//
// GauntletSelectLayer::init from 0x1401f8c30 to 0x1401f978e (2910 bytes)
//
// 2 xrefs:
// > GauntletSelectLayer::scene @ 0x1401f8be6
// > ??> @ 0x1406cc978
//
// 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
//
// Hidden C++ exception states: #wind=4
bool GauntletSelectLayer::init(GauntletSelectLayer *a1, int a2)
{
float v2; // xmm0_4
bool result; // al
cocos2d::CCTextureCache *v5; // rax
__int64 v6; // rcx
cocos2d::CCSpriteFrameCache *v7; // rax
_BOOL8 v8; // rdx
_BOOL8 v9; // rdx
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
__int64 v12; // rcx
cocos2d::CCDictionary *v13; // rax
cocos2d::CCSprite *v14; // rax
cocos2d::CCSprite_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
float v17; // xmm0_4
cocos2d::CCSprite_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
struct cocos2d::CCSprite *v20; // rdi
cocos2d::CCSprite_vtbl *v21; // rbx
__int64 v22; // rcx
cocos2d::CCDirector *v23; // rax
float v24; // xmm0_4
double v25; // xmm0_8
const cocos2d::CCPoint *v26; // rax
struct cocos2d::CCSprite *v27; // rdi
cocos2d::CCSprite_vtbl *v28; // rbx
const cocos2d::CCPoint *v29; // rax
cocos2d::CCSprite_vtbl *v30; // rbx
__int64 v31; // rcx
cocos2d::CCDirector *v32; // rax
__int64 v33; // rcx
cocos2d::CCDirector *v34; // rax
float v35; // xmm0_4
double v36; // xmm0_8
const cocos2d::CCPoint *v37; // rax
struct cocos2d::CCSprite *v38; // rdi
cocos2d::CCSprite_vtbl *v39; // rbx
const cocos2d::CCPoint *v40; // rax
cocos2d::CCSprite_vtbl *v41; // rbx
__int64 v42; // rcx
cocos2d::CCDirector *v43; // rax
__int64 v44; // rcx
cocos2d::CCDirector *v45; // rax
float v46; // xmm0_4
double v47; // xmm0_8
const cocos2d::CCPoint *v48; // rax
struct cocos2d::CCSprite *v49; // rdi
cocos2d::CCSprite_vtbl *v50; // rbx
const cocos2d::CCPoint *v51; // rax
cocos2d::CCSprite_vtbl *v52; // rbx
__int64 v53; // rcx
cocos2d::CCDirector *v54; // rax
__int64 v55; // rcx
cocos2d::CCDirector *v56; // rax
float v57; // xmm0_4
double v58; // xmm0_8
const cocos2d::CCPoint *v59; // rax
struct cocos2d::CCSprite *v60; // rdi
cocos2d::CCSprite_vtbl *v61; // rbx
const cocos2d::CCPoint *v62; // rax
cocos2d::CCSprite_vtbl *v63; // rbx
__int64 v64; // rcx
cocos2d::CCDirector *v65; // rax
__int64 v66; // rcx
cocos2d::CCDirector *v67; // rax
float v68; // xmm0_4
const cocos2d::CCPoint *v69; // rax
__int64 v70; // rcx
cocos2d::CCNode *v71; // rdi
__int64 v72; // rdx
__int64 v73; // rcx
char v74; // r12
const char *v75; // r14
const char *v76; // rcx
cocos2d::CCSprite *v77; // rbx
CCMenuItemSpriteExtra *v78; // rax
CCMenuItemSpriteExtra_vtbl *v79; // rbx
__int64 v80; // rcx
cocos2d::CCDirector *v81; // rax
float v82; // xmm0_4
struct cocos2d::CCPoint v83; // rax
struct cocos2d::CCSprite *v84; // rbx
CCMenuItemSpriteExtra *v85; // rax
CCMenuItemSpriteExtra_vtbl *v86; // rbx
__int64 v87; // rcx
cocos2d::CCDirector *v88; // rax
float v89; // xmm0_4
struct cocos2d::CCPoint v90; // rax
struct cocos2d::CCSprite *v91; // rax
CCMenuItemSpriteExtra *v92; // r15
struct cocos2d::CCMenu *v93; // r14
cocos2d::CCMenu_vtbl *v94; // rbx
__int64 v95; // rcx
cocos2d::CCDirector *v96; // rax
__int64 v97; // rcx
cocos2d::CCDirector *v98; // rax
float v99; // xmm0_4
const cocos2d::CCPoint *v100; // rax
struct cocos2d::CCSprite *v101; // rax
CCMenuItemSpriteExtra *v102; // rdi
CCMenuItemSpriteExtra_vtbl *v103; // rbx
__int64 v104; // rcx
cocos2d::CCDirector *v105; // rax
__int64 v106; // rcx
cocos2d::CCDirector *v107; // rax
float v108; // xmm0_4
struct cocos2d::CCPoint v109; // rax
LoadingCircle *v110; // rax
cocos2d::CCRGBAProtocol *v111; // rcx
double v112; // xmm0_8
const struct cocos2d::CCPoint *v113; // rax
char *v114; // rax
__int64 v115; // rbx
__int64 v116; // rax
struct cocos2d::CCSprite *v117; // rbx
CCMenuItemSpriteExtra *v118; // rax
CCMenuItemSpriteExtra_vtbl *v119; // rbx
__int64 v120; // rcx
cocos2d::CCDirector *v121; // rax
float v122; // xmm0_4
struct cocos2d::CCPoint v123; // rax
__int64 v124; // rcx
_BOOL8 v125; // rdx
_BOOL8 v126; // rdx
GameLevelManager *v127; // rcx
_BOOL8 v128; // rdx
struct cocos2d::CCPoint v129; // [rsp+48h] [rbp-59h] BYREF
void *v130; // [rsp+50h] [rbp-51h]
__int128 v131; // [rsp+58h] [rbp-49h] BYREF
__int64 v132; // [rsp+68h] [rbp-39h]
__int128 v133; // [rsp+70h] [rbp-31h]
int v134; // [rsp+110h] [rbp+6Fh] BYREF
__int128 *v135; // [rsp+118h] [rbp+77h] BYREF
float v136; // [rsp+120h] [rbp+7Fh]
v134 = a2;
result = cocos2d::CCLayer::init(a1);
if ( result )
{
v5 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v5, "GauntletSheet.png", 0);
v7 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v6);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v7, "GauntletSheet.plist");
LOBYTE(v8) = 1;
a1->setKeypadEnabled(a1, v8);
LOBYTE(v9) = 1;
a1->setKeyboardEnabled(a1, v9);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11);
v13 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::create(v12);
a1->m_gauntlets = v13;
cocos2d::CCObject::retain(v13);
v14 = cocos2d::CCSprite::create("GJ_gradientBG.png");
a1->m_backgroundSprite = v14;
v15 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v2, 0.0);
v15->setAnchorPoint(a1->m_backgroundSprite, v16);
a1->addChild_0(a1, a1->m_backgroundSprite, -2);
((void (*)(void))a1->m_backgroundSprite->setScaleX)();
v17 = ((float (*)(void))a1->m_backgroundSprite->setScaleY)();
v18 = a1->m_backgroundSprite->__vftable;
cocos2d::CCPoint::CCPoint(v17, -5.0);
v18->setPosition_0(a1->m_backgroundSprite, v19);
memset(&v135, 51, 3);
a1->m_backgroundSprite->setColor(
&a1->m_backgroundSprite->cocos2d::CCRGBAProtocol,
(const cocos2d::ccColor3B *)&v135);
v20 = cocos2d::CCSprite::createWithSpriteFrameName("theLostGauntletsLabel_001.png");
a1->addChild_1(a1, v20);
v21 = v20->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v23 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v22);
v24 = cocos2d::CCDirector::getScreenTop(v23) - 28.0;
v25 = cocos2d::CCPoint::CCPoint(v24, v136 * 0.5);
v21->setPosition_0(v20, v26);
LOWORD(v135) = 19532;
memset(&v134, 76, 3);
v27 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v28 = v27->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v25, 0.0);
v28->setAnchorPoint(v27, v29);
v30 = v27->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v32 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v31);
cocos2d::CCDirector::getScreenBottom(v32);
v34 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v33);
v35 = cocos2d::CCDirector::getScreenLeft(v34) - 1.0;
v36 = cocos2d::CCPoint::CCPoint(v35, v35);
v30->setPosition_0(v27, v37);
a1->addChild_0(a1, v27, 1);
v27->setColor(&v27->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v134);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v39 = v38->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v36, 1.0);
v39->setAnchorPoint(v38, v40);
v41 = v38->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v43 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v42);
cocos2d::CCDirector::getScreenBottom(v43);
v45 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v44);
v46 = cocos2d::CCDirector::getScreenRight(v45) + 1.0;
v47 = cocos2d::CCPoint::CCPoint(v46, v46);
v41->setPosition_0(v38, v48);
cocos2d::CCSprite::setFlipX(v38, 1);
a1->addChild_0(a1, v38, 1);
v38->setColor(&v38->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v134);
v49 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v50 = v49->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v47, 0.0);
v50->setAnchorPoint(v49, v51);
v52 = v49->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v54 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v53);
cocos2d::CCDirector::getScreenTop(v54);
v56 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v55);
v57 = cocos2d::CCDirector::getScreenLeft(v56) - 1.0;
v58 = cocos2d::CCPoint::CCPoint(v57, v57);
v52->setPosition_0(v49, v59);
cocos2d::CCSprite::setFlipY(v49, 1);
a1->addChild_0(a1, v49, 1);
v49->setColor(&v49->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v134);
v60 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v61 = v60->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v58, 1.0);
v61->setAnchorPoint(v60, v62);
v63 = v60->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v65 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v64);
cocos2d::CCDirector::getScreenTop(v65);
v67 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v66);
v68 = cocos2d::CCDirector::getScreenRight(v67) + 1.0;
cocos2d::CCPoint::CCPoint(v68, v68);
v63->setPosition_0(v60, v69);
cocos2d::CCSprite::setFlipX(v60, 1);
cocos2d::CCSprite::setFlipY(v60, 1);
a1->addChild_0(a1, v60, 1);
v60->setColor(&v60->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v134);
v71 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v70);
a1->addChild_0(a1, v71, 5);
v74 = *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v73, v72) + 197);
v75 = "navArrowBtn_001.png";
v76 = "navArrowBtn_001.png";
if ( v74 )
v76 = "controllerBtn_DPad_Left_001.png";
v77 = cocos2d::CCSprite::createWithSpriteFrameName(v76);
((void (__fastcall *)(cocos2d::CCSprite *))v77->setScale_0)(v77);
if ( !v74 )
cocos2d::CCSprite::setFlipX(v77, 1);
v78 = CCMenuItemSpriteExtra::create(v77, nullptr, a1, (cocos2d::SEL_MenuHandler *)GauntletSelectLayer::onPrev);
a1->m_leftButton = v78;
v71->addChild_1(v71, v78);
HIDWORD(a1->m_leftButton->m_pfnSelector.adj) = 0x40000000;
v79 = a1->m_leftButton->__vftable;
v81 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v80);
v82 = cocos2d::CCDirector::getScreenLeft(v81) + 25.0;
cocos2d::CCPoint::CCPoint(v82, v82);
v83 = cocos2d::CCNode::convertToNodeSpace(v71, &v129);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v79->setPosition_0)(a1->m_leftButton, v83);
if ( v74 )
v75 = "controllerBtn_DPad_Right_001.png";
v84 = cocos2d::CCSprite::createWithSpriteFrameName(v75);
((void (__fastcall *)(struct cocos2d::CCSprite *))v84->setScale_0)(v84);
v85 = CCMenuItemSpriteExtra::create(v84, nullptr, a1, (cocos2d::SEL_MenuHandler *)GauntletSelectLayer::onNext);
a1->m_rightButton = v85;
v71->addChild_1(v71, v85);
HIDWORD(a1->m_rightButton->m_pfnSelector.adj) = 0x40000000;
v86 = a1->m_rightButton->__vftable;
v88 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v87);
v89 = cocos2d::CCDirector::getScreenRight(v88) - 25.0;
cocos2d::CCPoint::CCPoint(v89, v89);
v90 = cocos2d::CCNode::convertToNodeSpace(v71, &v129);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v86->setPosition_0)(a1->m_rightButton, v90);
v91 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v92 = CCMenuItemSpriteExtra::create(v91, nullptr, a1, (cocos2d::SEL_MenuHandler *)GauntletSelectLayer::onBack);
HIDWORD(v92->m_pfnSelector.adj) = 1070386381;
v93 = cocos2d::CCMenu::create(v92, 0);
a1->addChild_0(a1, v93, 1);
v94 = v93->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v96 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v95);
cocos2d::CCDirector::getScreenTop(v96);
v98 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v97);
v99 = cocos2d::CCDirector::getScreenLeft(v98) + 25.0;
cocos2d::CCPoint::CCPoint(v99, v99);
v94->setPosition_0(v93, v100);
v101 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
v102 = CCMenuItemSpriteExtra::create(v101, nullptr, a1, (cocos2d::SEL_MenuHandler *)GauntletSelectLayer::onInfo);
HIDWORD(v102->m_pfnSelector.adj) = 0x40000000;
v93->addChild_1(v93, v102);
v103 = v102->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v105 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v104);
cocos2d::CCDirector::getScreenBottom(v105);
v107 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v106);
v108 = cocos2d::CCDirector::getScreenLeft(v107) + 30.0;
cocos2d::CCPoint::CCPoint(v108, v108);
v109 = cocos2d::CCNode::convertToNodeSpace(v93, &v129);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v103->setPosition_0)(v102, v109);
if ( v74 )
GameToolbox::addBackButton(a1, v92);
v110 = LoadingCircle::create();
a1->m_loadingCircle = v110;
v110->m_parentLayer = a1;
a1->m_loadingCircle->m_fade = 0;
cocos2d::CCObject::retain(a1->m_loadingCircle);
LoadingCircle::show(a1->m_loadingCircle);
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
memset(&v135, 100, 3);
v111 = &a1->m_loadingCircle->m_sprite->cocos2d::CCRGBAProtocol;
v111->setColor(v111, (const cocos2d::ccColor3B *)&v135);
v135 = &v131;
v131 = 0;
v132 = 0;
*(_QWORD *)&v133 = 15;
*(_QWORD *)&v131 = sub_14003AA10(0x30u);
v132 = 43;
*(_QWORD *)&v133 = 47;
strcpy((char *)v131, "Something went wrong\nplease try again later");
v112 = cocos2d::CCPoint::CCPoint(1.7031031e25, 0.5);
v114 = TextArea::create((__int64)&v131, &qword_14052A4D8, 1.0, 600.0, v113, 1106247680, 0);
a1->m_tryAgainText = (TextArea *)v114;
v115 = *(_QWORD *)v114;
cocos2d::CCPoint::CCPoint(*(float *)&v112, v136 * 0.5);
(*(void (__fastcall **)(TextArea *, __int64))(v115 + 184))(a1->m_tryAgainText, v116);
((void (__fastcall *)(TextArea *))a1->m_tryAgainText->setScale_0)(a1->m_tryAgainText);
a1->addChild_0(a1, a1->m_tryAgainText, 10);
a1->m_tryAgainText->setVisible(a1->m_tryAgainText, 0);
v117 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v117->setScale_0)(v117);
v118 = CCMenuItemSpriteExtra::create(v117, nullptr, a1, (cocos2d::SEL_MenuHandler *)GauntletSelectLayer::onRefresh);
a1->m_refreshButton = v118;
v93->addChild_1(v93, v118);
v119 = a1->m_refreshButton->__vftable;
v121 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v120);
v122 = cocos2d::CCDirector::getScreenRight(v121) - 25.0;
cocos2d::CCPoint::CCPoint(v122, v122);
v123 = cocos2d::CCNode::convertToNodeSpace(v93, &v129);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v119->setPosition_0)(
a1->m_refreshButton,
v123);
v124 = qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v130 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v130);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v124 = qword_1406C2EC0;
}
if ( cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v124 + 576)) )
{
GauntletSelectLayer::setupGauntlets(a1);
}
else
{
LOBYTE(v125) = 1;
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, v125);
v127 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v135 = (__int128 *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v135);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v127 = (GameLevelManager *)qword_1406C2EC0;
}
v127->m_levelManagerDelegate = &a1->LevelManagerDelegate;
GameLevelManager::getGauntlets(v127);
}
LOBYTE(v126) = a1->m_scrollLayer != nullptr;
a1->m_leftButton->setVisible(a1->m_leftButton, v126);
LOBYTE(v128) = a1->m_scrollLayer != nullptr;
a1->m_rightButton->setVisible(a1->m_rightButton, v128);
return 1;
}
return result;
}