//
// GauntletSelectLayer::init from 0x91c490 to 0x91cf1c (2700 bytes)
//
// 2 xrefs:
// > GauntletSelectLayer::create @ 0x91cfd4
// > ??> @ 0x6b058
//
// 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 GauntletSelectLayer::init(GauntletSelectLayer *a1, int a2)
{
bool v3; // w24
cocos2d::CCTextureCache *v5; // x0
cocos2d::CCSpriteFrameCache *v6; // x0
cocos2d::CCDirector *v7; // x0
cocos2d::CCDictionary *v8; // x0
const char *v9; // x1
cocos2d::CCSprite *v10; // x22
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCSprite *m_backgroundSprite; // x22
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCSprite *v14; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
cocos2d::CCSprite *v16; // x22
float v17; // s9
void (__fastcall *v18)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v19; // x0
float v20; // s0
cocos2d::CCSprite *v21; // x22
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *v23)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v24; // x0
float v25; // s0
float v26; // s9
cocos2d::CCDirector *v27; // x0
float v28; // s0
cocos2d::CCSprite *v29; // x22
void (__fastcall *v30)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *v31)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v32; // x0
float v33; // s0
float v34; // s9
cocos2d::CCDirector *v35; // x0
float v36; // s0
cocos2d::CCSprite *v37; // x22
void (__fastcall *v38)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *v39)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v40; // x0
float v41; // s0
float v42; // s9
cocos2d::CCDirector *v43; // x0
float v44; // s0
cocos2d::CCSprite *v45; // x22
void (__fastcall *v46)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *v47)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v48; // x0
float v49; // s0
float v50; // s9
cocos2d::CCDirector *v51; // x0
float v52; // s0
float v53; // s8
cocos2d::CCMenu *v54; // x23
bool isControllerConnected; // w0
_BOOL4 v56; // w25
cocos2d::CCSprite *v57; // x22
CCMenuItemSpriteExtra *v58; // x0
cocos2d::CCMenu_vtbl *v59; // x2
CCMenuItemSpriteExtra *m_leftButton; // x26
void (__fastcall *v61)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCDirector *v62; // x0
float v63; // s0
const char *v64; // x0
cocos2d::CCSprite *v65; // x26
CCMenuItemSpriteExtra *v66; // x0
cocos2d::CCMenu_vtbl *v67; // x2
CCMenuItemSpriteExtra *m_rightButton; // x26
void (__fastcall *v69)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCDirector *v70; // x0
float v71; // s0
cocos2d::CCSprite *v72; // x0
CCMenuItemSpriteExtra *v73; // x27
cocos2d::CCNode *v74; // x23
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v76; // x0
float v77; // s0
float v78; // s8
cocos2d::CCDirector *v79; // x0
float v80; // s0
cocos2d::CCSprite *v81; // x0
CCMenuItemSpriteExtra *v82; // x26
void (__fastcall *v83)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCDirector *v84; // x0
float v85; // s0
float v86; // s8
cocos2d::CCDirector *v87; // x0
float v88; // s0
LoadingCircle *v89; // x0
LoadingCircle *m_loadingCircle; // x0
cocos2d::CCSprite *m_sprite; // x0
void (__fastcall *v92)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
TextArea *v93; // x0
TextArea *m_tryAgainText; // x25
void *v95; // x0
void (__fastcall *v96)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCSprite *v97; // x25
CCMenuItemSpriteExtra *v98; // x0
cocos2d::CCNode_vtbl *v99; // x2
CCMenuItemSpriteExtra *m_refreshButton; // x25
void (__fastcall *v101)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
cocos2d::CCDirector *v102; // x0
float v103; // s0
GameLevelManager *v104; // x0
GameLevelManager *v105; // x0
unsigned int *v106; // x2
int v107; // w1
_BYTE v108[8]; // [xsp+88h] [xbp+88h] BYREF
float v109; // [xsp+90h] [xbp+90h]
float v110; // [xsp+94h] [xbp+94h]
cocos2d::CCPoint v111; // [xsp+98h] [xbp+98h] BYREF
cocos2d::CCPoint v112; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v113; // 0:kr08_8.8
cocos2d::CCPoint v114; // 0:kr10_8.8
cocos2d::CCPoint v115; // 0:kr18_8.8
cocos2d::CCPoint v116; // 0:kr20_8.8
cocos2d::SEL_MenuHandler v117; // 0:x2.16
cocos2d::SEL_MenuHandler v118; // 0:x2.16
cocos2d::SEL_MenuHandler v119; // 0:x2.16
cocos2d::SEL_MenuHandler v120; // 0:x2.16
cocos2d::SEL_MenuHandler v121; // 0:x2.16
v3 = cocos2d::CCLayer::init(a1);
if ( v3 )
{
v5 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v5, "GauntletSheet.png", 0);
v6 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v6, "GauntletSheet.plist");
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
v8 = cocos2d::CCDictionary::create();
a1->m_gauntlets = v8;
cocos2d::CCObject::retain(v8);
v10 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v9);
a1->m_backgroundSprite = v10;
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v112, 0.0, 0.0);
setAnchorPoint(v10, &v112);
a1->addChild_0(a1, a1->m_backgroundSprite, -2);
a1->m_backgroundSprite->setScaleX(
a1->m_backgroundSprite,
(float)(v109 + 10.0) / a1->m_backgroundSprite->m_obRect.size.width);
a1->m_backgroundSprite->setScaleY(
a1->m_backgroundSprite,
(float)(v110 + 10.0) / a1->m_backgroundSprite->m_obRect.size.height);
m_backgroundSprite = a1->m_backgroundSprite;
setPosition = m_backgroundSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v112, -5.0, -5.0);
setPosition(m_backgroundSprite, &v112);
v14 = a1->m_backgroundSprite;
setColor = v14->setColor;
memset(&v112, 51, 3);
setColor(v14, (const cocos2d::ccColor3B *)&v112);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("theLostGauntletsLabel_001.png");
a1->addChild(a1, v16);
v17 = v109 * 0.5;
v18 = v16->setPosition;
v19 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v19);
cocos2d::CCPoint::CCPoint(&v112, v17, v20 - 28.0);
v18(v16, &v112);
v108[0] = (unsigned __int8)&qword_48 + 4;
v108[1] = (unsigned __int8)&qword_48 + 4;
v108[2] = (unsigned __int8)&qword_48 + 4;
v21 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v22 = v21->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v112, 0.0, 0.0);
v22(v21, &v112);
v23 = v21->setPosition;
v24 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v24);
v26 = v25;
v27 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v27);
cocos2d::CCPoint::CCPoint(&v112, v26 - 1.0, v28 - 1.0);
v23(v21, &v112);
a1->addChild_0(a1, v21, 1);
v21->setColor(v21, (const cocos2d::ccColor3B *)v108);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v30 = v29->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v112, 1.0, 0.0);
v30(v29, &v112);
v31 = v29->setPosition;
v32 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v32);
v34 = v33;
v35 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v35);
cocos2d::CCPoint::CCPoint(&v112, v34 + 1.0, v36 - 1.0);
v31(v29, &v112);
cocos2d::CCSprite::setFlipX(v29, 1);
a1->addChild_0(a1, v29, 1);
v29->setColor(v29, (const cocos2d::ccColor3B *)v108);
v37 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v38 = v37->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v112, 0.0, 1.0);
v38(v37, &v112);
v39 = v37->setPosition;
v40 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v40);
v42 = v41;
v43 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v43);
cocos2d::CCPoint::CCPoint(&v112, v42 - 1.0, v44 + 1.0);
v39(v37, &v112);
cocos2d::CCSprite::setFlipY(v37, 1);
a1->addChild_0(a1, v37, 1);
v37->setColor(v37, (const cocos2d::ccColor3B *)v108);
v45 = cocos2d::CCSprite::createWithSpriteFrameName("gauntletCorner_001.png");
v46 = v45->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v112, 1.0, 1.0);
v46(v45, &v112);
v47 = v45->setPosition;
v48 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v48);
v50 = v49;
v51 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v51);
cocos2d::CCPoint::CCPoint(&v112, v50 + 1.0, v52 + 1.0);
v47(v45, &v112);
cocos2d::CCSprite::setFlipX(v45, 1);
cocos2d::CCSprite::setFlipY(v45, 1);
a1->addChild_0(a1, v45, 1);
v45->setColor(v45, (const cocos2d::ccColor3B *)v108);
v53 = v110 * 0.5;
v54 = cocos2d::CCMenu::create();
a1->addChild_0(a1, v54, 5);
isControllerConnected = PlatformToolbox::isControllerConnected();
v56 = isControllerConnected;
if ( isControllerConnected )
{
v57 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_DPad_Left_001.png");
v57->setScale(v57, 0.8);
}
else
{
v57 = cocos2d::CCSprite::createWithSpriteFrameName("navArrowBtn_001.png");
v57->setScale(v57, 0.8);
cocos2d::CCSprite::setFlipX(v57, 1);
}
v117.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v117.adj = (size_t)GauntletSelectLayer::onPrev;
v58 = CCMenuItemSpriteExtra::create(v57, nullptr, v117);
v59 = v54->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_leftButton = v58;
v59->addChild(v54, v58);
CCMenuItemSpriteExtra::setSizeMult(a1->m_leftButton, 2.0);
m_leftButton = a1->m_leftButton;
v61 = m_leftButton->setPosition;
v62 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v62);
cocos2d::CCPoint::CCPoint(&v111, v63 + 25.0, v53);
v113 = cocos2d::CCNode::convertToNodeSpace(v54, &v111);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v61)(
m_leftButton,
&v112,
v113.x,
v113.y);
if ( v56 )
v64 = "controllerBtn_DPad_Right_001.png";
else
v64 = "navArrowBtn_001.png";
v65 = cocos2d::CCSprite::createWithSpriteFrameName(v64);
v65->setScale(v65, 0.8);
v118.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v118.adj = (size_t)GauntletSelectLayer::onNext;
v66 = CCMenuItemSpriteExtra::create(v65, nullptr, v118);
v67 = v54->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_rightButton = v66;
v67->addChild(v54, v66);
CCMenuItemSpriteExtra::setSizeMult(a1->m_rightButton, 2.0);
m_rightButton = a1->m_rightButton;
v69 = m_rightButton->setPosition;
v70 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v70);
cocos2d::CCPoint::CCPoint(&v111, v71 - 25.0, v53);
v114 = cocos2d::CCNode::convertToNodeSpace(v54, &v111);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v69)(
m_rightButton,
&v112,
v114.x,
v114.y);
v72 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v119.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v119.adj = (size_t)GauntletSelectLayer::onBack;
v73 = CCMenuItemSpriteExtra::create(v72, nullptr, v119);
CCMenuItemSpriteExtra::setSizeMult(v73, 1.6);
v74 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v73, nullptr);
a1->addChild_0(a1, v74, 1);
v75 = v74->setPosition;
v76 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v76);
v78 = v77;
v79 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v79);
cocos2d::CCPoint::CCPoint(&v112, v78 + 25.0, v80 - 22.0);
v75(v74, &v112);
v81 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
v120.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v120.adj = (size_t)GauntletSelectLayer::onInfo;
v82 = CCMenuItemSpriteExtra::create(v81, nullptr, v120);
CCMenuItemSpriteExtra::setSizeMult(v82, 2.0);
v74->addChild(v74, v82);
v83 = v82->setPosition;
v84 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v84);
v86 = v85;
v87 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v87);
cocos2d::CCPoint::CCPoint(&v111, v86 + 30.0, v88 + 30.0);
v115 = cocos2d::CCNode::convertToNodeSpace(v74, &v111);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v83)(v82, &v112, v115.x, v115.y);
if ( v56 )
GameToolbox::addBackButton(a1, v73);
v89 = LoadingCircle::create();
a1->m_loadingCircle = v89;
v89->m_parentLayer = a1;
m_loadingCircle = a1->m_loadingCircle;
m_loadingCircle->m_fade = 0;
cocos2d::CCObject::retain(m_loadingCircle);
LoadingCircle::show(a1->m_loadingCircle);
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 0);
m_sprite = a1->m_loadingCircle->m_sprite;
v92 = m_sprite->setColor;
memset(&v112, 100, 3);
v92(m_sprite, (const cocos2d::ccColor3B *)&v112);
sub_D153B8((int)&v112, "Something went wrong\nplease try again later");
cocos2d::CCPoint::CCPoint(&v111, 0.5, 1.0);
v93 = (TextArea *)TextArea::create((__int64)&v112, "bigFont.fnt", &v111, 0, 1.0, 600.0, 30.0);
a1->m_tryAgainText = v93;
m_tryAgainText = v93;
v95 = (void *)(*(_QWORD *)&v112 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v112 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v106 = (unsigned int *)(*(_QWORD *)&v112 - 8LL);
do
v107 = __ldaxr(v106);
while ( __stlxr(v107 - 1, v106) );
}
else
{
v107 = *(_DWORD *)(*(_QWORD *)&v112 - 8LL);
*(_DWORD *)(*(_QWORD *)&v112 - 8LL) = v107 - 1;
}
if ( v107 <= 0 )
operator delete(v95);
m_tryAgainText = a1->m_tryAgainText;
}
v96 = m_tryAgainText->setPosition;
cocos2d::CCPoint::CCPoint(&v112, v109 * 0.5, (float)(v110 * 0.5) + 10.0);
v96(m_tryAgainText, &v112);
a1->m_tryAgainText->setScale(a1->m_tryAgainText, 0.6);
a1->addChild_0(a1, a1->m_tryAgainText, 10);
a1->m_tryAgainText->setVisible(a1->m_tryAgainText, 0);
v97 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
v97->setScale(v97, 0.75);
v121.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v121.adj = (size_t)GauntletSelectLayer::onRefresh;
v98 = CCMenuItemSpriteExtra::create(v97, nullptr, v121);
v99 = v74->__vftable;
a1->m_refreshButton = v98;
v99->addChild(v74, v98);
m_refreshButton = a1->m_refreshButton;
v101 = m_refreshButton->setPosition;
v102 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v102);
cocos2d::CCPoint::CCPoint(&v111, v103 - 25.0, 25.0);
v116 = cocos2d::CCNode::convertToNodeSpace(v74, &v111);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v101)(
m_refreshButton,
&v112,
v116.x,
v116.y);
v104 = GameLevelManager::sharedState();
if ( GameLevelManager::areGauntletsLoaded(v104) )
{
GauntletSelectLayer::setupGauntlets(a1);
}
else
{
a1->m_loadingCircle->setVisible(a1->m_loadingCircle, 1);
GameLevelManager::sharedState()->m_levelManagerDelegate = &a1->LevelManagerDelegate;
v105 = GameLevelManager::sharedState();
GameLevelManager::getGauntlets(v105);
}
GauntletSelectLayer::updateArrows(a1);
}
return v3;
}