//
// GJTransformControl::ccTouchBegan from 0x1401a6f20 to 0x1401a7408 (1256 bytes)
//
// 4 xrefs:
// > ??> @ 0x140750428
// > ??> @ 0x1408a0cf0
// > ??> @ 0x1408a0d00
// > ??> @ 0x140919be0
//
// This function is hookable on this platform (idp: pc, 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 11:27:50 +0000
//
char __fastcall GJTransformControl::ccTouchBegan(__int64 a1, __int64 a2, __int64 a3)
{
unsigned int v5; // esi
int v6; // ebx
const struct cocos2d::CCPoint *v7; // rdx
struct cocos2d::CCObject *v8; // rax
cocos2d::CCRect *v9; // rax
__int16 *v10; // r14
__int16 v11; // dx
__int64 v12; // rcx
__int64 v13; // rax
struct cocos2d::CCObject *v14; // rax
__int64 v15; // rax
__int64 v16; // rax
struct cocos2d::CCObject *v17; // rax
const struct cocos2d::CCPoint *v18; // rax
struct cocos2d::CCObject *v19; // rax
const struct cocos2d::CCPoint *v20; // rax
float v21; // xmm1_4
float v22; // xmm0_4
float v23; // xmm2_4
__int64 v24; // rax
struct cocos2d::CCObject *v25; // rax
__int64 v26; // rax
__int64 v27; // rax
__int64 Location; // rax
__int64 v29; // rax
unsigned int v30; // edx
cocos2d::CCArray *v31; // rcx
struct cocos2d::CCObject *v32; // rax
__int64 v33; // rax
struct cocos2d::CCObject *v34; // rax
__int64 v35; // rax
struct cocos2d::CCObject *v36; // rax
__int64 v37; // rax
__int64 v38; // rax
__int64 v40; // rax
cocos2d::CCArray *v41; // rcx
struct cocos2d::CCObject *v42; // rax
const struct cocos2d::CCPoint *v43; // rax
__int64 v44; // rax
_BYTE v45[8]; // [rsp+20h] [rbp-50h] BYREF
_BYTE v46[8]; // [rsp+28h] [rbp-48h] BYREF
float v47; // [rsp+30h] [rbp-40h] BYREF
float v48; // [rsp+34h] [rbp-3Ch]
float v49[2]; // [rsp+38h] [rbp-38h] BYREF
_BYTE v50[8]; // [rsp+40h] [rbp-30h] BYREF
_BYTE v51[8]; // [rsp+48h] [rbp-28h] BYREF
_BYTE v52[8]; // [rsp+50h] [rbp-20h] BYREF
_BYTE v53[24]; // [rsp+58h] [rbp-18h] BYREF
float v54; // [rsp+A0h] [rbp+30h] BYREF
float v55; // [rsp+A4h] [rbp+34h]
char v56; // [rsp+B8h] [rbp+48h] BYREF
if ( *(_DWORD *)(a1 + 112) == -1 )
{
if ( ControlMenuTouch::began((__int64 *)(a1 + 240), a2, a3) )
return 1;
cocos2d::CCTouch::getLocation(a2, v46);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 88), v50, v46);
cocos2d::CCNode::convertToNodeSpace(a1 - 320, v51, v46);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56);
v5 = 1;
v6 = 1;
while ( 1 )
{
if ( v6 == 12 || (v7 = (const struct cocos2d::CCPoint *)v50, v6 == 1) )
v7 = (const struct cocos2d::CCPoint *)v51;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v7);
v8 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), v6 - 1);
v9 = (cocos2d::CCRect *)cocos2d::CCNode::boundingBox(v8, v53);
if ( cocos2d::CCRect::containsPoint(v9, (const struct cocos2d::CCPoint *)&v54) )
break;
if ( ++v6 >= 13 )
{
v10 = (__int16 *)(a1 + 116);
goto LABEL_11;
}
}
v10 = (__int16 *)(a1 + 116);
*(_WORD *)(a1 + 116) = v6;
cocos2d::CCPoint::operator=(&v56, &v54);
LABEL_11:
v11 = *v10;
if ( *v10 )
{
v12 = *(_QWORD *)(a1 + 120);
if ( v12 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 80LL))(v12);
v11 = *v10;
}
if ( !*(_BYTE *)(a1 + 281) )
{
v13 = cocos2d::CCDirector::sharedDirector(v12);
if ( !*(_BYTE *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 176LL))(v13) + 154) )
goto LABEL_33;
v11 = *v10;
}
if ( (unsigned __int16)(v11 - 2) <= 7u && *(_QWORD *)(a1 + 120) )
{
*(_BYTE *)(a1 + 308) = 1;
switch ( v11 )
{
case 2:
v5 = 2;
break;
case 3:
break;
case 4:
v5 = 4;
break;
case 5:
v5 = 3;
break;
case 6:
v5 = 8;
break;
case 7:
v5 = 7;
break;
case 8:
v5 = 6;
break;
case 9:
v5 = 5;
break;
}
v14 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), 0);
v15 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v14 + 200LL))(v14);
cocos2d::CCNode::convertToWorldSpace(a1 - 320, v45, v15);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 88), v49, v16);
v17 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), 5u);
v18 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v17 + 200LL))(v17);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v18);
v19 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), 8u);
v20 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v19 + 200LL))(v19);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v47, v20);
v21 = v47 - v54;
v22 = 0.5;
if ( (float)(v48 - v55) == 0.0 )
v23 = 0.5;
else
v23 = (float)(v49[1] - v55) / (float)(v48 - v55);
if ( v21 != 0.0 )
v22 = (float)(v49[0] - v54) / v21;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v45, v22, v23);
cocos2d::CCPoint::operator=(a1 + 300, v24);
v25 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), v5);
v26 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v25 + 200LL))(v25);
cocos2d::CCNode::convertToWorldSpace(*(_QWORD *)(a1 + 88), v52, v26);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v45, (const struct cocos2d::CCPoint *)v52);
GJTransformControl::moveAnchorTo(a1 - 320, v27);
Location = cocos2d::CCTouch::getLocation(a2, v45);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 88), v53, Location);
cocos2d::CCPoint::operator=(&v56, v29);
goto LABEL_34;
}
LABEL_33:
*(_BYTE *)(a1 + 308) = 0;
LABEL_34:
v30 = *v10 - 1;
v31 = *(cocos2d::CCArray **)(a1 + 192);
*(_DWORD *)(a1 + 112) = *(_DWORD *)(a2 + 56);
v32 = cocos2d::CCArray::objectAtIndex(v31, v30);
v33 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v32 + 200LL))(v32);
cocos2d::CCPoint::operator-(v33, &v54, &v56);
cocos2d::CCPoint::operator=(a1 + 128, &v54);
v34 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), 6u);
v35 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v34 + 200LL))(v34);
cocos2d::CCPoint::operator=(a1 + 152, v35);
v36 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 192), 7u);
v37 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v36 + 200LL))(v36);
cocos2d::CCPoint::operator=(a1 + 160, v37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, *(float *)(a1 + 272), *(float *)(a1 + 276));
cocos2d::CCPoint::operator=(a1 + 168, v38);
if ( *v10 == 12 )
{
*(_DWORD *)(a1 + 284) = *(_DWORD *)(a1 + 288);
return 1;
}
if ( *v10 == 1 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, 3.4028235e38, 3.4028235e38);
cocos2d::CCPoint::operator=(a1 + 316, v40);
v41 = *(cocos2d::CCArray **)(a1 + 192);
*(_DWORD *)(a1 + 312) = 0;
v42 = cocos2d::CCArray::objectAtIndex(v41, 0);
v43 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v42 + 200LL))(v42);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v43);
GJTransformControl::snapToNearestVertex(a1 - 320, v53, v44);
}
return 1;
}
}
return 0;
}