//
// UILayer::processUINodeTouch from 0x5c7288 to 0x5c7578 (752 bytes)
//
// 2 xrefs:
// > UILayer::processUINodesTouch @ 0x5c7610
// > ??> @ 0xa8ca8
//
// 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 UILayer::processUINodeTouch(UILayer *a1, GJUITouchEvent a2, int a3, cocos2d::CCPoint a4, GJUINode *a5, double a6)
{
__int64 v6; // x4
char v7; // w19
int v11; // w0
int v12; // w19
int active; // w22
GJBaseGameLayer *m_gameLayer; // x0
int m_currentButton; // w1
bool m_player2; // w3
GJUINode *v17; // x4
GJUINode *v19; // [xsp+48h] [xbp+48h]
GJUINode *v20; // [xsp+48h] [xbp+48h]
GJUINode *v21; // [xsp+48h] [xbp+48h]
cocos2d::CCPoint v22; // 0:s0.4,4:s1.4
cocos2d::CCPoint v23; // 0:s0.4,4:s1.4
v7 = a2;
if ( a2 )
{
if ( *(_DWORD *)(v6 + 352) != a3 )
return 0;
if ( a2 == Moved )
{
if ( *(_BYTE *)(v6 + 386) || *(_BYTE *)(v6 + 387) )
return 1;
v20 = (GJUINode *)v6;
v23 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v6, (const cocos2d::CCPoint *)a5);
active = GJUINode::activeTouchTest(v20, v23);
if ( (unsigned int)(active - 2) <= 1 )
{
if ( active == v20->m_currentButton )
return 1;
v20->m_moving = 0;
GJUINode::highlightButton(v20, active);
GJBaseGameLayer::queueButton(a1->m_gameLayer, active, v7, v20->m_player2, *(double *)&a4);
GJBaseGameLayer::queueButton(a1->m_gameLayer, v20->m_currentButton, 0, v20->m_player2, *(double *)&a4);
v20->m_currentButton = active;
return v7;
}
else
{
if ( v20->m_moving )
return 1;
m_gameLayer = a1->m_gameLayer;
m_currentButton = v20->m_currentButton;
m_player2 = v20->m_player2;
v20->m_moving = v7;
GJBaseGameLayer::queueButton(m_gameLayer, m_currentButton, 0, m_player2, *(double *)&a4);
v17 = v20;
if ( !v20->m_modeB )
{
GJUINode::touchEnded(v20);
v17 = v20;
}
v17->m_currentButton = 0;
return 1;
}
}
else
{
if ( a2 != Ended )
return 1;
v21 = (GJUINode *)v6;
if ( *(_BYTE *)(v6 + 386) )
{
GJBaseGameLayer::queueButton(a1->m_gameLayer, 1, 0, *(_BYTE *)(v6 + 385), *(double *)&a4);
}
else
{
GJBaseGameLayer::queueButton(a1->m_gameLayer, *(_DWORD *)(v6 + 388), 0, *(_BYTE *)(v6 + 385), *(double *)&a4);
GJBaseGameLayer::queueButton(a1->m_gameLayer, 5, 0, v21->m_player2, *(double *)&a4);
}
GJUINode::touchEnded(v21);
return 1;
}
}
else
{
v19 = (GJUINode *)v6;
v22 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v6, (const cocos2d::CCPoint *)a5);
v11 = GJUINode::touchTest(v19, v22);
v12 = v11;
if ( !v11 )
return 0;
v19->m_touchID = a3;
if ( v11 == 1 )
{
GJUINode::toggleHighlight(v19, 1, 1);
GJBaseGameLayer::queueButton(a1->m_gameLayer, v12, v12, v19->m_player2, *(double *)&a4);
return v12;
}
else
{
if ( (unsigned int)(v11 - 2) <= 1 )
{
GJUINode::toggleHighlight(v19, v11, 1);
GJBaseGameLayer::queueButton(a1->m_gameLayer, v12, 1, v19->m_player2, *(double *)&a4);
GJBaseGameLayer::queueButton(a1->m_gameLayer, 5, 1, v19->m_player2, *(double *)&a4);
v19->m_currentButton = v12;
}
else
{
v19->m_currentButton = 0;
v19->m_moving = 1;
}
return 1;
}
}
}