//
// GauntletLayer::init from 0xa79580 to 0xa79c48 (1736 bytes)
//
// 2 xrefs:
// > GauntletLayer::create @ 0xa79ce8
// > ??> @ 0x7d650
//
// 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:28 +0000
//
__int64 __fastcall GauntletLayer::init(__int64 a1, int a2)
{
unsigned __int8 v4; // w0
unsigned int v5; // w24
__int64 v7; // x2
cocos2d::CCDirector *v8; // x0
cocos2d::CCDirector *v9; // x0
GameManager *v10; // x0
GameManager *v11; // x0
cocos2d::CCSprite *BGTexture; // x0
const char *v13; // x1
__int64 v14; // x0
__int64 v15; // x0
long double v16; // q0
__int64 v17; // x25
void (__fastcall *v18)(__int64, __int64 *); // x26
AppDelegate **v19; // x25
void (__fastcall *v20)(AppDelegate **); // x26
AppDelegate *v21; // x0
__int64 v22; // x0
void (__fastcall *v23)(__int64, __int64 *); // x3
__int64 v24; // x25
void (__fastcall *v25)(__int64, __int64 *); // x26
size_t v26; // x3
unsigned __int64 v27; // x1
cocos2d::CCLabelBMFont *v28; // x2
size_t v29; // x1
cocos2d::CCLabelBMFont *v30; // x0
__int64 v31; // x23
void (__fastcall *v32)(__int64, __int64 *); // x26
void (__fastcall *v33)(__int64, __int64 *); // x3
const char *v34; // x2
cocos2d::CCLabelBMFont *v35; // x0
__int64 v36; // x22
void (__fastcall *v37)(__int64, __int64 *); // x25
__int64 v38; // x26
const char *v39; // x1
__int64 v40; // x0
cocos2d::CCMenu *v41; // x23
cocos2d::CCDirector **v42; // x22
__int64 (__fastcall *v43)(cocos2d::CCDirector **, __int64 *); // x25
cocos2d::CCDirector *v44; // x0
cocos2d::CCDirector *ScreenLeft; // x0
float v46; // s0
float v47; // s8
cocos2d::CCDirector *v48; // x0
float v49; // s0
PlatformToolbox *v50; // x0
unsigned __int64 isControllerConnected; // x0
cocos2d::CCMenuItem *v52; // x2
__int64 v53; // x0
__int64 v54; // x0
void (__fastcall *v55)(__int64, __int64 *); // x3
__int64 v56; // x22
void (__fastcall *v57)(__int64, __int64 *); // x23
GameLevelManager *v58; // x0
__int64 *GauntletSearchKey; // x0
GameLevelManager *v60; // x0
char *v61; // x1
cocos2d::CCArray *StoredOnlineLevels; // x1
GameLevelManager *v63; // x0
GameLevelManager *v64; // x0
GameLevelManager *v65; // x0
int v66; // [xsp+68h] [xbp+68h]
__int64 v67; // [xsp+78h] [xbp+78h] BYREF
_BYTE v68[8]; // [xsp+80h] [xbp+80h] BYREF
__int64 v69; // [xsp+88h] [xbp+88h] BYREF
_DWORD v70[4]; // [xsp+90h] [xbp+90h] BYREF
__int64 v71; // [xsp+A0h] [xbp+A0h] BYREF
size_t v72; // [xsp+A8h] [xbp+A8h]
cocos2d::CCLabelBMFont *v73; // [xsp+B0h] [xbp+B0h]
__int64 v74[2]; // [xsp+B8h] [xbp+B8h] BYREF
void *v75; // [xsp+C8h] [xbp+C8h]
__int64 v76[2]; // [xsp+D0h] [xbp+D0h] BYREF
char *v77; // [xsp+E0h] [xbp+E0h]
v4 = cocos2d::CCLayer::init((cocos2d::CCLayer *)a1);
v5 = v4;
if ( !v4 )
return v5;
v7 = *(_QWORD *)a1;
*(_DWORD *)(a1 + 432) = a2;
(*(void (__fastcall **)(__int64, __int64))(v7 + 1072))(a1, 1);
v8 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1);
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(&v67, v9);
v10 = (GameManager *)bgForGauntlet(*(_DWORD *)(a1 + 432));
v66 = (int)v10;
v11 = (GameManager *)GameManager::sharedState(v10);
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v11, v66);
v14 = cocos2d::CCSprite::create(BGTexture, v13);
*(_QWORD *)(a1 + 440) = v14;
v70[0] = 9729;
v70[1] = 9729;
v70[2] = 10497;
v70[3] = 10497;
v15 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 1072LL))(v14);
*(__n128 *)&v16 = cocos2d::CCTexture2D::setTexParameters(v15, v70);
(*(void (__fastcall **)(__int64, _QWORD, __int64, long double))(*(_QWORD *)a1 + 464LL))(
a1,
*(_QWORD *)(a1 + 440),
0xFFFFFFFFLL,
v16);
v17 = *(_QWORD *)(a1 + 440);
v18 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, 0.0, 0.0);
v18(v17, &v69);
v19 = *(AppDelegate ***)(a1 + 440);
v20 = *((void (__fastcall **)(AppDelegate **))*v19 + 20);
v21 = (AppDelegate *)AppDelegate::get(*v19);
AppDelegate::bgScale(v21);
v20(v19);
v22 = *(_QWORD *)(a1 + 440);
v23 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v22 + 960LL);
memset(&v69, 76, 3);
v23(v22, &v69);
v24 = *(_QWORD *)(a1 + 440);
v25 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v24 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, 0.0, -20.0);
v25(v24, &v69);
GauntletNode::nameForType(a2, &v71);
if ( (v71 & 1) != 0 )
{
v26 = v72;
v27 = (v71 & 0xFFFFFFFFFFFFFFFELL) - 1;
if ( v27 - v72 > 8 )
{
v28 = v73;
goto LABEL_5;
}
}
else
{
v26 = (unsigned __int8)v71 >> 1;
v27 = 22;
v28 = (cocos2d::CCLabelBMFont *)((char *)&v71 + 1);
if ( 22 - v26 > 8 )
{
LABEL_5:
v29 = v26 + 9;
qmemcpy((char *)v28 + v26, " Gauntlet", 9);
if ( (v71 & 1) != 0 )
v72 = v26 + 9;
else
LOBYTE(v71) = 2 * v29;
*((_BYTE *)v28 + v29) = 0;
goto LABEL_8;
}
}
std::string::__grow_by_and_replace((__int64)&v71, v27, v26 + 9 - v27, v26, v26, 0, 9u, " Gauntlet");
LABEL_8:
v30 = (cocos2d::CCLabelBMFont *)((char *)&v71 + 1);
if ( (v71 & 1) != 0 )
v30 = v73;
v31 = cocos2d::CCLabelBMFont::create(v30, "goldFont.fnt", (const char *)v28);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v31, 2);
v32 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v31 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, *(float *)&v67 * 0.5, *((float *)&v67 + 1) - 22.0);
v32(v31, &v69);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, 1.0);
v33 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v31 + 1072LL);
LOWORD(v69) = -1;
BYTE2(v69) = 0;
v33(v31, &v69);
v35 = (cocos2d::CCLabelBMFont *)((char *)&v71 + 1);
if ( (v71 & 1) != 0 )
v35 = v73;
v36 = cocos2d::CCLabelBMFont::create(v35, "goldFont.fnt", v34);
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)a1 + 464LL))(a1, v36, 0);
v37 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v36 + 184LL);
v38 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v31 + 192LL))(v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v68, 2.0, -4.0);
cocos2d::CCPoint::operator+(&v69, v38);
v37(v36, &v69);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v36 + 160LL))(v36, 1.0);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v36 + 1072LL))(v36, &unk_1175920);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v36 + 1024LL))(v36, 100);
v40 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v39);
v41 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v40, 0, a1, (__int64)GauntletLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v41, 1.6);
v42 = (cocos2d::CCDirector **)cocos2d::CCMenu::create(v41, nullptr);
(*(void (__fastcall **)(__int64, cocos2d::CCDirector **, __int64))(*(_QWORD *)a1 + 464LL))(a1, v42, 2);
v43 = *((__int64 (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v42 + 23);
v44 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v42);
ScreenLeft = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenLeft(v44);
v47 = v46 + 25.0;
v48 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenLeft);
cocos2d::CCDirector::getScreenTop(v48);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, v47, v49 - 22.0);
v50 = (PlatformToolbox *)v43(v42, &v69);
isControllerConnected = (unsigned __int8)PlatformToolbox::isControllerConnected(v50);
if ( (_BYTE)isControllerConnected )
isControllerConnected = GameToolbox::addBackButton((GameToolbox *)a1, v41, v52);
v53 = LoadingCircle::create((LoadingCircle *)isControllerConnected);
*(_QWORD *)(a1 + 424) = v53;
*(_QWORD *)(v53 + 552) = a1;
*(_BYTE *)(*(_QWORD *)(a1 + 424) + 560LL) = 0;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 424));
LoadingCircle::show(*(cocos2d::CCNode ***)(a1 + 424));
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 424) + 344LL))(*(_QWORD *)(a1 + 424), 0);
v54 = *(_QWORD *)(*(_QWORD *)(a1 + 424) + 544LL);
v55 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v54 + 960LL);
memset(&v69, 100, 3);
v55(v54, &v69);
v74[0] = 0;
v74[1] = 0;
v75 = nullptr;
std::string::__init(v74, "Something went wrong\nplease try again later", 0x2Bu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, 0.5, 1.0);
v56 = TextArea::create((char *)v74, "bigFont.fnt", (const cocos2d::CCPoint *)&v69, 0, 0, 1.0, 600.0, 20.0);
*(_QWORD *)(a1 + 472) = v56;
if ( (v74[0] & 1) != 0 )
{
operator delete(v75);
v56 = *(_QWORD *)(a1 + 472);
}
v57 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v56 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v69, *(float *)&v67 * 0.5, (float)(*((float *)&v67 + 1) * 0.5) + 10.0);
v57(v56, &v69);
(*(void (__fastcall **)(_QWORD, float))(**(_QWORD **)(a1 + 472) + 160LL))(*(_QWORD *)(a1 + 472), 0.6);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 472), 10);
v58 = (GameLevelManager *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 472) + 344LL))(
*(_QWORD *)(a1 + 472),
0);
GameLevelManager::sharedState(v58);
GauntletSearchKey = GameLevelManager::getGauntletSearchKey((const char *)*(unsigned int *)(a1 + 432), v76);
v60 = (GameLevelManager *)GameLevelManager::sharedState((GameLevelManager *)GauntletSearchKey);
v61 = (char *)v76 + 1;
if ( (v76[0] & 1) != 0 )
v61 = v77;
StoredOnlineLevels = (cocos2d::CCArray *)GameLevelManager::getStoredOnlineLevels(v60, v61);
if ( StoredOnlineLevels )
{
GauntletLayer::setupGauntlet((GauntletLayer *)a1, StoredOnlineLevels);
}
else
{
v63 = (GameLevelManager *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 424) + 344LL))(
*(_QWORD *)(a1 + 424),
1);
v64 = (GameLevelManager *)GameLevelManager::sharedState(v63);
*((_QWORD *)v64 + 153) = a1 + 408;
v65 = (GameLevelManager *)GameLevelManager::sharedState(v64);
GameLevelManager::getGauntletLevels(v65, (const char *)*(unsigned int *)(a1 + 432));
}
if ( (v76[0] & 1) != 0 )
operator delete(v77);
if ( (v71 & 1) != 0 )
operator delete(v73);
return v5;
}