//
// GauntletSelectLayer::setupGauntlets from 0xa763b8 to 0xa768c8 (1296 bytes)
//
// 3 xrefs:
// > GauntletSelectLayer::init @ 0xa773fc
// > GauntletSelectLayer::loadLevelsFinished @ 0xa77738
// > ??> @ 0xc2110
//
// 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 13:00:26 +0000
//
__int64 __fastcall GauntletSelectLayer::setupGauntlets(GauntletSelectLayer *this)
{
cocos2d::CCDirector *v2; // x0
cocos2d::CCArray *WinSize; // x0
cocos2d::CCArray *v4; // x22
cocos2d::CCArray *v5; // x21
GameLevelManager *v6; // x0
cocos2d::CCDictionary *v7; // x20
GameManager *v8; // x0
GameLevelManager *v10; // x0
GameLevelManager *v11; // x0
GameLevelManager *v12; // x0
__int64 v13; // x19
unsigned int *v14; // x25
int v15; // w27
__int64 v16; // x23
GameManager *v17; // x0
unsigned int v18; // w19
cocos2d::CCLayer *v19; // x0
__int64 v20; // x7
unsigned __int64 v21; // x1
int v22; // w0
cocos2d::CCObject *v23; // x28
cocos2d::CCNode *v24; // x0
cocos2d::CCNode *v25; // x19
float v26; // s1
__int64 v27; // x0
__int64 v28; // x2
cocos2d::CCObject *v29; // x19
__int64 v30; // x19
GameManager *v31; // x0
int v32; // w0
cocos2d::CCObject *v33; // x28
cocos2d::CCMenu *v34; // x0
cocos2d::CCArray *v35; // x0
unsigned int v36; // w19
cocos2d::CCNode *v37; // x25
__int64 v38; // x28
unsigned int v39; // w1
cocos2d::CCNode *v40; // x23
__int64 v41; // x0
cocos2d::CCDirector *v42; // x0
cocos2d::CCArray **v43; // x19
float v44; // s8
cocos2d::CCDirector *v45; // x0
float v46; // s0
int v47; // [xsp+90h] [xbp+90h]
int v48; // [xsp+94h] [xbp+94h]
__int64 v49; // [xsp+98h] [xbp+98h]
void (__fastcall *v50)(cocos2d::CCObject *, __int64 *); // [xsp+A8h] [xbp+A8h]
float v51; // [xsp+B0h] [xbp+B0h]
cocos2d::CCPoint *v52; // [xsp+C0h] [xbp+C0h]
cocos2d::CCPoint *v53; // [xsp+C0h] [xbp+C0h]
cocos2d::CCObject *v54; // [xsp+C8h] [xbp+C8h]
cocos2d::CCObject *v55; // [xsp+C8h] [xbp+C8h]
int v56; // [xsp+D0h] [xbp+D0h]
int v57; // [xsp+D4h] [xbp+D4h]
cocos2d::CCArray *v58; // [xsp+D8h] [xbp+D8h]
__int64 v59; // [xsp+E8h] [xbp+E8h] BYREF
_BYTE v60[8]; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v61; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v62; // [xsp+100h] [xbp+100h] BYREF
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(_stack_chk_guard);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize(&v59, v2);
v4 = (cocos2d::CCArray *)cocos2d::CCArray::create(WinSize);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
v58 = (cocos2d::CCArray *)cocos2d::CCArray::create(v5);
v6 = (GameLevelManager *)cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v60,
*(float *)&v59 * 0.5,
(float)(*((float *)&v59 + 1) * 0.5) + -11.0);
v7 = *(cocos2d::CCDictionary **)(GameLevelManager::sharedState(v6) + 1072);
v8 = (GameManager *)cocos2d::CCDictionary::count(v7);
if ( (_DWORD)v8 )
{
v10 = (GameLevelManager *)*(unsigned int *)(GameManager::sharedState(v8) + 1084);
v48 = (int)v10;
v11 = (GameLevelManager *)*(unsigned __int8 *)(GameLevelManager::sharedState(v10) + 1448);
v56 = (int)v11;
v12 = (GameLevelManager *)GameLevelManager::sharedState(v11);
*((_BYTE *)v12 + 1448) = 0;
v47 = *(_DWORD *)(GameLevelManager::sharedState(v12) + 908);
if ( v7 && (v13 = *((_QWORD *)v7 + 7)) != 0 )
{
v14 = *(unsigned int **)(v13 + 264);
v15 = 1;
v57 = 0;
v16 = *(_QWORD *)(v13 + 288);
v17 = (GameManager *)v14[82];
if ( (_DWORD)v17 == 7 )
goto LABEL_16;
LABEL_6:
v18 = (int)(float)(ceilf((float)v15 / 3.0) - 1.0);
v19 = (cocos2d::CCLayer *)cocos2d::CCArray::count(v4);
if ( (unsigned int)v19 <= v18 )
{
v33 = (cocos2d::CCObject *)cocos2d::CCLayer::create(v19);
v34 = (cocos2d::CCMenu *)cocos2d::CCArray::addObject(v4, v33);
v55 = (cocos2d::CCObject *)cocos2d::CCMenu::create(v34);
(*(void (__fastcall **)(cocos2d::CCObject *, cocos2d::CCObject *))(*(_QWORD *)v33 + 456LL))(v33, v55);
v53 = v55;
v35 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(v58, v55);
v54 = (cocos2d::CCObject *)cocos2d::CCArray::create(v35);
cocos2d::CCArray::addObject(v5, v54);
v20 = (__int64)v53;
}
else
{
cocos2d::CCArray::objectAtIndex(v4, v18);
v54 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v5, v18);
v20 = cocos2d::CCArray::objectAtIndex(v58, v18);
}
if ( v56 )
{
v21 = (unsigned int)v47;
if ( v47 > 0 )
{
v22 = v57;
if ( v47 == v14[82] )
v22 = v18;
v57 = v22;
}
}
else
{
v21 = (unsigned int)v48;
if ( v48 == v14[82] )
{
v32 = v57;
if ( v48 > 1 )
v32 = v18;
v57 = v32;
}
}
v49 = v20;
++v15;
v23 = (cocos2d::CCObject *)GauntletNode::create((GauntletNode *)v14, (GJMapPack *)v21);
v24 = (cocos2d::CCNode *)cocos2d::CCDictionary::setObject(
*((cocos2d::CCDictionary **)this + 62),
v23,
(int)v14[82]);
v25 = (cocos2d::CCNode *)cocos2d::CCNode::create(v24);
v52 = *(cocos2d::CCPoint **)(*(_QWORD *)v25 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v62, 110.0, 234.0);
((void (__fastcall *)(cocos2d::CCNode *, __int64 *))v52)(v25, &v62);
(*(void (__fastcall **)(cocos2d::CCNode *, cocos2d::CCObject *))(*(_QWORD *)v25 + 456LL))(v25, v23);
v50 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v23 + 184LL);
v51 = *(float *)(*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v25 + 328LL))(v25) * 0.5;
v26 = *(float *)((*(__int64 (__fastcall **)(cocos2d::CCNode *))(*(_QWORD *)v25 + 328LL))(v25) + 4);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v61, v51, v26 * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v62, v25, (const cocos2d::CCPoint *)&v61);
v50(v23, &v62);
v27 = CCMenuItemSpriteExtra::create((__int64)v25, 0, (__int64)this, (__int64)GauntletSelectLayer::onPlay, 0);
v28 = *(_QWORD *)v27;
*(_DWORD *)(v27 + 400) = 1065772646;
v29 = (cocos2d::CCObject *)v27;
(*(void (__fastcall **)(__int64, _QWORD))(v28 + 72))(v27, v14[82]);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v49 + 456LL))(v49, v29);
cocos2d::CCArray::addObject(v54, v29);
while ( v16 )
{
v30 = v16;
v16 = *(_QWORD *)(v16 + 288);
v14 = *(unsigned int **)(v30 + 264);
v17 = (GameManager *)v14[82];
if ( (_DWORD)v17 != 7 )
goto LABEL_6;
LABEL_16:
v31 = (GameManager *)GameManager::sharedState(v17);
if ( (unsigned __int8)GameManager::getUGV(v31, "19") )
goto LABEL_6;
}
}
else
{
v57 = 0;
}
v36 = 0;
while ( v36 < (unsigned int)cocos2d::CCArray::count(v5) )
{
v37 = (cocos2d::CCNode *)cocos2d::CCArray::objectAtIndex(v4, v36);
v38 = cocos2d::CCArray::objectAtIndex(v5, v36);
v39 = v36++;
v40 = (cocos2d::CCNode *)cocos2d::CCArray::objectAtIndex(v58, v39);
cocos2d::CCNode::convertToWorldSpace(&v61, v37, (const cocos2d::CCPoint *)v60);
cocos2d::CCNode::convertToNodeSpace(&v62, v40, (const cocos2d::CCPoint *)&v61);
GameToolbox::alignItemsHorisontally(v38, (__int64)&v62, 1u, 112.0);
}
v41 = BoomScrollLayer::create(v4, 0, 1u, nullptr, 0);
*((_QWORD *)this + 55) = v41;
*(_QWORD *)(v41 + 544) = (char *)this + 408;
v42 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(GauntletSelectLayer *, _QWORD))(*(_QWORD *)this + 456LL))(
this,
*((_QWORD *)this + 55));
v43 = *((cocos2d::CCArray ***)this + 55);
v44 = *(float *)&v59 * 0.5;
v45 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v42);
cocos2d::CCDirector::getScreenBottom(v45);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v44, v46 + 15.0);
BoomScrollLayer::setPagesIndicatorPosition(v43, (__int64)&v62);
if ( v57 > 0 )
{
if ( v57 == (unsigned int)BoomScrollLayer::getTotalPages(*((cocos2d::CCArray ***)this + 55)) - 1 )
GauntletSelectLayer::goToPage((cocos2d::CCArray ***)this, v57 - 1, 1u);
GauntletSelectLayer::goToPage((cocos2d::CCArray ***)this, v57, 1u);
}
}
return _stack_chk_guard;
}