//
// GJTransformControl::ccTouchBegan from 0xbd1e00 to 0xbd2238 (1080 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'GJTransformControl::ccTouchBegan @ 0xbd2240
// > ??> @ 0x47308
// > ??> @ 0x14e2800
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// 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 13:03:38 +0000
//
__int64 __fastcall GJTransformControl::ccTouchBegan(__int64 a1, cocos2d::CCTouch *a2, __int64 a3)
{
unsigned int v5; // w22
unsigned __int8 v7; // w0
int v8; // w21
__int64 *v9; // x1
cocos2d::CCNode *v10; // x0
__int64 v11; // x0
int v12; // w1
int OppositeHandleTag; // w22
cocos2d::CCNode *v14; // x21
__int64 v15; // x0
const cocos2d::CCPoint *v16; // x0
__int64 v17; // x0
const cocos2d::CCPoint *v18; // x0
__int64 v19; // x0
const cocos2d::CCPoint *v20; // x0
float v21; // s1
float v22; // s0
float v23; // s1
cocos2d::CCNode *v24; // x26
__int64 v25; // x0
const cocos2d::CCPoint *v26; // x0
cocos2d::CCNode *v27; // x21
__int64 v28; // x0
__int64 v29; // x0
long double v30; // q0
__int64 v31; // x0
__int64 v32; // x0
__int64 v33; // x0
__int64 v34; // x0
int v35; // w0
__int64 v36; // x0
const cocos2d::CCPoint *v37; // x0
__int64 v38; // x0
_BYTE v39[16]; // [xsp+70h] [xbp+70h] BYREF
__int64 v40; // [xsp+80h] [xbp+80h] BYREF
__int64 v41; // [xsp+88h] [xbp+88h] BYREF
__int64 v42; // [xsp+90h] [xbp+90h] BYREF
_BYTE v43[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v44; // [xsp+A0h] [xbp+A0h] BYREF
float v45; // [xsp+A8h] [xbp+A8h] BYREF
float v46; // [xsp+ACh] [xbp+ACh]
float v47[2]; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v48; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v49; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v50[2]; // [xsp+C8h] [xbp+C8h] BYREF
v5 = 0;
if ( *(_DWORD *)(a1 + 432) == -1 )
{
v7 = ControlMenuTouch::began((__int64 *)(a1 + 560), (__int64)a2, a3);
v5 = v7;
if ( !v7 )
{
cocos2d::CCTouch::getLocation(&v40, a2);
v8 = 1;
cocos2d::CCNode::convertToNodeSpace(&v41, *(cocos2d::CCNode **)(a1 + 408), (const cocos2d::CCPoint *)&v40);
cocos2d::CCNode::convertToNodeSpace(&v42, (cocos2d::CCNode *)a1, (const cocos2d::CCPoint *)&v40);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43);
v9 = &v42;
while ( 1 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, (const cocos2d::CCPoint *)v9);
v10 = (cocos2d::CCNode *)GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, v8);
cocos2d::CCNode::boundingBox(v50, v10);
if ( (unsigned __int8)cocos2d::CCRect::containsPoint((cocos2d::CCRect *)v50, (const cocos2d::CCPoint *)&v49) )
break;
if ( ++v8 == 13 )
goto LABEL_10;
if ( v8 == 12 )
v9 = &v42;
else
v9 = &v41;
}
*(_WORD *)(a1 + 436) = v8;
cocos2d::CCPoint::operator=(v43, &v49);
LABEL_10:
if ( *(_WORD *)(a1 + 436) )
{
v11 = *(_QWORD *)(a1 + 440);
if ( v11 )
(*(void (__fastcall **)(__int64))(*(_QWORD *)v11 + 80LL))(v11);
if ( *(_BYTE *)(a1 + 601)
|| (v38 = cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)*(unsigned __int8 *)(a1 + 601)),
*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v38 + 192LL))(v38) + 130)) )
{
v12 = *(__int16 *)(a1 + 436);
if ( (unsigned __int16)(*(_WORD *)(a1 + 436) - 2) <= 7u && *(_QWORD *)(a1 + 440) )
{
*(_BYTE *)(a1 + 628) = 1;
OppositeHandleTag = GJTransformControl::getOppositeHandleTag((GJTransformControl *)a1, v12);
v14 = *(cocos2d::CCNode **)(a1 + 408);
v15 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 1);
v16 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 192LL))(v15);
cocos2d::CCNode::convertToWorldSpace(v50, (cocos2d::CCNode *)a1, v16);
cocos2d::CCNode::convertToNodeSpace(&v44, v14, (const cocos2d::CCPoint *)v50);
v17 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 6);
v18 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 192LL))(v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, v18);
v19 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 9);
v20 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v19 + 192LL))(v19);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v47, v20);
v21 = v47[1] - v46;
if ( (float)(v47[0] - v45) == 0.0 )
v22 = 0.5;
else
v22 = (float)(*(float *)&v44 - v45) / (float)(v47[0] - v45);
if ( v21 == 0.0 )
v23 = 0.5;
else
v23 = (float)(*((float *)&v44 + 1) - v46) / v21;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, v22, v23);
cocos2d::CCPoint::operator=(a1 + 620, v50);
v24 = *(cocos2d::CCNode **)(a1 + 408);
v25 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, OppositeHandleTag);
v26 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 192LL))(v25);
cocos2d::CCNode::convertToWorldSpace(&v48, v24, v26);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const cocos2d::CCPoint *)&v48);
GJTransformControl::moveAnchorTo(a1, (const cocos2d::CCPoint *)v50);
v27 = *(cocos2d::CCNode **)(a1 + 408);
cocos2d::CCTouch::getLocation(v50, a2);
cocos2d::CCNode::convertToNodeSpace(&v49, v27, (const cocos2d::CCPoint *)v50);
cocos2d::CCPoint::operator=(v43, &v49);
v12 = *(__int16 *)(a1 + 436);
goto LABEL_21;
}
}
else
{
v12 = *(__int16 *)(a1 + 436);
}
*(_BYTE *)(a1 + 628) = 0;
LABEL_21:
*(_DWORD *)(a1 + 432) = *((_DWORD *)a2 + 14);
v28 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, v12);
v29 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v28 + 192LL))(v28);
cocos2d::CCPoint::operator-(v50, v29, v43, v30);
cocos2d::CCPoint::operator=(a1 + 448, v50);
v31 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 7);
v32 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v31 + 192LL))(v31);
cocos2d::CCPoint::operator=(a1 + 472, v32);
v33 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 8);
v34 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v33 + 192LL))(v33);
cocos2d::CCPoint::operator=(a1 + 480, v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, *(float *)(a1 + 592), *(float *)(a1 + 596));
cocos2d::CCPoint::operator=(a1 + 488, v50);
v35 = *(__int16 *)(a1 + 436);
if ( v35 == 12 )
{
v5 = 1;
*(_DWORD *)(a1 + 604) = *(_DWORD *)(a1 + 608);
}
else
{
v5 = 1;
if ( v35 == 1 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, 3.4028e38, 3.4028e38);
cocos2d::CCPoint::operator=(a1 + 636, v50);
*(_DWORD *)(a1 + 632) = 0;
v36 = GJTransformControl::spriteByTag((cocos2d::CCArray **)a1, 1);
v37 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v36 + 192LL))(v36);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, v37);
GJTransformControl::snapToNearestVertex(a1, (const cocos2d::CCPoint *)v50, (cocos2d::CCPoint *)v39);
}
}
}
}
}
return v5;
}