//
// cocos2d::CCKeypadDispatcher::dispatchKeypadMSG from 0xd540ac to 0xd54228 (380 bytes)
//
// 4 xrefs:
// > cocos2d::CCLayer::keyDown @ 0xd5c874
// > Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown @ 0xd81a30
// > Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown @ 0xd81a54
// > ??> @ 0x58de0
//
// This function is hookable on this platform (idp: arm, 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 13:07:42 +0000
//
__int64 __fastcall cocos2d::CCKeypadDispatcher::dispatchKeypadMSG(__int64 a1, int a2)
{
cocos2d::CCArray *v5; // x0
unsigned int v6; // w20
int v7; // w23
cocos2d::CCArray *v8; // x21
int v9; // w0
cocos2d::CCKeypadHandler *v10; // x0
__int64 Delegate; // x0
int v12; // w0
__int64 v13; // x0
unsigned int v14; // w20
cocos2d::CCKeypadDelegate *v15; // x1
__int64 v16; // x0
unsigned int v17; // w20
cocos2d::CCKeypadDelegate *v18; // x1
if ( *(_BYTE *)(cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)a1) + 176) )
return 1;
v5 = *(cocos2d::CCArray **)(a1 + 56);
*(_BYTE *)(a1 + 64) = 1;
if ( (unsigned int)cocos2d::CCArray::count(v5) )
{
v6 = 0;
v7 = 0;
while ( v6 < (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 56)) )
{
v8 = *(cocos2d::CCArray **)(a1 + 56);
v9 = cocos2d::CCArray::count(v8);
v10 = (cocos2d::CCKeypadHandler *)cocos2d::CCArray::objectAtIndex(v8, v9 + ~v6);
if ( v7 || !v10 )
break;
Delegate = cocos2d::CCKeypadHandler::getDelegate(v10);
if ( a2 == 1 )
{
v7 = 1;
++v6;
(**(void (__fastcall ***)(__int64))Delegate)(Delegate);
}
else
{
if ( a2 == 2 )
{
v7 = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)Delegate + 8LL))(Delegate);
}
++v6;
}
}
}
v12 = *(unsigned __int8 *)(a1 + 66);
*(_BYTE *)(a1 + 64) = 0;
if ( v12 )
{
v16 = *(_QWORD *)(a1 + 80);
*(_BYTE *)(a1 + 66) = 0;
if ( *(_DWORD *)v16 )
{
v17 = 0;
do
{
v18 = *(cocos2d::CCKeypadDelegate **)(*(_QWORD *)(v16 + 16) + 8LL * v17++);
cocos2d::CCKeypadDispatcher::forceRemoveDelegate((cocos2d::CCKeypadDelegate *)a1, v18);
v16 = *(_QWORD *)(a1 + 80);
}
while ( *(_DWORD *)v16 > v17 );
}
cocos2d::ccCArrayRemoveAllValues();
}
if ( !*(_BYTE *)(a1 + 65) )
return 1;
v13 = *(_QWORD *)(a1 + 72);
*(_BYTE *)(a1 + 65) = 0;
if ( *(_DWORD *)v13 )
{
v14 = 0;
do
{
v15 = *(cocos2d::CCKeypadDelegate **)(*(_QWORD *)(v13 + 16) + 8LL * v14++);
cocos2d::CCKeypadDispatcher::forceAddDelegate((cocos2d::CCArray **)a1, v15);
v13 = *(_QWORD *)(a1 + 72);
}
while ( *(_DWORD *)v13 > v14 );
}
cocos2d::ccCArrayRemoveAllValues();
return 1;
}