//
// cocos2d::CCKeyboardDispatcher::dispatchToTopDelegate from 0xdb2e54 to 0xdb2f8c (312 bytes)
//
// 3 xrefs:
// > cocos2d::CCKeyboardDispatcher::releaseAllKeys @ 0xdb30a4
// > cocos2d::CCKeyboardDispatcher::dispatchKeyboardMSG @ 0xdb3eb8
// > ??> @ 0x89908
//
// 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:08:40 +0000
//
cocos2d::CCKeyboardHandler *__fastcall cocos2d::CCKeyboardDispatcher::dispatchToTopDelegate(
__int64 a1,
unsigned int a2,
unsigned __int8 a3,
__int64 a4,
double a5)
{
unsigned int v8; // w22
cocos2d::CCKeyboardHandler *result; // x0
__int64 Delegate; // x21
__int64 v12; // x2
int v13; // w24
unsigned __int64 v14; // x19
__int64 v15; // x1
v8 = a3;
result = (cocos2d::CCKeyboardHandler *)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 56));
if ( !(_DWORD)result )
return result;
result = (cocos2d::CCKeyboardHandler *)cocos2d::CCArray::lastObject(*(cocos2d::CCArray **)(a1 + 56));
if ( !result )
return result;
Delegate = cocos2d::CCKeyboardHandler::getDelegate(result);
v12 = *(_QWORD *)(a4 + 8);
v13 = 0;
result = *(cocos2d::CCKeyboardHandler **)a4;
v14 = 0;
if ( !((v12 - *(_QWORD *)a4) >> 2) )
goto LABEL_11;
do
{
while ( 1 )
{
v15 = *((unsigned int *)result + v14);
if ( (_DWORD)v15 )
break;
LABEL_6:
if ( ++v14 >= (v12 - (__int64)result) >> 2 )
goto LABEL_10;
}
if ( (*(unsigned __int8 (__fastcall **)(__int64, __int64, _QWORD, double))(*(_QWORD *)Delegate + 16LL))(
Delegate,
v15,
v8,
a5) )
{
result = *(cocos2d::CCKeyboardHandler **)a4;
v13 = 1;
v12 = *(_QWORD *)(a4 + 8);
goto LABEL_6;
}
result = *(cocos2d::CCKeyboardHandler **)a4;
++v14;
v12 = *(_QWORD *)(a4 + 8);
}
while ( v14 < (v12 - *(_QWORD *)a4) >> 2 );
LABEL_10:
if ( !v13 )
{
LABEL_11:
if ( v8 )
return (cocos2d::CCKeyboardHandler *)(**(__int64 (__fastcall ***)(__int64, _QWORD, double))Delegate)(
Delegate,
a2,
a5);
else
return (cocos2d::CCKeyboardHandler *)(*(__int64 (__fastcall **)(__int64, _QWORD, double))(*(_QWORD *)Delegate + 8LL))(
Delegate,
a2,
a5);
}
return result;
}