//
// SetupSequenceTriggerPopup::updateGroupIDButtons from 0x1001d32cc to 0x1001d35bc (752 bytes)
//
// 4 xrefs:
// > SetupSequenceTriggerPopup::init @ 0x1001d2f90
// > SetupSequenceTriggerPopup::onAddChance @ 0x1001d31c8
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0x1001d3214
// > SetupSequenceTriggerPopup::onChangeOrder @ 0x1001d32b8
//
// 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 SetupSequenceTriggerPopup::updateGroupIDButtons(SetupSequenceTriggerPopup *a1)
{
CCMenuItemSpriteExtra *m_selectedButton; // x0
unsigned int v3; // w0
__int64 v4; // x21
__int64 v5; // x20
__int64 v6; // x0
EffectGameObject *m_gameObject; // x26
unsigned __int64 v8; // x27
cocos2d::CCDirector *v9; // x0
__n128 v10; // q0
__n128 v11; // q1
unsigned int v12; // w28
float v13; // s9
cocos2d::CCMenu *m_buttonMenu; // x20
EffectGameObject_vtbl *v15; // x8
__int64 v16; // x24
unsigned __int64 v17; // x20
__int64 v18; // x21
char *v19; // x9
int v20; // w8
int v21; // w9
cocos2d::CCString *v22; // x0
const char *v23; // x0
int v24; // w1
cocos2d::CCString *v25; // x0
const char *CString; // x0
std::string *v27; // x0
const char *v28; // x5
ButtonSprite *v29; // x0
CCMenuItemSpriteExtra *v30; // x25
__n128 v31; // q0
__n128 v32; // q1
double v33; // d0
float32x2_t v34; // [xsp+18h] [xbp-98h] BYREF
float32x2_t v35; // [xsp+20h] [xbp-90h] BYREF
std::string v36; // [xsp+28h] [xbp-88h] BYREF
float32x2_t v37; // [xsp+40h] [xbp-70h] BYREF
float v38; // [xsp+48h] [xbp-68h]
float v39; // [xsp+4Ch] [xbp-64h]
cocos2d::SEL_MenuHandler v40; // 0:x3.16
m_selectedButton = a1->m_selectedButton;
if ( m_selectedButton )
{
v3 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))m_selectedButton->getTag)(m_selectedButton);
a1->m_selectedButton = nullptr;
v4 = v3;
}
else
{
v4 = 0xFFFFFFFFLL;
}
if ( (unsigned int)sub_10024A36C(a1->m_groupButtons) )
{
v5 = 0;
do
{
v6 = sub_10024A388(a1->m_groupButtons, v5);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 504LL))(v6);
v5 = (unsigned int)(v5 + 1);
}
while ( (unsigned int)v5 < (unsigned int)sub_10024A36C(a1->m_groupButtons) );
}
sub_10024A45C(a1->m_groupButtons);
m_gameObject = a1->m_gameObject;
v8 = *(_QWORD *)&m_gameObject[1].m_uID
- (unsigned __int64)m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
if ( v8 <= 0xA0 )
v12 = 5;
else
v12 = 10;
if ( v8 <= 0xA0 )
v13 = 66.0;
else
v13 = 35.0;
m_buttonMenu = a1->m_buttonMenu;
v10.n128_u32[0] = -2.0;
if ( v8 > 0xA0 )
v10.n128_f32[0] = -4.5;
v10.n128_f32[0] = (float)(v38 * 0.5) + (float)(v10.n128_f32[0] * v13);
v11.n128_f32[0] = (float)(v39 * 0.5) + 34.0;
sub_100022980(v10, v11, &v36);
cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, (const cocos2d::CCPoint *)&v36);
v15 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( *(EffectGameObject_vtbl **)&m_gameObject[1].m_uID != v15 )
{
v16 = 0;
v17 = 0;
v18 = 16 * v4;
do
{
v19 = (char *)v15 + v16;
memset(&v36, 0, sizeof(v36));
v20 = *(_DWORD *)((char *)&v15->copyWithZone + v16);
v21 = *((_DWORD *)v19 + 2);
if ( v8 <= 0xA0 )
{
v25 = (cocos2d::CCString *)sub_100268F4C("%i-%i", v20, v21);
CString = cocos2d::CCString::getCString(v25);
std::string::assign(&v36, CString);
v24 = 40;
}
else
{
v22 = (cocos2d::CCString *)sub_100268F4C("%i\n%i", v20, v21);
v23 = cocos2d::CCString::getCString(v22);
std::string::assign(&v36, v23);
v24 = 15;
}
if ( (v36.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v27 = &v36;
else
v27 = (std::string *)v36.__r_.__value_.__r.__words[0];
if ( v18 == v16 )
v28 = "GJ_button_03.png";
else
v28 = "GJ_button_04.png";
v29 = ButtonSprite::create_1((const char *)v27, v24, 0, 0.35, 1, "bigFont.fnt", v28, 30.0);
v40.ptr = (void (__cdecl *)(cocos2d::CCObject *))SetupSequenceTriggerPopup::onSelect;
v40.adj = 0;
v30 = CCMenuItemSpriteExtra::create(v29, nullptr, a1, v40);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64))v30->setTag)(v30, v17);
v31 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v30);
v31.n128_f32[0] = v13 * (float)((unsigned int)v17 % v12);
v32.n128_f32[0] = (float)((unsigned int)v17 / v12) * -38.0;
sub_100022980(v31, v32, &v34);
*(float32x2_t *)&v33 = sub_1000229DC(&v37, &v34, &v35);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, double))v30->setPosition)(v30, &v35, v33);
sub_10024A2D0(a1->m_groupButtons, v30);
if ( v18 == v16 )
a1->m_selectedButton = v30;
if ( SHIBYTE(v36.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v36.__r_.__value_.__l.__data_);
if ( v17 > 0x12 )
break;
++v17;
v15 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v16 += 16;
}
while ( (__int64)(*(_QWORD *)&m_gameObject[1].m_uID - (_QWORD)v15) >> 4 > v17 );
}
}