//
// sub_1800DAFF0 from 0x1800daff0 to 0x1800db1c8 (472 bytes)
//
// 2 xrefs:
// > sub_1800D39B0 @ 0x1800d3a3d
// > ??> @ 0x1801bac68
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
unsigned int __fastcall sub_1800DAFF0(__int64 a1, __int64 a2)
{
__int128 *v5; // rax
_BYTE *v6; // rcx
__int64 v7; // rdx
__int64 v8; // r9
__int128 v9; // xmm0
__int128 *v10; // rax
char *v11; // rcx
__int64 v12; // r9
__int128 v13; // xmm0
__int128 *v14; // rcx
char *v15; // rax
__int128 v16; // xmm0
HDC DCW; // rbx
_BYTE Ramp[512]; // [rsp+20h] [rbp-618h] BYREF
char v19; // [rsp+220h] [rbp-418h] BYREF
char v20; // [rsp+420h] [rbp-218h] BYREF
if ( *(_DWORD *)(a2 + 24) != 256 )
return (unsigned int)sub_1800D3530(0x10008u, "Win32: Gamma ramp size must be 256", a2);
v5 = *(__int128 **)a2;
v6 = Ramp;
v7 = 4;
v8 = 4;
do
{
v6 += 128;
v9 = *v5;
v5 += 8;
*((_OWORD *)v6 - 8) = v9;
*((_OWORD *)v6 - 7) = *(v5 - 7);
*((_OWORD *)v6 - 6) = *(v5 - 6);
*((_OWORD *)v6 - 5) = *(v5 - 5);
*((_OWORD *)v6 - 4) = *(v5 - 4);
*((_OWORD *)v6 - 3) = *(v5 - 3);
*((_OWORD *)v6 - 2) = *(v5 - 2);
*((_OWORD *)v6 - 1) = *(v5 - 1);
--v8;
}
while ( v8 );
v10 = *(__int128 **)(a2 + 8);
v11 = &v19;
v12 = 4;
do
{
v11 += 128;
v13 = *v10;
v10 += 8;
*((_OWORD *)v11 - 8) = v13;
*((_OWORD *)v11 - 7) = *(v10 - 7);
*((_OWORD *)v11 - 6) = *(v10 - 6);
*((_OWORD *)v11 - 5) = *(v10 - 5);
*((_OWORD *)v11 - 4) = *(v10 - 4);
*((_OWORD *)v11 - 3) = *(v10 - 3);
*((_OWORD *)v11 - 2) = *(v10 - 2);
*((_OWORD *)v11 - 1) = *(v10 - 1);
--v12;
}
while ( v12 );
v14 = *(__int128 **)(a2 + 16);
v15 = &v20;
do
{
v15 += 128;
v16 = *v14;
v14 += 8;
*((_OWORD *)v15 - 8) = v16;
*((_OWORD *)v15 - 7) = *(v14 - 7);
*((_OWORD *)v15 - 6) = *(v14 - 6);
*((_OWORD *)v15 - 5) = *(v14 - 5);
*((_OWORD *)v15 - 4) = *(v14 - 4);
*((_OWORD *)v15 - 3) = *(v14 - 3);
*((_OWORD *)v15 - 2) = *(v14 - 2);
*((_OWORD *)v15 - 1) = *(v14 - 1);
--v7;
}
while ( v7 );
DCW = CreateDCW(L"DISPLAY", (LPCWSTR)(a1 + 264), nullptr, nullptr);
SetDeviceGammaRamp(DCW, Ramp);
return DeleteDC(DCW);
}