//
// WorldSelectLayer::init from 0xaa7e58 to 0xaa8618 (1984 bytes)
//
// 2 xrefs:
// > WorldSelectLayer::create @ 0xaa86ac
// > ??> @ 0x879a0
//
// 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:52 +0000
//
__int64 __fastcall WorldSelectLayer::init(WorldSelectLayer *this, int a2)
{
cocos2d::CCTextureCache *v4; // x0
unsigned int v5; // w23
cocos2d::CCTextureCache *v7; // x0
cocos2d::CCSpriteFrameCache *v8; // x0
cocos2d::CCSpriteFrameCache *v9; // x0
cocos2d::CCDirector *v10; // x0
cocos2d::CCDirector *v11; // x0
const char *v12; // x1
__int64 v13; // x22
void (__fastcall *v14)(__int64, __int64 *); // x25
__int64 v15; // x22
void (__fastcall *v16)(__int64, __int64 *); // x25
__int64 v17; // x0
__int64 (__fastcall *v18)(__int64, __int64 *); // x3
cocos2d::CCMenu *v19; // x0
__int64 v20; // x22
void (__fastcall *v21)(__int64, __int64 *); // x25
const char *v22; // x1
__int64 v23; // x0
_DWORD *v24; // x25
long double v25; // q0
cocos2d::CCDirector **v26; // x22
void (__fastcall *v27)(cocos2d::CCDirector **, __int64 *); // x27
void (__fastcall *v28)(cocos2d::CCDirector **, __int64 *); // x27
cocos2d::CCDirector *v29; // x0
cocos2d::CCDirector *ScreenLeft; // x0
float v31; // s0
float v32; // s9
cocos2d::CCDirector *v33; // x0
float v34; // s0
const char *v35; // x1
cocos2d::CCDirector **v36; // x22
void (__fastcall *v37)(cocos2d::CCDirector **, __int64 *); // x25
void (__fastcall *v38)(cocos2d::CCDirector **, __int64 *); // x25
cocos2d::CCDirector *v39; // x0
cocos2d::CCDirector *ScreenRight; // x0
float v41; // s0
float v42; // s9
cocos2d::CCDirector *v43; // x0
float v44; // s0
cocos2d::CCMenu *v45; // x0
float v46; // s8
cocos2d::CCNode *v47; // x22
PlatformToolbox *v48; // x0
unsigned __int8 isControllerConnected; // w0
const char *v50; // x1
int v51; // w26
cocos2d::CCSprite *v52; // x25
__int64 v53; // x0
cocos2d::CCDirector **v54; // x27
void (__fastcall *v55)(cocos2d::CCDirector **, __int64 *); // x28
cocos2d::CCDirector *v56; // x0
float v57; // s0
const char *v58; // x1
char *v59; // x0
__int64 v60; // x27
__int64 v61; // x0
cocos2d::CCDirector **v62; // x27
void (__fastcall *v63)(cocos2d::CCDirector **, __int64 *); // x28
cocos2d::CCDirector *v64; // x0
float v65; // s0
const char *v66; // x1
__int64 v67; // x0
cocos2d::CCMenu *v68; // x25
cocos2d::CCDirector **v69; // x22
void (__fastcall *v70)(cocos2d::CCDirector **, __int64 *); // x27
cocos2d::CCDirector *v71; // x0
cocos2d::CCDirector *v72; // x0
float v73; // s0
float v74; // s8
cocos2d::CCDirector *v75; // x0
float v76; // s0
cocos2d::CCMenuItem *v77; // x2
__int64 (__fastcall *v78)(WorldSelectLayer *, __int64 *); // x22
GameManager *v79; // x0
cocos2d::CCDelayTime *v80; // x0
cocos2d::CCSequence *v81; // x20
cocos2d::CCFiniteTimeAction *v82; // x0
cocos2d::CCAction *v83; // x0
__int64 v84; // x2
GameStatsManager *v85; // x0
_BOOL8 hasCompletedMainLevel; // x0
_BOOL4 v87; // w20
GameManager *v88; // x0
cocos2d::CCSequence *v89; // x20
cocos2d::CCFiniteTimeAction *v90; // x0
cocos2d::CCAction *v91; // x0
int v92; // w0
_BYTE v93[8]; // [xsp+88h] [xbp+88h] BYREF
__int64 v94; // [xsp+90h] [xbp+90h] BYREF
_BYTE v95[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v96; // [xsp+A0h] [xbp+A0h] BYREF
v4 = (cocos2d::CCTextureCache *)cocos2d::CCLayer::init(this);
v5 = (unsigned __int8)v4;
if ( (_BYTE)v4 )
{
v7 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v4);
v8 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCTextureCache::addImage(v7, "WorldSheet.png", 0);
v9 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v8);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v9, "WorldSheet.plist");
(*(void (__fastcall **)(WorldSelectLayer *, __int64))(*(_QWORD *)this + 1072LL))(this, 1);
v10 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(WorldSelectLayer *, __int64))(*(_QWORD *)this + 1088LL))(
this,
1);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(&v94, v11);
v13 = cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v12);
*((_QWORD *)this + 52) = v13;
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, 0.0, 0.0);
v14(v13, &v96);
(*(void (__fastcall **)(WorldSelectLayer *, _QWORD, __int64))(*(_QWORD *)this + 464LL))(
this,
*((_QWORD *)this + 52),
4294967294LL);
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 52) + 128LL))(
*((_QWORD *)this + 52),
(float)(*(float *)&v94 + 10.0) / *(float *)(*((_QWORD *)this + 52) + 432LL));
(*(void (__fastcall **)(_QWORD, float))(**((_QWORD **)this + 52) + 144LL))(
*((_QWORD *)this + 52),
(float)(*((float *)&v94 + 1) + 10.0) / *(float *)(*((_QWORD *)this + 52) + 436LL));
v15 = *((_QWORD *)this + 52);
v16 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, -5.0, -5.0);
v16(v15, &v96);
v17 = *((_QWORD *)this + 52);
v18 = *(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 960LL);
memset(&v96, 51, 3);
v19 = (cocos2d::CCMenu *)v18(v17, &v96);
v20 = cocos2d::CCMenu::create(v19);
(*(void (__fastcall **)(WorldSelectLayer *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v20, 2);
v21 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v20 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, *(float *)&v94 - 40.0, *((float *)&v94 + 1) - 25.0);
v21(v20, &v96);
v23 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"garageRope_001.png", v22);
v24 = (_DWORD *)CCMenuItemSpriteExtra::create(v23, 0, (__int64)this, (__int64)WorldSelectLayer::onGarage, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v24, 1.2);
CCMenuItemSpriteExtra::useAnimationType(v24, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, 0.0, -8.0);
*(__n128 *)&v25 = cocos2d::CCPoint::operator=(v24 + 117, &v96);
v24[119] = 1045220557;
v24[120] = 1045220557;
(*(void (__fastcall **)(__int64, _DWORD *, long double))(*(_QWORD *)v20 + 456LL))(v20, v24, v25);
v93[0] = -1;
v93[1] = -1;
v93[2] = -1;
v26 = (cocos2d::CCDirector **)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_sideArt_001.png",
(const char *)0xFFFFFFFFLL);
v27 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v26 + 37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, 0.0, 0.0);
v27(v26, &v96);
v28 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v26 + 23);
v29 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v26);
ScreenLeft = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenLeft(v29);
v32 = v31;
v33 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenLeft);
cocos2d::CCDirector::getScreenBottom(v33);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, v32 - 1.0, v34 - 1.0);
v28(v26, &v96);
(*(void (__fastcall **)(WorldSelectLayer *, cocos2d::CCDirector **, __int64))(*(_QWORD *)this + 464LL))(
this,
v26,
1);
(*((void (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v26 + 120))(v26, v93);
v36 = (cocos2d::CCDirector **)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_sideArt_001.png",
v35);
v37 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v36 + 37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, 1.0, 0.0);
v37(v36, &v96);
v38 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v36 + 23);
v39 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v36);
ScreenRight = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenRight(v39);
v42 = v41;
v43 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(ScreenRight);
cocos2d::CCDirector::getScreenBottom(v43);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, v42 + 1.0, v44 - 1.0);
v38(v36, &v96);
cocos2d::CCSprite::setFlipX((cocos2d::CCSprite *)v36, 1);
(*(void (__fastcall **)(WorldSelectLayer *, cocos2d::CCDirector **, __int64))(*(_QWORD *)this + 464LL))(
this,
v36,
1);
v45 = (cocos2d::CCMenu *)(*((__int64 (__fastcall **)(cocos2d::CCDirector **, _BYTE *))*v36 + 120))(v36, v93);
v46 = *((float *)&v94 + 1) * 0.5;
v47 = (cocos2d::CCNode *)cocos2d::CCMenu::create(v45);
v48 = (PlatformToolbox *)(*(__int64 (__fastcall **)(WorldSelectLayer *, cocos2d::CCNode *, __int64))(*(_QWORD *)this + 464LL))(
this,
v47,
5);
isControllerConnected = PlatformToolbox::isControllerConnected(v48);
v51 = isControllerConnected;
if ( isControllerConnected )
{
v52 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"controllerBtn_DPad_Left_001.png",
v50);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v52 + 160LL))(v52, 0.6);
}
else
{
v52 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"navArrowBtn_001.png",
v50);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v52 + 160LL))(v52, 0.6);
cocos2d::CCSprite::setFlipX(v52, 1);
}
v53 = CCMenuItemSpriteExtra::create((__int64)v52, 0, (__int64)this, (__int64)WorldSelectLayer::onPrev, 0);
*((_QWORD *)this + 54) = v53;
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v47 + 456LL))(v47, v53);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 54), 2.0);
v54 = *((cocos2d::CCDirector ***)this + 54);
v55 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v54 + 23);
v56 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v54);
cocos2d::CCDirector::getScreenLeft(v56);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v57 + 25.0, v46);
cocos2d::CCNode::convertToNodeSpace(&v96, v47, (const cocos2d::CCPoint *)v95);
v55(v54, &v96);
if ( v51 )
v59 = "controllerBtn_DPad_Right_001.png";
else
v59 = "navArrowBtn_001.png";
v60 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)v59, v58);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v60 + 160LL))(v60, 0.6);
v61 = CCMenuItemSpriteExtra::create(v60, 0, (__int64)this, (__int64)WorldSelectLayer::onNext, 0);
*((_QWORD *)this + 55) = v61;
(*(void (__fastcall **)(cocos2d::CCNode *, __int64))(*(_QWORD *)v47 + 456LL))(v47, v61);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 55), 2.0);
v62 = *((cocos2d::CCDirector ***)this + 55);
v63 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v62 + 23);
v64 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v62);
cocos2d::CCDirector::getScreenRight(v64);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v65 - 25.0, v46);
cocos2d::CCNode::convertToNodeSpace(&v96, v47, (const cocos2d::CCPoint *)v95);
v63(v62, &v96);
v67 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v66);
v68 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v67, 0, (__int64)this, (__int64)WorldSelectLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((__int64)v68, 1.6);
v69 = (cocos2d::CCDirector **)cocos2d::CCMenu::create(v68, nullptr);
(*(void (__fastcall **)(WorldSelectLayer *, cocos2d::CCDirector **, __int64))(*(_QWORD *)this + 464LL))(
this,
v69,
1);
v70 = *((void (__fastcall **)(cocos2d::CCDirector **, __int64 *))*v69 + 23);
v71 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(*v69);
v72 = (cocos2d::CCDirector *)cocos2d::CCDirector::getScreenLeft(v71);
v74 = v73;
v75 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v72);
cocos2d::CCDirector::getScreenTop(v75);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, v74 + 25.0, v76 - 22.0);
v70(v69, &v96);
if ( v51 )
GameToolbox::addBackButton(this, v68, v77);
WorldSelectLayer::setupWorlds((cocos2d::CCArray ***)this);
WorldSelectLayer::updateArrows(this);
v78 = *(__int64 (__fastcall **)(WorldSelectLayer *, __int64 *))(*(_QWORD *)this + 1168LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v96, (const cocos2d::CCPoint *)&dword_155DC18);
v79 = (GameManager *)v78(this, &v96);
*(_BYTE *)(GameManager::sharedState(v79) + 1064) = 0;
v80 = *((cocos2d::CCDelayTime **)this + 57);
if ( v80 )
{
if ( *((_BYTE *)v80 + 372) )
{
v81 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v80, 1.0);
v82 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(
this,
WorldSelectLayer::animateInActiveIsland,
0);
v83 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v81, v82, 0);
cocos2d::CCNode::runAction(this, v83);
v84 = *((_QWORD *)this + 53);
*((_BYTE *)this + 464) = 1;
v80 = (cocos2d::CCDelayTime *)(*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v84 + 1000LL))(v84, 0);
}
else
{
v92 = (*(__int64 (__fastcall **)(cocos2d::CCDelayTime *))(*(_QWORD *)v80 + 64LL))(v80);
v80 = (cocos2d::CCDelayTime *)WorldSelectLayer::goToPage((cocos2d::CCArray ***)this, v92 - 1, 1u);
}
}
else if ( a2 > 0 )
{
v80 = (cocos2d::CCDelayTime *)WorldSelectLayer::goToPage((cocos2d::CCArray ***)this, a2, 1u);
}
v85 = (GameStatsManager *)GameStatsManager::sharedState(v80);
hasCompletedMainLevel = GameStatsManager::hasCompletedMainLevel(v85, 0x7DAu);
v87 = hasCompletedMainLevel;
if ( hasCompletedMainLevel )
{
v88 = (GameManager *)GameManager::sharedState((GameManager *)hasCompletedMainLevel);
if ( !(unsigned __int8)GameManager::getUGV(v88, "18") )
{
*((_BYTE *)this + 464) = (unsigned __int8)&dword_0 + 1;
v5 = v87;
v89 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create((cocos2d::CCDelayTime *)((char *)&dword_0 + 1), 1.0);
v90 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, WorldSelectLayer::showCompleteDialog, 0);
v91 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v89, v90, 0);
cocos2d::CCNode::runAction(this, v91);
}
}
}
return v5;
}