//
// cocos2d::CCKeypadDispatcher::dispatchKeypadMSG from 0x7d20e6 to 0x7d21ac (198 bytes)
//
// 2 xrefs:
// > cocos2d::CCLayer::keyDown @ 0x7d75e8
// > Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown @ 0x7ee0dc
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:00:35 +0000
//
int __fastcall cocos2d::CCKeypadDispatcher::dispatchKeypadMSG(int a1, int a2)
{
int v4; // r0
unsigned int v5; // r5
cocos2d::CCArray *v6; // r0
int v7; // r3
unsigned int v8; // r5
int v9; // r6
cocos2d::CCArray *v10; // r8
int v11; // r0
cocos2d::CCKeypadHandler *v12; // r0
void (***Delegate)(void); // r0
void (*v14)(void); // r3
unsigned int *v15; // r0
cocos2d::CCKeypadDelegate *v16; // r1
unsigned int v17; // r5
unsigned int *v18; // r0
cocos2d::CCKeypadDelegate *v19; // r1
v4 = cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)a1);
v5 = *(unsigned __int8 *)(v4 + 140);
if ( *(_BYTE *)(v4 + 140) )
return 1;
v6 = *(cocos2d::CCArray **)(a1 + 52);
*(_BYTE *)(a1 + 56) = 1;
if ( cocos2d::CCArray::count(v6) )
{
v9 = v5;
while ( v5 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 52)) )
{
v10 = *(cocos2d::CCArray **)(a1 + 52);
v11 = cocos2d::CCArray::count(v10);
v12 = (cocos2d::CCKeypadHandler *)cocos2d::CCArray::objectAtIndex(v10, ~v5 + v11);
if ( !v12 || v9 )
break;
Delegate = (void (***)(void))cocos2d::CCKeypadHandler::getDelegate(v12);
if ( a2 == 1 )
{
v14 = **Delegate;
}
else
{
if ( a2 != 2 )
goto LABEL_14;
v14 = (*Delegate)[1];
}
v14();
v9 = 1;
LABEL_14:
++v5;
}
}
v7 = *(unsigned __int8 *)(a1 + 58);
v8 = 0;
*(_BYTE *)(a1 + 56) = 0;
if ( v7 )
{
*(_BYTE *)(a1 + 58) = 0;
while ( 1 )
{
v15 = *(unsigned int **)(a1 + 64);
if ( v8 >= *v15 )
break;
v16 = *(cocos2d::CCKeypadDelegate **)(v15[3] + 4 * v8++);
cocos2d::CCKeypadDispatcher::forceRemoveDelegate((cocos2d::CCKeypadDelegate *)a1, v16);
}
cocos2d::ccCArrayRemoveAllValues();
}
if ( *(_BYTE *)(a1 + 57) )
{
v17 = 0;
*(_BYTE *)(a1 + 57) = 0;
while ( 1 )
{
v18 = *(unsigned int **)(a1 + 60);
if ( v17 >= *v18 )
break;
v19 = *(cocos2d::CCKeypadDelegate **)(v18[3] + 4 * v17++);
cocos2d::CCKeypadDispatcher::forceAddDelegate((cocos2d::CCArray **)a1, v19);
}
cocos2d::ccCArrayRemoveAllValues();
}
return 1;
}