//
// UILayer::ccTouchBegan from 0x10004a0f4 to 0x10004a264 (368 bytes)
//
// 2 xrefs:
// > sub_10004A30C @ 0x10004a318
// > ??> @ 0x10076fa98
//
// 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::ccTouchBegan(UILayer *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v5; // x0
float v6; // s9
GameManager *v7; // x0
GJBaseGameLayer *m_gameLayer; // x0
double m_timestamp; // d0
bool v10; // w3
GameManager *v11; // x0
float v13; // [xsp+8h] [xbp-38h]
cocos2d::CCPoint v14; // [xsp+10h] [xbp-30h] BYREF
float v15; // [xsp+18h] [xbp-28h]
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
cocos2d::CCTouch::getLocation(a2);
cocos2d::CCNode::convertToNodeSpace(a1, &v14);
v6 = v15 * 0.5;
if ( !a1->m_inPlatformer )
{
if ( a1->m_gameLayer->m_gameState.m_isDualMode
|| (v7 = GameManager::sharedState(), GameManager::getGameVariable(v7, "0011")) )
{
if ( v13 <= v6 )
goto LABEL_8;
}
else
{
v11 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v11, "0010") )
{
LABEL_8:
if ( a1->m_p1TouchId != -1 )
return 1;
LABEL_15:
a1->m_p1TouchId = a2->m_nId;
m_gameLayer = a1->m_gameLayer;
m_timestamp = a2->m_timestamp;
v10 = 0;
goto LABEL_19;
}
}
if ( a1->m_p2TouchId != -1 )
return 1;
a1->m_p2TouchId = a2->m_nId;
m_gameLayer = a1->m_gameLayer;
m_timestamp = a2->m_timestamp;
v10 = 1;
LABEL_19:
GJBaseGameLayer::queueButton(m_gameLayer, 1, 1, v10, m_timestamp);
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 != v13 <= v6)) )
{
return 1;
}
goto LABEL_15;
}
if ( a1->m_initialized )
UILayer::processUINodesTouch(a1, Pressed, a2);
return 1;
}