//
// EditorUI::createLoop from 0x48530c to 0x4856ce (962 bytes)
//
// 2 xrefs:
// > EditorUI::handleEditorAction @ 0x6f1ffa
// > EditorCommandsPopup::onCommand @ 0x77a778
//
// 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:49:25 +0000
//
cocos2d::CCArray **__fastcall EditorUI::createLoop(cocos2d::CCArray **this)
{
int v1; // r4
cocos2d::CCArray *v2; // r0
cocos2d::CCObject *v3; // r1
size_t **v4; // r6
unsigned int v5; // r5
GameObject *v6; // r0
float v7; // s16
unsigned int v8; // r8
float v9; // s17
cocos2d::CCArray *v10; // r0
cocos2d::CCArray *v11; // r7
cocos2d::CCObject *v12; // r0
cocos2d::CCObject *v13; // r5
float v14; // s18
float v15; // s17
cocos2d::CCArray *v16; // r0
cocos2d::CCArray *Object; // r11
int v18; // r0
float v19; // s16
cocos2d::CCArray *v20; // r0
cocos2d::CCObject *v21; // r1
LevelEditorLayer *v22; // r0
float v23; // s18
GameObject *v24; // r5
int v25; // r8
unsigned int v26; // r5
float v27; // r1
float v28; // s17
int (__fastcall *v29)(int, float *, _DWORD, _DWORD, _DWORD, _DWORD); // r9
float v30; // s20
cocos2d::CCArray *v31; // r0
float v32; // s16
int v33; // r9
cocos2d::CCArray *v34; // r0
int v35; // r0
int v36; // r10
float (__fastcall *v37)(int, float *, _DWORD, _DWORD, _DWORD, _DWORD); // r8
float v38; // s19
int v39; // r10
unsigned int i; // r6
GameObject *v41; // r11
LevelEditorLayer *v42; // r0
GameObject *v43; // r11
cocos2d::CCArray *v44; // r11
int NextFreeGroupID; // [sp+Ch] [bp-50h]
cocos2d::CCArray *v46; // [sp+10h] [bp-4Ch]
cocos2d::CCArray *v47; // [sp+18h] [bp-44h]
int v48; // [sp+1Ch] [bp-40h]
_BYTE v49[8]; // [sp+28h] [bp-34h] BYREF
_BYTE v50[8]; // [sp+30h] [bp-2Ch] BYREF
float v51; // [sp+38h] [bp-24h] BYREF
float v52; // [sp+3Ch] [bp-20h]
float v53; // [sp+40h] [bp-1Ch] BYREF
int v54; // [sp+44h] [bp-18h]
int v55; // [sp+48h] [bp-14h]
int v56; // [sp+4Ch] [bp-10h]
int v57; // [sp+50h] [bp-Ch]
v1 = (int)this;
if ( *(this + 249) || (this = (cocos2d::CCArray **)cocos2d::CCArray::count(*(this + 167))) != nullptr )
{
v2 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)this);
v3 = *(cocos2d::CCObject **)(v1 + 996);
v4 = (size_t **)v2;
if ( v3 )
cocos2d::CCArray::addObject(v2, v3);
else
cocos2d::CCArray::addObjectsFromArray(v2, *(cocos2d::CCArray **)(v1 + 668));
v5 = 0;
while ( v5 < cocos2d::CCArray::count((cocos2d::CCArray *)v4) )
{
v6 = (GameObject *)cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)v4, v5);
if ( GameObject::isSpawnableTrigger(v6) )
++v5;
else
cocos2d::CCArray::removeObjectAtIndex((cocos2d::CCArray *)v4, v5, 1);
}
v7 = 0.0;
v8 = 0;
v9 = 0.0;
qsort((void *)v4[13][3], *v4[13], 4u, alignXSort);
v11 = (cocos2d::CCArray *)cocos2d::CCArray::create(v10);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49);
while ( v8 < cocos2d::CCArray::count((cocos2d::CCArray *)v4) )
{
v12 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)v4, v8);
v13 = v12;
if ( !v8 )
{
(*(void (__fastcall **)(float *, cocos2d::CCObject *))(*(_DWORD *)v12 + 680))(&v53, v12);
cocos2d::CCPoint::operator=(v49, &v53);
}
*((_BYTE *)v13 + 1293) = 1;
*((_BYTE *)v13 + 1484) = 1;
(*(void (__fastcall **)(float *, cocos2d::CCObject *))(*(_DWORD *)v13 + 680))(&v51, v13);
v14 = v51;
if ( v51 >= v9 && v9 != 0.0 )
v14 = v9;
v15 = v52;
if ( v52 <= v7 && v7 != 0.0 )
v15 = v7;
v16 = (cocos2d::CCArray *)cocos2d::CCArray::count(v11);
if ( v16
&& (Object = (cocos2d::CCArray *)cocos2d::CCArray::lastObject(v11),
v18 = cocos2d::CCArray::objectAtIndex(Object, 0),
v19 = v51,
v16 = (cocos2d::CCArray *)(*(int (__fastcall **)(float *, int))(*(_DWORD *)v18 + 680))(&v53, v18),
(float)(v19 - v53) <= 0.1) )
{
v20 = Object;
v21 = v13;
}
else
{
v44 = (cocos2d::CCArray *)cocos2d::CCArray::create(v16);
cocos2d::CCArray::addObject(v44, v13);
v20 = v11;
v21 = v44;
}
v7 = v15;
cocos2d::CCArray::addObject(v20, v21);
++v8;
v9 = v14;
}
v22 = *(LevelEditorLayer **)(v1 + 944);
v53 = 0.0;
v54 = 0;
v55 = 0;
v56 = 0;
v57 = 1065353216;
NextFreeGroupID = LevelEditorLayer::getNextFreeGroupID(v22, (int)&v53);
std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v53);
v23 = 0.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, v9, v7 + 90.0);
v24 = EditorUI::createObject(v1, (GameObject *)&stru_4EC.st_size, (const cocos2d::CCPoint *)&v53);
EffectGameObject::setTargetID(v24, NextFreeGroupID);
LevelEditorLayer::refreshSpecial(*(LevelEditorLayer **)(v1 + 944), v24);
v25 = *(_DWORD *)(v1 + 944);
v26 = 0;
v27 = v9;
v28 = 0.0;
v29 = *(int (__fastcall **)(int, float *, _DWORD, _DWORD, _DWORD, _DWORD))(*(_DWORD *)v25 + 704);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, v27, 0.0);
v30 = COERCE_FLOAT(v29(v25, &v53, 0, 0, 0, 0));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50);
v31 = (cocos2d::CCArray *)rand();
v32 = v7 + 60.0;
v33 = NextFreeGroupID;
v47 = (cocos2d::CCArray *)cocos2d::CCArray::create(v31);
while ( v26 < cocos2d::CCArray::count(v11) )
{
v48 = cocos2d::CCArray::count(v11) - 1;
v46 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v11, v26);
if ( v26 >= cocos2d::CCArray::count(v11) - 1 )
{
v38 = v28;
}
else
{
v34 = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(v11, v26 + 1);
v35 = cocos2d::CCArray::objectAtIndex(v34, 0);
(*(void (__fastcall **)(float *, int))(*(_DWORD *)v35 + 680))(&v53, v35);
v36 = *(_DWORD *)(v1 + 944);
v37 = *(float (__fastcall **)(int, float *, _DWORD, _DWORD, _DWORD, _DWORD))(*(_DWORD *)v36 + 704);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, v53, 0.0);
v38 = v37(v36, &v53, 0, 0, 0, 0) - v30;
}
v39 = v33;
for ( i = 0; i < cocos2d::CCArray::count(v46); ++i )
{
v41 = (GameObject *)cocos2d::CCArray::objectAtIndex(v46, i);
LevelEditorLayer::addObjectToGroup(*(LevelEditorLayer **)(v1 + 944), v41, v33);
if ( !i )
{
if ( v26 == v48 )
{
v28 = v38;
v39 = NextFreeGroupID;
}
else
{
v42 = *(LevelEditorLayer **)(v1 + 944);
v53 = 0.0;
v54 = 0;
v55 = 0;
v56 = 0;
v57 = 1065353216;
v39 = LevelEditorLayer::getNextFreeGroupID(v42, (int)&v53);
std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)&v53);
v28 = v38 - v23;
}
(*(void (__fastcall **)(float *, GameObject *))(*(_DWORD *)v41 + 680))(&v51, v41);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, v51, v32);
cocos2d::CCPoint::operator=(v50, &v53);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, (const cocos2d::CCPoint *)v50);
v43 = EditorUI::createObject(v1, (GameObject *)&stru_4EC.st_size, (const cocos2d::CCPoint *)&v53);
cocos2d::CCArray::addObject(v47, v43);
LevelEditorLayer::addObjectToGroup(*(LevelEditorLayer **)(v1 + 944), v43, v33);
EffectGameObject::setTargetID(v43, v39);
*((float *)v43 + 422) = v28;
*((_BYTE *)v43 + 1293) = 1;
*((_BYTE *)v43 + 1484) = 1;
LevelEditorLayer::refreshSpecial(*(LevelEditorLayer **)(v1 + 944), v43);
v23 = v23 + v28;
}
}
++v26;
v33 = v39;
}
return (cocos2d::CCArray **)LevelEditorLayer::dirtifyTriggers(*(_BYTE **)(v1 + 944));
}
return this;
}