//
// cocos2d::CCTouchDispatcher::forceAddHandler from 0xdb1718 to 0xdb17fc (228 bytes)
//
// 5 xrefs:
// > cocos2d::CCTouchDispatcher::addStandardDelegate @ 0xdb1894
// > cocos2d::CCTouchDispatcher::addTargetedDelegate @ 0xdb192c
// > cocos2d::CCTouchDispatcher::touches @ 0xdb1f28
// > cocos2d::CCTouchDispatcher::touches @ 0xdb225c
// > ??> @ 0xf3340
//
// 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:39 +0000
//
__int64 __fastcall cocos2d::CCTouchDispatcher::forceAddHandler(
cocos2d::CCTouchDispatcher *this,
cocos2d::CCTouchHandler *a2,
cocos2d::CCArray *a3)
{
unsigned int *v5; // x1
cocos2d::CCTouchHandler **v6; // x19
__int64 v7; // x0
char *v8; // x23
cocos2d::CCTouchHandler *v9; // x20
int v10; // w22
int Priority; // w24
__int64 Delegate; // x20
__int64 result; // x0
if ( !a3 )
return cocos2d::CCArray::insertObject(a3, a2);
v5 = *((unsigned int **)a3 + 7);
if ( !*v5 )
return cocos2d::CCArray::insertObject(a3, a2);
v6 = *((cocos2d::CCTouchHandler ***)v5 + 2);
v7 = 8LL * *v5 - 8;
v8 = (char *)v6 + v7;
if ( v6 > (cocos2d::CCTouchHandler **)((char *)v6 + v7) )
return cocos2d::CCArray::insertObject(a3, a2);
v9 = *v6;
v10 = 0;
if ( !*v6 )
return cocos2d::CCArray::insertObject(a3, a2);
while ( 1 )
{
++v6;
Priority = cocos2d::CCTouchHandler::getPriority(v9);
if ( Priority < (int)cocos2d::CCTouchHandler::getPriority(a2) )
++v10;
Delegate = cocos2d::CCTouchHandler::getDelegate(v9);
result = cocos2d::CCTouchHandler::getDelegate(a2);
if ( Delegate == result )
break;
if ( v8 >= (char *)v6 )
{
v9 = *v6;
if ( *v6 )
continue;
}
return cocos2d::CCArray::insertObject(a3, a2);
}
return result;
}