//
// GauntletSelectLayer::setupGauntlets from 0x100254d40 to 0x1002551cc (1164 bytes)
//
// 2 xrefs:
// > GauntletSelectLayer::init @ 0x100254ab8
// > GauntletSelectLayer::loadLevelsFinished @ 0x100255254
//
// 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 11:01:33 +0000
//
__int64 __fastcall GauntletSelectLayer::setupGauntlets(__int64 *a1)
{
__int64 v2; // x0
__int64 v3; // x0
__int64 v4; // x20
__int64 v5; // x22
__int64 v6; // x23
__int64 v7; // x21
__int64 result; // x0
__int64 UGV; // x0
__int64 v10; // x21
int v11; // w19
__int64 v12; // x26
__int64 v13; // x0
__int64 v14; // x24
__int64 v15; // x28
__int64 v16; // x27
__n128 v17; // q0
void *v18; // x25
__int64 v19; // x0
__int64 v20; // x0
int v21; // w8
__int64 v23; // x24
__int64 v24; // x0
__int64 v25; // x25
float v26; // s8
__int64 v27; // x0
__n128 v28; // q0
_DWORD *v29; // x24
__int64 v30; // x24
__int64 v31; // x25
__int64 v32; // x26
__int64 v33; // x27
__n128 v34; // q0
_QWORD *v35; // x0
__int64 v36; // x20
float v37; // s8
__int64 v38; // x0
float v39; // s0
int v40; // [xsp+8h] [xbp-B8h]
int v41; // [xsp+Ch] [xbp-B4h]
__int64 v42; // [xsp+10h] [xbp-B0h]
int v43; // [xsp+1Ch] [xbp-A4h]
__int64 *v44; // [xsp+20h] [xbp-A0h]
int v45; // [xsp+2Ch] [xbp-94h]
__int64 v46; // [xsp+30h] [xbp-90h] BYREF
float32x2_t v47; // [xsp+38h] [xbp-88h] BYREF
float v48; // [xsp+40h] [xbp-80h] BYREF
__int64 v49; // [xsp+48h] [xbp-78h] BYREF
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v2, &v49);
v4 = sub_1002E736C(v3);
v5 = sub_1002E736C(v4);
v6 = sub_1002E736C(v5);
sub_1000262BC(&v48, *(float *)&v49 * 0.5, (float)(*((float *)&v49 + 1) * 0.5) + -11.0);
v7 = *(_QWORD *)(GameLevelManager::sharedState() + 1072);
result = cocos2d::CCDictionary::count(v7);
if ( (_DWORD)result )
{
v41 = *(_DWORD *)(GameManager::sharedState(result) + 1084);
v43 = *(unsigned __int8 *)(GameLevelManager::sharedState() + 1448);
*(_BYTE *)(GameLevelManager::sharedState() + 1448) = 0;
UGV = GameLevelManager::sharedState();
v44 = a1;
if ( v7 )
{
v10 = *(_QWORD *)(v7 + 56);
if ( v10 )
{
v45 = 0;
v40 = *(_DWORD *)(UGV + 908);
v11 = 1;
v42 = v6;
while ( 1 )
{
v12 = *(_QWORD *)(v10 + 264);
v10 = *(_QWORD *)(v10 + 288);
if ( *(_DWORD *)(v12 + 328) == 7 )
{
v13 = GameManager::sharedState(UGV);
UGV = GameManager::getUGV(v13, "19");
if ( !(_DWORD)UGV )
goto LABEL_23;
}
v14 = (unsigned int)(int)(float)(ceilf((float)v11 / 3.0) + -1.0);
if ( (unsigned int)sub_1002E757C(v4) <= (unsigned int)v14 )
{
v18 = cocos2d::CCLayer::create();
sub_1002E74E0(v4, v18);
v16 = cocos2d::CCMenu::create(v19);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v18 + 456LL))(v18, v16);
sub_1002E74E0(v6, v16);
v15 = sub_1002E736C(v20);
v17 = sub_1002E74E0(v5, v15);
}
else
{
sub_1002E75A0(v4, v14);
v15 = sub_1002E75A0(v5, v14);
v16 = sub_1002E75A0(v6, v14);
}
if ( !v43 )
break;
if ( v40 >= 1 )
{
if ( *(_DWORD *)(v12 + 328) == v40 )
v21 = v14;
else
v21 = v45;
LABEL_21:
v45 = v21;
}
v23 = GauntletNode::create(v12, v17);
cocos2d::CCDictionary::setObject_1(v44[62], v23, *(int *)(v12 + 328));
v25 = cocos2d::CCNode::create(v24);
sub_1000262C4((float *)&v47, 110.0, 234.0);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v25 + 320LL))(v25, &v47);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v25 + 456LL))(v25, v23);
v26 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 328LL))(v25) * 0.5;
v27 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v25 + 328LL))(v25);
sub_1000262BC((float *)&v46, v26, *(float *)(v27 + 4) * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v47, v25, &v46, v28);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v23 + 184LL))(v23, &v47);
v29 = (_DWORD *)CCMenuItemSpriteExtra::create(v25, 0, v44, GauntletSelectLayer::onPlay, 0);
v29[100] = 1065772646;
(*(void (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)v29 + 72LL))(v29, *(unsigned int *)(v12 + 328));
(*(void (__fastcall **)(__int64, _DWORD *))(*(_QWORD *)v16 + 456LL))(v16, v29);
sub_1002E74E0(v15, v29);
++v11;
v6 = v42;
LABEL_23:
if ( !v10 )
goto LABEL_26;
}
if ( *(_DWORD *)(v12 + 328) != v41 || v41 <= 1 )
v21 = v45;
else
v21 = v14;
goto LABEL_21;
}
}
v45 = 0;
LABEL_26:
if ( (unsigned int)sub_1002E757C(v5) )
{
v30 = 0;
do
{
v31 = sub_1002E75A0(v4, v30);
v32 = sub_1002E75A0(v5, v30);
v33 = sub_1002E75A0(v6, v30);
cocos2d::CCNode::convertToWorldSpace(&v46, v31, &v48);
cocos2d::CCNode::convertToNodeSpace(&v47, v33, &v46, v34);
GameToolbox::alignItemsHorisontally(v32, &v47, 1, 112.0);
v30 = (unsigned int)(v30 + 1);
}
while ( (unsigned int)v30 < (unsigned int)sub_1002E757C(v5) );
}
v35 = BoomScrollLayer::create(v4, 0, 1, 0, 0);
v44[55] = (__int64)v35;
v35[68] = v44 + 51;
(*(void (__fastcall **)(__int64 *, _QWORD *))(*v44 + 456))(v44, v35);
v36 = v44[55];
v37 = *(float *)&v49 * 0.5;
v38 = cocos2d::CCDirector::sharedDirector();
v39 = sub_100207EA0(v38);
sub_1000262BC((float *)&v47, v37, v39 + 15.0);
result = BoomScrollLayer::setPagesIndicatorPosition(v36, (double *)&v47);
if ( v45 > 0 )
{
if ( v45 == (unsigned int)BoomScrollLayer::getTotalPages(v44[55]) - 1 )
sub_100255900(v44, (unsigned int)(v45 - 1), 1);
return sub_100255900(v44, (unsigned int)v45, 1);
}
}
return result;
}