//
// SetGroupIDLayer::updateGroupIDButtons from 0x100300b00 to 0x1003010c1 (1473 bytes)
//
// 6 xrefs:
// > SetGroupIDLayer::init @ 0x1002fe6ad
// > SetGroupIDLayer::onAddGroupParent @ 0x1002ffc5e
// > SetGroupIDLayer::onPaste @ 0x1003011d2
// > SetGroupIDLayer::callRemoveFromGroup @ 0x1003029d1
// > SetGroupIDLayer::removeGroupID @ 0x100302b4b
// > SetGroupIDLayer::addGroupID @ 0x100302c34
//
// 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 12:28:32 +0000
//
__int64 __fastcall SetGroupIDLayer::updateGroupIDButtons(__int64 *a1, __m128 a2)
{
__int64 *v2; // r13
unsigned int v3; // ebx
__int64 v4; // rax
__int64 v5; // rdi
unsigned int v6; // ebx
unsigned int v7; // r12d
void *v8; // r14
__int64 v9; // rdx
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rax
__int64 v13; // rdx
__int64 *v14; // rcx
__int64 v15; // rax
char v16; // al
unsigned int v17; // ebx
__int64 v18; // rdi
__int64 v19; // rax
__int64 v20; // r12
unsigned int v21; // r13d
int v22; // eax
unsigned int GroupID; // r14d
__int64 v24; // rbx
_QWORD *v25; // rdi
__int64 v26; // rsi
__int64 v27; // rdx
__int64 v28; // rax
__int64 v29; // rdi
__int64 v30; // rax
__int64 v31; // rdx
__int64 *v32; // rcx
__int64 v33; // rax
__int64 v34; // rax
_QWORD *v35; // r14
__int64 result; // rax
__int64 v37; // rbx
int v38; // eax
_BOOL8 v39; // rsi
int v40; // ecx
unsigned int v41; // r8d
__int64 v42; // r15
__int64 v43; // rdi
float v44; // xmm1_4
unsigned int v45; // r13d
__int64 v46; // rax
__int64 CString; // rax
char *v48; // rax
void *v49; // r14
__int64 v50; // rbx
__int64 v51; // rax
bool v52; // zf
const char *v53; // r15
unsigned int v54; // r14d
const std::string::value_type *v55; // r14
__int64 v56; // rdi
float v57; // [rsp+0h] [rbp-70h] BYREF
unsigned int v58; // [rsp+8h] [rbp-68h]
float v59; // [rsp+Ch] [rbp-64h]
float v60; // [rsp+10h] [rbp-60h]
int v61; // [rsp+14h] [rbp-5Ch]
__int64 v62; // [rsp+18h] [rbp-58h]
__int64 *v63; // [rsp+20h] [rbp-50h]
__int64 *v64; // [rsp+28h] [rbp-48h]
_QWORD *v65; // [rsp+30h] [rbp-40h]
__int64 *v66; // [rsp+38h] [rbp-38h]
unsigned int v67; // [rsp+44h] [rbp-2Ch]
v2 = a1;
if ( (unsigned int)sub_1007FEF90(a1[87]) )
{
v3 = 0;
do
{
v4 = sub_1007FEFE0(a1[87], v3);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 520LL))(v4);
++v3;
}
while ( v3 < (unsigned int)sub_1007FEF90(a1[87]) );
}
sub_1007FF190(a1[87]);
v66 = a1 + 102;
cocos2d::CCDictionary::removeAllObjects(a1[102]);
v63 = a1 + 103;
cocos2d::CCDictionary::removeAllObjects(a1[103]);
v65 = cocos2d::CCDictionary::create();
v5 = a1[84];
v64 = v2;
if ( !v5 )
{
if ( !(unsigned int)sub_1007FEF90(v2[85]) )
goto LABEL_28;
v17 = 0;
while ( 1 )
{
v18 = v2[85];
v67 = v17;
v19 = sub_1007FEFE0(v18, v17);
if ( *(__int16 *)(v19 + 1168) > 0 )
break;
LABEL_15:
v17 = v67 + 1;
v2 = v64;
if ( v67 + 1 >= (unsigned int)sub_1007FEF90(v64[85]) )
goto LABEL_28;
}
v20 = v19;
v21 = 0;
v62 = v19;
while ( 1 )
{
GroupID = GameObject::getGroupID(v20, v21);
v24 = cocos2d::CCDictionary::objectForKey_1((__int64)v65, (int)GroupID);
v25 = v65;
v26 = (int)GroupID;
if ( cocos2d::CCDictionary::objectForKey_1((__int64)v65, (int)GroupID) )
{
v20 = v62;
if ( *(_BYTE *)(v62 + 1170) == 1 )
goto LABEL_24;
}
else
{
v24 = (__int64)cocos2d::CCNode::create();
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 72LL))(v24, 0);
v25 = v65;
v26 = v24;
cocos2d::CCDictionary::setObject_1((__int64)v65, v24, (int)GroupID);
v20 = v62;
if ( *(_BYTE *)(v62 + 1170) == 1 )
{
LABEL_24:
a2 = GameManager::sharedState(v25, v26, v27);
v29 = *(_QWORD *)(v28 + 552);
v30 = sub_10011AA60(v29);
v32 = v66;
if ( v20 == v30
|| (a2 = GameManager::sharedState(v29, GroupID, v31),
(unsigned __int8)sub_10011A800(*(_QWORD *)(v33 + 552), v20))
&& (v34 = cocos2d::CCDictionary::objectForKey_1(*v66, (int)GroupID), v32 = v63, !v34) )
{
cocos2d::CCDictionary::setObject_1(*v32, v24, (int)GroupID);
}
}
}
v22 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v24 + 64LL))(v24);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 72LL))(v24, (unsigned int)(v22 + 1));
if ( (int)++v21 >= *(__int16 *)(v20 + 1168) )
goto LABEL_15;
}
}
if ( *(__int16 *)(v5 + 1168) > 0 )
{
v6 = 0;
do
{
v7 = GameObject::getGroupID(v5, v6);
v8 = cocos2d::CCNode::create();
cocos2d::CCDictionary::setObject_1((__int64)v65, (__int64)v8, (int)v7);
if ( *(_BYTE *)(v2[84] + 1170) == 1 )
{
a2 = GameManager::sharedState(v65, v8, v9);
v11 = *(_QWORD *)(v10 + 552);
v12 = sub_10011AA60(v11);
v14 = v66;
if ( v2[84] == v12
|| (a2 = GameManager::sharedState(v11, v7, v13),
v16 = sub_10011A800(*(_QWORD *)(v15 + 552), v2[84]),
v14 = v63,
v16) )
{
cocos2d::CCDictionary::setObject_1(*v14, (__int64)v8, (int)v7);
}
}
++v6;
v5 = v2[84];
}
while ( (int)v6 < *(__int16 *)(v5 + 1168) );
}
LABEL_28:
v35 = v65;
result = cocos2d::CCDictionary::allKeys((__int64)v65);
if ( result && (v37 = result, result = sub_1007FEF90(result), (_DWORD)result) )
{
qsort(
*(void **)(*(_QWORD *)(v37 + 56) + 16LL),
**(unsigned int **)(v37 + 56),
8u,
(int (__cdecl *)(const void *, const void *))sub_1002FCCF0);
v38 = sub_1007FEF90(v37);
v39 = v38 >= 11;
v40 = 58;
if ( v38 >= 11 )
v40 = 35;
v41 = 30;
if ( v38 >= 11 )
v41 = 15;
v67 = v41;
v58 = 5 * v39 + 5;
a2.f32[0] = (float)v38 / (float)(int)v58;
v61 = (int)_mm_round_ss(a2, a2, 10).f32[0];
LODWORD(v62) = v38;
v42 = (__int64)v2;
if ( v38 > 0 )
{
v43 = v37;
v44 = flt_100A07DB0[v39];
v59 = (float)v40;
v60 = (float)(v44 * (float)v40) + 180.0;
v45 = 0;
do
{
v50 = *(int *)(sub_1007FEFE0(v43, v45) + 56);
v51 = cocos2d::CCDictionary::objectForKey_1((__int64)v35, v50);
v52 = *(_QWORD *)(v42 + 672) == 0;
v53 = "GJ_button_04.png";
if ( v52 )
{
v54 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v51 + 64LL))(v51);
v53 = "GJ_button_05.png";
if ( v54 >= (unsigned int)sub_1007FEF90(v64[85]) )
v53 = "GJ_button_04.png";
}
v55 = "GJ_button_03.png";
if ( !cocos2d::CCDictionary::objectForKey_1(*v66, v50) )
{
if ( cocos2d::CCDictionary::objectForKey_1(*v63, v50) )
v53 = "GJ_button_02.png";
v55 = v53;
}
v46 = sub_10088E820("%i", SLOBYTE(v57));
CString = cocos2d::CCString::getCString(v46);
v48 = ButtonSprite::create_1(CString, v67, 0, 1u, (__int64)"goldFont.fnt", (__int64)v55, 0.5, 20.0);
v42 = (__int64)v64;
v49 = CCMenuItemSpriteExtra::create(
(__int64)v48,
0,
(__int64)v64,
(__int64)SetGroupIDLayer::onRemoveFromGroup,
0);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v49 + 72LL))(v49, (unsigned int)v50);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(v42 + 840) + 456LL))(*(_QWORD *)(v42 + 840), v49);
sub_100278250(
&v57,
(float)((float)(int)(v45 % v58) * v59) + v60,
(float)((float)(int)(v45 / v58) * -30.0) + -18.0);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v49 + 184LL))(v49, &v57);
sub_1007FEBF0(*(_QWORD *)(v42 + 696), v49);
++v45;
v35 = v65;
}
while ( (_DWORD)v62 != v45 );
}
return ScrollableContentLayer::setContentHeight(
*(_QWORD *)(v42 + 832),
(float)((float)((float)v61 * 30.0) + 3.0) + 5.0);
}
else
{
v56 = v2[104];
if ( v56 )
return ScrollableContentLayer::setContentHeight(v56, 0.0);
}
return result;
}