//
// EditorUI::createLoop from 0x7c3e88 to 0x7c4494 (1548 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0xbd7960
// > EditorCommandsPopup::onCommand @ 0xcbc018
// > ??> @ 0x9f550
//
// 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 12:54:08 +0000
//
__int64 __fastcall EditorUI::createLoop(EditorUI *this)
{
cocos2d::CCArray *v2; // x0
cocos2d::CCArray *v3; // x0
cocos2d::CCArray *v4; // x21
cocos2d::CCObject *v5; // x1
unsigned int i; // w19
GameObject *v7; // x0
float v8; // s10
unsigned int v9; // w19
float v10; // s11
cocos2d::CCArray *v11; // x0
__int64 v12; // x1
float v13; // s8
float v14; // s9
cocos2d::CCArray *v15; // x0
cocos2d::CCArray *v16; // x26
__int64 v17; // x0
cocos2d::CCObject *v18; // x27
cocos2d::CCArray *Object; // x26
__int64 v20; // x0
float v21; // s10
LevelEditorLayer *v22; // x0
_QWORD *v23; // x0
_QWORD *v24; // x19
void *v25; // x0
float v26; // s9
unsigned int v27; // w24
float v28; // s8
float *v29; // x19
__int64 v30; // x19
float (__fastcall *v31)(__int64, void **, _QWORD, _QWORD, _QWORD, _QWORD); // x21
float v32; // s13
cocos2d::CCArray *v33; // x0
float v34; // s11
float v35; // s10
cocos2d::CCArray *v36; // x23
unsigned int v37; // w19
int j; // w25
GameObject *v39; // x21
float *v40; // x21
LevelEditorLayer *v42; // x0
_QWORD *v43; // x0
_QWORD *v44; // x27
void *v45; // x0
cocos2d::CCArray *v46; // x0
__int64 v47; // x0
__int64 v48; // x19
float (__fastcall *v49)(__int64, void **, _QWORD, _QWORD, _QWORD, _QWORD); // x21
cocos2d::CCArray *v50; // [xsp+98h] [xbp+98h]
int NextFreeGroupID; // [xsp+A4h] [xbp+A4h]
cocos2d::CCArray *v52; // [xsp+B0h] [xbp+B0h]
int v53; // [xsp+B8h] [xbp+B8h]
unsigned int v54; // [xsp+BCh] [xbp+BCh]
_BYTE v55[8]; // [xsp+C8h] [xbp+C8h] BYREF
_BYTE v56[8]; // [xsp+D0h] [xbp+D0h] BYREF
float v57; // [xsp+D8h] [xbp+D8h]
float v58; // [xsp+DCh] [xbp+DCh]
void *v59; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v60; // [xsp+E8h] [xbp+E8h]
void *v61; // [xsp+F0h] [xbp+F0h]
__int64 v62; // [xsp+F8h] [xbp+F8h]
float v63; // [xsp+100h] [xbp+100h]
v2 = *((cocos2d::CCArray **)this + 187);
if ( v2 || (v2 = (cocos2d::CCArray *)cocos2d::CCArray::count(*((cocos2d::CCArray **)this + 112)), (_DWORD)v2) )
{
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = v3;
v5 = *((cocos2d::CCObject **)this + 187);
if ( v5 )
cocos2d::CCArray::addObject(v3, v5);
else
cocos2d::CCArray::addObjectsFromArray(v3, *((cocos2d::CCArray **)this + 112));
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v4); cocos2d::CCArray::removeObjectAtIndex(v4, i, 1) )
{
while ( 1 )
{
v7 = (GameObject *)cocos2d::CCArray::objectAtIndex(v4, i);
if ( !GameObject::isSpawnableTrigger(v7) )
break;
if ( ++i >= (unsigned int)cocos2d::CCArray::count(v4) )
goto LABEL_8;
}
}
LABEL_8:
v8 = 0.0;
v9 = 0;
v10 = 0.0;
qsort(
*(void **)(*((_QWORD *)v4 + 7) + 16LL),
**((unsigned int **)v4 + 7),
8u,
(int (*)(const void *, const void *))alignXSort);
v50 = (cocos2d::CCArray *)cocos2d::CCArray::create(v11);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55);
while ( v9 < (unsigned int)cocos2d::CCArray::count(v4) )
{
v17 = cocos2d::CCArray::objectAtIndex(v4, v9);
v18 = (cocos2d::CCObject *)v17;
if ( !v9 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1360LL))(v17);
cocos2d::CCPoint::operator=(v55, &v59);
}
v12 = *(_QWORD *)v18;
*((_BYTE *)v18 + 1473) = 1;
*((_BYTE *)v18 + 1664) = 1;
(*(void (__fastcall **)(cocos2d::CCObject *))(v12 + 1360))(v18);
v13 = v57;
if ( v10 <= v57 && v10 != 0.0 )
v13 = v10;
v14 = v58;
if ( v8 >= v58 && v8 != 0.0 )
v14 = v8;
v15 = (cocos2d::CCArray *)cocos2d::CCArray::count(v50);
if ( (_DWORD)v15
&& (Object = (cocos2d::CCArray *)cocos2d::CCArray::lastObject(v50),
v20 = cocos2d::CCArray::objectAtIndex(Object, 0),
v21 = v57,
v15 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 1360LL))(v20),
(float)(v21 - *(float *)&v59) <= 0.1) )
{
cocos2d::CCArray::addObject(Object, v18);
}
else
{
v16 = (cocos2d::CCArray *)cocos2d::CCArray::create(v15);
cocos2d::CCArray::addObject(v16, v18);
cocos2d::CCArray::addObject(v50, v16);
}
v8 = v14;
++v9;
v10 = v13;
}
v22 = *((LevelEditorLayer **)this + 180);
v59 = nullptr;
v60 = 0;
v61 = nullptr;
v62 = 0;
v63 = 1.0;
NextFreeGroupID = LevelEditorLayer::getNextFreeGroupID(v22, (__int64)&v59);
v23 = v61;
if ( v61 )
{
do
{
v24 = (_QWORD *)*v23;
operator delete(v23);
v23 = v24;
}
while ( v24 );
}
v25 = v59;
v59 = nullptr;
if ( v25 )
operator delete(v25);
v26 = 0.0;
v54 = 0;
v27 = NextFreeGroupID;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v10, v8 + 90.0);
v28 = 0.0;
v29 = EditorUI::createObject((__int64)this, 0x4F4u, (const cocos2d::CCPoint *)&v59);
EffectGameObject::setTargetID((EffectGameObject *)v29, NextFreeGroupID);
LevelEditorLayer::refreshSpecial(*((LevelEditorLayer **)this + 180), (GameObject *)v29);
v30 = *((_QWORD *)this + 180);
v31 = *(float (__fastcall **)(__int64, void **, _QWORD, _QWORD, _QWORD, _QWORD))(*(_QWORD *)v30 + 1408LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v10, 0.0);
v32 = v31(v30, &v59, 0, 0, 0, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v56);
v33 = (cocos2d::CCArray *)rand();
v34 = v8 + 60.0;
v52 = (cocos2d::CCArray *)cocos2d::CCArray::create(v33);
if ( (unsigned int)cocos2d::CCArray::count(v50) )
{
do
{
v35 = v28;
v53 = cocos2d::CCArray::count(v50) - 1;
v36 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v50, v54);
if ( v54 < (unsigned int)cocos2d::CCArray::count(v50) - 1 )
{
v46 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v50, v54 + 1);
v47 = cocos2d::CCArray::objectAtIndex(v46, 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v47 + 1360LL))(v47);
v48 = *((_QWORD *)this + 180);
v49 = *(float (__fastcall **)(__int64, void **, _QWORD, _QWORD, _QWORD, _QWORD))(*(_QWORD *)v48 + 1408LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, *(float *)&v59, 0.0);
v35 = v49(v48, &v59, 0, 0, 0, 0) - v32;
}
v37 = 0;
for ( j = v27; v37 < (unsigned int)cocos2d::CCArray::count(v36); ++v37 )
{
v39 = (GameObject *)cocos2d::CCArray::objectAtIndex(v36, v37);
LevelEditorLayer::addObjectToGroup(*((LevelEditorLayer **)this + 180), v39, v27);
if ( !v37 )
{
if ( v54 == v53 )
{
v28 = v35;
j = NextFreeGroupID;
}
else
{
v42 = *((LevelEditorLayer **)this + 180);
v59 = nullptr;
v60 = 0;
v61 = nullptr;
v62 = 0;
v63 = 1.0;
j = LevelEditorLayer::getNextFreeGroupID(v42, (__int64)&v59);
v43 = v61;
if ( v61 )
{
do
{
v44 = (_QWORD *)*v43;
operator delete(v43);
v43 = v44;
}
while ( v44 );
}
v45 = v59;
v59 = nullptr;
if ( v45 )
operator delete(v45);
v28 = v35 - v26;
}
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)v39 + 1360LL))(v39);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, v57, v34);
cocos2d::CCPoint::operator=(v56, &v59);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v59, (const cocos2d::CCPoint *)v56);
v40 = EditorUI::createObject((__int64)this, 0x4F4u, (const cocos2d::CCPoint *)&v59);
cocos2d::CCArray::addObject(v52, (cocos2d::CCObject *)v40);
LevelEditorLayer::addObjectToGroup(*((LevelEditorLayer **)this + 180), (GameObject *)v40, v27);
EffectGameObject::setTargetID((EffectGameObject *)v40, j);
*((_BYTE *)v40 + 1473) = 1;
*((_BYTE *)v40 + 1664) = 1;
v40[476] = v28;
LevelEditorLayer::refreshSpecial(*((LevelEditorLayer **)this + 180), (GameObject *)v40);
v26 = v26 + v28;
}
}
v27 = j;
++v54;
}
while ( v54 < (unsigned int)cocos2d::CCArray::count(v50) );
}
LevelEditorLayer::dirtifyTriggers(*((LevelEditorLayer **)this + 180));
}
return _stack_chk_guard;
}