//
// EditorUI::assignNewGroups from 0x48c9a8 to 0x48caa8 (256 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0x6f2078
// > EditorUI::handleEditorAction @ 0x6f2088
// > EditorCommandsPopup::onCommand @ 0x77a804
//
// 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:31 +0000
//
int __fastcall EditorUI::assignNewGroups(int this, int a2)
{
cocos2d::CCArray **v2; // r6
cocos2d::CCArray *v4; // r0
cocos2d::CCObject *v5; // r1
cocos2d::CCArray *v6; // r4
size_t *v7; // r3
void *v8; // r0
size_t v9; // r1
int (*v10)(const void *, const void *); // r3
_DWORD *v11; // r2
int *v12; // r4
int *v13; // r5
int v14; // r8
int v15; // t1
LevelEditorLayer *v16; // r0
int NextFreeGroupID; // r11
_DWORD v18[5]; // [sp+0h] [bp-1Ch] BYREF
v2 = (cocos2d::CCArray **)this;
if ( *(_DWORD *)(this + 996) || (this = cocos2d::CCArray::count(*(cocos2d::CCArray **)(this + 668))) != 0 )
{
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)this);
v5 = v2[249];
v6 = v4;
if ( v5 )
cocos2d::CCArray::addObject(v4, v5);
else
cocos2d::CCArray::addObjectsFromArray(v4, v2[167]);
v7 = *((size_t **)v6 + 13);
v8 = (void *)v7[3];
v9 = *v7;
if ( a2 )
v10 = alignYSort;
else
v10 = alignXSort;
qsort(v8, v9, 4u, v10);
v11 = *((_DWORD **)v6 + 13);
if ( *v11 )
{
v12 = (int *)v11[3];
v13 = &v12[*v11 - 1];
while ( v12 <= v13 )
{
v15 = *v12++;
v14 = v15;
if ( !v15 )
break;
v16 = v2[236];
memset(v18, 0, 16);
v18[4] = 1.0;
NextFreeGroupID = LevelEditorLayer::getNextFreeGroupID(v16, (int)v18);
std::__hash_table,std::equal_to,std::allocator>::~__hash_table((int)v18);
if ( (*(int (__fastcall **)(int, int))(*(_DWORD *)v14 + 800))(v14, NextFreeGroupID) == 1 )
(*(void (__fastcall **)(cocos2d::CCArray *, int, int, _DWORD))(*(_DWORD *)v2[236] + 676))(
v2[236],
v14,
NextFreeGroupID,
0);
}
}
return EditorUI::updateObjectInfoLabel(v2);
}
return this;
}