//
// LevelEditorLayer::recreateGroups from 0x1403fd660 to 0x1403fd9b1 (849 bytes)
//
// 6 xrefs:
// > EditorUI::dynamicGroupUpdate @ 0x1401b8a21
// > LevelEditorLayer::onPlaytest @ 0x1403feda7
// > LevelEditorLayer::onResumePlaytest @ 0x1403ffe80
// > ??> @ 0x1408c66e8
// > ??> @ 0x1408c6720
// > ??> @ 0x140925898
//
// This function is hookable on this platform (idp: pc, 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 11:31:53 +0000
//
void __fastcall LevelEditorLayer::recreateGroups(__int64 a1)
{
__int64 v1; // rax
unsigned int *v3; // rcx
__int64 v4; // rax
__int64 *v5; // rcx
__int64 *i; // r8
__int64 v7; // rdx
__int64 v8; // rdi
__int64 j; // rbx
cocos2d::CCArray *v10; // rcx
cocos2d::CCArray *v11; // rcx
cocos2d::CCArray *v12; // rcx
__int64 v13; // rcx
__int64 v14; // rcx
__int64 k; // rbx
cocos2d::CCArray *v16; // r12
unsigned int m; // r15d
struct cocos2d::CCObject *v18; // rbx
__int64 v19; // r9
int v20; // r14d
__int64 v21; // rbp
unsigned __int64 v22; // rdi
__int64 v23; // rax
__int64 v24; // r8
int v25; // eax
int v26; // eax
__int64 v27; // rax
_QWORD *v28; // rcx
_BYTE *v29; // rdx
__int64 v30; // rax
__int64 n; // rbx
__int64 v32; // rcx
_BYTE v33[16]; // [rsp+20h] [rbp-58h] BYREF
_BYTE v34[16]; // [rsp+30h] [rbp-48h] BYREF
int v35; // [rsp+80h] [rbp+8h] BYREF
struct cocos2d::CCObject *v36; // [rsp+88h] [rbp+10h] BYREF
v1 = *(_QWORD *)(a1 + 3536);
if ( v1 )
{
v3 = *(unsigned int **)(v1 + 56);
v4 = *v3;
if ( (_DWORD)v4 )
{
v5 = *((__int64 **)v3 + 2);
for ( i = &v5[v4 - 1]; v5 <= i; *(_BYTE *)(v7 + 1298) = *(_BYTE *)(v7 + 1297) )
{
v7 = *v5;
if ( !*v5 )
break;
++v5;
}
}
}
sub_1403544F0((_QWORD *)(a1 + 4376));
v8 = a1 + 4440;
sub_1403544F0((_QWORD *)(a1 + 4440));
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 3544));
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3544), *(struct cocos2d::CCObject **)(a1 + 12672));
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3544), *(struct cocos2d::CCObject **)(a1 + 12680));
for ( j = 0; j <= 79992; j += 8 )
{
v10 = *(cocos2d::CCArray **)(j + *(_QWORD *)(a1 + 3896));
if ( v10 )
cocos2d::CCArray::removeAllObjects(v10);
v11 = *(cocos2d::CCArray **)(j + *(_QWORD *)(a1 + 3920));
if ( v11 )
cocos2d::CCArray::removeAllObjects(v11);
v12 = *(cocos2d::CCArray **)(j + *(_QWORD *)(a1 + 3944));
if ( v12 )
cocos2d::CCArray::removeAllObjects(v12);
}
v13 = *(_QWORD *)(a1 + 15040);
if ( v13 )
{
v14 = *(_QWORD *)(v13 + 56);
if ( v14 )
{
for ( k = *(_QWORD *)(v14 + 288); ; k = *(_QWORD *)(k + 288) )
{
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(v14 + 264));
v14 = k;
if ( !k )
break;
}
}
}
v16 = *(cocos2d::CCArray **)(a1 + 3536);
for ( m = 0; m < cocos2d::CCArray::count(v16); ++m )
{
v18 = cocos2d::CCArray::objectAtIndex(v16, m);
if ( *((__int16 *)v18 + 588) > 0 )
{
v20 = 0;
v21 = 0;
v22 = 0;
do
{
if ( v22 <= 9 && (v23 = *((_QWORD *)v18 + 146)) != 0 )
v24 = (unsigned int)*(__int16 *)(v23 + v21);
else
v24 = 0;
LOBYTE(v19) = 1;
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *, __int64, __int64))(*(_QWORD *)a1 + 1200LL))(
a1,
v18,
v24,
v19);
++v20;
++v22;
v21 += 2;
}
while ( v20 < *((__int16 *)v18 + 588) );
v8 = a1 + 4440;
}
v25 = *((_DWORD *)v18 + 259);
if ( v25 != 1615 )
{
if ( v25 == 1816 && *((_BYTE *)v18 + 1693) )
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 3544), v18);
continue;
}
v35 = *((_DWORD *)v18 + 424);
v26 = *((_DWORD *)v18 + 479);
v36 = v18;
if ( v26 < 0 )
v35 = v26;
if ( *((_BYTE *)v18 + 1920) )
{
v27 = sub_1403572D0(v8, (__int64)v33, (unsigned __int8 *)&v35);
v28 = (_QWORD *)(*(_QWORD *)v27 + 24LL);
v29 = *(_BYTE **)(*(_QWORD *)v27 + 32LL);
if ( v29 == *(_BYTE **)(*(_QWORD *)v27 + 40LL) )
goto LABEL_36;
*(_QWORD *)v29 = v18;
v28[1] += 8LL;
}
else
{
v30 = sub_1403572D0(a1 + 4376, (__int64)v34, (unsigned __int8 *)&v35);
v28 = (_QWORD *)(*(_QWORD *)v30 + 24LL);
v29 = *(_BYTE **)(*(_QWORD *)v30 + 32LL);
if ( v29 == *(_BYTE **)(*(_QWORD *)v30 + 40LL) )
{
LABEL_36:
sub_1400699B0(v28, v29, &v36);
continue;
}
*(_QWORD *)v29 = v18;
v28[1] += 8LL;
}
}
if ( *(_BYTE *)(*(_QWORD *)(a1 + 3528) + 462LL) )
{
for ( n = 8; n <= 79992; n += 8 )
{
v32 = *(_QWORD *)(n + *(_QWORD *)(a1 + 3896));
if ( v32 )
qsort(
*(void **)(*(_QWORD *)(v32 + 56) + 16LL),
**(unsigned int **)(v32 + 56),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_14030B1E0);
}
}
}