//
// EditorUI::replaceGroupID from 0x1401b8ab0 to 0x1401b8e6e (958 bytes)
//
// 4 xrefs:
// > EditorUI::dynamicGroupUpdate @ 0x1401b8992
// > ??> @ 0x1408a1f24
// > ??> @ 0x1408a1f80
// > ??> @ 0x14091a30c
//
// 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:27:59 +0000
//
void __fastcall EditorUI::replaceGroupID(__int64 a1, __int64 a2, __int64 a3, int a4)
{
int v4; // r10d
char v5; // r14
__int64 v7; // rsi
__int64 v9; // rdi
__int64 v10; // r9
unsigned __int64 v11; // rax
__int64 v12; // rcx
int v13; // edx
__int64 v14; // r13
cocos2d::CCArray *v15; // rax
cocos2d::CCArray *v16; // rbp
cocos2d::CCArray *v17; // rax
cocos2d::CCArray *v18; // r15
signed int v19; // ebp
int v20; // ecx
struct cocos2d::CCObject *v21; // rax
__int64 v22; // rcx
struct cocos2d::CCObject *v23; // rbp
int v24; // ebp
int v25; // eax
int v26; // eax
int v27; // eax
__int64 v28; // rax
void (__fastcall ***v29)(_QWORD, const char *); // r14
const char *v30; // rax
cocos2d::CCString *v31; // rax
const char *CString; // rax
int v33; // eax
_DWORD *v34; // rcx
_DWORD *i; // rax
__int64 v36; // r9
v4 = *(__int16 *)(a2 + 1176);
v5 = 0;
v7 = a4;
v9 = (int)a3;
v10 = 0;
if ( v4 > 0 )
{
a3 = 0;
v11 = 0;
while ( 1 )
{
if ( v11 <= 9 && (v12 = *(_QWORD *)(a2 + 1168)) != 0 )
v13 = *(__int16 *)(a3 + v12);
else
v13 = 0;
if ( v13 == (_DWORD)v9 )
break;
v10 = (unsigned int)(v10 + 1);
++v11;
a3 += 2;
if ( (int)v10 >= v4 )
goto LABEL_11;
}
(*(void (__fastcall **)(__int64, _QWORD, __int64, __int64))(*(_QWORD *)a2 + 1456LL))(a2, (unsigned int)v9, a3, v10);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a2 + 1448LL))(a2, (unsigned int)v7);
}
LABEL_11:
v14 = *(_QWORD *)(a1 + 1512);
if ( (int)v9 > 0 && (int)v7 > 0 && (_DWORD)v9 != (_DWORD)v7 )
{
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v14 + 3968), v9);
v16 = v15;
if ( v15 )
{
if ( cocos2d::CCArray::containsObject(v15, (struct cocos2d::CCObject *)a2) )
{
cocos2d::CCArray::removeObject(v16, (struct cocos2d::CCObject *)a2, 1);
if ( !cocos2d::CCArray::count(v16) )
cocos2d::CCDictionary::removeObjectForKey(*(cocos2d::CCDictionary **)(v14 + 3968), v9);
v17 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v14 + 3976), *(unsigned int *)(a2 + 924));
v18 = v17;
if ( v17 )
{
v19 = cocos2d::CCArray::count(v17) - 1;
if ( v19 < 0 )
goto LABEL_26;
do
{
v20 = *((_DWORD *)cocos2d::CCArray::objectAtIndex(v18, v19) + 14);
if ( v20 == (_DWORD)v9 )
{
cocos2d::CCArray::removeObjectAtIndex(v18, v19, 1);
}
else if ( v20 == (_DWORD)v7 )
{
v5 = 1;
}
--v19;
}
while ( v19 >= 0 );
if ( !v5 )
{
LABEL_26:
v21 = cocos2d::CCInteger::create(v7);
cocos2d::CCArray::addObject(v18, v21);
}
}
v23 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v14 + 3968), v7);
if ( !v23 )
{
v23 = (struct cocos2d::CCObject *)cocos2d::CCArray::create(v22);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(v14 + 3968), v23, v7);
}
if ( !cocos2d::CCArray::containsObject(v23, (struct cocos2d::CCObject *)a2) )
cocos2d::CCArray::addObject(v23, (struct cocos2d::CCObject *)a2);
}
}
}
if ( *(_DWORD *)(a2 + 1256) == 1 )
{
v24 = *(_DWORD *)(a2 + 1480);
if ( v24 == (_DWORD)v9 )
{
v25 = v7;
if ( (int)v7 < 0 )
v25 = 0;
if ( v25 > 9999 )
v25 = 9999;
*(_DWORD *)(a2 + 1480) = v25;
}
if ( *(_DWORD *)(a2 + 1484) == (_DWORD)v9 )
{
v26 = v7;
if ( (int)v7 < 0 )
v26 = 0;
if ( v26 > 9999 )
v26 = 9999;
*(_DWORD *)(a2 + 1484) = v26;
}
if ( *(_DWORD *)(a2 + 1696) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1696) = v7;
if ( *(_DWORD *)(a2 + 1684) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1684) = v7;
v27 = *(_DWORD *)(a2 + 1036);
if ( v27 != 1615 && v27 != 899 )
{
v28 = (*(__int64 (__fastcall **)(__int64, __int64, __int64, __int64))(*(_QWORD *)a2 + 472LL))(a2, 999, a3, v10);
if ( v28 )
{
v29 = (void (__fastcall ***)(_QWORD, const char *))(v28 + 360);
v30 = (const char *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v28 + 360) + 8LL))(v28 + 360);
if ( atoi(v30) == v24 && *(_DWORD *)(a2 + 1480) != v24 )
{
v31 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8);
CString = cocos2d::CCString::getCString(v31);
(**v29)(v29, CString);
}
}
}
v33 = *(_DWORD *)(a2 + 1036);
switch ( v33 )
{
case 901:
if ( *(_DWORD *)(a2 + 1544) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1544) = v7;
break;
case 1268:
SpawnTriggerGameObject::changeRemap(a2, (unsigned int)v9, (unsigned int)v7, 0);
LOBYTE(v36) = 1;
SpawnTriggerGameObject::changeRemap(a2, (unsigned int)v9, (unsigned int)v7, v36);
break;
case 2068:
v34 = *(_DWORD **)(a2 + 1864);
for ( i = *(_DWORD **)(a2 + 1856); i != v34; i += 4 )
{
if ( *i == (_DWORD)v9 )
*i = v7;
}
break;
case 2903:
if ( *(_DWORD *)(a2 + 1868) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1868) = v7;
if ( *(_DWORD *)(a2 + 1872) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1872) = v7;
if ( *(_DWORD *)(a2 + 1876) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1876) = v7;
if ( *(_DWORD *)(a2 + 1880) == (_DWORD)v9 )
*(_DWORD *)(a2 + 1880) = v7;
break;
}
}
}