//
// cocos2d::CCKeypadDispatcher::dispatchKeypadMSG from 0x1800b8160 to 0x1800b82ce (366 bytes)
//
// 6 xrefs:
// > cocos2d::CCLayer::keyDown @ 0x180052341
// > cocos2d::CCApplication::updateControllerKeys @ 0x180076f7d
// > ??> @ 0x18014a464
// > ??> @ 0x18014a4bc
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c2b5c
//
// 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:22:22 +0000
//
char __fastcall cocos2d::CCKeypadDispatcher::dispatchKeypadMSG(__int64 a1, int a2)
{
cocos2d::CCArray *v4; // rcx
__int64 v5; // rdi
int v6; // esi
char v7; // bp
int v8; // eax
cocos2d::CCNotificationObserver *v9; // rax
struct cocos2d::CCObject *Target; // rax
Concurrency::details::_NonReentrantLock *v11; // rcx
unsigned int v12; // esi
Concurrency::details::_NonReentrantLock *v13; // rcx
struct cocos2d::CCObject *v14; // rax
if ( *((_BYTE *)cocos2d::CCDirector::sharedDirector() + 176) )
return 1;
v4 = *(cocos2d::CCArray **)(a1 + 56);
*(_BYTE *)(a1 + 64) = 1;
v5 = 0;
if ( (unsigned int)cocos2d::CCArray::count(v4) )
{
v6 = 0;
v7 = 0;
if ( (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 56)) )
{
while ( 1 )
{
v8 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 56));
v9 = cocos2d::CCArray::stringAtIndex(*(cocos2d::CCArray **)(a1 + 56), v8 + ~v6);
if ( !v9 || v7 )
goto LABEL_12;
Target = cocos2d::CCNotificationObserver::getTarget(v9);
if ( a2 == 1 )
break;
if ( a2 == 2 )
{
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD, struct cocos2d::CCObject *))(*(_QWORD *)Target
+ 8LL))(
Target,
*(_QWORD *)(*(_QWORD *)Target + 8LL),
Target);
LABEL_10:
v7 = 1;
}
if ( ++v6 >= (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 56)) )
goto LABEL_12;
}
(**(void (__fastcall ***)(struct cocos2d::CCObject *, _QWORD))Target)(Target, (unsigned int)(a2 - 1));
goto LABEL_10;
}
}
LABEL_12:
*(_BYTE *)(a1 + 64) = 0;
if ( *(_BYTE *)(a1 + 66) )
{
v11 = *(Concurrency::details::_NonReentrantLock **)(a1 + 80);
v12 = 0;
for ( *(_BYTE *)(a1 + 66) = 0; v12 < *(_DWORD *)v11; ++v12 )
{
cocos2d::CCMouseDispatcher::forceRemoveDelegate(
(cocos2d::CCMouseDispatcher *)a1,
*(struct cocos2d::CCMouseDelegate **)(*((_QWORD *)v11 + 2) + 8LL * v12));
v11 = *(Concurrency::details::_NonReentrantLock **)(a1 + 80);
}
Concurrency::details::_NonReentrantLock::_Release(v11);
}
if ( *(_BYTE *)(a1 + 65) )
{
v13 = *(Concurrency::details::_NonReentrantLock **)(a1 + 72);
*(_BYTE *)(a1 + 65) = 0;
if ( *(_DWORD *)v13 )
{
do
{
v14 = cocos2d::CCKeypadHandler::handlerWithDelegate(*(struct cocos2d::CCKeypadDelegate **)(*((_QWORD *)v13 + 2)
+ 8 * v5));
if ( v14 )
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 56), v14);
v13 = *(Concurrency::details::_NonReentrantLock **)(a1 + 72);
v5 = (unsigned int)(v5 + 1);
}
while ( (unsigned int)v5 < *(_DWORD *)v13 );
}
Concurrency::details::_NonReentrantLock::_Release(v13);
}
return 1;
}