//
// cocos2d::CCTouchDispatcher::touches from 0x1800b3250 to 0x1800b36df (1167 bytes)
//
// 8 xrefs:
// > cocos2d::CCTouchDispatcher::touchesBegan @ 0x1800b36ed
// > cocos2d::CCTouchDispatcher::touchesCancelled @ 0x1800b3710
// > cocos2d::CCTouchDispatcher::touchesEnded @ 0x1800b3730
// > cocos2d::CCTouchDispatcher::touchesMoved @ 0x1800b3750
// > ??> @ 0x180140f60
// > ??> @ 0x180140fb0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b86e8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall cocos2d::CCTouchDispatcher::touches(
cocos2d::CCTouchDispatcher *this,
struct cocos2d::CCSet *a2,
struct cocos2d::CCEvent *a3,
unsigned int a4)
{
cocos2d::CCSet *v5; // rsi
__int64 v7; // rdi
int v8; // ebx
int v9; // eax
char v10; // r12
cocos2d::CCSet *v11; // r14
int m_type; // edi
_QWORD *j; // rbx
cocos2d::CCArray *m_pTargetedHandlers; // rax
struct cocos2d::CCObject *v15; // rbp
cocos2d::ccArray *data; // r14
__int64 num; // rax
cocos2d::CCNotificationObserver **arr; // r14
cocos2d::CCNotificationObserver **v19; // r12
cocos2d::CCNotificationObserver *v20; // rsi
cocos2d::CCNotificationObserver *v21; // rcx
struct cocos2d::CCObject *Target; // rax
cocos2d::CCSet *Object; // rax
cocos2d::CCSet *v24; // rax
struct cocos2d::CCObject *v25; // rax
cocos2d::CCSet *v26; // rax
struct cocos2d::CCObject *v27; // rax
struct cocos2d::CCObject *v28; // rax
__int64 **v29; // rax
__int64 i; // rax
__int64 *v31; // rcx
cocos2d::CCArray *m_pStandardHandlers; // rax
cocos2d::ccArray *v33; // rbx
__int64 v34; // rax
cocos2d::CCNotificationObserver **v35; // rbx
cocos2d::CCNotificationObserver **k; // rsi
cocos2d::CCNotificationObserver *v37; // rcx
struct cocos2d::CCObject *v38; // rax
struct cocos2d::CCObject *v39; // rax
struct cocos2d::CCObject *v40; // rax
struct cocos2d::CCObject *v41; // rax
cocos2d::_ccCArray *m_pHandlersToRemove; // rcx
unsigned int v43; // ebx
cocos2d::CCArray *m_pHandlersToAdd; // rax
cocos2d::ccArray *v45; // rbx
__int64 v46; // rax
cocos2d::CCNotificationCenter **v47; // rbx
cocos2d::CCNotificationCenter **m; // rsi
cocos2d::CCNotificationCenter *v49; // rdi
struct cocos2d::CCArray *v50; // r8
cocos2d::CCArray *v51; // rcx
int v52; // [rsp+30h] [rbp-58h]
cocos2d::CCSet *v53; // [rsp+38h] [rbp-50h]
__int64 v54; // [rsp+40h] [rbp-48h] BYREF
__int64 v55; // [rsp+48h] [rbp-40h] BYREF
char v56; // [rsp+90h] [rbp+8h]
v5 = a2;
this->m_bLocked = 1;
v7 = a4;
v8 = cocos2d::CCArray::count(this->m_pTargetedHandlers);
v9 = cocos2d::CCArray::count(this->m_pStandardHandlers);
v52 = v9;
if ( v8 && v9 )
{
v10 = 1;
v56 = 1;
v11 = cocos2d::CCSet::mutableCopy(v5);
}
else
{
v10 = 0;
v11 = v5;
v56 = 0;
}
m_type = this->m_sHandlerHelperData[v7].m_type;
v53 = v11;
if ( !v8 )
goto LABEL_38;
j = (_QWORD *)*cocos2d::CCSet::begin((__int64)v5, &v55);
if ( j == (_QWORD *)*cocos2d::CCSet::end((__int64)v5, &v54) )
goto LABEL_38;
do
{
m_pTargetedHandlers = this->m_pTargetedHandlers;
v15 = (struct cocos2d::CCObject *)j[4];
if ( !m_pTargetedHandlers )
goto LABEL_26;
data = m_pTargetedHandlers->data;
num = data->num;
if ( !(_DWORD)num )
{
v11 = v53;
goto LABEL_26;
}
arr = (cocos2d::CCNotificationObserver **)data->arr;
v19 = &arr[num - 1];
if ( arr > v19 )
{
v11 = v53;
v10 = v56;
goto LABEL_26;
}
while ( 1 )
{
v20 = *arr;
if ( !*arr )
{
LABEL_24:
v11 = v53;
v10 = v56;
goto LABEL_25;
}
v21 = *arr;
if ( a4 )
break;
Target = cocos2d::CCNotificationObserver::getTarget(v21);
if ( ((unsigned __int8 (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCObject *, struct cocos2d::CCEvent *))Target->~CCObject)(
Target,
v15,
a3) )
{
Object = (cocos2d::CCSet *)cocos2d::CCNotificationObserver::getObject(v20);
cocos2d::CCSet::addObject(Object, v15);
goto LABEL_22;
}
LABEL_23:
if ( ++arr > v19 )
goto LABEL_24;
}
v24 = (cocos2d::CCSet *)cocos2d::CCNotificationObserver::getObject(v21);
if ( !cocos2d::CCSet::containsObject(v24, v15) )
goto LABEL_23;
switch ( m_type )
{
case 1:
v28 = cocos2d::CCNotificationObserver::getTarget(v20);
((void (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCObject *, struct cocos2d::CCEvent *))v28->isEqual)(
v28,
v15,
a3);
break;
case 2:
v27 = cocos2d::CCNotificationObserver::getTarget(v20);
((void (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCObject *, struct cocos2d::CCEvent *))v27->acceptVisitor)(
v27,
v15,
a3);
LABEL_19:
v26 = (cocos2d::CCSet *)cocos2d::CCNotificationObserver::getObject(v20);
cocos2d::CCSet::removeObject(v26, v15);
break;
case 3:
v25 = cocos2d::CCNotificationObserver::getTarget(v20);
((void (__fastcall *)(struct cocos2d::CCObject *, struct cocos2d::CCObject *, struct cocos2d::CCEvent *))v25->update)(
v25,
v15,
a3);
goto LABEL_19;
}
LABEL_22:
if ( !cocos2d::CCTargetedTouchHandler::isSwallowsTouches((cocos2d::CCTargetedTouchHandler *)v20) )
goto LABEL_23;
v10 = v56;
v11 = v53;
if ( v56 )
cocos2d::CCSet::removeObject(v53, v15);
LABEL_25:
v5 = a2;
LABEL_26:
v29 = (__int64 **)j[2];
if ( *((_BYTE *)v29 + 25) )
{
for ( i = j[1]; !*(_BYTE *)(i + 25); i = *(_QWORD *)(i + 8) )
{
if ( j != *(_QWORD **)(i + 16) )
break;
j = (_QWORD *)i;
}
j = (_QWORD *)i;
}
else
{
v31 = *v29;
for ( j = (_QWORD *)j[2]; !*((_BYTE *)v31 + 25); v31 = (__int64 *)*v31 )
j = v31;
}
}
while ( j != (_QWORD *)*cocos2d::CCSet::end((__int64)v5, &v54) );
LABEL_38:
if ( v52 )
{
if ( (int)cocos2d::CCSet::count(v11) > 0 )
{
m_pStandardHandlers = this->m_pStandardHandlers;
if ( m_pStandardHandlers )
{
v33 = m_pStandardHandlers->data;
v34 = v33->num;
if ( (_DWORD)v34 )
{
v35 = (cocos2d::CCNotificationObserver **)v33->arr;
for ( k = &v35[v34 - 1]; v35 <= k; ++v35 )
{
v37 = *v35;
if ( !*v35 )
break;
if ( m_type )
{
switch ( m_type )
{
case 1:
v40 = cocos2d::CCNotificationObserver::getTarget(v37);
((void (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCSet *, struct cocos2d::CCEvent *))v40->canEncode)(
v40,
v11,
a3);
break;
case 2:
v39 = cocos2d::CCNotificationObserver::getTarget(v37);
((void (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCSet *, struct cocos2d::CCEvent *))v39->getTag)(
v39,
v11,
a3);
break;
case 3:
v38 = cocos2d::CCNotificationObserver::getTarget(v37);
((void (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCSet *, struct cocos2d::CCEvent *))v38->setTag)(
v38,
v11,
a3);
break;
}
}
else
{
v41 = cocos2d::CCNotificationObserver::getTarget(v37);
((void (__fastcall *)(struct cocos2d::CCObject *, cocos2d::CCSet *, struct cocos2d::CCEvent *))v41->encodeWithCoder)(
v41,
v11,
a3);
}
}
}
}
}
}
if ( v10 )
cocos2d::CCObject::release(v11);
this->m_bLocked = 0;
if ( this->m_bToRemove )
{
m_pHandlersToRemove = this->m_pHandlersToRemove;
v43 = 0;
for ( this->m_bToRemove = 0; v43 < m_pHandlersToRemove->num; ++v43 )
{
cocos2d::CCTouchDispatcher::forceRemoveDelegate(this, (struct cocos2d::CCObject *)m_pHandlersToRemove->arr[v43]);
m_pHandlersToRemove = this->m_pHandlersToRemove;
}
Concurrency::details::_NonReentrantLock::_Release((Concurrency::details::_NonReentrantLock *)m_pHandlersToRemove);
}
if ( this->m_bToAdd )
{
m_pHandlersToAdd = this->m_pHandlersToAdd;
this->m_bToAdd = 0;
if ( m_pHandlersToAdd )
{
v45 = m_pHandlersToAdd->data;
v46 = v45->num;
if ( (_DWORD)v46 )
{
v47 = (cocos2d::CCNotificationCenter **)v45->arr;
for ( m = &v47[v46 - 1]; v47 <= m; ++v47 )
{
v49 = *v47;
if ( !*v47 )
break;
v50 = _RTDynamicCast(
v49,
0,
&cocos2d::CCTouchHandler `RTTI Type Descriptor',
&cocos2d::CCTargetedTouchHandler `RTTI Type Descriptor',
0)
? this->m_pTargetedHandlers
: this->m_pStandardHandlers;
cocos2d::CCTouchDispatcher::forceAddHandler(this, v49, v50);
}
}
}
cocos2d::CCArray::removeAllObjects(this->m_pHandlersToAdd);
}
if ( this->m_bToQuit )
{
v51 = this->m_pStandardHandlers;
this->m_bToQuit = 0;
cocos2d::CCArray::removeAllObjects(v51);
cocos2d::CCArray::removeAllObjects(this->m_pTargetedHandlers);
}
}