//
// EditorUI::alignObjects from 0x70f34c to 0x70f69c (848 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0x6f1fb6
// > EditorUI::handleEditorAction @ 0x6f1fce
// > EditorCommandsPopup::onCommand @ 0x77a7cc
//
// 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:57:43 +0000
//
unsigned int __fastcall EditorUI::alignObjects(unsigned int this, size_t **a2, int a3)
{
int v3; // r5
cocos2d::CCArray *v5; // r0
unsigned int v6; // r1
cocos2d::CCArray *v7; // r0
cocos2d::CCDictionary *v8; // r0
cocos2d::CCDictionary *v9; // r7
unsigned int v10; // r6
size_t *v11; // r3
void *v12; // r0
size_t v13; // r1
int (*v14)(const void *, const void *); // r3
int v15; // r8
cocos2d::CCObject *v16; // r0
unsigned int v17; // r6
cocos2d::CCArray *v18; // r7
int v19; // r9
cocos2d::CCArray *StickyGroup; // r2
const char *v21; // r1
GameObject *v22; // r0
cocos2d::CCObject *v23; // r11
int v24; // r3
size_t *v25; // r2
size_t v26; // r3
unsigned int *v27; // r2
unsigned int v28; // r8
unsigned int *v29; // r10
int i; // r2
unsigned int v31; // t1
int v32; // r0
unsigned int v33; // r7
int *v34; // r9
const cocos2d::CCPoint *v35; // r0
float v36; // s15
float v37; // r1
float v38; // r2
cocos2d::CCArray *v39; // r9
unsigned int v40; // r11
GameObject *v41; // r0
const cocos2d::CCPoint *v42; // r0
cocos2d::CCPoint *v44; // [sp+4h] [bp-58h]
cocos2d::CCPoint *v45; // [sp+4h] [bp-58h]
GameObject *v46; // [sp+Ch] [bp-50h]
float v47; // [sp+14h] [bp-48h] BYREF
float v48; // [sp+18h] [bp-44h]
float v49; // [sp+1Ch] [bp-40h] BYREF
float v50; // [sp+20h] [bp-3Ch]
_BYTE v51[8]; // [sp+24h] [bp-38h] BYREF
float v52[2]; // [sp+2Ch] [bp-30h] BYREF
_DWORD v53[2]; // [sp+34h] [bp-28h] BYREF
_BYTE v54[8]; // [sp+3Ch] [bp-20h] BYREF
_BYTE v55[8]; // [sp+44h] [bp-18h] BYREF
float v56; // [sp+4Ch] [bp-10h] BYREF
float v57; // [sp+50h] [bp-Ch]
v3 = this;
if ( a2 )
{
this = cocos2d::CCArray::count((cocos2d::CCArray *)a2);
if ( this > 2 )
{
v5 = (cocos2d::CCArray *)cocos2d::CCArray::count((cocos2d::CCArray *)a2);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::createWithCapacity(v5, v6);
v8 = (cocos2d::CCDictionary *)cocos2d::CCArray::addObjectsFromArray(v7, (cocos2d::CCArray *)a2);
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v8);
if ( *(_BYTE *)(v3 + 643) )
{
v10 = *(unsigned __int8 *)(v3 + 644);
if ( !*(_BYTE *)(v3 + 644) )
{
while ( v10 < cocos2d::CCArray::count((cocos2d::CCArray *)a2) )
{
v15 = cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)a2, v10);
if ( *(int *)(v15 + 740) <= 0 )
{
++v10;
}
else
{
cocos2d::CCArray::removeObjectAtIndex((cocos2d::CCArray *)a2, v10, 1);
if ( !cocos2d::CCDictionary::objectForKey(v9, *(_DWORD *)(v15 + 740)) )
{
v16 = (cocos2d::CCObject *)cocos2d::CCNode::create(nullptr);
cocos2d::CCDictionary::setObject(v9, v16, *(_DWORD *)(v15 + 740));
}
}
}
v17 = 0;
v18 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v9);
while ( v17 < cocos2d::CCArray::count(v18) )
{
v19 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v18, v17) + 52);
StickyGroup = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(
*(cocos2d::CCDictionary ***)(v3 + 944),
v19);
if ( StickyGroup )
{
EditorUI::getGroupCenter((EditorUI *)v55, (cocos2d::CCArray *)v3, StickyGroup, 1);
v22 = GameObject::createWithFrame((GameObject *)"checkpoint_01_001.png", v21);
*((_DWORD *)v22 + 223) = 44;
v23 = v22;
v24 = *(_DWORD *)v22;
*((_DWORD *)v22 + 185) = v19;
v44 = *(cocos2d::CCPoint **)(v24 + 684);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, (const cocos2d::CCPoint *)v55);
((void (__fastcall *)(cocos2d::CCObject *, float *))v44)(v23, &v56);
cocos2d::CCArray::addObject((cocos2d::CCArray *)a2, v23);
}
++v17;
}
}
}
v11 = a2[13];
v12 = (void *)v11[3];
v13 = *v11;
if ( a3 )
v14 = (int (*)(const void *, const void *))alignYSort;
else
v14 = (int (*)(const void *, const void *))alignXSort;
qsort(v12, v13, 4u, v14);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v47);
this = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49);
v25 = a2[13];
v26 = *v25;
if ( *v25 )
{
v27 = (unsigned int *)v25[3];
v28 = (unsigned int)&v27[v26 - 1];
v29 = v27;
for ( i = 1; (unsigned int)v29 <= v28; i = 0 )
{
v31 = *v29++;
this = v31;
if ( !v31 )
break;
v45 = (cocos2d::CCPoint *)i;
v42 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(unsigned int))(*(_DWORD *)this + 96))(this);
this = cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, v42);
if ( v45 )
{
cocos2d::CCPoint::operator=(&v47, &v56);
this = cocos2d::CCPoint::operator=(&v49, &v56);
}
else
{
if ( v56 < v47 )
v47 = v56;
if ( v56 > v49 )
v49 = v56;
if ( v57 < v48 )
v48 = v57;
if ( v57 > v50 )
v50 = v57;
}
}
}
if ( v47 != v49 || v48 != v50 )
{
EditorUI::createUndoObject(v3, 5, 0);
cocos2d::CCPoint::operator-(v51, &v49, &v47);
v32 = cocos2d::CCArray::count((cocos2d::CCArray *)a2);
v33 = 1;
cocos2d::CCPoint::operator*(v52, v51, 1.0 / (float)(unsigned int)(v32 - 1));
while ( v33 < cocos2d::CCArray::count((cocos2d::CCArray *)a2) - 1 )
{
v34 = (int *)cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)a2, v33);
v35 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int *))(*v34 + 96))(v34);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v53, v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54);
v36 = (float)(int)v33;
if ( a3 )
{
v37 = *(float *)v53;
v38 = v48 + (float)(v36 * v52[1]);
}
else
{
v38 = *(float *)&v53[1];
v37 = v47 + (float)(v36 * v52[0]);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, v37, v38);
cocos2d::CCPoint::operator=(v54, &v56);
cocos2d::CCPoint::operator-(v55, v54, v53);
if ( v34[223] == 44 )
{
v39 = (cocos2d::CCArray *)GJBaseGameLayer::getStickyGroup(*(cocos2d::CCDictionary ***)(v3 + 944), v34[185]);
if ( v39 )
{
v40 = 0;
while ( v40 < cocos2d::CCArray::count(v39) )
{
v41 = (GameObject *)cocos2d::CCArray::objectAtIndex(v39, v40++);
v46 = v41;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, (const cocos2d::CCPoint *)v55);
EditorUI::moveObject(v3, v46, (int)&v56);
}
}
}
else
{
cocos2d::CCPoint::operator-(&v56, v54, v53);
EditorUI::moveObject(v3, (GameObject *)v34, (int)&v56);
}
++v33;
}
return EditorUI::updateControlsAfterAlign((EditorUI *)v3);
}
}
}
return this;
}