//
// sub_1800D8360 from 0x1800d8360 to 0x1800d85bd (605 bytes)
//
// 4 xrefs:
// > cocos2d::CCEGLView::pollEvents @ 0x1800dc7b5
// > ??> @ 0x18014c15c
// > ??> @ 0x18014c16c
// > ??> @ 0x1801c4a10
//
// 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:33 +0000
//
__int16 sub_1800D8360()
{
_QWORD *v0; // rbx
HWND ActiveWindow; // rax
_BYTE *v2; // rbx
int v3; // edi
int v4; // eax
int v5; // edi
int v6; // eax
int v7; // edi
int v8; // eax
int v9; // edi
int v10; // eax
__int64 v11; // rbx
LONG bottom; // r8d
HWND v13; // rcx
struct tagMSG Msg; // [rsp+30h] [rbp-58h] BYREF
struct tagRECT Rect; // [rsp+60h] [rbp-28h] BYREF
while ( PeekMessageW(&Msg, nullptr, 0, 0, 1u) )
{
if ( Msg.message == 18 )
{
v0 = (_QWORD *)qword_1801B3FE0;
if ( qword_1801B3FE0 )
{
do
{
sub_1800DC010(v0);
v0 = (_QWORD *)*v0;
}
while ( v0 );
}
}
else
{
TranslateMessage(&Msg);
DispatchMessageW(&Msg);
}
}
ActiveWindow = GetActiveWindow();
if ( ActiveWindow )
{
ActiveWindow = (HWND)GetPropW(ActiveWindow, L"GLFW");
v2 = ActiveWindow;
if ( ActiveWindow )
{
v3 = word_1801B5970;
if ( GetKeyState(160) >= 0 && v2[476] == 1 )
{
v4 = sub_1800D9A80();
sub_1800DD1E0((_DWORD)v2, 340, v3, 0, v4);
}
v5 = word_1801B5978;
if ( GetKeyState(161) >= 0 && v2[480] == 1 )
{
v6 = sub_1800D9A80();
sub_1800DD1E0((_DWORD)v2, 344, v5, 0, v6);
}
v7 = word_1801B5976;
if ( GetKeyState(91) >= 0 && v2[479] == 1 )
{
v8 = sub_1800D9A80();
sub_1800DD1E0((_DWORD)v2, 343, v7, 0, v8);
}
v9 = word_1801B597E;
LOWORD(ActiveWindow) = GetKeyState(92);
if ( (__int16)ActiveWindow >= 0 && v2[483] == 1 )
{
v10 = sub_1800D9A80();
LOWORD(ActiveWindow) = sub_1800DD1E0((_DWORD)v2, 347, v9, 0, v10);
}
}
}
v11 = qword_1801B6068;
if ( qword_1801B6068 )
{
GetClientRect(*(HWND *)(qword_1801B6068 + 880), &Rect);
bottom = Rect.bottom;
if ( *(_DWORD *)(v11 + 936) != Rect.right / 2
|| (LODWORD(ActiveWindow) = Rect.bottom / 2, *(_DWORD *)(v11 + 940) != Rect.bottom / 2) )
{
v13 = *(HWND *)(v11 + 880);
Rect.left = Rect.right / 2;
*(_DWORD *)(v11 + 936) = Rect.right / 2;
Rect.top = bottom / 2;
*(_DWORD *)(v11 + 940) = bottom / 2;
ClientToScreen(v13, (LPPOINT)&Rect);
LOWORD(ActiveWindow) = SetCursorPos(Rect.left, Rect.top);
}
}
return (__int16)ActiveWindow;
}