//
// cocos2d::CCTouchDispatcher::setPriority from 0x1004c7eb0 to 0x1004c7ff4 (324 bytes)
//
// 1 xrefs:
// > cocos2d::CCMenu::setHandlerPriority @ 0x100873c80
//
// 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
//
__int64 __fastcall cocos2d::CCTouchDispatcher::setPriority(__int64 a1, int a2, __int64 a3)
{
__int64 v5; // rax
unsigned int *v6; // rax
__int64 *v7; // r13
__int64 *v8; // r14
__int64 v9; // r12
__int64 v10; // rax
unsigned int *v11; // rax
__int64 *v12; // r14
unsigned __int64 v13; // r13
__int64 result; // rax
unsigned int *v15; // rax
__m128i *v16; // rdi
unsigned __int64 v17; // rax
unsigned __int64 v18; // rcx
__int64 v19; // rcx
unsigned int *v20; // rax
__m128i *v21; // rdi
unsigned __int64 v22; // rax
unsigned __int64 v23; // rcx
__int64 v24; // rcx
__int64 (__fastcall *v25[6])(__int64); // [rsp+10h] [rbp-30h] BYREF
v5 = *(_QWORD *)(a1 + 64);
if ( v5 )
{
v6 = *(unsigned int **)(v5 + 56);
if ( *v6 )
{
v7 = *((__int64 **)v6 + 2);
v8 = &v7[*v6 - 1];
do
{
v9 = *v7;
if ( !*v7 )
break;
if ( cocos2d::CCTouchHandler::getDelegate(*v7) == a3 )
goto LABEL_14;
++v7;
}
while ( v7 <= v8 );
}
}
v10 = *(_QWORD *)(a1 + 72);
if ( v10 )
{
v11 = *(unsigned int **)(v10 + 56);
if ( *v11 )
{
v12 = *((__int64 **)v11 + 2);
v13 = (unsigned __int64)&v12[*v11 - 1];
do
{
v9 = *v12;
if ( !*v12 )
break;
if ( cocos2d::CCTouchHandler::getDelegate(*v12) == a3 )
goto LABEL_14;
++v12;
}
while ( (unsigned __int64)v12 <= v13 );
}
}
v9 = 0;
LABEL_14:
result = cocos2d::CCTouchHandler::getPriority(v9);
if ( (_DWORD)result != a2 )
{
cocos2d::CCTouchHandler::setPriority(v9, a2);
v15 = *(unsigned int **)(*(_QWORD *)(a1 + 64) + 56LL);
v16 = *((__m128i **)v15 + 2);
v17 = *v15;
_BitScanReverse64(&v18, v17);
v19 = (2 * ((unsigned int)v18 ^ 0x3F)) ^ 0x7ELL;
v25[0] = (__int64 (__fastcall *)(__int64))sub_1004C7E80;
if ( !v17 )
v19 = 0;
sub_100261E00(v16, (__m128i *)((char *)v16 + 8 * v17), v25, v19, 1);
v20 = *(unsigned int **)(*(_QWORD *)(a1 + 72) + 56LL);
v21 = *((__m128i **)v20 + 2);
v22 = *v20;
_BitScanReverse64(&v23, v22);
v24 = (2 * ((unsigned int)v23 ^ 0x3F)) ^ 0x7ELL;
v25[0] = (__int64 (__fastcall *)(__int64))sub_1004C7E80;
if ( !v22 )
v24 = 0;
return sub_100261E00(v21, (__m128i *)((char *)v21 + 8 * v22), v25, v24, 1);
}
return result;
}