//
// sub_1800E3490 from 0x1800e3490 to 0x1800e3624 (404 bytes)
//
// 4 xrefs:
// > sub_1800D90E0 @ 0x1800d9152
// > ??> @ 0x18014c944
// > ??> @ 0x18014c954
// > ??> @ 0x1801c5310
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:22:37 +0000
//
int __fastcall sub_1800E3490(__int64 a1, int *a2)
{
DWORD *v3; // rdi
int result; // eax
DWORD v5; // edx
const char *v6; // r8
int v7[8]; // [rsp+30h] [rbp-118h] BYREF
DEVMODEW DevMode; // [rsp+50h] [rbp-F8h] BYREF
v3 = sub_1800DB8C0(a1, a2);
sub_1800E2C50(a1, v7);
result = sub_1800DBAF0(v7, v3);
if ( result )
{
memset(&DevMode, 0, sizeof(DevMode));
DevMode.dmSize = 220;
DevMode.dmFields = 6029312;
DevMode.dmPelsWidth = *v3;
DevMode.dmPelsHeight = v3[1];
v5 = v3[2] + v3[3] + v3[4];
DevMode.dmBitsPerPel = v5;
DevMode.dmDisplayFrequency = v3[5];
if ( v5 - 15 > 8 )
v5 = 32;
DevMode.dmBitsPerPel = v5;
result = ChangeDisplaySettingsExW((LPCWSTR)(a1 + 264), &DevMode, nullptr, 4u, nullptr);
if ( result )
{
switch ( result )
{
case -6:
v6 = "The system uses DualView";
break;
case -4:
v6 = "Invalid flags";
break;
case -2:
v6 = "Graphics mode not supported";
break;
case -5:
v6 = "Invalid parameter";
break;
case -1:
v6 = "Graphics mode failed";
break;
case -3:
v6 = "Failed to write to registry";
break;
default:
v6 = "Computer restart required";
if ( result != 1 )
v6 = "Unknown error";
break;
}
return (unsigned int)sub_1800DB260(0x10008u, "Win32: Failed to set video mode: %s", v6);
}
else
{
*(_DWORD *)(a1 + 460) = 1;
}
}
return result;
}