//
// cocos2d::CCKeypadDispatcher::dispatchKeypadMSG from 0x1800b4420 to 0x1800b4591 (369 bytes)
//
// 6 xrefs:
// > cocos2d::CCLayer::keyDown @ 0x18005051e
// > cocos2d::CCApplication::updateControllerKeys @ 0x1800742e9
// > ??> @ 0x1801410c8
// > ??> @ 0x180141120
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b8868
//
// 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
//
char __fastcall cocos2d::CCKeypadDispatcher::dispatchKeypadMSG(
cocos2d::CCKeypadDispatcher *this,
enum cocos2d::ccKeypadMSGType a2)
{
cocos2d::CCArray *m_pDelegates; // rcx
__int64 v5; // rdi
int v6; // esi
char v7; // bp
int v8; // eax
struct cocos2d::CCString *v9; // rax
struct cocos2d::CCObject *Target; // rax
cocos2d::_ccCArray *m_pHandlersToRemove; // rcx
unsigned int v12; // esi
cocos2d::_ccCArray *m_pHandlersToAdd; // rax
struct cocos2d::CCKeypadHandler *v14; // rax
if ( cocos2d::CCDirector::sharedDirector()->m_bIsTransitioning )
return 1;
m_pDelegates = this->m_pDelegates;
this->m_bLocked = 1;
v5 = 0;
if ( (unsigned int)cocos2d::CCArray::count(m_pDelegates) )
{
v6 = 0;
v7 = 0;
if ( (unsigned int)cocos2d::CCArray::count(this->m_pDelegates) )
{
while ( 1 )
{
v8 = cocos2d::CCArray::count(this->m_pDelegates);
v9 = cocos2d::CCArray::stringAtIndex(this->m_pDelegates, v8 + -1 - v6);
if ( !v9 || v7 )
goto LABEL_12;
Target = cocos2d::CCNotificationObserver::getTarget((cocos2d::CCNotificationObserver *)v9);
if ( a2 == kTypeBackClicked )
break;
if ( a2 == kTypeMenuClicked )
{
((void (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCObject_vtbl *, struct cocos2d::CCObject *))Target->~CCObject)(
Target,
Target->__vftable,
Target);
LABEL_10:
v7 = 1;
}
if ( ++v6 >= (unsigned int)cocos2d::CCArray::count(this->m_pDelegates) )
goto LABEL_12;
}
((void (__fastcall *)(struct cocos2d::CCObject *, _QWORD))Target->copyWithZone)(Target, (unsigned int)(a2 - 1));
goto LABEL_10;
}
}
LABEL_12:
this->m_bLocked = 0;
if ( this->m_bToRemove )
{
m_pHandlersToRemove = this->m_pHandlersToRemove;
v12 = 0;
for ( this->m_bToRemove = 0; v12 < m_pHandlersToRemove->num; ++v12 )
{
cocos2d::CCMouseDispatcher::forceRemoveDelegate(
(cocos2d::CCMouseDispatcher *)this,
(struct cocos2d::CCObject *)m_pHandlersToRemove->arr[v12]);
m_pHandlersToRemove = this->m_pHandlersToRemove;
}
Concurrency::details::_NonReentrantLock::_Release((Concurrency::details::_NonReentrantLock *)m_pHandlersToRemove);
}
if ( this->m_bToAdd )
{
m_pHandlersToAdd = this->m_pHandlersToAdd;
this->m_bToAdd = 0;
if ( m_pHandlersToAdd->num )
{
do
{
v14 = cocos2d::CCKeypadHandler::handlerWithDelegate((cocos2d::CCObject_vtbl *)m_pHandlersToAdd->arr[v5]);
if ( v14 )
cocos2d::CCArray::addObject(this->m_pDelegates, v14);
m_pHandlersToAdd = this->m_pHandlersToAdd;
v5 = (unsigned int)(v5 + 1);
}
while ( (unsigned int)v5 < m_pHandlersToAdd->num );
}
Concurrency::details::_NonReentrantLock::_Release((Concurrency::details::_NonReentrantLock *)m_pHandlersToAdd);
}
return 1;
}