//
// UILayer::ccTouchBegan from 0x5c765c to 0x5c7808 (428 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'UILayer::ccTouchBegan @ 0x5c780c
// > ??> @ 0x42eb8
// > ??> @ 0x1147c50
//
// 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 UILayer::ccTouchBegan(UILayer *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v5; // x0
_BOOL4 v6; // w21
double v8; // d0
GJBaseGameLayer *v9; // x0
GameManager *v10; // x0
GameManager *v11; // x0
double m_timestamp; // d0
GJBaseGameLayer *m_gameLayer; // x0
float v14; // [xsp+40h] [xbp+40h]
cocos2d::CCPoint v15; // [xsp+48h] [xbp+48h] BYREF
float v16; // [xsp+50h] [xbp+50h]
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCTouch::getLocation(a2);
cocos2d::CCNode::convertToNodeSpace(a1, &v15);
v6 = v16 <= (float)(v14 * 0.5);
if ( !a1->m_inPlatformer )
{
if ( a1->m_gameLayer->m_gameState.m_isDualMode
|| (v10 = GameManager::sharedState(), GameManager::getGameVariable(v10, "0011")) )
{
if ( !v6 )
goto LABEL_13;
}
else
{
v11 = GameManager::sharedState();
if ( GameManager::getGameVariable(v11, "0010") )
{
LABEL_13:
if ( a1->m_p2TouchId == -1 )
{
m_timestamp = a2->m_timestamp;
m_gameLayer = a1->m_gameLayer;
a1->m_p2TouchId = a2->m_nId;
GJBaseGameLayer::queueButton(m_gameLayer, 1, 1, 1, m_timestamp);
}
return 1;
}
}
if ( a1->m_p1TouchId != -1 )
return 1;
LABEL_8:
v8 = a2->m_timestamp;
v9 = a1->m_gameLayer;
a1->m_p1TouchId = a2->m_nId;
GJBaseGameLayer::queueButton(v9, 1, 1, 0, v8);
return 1;
}
if ( !a1->m_dualMode )
{
if ( a1->m_initialized
&& (UILayer::processUINodesTouch(a1, Pressed, a2)
|| a1->m_initialized && (a1->m_p1TouchId != -1 || a1->m_dpadType != v6)) )
{
return 1;
}
goto LABEL_8;
}
if ( a1->m_initialized )
UILayer::processUINodesTouch(a1, Pressed, a2);
return 1;
}