//
// SetupRandAdvTriggerPopup::updateGroupIDButtons from 0x10002ef20 to 0x10002f418 (1272 bytes)
//
// 4 xrefs:
// > SetupRandAdvTriggerPopup::init @ 0x10002edb4
// > SetupRandAdvTriggerPopup::onAddChance @ 0x10002ef08
// > SetupRandAdvTriggerPopup::addChance @ 0x10002f598
// > SetupRandAdvTriggerPopup::removeGroupID @ 0x10002f744
//
// 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 __fastcall SetupRandAdvTriggerPopup::updateGroupIDButtons(SetupRandAdvTriggerPopup *a1)
{
__int64 v2; // x20
__int64 v3; // x0
RandTriggerGameObject *m_gameObject; // x20
std::__vector_base::pointer begin; // x21
std::__vector_base::pointer end; // x22
_BOOL4 v7; // w22
char v8; // w26
unsigned int v9; // w27
float v10; // s9
__int64 v11; // x21
int v12; // w24
RandTriggerGameObject *v13; // x23
int *p_m_groupID; // x22
std::__vector_base::pointer v15; // x23
__int64 v16; // x8
int v17; // w9
__int64 v18; // x0
__int64 *v19; // x22
unsigned int v20; // w23
unsigned int v21; // w21
cocos2d::CCDirector *v22; // x0
__n128 v23; // q0
__n128 v24; // q1
cocos2d::CCMenu *m_buttonMenu; // x21
float v26; // s3
_QWORD *v27; // x0
unsigned __int64 v28; // x28
float v29; // s10
int v30; // w20
unsigned int *v31; // x22
const char *v32; // x25
unsigned int v33; // w24
int v34; // w24
int v35; // w9
cocos2d::CCString *v36; // x0
const char *CString; // x0
const char *v38; // x0
ButtonSprite *v39; // x0
cocos2d::CCNode *v40; // x25
cocos2d::CCLabelBMFont *m_label; // x0
CCMenuItemSpriteExtra *v42; // x25
__n128 v43; // q0
__n128 v44; // q1
double v45; // d0
__n128 v46; // q0
__n128 v47; // q1
float32x2_t v48; // [xsp+18h] [xbp-E8h] BYREF
float32x2_t v49; // [xsp+20h] [xbp-E0h] BYREF
float32x2_t v50; // [xsp+28h] [xbp-D8h] BYREF
__int64 v51; // [xsp+30h] [xbp-D0h] BYREF
int v52; // [xsp+38h] [xbp-C8h]
int v53; // [xsp+3Ch] [xbp-C4h]
_BYTE v54[32]; // [xsp+40h] [xbp-C0h] BYREF
int v55; // [xsp+60h] [xbp-A0h]
void *__p; // [xsp+70h] [xbp-90h] BYREF
_BYTE *v57; // [xsp+78h] [xbp-88h]
__int64 v58; // [xsp+80h] [xbp-80h]
cocos2d::CCPoint v59; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v60; // 0:x3.16
if ( (unsigned int)sub_10024A36C(a1->m_groupButtons) )
{
v2 = 0;
do
{
v3 = sub_10024A388(a1->m_groupButtons, v2);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v3 + 504LL))(v3);
v2 = (unsigned int)(v2 + 1);
}
while ( (unsigned int)v2 < (unsigned int)sub_10024A36C(a1->m_groupButtons) );
}
sub_10024A45C(a1->m_groupButtons);
__p = nullptr;
v57 = nullptr;
v58 = 0;
m_gameObject = (RandTriggerGameObject *)a1->m_gameObject;
if ( m_gameObject )
{
begin = m_gameObject->m_chanceObjects.__begin_;
end = m_gameObject->m_chanceObjects.__end_;
while ( begin != end )
{
*(_QWORD *)v54 = begin;
sub_1000115B8((__int64)&__p, v54);
++begin;
}
LODWORD(m_gameObject) = RandTriggerGameObject::getTotalChance(m_gameObject);
v7 = 0;
v8 = 1;
v9 = 5;
v10 = 66.0;
}
else
{
v11 = 0;
v12 = 0;
memset(v54, 0, sizeof(v54));
v55 = 1065353216;
v8 = 1;
while ( (unsigned int)v11 < (unsigned int)sub_10024A36C(a1->m_gameObjects) )
{
v13 = (RandTriggerGameObject *)sub_10024A388(a1->m_gameObjects, v11);
LODWORD(m_gameObject) = RandTriggerGameObject::getTotalChance(v13);
p_m_groupID = &v13->m_chanceObjects.__begin_->m_groupID;
v15 = v13->m_chanceObjects.__end_;
while ( p_m_groupID != (int *)v15 )
{
if ( sub_100018814(v54, p_m_groupID) )
{
v16 = 0;
}
else
{
v17 = p_m_groupID[2];
LODWORD(v51) = *p_m_groupID;
HIDWORD(v51) = v51;
v52 = v17;
v53 = 0;
v18 = sub_10002F900(v54, p_m_groupID, p_m_groupID, &v51);
v16 = v18 + 20;
*(_DWORD *)(v18 + 32) = 0;
++v12;
}
if ( *(_DWORD *)(v16 + 8) != p_m_groupID[2] )
{
v8 = 0;
*(_DWORD *)(v16 + 8) = -1;
}
++*(_DWORD *)(v16 + 12);
p_m_groupID += 4;
}
v11 = (unsigned int)(v11 + 1);
}
v19 = *(__int64 **)&v54[16];
if ( *(_QWORD *)&v54[16] )
{
do
{
v20 = *((_DWORD *)v19 + 8);
v21 = sub_10024A36C(a1->m_gameObjects);
v51 = (__int64)v19 + 20;
sub_1000115B8((__int64)&__p, &v51);
v8 &= v20 >= v21;
v19 = (__int64 *)*v19;
}
while ( v19 );
}
sub_100017A98((__int64)v54);
v7 = v12 > 10;
if ( v12 <= 10 )
v9 = 5;
else
v9 = 10;
if ( v12 <= 10 )
v10 = 66.0;
else
v10 = 35.0;
}
v22 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v22);
m_buttonMenu = a1->m_buttonMenu;
v26 = -2.0;
if ( v7 )
v26 = -4.5;
v23.n128_f32[0] = (float)(*(float *)&v51 * 0.5) + (float)(v26 * v10);
v24.n128_f32[0] = (float)(*((float *)&v51 + 1) * 0.5) + 10.0;
sub_100022980(v23, v24, v54);
v59 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)v54);
v46.n128_u32[0] = LODWORD(v59.x);
v47.n128_u32[0] = LODWORD(v59.y);
*(_QWORD *)v54 = sub_10002E46C;
sub_10002FB2C(v46, v47);
v27 = __p;
if ( v57 != __p )
{
v28 = 0;
v29 = (float)(int)m_gameObject;
if ( v7 )
v30 = 15;
else
v30 = 40;
do
{
v31 = (unsigned int *)v27[v28];
v32 = "GJ_button_04.png";
if ( !a1->m_gameObject )
{
v33 = v31[3];
if ( v33 >= (unsigned int)sub_10024A36C(a1->m_gameObjects) )
v32 = "GJ_button_04.png";
else
v32 = "GJ_button_05.png";
}
v34 = v31[2];
memset(v54, 0, 24);
v35 = v31[2];
if ( (v8 & 1) != 0 )
{
if ( v34 < 1 )
v36 = (cocos2d::CCString *)sub_100268F4C("%i - ?\n?%%");
else
v36 = (cocos2d::CCString *)sub_100268F4C(
"%i - %i\n%i%%",
*v31,
v31[2],
llroundf((float)((float)v35 / v29) * 100.0));
}
else if ( v34 < 1 )
{
v36 = (cocos2d::CCString *)sub_100268F4C("%i - ?");
}
else
{
v36 = (cocos2d::CCString *)sub_100268F4C("%i - %i", *v31, v35);
}
CString = cocos2d::CCString::getCString(v36);
std::string::assign((std::string *)v54, CString);
if ( v54[23] >= 0 )
v38 = v54;
else
v38 = *(const char **)v54;
v39 = ButtonSprite::create_1(v38, v30, 0, 0.35, 1, "bigFont.fnt", v32, 30.0);
v40 = v39;
if ( v34 <= 0 )
{
m_label = v39->m_label;
v49.i8[2] = 0;
v49.i16[0] = -26881;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))m_label->setColor)(m_label, &v49);
}
v60.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupRandAdvTriggerPopup::onRemoveFromGroup;
v60.adj = 0;
v42 = CCMenuItemSpriteExtra::create(v40, nullptr, a1, v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v42->setTag)(v42, *v31);
v43 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v42);
v43.n128_f32[0] = v10 * (float)((unsigned int)v28 % v9);
v44.n128_f32[0] = (float)(int)(-38 * ((unsigned int)v28 / v9));
sub_100022980(v43, v44, &v48);
*(float32x2_t *)&v45 = sub_1000229DC(&v50, &v48, &v49);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v42->setPosition)(v42, &v49, v45);
sub_10024A2D0(a1->m_groupButtons, v42);
if ( (v54[23] & 0x80000000) != 0 )
operator delete(*(void **)v54);
v27 = __p;
if ( v28 > 0x12 )
break;
++v28;
}
while ( (v57 - (_BYTE *)__p) >> 3 > v28 );
}
if ( v27 )
{
v57 = v27;
operator delete(v27);
}
}