//
// GauntletLayer::init from 0x60ecd4 to 0x60f19e (1226 bytes)
//
// 1 xrefs:
// > GauntletLayer::create @ 0x60f230
//
// 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:50 +0000
//
int __fastcall GauntletLayer::init(int a1, int a2)
{
int v4; // r9
int v5; // r3
cocos2d::CCDirector *v6; // r0
GameManager *v7; // r5
GameManager *v8; // r0
cocos2d::CCSprite *BGTexture; // r0
const char *v10; // r1
int v11; // r0
int v12; // r0
int v13; // r7
int (__fastcall *v14)(int, _DWORD *); // r8
AppDelegate *v15; // r0
int v16; // r7
void (__fastcall *v17)(int, int); // r8
AppDelegate *v18; // r0
int v19; // r0
int v20; // r0
void (__fastcall *v21)(int, _DWORD *); // r2
int v22; // r7
void (__fastcall *v23)(int, _DWORD *); // r8
int v24; // r3
unsigned int v25; // r1
int v26; // r6
cocos2d::CCLabelBMFont *v27; // r7
const char *v28; // r2
cocos2d::CCLabelBMFont *v29; // r0
int v30; // r6
void (__fastcall *v31)(int, _DWORD *); // r7
void (__fastcall *v32)(int, _DWORD *); // r2
cocos2d::CCLabelBMFont *v33; // r0
int v34; // r7
void (__fastcall *v35)(int, _DWORD *); // r10
int v36; // r11
const char *v37; // r1
int v38; // r0
cocos2d::CCMenu *v39; // r7
int v40; // r5
cocos2d::CCDirector *v41; // r0
int (__fastcall *v42)(int, _BYTE *); // r10
cocos2d::CCDirector *v43; // r0
float v44; // r0
float v45; // s17
cocos2d::CCDirector *v46; // r0
float v47; // r0
PlatformToolbox *v48; // r0
LoadingCircle *isControllerConnected; // r0
cocos2d::CCMenuItem *v50; // r2
cocos2d::CCLayerColor *v51; // r0
int v52; // r0
void (__fastcall *v53)(int, _BYTE *); // r2
int v54; // r5
void (__fastcall *v55)(int, _BYTE *); // r7
GameLevelManager *v56; // r0
int v57; // r0
GameLevelManager *GauntletSearchKey; // r0
GameLevelManager *v59; // r0
char *v60; // r1
_BOOL4 StoredOnlineLevels; // r1
GameLevelManager *v62; // r0
GameLevelManager *v63; // r0
GameLevelManager *v64; // r0
float v66; // [sp+18h] [bp-54h] BYREF
float v67; // [sp+1Ch] [bp-50h]
_BYTE v68[8]; // [sp+20h] [bp-4Ch] BYREF
_DWORD v69[2]; // [sp+28h] [bp-44h] BYREF
int v70; // [sp+30h] [bp-3Ch] BYREF
int v71; // [sp+34h] [bp-38h]
cocos2d::CCLabelBMFont *v72; // [sp+38h] [bp-34h]
int v73[3]; // [sp+3Ch] [bp-30h] BYREF
char v74; // [sp+48h] [bp-24h] BYREF
char v75; // [sp+49h] [bp-23h] BYREF
char *v76; // [sp+50h] [bp-1Ch]
_DWORD v77[4]; // [sp+54h] [bp-18h] BYREF
v4 = cocos2d::CCLayer::init((cocos2d::CCLayer *)a1);
if ( v4 )
{
v5 = *(_DWORD *)a1;
*(_DWORD *)(a1 + 328) = a2;
(*(void (__fastcall **)(int, int))(v5 + 536))(a1, 1);
v6 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int))(*(_DWORD *)a1 + 544))(a1, 1);
cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v66);
v7 = (GameManager *)bgForGauntlet(*(_DWORD *)(a1 + 328));
v8 = (GameManager *)GameManager::sharedState(v7);
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v8, (const char *)v7);
v11 = cocos2d::CCSprite::create(BGTexture, v10);
*(_DWORD *)(a1 + 332) = v11;
v77[0] = 9729;
v77[1] = 9729;
v77[2] = 10497;
v77[3] = 10497;
v12 = (*(int (__fastcall **)(int))(*(_DWORD *)v11 + 536))(v11);
cocos2d::CCTexture2D::setTexParameters(v12, v77);
(*(void (__fastcall **)(int, _DWORD, int))(*(_DWORD *)a1 + 232))(a1, *(_DWORD *)(a1 + 332), -1);
v13 = *(_DWORD *)(a1 + 332);
v14 = *(int (__fastcall **)(int, _DWORD *))(*(_DWORD *)v13 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, 0.0, 0.0);
v15 = (AppDelegate *)v14(v13, v69);
v16 = *(_DWORD *)(a1 + 332);
v17 = *(void (__fastcall **)(int, int))(*(_DWORD *)v16 + 80);
v18 = (AppDelegate *)AppDelegate::get(v15);
v19 = AppDelegate::bgScale(v18);
v17(v16, v19);
v20 = *(_DWORD *)(a1 + 332);
v21 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v20 + 480);
memset(v69, 76, 3);
v21(v20, v69);
v22 = *(_DWORD *)(a1 + 332);
v23 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v22 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, 0.0, -20.0);
v23(v22, v69);
GauntletNode::nameForType(&v70, a2);
if ( (v70 & 1) != 0 )
{
v24 = v71;
v25 = (v70 & 0xFFFFFFFE) - 1;
}
else
{
v24 = (int)(unsigned __int8)v70 >> 1;
v25 = 10;
}
v26 = v24 + 9;
if ( v25 - v24 <= 8 )
{
std::string::__grow_by_and_replace((int)&v70, v25, v26 - v25, v24, v24, 0, 9u, " Gauntlet");
}
else
{
if ( (v70 & 1) != 0 )
v27 = v72;
else
v27 = (cocos2d::CCLabelBMFont *)((char *)&v70 + 1);
std::char_traits::copy((char *)v27 + v24, " Gauntlet", 9u);
if ( (v70 & 1) != 0 )
v71 = v26;
else
LOBYTE(v70) = 2 * v26;
*((_BYTE *)v27 + v26) = 0;
}
if ( (v70 & 1) != 0 )
v29 = v72;
else
v29 = (cocos2d::CCLabelBMFont *)((char *)&v70 + 1);
v30 = cocos2d::CCLabelBMFont::create(v29, "goldFont.fnt", v28);
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)a1 + 232))(a1, v30, 2);
v31 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v30 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v69, v66 * 0.5, v67 - 22.0);
v31(v30, v69);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v30 + 80))(v30, 1065353216);
v32 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v30 + 536);
LOWORD(v69[0]) = -1;
BYTE2(v69[0]) = 0;
v32(v30, v69);
if ( (v70 & 1) != 0 )
v33 = v72;
else
v33 = (cocos2d::CCLabelBMFont *)((char *)&v70 + 1);
v34 = cocos2d::CCLabelBMFont::create(v33, "goldFont.fnt", (const char *)((unsigned __int8)v70 << 31));
(*(void (__fastcall **)(int, int, _DWORD))(*(_DWORD *)a1 + 232))(a1, v34, 0);
v35 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v34 + 92);
v36 = (*(int (__fastcall **)(int))(*(_DWORD *)v30 + 96))(v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 2.0, -4.0);
cocos2d::CCPoint::operator+(v69, v36, v68);
v35(v34, v69);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v34 + 80))(v34, 1065353216);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v34 + 536))(v34, &unk_BEEA78);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v34 + 512))(v34, 100);
v38 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v37);
v69[1] = 0;
v69[0] = GauntletLayer::onBack;
v39 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v38, 0, a1, (int)GauntletLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v39, 1.6);
v40 = cocos2d::CCMenu::create(v39, nullptr);
v41 = (cocos2d::CCDirector *)(*(int (__fastcall **)(int, int, int))(*(_DWORD *)a1 + 232))(a1, v40, 2);
v42 = *(int (__fastcall **)(int, _BYTE *))(*(_DWORD *)v40 + 92);
v43 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v41);
v44 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v43));
v45 = v44 + 25.0;
v46 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v44));
v47 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v46));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, v45, v47 - 22.0);
v48 = (PlatformToolbox *)v42(v40, v68);
isControllerConnected = (LoadingCircle *)PlatformToolbox::isControllerConnected(v48);
if ( isControllerConnected )
isControllerConnected = (LoadingCircle *)GameToolbox::addBackButton((GameToolbox *)a1, v39, v50);
v51 = LoadingCircle::create(isControllerConnected);
*(_DWORD *)(a1 + 324) = v51;
*((_DWORD *)v51 + 111) = a1;
*(_BYTE *)(*(_DWORD *)(a1 + 324) + 448) = 0;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 324));
LoadingCircle::show(*(cocos2d::CCNode ***)(a1 + 324));
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 324) + 172))(*(_DWORD *)(a1 + 324), 0);
v52 = *(_DWORD *)(*(_DWORD *)(a1 + 324) + 440);
v53 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v52 + 480);
memset(v68, 100, 3);
v53(v52, v68);
memset(v73, 0, sizeof(v73));
std::string::__init(v73, "Something went wrong\nplease try again later", 0x2Bu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 0.5, 1.0);
*(_DWORD *)(a1 + 348) = TextArea::create(
(int)v73,
"bigFont.fnt",
1065353216,
1142292480,
(const cocos2d::CCPoint *)v68,
1101004800,
0,
0);
std::string::~string((int)v73);
v54 = *(_DWORD *)(a1 + 348);
v55 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v54 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, v66 * 0.5, (float)(v67 * 0.5) + 10.0);
v55(v54, v68);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 348) + 80))(*(_DWORD *)(a1 + 348), 1058642330);
(*(void (__fastcall **)(int, _DWORD, int))(*(_DWORD *)a1 + 232))(a1, *(_DWORD *)(a1 + 348), 10);
v56 = (GameLevelManager *)(*(int (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(a1 + 348) + 172))(
*(_DWORD *)(a1 + 348),
0);
v57 = GameLevelManager::sharedState(v56);
GauntletSearchKey = GameLevelManager::getGauntletSearchKey(
(GameLevelManager *)&v74,
v57,
*(const char **)(a1 + 328));
v59 = (GameLevelManager *)GameLevelManager::sharedState(GauntletSearchKey);
if ( (v74 & 1) != 0 )
v60 = v76;
else
v60 = &v75;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v59, v60);
if ( StoredOnlineLevels )
{
GauntletLayer::setupGauntlet(a1, (cocos2d::CCArray *)StoredOnlineLevels);
}
else
{
v62 = (GameLevelManager *)(*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 324) + 172))(
*(_DWORD *)(a1 + 324),
1);
v63 = (GameLevelManager *)GameLevelManager::sharedState(v62);
*((_DWORD *)v63 + 205) = a1 + 316;
v64 = (GameLevelManager *)GameLevelManager::sharedState(v63);
GameLevelManager::getGauntletLevels(v64, *(const char **)(a1 + 328));
}
std::string::~string((int)&v74);
std::string::~string((int)&v70);
}
return v4;
}