//
// cocos2d::CCEGLView::onGLFWWindowFocus from 0x180077880 to 0x180077b86 (774 bytes)
//
// 3 xrefs:
// > sub_180077B90 @ 0x180077ba5
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b4a10
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCEGLView::onGLFWWindowFocus(cocos2d::CCEGLView *this, struct GLFWwindow *a2, int a3)
{
__int64 v6; // rcx
void ***v7; // rax
_QWORD *v8; // rax
void ***v9; // rcx
void *v10; // rcx
__int64 v11; // rcx
__int64 v12; // rcx
__int64 v13; // rcx
__int64 v14; // rax
void **v15; // rcx
__int64 v16; // rbx
void **v17; // rax
void *v18; // rcx
HWND v19; // rax
void *v20; // [rsp+40h] [rbp-30h] BYREF
void *Block; // [rsp+48h] [rbp-28h]
__int64 v22; // [rsp+50h] [rbp-20h]
__int64 v23; // [rsp+58h] [rbp-18h]
__int64 v24; // [rsp+60h] [rbp-10h]
byte_1801A2BC0 = a3 != 0;
v6 = *((_QWORD *)this + 25);
if ( !v6 || a3 )
goto LABEL_27;
*((_BYTE *)this + 176) = 0;
if ( *((_BYTE *)this + 236) )
{
*((_BYTE *)this + 236) = 0;
sub_1800D5870(v6, 208897, 212993);
}
Block = nullptr;
v22 = 0;
v23 = 0;
v24 = 0;
v7 = (void ***)operator new(0x10u);
v7[1] = nullptr;
v20 = v7;
*v7 = &v20;
if ( Mtx_lock((_Mtx_t)&unk_1801A8558) )
goto LABEL_34;
if ( dword_1801A85A4 == 0x7FFFFFFF )
{
LABEL_35:
dword_1801A85A4 = 2147483646;
std::_Throw_Cpp_error(6);
JUMPOUT(0x180077B85LL);
}
v8 = v20;
v9 = (void ***)xmmword_1801A85A8;
v20 = xmmword_1801A85A8;
xmmword_1801A85A8 = v8;
if ( v20 )
{
*v9 = &v20;
v8 = xmmword_1801A85A8;
}
if ( v8 )
*v8 = &xmmword_1801A85A8;
v10 = Block;
Block = *(&xmmword_1801A85A8 + 1);
*(&xmmword_1801A85A8 + 1) = v10;
v11 = v22;
v22 = xmmword_1801A85B8;
*(_QWORD *)&xmmword_1801A85B8 = v11;
v12 = v23;
v23 = *((_QWORD *)&xmmword_1801A85B8 + 1);
*((_QWORD *)&xmmword_1801A85B8 + 1) = v12;
v13 = v24;
v24 = qword_1801A85C8;
qword_1801A85C8 = v13;
Mtx_unlock((_Mtx_t)&unk_1801A8558);
if ( Mtx_lock((_Mtx_t)&unk_1801A8558) )
{
LABEL_34:
std::_Throw_Cpp_error(5);
__debugbreak();
}
if ( dword_1801A85A4 == 0x7FFFFFFF )
goto LABEL_35;
sub_180076710((__int64)&dword_1801A85D0);
Mtx_unlock((_Mtx_t)&unk_1801A8558);
dword_1801A8540 = 0;
dword_1801A8544 = 0;
qword_1801A8548 = 0;
v14 = v24;
if ( v24 )
{
do
--v14;
while ( v14 );
v24 = 0;
v23 = 0;
}
v15 = (void **)Block;
if ( Block )
{
v16 = v22;
if ( v22 )
{
do
{
if ( v15[--v16] )
{
j_j_free_0(v15[v16]);
v15 = (void **)Block;
}
}
while ( v16 );
v16 = v22;
}
v17 = v15;
if ( (unsigned __int64)(8 * v16) >= 0x1000 )
{
v15 = (void **)*(v15 - 1);
if ( (unsigned __int64)((char *)v17 - (char *)v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v15);
}
v22 = 0;
Block = nullptr;
v18 = v20;
v20 = nullptr;
j_j_free_0(v18);
LABEL_27:
if ( *((_BYTE *)this + 232) && *((_BYTE *)this + 233) && *((_BYTE *)this + 234) )
{
v19 = (HWND)sub_1800D8320(a2);
if ( a3 )
{
SetWindowPos(v19, HWND_MESSAGE|0x2LL, 0, 0, 0, 0, 0x53u);
}
else
{
SetWindowPos(v19, (HWND)0xFFFFFFFFFFFFFFFELL, 0, 0, 0, 0, 0x13u);
*((_DWORD *)this + 47) = 2;
}
}
}