//
// cocos2d::CCTouchDispatcher::addTargetedDelegate from 0x1800b6530 to 0x1800b664a (282 bytes)
//
// 5 xrefs:
// > cocos2d::CCLayer::registerWithTouchDispatcher @ 0x1800527a9
// > cocos2d::CCMenu::registerWithTouchDispatcher @ 0x18005b92c
// > cocos2d::CCTouchDispatcher::addPrioTargetedDelegate @ 0x1800b6484
// > ??> @ 0x18014cf68
// > ??> @ 0x1801c28f8
//
// 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:21 +0000
//
void __fastcall cocos2d::CCTouchDispatcher::addTargetedDelegate(
cocos2d::CCTouchDispatcher *this,
struct cocos2d::CCTouchDelegate *a2,
int a3,
bool a4)
{
struct cocos2d::CCNode *v8; // rax
int v9; // eax
struct cocos2d::CCTouchHandler *v10; // rax
struct cocos2d::CCObject *v11; // rsi
int v12; // [rsp+40h] [rbp+8h] BYREF
v12 = 0;
v8 = (struct cocos2d::CCNode *)_RTDynamicCast(
a2,
0,
&cocos2d::CCTouchDelegate `RTTI Type Descriptor',
&cocos2d::CCNode `RTTI Type Descriptor',
0);
if ( v8 && cocos2d::CCTouchDispatcher::ownerLevelOf(this, v8, &v12) )
{
v9 = v12;
if ( a3 <= v12 )
goto LABEL_12;
goto LABEL_11;
}
if ( *((int *)this + 40) > 0
&& a3 > *((_DWORD *)this + 32)
&& !(*(unsigned int (__fastcall **)(struct cocos2d::CCTouchDelegate *))(*(_QWORD *)a2 + 80LL))(a2) )
{
a3 = *((_DWORD *)this + 32);
goto LABEL_12;
}
if ( (*(unsigned int (__fastcall **)(struct cocos2d::CCTouchDelegate *))(*(_QWORD *)a2 + 80LL))(a2) )
{
v9 = (*(__int64 (__fastcall **)(struct cocos2d::CCTouchDelegate *))(*(_QWORD *)a2 + 80LL))(a2);
LABEL_11:
a3 = v9;
}
LABEL_12:
(*(void (__fastcall **)(struct cocos2d::CCTouchDelegate *, _QWORD))(*(_QWORD *)a2 + 72LL))(a2, (unsigned int)a3);
v10 = cocos2d::CCTargetedTouchHandler::handlerWithDelegate(a2, a3, a4);
v11 = v10;
if ( *((_BYTE *)this + 80) )
{
if ( sub_1800A1E40(*((_QWORD *)this + 12), (__int64)a2) )
{
sub_1800A1F90(*((_QWORD *)this + 12), (__int64)a2);
}
else
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 11), v11);
*((_BYTE *)this + 81) = 1;
}
}
else
{
cocos2d::CCTouchDispatcher::forceAddHandler(this, v10, *((struct cocos2d::CCArray **)this + 8));
}
}