//
// EditorUI::ccTouchEnded from 0xbd5fec to 0xbd6944 (2392 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'EditorUI::ccTouchEnded @ 0xbd694c
// > ??> @ 0x103858
// > ??> @ 0x1437100
//
// 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:40 +0000
//
__int64 __fastcall EditorUI::ccTouchEnded(cocos2d::CCNode *this, unsigned int *a2, __int64 a3)
{
GameManager *v6; // x0
__int64 v7; // x1
__int64 v9; // x4
GameManager *v10; // x0
int GameVariable; // w24
const cocos2d::CCPoint *v12; // x2
GameToolbox *v13; // x0
const cocos2d::CCPoint *v14; // x2
float v15; // s0
char *v16; // x24
unsigned int v17; // w26
_BOOL4 v18; // w25
int v19; // w0
GameManager *v20; // x0
GameManager *v21; // x0
char v22; // w0
GameObject *v23; // x1
int v24; // w21
cocos2d::CCPoint *v25; // x0
__int64 v26; // x0
long double v27; // q0
UndoObject *v28; // x1
cocos2d::CCObject *v29; // x0
GameObject *v30; // x0
EditorSFXManager *v31; // x0
EditorSFXManager *v32; // x0
int v33; // w1
int v34; // w21
cocos2d::CCArray *v35; // x0
const cocos2d::CCPoint *v36; // x2
GameToolbox *v37; // x0
float v38; // s0
const cocos2d::CCPoint *v39; // x2
float v40; // s0
cocos2d::CCNode *v41; // x25
float v42; // s0
float v43; // s1
const cocos2d::CCPoint *v44; // x2
GameToolbox *v45; // x0
float v46; // s0
__int64 v47; // x21
cocos2d::CCArray *v48; // x0
cocos2d::CCArray *CycledObject; // x21
cocos2d::CCObject *v50; // x1
cocos2d::CCArray *v51; // x0
EditorSFXManager *v52; // x0
EditorSFXManager *v53; // x0
__int64 v54; // x27
cocos2d::CCArray *v55; // x0
GameObject *v56; // x21
cocos2d::CCObject *v57; // x1
cocos2d::CCArray *v58; // x0
long double v59; // q0
const cocos2d::CCPoint *v60; // x0
long double v61; // q0
unsigned int i; // w21
__int64 v63; // x28
long double v64; // q0
__int64 v65; // x21
void (__fastcall *v66)(__int64, float *); // x28
__int64 v67; // x0
EditorSFXManager *v68; // x0
EditorSFXManager *v69; // x0
__int64 v70; // x21
void (__fastcall *v71)(__int64, float *); // x28
__int64 v72; // x0
GameObject *Object; // x0
cocos2d::CCPoint *v74; // [xsp+78h] [xbp+78h]
_BYTE v75[8]; // [xsp+88h] [xbp+88h] BYREF
_BYTE v76[8]; // [xsp+90h] [xbp+90h] BYREF
_BYTE v77[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v78; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v79; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v80; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v81[2]; // [xsp+B8h] [xbp+B8h] BYREF
float v82[4]; // [xsp+C8h] [xbp+C8h] BYREF
if ( !*((_BYTE *)this + 750) || *((_DWORD *)this + 176) != a2[14] )
{
*((_BYTE *)this + 776) = 0;
cocos2d::CCNode::stopActionByTag(this, 123);
v6 = (GameManager *)a2[14];
if ( *((_DWORD *)this + 174) != (_DWORD)v6 )
goto LABEL_4;
LABEL_12:
v9 = *((_QWORD *)this + 95);
*((_DWORD *)this + 174) = -1;
LABEL_13:
(*(void (__fastcall **)(__int64, unsigned int *, __int64))(*(_QWORD *)v9 + 912LL))(v9, a2, a3);
return _stack_chk_guard;
}
cocos2d::CCNode::stopActionByTag(this, 128);
EditorUI::finishTouchDelay(this);
*((_BYTE *)this + 776) = 0;
cocos2d::CCNode::stopActionByTag(this, 123);
v6 = (GameManager *)a2[14];
if ( *((_DWORD *)this + 174) == (_DWORD)v6 )
goto LABEL_12;
LABEL_4:
if ( (_DWORD)v6 == *((_DWORD *)this + 175) )
{
v9 = *((_QWORD *)this + 98);
*((_DWORD *)this + 175) = -1;
goto LABEL_13;
}
if ( (_DWORD)v6 == *((_DWORD *)this + 178) )
{
v9 = *((_QWORD *)this + 99);
*((_DWORD *)this + 178) = -1;
goto LABEL_13;
}
v7 = *((_QWORD *)this + 180);
if ( *(_DWORD *)(v7 + 1972) == 1 )
{
(*(void (__fastcall **)(_QWORD, unsigned int *, __int64))(**(_QWORD **)(v7 + 13288) + 912LL))(
*(_QWORD *)(v7 + 13288),
a2,
a3);
return _stack_chk_guard;
}
if ( *((_BYTE *)this + 748) )
{
*((_BYTE *)this + 748) = 0;
*((_DWORD *)this + 179) = -1;
*((_DWORD *)this + 176) = -1;
*((_BYTE *)this + 1512) = 0;
return _stack_chk_guard;
}
if ( (_DWORD)v6 == *((_DWORD *)this + 176) )
{
v10 = (GameManager *)GameManager::sharedState(v6);
GameVariable = (unsigned __int8)GameManager::getGameVariable(v10, "0059");
EditorUI::getTouchPoint((cocos2d::CCTouch *)a2, this, (const cocos2d::CCPoint *)v75);
v13 = (GameToolbox *)cocos2d::ccpDistance(
(cocos2d::CCNode *)((char *)this + 1448),
(const cocos2d::CCPoint *)v75,
v12);
if ( GameVariable )
{
v16 = (char *)this + 1472;
v17 = v15 < GameToolbox::touchUnitsForMM(v13, 1.6);
v37 = (GameToolbox *)cocos2d::ccpDistance(
(cocos2d::CCNode *)((char *)this + 1472),
(const cocos2d::CCPoint *)v75,
v36);
v18 = GameToolbox::touchUnitsForMM(v37, 1.6) > v38;
}
else
{
v16 = (char *)this + 1472;
v17 = 0;
v18 = 0;
cocos2d::ccpDistance((cocos2d::CCNode *)((char *)this + 1472), (const cocos2d::CCPoint *)v75, v14);
}
v19 = *((unsigned __int8 *)this + 865);
*((_DWORD *)this + 176) = -1;
if ( v19 && *((_BYTE *)this + 863) && *((_QWORD *)this + 188) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v76, (const cocos2d::CCPoint *)&unk_155EA20);
EditorUI::getTouchPoint((cocos2d::CCTouch *)a2, this, (const cocos2d::CCPoint *)v77);
v20 = (GameManager *)cocos2d::CCNode::convertToNodeSpace(
&v78,
*(cocos2d::CCNode **)(*((_QWORD *)this + 180) + 3920LL),
(const cocos2d::CCPoint *)v77);
v21 = (GameManager *)GameManager::sharedState(v20);
v22 = GameManager::getGameVariable(v21, "0008");
v23 = *((GameObject **)this + 188);
if ( !v22 || !v23 )
goto LABEL_26;
if ( !EditorUI::shouldSnap(this, v23) )
{
v23 = *((GameObject **)this + 188);
LABEL_26:
v24 = 0;
LABEL_27:
v25 = (cocos2d::CCPoint *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)v23 + 192LL))(v23);
if ( (unsigned __int8)cocos2d::CCPoint::equals(v25, (cocos2d::CCNode *)((char *)this + 888)) )
*((_BYTE *)this + 689) = 1;
v26 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 188) + 192LL))(*((_QWORD *)this + 188));
cocos2d::CCPoint::operator-(v82, v26, (char *)this + 888, v27);
if ( !*((_BYTE *)this + 689) )
{
v28 = *((UndoObject **)this + 85);
if ( v28 )
{
LevelEditorLayer::addToUndoList(*((cocos2d::CCArray ***)this + 180), v28, 0);
v29 = *((cocos2d::CCObject **)this + 85);
if ( v29 )
{
cocos2d::CCObject::release(v29);
*((_QWORD *)this + 85) = 0;
}
}
}
v30 = *((GameObject **)this + 188);
goto LABEL_34;
}
if ( (unsigned __int8)cocos2d::CCPoint::equals((cocos2d::CCPoint *)v77, (cocos2d::CCNode *)((char *)this + 1448)) )
{
v23 = *((GameObject **)this + 188);
v24 = 0;
goto LABEL_27;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (const cocos2d::CCPoint *)&v78);
EditorUI::getGridSnappedPos((__int64)this, v82, (__int64)&v79);
EditorUI::getRelativeOffset(v81, this, *((GameObject **)this + 188));
v74 = *((cocos2d::CCPoint **)this + 188);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (const cocos2d::CCPoint *)&v79);
EditorUI::applySpecialOffset(&v80, this, v81, v74, v82);
cocos2d::CCPoint::operator+(v82, &v79);
*(__n128 *)&v59 = cocos2d::CCPoint::operator=(&v79, v82);
v60 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD, long double))(**((_QWORD **)this + 188) + 192LL))(
*((_QWORD *)this + 188),
v59);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v81, v60);
v61 = ((long double (__fastcall *)(_QWORD, __int64 *))*(_QWORD *)(**((_QWORD **)this + 188) + 184LL))(
*((_QWORD *)this + 188),
&v79);
cocos2d::CCPoint::operator-(v82, &v79, v81, v61);
cocos2d::CCPoint::operator=(v76, v82);
if ( (unsigned int)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112)) )
{
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112)); ++i )
{
v63 = cocos2d::CCArray::objectAtIndex(*((cocos2d::CCArray **)this + 112), i);
if ( *(_DWORD *)(v63 + 916) != *(_DWORD *)(*((_QWORD *)this + 188) + 916LL) )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (const cocos2d::CCPoint *)v76);
EditorUI::moveObject(this, v63, v82);
}
}
}
cocos2d::CCPoint::operator+(v82, (char *)this + 768);
*(__n128 *)&v64 = cocos2d::CCPoint::operator=((char *)this + 768, v82);
if ( (*(unsigned __int8 (__fastcall **)(_QWORD, long double))(**((_QWORD **)this + 95) + 352LL))(
*((_QWORD *)this + 95),
v64) )
{
v65 = *((_QWORD *)this + 95);
}
else
{
if ( !(*(unsigned __int8 (__fastcall **)(_QWORD))(**((_QWORD **)this + 98) + 352LL))(*((_QWORD *)this + 98)) )
{
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**((_QWORD **)this + 99) + 352LL))(*((_QWORD *)this + 99)) )
{
v70 = *((_QWORD *)this + 99);
v71 = *(void (__fastcall **)(__int64, float *))(*(_QWORD *)v70 + 184LL);
v72 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v70 + 192LL))(v70);
cocos2d::CCPoint::operator+(v82, v72);
v71(v70, v82);
GJTransformControl::refreshControl(*((GJTransformControl **)this + 99));
}
goto LABEL_87;
}
v65 = *((_QWORD *)this + 98);
}
v66 = *(void (__fastcall **)(__int64, float *))(*(_QWORD *)v65 + 184LL);
v67 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v65 + 192LL))(v65);
cocos2d::CCPoint::operator+(v82, v67);
v66(v65, v82);
LABEL_87:
v23 = *((GameObject **)this + 188);
v24 = 1;
goto LABEL_27;
}
if ( *((unsigned __int8 *)this + 861) > v17 )
{
v41 = *(cocos2d::CCNode **)(*((_QWORD *)this + 180) + 3920LL);
cocos2d::CCNode::convertToNodeSpace(&v79, v41, (cocos2d::CCNode *)((char *)this + 1448));
cocos2d::CCNode::convertToNodeSpace(&v80, v41, (cocos2d::CCNode *)((char *)this + 1456));
v42 = *(float *)&v80;
if ( *(float *)&v79 <= *(float *)&v80 )
v42 = *(float *)&v79;
v43 = *((float *)&v80 + 1);
if ( *((float *)&v79 + 1) <= *((float *)&v80 + 1) )
v43 = *((float *)&v79 + 1);
cocos2d::CCRect::CCRect(
(cocos2d::CCRect *)v81,
v42,
v43,
vabds_f32(*(float *)&v79, *(float *)&v80),
vabds_f32(*((float *)&v79 + 1), *((float *)&v80 + 1)));
EditorUI::getTouchPoint((cocos2d::CCTouch *)a2, this, (const cocos2d::CCPoint *)v82);
v45 = (GameToolbox *)cocos2d::ccpDistance(
(cocos2d::CCNode *)((char *)this + 1448),
(const cocos2d::CCPoint *)v82,
v44);
if ( v46 >= GameToolbox::touchUnitsForMM(v45, 1.6) )
{
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v82, (const cocos2d::CCRect *)v81);
EditorUI::selectObjectsInRect(this, v82);
}
else
{
v47 = *((_QWORD *)this + 180);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (const cocos2d::CCPoint *)&v80);
v48 = LevelEditorLayer::objectsAtPosition(v47, v82);
CycledObject = (cocos2d::CCArray *)EditorUI::getCycledObject(this, v48, 0);
if ( CycledObject )
{
EditorUI::createUndoSelectObject((cocos2d::CCArray ***)this, 0);
v51 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(CycledObject, v50);
v52 = (EditorSFXManager *)EditorUI::selectObjects(this, v51, 0);
v53 = (EditorSFXManager *)EditorSFXManager::sharedState(v52);
EditorSFXManager::playAction(v53, 121);
}
}
}
else
{
if ( *((_BYTE *)this + 1512) )
{
*((_BYTE *)this + 1512) = 0;
v24 = 0;
v30 = *((GameObject **)this + 188);
LABEL_34:
if ( v30 )
{
if ( *((_BYTE *)this + 865) && *((_BYTE *)this + 863) )
{
if ( *((_BYTE *)v30 + 1133) )
v31 = (EditorSFXManager *)(*(__int64 (__fastcall **)(GameObject *, __int64))(*(_QWORD *)v30 + 1528LL))(
v30,
65280);
else
v31 = (EditorSFXManager *)GameObject::deselectObject(v30);
v32 = (EditorSFXManager *)EditorSFXManager::sharedState(v31);
if ( v24 )
v33 = 106;
else
v33 = 105;
EditorSFXManager::playAction(v32, v33);
}
*((_QWORD *)this + 188) = 0;
}
*((_BYTE *)this + 862) = 0;
*((_BYTE *)this + 861) = 0;
*((_BYTE *)this + 865) = 0;
*((_BYTE *)this + 689) = 0;
cocos2d::CCPoint::operator=((char *)this + 872, &unk_155EA20);
*((_BYTE *)this + 863) = 0;
*((_BYTE *)this + 690) = 0;
cocos2d::CCPoint::operator=((char *)this + 1464, (char *)this + 1448);
*((_BYTE *)this + 1513) = 0;
v34 = *((unsigned __int8 *)this + 776);
EditorUI::updateButtons(this);
v35 = *((cocos2d::CCArray **)this + 110);
++*((_DWORD *)this + 385);
cocos2d::CCArray::removeAllObjects(v35);
if ( v34 )
{
EditorUI::updateSpecialUIElements((cocos2d::CCArray **)this);
(*(void (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)this + 1176LL))(this);
*((_BYTE *)this + 776) = 0;
}
cocos2d::CCPoint::operator=(v16, v75);
return _stack_chk_guard;
}
EditorUI::getTouchPoint((cocos2d::CCTouch *)a2, this, (const cocos2d::CCPoint *)v82);
cocos2d::ccpDistance((cocos2d::CCNode *)((char *)this + 1448), (const cocos2d::CCPoint *)v82, v39);
if ( !*((_BYTE *)this + 862) || v40 < 20.0 )
{
if ( *((_DWORD *)this + 359) == 3 )
{
cocos2d::CCNode::convertToNodeSpace(
v81,
*(cocos2d::CCNode **)(*((_QWORD *)this + 180) + 3920LL),
(cocos2d::CCNode *)((char *)this + 1448));
v30 = *((GameObject **)this + 188);
if ( v30 && *((_BYTE *)this + 690) )
goto LABEL_56;
v54 = *((_QWORD *)this + 180);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (const cocos2d::CCPoint *)v81);
v55 = LevelEditorLayer::objectsAtPosition(v54, v82);
v56 = (GameObject *)EditorUI::getCycledObject(this, v55, 0);
if ( v56 )
{
EditorUI::createUndoSelectObject((cocos2d::CCArray ***)this, 0);
if ( !*((_BYTE *)this + 861) )
{
v68 = (EditorSFXManager *)EditorUI::selectObject(this, v56, 0);
v69 = (EditorSFXManager *)EditorSFXManager::sharedState(v68);
EditorSFXManager::playAction(v69, 121);
v30 = *((GameObject **)this + 188);
goto LABEL_56;
}
if ( v18 )
{
if ( *((_QWORD *)this + 187) )
{
EditorUI::deselectObject(this);
}
else
{
Object = (GameObject *)cocos2d::CCArray::lastObject(*((cocos2d::CCArray **)this + 112));
if ( Object )
{
GameObject::deselectObject(Object);
cocos2d::CCArray::removeLastObject(*((cocos2d::CCArray **)this + 112), 1);
}
}
}
v58 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v56, v57);
EditorUI::selectObjects(this, v58, 0);
}
}
else if ( !*((_BYTE *)this + 1568) )
{
v24 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v82, (cocos2d::CCNode *)((char *)this + 1448));
EditorUI::clickOnPosition((__int64)this, v82);
v30 = *((GameObject **)this + 188);
goto LABEL_34;
}
v30 = *((GameObject **)this + 188);
LABEL_56:
v24 = 0;
goto LABEL_34;
}
}
v24 = 0;
v30 = *((GameObject **)this + 188);
goto LABEL_34;
}
return _stack_chk_guard;
}