//
// SetupRandAdvTriggerPopup::updateGroupIDButtons from 0x14043dea0 to 0x14043e814 (2420 bytes)
//
// 5 xrefs:
// > SetupRandAdvTriggerPopup::init @ 0x14043dd7b
// > SetupRandAdvTriggerPopup::callRemoveFromGroup @ 0x14043e965
// > SetupRandAdvTriggerPopup::onAddChance @ 0x14043ece0
// > SetupRandAdvTriggerPopup::onAddChance @ 0x14043ece8
// > ??> @ 0x1406da19c
//
// 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=7
void SetupRandAdvTriggerPopup::updateGroupIDButtons(SetupRandAdvTriggerPopup *a1)
{
SetupRandAdvTriggerPopup *v1; // r12
unsigned int i; // ebx
struct cocos2d::CCObject *v3; // rax
_BYTE *v4; // rax
int v5; // r15d
int v6; // r14d
EffectGameObject *m_gameObject; // r13
EffectGameObject_vtbl *v8; // rdi
EffectGameObject_vtbl *v9; // rbx
_BYTE *v10; // rsi
EffectGameObject_vtbl *v11; // rcx
EffectGameObject_vtbl *j; // rax
char v13; // bl
float v14; // xmm6_4
int v15; // eax
float v16; // xmm10_4
int v17; // eax
float v18; // xmm9_4
cocos2d::CCDirector *v19; // rax
int **v20; // r15
__int64 v21; // r13
int v22; // edi
int **v23; // rcx
int *v24; // rsi
bool v25; // al
_QWORD *v26; // rdi
_QWORD *v27; // rbx
_QWORD *v28; // rax
unsigned int v29; // esi
struct cocos2d::CCObject *v30; // rax
int v31; // r14d
unsigned __int8 *v32; // rbx
unsigned __int8 *v33; // rdi
unsigned __int8 *v34; // rax
unsigned int *p_m_uReference; // rdx
__int64 v36; // rcx
int v37; // ecx
__int64 *v38; // rdi
__int64 *v39; // rbx
SetupRandAdvTriggerPopup *v40; // r13
char v41; // r15
_BYTE *v42; // r14
unsigned int v43; // eax
char v44; // dl
int v45; // r13d
const char *v46; // r13
int v47; // r15d
int v48; // r9d
int v49; // edx
cocos2d::CCString *v50; // rax
char *CString; // rax
size_t v52; // r8
cocos2d::CCString *v53; // rax
cocos2d::CCString *v54; // rax
cocos2d::CCString *v55; // rax
const char *v56; // rbx
ButtonSprite *v57; // rdi
CCMenuItemSpriteExtra *v58; // rbx
int v59; // edi
float v60; // xmm0_4
void *v61; // rcx
char *v62; // rax
char v63; // [rsp+50h] [rbp-B0h]
int v64; // [rsp+54h] [rbp-ACh] BYREF
int v65; // [rsp+58h] [rbp-A8h]
SetupRandAdvTriggerPopup *v66; // [rsp+60h] [rbp-A0h]
EffectGameObject_vtbl *v67; // [rsp+68h] [rbp-98h] BYREF
int v68; // [rsp+70h] [rbp-90h]
void *v69[2]; // [rsp+78h] [rbp-88h] BYREF
_BYTE *v70; // [rsp+88h] [rbp-78h]
_BYTE *v71; // [rsp+90h] [rbp-70h]
float v72; // [rsp+98h] [rbp-68h]
unsigned __int64 v73; // [rsp+A0h] [rbp-60h]
_DWORD v74[4]; // [rsp+A8h] [rbp-58h] BYREF
struct cocos2d::CCPoint v75; // [rsp+B8h] [rbp-48h] BYREF
cocos2d::CCPoint v76; // [rsp+C0h] [rbp-40h] BYREF
CCMenuItemSpriteExtra *v77; // [rsp+C8h] [rbp-38h] BYREF
ButtonSprite *v78; // [rsp+D8h] [rbp-28h]
__int128 v79; // [rsp+E0h] [rbp-20h] BYREF
__int64 v80; // [rsp+F0h] [rbp-10h]
void *Block[3]; // [rsp+F8h] [rbp-8h] BYREF
__int64 v82; // [rsp+110h] [rbp+10h]
__int64 v83; // [rsp+118h] [rbp+18h]
v1 = a1;
v66 = a1;
for ( i = 0; i < cocos2d::CCArray::count(v1->m_groupButtons); ++i )
{
v3 = cocos2d::CCArray::objectAtIndex(v1->m_groupButtons, i);
((void (__fastcall *)(struct cocos2d::CCObject *))v3->__vftable[6].setTag)(v3);
}
cocos2d::CCArray::removeAllObjects(v1->m_groupButtons);
*(_OWORD *)v69 = 0;
v4 = nullptr;
v71 = nullptr;
v70 = nullptr;
v5 = 0;
v65 = 0;
v63 = 1;
v6 = 0;
v64 = 0;
m_gameObject = v1->m_gameObject;
if ( m_gameObject )
{
v8 = *(EffectGameObject_vtbl **)&m_gameObject[1].m_uID;
v9 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v10 = v69[1];
if ( v9 != v8 )
{
do
{
v67 = v9;
if ( v10 == v4 )
{
sub_140063110(v69, v10, &v67);
v4 = v70;
v10 = v69[1];
}
else
{
*(_QWORD *)v10 = v9;
v10 += 8;
v69[1] = v10;
}
v9 = (EffectGameObject_vtbl *)((char *)v9 + 16);
}
while ( v9 != v8 );
v71 = v4;
}
v11 = *(EffectGameObject_vtbl **)&m_gameObject[1].m_uID;
for ( j = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
j != v11;
j = (EffectGameObject_vtbl *)((char *)j + 16) )
{
v6 += LODWORD(j->~EffectGameObject);
}
LOBYTE(v11) = 0;
v68 = 5;
v13 = 1;
LABEL_13:
v14 = 2.0;
goto LABEL_14;
}
v80 = 0;
v26 = operator new(0x28u);
*v26 = v26;
v26[1] = v26;
*((_QWORD *)&v79 + 1) = v26;
v82 = 7;
v83 = 8;
LODWORD(v79) = 1065353216;
v27 = operator new(0x80u);
Block[0] = v27;
v28 = v27 + 16;
Block[1] = v27 + 16;
Block[2] = v27 + 16;
do
*v27++ = v26;
while ( v27 != v28 );
v29 = 0;
if ( cocos2d::CCArray::count(v1->m_gameObjects) )
{
while ( 1 )
{
v30 = cocos2d::CCArray::objectAtIndex(v1->m_gameObjects, v29);
v31 = 0;
v32 = *(unsigned __int8 **)&v30[33].m_uID;
v33 = *(unsigned __int8 **)&v30[33].m_nTag;
v34 = v32;
if ( v32 != v33 )
break;
v6 = 0;
v64 = 0;
LABEL_43:
if ( ++v29 >= cocos2d::CCArray::count(v1->m_gameObjects) )
goto LABEL_44;
}
do
{
v31 += *((_DWORD *)v34 + 2);
v34 += 16;
}
while ( v34 != v33 );
v64 = v31;
while ( 1 )
{
p_m_uReference = nullptr;
v36 = *((_QWORD *)Block[0]
+ 2
* ((0x100000001B3LL
* (v32[3]
^ (0x100000001B3LL
* (v32[2] ^ (0x100000001B3LL * (v32[1] ^ (0x100000001B3LL * (*v32 ^ 0xCBF29CE484222325uLL))))))))
& v82)
+ 1);
if ( v36 == *((_QWORD *)&v79 + 1) )
goto LABEL_35;
if ( *(_DWORD *)v32 != *(_DWORD *)(v36 + 16) )
break;
LABEL_36:
if ( !v36 )
{
v37 = *((_DWORD *)v32 + 2);
v74[0] = *(_DWORD *)v32;
v74[1] = v74[0];
v74[2] = v37;
v74[3] = 0;
sub_14043ED20(&v79, &v77, v32, v74);
p_m_uReference = &v77->m_uReference;
v77->m_uIndexInArray = 0;
++v5;
}
if ( p_m_uReference[2] != *((_DWORD *)v32 + 2) )
{
p_m_uReference[2] = -1;
v63 = 0;
}
++p_m_uReference[3];
v32 += 16;
if ( v32 == v33 )
{
v65 = v5;
v6 = v64;
v1 = v66;
goto LABEL_43;
}
}
while ( v36 != *((_QWORD *)Block[0]
+ 2
* ((0x100000001B3LL
* (v32[3]
^ (0x100000001B3LL
* (v32[2] ^ (0x100000001B3LL * (v32[1] ^ (0x100000001B3LL * (*v32 ^ 0xCBF29CE484222325uLL))))))))
& v82)) )
{
v36 = *(_QWORD *)(v36 + 8);
if ( *(_DWORD *)v32 == *(_DWORD *)(v36 + 16) )
goto LABEL_36;
}
LABEL_35:
v36 = 0;
goto LABEL_36;
}
LABEL_44:
v38 = *((__int64 **)&v79 + 1);
v39 = **((__int64 ***)&v79 + 1);
v10 = v69[1];
if ( **((_QWORD **)&v79 + 1) == *((_QWORD *)&v79 + 1) )
{
v13 = v63;
}
else
{
v40 = v66;
v41 = v63;
v42 = v71;
do
{
v43 = cocos2d::CCArray::count(v40->m_gameObjects);
v44 = 0;
if ( *((_DWORD *)v39 + 8) >= v43 )
v44 = v41;
v41 = v44;
v67 = (EffectGameObject_vtbl *)((char *)v39 + 20);
if ( v10 == v42 )
{
sub_140063110(v69, v10, &v67);
v42 = v70;
v10 = v69[1];
}
else
{
*(_QWORD *)v10 = (char *)v39 + 20;
v10 += 8;
v69[1] = v10;
}
v39 = (__int64 *)*v39;
}
while ( v39 != v38 );
v71 = v42;
v13 = v41;
v6 = v64;
v5 = v65;
v1 = v40;
}
v63 = v13;
sub_14005D100((__int64)Block);
sub_1402652B0((void **)&v79 + 1);
LOBYTE(v11) = v5 > 10;
v45 = 5;
if ( v5 > 10 )
v45 = 10;
v68 = v45;
if ( v5 <= 10 )
goto LABEL_13;
v14 = 4.5;
v63 = v13;
LABEL_14:
v15 = 66;
if ( (_BYTE)v11 )
v15 = 35;
v16 = (float)v15;
v17 = 40;
if ( (_BYTE)v11 )
v17 = 15;
v18 = (float)v17;
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v11);
cocos2d::CCDirector::getWinSize(v19);
cocos2d::CCPoint::CCPoint(v16 * v14, (float)(v72 * 0.5) - (float)(v16 * v14));
cocos2d::CCNode::convertToNodeSpace(v1->m_buttonMenu, &v75);
v20 = (int **)v69[0];
v21 = (v10 - (char *)v69[0]) >> 3;
v73 = v21;
sub_14043F150(v69[0], v10, v21, sub_14043D210);
v22 = 0;
LODWORD(v66) = 0;
if ( v21 )
{
v23 = v20;
v67 = (EffectGameObject_vtbl *)v20;
while ( 1 )
{
if ( v22 >= 20 )
{
LABEL_95:
v20 = (int **)v69[0];
break;
}
v24 = *v23;
v25 = v1->m_gameObject || v24[3] >= cocos2d::CCArray::count(v1->m_gameObjects);
v46 = "GJ_button_05.png";
if ( v25 )
v46 = "GJ_button_04.png";
v47 = v24[2];
v79 = 0;
v80 = 0;
Block[0] = (void *)15;
LOBYTE(v79) = 0;
v48 = (int)roundf((float)((float)v24[2] / (float)v6) * 100.0);
v49 = *v24;
if ( v13 )
{
if ( v47 <= 0 )
{
v53 = cocos2d::CCString::createWithFormat("%i - ?\n?%%", v49);
CString = (char *)cocos2d::CCString::getCString(v53);
v52 = -1;
do
++v52;
while ( CString[v52] );
}
else
{
v50 = cocos2d::CCString::createWithFormat("%i - %i\n%i%%", v49, v24[2], v48);
CString = (char *)cocos2d::CCString::getCString(v50);
v52 = -1;
do
++v52;
while ( CString[v52] );
}
}
else if ( v47 <= 0 )
{
v55 = cocos2d::CCString::createWithFormat("%i - ?", v49);
CString = (char *)cocos2d::CCString::getCString(v55);
v52 = -1;
do
++v52;
while ( CString[v52] );
}
else
{
v54 = cocos2d::CCString::createWithFormat("%i - %i", v49, v24[2]);
CString = (char *)cocos2d::CCString::getCString(v54);
v52 = -1;
do
++v52;
while ( CString[v52] );
}
sub_14003CCE0((void **)&v79, CString, v52);
v56 = (const char *)&v79;
if ( Block[0] > (void *)0xF )
v56 = (const char *)v79;
v78 = (ButtonSprite *)operator new(0x2C0u);
v57 = ButtonSprite::ButtonSprite(v78);
if ( v57 )
{
if ( ButtonSprite::init_1(v57, v56, (int)v18, 0, 0.34999999, 1, (const char *)&qword_14052A4D8, v46, 30.0) )
{
cocos2d::CCObject::autorelease(v57);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v57->~ButtonSprite)(v57, 1);
v57 = nullptr;
}
}
if ( v47 <= 0 )
{
LOWORD(v65) = -26881;
LOWORD(v64) = -26881;
BYTE2(v64) = 0;
v57->m_label->setColor(&v57->m_label->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v64);
}
v77 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v58 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v77);
if ( v58 )
{
if ( CCMenuItemSpriteExtra::init(
v58,
v57,
nullptr,
v1,
(cocos2d::SEL_MenuHandler *)SetupRandAdvTriggerPopup::onRemoveFromGroup) )
{
cocos2d::CCObject::autorelease(v58);
goto LABEL_88;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v58->~CCMenuItemSpriteExtra)(v58, 1);
}
v58 = nullptr;
LABEL_88:
v58->setTag(v58, *v24);
v1->m_buttonMenu->addChild_1(v1->m_buttonMenu, v58);
v59 = (int)v66;
v60 = floorf((float)((int)v66 / v68));
cocos2d::CCPoint::CCPoint(v60, (float)(v59 % v68) * v16);
cocos2d::CCPoint::operator+(&v75, &v76);
v58->setPosition_0(v58, &v76);
cocos2d::CCArray::addObject(v1->m_groupButtons, v58);
if ( Block[0] > (void *)0xF )
{
v61 = (void *)v79;
if ( (unsigned __int64)Block[0] + 1 >= 0x1000 )
{
v61 = *(void **)(v79 - 8);
if ( (unsigned __int64)(v79 - (_QWORD)v61 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v61);
}
v22 = v59 + 1;
LODWORD(v66) = v22;
v23 = (int **)&v67->~EffectGameObject;
v67 = (EffectGameObject_vtbl *)((char *)v67 + 8);
if ( v22 >= v73 )
goto LABEL_95;
v13 = v63;
}
}
if ( v20 )
{
v62 = (char *)v20;
if ( ((v71 - (_BYTE *)v20) & 0xFFFFFFFFFFFFFFF8uLL) >= 0x1000 )
{
v20 = (int **)*(v20 - 1);
if ( (unsigned __int64)(v62 - (char *)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v20);
}
}