//
// cocos2d::CCTouchDispatcher::forceAddHandler from 0x1001cda2c to 0x1001cdb00 (212 bytes)
//
// 3 xrefs:
// > cocos2d::CCTouchDispatcher::addTargetedDelegate @ 0x1001cd9f8
// > cocos2d::CCTouchDispatcher::addStandardDelegate @ 0x1001cdb6c
// > cocos2d::CCTouchDispatcher::touches @ 0x1001ce1dc
//
// 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 11:00:21 +0000
//
__int64 __fastcall cocos2d::CCTouchDispatcher::forceAddHandler(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int *v5; // x9
__int64 v6; // x8
__int64 v7; // x21
__int64 *v8; // x25
unsigned __int64 v9; // x26
__int64 v10; // x23
int Priority; // w22
int v12; // w24
__int64 Delegate; // x23
__int64 result; // x0
if ( a3 && (v5 = *(unsigned int **)(a3 + 56), v6 = *v5, (_DWORD)v6) )
{
v7 = 0;
v8 = *((__int64 **)v5 + 2);
v9 = (unsigned __int64)&v8[v6 - 1];
do
{
v10 = *v8;
if ( !*v8 )
break;
Priority = cocos2d::CCTouchHandler::getPriority(*v8);
v12 = cocos2d::CCTouchHandler::getPriority(a2);
Delegate = cocos2d::CCTouchHandler::getDelegate(v10);
result = cocos2d::CCTouchHandler::getDelegate(a2);
if ( Delegate == result )
return result;
v7 = Priority >= v12 ? (unsigned int)v7 : (unsigned int)(v7 + 1);
++v8;
}
while ( (unsigned __int64)v8 <= v9 );
}
else
{
v7 = 0;
}
return sub_1002E7640(a3, a2, v7);
}