//
// GJBaseGameLayer::setGroupParent from 0x472de8 to 0x472e9c (180 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::addToGroupParents @ 0x472f9a
// > GJBaseGameLayer::loadGroupParentsFromString @ 0x473006
// > SetGroupIDLayer::onAddGroupParent @ 0x509b18
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJBaseGameLayer::setGroupParent(GJBaseGameLayer *a1, GameObject *a2, int a3)
{
GameObject *GroupParent; // r0
cocos2d::CCArray *v7; // r4
unsigned int i; // r6
cocos2d::CCObject *v9; // r6
if ( a3 > 0 )
{
if ( a2 )
{
GroupParent = GJBaseGameLayer::getGroupParent(a1, a3);
if ( GroupParent != a2 && (!GroupParent || !a1->m_keepGroupParents) )
{
GJBaseGameLayer::removeGroupParent(a1, a3);
cocos2d::CCDictionary::setObject(a1->m_parentGroupsDict, a2, a3);
v7 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_parentGroupIDs, a2->m_uniqueID);
if ( !v7 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(a1->m_parentGroupIDs, v7, a2->m_uniqueID);
}
for ( i = 0; i < cocos2d::CCArray::count(v7); ++i )
{
if ( *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v7, i) + 52) == a3 )
goto LABEL_13;
}
v9 = (cocos2d::CCObject *)operator new(0x38u);
cocos2d::CCObject::CCObject(v9);
v9[1].__vftable = (cocos2d::CCObject_vtbl *)a3;
v9->__vftable = (cocos2d::CCObject_vtbl *)&off_A45350;
cocos2d::CCObject::autorelease(v9);
cocos2d::CCArray::addObject(v7, v9);
LABEL_13:
a2->m_hasGroupParentsString = 1;
}
}
}
}