//
// LevelSelectLayer::init from 0x79dbc8 to 0x79e4f4 (2348 bytes)
//
// 2 xrefs:
// > LevelSelectLayer::create @ 0x79e5a0
// > ??> @ 0x84450
//
// 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 LevelSelectLayer::init(LevelSelectLayer *a1, int a2)
{
bool v4; // w24
GameStatsManager *v6; // x0
AchievementManager *v7; // x0
cocos2d::CCDirector *v8; // x0
const char *v9; // x1
cocos2d::CCSprite *v10; // x19
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *m_backgroundSprite; // x19
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCSprite *v14; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x2
GameManager *v16; // x0
GJGroundLayer *v17; // x0
LevelSelectLayer_vtbl *v18; // x3
float v19; // s0
int v20; // w19
cocos2d::CCSprite *v21; // x22
void (__fastcall *v22)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *v23)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v24; // x0
float v25; // s0
cocos2d::CCSprite *v26; // x22
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
void (__fastcall *v28)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCDirector *v29; // x0
float v30; // s0
float v31; // s9
cocos2d::CCDirector *v32; // x0
float v33; // s0
cocos2d::CCSprite *v34; // x22
void (__fastcall *v35)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *v36)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v37; // x0
float v38; // s0
float v39; // s9
cocos2d::CCDirector *v40; // x0
float v41; // s0
cocos2d::CCArray *v42; // x0
cocos2d::CCArray *v43; // x25
cocos2d::CCArray *v44; // x22
GameLevelManager *v45; // x0
int v46; // w1
GJGameLevel *MainLevel; // x0
int v48; // w19
LevelPage *v49; // x0
GJGameLevel *v50; // x0
__int64 v51; // x19
int v52; // w2
GJGameLevel *v53; // x0
__int64 v54; // x19
int v55; // w2
BoomScrollLayer *v56; // x0
BoomScrollLayer *m_scrollLayer; // x19
cocos2d::CCDirector *v58; // x0
float v59; // s0
ExtendedLayer *m_extendedLayer; // x1
int PageCount; // w0
int v62; // w1
bool v63; // zf
BoomScrollLayer *v64; // x0
cocos2d::CCLabelBMFont *v65; // x19
CCMenuItemSpriteExtra *v66; // x19
cocos2d::CCNode *v67; // x19
void (__fastcall *v68)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v69; // x0
float v70; // s0
float v71; // s8
cocos2d::CCMenu *v72; // x19
bool isControllerConnected; // w0
_BOOL4 v74; // w26
cocos2d::CCSprite *v75; // x22
CCMenuItemSpriteExtra *v76; // x22
void (__fastcall *v77)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCDirector *v78; // x0
float v79; // s0
const char *v80; // x0
cocos2d::CCSprite *v81; // x0
CCMenuItemSpriteExtra *v82; // x22
void (__fastcall *v83)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCDirector *v84; // x0
float v85; // s0
cocos2d::CCSprite *v86; // x0
CCMenuItemSpriteExtra *v87; // x22
cocos2d::CCNode *v88; // x19
void (__fastcall *v89)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v90; // x0
float v91; // s0
float v92; // s8
cocos2d::CCDirector *v93; // x0
float v94; // s0
cocos2d::CCMenu *v95; // x19
cocos2d::CCSprite *v96; // x0
void (__fastcall *v97)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v98; // x0
float v99; // s0
float v100; // s8
cocos2d::CCDirector *v101; // x0
float v102; // s0
void (__fastcall *scrollLayerMoved)(LevelSelectLayer *__hidden, cocos2d::CCPoint); // x19
GameManager *v104; // x0
CCMenuItemSpriteExtra *v105; // [xsp+78h] [xbp+78h]
float v106; // [xsp+80h] [xbp+80h]
float v107; // [xsp+84h] [xbp+84h]
cocos2d::CCPoint v108; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v109; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v110; // 0:kr08_8.8
cocos2d::CCPoint v111; // 0:kr10_8.8
cocos2d::SEL_MenuHandler v112; // 0:x2.16
cocos2d::SEL_MenuHandler v113; // 0:x2.16
cocos2d::SEL_MenuHandler v114; // 0:x2.16
cocos2d::SEL_MenuHandler v115; // 0:x2.16
cocos2d::SEL_MenuHandler v116; // 0:x2.16
cocos2d::CCPoint v117; // 0:s0.4,4:s1.4
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
v6 = GameStatsManager::sharedState();
if ( GameStatsManager::isItemUnlocked(v6, GJItem, 4) )
{
v104 = GameManager::sharedState();
GameManager::setUGV(v104, "6", 1);
}
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
s_didClick = 0;
v7 = AchievementManager::sharedState();
a1->m_masterDetectiveUnlocked = AchievementManager::isAchievementEarned(v7, "geometry.ach.secret04");
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v10 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v9);
a1->m_backgroundSprite = v10;
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v109, 0.0, 0.0);
setAnchorPoint(v10, &v109);
a1->addChild_0(a1, a1->m_backgroundSprite, -2);
a1->m_backgroundSprite->setScaleX(
a1->m_backgroundSprite,
(float)(v106 + 10.0) / a1->m_backgroundSprite->m_obRect.size.width);
a1->m_backgroundSprite->setScaleY(
a1->m_backgroundSprite,
(float)(v107 + 10.0) / a1->m_backgroundSprite->m_obRect.size.height);
m_backgroundSprite = a1->m_backgroundSprite;
setPosition = m_backgroundSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v109, -5.0, -5.0);
setPosition(m_backgroundSprite, &v109);
v14 = a1->m_backgroundSprite;
setColor = v14->setColor;
LOWORD(v109.x) = 32040;
BYTE2(v109.x) = -1;
setColor(v14, (const cocos2d::ccColor3B *)&v109);
v16 = GameManager::sharedState();
v17 = GJGroundLayer::create(v16->m_loadedGroundID, 1);
v18 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_groundLayer = v17;
((void (__fastcall *)(LevelSelectLayer *))v18->addChild_0)(a1);
v19 = (float)(v107 * 0.5) + -110.0;
if ( v19 > 128.0 )
v19 = 128.0;
v20 = 1;
GJGroundLayer::positionGround(a1->m_groundLayer, v19);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_topBar_001.png");
v22 = v21->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v109, 0.5, 1.0);
v22(v21, &v109);
v23 = v21->setPosition;
v24 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v24);
cocos2d::CCPoint::CCPoint(&v109, v106 * 0.5, v25 + 1.0);
v23(v21, &v109);
a1->addChild_0(a1, v21, 1);
v26 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v27 = v26->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v109, 0.0, 0.0);
v27(v26, &v109);
v28 = v26->setPosition;
v29 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v29);
v31 = v30;
v32 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v32);
cocos2d::CCPoint::CCPoint(&v109, v31 - 1.0, v33 - 1.0);
v28(v26, &v109);
a1->addChild_0(a1, v26, 1);
v34 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v35 = v34->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v109, 1.0, 0.0);
v35(v34, &v109);
v36 = v34->setPosition;
v37 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v37);
v39 = v38;
v40 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v40);
cocos2d::CCPoint::CCPoint(&v109, v39 + 1.0, v41 - 1.0);
v36(v34, &v109);
cocos2d::CCSprite::setFlipX(v34, 1);
v42 = (cocos2d::CCArray *)((__int64 (__fastcall *)(LevelSelectLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(
a1,
v34,
1);
v43 = (cocos2d::CCArray *)cocos2d::CCArray::create(v42);
v44 = (cocos2d::CCArray *)cocos2d::CCArray::create(v43);
do
{
v45 = GameLevelManager::sharedState();
v46 = v20++;
MainLevel = GameLevelManager::getMainLevel(v45, v46, 1);
cocos2d::CCArray::addObject(v44, MainLevel);
}
while ( v20 != 23 );
v48 = 3;
do
{
v49 = LevelPage::create(nullptr);
v50 = (GJGameLevel *)cocos2d::CCArray::addObject(v43, v49);
--v48;
}
while ( v48 );
v51 = GJGameLevel::create(v50);
*(_DWORD *)(v51 + 336) = -2;
v52 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v51 + 332) = v52;
*(_DWORD *)(v51 + 328) = v52 - 2;
v53 = (GJGameLevel *)cocos2d::CCArray::addObject(v44, (cocos2d::CCObject *)v51);
v54 = GJGameLevel::create(v53);
*(_DWORD *)(v54 + 336) = -1;
v55 = (int)(float)((float)((float)rand() * 4.6566e-10) * 1000.0);
*(_DWORD *)(v54 + 332) = v55;
*(_DWORD *)(v54 + 328) = v55 - 1;
cocos2d::CCArray::addObject(v44, (cocos2d::CCObject *)v54);
v56 = (BoomScrollLayer *)BoomScrollLayer::create(v43, 0, 1, v44, &a1->DynamicScrollDelegate);
a1->m_scrollLayer = v56;
a1->addChild(a1, v56);
m_scrollLayer = a1->m_scrollLayer;
v58 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v58);
cocos2d::CCPoint::CCPoint(&v109, v106 * 0.5, v59 + 15.0);
BoomScrollLayer::setPagesIndicatorPosition(m_scrollLayer, v117);
m_extendedLayer = a1->m_scrollLayer->m_extendedLayer;
a1->m_width = v106;
m_extendedLayer->m_delegate = &a1->BoomScrollLayerDelegate;
PageCount = getPageCount();
v62 = PageCount;
if ( a2 )
{
v63 = PageCount - 1 == a2;
v64 = a1->m_scrollLayer;
if ( v63 )
{
BoomScrollLayer::instantMoveToPage(v64, v62 - 2);
BoomScrollLayer::instantMoveToPage(a1->m_scrollLayer, a2);
}
else
{
BoomScrollLayer::instantMoveToPage(v64, a2);
}
}
else
{
scrollLayerMoved = a1->scrollLayerMoved;
cocos2d::CCPoint::CCPoint(&v109, &stru_12425A8);
((void (__fastcall *)(LevelSelectLayer *, cocos2d::CCPoint *))scrollLayerMoved)(a1, &v109);
}
v65 = cocos2d::CCLabelBMFont::create();
v65->setScale(v65, 0.5);
v112.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v112.adj = (size_t)LevelSelectLayer::onDownload;
v66 = CCMenuItemSpriteExtra::create(v65, nullptr, v112);
CCMenuItemSpriteExtra::setSizeMult(v66, 1.1);
v67 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v66, nullptr);
a1->addChild(a1, v67);
v68 = v67->setPosition;
v69 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v69);
cocos2d::CCPoint::CCPoint(&v109, v106 * 0.5, v70 + 35.0);
v68(v67, &v109);
v71 = v107 * 0.5;
v72 = cocos2d::CCMenu::create();
a1->addChild_0(a1, v72, 5);
isControllerConnected = PlatformToolbox::isControllerConnected();
v74 = isControllerConnected;
if ( isControllerConnected )
{
v75 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_DPad_Left_001.png");
}
else
{
v75 = cocos2d::CCSprite::createWithSpriteFrameName("navArrowBtn_001.png");
cocos2d::CCSprite::setFlipX(v75, 1);
}
v113.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v113.adj = (size_t)LevelSelectLayer::onPrev;
v76 = CCMenuItemSpriteExtra::create(v75, nullptr, v113);
v72->addChild(v72, v76);
CCMenuItemSpriteExtra::setSizeMult(v76, 2.0);
v77 = v76->setPosition;
v78 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v78);
cocos2d::CCPoint::CCPoint(&v108, v79 + 25.0, v71);
v110 = cocos2d::CCNode::convertToNodeSpace(v72, &v108);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v77)(v76, &v109, v110.x, v110.y);
if ( v74 )
v80 = "controllerBtn_DPad_Right_001.png";
else
v80 = "navArrowBtn_001.png";
v81 = cocos2d::CCSprite::createWithSpriteFrameName(v80);
v114.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v114.adj = (size_t)LevelSelectLayer::onNext;
v82 = CCMenuItemSpriteExtra::create(v81, nullptr, v114);
v72->addChild(v72, v82);
CCMenuItemSpriteExtra::setSizeMult(v82, 2.0);
v83 = v82->setPosition;
v84 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v84);
cocos2d::CCPoint::CCPoint(&v108, v85 - 25.0, v71);
v111 = cocos2d::CCNode::convertToNodeSpace(v72, &v108);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v83)(v82, &v109, v111.x, v111.y);
v86 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v115.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v115.adj = (size_t)LevelSelectLayer::onBack;
v87 = CCMenuItemSpriteExtra::create(v86, nullptr, v115);
CCMenuItemSpriteExtra::setSizeMult(v87, 1.6);
v88 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v87, nullptr);
a1->addChild_0(a1, v88, 1);
v89 = v88->setPosition;
v90 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v90);
v92 = v91;
v93 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v93);
cocos2d::CCPoint::CCPoint(&v109, v92 + 25.0, v94 - 22.0);
v89(v88, &v109);
GameManager::sharedState()->m_somethingInMenuLayer = 0;
v95 = cocos2d::CCMenu::create();
a1->addChild(a1, v95);
v96 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_infoIcon_001.png");
v116.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v116.adj = (size_t)LevelSelectLayer::onInfo;
v105 = CCMenuItemSpriteExtra::create(v96, nullptr, v116);
CCMenuItemSpriteExtra::setSizeMult(v105, 2.0);
v95->addChild(v95, v105);
v97 = v95->setPosition;
v98 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v98);
v100 = v99;
v101 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v101);
cocos2d::CCPoint::CCPoint(&v109, v100 - 20.0, v102 - 20.0);
v97(v95, &v109);
if ( v74 )
GameToolbox::addBackButton(a1, v87);
}
return v4;
}