//
// SetGroupIDLayer::updateGroupIDButtons from 0x63a254 to 0x63a616 (962 bytes)
//
// 6 xrefs:
// > SetGroupIDLayer::onAddGroupParent @ 0x63a6ae
// > SetGroupIDLayer::addGroupID @ 0x63a7a4
// > SetGroupIDLayer::removeGroupID @ 0x63a824
// > SetGroupIDLayer::callRemoveFromGroup @ 0x63a8d4
// > SetGroupIDLayer::onPaste @ 0x63b15c
// > SetGroupIDLayer::init @ 0x63e098
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:55:23 +0000
//
void __fastcall SetGroupIDLayer::updateGroupIDButtons(cocos2d::CCArray **this)
{
int v1; // r11
unsigned int v3; // r7
bool v4; // cf
cocos2d::CCArray *v5; // r0
unsigned int v6; // r1
int v7; // r0
cocos2d::CCDictionary *v8; // r0
cocos2d::CCDictionary *v9; // r6
unsigned int i; // r8
signed int j; // r7
__int16 *v12; // r0
cocos2d::CCNode *v13; // r5
cocos2d::CCObject *v14; // r8
GameManager *v15; // r0
int v16; // r0
GameManager *v17; // r0
cocos2d::CCDictionary *v18; // r0
int v19; // r0
cocos2d::CCArray *v20; // r0
size_t **v21; // r9
int GroupID; // r5
cocos2d::CCObject *v23; // r7
GameManager *v24; // r0
signed int v25; // r10
void (__fastcall *v26)(cocos2d::CCObject *, int); // r5
int v27; // r0
int v28; // r9
int v29; // r0
GameManager *GroupParent; // r0
cocos2d::CCDictionary *v31; // r0
int v32; // r0
float v33; // s16
signed int v34; // r5
int v35; // r0
float v36; // s17
bool v37; // cc
signed int v38; // r10
float v39; // s15
float v40; // r0
int v41; // s19
const char *v42; // r7
int v43; // r0
unsigned int v44; // r8
_BOOL4 v45; // r8
char *v46; // r8
cocos2d::CCString *v47; // r0
ButtonSprite *CString; // r0
ButtonSprite *v49; // r0
cocos2d::CCObject *v50; // r8
void (__fastcall *v51)(cocos2d::CCObject *, _BYTE *); // r7
int v52; // r1
signed int v53; // r0
ScrollableContentLayer *v54; // r0
float v55; // r1
void *v56; // [sp+10h] [bp-3Ch]
_BYTE v57[8]; // [sp+34h] [bp-18h] BYREF
int (__fastcall *v58)(int, cocos2d::CCObject *); // [sp+3Ch] [bp-10h]
int v59; // [sp+40h] [bp-Ch]
v3 = 0;
v56 = &_stack_chk_guard;
while ( 1 )
{
v4 = v3 >= cocos2d::CCArray::count(*(this + 134));
v5 = *(this + 134);
if ( v4 )
break;
v6 = v3++;
v7 = cocos2d::CCArray::objectAtIndex(v5, v6);
(*(void (__fastcall **)(int))(*(_DWORD *)v7 + 260))(v7);
}
cocos2d::CCArray::removeAllObjects(v5);
cocos2d::CCDictionary::removeAllObjects(*(this + 156));
v8 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::removeAllObjects(*(this + 157));
v9 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v8);
if ( !*(this + 131) )
{
for ( i = 0; ; ++i )
{
if ( i >= cocos2d::CCArray::count(*(this + 132)) )
goto LABEL_15;
v25 = 0;
v28 = cocos2d::CCArray::objectAtIndex(*(this + 132), i);
while ( v25 < *(__int16 *)(v28 + 1020) )
{
GroupID = GameObject::getGroupID((GameObject *)v28, v25);
v23 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v9, GroupID);
v24 = (GameManager *)cocos2d::CCDictionary::objectForKey(v9, GroupID);
v1 = (int)v24;
if ( !v24 )
{
v23 = (cocos2d::CCObject *)cocos2d::CCNode::create(nullptr);
(*(void (__fastcall **)(cocos2d::CCObject *, _DWORD))(*(_DWORD *)v23 + 36))(v23, 0);
v24 = (GameManager *)cocos2d::CCDictionary::setObject(v9, v23, GroupID);
}
if ( *(_BYTE *)(v28 + 1022) )
{
v29 = GameManager::sharedState(v24);
GroupParent = (GameManager *)GJBaseGameLayer::getGroupParent(*(cocos2d::CCDictionary ***)(v29 + 408), GroupID);
if ( (GameManager *)v28 == GroupParent )
{
v31 = *(this + 156);
LABEL_52:
cocos2d::CCDictionary::setObject(v31, v23, GroupID);
goto LABEL_20;
}
v32 = GameManager::sharedState(GroupParent);
if ( GJBaseGameLayer::isGroupParentOf(*(cocos2d::CCDictionary ***)(v32 + 408), (GameObject *)v28, GroupID)
&& !cocos2d::CCDictionary::objectForKey(*(this + 156), GroupID) )
{
v31 = *(this + 157);
goto LABEL_52;
}
}
LABEL_20:
++v25;
v26 = *(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v23 + 36);
v27 = (*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)v23 + 32))(v23);
v26(v23, v27 + 1);
}
}
}
for ( j = 0; ; ++j )
{
v12 = (__int16 *)*(this + 131);
if ( j >= v12[510] )
break;
v13 = (cocos2d::CCNode *)GameObject::getGroupID((GameObject *)v12, j);
v14 = (cocos2d::CCObject *)cocos2d::CCNode::create(v13);
v15 = (GameManager *)cocos2d::CCDictionary::setObject(v9, v14, (int)v13);
if ( !*((_BYTE *)*(this + 131) + 1022) )
continue;
v16 = GameManager::sharedState(v15);
v17 = (GameManager *)GJBaseGameLayer::getGroupParent(*(cocos2d::CCDictionary ***)(v16 + 408), (int)v13);
if ( *(this + 131) == v17 )
{
v18 = *(this + 156);
}
else
{
v19 = GameManager::sharedState(v17);
if ( !GJBaseGameLayer::isGroupParentOf(*(cocos2d::CCDictionary ***)(v19 + 408), *(this + 131), (int)v13) )
continue;
v18 = *(this + 157);
}
cocos2d::CCDictionary::setObject(v18, v14, (int)v13);
}
LABEL_15:
v20 = (cocos2d::CCArray *)cocos2d::CCDictionary::allKeys(v9);
v21 = (size_t **)v20;
if ( v20 && cocos2d::CCArray::count(v20) )
{
v33 = 35.0;
v34 = 0;
qsort((void *)v21[13][3], *v21[13], 4u, groupIDCompare);
v35 = cocos2d::CCArray::count((cocos2d::CCArray *)v21);
v36 = 15.0;
v37 = v35 <= 10;
v38 = v35;
if ( v35 > 10 )
v1 = 10;
else
v33 = 58.0;
if ( v35 <= 10 )
v1 = 5;
v39 = 4.5;
if ( v35 <= 10 )
v39 = 2.0;
v40 = (float)v35 / (float)v1;
if ( v37 )
v36 = 30.0;
v41 = (int)ceilf(v40);
while ( v34 < v38 )
{
v42 = *(const char **)(cocos2d::CCArray::objectAtIndex((cocos2d::CCArray *)v21, v34) + 52);
v43 = cocos2d::CCDictionary::objectForKey(v9, (int)v42);
if ( *(this + 131) )
{
v45 = 1;
}
else
{
v44 = (*(int (__fastcall **)(int))(*(_DWORD *)v43 + 32))(v43);
v45 = v44 >= cocos2d::CCArray::count(*(this + 132));
}
if ( cocos2d::CCDictionary::objectForKey(*(this + 156), (int)v42) )
{
v46 = "GJ_button_03.png";
}
else if ( cocos2d::CCDictionary::objectForKey(*(this + 157), (int)v42) )
{
v46 = "GJ_button_02.png";
}
else if ( v45 )
{
v46 = "GJ_button_04.png";
}
else
{
v46 = "GJ_button_05.png";
}
v47 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v42);
CString = (ButtonSprite *)cocos2d::CCString::getCString(v47);
v49 = ButtonSprite::create(
CString,
(const char *)(int)v36,
0,
0.5,
1,
"goldFont.fnt",
v46,
(const char *)0x41A00000,
*(float *)&v56);
v58 = SetGroupIDLayer::onRemoveFromGroup;
v59 = 0;
v50 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v49,
0,
(int)this,
(int)SetGroupIDLayer::onRemoveFromGroup,
0);
(*(void (__fastcall **)(cocos2d::CCObject *, const char *))(*(_DWORD *)v50 + 36))(v50, v42);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 159) + 228))(*(this + 159), v50);
v51 = *(void (__fastcall **)(cocos2d::CCObject *, _BYTE *))(*(_DWORD *)v50 + 92);
v52 = v34 % v1;
v53 = v34++;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v57,
(float)(180.0 - (float)(v39 * v33)) + (float)(v33 * (float)v52),
-18.0 - (float)((float)(v53 / v1) * 30.0));
v51(v50, v57);
cocos2d::CCArray::addObject(*(this + 134), v50);
}
v54 = *(this + 158);
v55 = (float)((float)((float)v41 * 30.0) + 3.0) + 5.0;
LABEL_51:
ScrollableContentLayer::setContentHeight(v54, v55);
}
else
{
v54 = *(this + 158);
if ( v54 )
{
v55 = 0.0;
goto LABEL_51;
}
}
}