//
// GJBaseGameLayer::remapGroupParent from 0x9a37c4 to 0x9a3990 (460 bytes)
//
// 2 xrefs:
// > EditorUI::replaceGroupID @ 0x7c3a44
// > ??> @ 0xdc7c8
//
// This function is hookable on this platform (idp: arm, 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 12:58:08 +0000
//
__int64 __fastcall GJBaseGameLayer::remapGroupParent(__int64 this, GameObject *a2, int a3, int a4)
{
__int64 v4; // x23
__int64 v5; // x24
__int64 v7; // x21
cocos2d::CCArray *v9; // x19
cocos2d::CCArray *v10; // x0
cocos2d::CCArray *v11; // x25
signed int v12; // w19
int v13; // w23
int v14; // w2
cocos2d::CCObject *v15; // x19
cocos2d::CCObject *v16; // x19
if ( a2 )
{
if ( a3 > 0 && a4 > 0 && a3 != a4 )
{
v4 = a3;
v5 = this;
v7 = a4;
this = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(this + 3688), a3);
v9 = (cocos2d::CCArray *)this;
if ( this )
{
this = (unsigned __int8)cocos2d::CCArray::containsObject((cocos2d::CCArray *)this, a2);
if ( (_BYTE)this )
{
cocos2d::CCArray::removeObject(v9, a2, 1);
if ( !(unsigned int)cocos2d::CCArray::count(v9) )
cocos2d::CCDictionary::removeObjectForKey(*(cocos2d::CCDictionary **)(v5 + 3688), v4);
v10 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(
*(cocos2d::CCDictionary **)(v5 + 3696),
*((unsigned int *)a2 + 229));
v11 = v10;
if ( v10 )
{
v12 = cocos2d::CCArray::count(v10) - 1;
v13 = 0;
if ( v12 < 0 )
goto LABEL_18;
do
{
v14 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v11, v12) + 56);
if ( a3 == v14 )
{
cocos2d::CCArray::removeObjectAtIndex(v11, v12, 1);
}
else if ( (_DWORD)v7 == v14 )
{
v13 = 1;
}
--v12;
}
while ( v12 != -1 );
if ( !v13 )
{
LABEL_18:
v15 = (cocos2d::CCObject *)operator new(0x40u);
cocos2d::CCObject::CCObject(v15);
*((_DWORD *)v15 + 14) = v7;
*(_QWORD *)v15 = &off_1428350;
cocos2d::CCObject::autorelease(v15);
cocos2d::CCArray::addObject(v11, v15);
}
}
v16 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v5 + 3688), v7);
if ( !v16 )
{
v16 = (cocos2d::CCObject *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(v5 + 3688), v16, v7);
}
this = (unsigned __int8)cocos2d::CCArray::containsObject(v16, a2);
if ( !(_BYTE)this )
return cocos2d::CCArray::addObject(v16, a2);
}
}
}
}
return this;
}