//
// GauntletLayer::init from 0x100392aa0 to 0x100393062 (1474 bytes)
//
// 2 xrefs:
// > GauntletLayer::scene @ 0x10039296d
// > GauntletLayer::create @ 0x100392a66
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool __fastcall GauntletLayer::init(GauntletLayer *a1, GauntletType a2)
{
bool v4; // bl
cocos2d::CCDirector *v5; // rsi
int v6; // r12d
GameManager *v7; // rax
const char *BGTexture; // rax
cocos2d::CCSprite *v9; // rax
cocos2d::CCTexture2D *v10; // rax
cocos2d::CCSprite *m_backgroundSprite; // r12
cocos2d::CCSprite *v12; // r12
AppDelegate *v13; // rax
cocos2d::CCSprite *v14; // rdi
cocos2d::CCSprite *v15; // r12
const char *data; // r12
const char *v17; // rdi
cocos2d::CCLabelBMFont *v18; // r15
cocos2d::CCLabelBMFont *v19; // r12
unsigned __int64 *v20; // r15
cocos2d::CCSprite *v21; // rax
CCMenuItemSpriteExtra *v22; // r15
int v23; // edx
int v24; // ecx
int v25; // r8d
int v26; // r9d
__int64 v27; // r12
cocos2d::CCDirector *v28; // rax
cocos2d::CCDirector *v29; // rax
double v30; // xmm0_8
LoadingCircle *v31; // rax
cocos2d::CCSprite *m_sprite; // rdi
TextArea *m_tryAgainText; // r15
GameLevelManager *v34; // rax
GameLevelManager *v35; // rax
const char *v36; // rsi
cocos2d::CCArray *StoredOnlineLevels; // rax
GameLevelManager *v38; // rax
cocos2d::ccTexParams v40; // [rsp+0h] [rbp-A0h] BYREF
unsigned __int64 v41; // [rsp+18h] [rbp-88h] BYREF
__int128 v42; // [rsp+20h] [rbp-80h] BYREF
void *__p; // [rsp+30h] [rbp-70h]
float v44; // [rsp+3Ch] [rbp-64h]
float v45; // [rsp+40h] [rbp-60h] BYREF
float v46; // [rsp+44h] [rbp-5Ch]
std::string v47; // [rsp+48h] [rbp-58h] BYREF
double v48[2]; // [rsp+60h] [rbp-40h] BYREF
void *v49; // [rsp+70h] [rbp-30h]
double v50; // 0:xmm0_8.8
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
a1->m_gauntletType = a2;
((void (__fastcall *)(GauntletLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(GauntletLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v50 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v45);
v6 = sub_1003930C0((unsigned int)a1->m_gauntletType, v5, v50);
v7 = GameManager::sharedState();
BGTexture = GameManager::getBGTexture(v7, v6);
v9 = cocos2d::CCSprite::create_1(BGTexture);
a1->m_backgroundSprite = v9;
v40 = (cocos2d::ccTexParams)xmmword_100815E00;
v10 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v9->getTexture)(v9);
cocos2d::CCTexture2D::setTexParameters(v10, &v40);
((void (__fastcall *)(GauntletLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(
a1,
a1->m_backgroundSprite,
0xFFFFFFFFLL);
m_backgroundSprite = a1->m_backgroundSprite;
sub_10028CBE0((float *)&v47, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))m_backgroundSprite->setAnchorPoint)(
m_backgroundSprite,
&v47);
v12 = a1->m_backgroundSprite;
v13 = AppDelegate::get();
*(float *)&v50 = AppDelegate::bgScale(v13);
((void (__fastcall *)(cocos2d::CCSprite *, float))v12->setScale)(v12, *(float *)&v50);
v14 = a1->m_backgroundSprite;
memset(&v47, 76, 3);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v14->setColor)(v14, &v47);
v15 = a1->m_backgroundSprite;
sub_10028CBE0((float *)&v47, 0.0, -20.0);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v15->setPosition)(v15, &v47);
GauntletNode::nameForType(&v47, (unsigned int)a2);
std::string::append(&v47, " Gauntlet");
data = v47.__r_.__value_.__s.__data_;
v17 = v47.__r_.__value_.__s.__data_;
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 )
v17 = v47.__r_.__value_.__l.__data_;
v18 = cocos2d::CCLabelBMFont::create_3(v17, "goldFont.fnt");
((void (__fastcall *)(GauntletLayer *, cocos2d::CCLabelBMFont *, __int64))a1->addChild_0)(a1, v18, 2);
sub_10028CBE0((float *)v48, v45 * 0.5, v46 + -22.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v18->setPosition)(v18, v48);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v18->setScale)(v18, 1.0);
BYTE2(v48[0]) = 0;
LOWORD(v48[0]) = -1;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v18->setColor)(v18, v48);
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 )
data = v47.__r_.__value_.__l.__data_;
v19 = cocos2d::CCLabelBMFont::create_3(data, "goldFont.fnt");
((void (__fastcall *)(GauntletLayer *, cocos2d::CCLabelBMFont *, _QWORD))a1->addChild_0)(a1, v19, 0);
v20 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v18->getPosition)(v18);
sub_10028CBE0((float *)&v41, 2.0, -4.0);
sub_10028CCE0(v48, v20, &v41);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v19->setPosition)(v19, v48);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v19->setScale)(v19, 1.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))v19->setColor)(v19, &unk_10081A240);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v19->setOpacity)(v19, 100);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v22 = CCMenuItemSpriteExtra::create(
v21,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)GauntletLayer::onBack);
CCMenuItemSpriteExtra::setSizeMult(v22, 1.6);
v27 = sub_100792C50((_DWORD)v22, 0, v23, v24, v25, v26);
((void (__fastcall *)(GauntletLayer *, __int64, __int64))a1->addChild_0)(a1, v27, 2);
v28 = cocos2d::CCDirector::sharedDirector();
v44 = sub_100484D90(v28);
v29 = cocos2d::CCDirector::sharedDirector();
v30 = sub_100484D70(v29);
sub_10028CBE0((float *)v48, v44 + 25.0, *(float *)&v30 + -22.0);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v27 + 184LL))(v27, v48);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v22);
v31 = LoadingCircle::create();
a1->m_loadingCircle = v31;
v31->m_parentLayer = a1;
v31->m_fade = 0;
cocos2d::CCObject::retain(v31);
LoadingCircle::show(a1->m_loadingCircle);
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 0);
m_sprite = a1->m_loadingCircle->m_sprite;
memset(v48, 100, 3);
((void (__fastcall *)(cocos2d::CCSprite *, double *))m_sprite->setColor)(m_sprite, v48);
__p = operator new(0x30u);
*(_QWORD *)&v42 = 49;
*((_QWORD *)&v42 + 1) = 43;
strcpy((char *)__p, "Something went wrong\nplease try again later");
sub_10028CBE0((float *)v48, 0.5, 1.0);
m_tryAgainText = (TextArea *)TextArea::create(&v42, (__int64)"bigFont.fnt", v48, 0, 1.0, 600.0, 20.0);
a1->m_tryAgainText = m_tryAgainText;
if ( (v42 & 1) != 0 )
{
operator delete(__p);
m_tryAgainText = a1->m_tryAgainText;
}
sub_10028CBE0((float *)v48, v45 * 0.5, (float)(0.5 * v46) + 10.0);
((void (__fastcall *)(TextArea *, double *))m_tryAgainText->setPosition)(m_tryAgainText, v48);
((void (__fastcall *)(TextArea *, float))a1->m_tryAgainText->setScale)(a1->m_tryAgainText, 0.60000002);
((void (__fastcall *)(GauntletLayer *, TextArea *, __int64))a1->addChild_0)(a1, a1->m_tryAgainText, 10);
((void (__fastcall *)(TextArea *, _QWORD))a1->m_tryAgainText->setVisible)(a1->m_tryAgainText, 0);
v34 = GameLevelManager::sharedState();
GameLevelManager::getGauntletSearchKey(v48, v34, (unsigned int)a1->m_gauntletType);
v35 = GameLevelManager::sharedState();
if ( (LOBYTE(v48[0]) & 1) != 0 )
v36 = (const char *)v49;
else
v36 = (char *)v48 + 1;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v35, v36);
if ( StoredOnlineLevels )
{
GauntletLayer::setupGauntlet(a1, StoredOnlineLevels);
}
else
{
((void (__fastcall *)(LoadingCircle *, __int64))a1->m_loadingCircle->setVisible)(a1->m_loadingCircle, 1);
GameLevelManager::sharedState()->m_levelManagerDelegate = &a1->LevelManagerDelegate;
v38 = GameLevelManager::sharedState();
GameLevelManager::getGauntletLevels(v38, a1->m_gauntletType);
}
if ( (LOBYTE(v48[0]) & 1) != 0 )
operator delete(v49);
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v47.__r_.__value_.__l.__data_);
}
return v4;
}