//
// GauntletSelectLayer::setupGauntlets from 0x60cad8 to 0x60ce5c (900 bytes)
//
// 2 xrefs:
// > GauntletSelectLayer::init @ 0x60d60a
// > GauntletSelectLayer::loadLevelsFinished @ 0x60d814
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:54:49 +0000
//
GameManager *__fastcall GauntletSelectLayer::setupGauntlets(GauntletSelectLayer *this)
{
cocos2d::CCArray *WinSize; // r0
GameLevelManager *v3; // r0
cocos2d::CCDictionary *v4; // r6
GameManager *result; // r0
GameLevelManager *v6; // r0
unsigned __int8 *v7; // r0
GameLevelManager *v8; // r0
GameManager *UGV; // r0
int v10; // r3
int v11; // r8
int v12; // r4
int *v13; // r7
GameManager *v14; // r0
float v15; // s14
cocos2d::CCLayer *v16; // r0
GJMapPack *v17; // r1
cocos2d::CCObject *v18; // r9
int *v19; // r11
cocos2d::CCNode *v20; // r0
const cocos2d::CCPoint *v21; // r6
float v22; // s17
int v23; // r0
cocos2d::CCObject *v24; // r0
cocos2d::CCObject *v25; // r6
int v26; // r2
unsigned int v27; // r6
const cocos2d::CCPoint *v28; // r9
float v29; // r0
unsigned int v30; // r1
float v31; // r11
const cocos2d::CCPoint *v32; // r8
unsigned int v33; // r0
cocos2d::CCDirector *v34; // r0
unsigned int v35; // r7
float v36; // s16
cocos2d::CCDirector *v37; // r0
float v38; // r0
cocos2d::CCObject *v39; // r10
cocos2d::CCMenu *v40; // r0
cocos2d::CCArray *v41; // r0
cocos2d::CCArray *v42; // [sp+8h] [bp-64h]
cocos2d::CCArray *v43; // [sp+Ch] [bp-60h]
int v44; // [sp+10h] [bp-5Ch]
cocos2d::CCObject *v45; // [sp+14h] [bp-58h]
cocos2d::CCArray *v46; // [sp+18h] [bp-54h]
int v47; // [sp+1Ch] [bp-50h]
int v48; // [sp+20h] [bp-4Ch]
int v49; // [sp+24h] [bp-48h]
void (__fastcall *v50)(const cocos2d::CCPoint *, _BYTE *); // [sp+30h] [bp-3Ch]
void (__fastcall *v51)(int *, _BYTE *); // [sp+34h] [bp-38h]
float v52[2]; // [sp+3Ch] [bp-30h] BYREF
_BYTE v53[8]; // [sp+44h] [bp-28h] BYREF
_BYTE v54[8]; // [sp+4Ch] [bp-20h] BYREF
_BYTE v55[8]; // [sp+54h] [bp-18h] BYREF
GJRewardItem *(__fastcall *v56)(GJRewardItem *, cocos2d::CCObject *); // [sp+5Ch] [bp-10h]
int v57; // [sp+60h] [bp-Ch]
cocos2d::CCDirector::sharedDirector(this);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v52);
v42 = (cocos2d::CCArray *)cocos2d::CCArray::create(WinSize);
v43 = (cocos2d::CCArray *)cocos2d::CCArray::create(v42);
v46 = (cocos2d::CCArray *)cocos2d::CCArray::create(v43);
v3 = (GameLevelManager *)cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v53,
v52[0] * 0.5,
(float)(v52[1] * 0.5) - 11.0);
v4 = *(cocos2d::CCDictionary **)(GameLevelManager::sharedState(v3) + 740);
result = (GameManager *)cocos2d::CCDictionary::count(v4);
if ( result )
{
v6 = (GameLevelManager *)GameManager::sharedState(result);
v47 = *((_DWORD *)v6 + 216);
v7 = (unsigned __int8 *)GameLevelManager::sharedState(v6);
v49 = v7[932];
v8 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)v7);
*((_BYTE *)v8 + 932) = 0;
UGV = (GameManager *)GameLevelManager::sharedState(v8);
v48 = *((_DWORD *)UGV + 161);
if ( v4 )
{
v10 = *((_DWORD *)v4 + 13);
v11 = v10 ? *(_DWORD *)(v10 + 272) : 0;
v44 = 1;
v12 = 0;
while ( v10 )
{
v13 = *(int **)(v10 + 260);
if ( v13[67] != 7
|| (v14 = (GameManager *)GameManager::sharedState(UGV),
(UGV = (GameManager *)GameManager::getUGV(v14, "19")) != nullptr) )
{
v15 = ceilf((float)v44 / 3.0);
v16 = (cocos2d::CCLayer *)cocos2d::CCArray::count(v42);
if ( (unsigned int)v16 <= (int)(float)(v15 - 1.0) )
{
v39 = (cocos2d::CCObject *)cocos2d::CCLayer::create(v16);
v40 = (cocos2d::CCMenu *)cocos2d::CCArray::addObject(v42, v39);
v18 = (cocos2d::CCObject *)cocos2d::CCMenu::create(v40);
(*(void (__fastcall **)(cocos2d::CCObject *, cocos2d::CCObject *))(*(_DWORD *)v39 + 228))(v39, v18);
v41 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(v46, v18);
v45 = (cocos2d::CCObject *)cocos2d::CCArray::create(v41);
cocos2d::CCArray::addObject(v43, v45);
}
else
{
cocos2d::CCArray::objectAtIndex(v42, (int)(float)(v15 - 1.0));
v45 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v43, (int)(float)(v15 - 1.0));
v18 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v46, (int)(float)(v15 - 1.0));
}
if ( v49 )
{
if ( v48 > 0 && v13[67] == v48 )
v12 = (int)(float)(v15 - 1.0);
}
else if ( v13[67] == v47 && v47 > 1 )
{
v12 = (int)(float)(v15 - 1.0);
}
v19 = GauntletNode::create((GauntletNode *)v13, v17);
v20 = (cocos2d::CCNode *)cocos2d::CCDictionary::setObject(
*((cocos2d::CCDictionary **)this + 90),
(cocos2d::CCObject *)v19,
v13[67]);
v21 = (const cocos2d::CCPoint *)cocos2d::CCNode::create(v20);
v50 = *(void (__fastcall **)(const cocos2d::CCPoint *, _BYTE *))(*(_DWORD *)v21 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v55, 110.0, 234.0);
v50(v21, v55);
(*(void (__fastcall **)(const cocos2d::CCPoint *, int *))(*(_DWORD *)v21 + 228))(v21, v19);
v51 = *(void (__fastcall **)(int *, _BYTE *))(*v19 + 92);
v22 = *(float *)(*(int (__fastcall **)(const cocos2d::CCPoint *))(*(_DWORD *)v21 + 164))(v21);
v23 = (*(int (__fastcall **)(const cocos2d::CCPoint *))(*(_DWORD *)v21 + 164))(v21);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54, v22 * 0.5, *(float *)(v23 + 4) * 0.5);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v55, v21);
v51(v19, v55);
v56 = GauntletSelectLayer::onPlay;
v57 = 0;
v24 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v21,
0,
(int)this,
(int)GauntletSelectLayer::onPlay,
0);
*((_DWORD *)v24 + 78) = 1065772646;
v25 = v24;
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v24 + 36))(v24, v13[67]);
(*(void (__fastcall **)(cocos2d::CCObject *, cocos2d::CCObject *))(*(_DWORD *)v18 + 228))(v18, v25);
UGV = (GameManager *)cocos2d::CCArray::addObject(v45, v25);
++v44;
}
if ( v11 )
v26 = *(_DWORD *)(v11 + 272);
else
v26 = 0;
v10 = v11;
v11 = v26;
}
}
else
{
v12 = 0;
}
v27 = 0;
while ( v27 < cocos2d::CCArray::count(v43) )
{
v28 = (const cocos2d::CCPoint *)cocos2d::CCArray::objectAtIndex(v42, v27);
v29 = COERCE_FLOAT(cocos2d::CCArray::objectAtIndex(v43, v27));
v30 = v27++;
v31 = v29;
v32 = (const cocos2d::CCPoint *)cocos2d::CCArray::objectAtIndex(v46, v30);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v54, v28);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v55, v32);
GameToolbox::alignItemsHorisontally(v31, 112.0, (int)v55, 1);
}
v33 = BoomScrollLayer::create(v42, 0, 1, nullptr, 0);
*((_DWORD *)this + 83) = v33;
*(_DWORD *)(v33 + 420) = (char *)this + 316;
v34 = (cocos2d::CCDirector *)(*(int (__fastcall **)(GauntletSelectLayer *, _DWORD))(*(_DWORD *)this + 228))(
this,
*((_DWORD *)this + 83));
v35 = *((_DWORD *)this + 83);
v36 = v52[0] * 0.5;
v37 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v34);
v38 = COERCE_FLOAT(cocos2d::CCDirector::getScreenBottom(v37));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, v36, v38 + 15.0);
result = (GameManager *)BoomScrollLayer::setPagesIndicatorPosition(v35, (int)v55);
if ( v12 > 0 )
{
if ( v12 == BoomScrollLayer::getTotalPages(*((cocos2d::CCArray ***)this + 83)) - 1 )
GauntletSelectLayer::goToPage((cocos2d::CCArray ***)this, (cocos2d::CCArray *)(v12 - 1), 1);
return (GameManager *)GauntletSelectLayer::goToPage((cocos2d::CCArray ***)this, (cocos2d::CCArray *)v12, 1);
}
}
return result;
}