//
// SetupSequenceTriggerPopup::updateGroupIDButtons from 0x1405d99d0 to 0x1405d9e8d (1213 bytes)
//
// 5 xrefs:
// > SetupSequenceTriggerPopup::init @ 0x1405d97e0
// > SetupSequenceTriggerPopup::onAddChance @ 0x1405d9ffa
// > SetupSequenceTriggerPopup::onChangeOrder @ 0x1405da0dc
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0x1405da193
// > ??> @ 0x14092eb50
//
// 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 11:34:58 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall SetupSequenceTriggerPopup::updateGroupIDButtons(__int64 a1)
{
int v2; // edi
__int64 v3; // rcx
unsigned int i; // ebx
struct cocos2d::CCObject *v5; // rax
__int64 *v6; // r15
unsigned __int64 v7; // r12
int v8; // eax
float v9; // xmm6_4
int v10; // eax
float v11; // xmm9_4
int v12; // eax
float v13; // xmm8_4
__int64 v14; // rax
__int64 v15; // rax
int v16; // ebp
__int64 v17; // rdx
__int64 result; // rax
__int64 v19; // r13
__int64 v20; // r14
__int64 v21; // r8
__int64 v22; // rdx
const char *v23; // rcx
cocos2d::CCString *v24; // rax
char *CString; // rax
size_t v26; // r8
__int128 *v27; // rdi
cocos2d::CCObject *v28; // rbx
const char *v29; // rax
__int64 *v30; // rdi
float v31; // xmm0_4
__int64 v32; // rax
void *v33; // rcx
int v34; // [rsp+50h] [rbp-E8h]
int v35; // [rsp+54h] [rbp-E4h]
float v36[2]; // [rsp+58h] [rbp-E0h] BYREF
__int64 v37; // [rsp+60h] [rbp-D8h] BYREF
_BYTE v38[8]; // [rsp+68h] [rbp-D0h] BYREF
_BYTE v39[8]; // [rsp+70h] [rbp-C8h] BYREF
void *v40; // [rsp+78h] [rbp-C0h]
void *v41; // [rsp+80h] [rbp-B8h]
_BYTE v42[8]; // [rsp+88h] [rbp-B0h] BYREF
__int128 v43; // [rsp+90h] [rbp-A8h] BYREF
__int64 v44; // [rsp+A0h] [rbp-98h]
unsigned __int64 v45; // [rsp+A8h] [rbp-90h]
v2 = -1;
v34 = -1;
v3 = *(_QWORD *)(a1 + 1000);
if ( v3 )
{
v2 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v3 + 56LL))(v3);
v34 = v2;
*(_QWORD *)(a1 + 1000) = 0;
}
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 1016)); ++i )
{
v5 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 1016), i);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v5 + 512LL))(v5);
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 1016));
v6 = (__int64 *)(*(_QWORD *)(a1 + 680) + 1856LL);
v7 = (*(_QWORD *)(*(_QWORD *)(a1 + 680) + 1864LL) - *v6) >> 4;
v8 = 5;
if ( v7 > 0xA )
v8 = 10;
v35 = 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::sharedDirector(35);
cocos2d::CCDirector::getWinSize(v14, v36);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v37,
(float)(v36[0] * 0.5) - (float)(v11 * v9),
(float)(v36[1] * 0.5) + 34.0);
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v38, v15);
v16 = 0;
v17 = *v6;
result = (v6[1] - *v6) >> 4;
if ( result )
{
v19 = 0;
result = v2;
v37 = v2;
v20 = 0;
while ( 1 )
{
if ( v16 >= 20 )
return result;
v43 = 0;
v44 = 0;
v45 = 15;
LOBYTE(v43) = 0;
v21 = *(unsigned int *)(v20 + v17 + 8);
v22 = *(unsigned int *)(v20 + v17);
v23 = "%i-%i";
if ( v7 > 0xA )
v23 = "%i\n%i";
v24 = cocos2d::CCString::createWithFormat(v23, v22, v21);
CString = (char *)cocos2d::CCString::getCString(v24);
v26 = -1;
do
++v26;
while ( CString[v26] );
sub_1400405A0((void **)&v43, CString, v26);
v27 = &v43;
if ( v45 > 0xF )
v27 = (__int128 *)v43;
v40 = operator new(0x2C8u);
v28 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v40);
if ( v28 )
{
v29 = "GJ_button_04.png";
if ( v16 == v34 )
v29 = "GJ_button_03.png";
if ( ButtonSprite::init_1(
(__int64)v28,
(__int64)v27,
(int)v13,
0,
1051931443,
1,
&qword_140704F78,
(__int64)v29,
1106247680) )
{
cocos2d::CCObject::autorelease(v28);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v28 + 8LL))(v28, 1);
v28 = nullptr;
}
}
v41 = operator new(0x208u);
v30 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v41);
if ( !v30 )
goto LABEL_33;
if ( !CCMenuItemSpriteExtra::init(v30, (__int64 *)v28, 0, a1, (__int64)SetupSequenceTriggerPopup::onSelect) )
break;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v30);
LABEL_34:
(*(void (__fastcall **)(__int64 *, _QWORD))(*v30 + 64))(v30, (unsigned int)v16);
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v30);
v31 = floorf((float)(v16 / v35)) * -38.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v42, (float)(v16 % v35) * v11, v31);
cocos2d::CCPoint::operator+(v38, v39, v32);
(*(void (__fastcall **)(__int64 *, _BYTE *))(*v30 + 184))(v30, v39);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1016), (struct cocos2d::CCObject *)v30);
if ( v19 == v37 )
*(_QWORD *)(a1 + 1000) = v30;
if ( v45 > 0xF )
{
v33 = (void *)v43;
if ( v45 + 1 >= 0x1000 )
{
v33 = *(void **)(v43 - 8);
if ( (unsigned __int64)(v43 - (_QWORD)v33 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v33);
}
++v16;
++v19;
v20 += 16;
v17 = *v6;
result = v16;
if ( v16 >= (unsigned __int64)((v6[1] - *v6) >> 4) )
return result;
}
(*(void (__fastcall **)(__int64 *, __int64))(*v30 + 8))(v30, 1);
LABEL_33:
v30 = nullptr;
goto LABEL_34;
}
return result;
}