//
// UILayer::ccTouchBegan from 0x30da40 to 0x30db56 (278 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'UILayer::ccTouchBegan @ 0x30db68
//
// 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; // r0
_BOOL4 v6; // r7
GameManager *v7; // r0
GameManager *v9; // r0
bool v11; // zf
GJBaseGameLayer *v12; // r0
GJBaseGameLayer *m_gameLayer; // r0
cocos2d::CCSize v14; // [sp+Ch] [bp-8h] BYREF
cocos2d::CCPoint v15; // [sp+14h] [bp+0h] BYREF
cocos2d::CCPoint v16; // [sp+1Ch] [bp+8h] BYREF
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v14, v5);
cocos2d::CCTouch::getLocation(&v15, a2);
cocos2d::CCNode::convertToNodeSpace(&v16, a1, &v15);
v6 = v16.x <= (float)(v14.width * 0.5);
if ( a1->m_inPlatformer )
{
if ( a1->m_dualMode )
{
if ( a1->m_initialized )
UILayer::processUINodesTouch(a1, Pressed, a2);
}
else if ( !a1->m_initialized || !UILayer::processUINodesTouch(a1, (GJUITouchEvent)a1->m_dualMode, a2) )
{
if ( !a1->m_initialized )
{
LABEL_22:
m_gameLayer = a1->m_gameLayer;
a1->m_p1TouchId = a2->m_nId;
GJBaseGameLayer::queueButton(m_gameLayer, 1, 1, 0, a2->m_timestamp);
return 1;
}
if ( a1->m_p1TouchId == -1 )
{
v11 = a1->m_dpadType == v6;
LABEL_20:
if ( !v11 )
return 1;
goto LABEL_22;
}
}
}
else
{
if ( a1->m_gameLayer->m_gameState.m_isDualMode
|| (v7 = GameManager::sharedState(), GameManager::getGameVariable(v7, "0011")) )
{
if ( v6 )
{
LABEL_13:
v11 = a1->m_p1TouchId == -1;
goto LABEL_20;
}
}
else
{
v9 = GameManager::sharedState();
if ( !GameManager::getGameVariable(v9, "0010") )
goto LABEL_13;
}
if ( a1->m_p2TouchId == -1 )
{
v12 = a1->m_gameLayer;
a1->m_p2TouchId = a2->m_nId;
GJBaseGameLayer::queueButton(v12, 1, 1, 1, a2->m_timestamp);
}
}
return 1;
}