//
// SetupSequenceTriggerPopup::updateGroupIDButtons from 0x1004de920 to 0x1004dec50 (816 bytes)
//
// 4 xrefs:
// > SetupSequenceTriggerPopup::init @ 0x1004de617
// > SetupSequenceTriggerPopup::onAddChance @ 0x1004de81d
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0x1004de871
// > SetupSequenceTriggerPopup::onChangeOrder @ 0x1004de908
//
// 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; // rdi
__int64 v3; // rax
unsigned int v4; // r14d
__int64 v5; // rax
EffectGameObject *m_gameObject; // r14
_BOOL8 v7; // r15
_BOOL8 v8; // r12
cocos2d::CCMenu *m_buttonMenu; // r13
__int64 v10; // r15
unsigned __int64 i; // r13
cocos2d::CCString *v12; // rax
const char *CString; // rax
int v14; // r12d
cocos2d::CCString *v15; // rax
const char *data; // rdi
const char *v17; // r9
ButtonSprite *v18; // rax
CCMenuItemSpriteExtra *v19; // r12
char v20; // [rsp+0h] [rbp-90h]
unsigned __int64 v21; // [rsp+8h] [rbp-88h] BYREF
double v22; // [rsp+10h] [rbp-80h] BYREF
unsigned __int64 v23; // [rsp+18h] [rbp-78h] BYREF
unsigned __int64 v24; // [rsp+20h] [rbp-70h]
float v25[2]; // [rsp+2Ch] [rbp-64h] BYREF
unsigned int v26; // [rsp+34h] [rbp-5Ch]
__int64 v27; // [rsp+38h] [rbp-58h]
std::string v28; // [rsp+40h] [rbp-50h] BYREF
float v29; // [rsp+64h] [rbp-2Ch]
m_selectedButton = a1->m_selectedButton;
if ( m_selectedButton )
{
LODWORD(v3) = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))m_selectedButton->getTag)(m_selectedButton);
a1->m_selectedButton = nullptr;
v3 = (unsigned int)v3;
}
else
{
v3 = 0xFFFFFFFFLL;
}
v27 = v3;
if ( (unsigned int)sub_100720070(a1->m_groupButtons) )
{
v4 = 0;
do
{
v5 = sub_1007200C0(a1->m_groupButtons, v4);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v5 + 504LL))(v5);
++v4;
}
while ( v4 < (unsigned int)sub_100720070(a1->m_groupButtons) );
}
sub_100720270(a1->m_groupButtons);
m_gameObject = a1->m_gameObject;
v24 = *(_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;
v7 = v24 >= 0xA1;
v8 = v7;
v29 = *(float *)&dword_100818D80[v8];
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v25);
m_buttonMenu = a1->m_buttonMenu;
sub_10028CBE0(
(float *)&v28,
(float)(*(float *)((char *)&unk_10081DAD8 + v8 * 4) * v29) + (float)(v25[0] * 0.5),
(float)(0.5 * v25[1]) + 34.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v21, (const cocos2d::CCPoint *)m_buttonMenu);
if ( *(EffectGameObject_vtbl **)&m_gameObject[1].m_uID != m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable )
{
v26 = 5 * v7 + 5;
v10 = 8;
for ( i = 0;
(__int64)(*(_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) >> 4 > i;
++i )
{
memset(&v28, 0, sizeof(v28));
if ( v24 <= 0xA0 )
{
v15 = (cocos2d::CCString *)sub_1007AB580("%i-%i", v20);
CString = cocos2d::CCString::getCString(v15);
v14 = 40;
}
else
{
v12 = (cocos2d::CCString *)sub_1007AB580("%i\n%i", v20);
CString = cocos2d::CCString::getCString(v12);
v14 = 15;
}
std::string::assign(&v28, CString);
data = v28.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
data = v28.__r_.__value_.__l.__data_;
v17 = "GJ_button_04.png";
if ( v27 == i )
v17 = "GJ_button_03.png";
v18 = ButtonSprite::create_1(data, v14, 0, 0.34999999, 1, "bigFont.fnt", v17, 30.0);
v19 = CCMenuItemSpriteExtra::create(
v18,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SetupSequenceTriggerPopup::onSelect);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v19->setTag)(v19, (unsigned int)i);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v19);
sub_10028CBE0(
(float *)&v23,
(float)(int)((unsigned int)i % v26) * v29,
(float)(int)((unsigned int)i / v26) * -38.0);
sub_10028CCE0(&v22, &v21, &v23);
((void (__fastcall *)(CCMenuItemSpriteExtra *, double *))v19->setPosition)(v19, &v22);
sub_10071FCD0(a1->m_groupButtons, v19);
if ( v27 == i )
{
a1->m_selectedButton = v19;
if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_21:
operator delete(v28.__r_.__value_.__l.__data_);
if ( i > 0x12 )
return;
goto LABEL_22;
}
}
else if ( (*(_BYTE *)&v28.__r_.__value_.__s.0 & 1) != 0 )
{
goto LABEL_21;
}
if ( i > 0x12 )
return;
LABEL_22:
v10 += 16;
}
}
}