//
// GauntletLayer::init from 0x1002ce374 to 0x1002ce8d8 (1380 bytes)
//
// 1 xrefs:
// > GauntletLayer::create @ 0x1002ce328
//
// 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:02:36 +0000
//
bool __fastcall GauntletLayer::init(__int64 a1, int a2)
{
_BOOL8 v4; // x19
__int64 v5; // x0
double WinSize; // d0
__int64 v7; // x22
__int64 v8; // x0
__int64 BGTexture; // x0
__int64 v10; // x0
unsigned int *v11; // x0
__int64 v12; // x22
__int64 v13; // x0
__int64 v14; // x22
__int64 v15; // x0
__int64 v16; // x0
__int64 v17; // x22
__int64 v18; // x0
__int64 v19; // x21
__int64 v20; // x0
__int64 v21; // x22
float32x2_t *v22; // x21
double v23; // d0
__int64 v24; // x0
void *v25; // x21
__int64 v26; // x1
__int64 v27; // x2
__int64 v28; // x3
__int64 v29; // x4
__int64 v30; // x5
__int64 v31; // x6
__int64 v32; // x7
__int64 v33; // x22
__int64 v34; // x0
float v35; // s8
__int64 v36; // x0
float v37; // s0
__int64 isControllerConnected; // x0
__int64 v39; // x0
__n128 v40; // q0
__int64 v41; // x0
void *v42; // x21
__int64 v43; // x0
char *v44; // x1
__int64 v45; // x0
void *v47[2]; // [xsp+10h] [xbp-A0h] BYREF
char v48; // [xsp+27h] [xbp-89h]
void *__p[2]; // [xsp+28h] [xbp-88h] BYREF
char v50; // [xsp+3Fh] [xbp-71h]
float32x2_t v51; // [xsp+40h] [xbp-70h] BYREF
std::string v52; // [xsp+48h] [xbp-68h] BYREF
__int128 v53; // [xsp+60h] [xbp-50h] BYREF
__int64 v54; // [xsp+78h] [xbp-38h] BYREF
v4 = cocos2d::CCLayer::init((_WORD *)a1);
if ( v4 )
{
*(_DWORD *)(a1 + 432) = a2;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1072LL))(a1, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1088LL))(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
WinSize = cocos2d::CCDirector::getWinSize(v5, &v54);
v7 = sub_1002CE954(*(unsigned int *)(a1 + 432), WinSize);
v8 = GameManager::sharedState(v7);
BGTexture = GameManager::getBGTexture(v8, v7);
v10 = cocos2d::CCSprite::create(BGTexture);
*(_QWORD *)(a1 + 440) = v10;
v53 = xmmword_10075DE40;
v11 = (unsigned int *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 1072LL))(v10);
cocos2d::CCTexture2D::setTexParameters(v11, (GLint *)&v53);
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)a1 + 464LL))(a1, *(_QWORD *)(a1 + 440), 0xFFFFFFFFLL);
v12 = *(_QWORD *)(a1 + 440);
sub_1000262BC((float *)&v52, 0.0, 0.0);
v13 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v12 + 296LL))(v12, &v52);
v14 = *(_QWORD *)(a1 + 440);
v15 = AppDelegate::get(v13);
AppDelegate::bgScale(v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v14 + 160LL))(v14);
v16 = *(_QWORD *)(a1 + 440);
memset(&v52, 76, 3);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v16 + 960LL))(v16, &v52);
v17 = *(_QWORD *)(a1 + 440);
sub_1000262BC((float *)&v52, 0.0, -20.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v17 + 184LL))(v17, &v52);
GauntletNode::nameForType(a2, &v52);
std::string::append(&v52, " Gauntlet");
if ( (v52.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v18 = cocos2d::CCLabelBMFont::create_1((const char *)&v52, "goldFont.fnt");
else
v18 = cocos2d::CCLabelBMFont::create_1(v52.__r_.__value_.__l.__data_, "goldFont.fnt");
v19 = v18;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v18, 2);
sub_1000262BC((float *)v47, *(float *)&v54 * 0.5, *((float *)&v54 + 1) + -22.0);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v19 + 184LL))(v19, v47);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v19 + 160LL))(v19, 1.0);
BYTE2(v47[0]) = 0;
LOWORD(v47[0]) = -1;
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v19 + 1072LL))(v19, v47);
if ( (v52.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v20 = cocos2d::CCLabelBMFont::create_1((const char *)&v52, "goldFont.fnt");
else
v20 = cocos2d::CCLabelBMFont::create_1(v52.__r_.__value_.__l.__data_, "goldFont.fnt");
v21 = v20;
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)a1 + 464LL))(a1, v20, 0);
v22 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v19 + 192LL))(v19);
sub_1000262BC((float *)&v51, 2.0, -4.0);
*(float32x2_t *)&v23 = sub_100026318(v22, &v51, (float32x2_t *)v47);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v21 + 184LL))(v21, v47, v23);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v21 + 160LL))(v21, 1.0);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v21 + 1072LL))(v21, &unk_100763724);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 1024LL))(v21, 100);
v24 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v25 = CCMenuItemSpriteExtra::create(v24, 0, a1, (__int64)sub_1002CE998, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v25, 1.6);
v33 = sub_100270434((__int64)v25, v26, v27, v28, v29, v30, v31, v32, 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v33, 2);
v34 = cocos2d::CCDirector::sharedDirector();
v35 = sub_100207EA8(v34);
v36 = cocos2d::CCDirector::sharedDirector();
v37 = sub_100207E98(v36);
sub_1000262BC((float *)v47, v35 + 25.0, v37 + -22.0);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v33 + 184LL))(v33, v47);
isControllerConnected = PlatformToolbox::isControllerConnected();
if ( (_DWORD)isControllerConnected )
isControllerConnected = GameToolbox::addBackButton(a1, (__int64)v25);
v39 = LoadingCircle::create(isControllerConnected);
*(_QWORD *)(a1 + 424) = v39;
*(_QWORD *)(v39 + 552) = a1;
*(_BYTE *)(v39 + 560) = 0;
cocos2d::CCObject::retain(v39);
v40 = LoadingCircle::show(*(_QWORD *)(a1 + 424));
(*(void (__fastcall **)(_QWORD, _QWORD, __n128))(**(_QWORD **)(a1 + 424) + 344LL))(*(_QWORD *)(a1 + 424), 0, v40);
v41 = *(_QWORD *)(*(_QWORD *)(a1 + 424) + 544LL);
memset(v47, 100, 3);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v41 + 960LL))(v41, v47);
sub_100009900(__p, "Something went wrong\nplease try again later");
sub_1000262BC((float *)v47, 0.5, 1.0);
v42 = TextArea::create((__int64)__p, (__int64)"bigFont.fnt", (double *)v47, 0, 0, 1.0, 600.0, 20.0);
*(_QWORD *)(a1 + 472) = v42;
if ( v50 < 0 )
{
operator delete(__p[0]);
v42 = *(void **)(a1 + 472);
}
sub_1000262BC((float *)v47, *(float *)&v54 * 0.5, (float)(*((float *)&v54 + 1) * 0.5) + 10.0);
(*(void (__fastcall **)(void *, void **))(*(_QWORD *)v42 + 184LL))(v42, v47);
(*(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);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 472) + 344LL))(*(_QWORD *)(a1 + 472), 0);
GameLevelManager::sharedState();
sub_1000B8BCC(*(_DWORD *)(a1 + 432), v47);
v43 = GameLevelManager::sharedState();
if ( v48 >= 0 )
v44 = (char *)v47;
else
v44 = (char *)v47[0];
if ( GameLevelManager::getStoredOnlineLevels(v43, v44) )
{
GauntletLayer::setupGauntlet(a1);
}
else
{
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 424) + 344LL))(*(_QWORD *)(a1 + 424), 1);
*(_QWORD *)(GameLevelManager::sharedState() + 1224) = a1 + 408;
v45 = GameLevelManager::sharedState();
sub_1000B9080(v45, *(_DWORD *)(a1 + 432));
}
if ( v48 < 0 )
operator delete(v47[0]);
if ( SHIBYTE(v52.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v52.__r_.__value_.__l.__data_);
}
return v4;
}