//
// StartAddress from 0x180074db0 to 0x180074f75 (453 bytes)
//
// 4 xrefs:
// > cocos2d::CCEGLView::setupWindow @ 0x180078b9d
// > ??> @ 0x18013bb54
// > ??> @ 0x18013bb64
// > ??> @ 0x1801b45f0
//
// 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
//
__int64 __fastcall StartAddress(LONG_PTR *a1)
{
LONG_PTR v1; // rbx
HWND Window; // rax
HWND v4; // rsi
HANDLE CurrentThread; // rax
RAWINPUTDEVICE pRawInputDevices; // [rsp+60h] [rbp-A8h] BYREF
int v8; // [rsp+70h] [rbp-98h]
int v9; // [rsp+74h] [rbp-94h]
HWND v10; // [rsp+78h] [rbp-90h]
WNDCLASSA WndClass; // [rsp+80h] [rbp-88h] BYREF
struct tagMSG Msg; // [rsp+D0h] [rbp-38h] BYREF
v1 = *a1;
WndClass.lpfnWndProc = (WNDPROC)sub_180075C50;
*(_QWORD *)&WndClass.style = 0;
*(_QWORD *)&WndClass.cbClsExtra = 0;
memset(&WndClass.hIcon, 0, 32);
WndClass.hInstance = GetModuleHandleA(nullptr);
WndClass.lpszClassName = "GD_RawInput";
RegisterClassA(&WndClass);
Window = CreateWindowExA(
0,
"GD_RawInput",
"GD Raw Input Window",
0,
0,
0,
0,
0,
HWND_MESSAGE,
nullptr,
WndClass.hInstance,
nullptr);
v4 = Window;
if ( Window )
{
*(_QWORD *)(v1 + 48) = Window;
SetWindowLongPtrA(Window, -21, v1);
*(_DWORD *)&pRawInputDevices.usUsagePage = 131073;
pRawInputDevices.dwFlags = 256;
pRawInputDevices.hwndTarget = v4;
v8 = 393217;
v9 = 256;
v10 = v4;
if ( RegisterRawInputDevices(&pRawInputDevices, 2u, 0x10u) )
{
CurrentThread = GetCurrentThread();
SetThreadPriority(CurrentThread, 2);
while ( *(_BYTE *)(v1 + 8) )
{
if ( GetMessageA(&Msg, v4, 0, 0) <= 0 )
break;
DispatchMessageA(&Msg);
}
}
else
{
*(_BYTE *)(v1 + 8) = 0;
}
DestroyWindow(v4);
*(_QWORD *)(v1 + 48) = 0;
}
else
{
*(_BYTE *)(v1 + 8) = 0;
}
Cnd_do_broadcast_at_thread_exit();
j_j_free_0(a1);
return 0;
}