//
// SetGroupIDLayer::updateGroupIDButtons from 0x140592230 to 0x140592ac7 (2199 bytes)
//
// 6 xrefs:
// > SetGroupIDLayer::init @ 0x14058ff92
// > SetGroupIDLayer::onPaste @ 0x140591b00
// > SetGroupIDLayer::callRemoveFromGroup @ 0x14059308b
// > SetGroupIDLayer::onAddGroup @ 0x1405932fe
// > SetGroupIDLayer::onAddGroupParent @ 0x140593465
// > ??> @ 0x14092cdf8
//
// This function is hookable on this platform (idp: pc, 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 11:34:32 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall SetGroupIDLayer::updateGroupIDButtons(__int64 a1)
{
unsigned int i; // ebx
struct cocos2d::CCObject *v3; // rax
__int64 v4; // rcx
__int64 v5; // rdx
cocos2d::CCDictionary *v6; // r14
__int64 v7; // rcx
int v8; // r13d
__int64 v9; // r15
unsigned __int64 v10; // r12
__int64 v11; // rax
int v12; // ebx
struct cocos2d::CCObject *v13; // rbp
__int64 v14; // rcx
cocos2d::CCArray *v15; // rax
cocos2d::CCArray *v16; // rdi
struct cocos2d::CCObject *v17; // rax
struct cocos2d::CCObject *v18; // rdi
cocos2d::CCDictionary *v19; // rcx
__int64 v20; // rax
cocos2d::CCArray *v21; // rax
unsigned int v22; // ebx
struct cocos2d::CCObject *v23; // rbp
int v24; // r13d
__int64 v25; // r12
unsigned __int64 v26; // r15
__int64 v27; // rax
int v28; // ecx
__int64 v29; // rbx
struct cocos2d::CCObject *v30; // rdi
__int64 v31; // rdx
__int64 v32; // rcx
__int64 v33; // rcx
cocos2d::CCArray *v34; // rax
cocos2d::CCArray *v35; // r14
struct cocos2d::CCObject *v36; // rax
cocos2d::CCDictionary *v37; // rcx
__int64 v38; // rcx
cocos2d::CCArray *v39; // rax
__int64 v40; // rbx
int v41; // eax
cocos2d::CCArray *v42; // rax
cocos2d::CCArray *v43; // r13
int v44; // ebx
int v45; // ecx
float v46; // xmm1_4
int v47; // eax
float v48; // xmm11_4
int v49; // eax
float v50; // xmm9_4
int v51; // eax
signed int v52; // ebp
__int64 v53; // r12
struct cocos2d::CCObject *v54; // r15
unsigned int v55; // ebx
bool v56; // bp
struct cocos2d::CCObject *v57; // rbx
const char *v58; // rdi
cocos2d::CCString *v59; // rax
const char *CString; // rbp
cocos2d::CCObject *v61; // rbx
__int64 *v62; // rdi
__int64 v63; // rbx
__int64 v64; // rax
__int64 v65; // rbx
__int64 v66; // rcx
void *v67; // [rsp+50h] [rbp-D8h]
void *v68; // [rsp+58h] [rbp-D0h]
_BYTE v69[16]; // [rsp+60h] [rbp-C8h] BYREF
void *v70; // [rsp+130h] [rbp+8h]
unsigned int v71; // [rsp+130h] [rbp+8h]
unsigned int v72; // [rsp+130h] [rbp+8h]
cocos2d::CCDictionary *v73; // [rsp+138h] [rbp+10h]
void *v74; // [rsp+138h] [rbp+10h]
unsigned int v75; // [rsp+138h] [rbp+10h]
void *v76; // [rsp+140h] [rbp+18h]
signed int v77; // [rsp+140h] [rbp+18h]
void *v78; // [rsp+148h] [rbp+20h]
int v79; // [rsp+148h] [rbp+20h]
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 696)); ++i )
{
v3 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 696), i);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v3 + 512LL))(v3);
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 696));
cocos2d::CCDictionary::removeAllObjects(*(cocos2d::CCDictionary **)(a1 + 816));
cocos2d::CCDictionary::removeAllObjects(*(cocos2d::CCDictionary **)(a1 + 824));
v6 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v4);
v73 = v6;
v7 = *(_QWORD *)(a1 + 672);
if ( v7 )
{
v8 = 0;
if ( *(__int16 *)(v7 + 1176) <= 0 )
goto LABEL_57;
v9 = 0;
v10 = 0;
while ( 1 )
{
if ( v10 <= 9 && (v11 = *(_QWORD *)(v7 + 1168)) != 0 )
v12 = *(__int16 *)(v11 + v9);
else
v12 = 0;
v13 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v7, v5);
cocos2d::CCDictionary::setObject(v6, v13, v12);
if ( *(_BYTE *)(*(_QWORD *)(a1 + 672) + 1178LL) )
{
v14 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v70 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v70);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v14 = qword_14090BFD0;
}
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(*(_QWORD *)(v14 + 568) + 3968LL), v12);
v16 = v15;
if ( v15 && cocos2d::CCArray::count(v15) )
v17 = cocos2d::CCArray::objectAtIndex(v16, 0);
else
v17 = nullptr;
v18 = *(struct cocos2d::CCObject **)(a1 + 672);
if ( v18 == v17 )
{
v19 = *(cocos2d::CCDictionary **)(a1 + 816);
}
else
{
v20 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v74 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v74);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v20 = qword_14090BFD0;
}
if ( !v18 )
goto LABEL_26;
v21 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(*(_QWORD *)(v20 + 568) + 3968LL), v12);
if ( !v21 || !cocos2d::CCArray::containsObject(v21, v18) )
goto LABEL_26;
v19 = *(cocos2d::CCDictionary **)(a1 + 824);
}
cocos2d::CCDictionary::setObject(v19, v13, v12);
}
LABEL_26:
++v8;
++v10;
v9 += 2;
v7 = *(_QWORD *)(a1 + 672);
if ( v8 >= *(__int16 *)(v7 + 1176) )
goto LABEL_57;
}
}
v22 = 0;
v71 = 0;
if ( !cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 680)) )
goto LABEL_57;
do
{
v23 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 680), v22);
v24 = 0;
if ( *((__int16 *)v23 + 588) <= 0 )
goto LABEL_56;
v25 = 0;
v26 = 0;
do
{
if ( v26 <= 9 && (v27 = *((_QWORD *)v23 + 146)) != 0 )
v28 = *(__int16 *)(v27 + v25);
else
v28 = 0;
v29 = v28;
v30 = cocos2d::CCDictionary::objectForKey(v6, v28);
if ( !cocos2d::CCDictionary::objectForKey(v6, v29) )
{
v30 = (struct cocos2d::CCObject *)cocos2d::CCNode::create(v32, v31);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v30 + 64LL))(v30, 0);
cocos2d::CCDictionary::setObject(v6, v30, v29);
}
if ( *((_BYTE *)v23 + 1178) )
{
v33 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v76 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v76);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v33 = qword_14090BFD0;
}
v34 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(*(_QWORD *)(v33 + 568) + 3968LL), v29);
v35 = v34;
if ( v34 && cocos2d::CCArray::count(v34) )
v36 = cocos2d::CCArray::objectAtIndex(v35, 0);
else
v36 = nullptr;
if ( v23 == v36 )
{
v37 = *(cocos2d::CCDictionary **)(a1 + 816);
}
else
{
v38 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v78 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v78);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v38 = qword_14090BFD0;
}
v39 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(*(_QWORD *)(v38 + 568) + 3968LL), v29);
if ( !v39
|| !cocos2d::CCArray::containsObject(v39, v23)
|| cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 816), v29) )
{
goto LABEL_53;
}
v37 = *(cocos2d::CCDictionary **)(a1 + 824);
}
cocos2d::CCDictionary::setObject(v37, v30, v29);
LABEL_53:
v6 = v73;
}
v40 = *(_QWORD *)v30;
v41 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v30 + 56LL))(v30);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(v40 + 64))(v30, (unsigned int)(v41 + 1));
++v24;
++v26;
v25 += 2;
}
while ( v24 < *((__int16 *)v23 + 588) );
v22 = v71;
LABEL_56:
v71 = ++v22;
}
while ( v22 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 680)) );
LABEL_57:
v42 = cocos2d::CCDictionary::allKeys(v6);
v43 = v42;
if ( v42 && cocos2d::CCArray::count(v42) )
{
qsort(
*(void **)(*((_QWORD *)v43 + 7) + 16LL),
**((unsigned int **)v43 + 7),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_14058E610);
v44 = cocos2d::CCArray::count(v43);
v77 = v44;
v45 = 5;
if ( v44 > 10 )
v45 = 10;
v75 = v45;
if ( v44 <= 10 )
v46 = 2.0;
else
v46 = 4.5;
v47 = 58;
if ( v44 > 10 )
v47 = 35;
v48 = (float)v47;
v49 = 30;
if ( v44 > 10 )
v49 = 15;
v50 = (float)v49;
v51 = (int)ceilf((float)v44 / (float)v45);
v79 = v51;
v52 = 0;
v72 = 0;
if ( v44 > 0 )
{
while ( 1 )
{
v53 = *((int *)cocos2d::CCArray::objectAtIndex(v43, v52) + 14);
v54 = cocos2d::CCDictionary::objectForKey(v6, v53);
v56 = true;
if ( !*(_QWORD *)(a1 + 672) )
{
v55 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 680));
if ( (*(unsigned int (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v54 + 56LL))(v54) < v55 )
v56 = false;
}
v57 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 816), v53);
if ( v57 || !cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 824), v53) )
{
if ( v57 )
{
v58 = "GJ_button_03.png";
}
else
{
v58 = "GJ_button_05.png";
if ( v56 )
v58 = "GJ_button_04.png";
}
}
else
{
v58 = "GJ_button_02.png";
}
v59 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v53);
CString = cocos2d::CCString::getCString(v59);
v67 = operator new(0x2C8u);
v61 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v67);
if ( v61 )
{
if ( ButtonSprite::init_1(
(__int64)v61,
(__int64)CString,
(int)v50,
0,
1056964608,
1,
"goldFont.fnt",
(__int64)v58,
1101004800) )
{
cocos2d::CCObject::autorelease(v61);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v61 + 8LL))(v61, 1);
v61 = nullptr;
}
}
v68 = operator new(0x208u);
v62 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v68);
if ( !v62 )
goto LABEL_88;
if ( !CCMenuItemSpriteExtra::init(v62, (__int64 *)v61, 0, a1, (__int64)SetGroupIDLayer::onRemoveFromGroup) )
break;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v62);
LABEL_89:
(*(void (__fastcall **)(__int64 *, _QWORD))(*v62 + 64))(v62, (unsigned int)v53);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 840) + 464LL))(*(_QWORD *)(a1 + 840), v62);
v63 = *v62;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v69,
(float)((float)(int)(v72 % v75) * v48) + (float)(180.0 - (float)(v48 * v46)),
-18.0 - (float)((float)(int)(v72 / v75) * 30.0));
(*(void (__fastcall **)(__int64 *, __int64))(v63 + 184))(v62, v64);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 696), (struct cocos2d::CCObject *)v62);
v52 = v72 + 1;
v72 = v52;
if ( v52 >= v77 )
{
v51 = v79;
goto LABEL_91;
}
}
(*(void (__fastcall **)(__int64 *, __int64))(*v62 + 8))(v62, 1);
LABEL_88:
v62 = nullptr;
goto LABEL_89;
}
LABEL_91:
v65 = *(_QWORD *)(a1 + 832);
*(float *)(v65 + 432) = (float)((float)((float)v51 * 30.0) + 3.0) + 5.0;
LABEL_94:
ScrollableContentLayer::clampOffset(v65);
ScrollableContentLayer::ensureScrollThumb(v66);
ScrollableContentLayer::applyContentPosition(v65);
}
else
{
v65 = *(_QWORD *)(a1 + 832);
if ( v65 )
{
*(_DWORD *)(v65 + 432) = 0;
goto LABEL_94;
}
}
}