//
// cocos2d::CCEGLView::pumpRawInput from 0x180078060 to 0x180078654 (1524 bytes)
//
// 3 xrefs:
// > cocos2d::CCApplication::run @ 0x1800737cf
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b4a64
//
// 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::pumpRawInput(cocos2d::CCEGLView *this)
{
char v2; // di
__int64 v3; // rcx
HWND v4; // rbx
HWND v5; // rax
bool v6; // bl
int v7; // eax
int v8; // ecx
double v9; // r14
float x; // xmm0_4
float y; // xmm1_4
__int64 v12; // rcx
HWND v13; // rbx
float v14; // xmm0_4
float v15; // xmm1_4
float v16; // xmm2_4
double v17; // xmm1_8
void ***v18; // rax
_QWORD *v19; // rax
void ***v20; // rcx
void *v21; // rdx
__int64 v22; // rdx
__int64 v23; // rdx
__int64 v24; // rdx
__int64 v25; // r12
__int64 v26; // r14
__int64 v27; // xmm6_8
enum cocos2d::enumKeyCodes v28; // r15d
bool v29; // di
char v30; // r13
bool v31; // bl
struct cocos2d::CCDirector *v32; // rax
char v33; // bl
cocos2d::CCIMEDispatcher *v34; // rax
bool hasDelegate; // di
cocos2d::CCIMEDispatcher *v36; // rax
cocos2d::CCIMEDispatcher *v37; // rax
cocos2d::CCIMEDispatcher *v38; // rax
cocos2d::CCRect *ViewPortRect; // rax
const struct cocos2d::CCPoint *v40; // rbx
cocos2d::CCRect *v41; // rax
char v42; // al
void *v43; // rcx
void *Block[2]; // [rsp+30h] [rbp-59h] BYREF
__int128 v45; // [rsp+40h] [rbp-49h]
__int64 v46; // [rsp+50h] [rbp-39h]
int v47; // [rsp+58h] [rbp-31h] BYREF
int v48; // [rsp+5Ch] [rbp-2Dh] BYREF
struct tagPOINT v49; // [rsp+60h] [rbp-29h] BYREF
struct tagPOINT Point; // [rsp+68h] [rbp-21h] BYREF
cocos2d::CCKeyboardDispatcher *v51; // [rsp+70h] [rbp-19h]
__int64 i; // [rsp+78h] [rbp-11h]
float v53[4]; // [rsp+80h] [rbp-9h] BYREF
bool v54; // [rsp+F0h] [rbp+67h]
char v55; // [rsp+F8h] [rbp+6Fh]
char v56; // [rsp+100h] [rbp+77h] BYREF
int v57; // [rsp+108h] [rbp+7Fh] BYREF
v2 = byte_1801A2BC0;
v55 = byte_1801A2BC0;
v3 = *((_QWORD *)this + 25);
if ( v3 )
v4 = (HWND)sub_1800D8320(v3);
else
v4 = nullptr;
v6 = true;
if ( !v2 && (!v4 || !GetCursorPos(&Point) || (v5 = WindowFromPoint(Point)) == nullptr || GetAncestor(v5, 2u) != v4) )
v6 = false;
v54 = v6;
v7 = _InterlockedExchange(&dword_1801A8540, 0);
v8 = _InterlockedExchange(&dword_1801A8544, 0);
v9 = COERCE_DOUBLE(_InterlockedExchange64(&qword_1801A8548, 0));
if ( !v6 )
goto LABEL_27;
if ( *((_BYTE *)this + 236) )
{
x = (float)v7 + *((float *)this + 56);
y = (float)v8 + *((float *)this + 57);
}
else
{
v12 = *((_QWORD *)this + 25);
if ( !v12 )
goto LABEL_19;
v13 = (HWND)sub_1800D8320(v12);
if ( !GetCursorPos(&v49) || !ScreenToClient(v13, &v49) )
goto LABEL_19;
x = (float)v49.x;
y = (float)v49.y;
}
*((float *)this + 57) = y;
*((float *)this + 56) = x;
LABEL_19:
v14 = *((float *)this + 48);
v15 = *((float *)this + 56) / v14;
*((float *)this + 56) = v15;
v16 = *((float *)this + 57) / v14;
*((float *)this + 57) = v16;
if ( *((_BYTE *)this + 178) && *((_DWORD *)this + 45) == 1 )
{
*((float *)this + 56) = v15 + v15;
*((float *)this + 57) = v16 + v16;
}
if ( *((_BYTE *)this + 176) )
{
v17 = v9;
if ( v9 == 0.0 )
v17 = sub_180076BE0();
v57 = 0;
((void (__fastcall *)(cocos2d::CCEGLView *, __int64, int *, char *, char *, _QWORD))this->handleTouchesMove)(
this,
1,
&v57,
(char *)this + 224,
(char *)this + 228,
*(_QWORD *)&v17);
}
v2 = v55;
v6 = v54;
LABEL_27:
*(_OWORD *)Block = 0;
v45 = 0;
v46 = 0;
v18 = (void ***)operator new(0x10u);
v18[1] = nullptr;
Block[0] = v18;
*v18 = Block;
if ( Mtx_lock((_Mtx_t)&unk_1801A8558) )
{
std::_Throw_Cpp_error(5);
JUMPOUT(0x180078653LL);
}
if ( dword_1801A85A4 == 0x7FFFFFFF )
{
dword_1801A85A4 = 2147483646;
std::_Throw_Cpp_error(6);
__debugbreak();
}
v19 = Block[0];
v20 = (void ***)xmmword_1801A85A8;
Block[0] = xmmword_1801A85A8;
xmmword_1801A85A8 = v19;
if ( Block[0] )
{
*v20 = Block;
v19 = xmmword_1801A85A8;
}
if ( v19 )
*v19 = &xmmword_1801A85A8;
v21 = Block[1];
Block[1] = *(&xmmword_1801A85A8 + 1);
*(&xmmword_1801A85A8 + 1) = v21;
v22 = v45;
*(_QWORD *)&v45 = xmmword_1801A85B8;
*(_QWORD *)&xmmword_1801A85B8 = v22;
v23 = *((_QWORD *)&v45 + 1);
*((_QWORD *)&v45 + 1) = *((_QWORD *)&xmmword_1801A85B8 + 1);
*((_QWORD *)&xmmword_1801A85B8 + 1) = v23;
v24 = v46;
v46 = qword_1801A85C8;
qword_1801A85C8 = v24;
Mtx_unlock((_Mtx_t)&unk_1801A8558);
v25 = *((_QWORD *)&v45 + 1);
for ( i = *((_QWORD *)&v45 + 1) + v46; v25 != i; v2 = v55 )
{
v26 = *((_QWORD *)Block[1] + (v25 & (v45 - 1)));
v27 = *(_QWORD *)(v26 + 8);
if ( *(_BYTE *)v26 )
{
if ( *(_BYTE *)v26 == 1 && v6 && !*(_DWORD *)(v26 + 24) )
{
if ( *(_BYTE *)(v26 + 20) )
{
ViewPortRect = (cocos2d::CCRect *)cocos2d::CCEGLViewProtocol::getViewPortRect(this);
if ( cocos2d::CCRect::equals(ViewPortRect, &unk_1801A8508)
|| (v40 = (const struct cocos2d::CCPoint *)kmVec2Fill(v53, *((float *)this + 56), *((float *)this + 57)),
v41 = (cocos2d::CCRect *)cocos2d::CCEGLViewProtocol::getViewPortRect(this),
cocos2d::CCRect::containsPoint(v41, v40))
|| *((_BYTE *)this + 236) )
{
*((_BYTE *)this + 176) = 1;
v47 = 0;
((void (__fastcall *)(cocos2d::CCEGLView *, __int64, int *, char *, char *, __int64))this->handleTouchesBegin)(
this,
1,
&v47,
(char *)this + 224,
(char *)this + 228,
v27);
}
}
else if ( *((_BYTE *)this + 176) )
{
*((_BYTE *)this + 176) = 0;
v48 = 0;
((void (__fastcall *)(cocos2d::CCEGLView *, __int64, int *, char *, char *, __int64))this->handleTouchesEnd)(
this,
1,
&v48,
(char *)this + 224,
(char *)this + 228,
v27);
}
}
}
else if ( v2 )
{
v28 = (unsigned int)cocos2d::CCKeyboardDispatcher::convertKeyCode(*(_DWORD *)(v26 + 16));
v29 = GetKeyState(16) < 0;
v30 = GetKeyState(17) < 0;
v31 = GetKeyState(18) < 0;
v32 = cocos2d::CCDirector::sharedDirector();
v51 = (cocos2d::CCKeyboardDispatcher *)((__int64 (__fastcall *)(struct cocos2d::CCDirector *))v32->getKeyboardDispatcher)(v32);
cocos2d::CCKeyboardDispatcher::updateModifierKeys(v51, v29, v30, v31, 0);
v33 = *(_BYTE *)(v26 + 20) || *(_BYTE *)(v26 + 21);
v34 = cocos2d::CCIMEDispatcher::sharedDispatcher();
hasDelegate = cocos2d::CCIMEDispatcher::hasDelegate(v34);
if ( hasDelegate && v33 )
{
if ( ((v28 - 37) & 0xFFFFFFFD) != 0 )
{
if ( v28 == KEY_Delete )
{
v36 = cocos2d::CCIMEDispatcher::sharedDispatcher();
cocos2d::CCIMEDispatcher::dispatchDeleteForward(v36);
}
}
else
{
v56 = 97;
v37 = cocos2d::CCIMEDispatcher::sharedDispatcher();
cocos2d::CCIMEDispatcher::dispatchInsertText(v37, &v56, 1, v28);
}
}
if ( *(_DWORD *)(v26 + 16) == 8 && v33 )
{
v38 = cocos2d::CCIMEDispatcher::sharedDispatcher();
cocos2d::CCIMEDispatcher::dispatchDeleteBackward(v38);
}
if ( !hasDelegate || v28 == KEY_Escape || v28 == KEY_Enter )
cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG(v51, v28, v33, *(_BYTE *)(v26 + 21));
if ( *(_BYTE *)(v26 + 20) && !*(_BYTE *)(v26 + 21) && v28 == KEY_V && v30 )
byte_1801A8518 = 1;
}
++v25;
v6 = v54;
}
if ( v55 )
{
v42 = byte_1801A8518;
byte_1801A8518 = 0;
if ( v42 )
cocos2d::CCEGLView::performSafeClipboardPaste(this);
}
sub_180076360(Block);
v43 = Block[0];
Block[0] = nullptr;
j_j_free_0(v43);
}