//
// UILayer::processUINodeTouch from 0x10004a3f4 to 0x10004a6c8 (724 bytes)
//
// 1 xrefs:
// > UILayer::processUINodesTouch @ 0x10004a2d8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
bool __fastcall UILayer::processUINodeTouch(
UILayer *a1,
GJUITouchEvent a2,
int a3,
cocos2d::CCPoint a4,
GJUINode *a5,
double a6)
{
__int64 v6; // x4
__int64 v8; // x19
int active; // w0
int v12; // w22
bool v13; // w21
GJBaseGameLayer *v14; // x0
int v15; // w1
char v16; // w3
bool v17; // w2
int v18; // w0
__int64 v19; // x0
__int64 v20; // x9
__int64 v21; // x0
GJBaseGameLayer *m_gameLayer; // x0
char v23; // w3
int v24; // w1
__int16 v26; // [xsp+8h] [xbp-38h] BYREF
char v27; // [xsp+Ah] [xbp-36h]
cocos2d::CCPoint v28; // 0:s0.4,4:s1.4
cocos2d::CCPoint v29; // 0:s0.4,4:s1.4
v8 = v6;
if ( a2 )
{
if ( *(_DWORD *)(v6 + 352) == a3 )
{
if ( a2 == Ended )
{
m_gameLayer = a1->m_gameLayer;
if ( *(_BYTE *)(v6 + 386) == 1 )
{
v23 = *(_BYTE *)(v6 + 385);
v24 = 1;
}
else
{
GJBaseGameLayer::queueButton(m_gameLayer, *(_DWORD *)(v6 + 388), 0, *(_BYTE *)(v6 + 385), *(double *)&a4);
m_gameLayer = a1->m_gameLayer;
v23 = *(_BYTE *)(v8 + 385);
v24 = 5;
}
GJBaseGameLayer::queueButton(m_gameLayer, v24, 0, v23, *(double *)&a4);
GJUINode::touchEnded((GJUINode *)v8);
}
else if ( a2 == Moved && (*(_BYTE *)(v6 + 386) & 1) == 0 && (*(_BYTE *)(v6 + 387) & 1) == 0 )
{
v28 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v6, (const cocos2d::CCPoint *)a5);
active = GJUINode::activeTouchTest((GJUINode *)v8, v28);
if ( (active & 6) == 2 )
{
v12 = active;
if ( *(_DWORD *)(v8 + 388) != active )
{
*(_BYTE *)(v8 + 384) = 0;
GJUINode::highlightButton((GJUINode *)v8, active);
v13 = 1;
GJBaseGameLayer::queueButton(a1->m_gameLayer, v12, 1, *(_BYTE *)(v8 + 385), *(double *)&a4);
v14 = a1->m_gameLayer;
v15 = *(_DWORD *)(v8 + 388);
v16 = *(_BYTE *)(v8 + 385);
v17 = 0;
LABEL_35:
GJBaseGameLayer::queueButton(v14, v15, v17, v16, *(double *)&a4);
*(_DWORD *)(v8 + 388) = v12;
return v13;
}
return 1;
}
v13 = 1;
if ( (*(_BYTE *)(v8 + 384) & 1) != 0 )
return v13;
*(_BYTE *)(v8 + 384) = 1;
GJBaseGameLayer::queueButton(a1->m_gameLayer, *(_DWORD *)(v8 + 388), 0, *(_BYTE *)(v8 + 385), *(double *)&a4);
if ( (*(_BYTE *)(v8 + 381) & 1) == 0 )
GJUINode::touchEnded((GJUINode *)v8);
goto LABEL_25;
}
return 1;
}
return 0;
}
v29 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v6, (const cocos2d::CCPoint *)a5);
v18 = GJUINode::touchTest((GJUINode *)v8, v29);
if ( !v18 )
return 0;
v12 = v18;
*(_DWORD *)(v8 + 352) = a3;
if ( v18 != 1 )
{
if ( (v18 & 6) == 2 )
{
v20 = 328;
if ( (v18 != 3) | *(_BYTE *)(v8 + 381) & 1 )
v20 = 320;
v21 = *(_QWORD *)(v8 + v20);
if ( v21 )
{
if ( (*(_BYTE *)(v8 + 381) & 1) != 0 )
{
v27 = -1;
v26 = -1;
}
else
{
v26 = -26986;
v27 = -106;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v21 + 944LL))(v21, &v26);
}
v13 = 1;
GJBaseGameLayer::queueButton(a1->m_gameLayer, v12, 1, *(_BYTE *)(v8 + 385), *(double *)&a4);
v14 = a1->m_gameLayer;
v16 = *(_BYTE *)(v8 + 385);
v15 = 5;
v17 = 1;
goto LABEL_35;
}
v13 = 1;
*(_BYTE *)(v8 + 384) = 1;
LABEL_25:
*(_DWORD *)(v8 + 388) = 0;
return v13;
}
v19 = *(_QWORD *)(v8 + 320);
if ( v19 )
{
if ( (*(_BYTE *)(v8 + 381) & 1) != 0 )
{
v27 = -1;
v26 = -1;
}
else
{
v26 = -26986;
v27 = -106;
}
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v19 + 944LL))(v19, &v26);
}
v13 = 1;
GJBaseGameLayer::queueButton(a1->m_gameLayer, 1, 1, *(_BYTE *)(v8 + 385), *(double *)&a4);
return v13;
}