//
// SetupSpawnPopup::updateRemapButtons from 0xa43014 to 0xa4362c (1560 bytes)
//
// 5 xrefs:
// > SetupSpawnPopup::init @ 0xa43e70
// > ??> @ 0xbedf8
// > SetupSpawnPopup::queueUpdateButtons @ 0xa42b88
// > SetupSpawnPopup::updateRemapButtons @ 0xa4304c
// > ??> @ 0x15458e8
//
// This function is hookable on this platform (idp: arm, 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 12:59:57 +0000
//
__int64 __fastcall SetupSpawnPopup::updateRemapButtons(cocos2d::CCNode **this, float a2)
{
unsigned int v3; // w19
unsigned int v4; // w1
cocos2d::CCObject *v5; // x20
cocos2d::CCObject *v6; // x2
cocos2d::CCObject *v7; // x1
cocos2d::CCNode *v8; // x0
cocos2d::CCArray *v9; // x0
cocos2d::CCDirector *v10; // x0
unsigned int *v11; // x1
int *v12; // x20
int *i; // x25
int v14; // w2
int v15; // w3
_QWORD **v16; // x0
int v17; // w1
int v18; // w1
__int64 v19; // x0
float v20; // s9
int v21; // w22
float v22; // s8
float v23; // s10
cocos2d::CCDirector *v24; // x0
cocos2d::CCNode *v25; // x19
int v26; // w0
__int64 *v27; // x19
unsigned int v28; // w26
_QWORD *v29; // x25
signed int v30; // w23
unsigned int v31; // w27
int v32; // w0
char *v33; // x1
cocos2d::CCString *v34; // x0
ButtonSprite *CString; // x0
const char *v36; // x6
const char *v37; // x5
__int64 v38; // x0
cocos2d::CCObject *v39; // x26
void (__fastcall *v40)(cocos2d::CCObject *, __int64 **); // x27
cocos2d::CCNode *v41; // x1
__int64 *v42; // x0
__int64 *v43; // x0
__int64 *v44; // x0
void *v45; // x19
cocos2d::CCDirector *v47; // [xsp+80h] [xbp+80h]
cocos2d::CCArray *v48; // [xsp+88h] [xbp+88h]
int v49; // [xsp+88h] [xbp+88h]
cocos2d::CCPoint *v50; // [xsp+90h] [xbp+90h]
__int64 v52; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v53; // [xsp+C0h] [xbp+C0h] BYREF
__int64 *v54; // [xsp+C8h] [xbp+C8h] BYREF
__int64 *v55; // [xsp+D0h] [xbp+D0h] BYREF
__int64 *v56; // [xsp+D8h] [xbp+D8h] BYREF
_QWORD **v57; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCDirector *v58; // [xsp+E8h] [xbp+E8h]
__int64 v59[2]; // [xsp+F0h] [xbp+F0h] BYREF
void *v60; // [xsp+100h] [xbp+100h]
v3 = 0;
cocos2d::CCNode::unschedule(this, SetupSpawnPopup::updateRemapButtons, 0);
*((_BYTE *)this + 1012) = 0;
while ( v3 < (unsigned int)cocos2d::CCArray::count(*(this + 127)) )
{
v4 = v3++;
v5 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(*(this + 127), v4);
SetupTriggerPopup::removeObjectFromPage((SetupTriggerPopup *)this, v5, 1);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v5 + 520LL))(v5);
}
cocos2d::CCArray::removeAllObjects(*(this + 127));
v6 = *(this + 128);
v7 = *(this + 129);
if ( v6 != v7 )
{
v8 = (cocos2d::CCObject *)((char *)v7 + 8 * ~((unsigned __int64)((cocos2d::CCObject *)((char *)v7 - 8) - v6) >> 3));
v7 = (cocos2d::CCObject *)this;
*(this + 129) = v8;
}
v9 = *(this + 85);
if ( v9 )
v48 = (cocos2d::CCArray *)cocos2d::CCArray::createWithObject(v9, v7);
else
v48 = *(this + 86);
v57 = nullptr;
v56 = (__int64 *)&v57;
v10 = v48;
v58 = nullptr;
if ( v48
&& (v11 = *((unsigned int **)v48 + 7), v10 = (cocos2d::CCDirector *)*v11, (_DWORD)v10)
&& (v50 = *((cocos2d::CCPoint **)v11 + 2),
v10 = (cocos2d::CCPoint *)((char *)v50 + 8 * (unsigned int)v10 - 8),
v47 = v10,
v50 <= v10)
&& (v10 = *(cocos2d::CCDirector **)v50) != nullptr )
{
do
{
v12 = *((int **)v10 + 230);
for ( i = *((int **)v10 + 231); i != v12; v12 += 4 )
{
v14 = *v12;
v15 = v12[2];
v16 = v57;
LODWORD(v53) = *v12;
HIDWORD(v53) = v15;
while ( v16 )
{
while ( 1 )
{
v17 = *((_DWORD *)v16 + 7);
if ( v14 >= v17 )
{
if ( v14 > v17 )
goto LABEL_49;
v18 = *((_DWORD *)v16 + 8);
if ( v15 >= v18 )
break;
}
v16 = (_QWORD **)*v16;
if ( !v16 )
goto LABEL_48;
}
if ( v15 <= v18 )
{
v55 = &v53;
v19 = std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::__emplace_unique_key_args,std::piecewise_construct_t const&,std::tuple const&>,std::tuple<>>(
&v56,
(int *)&v53,
(__int64)&unk_1170A00,
&v55);
++*(_DWORD *)(v19 + 36);
goto LABEL_20;
}
LABEL_49:
v16 = (_QWORD **)v16[1];
}
LABEL_48:
v54 = &v53;
*(_DWORD *)(std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::__emplace_unique_key_args,std::piecewise_construct_t const&,std::tuple const&>,std::tuple<>>(
&v56,
(int *)&v53,
(__int64)&unk_1170A00,
&v54)
+ 36) = 1;
LABEL_20:
;
}
v50 = (cocos2d::CCPoint *)((char *)v50 + 8);
if ( v47 < v50 )
break;
v10 = *(cocos2d::CCDirector **)v50;
}
while ( *(_QWORD *)v50 );
v10 = v58;
if ( (unsigned __int64)v58 <= 0xA )
{
v20 = 66.0;
v21 = 5;
v23 = 40.0;
v22 = 2.0;
}
else
{
v20 = 35.0;
v21 = 10;
v22 = 4.5;
v23 = 15.0;
}
}
else
{
v20 = 66.0;
v21 = 5;
v22 = 2.0;
v23 = 40.0;
}
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(&v52, v24);
v25 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v55,
-(float)((float)(v22 * v20) - (float)(*(float *)&v52 * 0.5)),
(float)((float)(*((float *)&v52 + 1) * 0.5) + 45.0) - 25.0);
cocos2d::CCNode::convertToNodeSpace(&v53, v25, (const cocos2d::CCPoint *)&v55);
v26 = cocos2d::CCArray::count(v48);
v27 = v56;
v49 = v26;
if ( v56 != (__int64 *)&v57 )
{
v28 = *((_DWORD *)v56 + 7);
v29 = (__int64 *)((char *)v56 + 28);
v30 = 0;
v31 = *((_DWORD *)v56 + 8);
v32 = *((_DWORD *)v56 + 9);
if ( *((_DWORD *)this + 262) == v28 )
goto LABEL_42;
LABEL_27:
if ( v49 == v32 )
v33 = "GJ_button_04.png";
else
v33 = "GJ_button_05.png";
while ( 1 )
{
v59[0] = 0;
v59[1] = 0;
v60 = nullptr;
std::string::__init(v59, v33, 0x10u);
v34 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i\n%i",
(const char *)v28,
v31);
CString = (ButtonSprite *)cocos2d::CCString::getCString(v34);
v37 = (char *)v59 + 1;
if ( (v59[0] & 1) != 0 )
v37 = (const char *)v60;
v38 = ButtonSprite::create(
CString,
(const char *)(unsigned int)(int)v23,
0,
1,
0.35,
"bigFont.fnt",
v37,
v36,
30.0);
v39 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v38,
0,
(__int64)this,
(__int64)SetupSpawnPopup::onSelectRemap,
0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v39 + 72LL))(v39, (unsigned int)v30);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v39);
SetupTriggerPopup::addObjectToPage((SetupTriggerPopup *)this, v39, 1);
v40 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 **))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, v20 * (float)(v30 % v21), floorf((float)(v30 / v21)) * -38.0);
cocos2d::CCPoint::operator+(&v55, &v53);
v40(v39, &v55);
cocos2d::CCArray::addObject(*(this + 127), v39);
v41 = *(this + 129);
if ( v41 == *(this + 130) )
{
std::vector>::__push_back_slow_path const&>(this + 128, v29);
}
else
{
if ( v41 )
{
*(_QWORD *)v41 = *(__int64 *)((char *)v27 + 28);
v41 = *(this + 129);
}
*(this + 129) = (cocos2d::CCNode *)((char *)v41 + 8);
}
if ( ++v30 == 20 )
break;
if ( (v59[0] & 1) != 0 )
operator delete(v60);
v42 = (__int64 *)v27[1];
if ( v42 )
{
do
{
v27 = v42;
v42 = (__int64 *)*v42;
}
while ( v42 );
}
else
{
do
{
v43 = v27;
v27 = (__int64 *)v27[2];
if ( v43 == (__int64 *)*v27 )
break;
v44 = v27;
v27 = (__int64 *)v27[2];
}
while ( v44 != (__int64 *)*v27 );
}
if ( v27 == (__int64 *)&v57 )
goto LABEL_54;
v29 = (__int64 *)((char *)v27 + 28);
v28 = *((_DWORD *)v27 + 7);
v31 = *((_DWORD *)v27 + 8);
v32 = *((_DWORD *)v27 + 9);
if ( *((_DWORD *)this + 262) != v28 )
goto LABEL_27;
LABEL_42:
if ( *((_DWORD *)this + 263) != v31 )
goto LABEL_27;
v33 = "GJ_button_03.png";
}
if ( (v59[0] & 1) != 0 )
operator delete(v60);
}
LABEL_54:
v45 = v57;
if ( v57 )
{
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)&v56,
*v57);
std::__tree,int>,std::__map_value_compare,std::__value_type,int>,std::less>,true>,std::allocator,int>>>::destroy(
(__int64)&v56,
*(_QWORD **)&byte_8[(_QWORD)v45]);
operator delete(v45);
}
return _stack_chk_guard;
}