//
// UILayer::processUINodeTouch from 0x1004c9ed0 to 0x1004ca2c0 (1008 bytes)
//
// 5 xrefs:
// > UILayer::processUINodesTouch @ 0x1004c9bd6
// > UILayer::ccTouchMoved @ 0x1004c9ca8
// > UILayer::ccTouchMoved @ 0x1004c9cf4
// > UILayer::ccTouchEnded @ 0x1004c9dd7
// > UILayer::ccTouchEnded @ 0x1004c9e95
//
// 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
//
bool __fastcall UILayer::processUINodeTouch(
UILayer *a1,
GJUITouchEvent a2,
int a3,
cocos2d::CCPoint a4,
GJUINode *a5,
double a6)
{
__int64 v6; // r8
__int64 v7; // rbx
bool v9; // r14
cocos2d::CCPoint v10; // xmm0_8
unsigned int active; // eax
double v12; // xmm0_8
int v14; // eax
__int64 v15; // rdi
double v16; // xmm0_8
double v17; // xmm0_8
__int64 v18; // rdi
int v19; // r14d
GJBaseGameLayer *m_gameLayer; // rdi
char v21; // cl
int v22; // esi
int v23; // esi
char v24; // cl
__int64 v25; // rdi
__int64 v26; // rdi
int v27; // r14d
int v29; // r12d
double v30; // [rsp+8h] [rbp-38h] BYREF
double v31; // [rsp+10h] [rbp-30h]
_QWORD v32[5]; // [rsp+18h] [rbp-28h] BYREF
cocos2d::CCPoint v33; // 0:xmm0_8.8
v7 = v6;
if ( a2 )
{
if ( *(_DWORD *)(v6 + 352) == a3 )
{
v9 = 1;
if ( a2 == Ended )
{
m_gameLayer = a1->m_gameLayer;
if ( *(_BYTE *)(v6 + 386) == 1 )
{
v21 = *(_BYTE *)(v6 + 385);
v22 = 1;
}
else
{
v23 = *(_DWORD *)(v6 + 388);
v24 = *(_BYTE *)(v6 + 385);
v31 = *(double *)&a4;
GJBaseGameLayer::queueButton(m_gameLayer, v23, 0, v24, *(double *)&a4);
m_gameLayer = a1->m_gameLayer;
v21 = *(_BYTE *)(v7 + 385);
v22 = 5;
}
GJBaseGameLayer::queueButton(m_gameLayer, v22, 0, v21, *(double *)&a4);
*(_DWORD *)(v7 + 352) = -1;
v25 = *(_QWORD *)(v7 + 320);
if ( v25 )
{
BYTE2(v32[0]) = -1;
LOWORD(v32[0]) = -1;
(*(void (__fastcall **)(__int64, _QWORD *, double, double))(*(_QWORD *)v25 + 944LL))(
v25,
v32,
*(double *)&a4,
a6);
}
if ( *(_BYTE *)(v7 + 381) == 1 )
{
if ( *(_BYTE *)(v7 + 382) == 1 )
(*(void (__fastcall **)(_QWORD, _QWORD, double, double))(**(_QWORD **)(v7 + 320) + 328LL))(
*(_QWORD *)(v7 + 320),
0,
*(double *)&a4,
a6);
}
else
{
v26 = *(_QWORD *)(v7 + 328);
if ( v26 )
{
BYTE2(v32[0]) = -1;
LOWORD(v32[0]) = -1;
(*(void (__fastcall **)(__int64, _QWORD *, double, double))(*(_QWORD *)v26 + 944LL))(
v26,
v32,
*(double *)&a4,
a6);
}
}
}
else
{
if ( a2 != Moved || *(_BYTE *)(v6 + 386) || *(_BYTE *)(v6 + 387) )
return v9;
v31 = *(double *)&a4;
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v30, (const cocos2d::CCPoint *)v6);
if ( *(_BYTE *)(v7 + 381) )
{
*(double *)&v10 = sub_10028CC60(v32, &v30);
active = GJUINode::activeRangeTouchTest((GJUINode *)v7, v10);
v12 = v31;
if ( active >= 2 )
{
LABEL_46:
if ( *(_DWORD *)(v7 + 388) != active )
{
*(_BYTE *)(v7 + 384) = 0;
v29 = active;
GJUINode::highlightButton((GJUINode *)v7, active);
GJBaseGameLayer::queueButton(a1->m_gameLayer, v29, 1, *(_BYTE *)(v7 + 385), v31);
GJBaseGameLayer::queueButton(a1->m_gameLayer, *(_DWORD *)(v7 + 388), 0, *(_BYTE *)(v7 + 385), v31);
*(_DWORD *)(v7 + 388) = v29;
}
return v9;
}
}
else
{
if ( *(float *)(v7 + 376) <= fabs(*(float *)&v30) )
{
active = ((LODWORD(v30) | 0x300000000LL) - (unsigned __int64)COERCE_UNSIGNED_INT(0.0)) >> 32;
goto LABEL_46;
}
v12 = v31;
}
if ( *(_BYTE *)(v7 + 384) )
return v9;
*(_BYTE *)(v7 + 384) = 1;
GJBaseGameLayer::queueButton(a1->m_gameLayer, *(_DWORD *)(v7 + 388), 0, *(_BYTE *)(v7 + 385), v12);
if ( !*(_BYTE *)(v7 + 381) )
GJUINode::touchEnded((GJUINode *)v7);
}
*(_DWORD *)(v7 + 388) = 0;
return v9;
}
return 0;
}
v31 = *(double *)&a4;
v33 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v32, (const cocos2d::CCPoint *)v6);
v14 = GJUINode::touchTest((GJUINode *)v7, v33);
if ( !v14 )
return 0;
*(_DWORD *)(v7 + 352) = a3;
if ( v14 == 1 )
{
v15 = *(_QWORD *)(v7 + 320);
v16 = v31;
if ( v15 )
{
if ( *(_BYTE *)(v7 + 381) )
{
BYTE2(v32[0]) = -1;
LOWORD(v32[0]) = -1;
}
else
{
BYTE2(v32[0]) = -106;
LOWORD(v32[0]) = -26986;
}
(*(void (__fastcall **)(__int64, _QWORD *, double, double))(*(_QWORD *)v15 + 944LL))(v15, v32, v31, a6);
v16 = v31;
}
GJBaseGameLayer::queueButton(a1->m_gameLayer, 1, 1, *(_BYTE *)(v7 + 385), v16);
}
else
{
v17 = v31;
if ( (v14 & 6) == 2 )
{
v18 = *(_QWORD *)(v7 + 8LL * ((*(_BYTE *)(v7 + 381) ^ 1u) & (v14 == 3)) + 320);
if ( v18 )
{
v19 = v14;
if ( (*(_BYTE *)(v7 + 381) & 1) != 0 )
{
BYTE2(v32[0]) = -1;
LOWORD(v32[0]) = -1;
}
else
{
BYTE2(v32[0]) = -106;
LOWORD(v32[0]) = -26986;
}
(*(void (__fastcall **)(__int64, _QWORD *, double, double))(*(_QWORD *)v18 + 944LL))(v18, v32, v31, a6);
v14 = v19;
v17 = v31;
}
v27 = v14;
GJBaseGameLayer::queueButton(a1->m_gameLayer, v14, 1, *(_BYTE *)(v7 + 385), v17);
GJBaseGameLayer::queueButton(a1->m_gameLayer, 5, 1, *(_BYTE *)(v7 + 385), v31);
*(_DWORD *)(v7 + 388) = v27;
}
else
{
*(_BYTE *)(v7 + 384) = 1;
*(_DWORD *)(v7 + 388) = 0;
}
}
return 1;
}