//
// SetupSequenceTriggerPopup::updateGroupIDButtons from 0x140444740 to 0x140444c1c (1244 bytes)
//
// 6 xrefs:
// > SetupSequenceTriggerPopup::init @ 0x140444581
// > SetupSequenceTriggerPopup::onAddChance @ 0x140444d5d
// > SetupSequenceTriggerPopup::onAddChance @ 0x140444dcd
// > SetupSequenceTriggerPopup::onChangeOrder @ 0x140444ea8
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0x140444f64
// > ??> @ 0x1406da4e4
//
// 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
//
// Hidden C++ exception states: #wind=3
void SetupSequenceTriggerPopup::updateGroupIDButtons(SetupSequenceTriggerPopup *a1)
{
int v2; // edi
CCMenuItemSpriteExtra *m_selectedButton; // rcx
unsigned int i; // ebx
struct cocos2d::CCObject *v5; // rax
EffectGameObject *m_gameObject; // r13
unsigned __int64 v7; // r15
int v8; // eax
float v9; // xmm6_4
int v10; // eax
float v11; // xmm9_4
int v12; // eax
float v13; // xmm8_4
cocos2d::CCDirector *v14; // rax
int v15; // ebp
EffectGameObject_vtbl *v16; // rdx
__int64 v17; // r12
__int64 j; // r14
int v19; // r8d
int v20; // edx
cocos2d::CCString *v21; // rax
char *CString; // rax
size_t v23; // r8
cocos2d::CCString *v24; // rax
const char *v25; // rdi
ButtonSprite *v26; // rbx
const char *v27; // rax
CCMenuItemSpriteExtra *v28; // rdi
float v29; // xmm0_4
void *v30; // rcx
int v31; // [rsp+50h] [rbp-E8h]
int v32; // [rsp+54h] [rbp-E4h]
float v33; // [rsp+58h] [rbp-E0h]
__int64 v34; // [rsp+60h] [rbp-D8h]
struct cocos2d::CCPoint v35; // [rsp+68h] [rbp-D0h] BYREF
cocos2d::CCPoint v36; // [rsp+70h] [rbp-C8h] BYREF
ButtonSprite *v37; // [rsp+78h] [rbp-C0h]
CCMenuItemSpriteExtra *v38; // [rsp+80h] [rbp-B8h]
__int128 v39; // [rsp+90h] [rbp-A8h] BYREF
__int64 v40; // [rsp+A0h] [rbp-98h]
unsigned __int64 v41; // [rsp+A8h] [rbp-90h]
v2 = -1;
v31 = -1;
m_selectedButton = a1->m_selectedButton;
if ( m_selectedButton )
{
v2 = m_selectedButton->getTag(m_selectedButton);
v31 = v2;
a1->m_selectedButton = nullptr;
}
for ( i = 0; i < cocos2d::CCArray::count(a1->m_groupButtons); ++i )
{
v5 = cocos2d::CCArray::objectAtIndex(a1->m_groupButtons, i);
((void (__fastcall *)(struct cocos2d::CCObject *))v5->__vftable[6].setTag)(v5);
}
cocos2d::CCArray::removeAllObjects(a1->m_groupButtons);
m_gameObject = a1->m_gameObject;
v7 = (__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;
v8 = 5;
if ( v7 > 0xA )
v8 = 10;
v32 = v8;
if ( v7 <= 0xA )
v9 = 2.0;
else
v9 = 4.5;
v10 = 66;
if ( v7 > 0xA )
v10 = 35;
v11 = (float)v10;
v12 = 40;
if ( v7 > 0xA )
v12 = 15;
v13 = (float)v12;
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(35);
cocos2d::CCDirector::getWinSize(v14);
cocos2d::CCPoint::CCPoint(v11 * v9, (float)(v33 * 0.5) - (float)(v11 * v9));
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v35);
v15 = 0;
v16 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( (__int64)(*(_QWORD *)&m_gameObject[1].m_uID - (_QWORD)v16) >> 4 )
{
v17 = 0;
v34 = v2;
for ( j = 0; ; j += 16 )
{
if ( v15 >= 20 )
return;
v39 = 0;
v40 = 0;
v41 = 15;
LOBYTE(v39) = 0;
v19 = *(_DWORD *)((char *)&v16->~EffectGameObject + j);
v20 = *(_DWORD *)((char *)&v16->copyWithZone + j);
if ( v7 > 0xA )
{
v24 = cocos2d::CCString::createWithFormat("%i\n%i", v20, v19);
CString = (char *)cocos2d::CCString::getCString(v24);
v23 = -1;
do
++v23;
while ( CString[v23] );
}
else
{
v21 = cocos2d::CCString::createWithFormat("%i-%i", v20, v19);
CString = (char *)cocos2d::CCString::getCString(v21);
v23 = -1;
do
++v23;
while ( CString[v23] );
}
sub_14003CCE0((void **)&v39, CString, v23);
v25 = (const char *)&v39;
if ( v41 > 0xF )
v25 = (const char *)v39;
v37 = (ButtonSprite *)operator new(0x2C0u);
v26 = ButtonSprite::ButtonSprite(v37);
if ( v26 )
{
v27 = "GJ_button_04.png";
if ( v15 == v31 )
v27 = "GJ_button_03.png";
if ( ButtonSprite::init_1(v26, v25, (int)v13, 0, 0.34999999, 1, (const char *)&qword_14052A4D8, v27, 30.0) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v26->~ButtonSprite)(v26, 1);
v26 = nullptr;
}
}
v38 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v28 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v38);
if ( !v28 )
goto LABEL_35;
if ( !CCMenuItemSpriteExtra::init(
v28,
v26,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)SetupSequenceTriggerPopup::onSelect) )
break;
cocos2d::CCObject::autorelease(v28);
LABEL_36:
v28->setTag(v28, v15);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v28);
v29 = floorf((float)(v15 / v32)) * -38.0;
cocos2d::CCPoint::CCPoint(v29, (float)(v15 % v32) * v11);
cocos2d::CCPoint::operator+(&v35, &v36);
v28->setPosition_0(v28, &v36);
cocos2d::CCArray::addObject(a1->m_groupButtons, v28);
if ( v17 == v34 )
a1->m_selectedButton = v28;
if ( v41 > 0xF )
{
v30 = (void *)v39;
if ( v41 + 1 >= 0x1000 )
{
v30 = *(void **)(v39 - 8);
if ( (unsigned __int64)(v39 - (_QWORD)v30 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v30);
}
++v15;
++v17;
v16 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v15 >= (unsigned __int64)((__int64)(*(_QWORD *)&m_gameObject[1].m_uID - (_QWORD)v16) >> 4) )
return;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v28->~CCMenuItemSpriteExtra)(v28, 1);
LABEL_35:
v28 = nullptr;
goto LABEL_36;
}
}