//
// cocos2d::CCTouchDispatcher::removeDelegate from 0x1004c7bf0 to 0x1004c7ca4 (180 bytes)
//
// 7 xrefs:
// > cocos2d::CCLayer::setTouchEnabled @ 0x1004a9b45
// > cocos2d::CCLayer::onExit @ 0x1004aa230
// > sub_1005979B0 @ 0x100597a24
// > sub_100597A50 @ 0x100597ac4
// > sub_100597AF0 @ 0x100597b54
// > sub_100597B80 @ 0x100597bf4
// > sub_100597C20 @ 0x100597c84
//
// 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 12:31:08 +0000
//
unsigned int *__fastcall cocos2d::CCTouchDispatcher::removeDelegate(__int64 a1, unsigned int *a2)
{
unsigned int *result; // rax
__int64 v3; // rax
unsigned int *v4; // rax
__int64 *v5; // r12
unsigned __int64 v6; // r13
__int64 v7; // r14
if ( a2 )
{
if ( *(_BYTE *)(a1 + 80) )
{
v3 = *(_QWORD *)(a1 + 88);
if ( v3 )
{
v4 = *(unsigned int **)(v3 + 56);
if ( *v4 )
{
v5 = *((__int64 **)v4 + 2);
v6 = (unsigned __int64)&v5[*v4 - 1];
do
{
v7 = *v5;
if ( !*v5 )
break;
if ( (unsigned int *)cocos2d::CCTouchHandler::getDelegate(*v5) == a2 )
return (unsigned int *)sub_1007FF140(*(_QWORD *)(a1 + 88), v7, 1);
++v5;
}
while ( (unsigned __int64)v5 <= v6 );
}
}
result = (unsigned int *)sub_100747970(*(_QWORD *)(a1 + 96), a2);
*(_BYTE *)(a1 + 82) = 1;
}
else
{
return cocos2d::CCTouchDispatcher::forceRemoveDelegate(a1, a2);
}
}
return result;
}