//
// SetupSequenceTriggerPopup::updateGroupIDButtons from 0xa58640 to 0xa589ec (940 bytes)
//
// 6 xrefs:
// > SetupSequenceTriggerPopup::init @ 0xa594f8
// > SetupSequenceTriggerPopup::onAddChance @ 0xa59d0c
// > SetupSequenceTriggerPopup::onChangeOrder @ 0xa59de4
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0xa59e28
// > SetupSequenceTriggerPopup::onDeleteSelected @ 0xa59e48
// > ??> @ 0x5c430
//
// 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 SetupSequenceTriggerPopup::updateGroupIDButtons(SetupSequenceTriggerPopup *a1)
{
CCMenuItemSpriteExtra *m_selectedButton; // x0
int v3; // w0
int v4; // w25
unsigned int i; // w19
unsigned int v6; // w1
__int64 v7; // x0
bool v8; // cf
cocos2d::CCArray *m_groupButtons; // x0
EffectGameObject *m_gameObject; // x28
float v11; // s8
int v12; // w26
float v13; // s9
float v14; // s10
cocos2d::CCDirector *v15; // x0
cocos2d::CCMenu *m_buttonMenu; // x19
EffectGameObject_vtbl *v17; // x19
unsigned __int64 j; // x21
char *v19; // x2
cocos2d::CCString *v20; // x0
size_t v21; // x0
const char *v22; // x6
const char *v23; // x5
cocos2d::CCNode *v24; // x0
CCMenuItemSpriteExtra *v25; // x19
ButtonSprite *v26; // x1
cocos2d::CCPoint *p_m_textOffset; // x0
unsigned int *p_m_caption; // x1
int m_data; // w2
double v30; // d0
double v31; // d1
_BOOL4 v32; // [xsp+9Ch] [xbp+9Ch]
const char *CString; // [xsp+A0h] [xbp+A0h]
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
float v35; // [xsp+B0h] [xbp+B0h]
float v36; // [xsp+B4h] [xbp+B4h]
char v37[8]; // [xsp+B8h] [xbp+B8h] BYREF
ButtonSprite *v38; // [xsp+C0h] [xbp+C0h] BYREF
cocos2d::CCPoint v39; // [xsp+C8h] [xbp+C8h] BYREF
cocos2d::CCPoint v40; // [xsp+D0h] [xbp+D0h] BYREF
cocos2d::CCPoint v41; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v42; // 0:x2.16
m_selectedButton = a1->m_selectedButton;
if ( m_selectedButton )
{
v3 = m_selectedButton->getTag(m_selectedButton);
a1->m_selectedButton = nullptr;
v4 = v3;
}
else
{
v4 = -1;
}
for ( i = 0; ; ++i )
{
v8 = i >= (unsigned int)cocos2d::CCArray::count(a1->m_groupButtons);
m_groupButtons = a1->m_groupButtons;
if ( v8 )
break;
v6 = i;
v7 = cocos2d::CCArray::objectAtIndex(m_groupButtons, v6);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 504LL))(v7);
}
cocos2d::CCArray::removeAllObjects(m_groupButtons);
m_gameObject = a1->m_gameObject;
v32 = *(_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 > 0xAF;
if ( *(_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 > 0xAF )
{
v11 = 35.0;
v12 = 10;
v14 = 4.5;
v13 = 15.0;
}
else
{
v11 = 66.0;
v12 = 5;
v13 = 40.0;
v14 = 2.0;
}
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v40, -(float)((float)(v14 * v11) - (float)(v35 * 0.5)), (float)(v36 * 0.5) + 34.0);
v41 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v40);
*(float *)&v30 = v41.x;
*(float *)&v31 = v41.y;
v17 = 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)v17) >> 4 )
{
for ( j = 0; (int)j <= 19 && j < (__int64)(*(_QWORD *)&m_gameObject[1].m_uID - (_QWORD)v17) >> 4; ++j )
{
v19 = (char *)v17 + 16 * j;
v38 = (ButtonSprite *)&byte_124B6C8;
if ( v32 )
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i\n%i",
(const char *)*((unsigned int *)&v17->copyWithZone + 4 * j),
*((unsigned int *)v19 + 2),
v30,
v31);
else
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i-%i",
(const char *)*((unsigned int *)&v17->copyWithZone + 4 * j),
*((unsigned int *)v19 + 2),
v30,
v31);
CString = cocos2d::CCString::getCString(v20);
v21 = strlen(CString);
sub_D1798C(&v38, CString, v21);
if ( v4 == (_DWORD)j )
v23 = "GJ_button_03.png";
else
v23 = "GJ_button_04.png";
v24 = (cocos2d::CCNode *)ButtonSprite::create(
v38,
(const char *)(unsigned int)(int)v13,
0,
1,
0.35,
"bigFont.fnt",
v23,
v22,
30.0);
v42.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v42.adj = (size_t)SetupSequenceTriggerPopup::onSelect;
v25 = CCMenuItemSpriteExtra::create(v24, nullptr, v42);
v25->setTag(v25, j);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v25);
setPosition = v25->setPosition;
cocos2d::CCPoint::CCPoint(&v39, v11 * (float)((int)j % v12), floorf((float)((int)j / v12)) * -38.0);
cocos2d::CCPoint::operator+(&v40, v37, &v39);
setPosition(v25, &v40);
cocos2d::CCArray::addObject(a1->m_groupButtons, v25);
if ( v4 == (_DWORD)j )
{
a1->m_selectedButton = v25;
v26 = v38;
p_m_textOffset = &v38[-1].m_textOffset;
if ( &v38[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
LABEL_21:
if ( &pthread_create )
{
p_m_caption = (unsigned int *)&v26[-1].m_caption;
do
m_data = __ldaxr(p_m_caption);
while ( __stlxr(m_data - 1, p_m_caption) );
}
else
{
m_data = (int)v26[-1].m_caption.m_data.m_data;
LODWORD(v26[-1].m_caption.m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(p_m_textOffset);
}
}
else
{
v26 = v38;
p_m_textOffset = &v38[-1].m_textOffset;
if ( &v38[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
goto LABEL_21;
}
v17 = m_gameObject[1].EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
}
}
}