//
// SetGroupIDLayer::updateGroupIDButtons from 0xaba618 to 0xabab64 (1356 bytes)
//
// 9 xrefs:
// > SetGroupIDLayer::onAddGroupParent @ 0xababbc
// > SetGroupIDLayer::onAddGroupParent @ 0xababf0
// > SetGroupIDLayer::addGroupID @ 0xabad44
// > SetGroupIDLayer::removeGroupID @ 0xabae44
// > SetGroupIDLayer::removeGroupID @ 0xabaeb4
// > SetGroupIDLayer::callRemoveFromGroup @ 0xabaf14
// > SetGroupIDLayer::onPaste @ 0xabba60
// > SetGroupIDLayer::init @ 0xac05e8
// > ??> @ 0xa8520
//
// 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 13:01:01 +0000
//
__int64 __fastcall SetGroupIDLayer::updateGroupIDButtons(cocos2d::CCArray **this)
{
unsigned int i; // w20
unsigned int v3; // w1
__int64 v4; // x0
bool v5; // cf
cocos2d::CCArray *v6; // x0
cocos2d::CCDictionary *v7; // x0
cocos2d::CCDictionary *v8; // x20
__int64 v9; // x0
unsigned int v10; // w21
cocos2d::CCNode *GroupID; // x0
__int64 v12; // x23
cocos2d::CCObject *v13; // x24
__int64 v14; // x0
GameManager *GroupParent; // x0
__int64 v16; // x0
cocos2d::CCArray *v17; // x0
cocos2d::CCArray *v18; // x26
ScrollableContentLayer *v19; // x0
int v21; // w0
int v22; // w27
float v23; // s0
int v24; // w24
float v25; // s1
float v26; // s9
float v27; // s8
float v28; // s0
signed int v29; // w21
cocos2d::CCString *v30; // x0
ButtonSprite *CString; // x0
const char *v32; // x6
__int64 v33; // x0
cocos2d::CCObject *v34; // x23
int v35; // w1
void (__fastcall *v36)(cocos2d::CCObject *, _BYTE *); // x22
int v37; // w2
unsigned int v38; // w22
__int64 v39; // x0
const char *v40; // x28
float v41; // s1
unsigned int v42; // w28
unsigned int j; // w26
signed int v44; // w22
__int64 v45; // x23
void (__fastcall *v46)(cocos2d::CCObject *, _QWORD); // x24
int v47; // w0
__int64 v48; // x24
cocos2d::CCObject *v49; // x21
__int64 v50; // x0
GameManager *v51; // x0
__int64 v52; // x0
int v53; // [xsp+8Ch] [xbp+8Ch]
unsigned int v54; // [xsp+98h] [xbp+98h]
_BOOL4 v55; // [xsp+9Ch] [xbp+9Ch]
_BYTE v56[8]; // [xsp+A0h] [xbp+A0h] BYREF
for ( i = 0; ; ++i )
{
v5 = i >= (unsigned int)cocos2d::CCArray::count(*(this + 87));
v6 = *(this + 87);
if ( v5 )
break;
v3 = i;
v4 = cocos2d::CCArray::objectAtIndex(v6, v3);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 520LL))(v4);
}
cocos2d::CCArray::removeAllObjects(v6);
cocos2d::CCDictionary::removeAllObjects(*(this + 102));
v7 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::removeAllObjects(*(this + 103));
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v7);
v9 = (__int64)*(this + 84);
if ( v9 )
{
v10 = 0;
if ( *(__int16 *)(v9 + 1168) <= 0 )
goto LABEL_13;
while ( 1 )
{
while ( 1 )
{
GroupID = (cocos2d::CCNode *)GameObject::getGroupID((GameObject *)v9, v10);
v12 = (int)GroupID;
v13 = (cocos2d::CCObject *)cocos2d::CCNode::create(GroupID);
cocos2d::CCDictionary::setObject(v8, v13, v12);
v9 = (__int64)*(this + 84);
if ( *(_BYTE *)(v9 + 1170) )
break;
LABEL_7:
if ( *(__int16 *)(v9 + 1168) <= (int)++v10 )
goto LABEL_13;
}
v14 = GameManager::sharedState((GameManager *)v9);
GroupParent = (GameManager *)GJBaseGameLayer::getGroupParent(*(cocos2d::CCDictionary ***)(v14 + 552), v12);
if ( *(this + 84) == GroupParent )
{
cocos2d::CCDictionary::setObject(*(this + 102), v13, v12);
v9 = (__int64)*(this + 84);
goto LABEL_7;
}
v16 = GameManager::sharedState(GroupParent);
if ( (unsigned __int8)GJBaseGameLayer::isGroupParentOf(*(cocos2d::CCDictionary ***)(v16 + 552), *(this + 84), v12) )
cocos2d::CCDictionary::setObject(*(this + 103), v13, v12);
v9 = (__int64)*(this + 84);
if ( *(__int16 *)(v9 + 1168) <= (int)++v10 )
goto LABEL_13;
}
}
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(*(this + 85)); ++j )
{
v44 = 0;
v45 = cocos2d::CCArray::objectAtIndex(*(this + 85), j);
if ( *(__int16 *)(v45 + 1168) > 0 )
{
do
{
v48 = (int)GameObject::getGroupID((GameObject *)v45, v44);
v49 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v8, v48);
if ( !cocos2d::CCDictionary::objectForKey(v8, v48) )
{
v49 = (cocos2d::CCObject *)cocos2d::CCNode::create(nullptr);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v49 + 72LL))(v49, 0);
cocos2d::CCDictionary::setObject(v8, v49, v48);
}
if ( *(_BYTE *)(v45 + 1170) )
{
v50 = GameManager::sharedState((GameManager *)*(unsigned __int8 *)(v45 + 1170));
v51 = (GameManager *)GJBaseGameLayer::getGroupParent(*(cocos2d::CCDictionary ***)(v50 + 552), v48);
if ( (GameManager *)v45 == v51 )
{
cocos2d::CCDictionary::setObject(*(this + 102), v49, v48);
}
else
{
v52 = GameManager::sharedState(v51);
if ( (unsigned __int8)GJBaseGameLayer::isGroupParentOf(
*(cocos2d::CCDictionary ***)(v52 + 552),
(GameObject *)v45,
v48)
&& !cocos2d::CCDictionary::objectForKey(*(this + 102), v48) )
{
cocos2d::CCDictionary::setObject(*(this + 103), v49, v48);
}
}
}
++v44;
v46 = *(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v49 + 72LL);
v47 = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v49 + 64LL))(v49);
v46(v49, (unsigned int)(v47 + 1));
}
while ( *(__int16 *)(v45 + 1168) > v44 );
}
}
LABEL_13:
v17 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v8);
v18 = v17;
if ( v17 && (unsigned int)cocos2d::CCArray::count(v17) )
{
qsort(
*(void **)(*((_QWORD *)v18 + 7) + 16LL),
**((unsigned int **)v18 + 7),
8u,
(int (*)(const void *, const void *))groupIDCompare);
v21 = cocos2d::CCArray::count(v18);
v22 = v21;
v23 = (float)v21;
if ( v21 > 10 )
{
v24 = 10;
v26 = 22.5;
v41 = v23 / 10.0;
v27 = 35.0;
v28 = 15.0;
v53 = vcvtps_s32_f32(v41);
}
else
{
v24 = 5;
v25 = v23 / 5.0;
v26 = 64.0;
v27 = 58.0;
v28 = 30.0;
v53 = vcvtps_s32_f32(v25);
if ( v21 <= 0 )
{
LABEL_32:
ScrollableContentLayer::setContentHeight(*(this + 104), (float)((float)((float)v53 * 30.0) + 3.0) + 5.0);
return _stack_chk_guard;
}
}
v29 = 0;
v54 = (int)v28;
do
{
v55 = 1;
v38 = *(_DWORD *)(cocos2d::CCArray::objectAtIndex(v18, v29) + 56);
v39 = cocos2d::CCDictionary::objectForKey(v8, (int)v38);
if ( !*(this + 84) )
{
v42 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v39 + 64LL))(v39);
v55 = v42 >= (unsigned int)cocos2d::CCArray::count(*(this + 85));
}
v40 = "GJ_button_03.png";
if ( !cocos2d::CCDictionary::objectForKey(*(this + 102), (int)v38) )
{
if ( cocos2d::CCDictionary::objectForKey(*(this + 103), (int)v38) )
{
v40 = "GJ_button_02.png";
}
else if ( v55 )
{
v40 = "GJ_button_04.png";
}
else
{
v40 = "GJ_button_05.png";
}
}
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v38);
CString = (ButtonSprite *)cocos2d::CCString::getCString(v30);
v33 = ButtonSprite::create(CString, (const char *)v54, 0, 1, 0.5, "goldFont.fnt", v40, v32, 20.0);
v34 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v33,
0,
(__int64)this,
(__int64)SetGroupIDLayer::onRemoveFromGroup,
0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v34 + 72LL))(v34, v38);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 105) + 456LL))(*(this + 105), v34);
v35 = v29 / v24;
v36 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_QWORD *)v34 + 184LL);
v37 = v29 % v24;
++v29;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v56,
v26 + (float)(v27 * (float)v37),
-18.0 - (float)((float)v35 * 30.0));
v36(v34, v56);
cocos2d::CCArray::addObject(*(this + 87), v34);
}
while ( v22 != v29 );
goto LABEL_32;
}
v19 = *(this + 104);
if ( v19 )
ScrollableContentLayer::setContentHeight(v19, 0.0);
return _stack_chk_guard;
}