//
// GJTransformControl::ccTouchBegan from 0x6ece5c to 0x6ed152 (758 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'GJTransformControl::ccTouchBegan @ 0x6ed160
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:57:33 +0000
//
int __fastcall GJTransformControl::ccTouchBegan(int a1, int a2, int a3)
{
int v5; // r6
int v6; // r7
const cocos2d::CCPoint *v7; // r3
const cocos2d::CCPoint *v8; // r1
cocos2d::CCDirector *v9; // r0
int v10; // r0
int OppositeHandleTag; // r0
const cocos2d::CCPoint *v12; // r11
int v13; // r6
int v14; // r0
int v15; // r0
const cocos2d::CCPoint *v16; // r0
int v17; // r0
const cocos2d::CCPoint *v18; // r0
float v19; // s13
float v20; // s14
float v21; // s15
const cocos2d::CCPoint *v22; // r11
int v23; // r0
const cocos2d::CCPoint *v24; // r6
int v25; // r1
int v26; // r0
int v27; // r0
int v28; // r0
int v29; // r0
int v30; // r0
int v31; // r0
int v32; // r0
const cocos2d::CCPoint *v33; // r0
_BYTE v35[12]; // [sp+8h] [bp-6Ch] BYREF
_BYTE v36[8]; // [sp+14h] [bp-60h] BYREF
_BYTE v37[8]; // [sp+1Ch] [bp-58h] BYREF
_BYTE v38[8]; // [sp+24h] [bp-50h] BYREF
_BYTE v39[8]; // [sp+2Ch] [bp-48h] BYREF
float v40[2]; // [sp+34h] [bp-40h] BYREF
float v41; // [sp+3Ch] [bp-38h] BYREF
float v42; // [sp+40h] [bp-34h]
float v43[2]; // [sp+44h] [bp-30h] BYREF
_BYTE v44[8]; // [sp+4Ch] [bp-28h] BYREF
_BYTE v45[8]; // [sp+54h] [bp-20h] BYREF
_BYTE v46[16]; // [sp+5Ch] [bp-18h] BYREF
if ( *(_DWORD *)(a1 + 328) != -1 )
return 0;
v5 = ControlMenuTouch::began((_DWORD *)(a1 + 432), a2, a3);
if ( !v5 )
{
cocos2d::CCTouch::getLocation((cocos2d::CCTouch *)v36);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v37, *(const cocos2d::CCPoint **)(a1 + 316));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v38, (const cocos2d::CCPoint *)a1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39);
v6 = 1;
while ( 1 )
{
if ( v6 == 12 )
{
v8 = (const cocos2d::CCPoint *)v38;
}
else
{
v7 = (const cocos2d::CCPoint *)v37;
if ( v6 == 1 )
v7 = (const cocos2d::CCPoint *)v38;
v8 = v7;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v45, v8);
GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, v6);
cocos2d::CCNode::boundingBox((cocos2d::CCNode *)v46);
if ( cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v46, (const cocos2d::CCPoint *)v45) )
break;
if ( ++v6 == 13 )
goto LABEL_12;
}
*(_WORD *)(a1 + 332) = v6;
cocos2d::CCPoint::operator=(v39, v45);
LABEL_12:
if ( *(_WORD *)(a1 + 332) )
{
v9 = *(cocos2d::CCDirector **)(a1 + 336);
if ( v9 )
v9 = (cocos2d::CCDirector *)(*(int (__fastcall **)(cocos2d::CCDirector *))(*(_DWORD *)v9 + 40))(v9);
if ( *(_BYTE *)(a1 + 457)
|| (v10 = cocos2d::CCDirector::sharedDirector(v9),
*(_BYTE *)((*(int (__fastcall **)(int))(*(_DWORD *)v10 + 96))(v10) + 90)) )
{
if ( (unsigned __int16)(*(_WORD *)(a1 + 332) - 2) <= 7u )
v5 = *(_DWORD *)(a1 + 336) != 0;
}
*(_BYTE *)(a1 + 484) = v5;
if ( v5 )
{
OppositeHandleTag = GJTransformControl::getOppositeHandleTag((GJTransformControl *)a1, *(__int16 *)(a1 + 332));
v12 = *(const cocos2d::CCPoint **)(a1 + 316);
v13 = OppositeHandleTag;
v14 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 1);
(*(void (__fastcall **)(int))(*(_DWORD *)v14 + 96))(v14);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v46, (const cocos2d::CCPoint *)a1);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v40, v12);
v15 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 6);
v16 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v15 + 96))(v15);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, v16);
v17 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 9);
v18 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v17 + 96))(v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, v18);
v19 = v43[1] - v42;
if ( (float)(v43[0] - v41) == 0.0 )
v20 = 0.5;
else
v20 = (float)(v40[0] - v41) / (float)(v43[0] - v41);
if ( v19 == 0.0 )
v21 = 0.5;
else
v21 = (float)(v40[1] - v42) / v19;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v20, v21);
cocos2d::CCPoint::operator=(a1 + 476, v46);
v22 = *(const cocos2d::CCPoint **)(a1 + 316);
v23 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, v13);
(*(void (__fastcall **)(int))(*(_DWORD *)v23 + 96))(v23);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v44, v22);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, (const cocos2d::CCPoint *)v44);
GJTransformControl::moveAnchorTo((cocos2d::CCArray *)a1, (const cocos2d::CCPoint *)v46);
v24 = *(const cocos2d::CCPoint **)(a1 + 316);
cocos2d::CCTouch::getLocation((cocos2d::CCTouch *)v46);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v45, v24);
cocos2d::CCPoint::operator=(v39, v45);
}
v25 = *(__int16 *)(a1 + 332);
*(_DWORD *)(a1 + 328) = *(_DWORD *)(a2 + 52);
v26 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, v25);
v27 = (*(int (__fastcall **)(int))(*(_DWORD *)v26 + 96))(v26);
cocos2d::CCPoint::operator-(v46, v27, v39);
cocos2d::CCPoint::operator=(a1 + 340, v46);
v28 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 7);
v29 = (*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::operator=(a1 + 364, v29);
v30 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 8);
v31 = (*(int (__fastcall **)(int))(*(_DWORD *)v30 + 96))(v30);
cocos2d::CCPoint::operator=(a1 + 372, v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, *(float *)(a1 + 448), *(float *)(a1 + 452));
cocos2d::CCPoint::operator=(a1 + 380, v46);
v5 = *(__int16 *)(a1 + 332);
if ( v5 == 12 )
{
*(_DWORD *)(a1 + 460) = *(_DWORD *)(a1 + 464);
return 1;
}
if ( v5 != 1 )
return 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, 3.4028e38, 3.4028e38);
cocos2d::CCPoint::operator=(a1 + 492, v46);
*(_DWORD *)(a1 + 488) = 0;
v32 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 1);
v33 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v32 + 96))(v32);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v46, v33);
GJTransformControl::snapToNearestVertex((cocos2d::CCPoint *)v35, a1, (const cocos2d::CCPoint *)v46);
}
}
return v5;
}