//
// cocos2d::CCEGLView::clearQueuedInput from 0x180079170 to 0x180079486 (790 bytes)
//
// 3 xrefs:
// > cocos2d::CCEGLView::onGLFWWindowFocus @ 0x18007a66f
// > ??> @ 0x18014cf68
// > ??> @ 0x1801beb9c
//
// 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:21:59 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCEGLView::clearQueuedInput(cocos2d::CCEGLView *this)
{
struct cocos2d::CCDirector *v2; // rax
cocos2d::CCKeyboardDispatcher *v3; // rdi
void ***v4; // rax
_QWORD *v5; // rax
void ***v6; // rcx
void *v7; // rdx
__int64 v8; // rdx
__int64 v9; // rdx
__int64 v10; // rdx
__int64 v11; // rcx
__int64 v12; // rax
void **v13; // rcx
__int64 v14; // rbx
void **v15; // rax
void *v16; // rcx
void *Block[2]; // [rsp+30h] [rbp-30h] BYREF
__int64 v18; // [rsp+40h] [rbp-20h]
__int128 v19; // [rsp+48h] [rbp-18h]
LARGE_INTEGER PerformanceCount; // [rsp+70h] [rbp+10h] BYREF
LARGE_INTEGER v21; // [rsp+78h] [rbp+18h] BYREF
v2 = cocos2d::CCDirector::sharedDirector();
v3 = (cocos2d::CCKeyboardDispatcher *)(*(__int64 (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v2 + 176LL))(v2);
if ( !byte_1801B2530 )
{
QueryPerformanceFrequency(&Frequency);
byte_1801B2530 = 1;
}
QueryPerformanceCounter(&PerformanceCount);
cocos2d::CCKeyboardDispatcher::releaseAllKeys(
v3,
(double)(int)PerformanceCount.LowPart / (double)(int)Frequency.LowPart);
cocos2d::CCKeyboardDispatcher::updateModifierKeys(v3, 0, 0, 0, 0);
if ( *((_BYTE *)this + 176) )
{
*((_BYTE *)this + 176) = 0;
PerformanceCount.LowPart = 0;
if ( !byte_1801B2530 )
{
QueryPerformanceFrequency(&Frequency);
byte_1801B2530 = 1;
}
QueryPerformanceCounter(&v21);
(*(void (__fastcall **)(cocos2d::CCEGLView *, __int64, LARGE_INTEGER *, char *, char *, double))(*(_QWORD *)this + 160LL))(
this,
1,
&PerformanceCount,
(char *)this + 224,
(char *)this + 228,
(double)(int)v21.LowPart / (double)(int)Frequency.LowPart);
}
*(_OWORD *)Block = 0;
v18 = 0;
v19 = 0;
v4 = (void ***)sub_1800E4AC0(0x10u);
v4[1] = nullptr;
Block[0] = v4;
*v4 = Block;
if ( Mtx_lock((_Mtx_t)&unk_1801B2588) )
{
std::_Throw_Cpp_error(5);
JUMPOUT(0x180079485LL);
}
if ( dword_1801B25D4 == 0x7FFFFFFF )
{
dword_1801B25D4 = 2147483646;
std::_Throw_Cpp_error(6);
__debugbreak();
}
v5 = Block[0];
v6 = (void ***)qword_1801B25D8;
Block[0] = qword_1801B25D8;
qword_1801B25D8 = v5;
if ( Block[0] )
{
*v6 = Block;
v5 = qword_1801B25D8;
}
if ( v5 )
*v5 = &qword_1801B25D8;
v7 = Block[1];
Block[1] = (void *)qword_1801B25E0;
qword_1801B25E0 = (__int64)v7;
v8 = v18;
v18 = qword_1801B25E8;
qword_1801B25E8 = v8;
v9 = v19;
*(_QWORD *)&v19 = qword_1801B25F0;
qword_1801B25F0 = v9;
v10 = *((_QWORD *)&v19 + 1);
*((_QWORD *)&v19 + 1) = qword_1801B25F8;
qword_1801B25F8 = v10;
Mtx_unlock((_Mtx_t)&unk_1801B2588);
if ( hWnd )
PostMessageA(hWnd, 0x8001u, 0, 0);
dword_1801B2570 = 0;
dword_1801B2574 = 0;
v11 = *((_QWORD *)&v19 + 1);
if ( *((_QWORD *)&v19 + 1) )
{
do
{
v12 = v11--;
if ( v12 == 1 )
*(_QWORD *)&v19 = 0;
}
while ( v11 );
*((_QWORD *)&v19 + 1) = 0;
}
v13 = (void **)Block[1];
if ( Block[1] )
{
v14 = v18;
if ( v18 > 0 )
{
do
{
if ( v13[--v14] )
{
j_j_free_0(v13[v14]);
v13 = (void **)Block[1];
}
}
while ( v14 > 0 );
v14 = v18;
}
v15 = v13;
if ( (unsigned __int64)(8 * v14) >= 0x1000 )
{
v13 = (void **)*(v13 - 1);
if ( (unsigned __int64)((char *)v15 - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v13);
Block[1] = nullptr;
v18 = 0;
}
v16 = Block[0];
Block[0] = nullptr;
j_j_free_0(v16);
}