//
// GJBaseGameLayer::setGroupParent from 0x860114 to 0x860240 (300 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::addToGroupParents @ 0x860448
// > GJBaseGameLayer::loadGroupParentsFromString @ 0x8604fc
// > SetGroupIDLayer::onAddGroupParent @ 0x9768c8
// > ??> @ 0x9ba90
//
// 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; // x0
cocos2d::CCArray *v7; // x21
unsigned int i; // w19
__int64 v9; // x19
if ( a3 > 0 )
{
if ( a2 )
{
GroupParent = GJBaseGameLayer::getGroupParent(a1, a3);
if ( a2 != GroupParent && (!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, (unsigned int)a2->m_uniqueID);
if ( !v7 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(nullptr);
cocos2d::CCDictionary::setObject(a1->m_parentGroupIDs, v7, (unsigned int)a2->m_uniqueID);
}
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v7); ++i )
{
if ( a3 == *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v7, i) + 56) )
goto LABEL_13;
}
v9 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v9);
*(_DWORD *)(v9 + 56) = a3;
*(_QWORD *)v9 = &off_1148430;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v9);
cocos2d::CCArray::addObject(v7, (cocos2d::CCObject *)v9);
LABEL_13:
a2->m_hasGroupParentsString = 1;
}
}
}
}