//
// CreatorLayer::init from 0x6cbf7c to 0x6cccb8 (3388 bytes)
//
// 3 xrefs:
// > CreatorLayer::create @ 0x6ccd60
// > ??> @ 0x31830
// > ??> @ 0x1159070
//
// 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 CreatorLayer::init(CreatorLayer *a1)
{
GameManager *v3; // x0
CreatorLayer_vtbl *v4; // x2
cocos2d::CCDirector *v5; // x0
const char *v6; // x1
cocos2d::CCNode *v7; // x19
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
cocos2d::CCMenu *v11; // x26
float v12; // s10
float v13; // s2
float v14; // s8
int v15; // w19
int v16; // w28
void (*v17)(CreatorLayer *, cocos2d::CCObject *); // x22
CCSpriteGrayscale *v18; // x20
CCMenuItemSpriteExtra *v19; // x22
char *v20; // x1
char *v21; // x0
void *v22; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x3
GameManager *v24; // x0
unsigned int *v25; // x1
int v26; // w2
cocos2d::CCSprite *v27; // x20
void (__fastcall *v28)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v29)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v30; // x0
float v31; // s0
float v32; // s9
cocos2d::CCDirector *v33; // x0
float v34; // s0
cocos2d::CCSprite *v35; // x20
void (__fastcall *v36)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v37)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v38; // x0
float v39; // s0
float v40; // s9
cocos2d::CCDirector *v41; // x0
float v42; // s0
cocos2d::CCSprite *v43; // x20
void (__fastcall *v44)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
void (__fastcall *v45)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v46; // x0
float v47; // s0
float v48; // s9
cocos2d::CCDirector *v49; // x0
float v50; // s0
cocos2d::CCSprite *v51; // x19
void (__fastcall *v52)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
void (__fastcall *v53)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCDirector *v54; // x0
float v55; // s0
float v56; // s9
cocos2d::CCDirector *v57; // x0
float v58; // s0
GameStatsManager *v59; // x0
_BOOL4 v60; // w20
const char *v61; // x0
cocos2d::CCSprite *v62; // x22
CCMenuItemSpriteExtra *v63; // x19
void (__fastcall *v64)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
GameManager *v65; // x0
const char *v66; // x0
cocos2d::CCSprite *v67; // x0
CCMenuItemSpriteExtra *v68; // x19
cocos2d::CCMenu_vtbl *v69; // x2
void (__fastcall *addChild)(cocos2d::CCMenu *__hidden, cocos2d::CCNode *); // x2
void (__fastcall *v71)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCSprite *v72; // x0
CCMenuItemSpriteExtra *v73; // x20
cocos2d::CCNode *v74; // x19
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCDirector *v76; // x0
float v77; // s0
float v78; // s9
cocos2d::CCDirector *v79; // x0
float v80; // s0
GameManager *v81; // x0
GameLevelManager *v82; // x0
unsigned int *v83; // x1
int v84; // w2
__int64 v85; // x0
cocos2d::CCSprite *v86; // x20
void (__fastcall *v87)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x27
cocos2d::CCString *v88; // x0
cocos2d::CCLabelBMFont *v89; // x20
void (__fastcall *v90)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
double v91; // d0
double v92; // d1
bool v93; // [xsp+9Fh] [xbp+9Fh]
void (__fastcall *v94)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+A8h] [xbp+A8h]
int v95; // [xsp+B0h] [xbp+B0h]
float v96; // [xsp+B0h] [xbp+B0h]
float v97; // [xsp+D0h] [xbp+D0h]
float v98; // [xsp+D4h] [xbp+D4h]
char v99[8]; // [xsp+D8h] [xbp+D8h] BYREF
char *v100; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v101; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCPoint v102; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCPoint v103; // 0:kr08_8.8
cocos2d::CCPoint v104; // 0:kr10_8.8
cocos2d::CCPoint v105; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v106; // 0:x2.16
cocos2d::SEL_MenuHandler v107; // 0:x2.16
cocos2d::SEL_MenuHandler v108; // 0:x2.16
cocos2d::SEL_MenuHandler v109; // 0:x2.16
v93 = cocos2d::CCLayer::init(a1);
if ( !v93 )
return v93;
v3 = GameManager::sharedState();
v4 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v3->m_currentLevelID = -1;
v4->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v7 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v6);
setAnchorPoint = v7->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v102, 0.0, 0.0);
setAnchorPoint(v7, &v102);
a1->addChild_0(a1, v7, -2);
v7->setScaleX(v7, (float)(v97 + 10.0) / v7[1].m_obContentSize.height);
v7->setScaleY(v7, (float)(v98 + 10.0) / v7[1].m_sAdditionalTransform.a);
setPosition = v7->setPosition;
cocos2d::CCPoint::CCPoint(&v102, -5.0, -5.0);
setPosition(v7, &v102);
getTag = v7->__vftable[1].getTag;
LOWORD(v102.x) = 26112;
BYTE2(v102.x) = -1;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *))getTag)(v7, &v102);
v11 = cocos2d::CCMenu::create();
a1->addChild(a1, v11);
v12 = 0.8;
v13 = (float)(v97 - 100.0)
/ (float)((float)(cocos2d::CCSprite::createWithSpriteFrameName("GJ_searchBtn_001.png")->m_obRect.size.width * 0.8)
+ 360.0);
if ( v13 > 0.9 )
{
if ( v13 < 1.0 )
{
v12 = v13 * 0.8;
v14 = v13 * 90.0;
}
else
{
v14 = 90.0;
}
}
else
{
v14 = 81.0;
v12 = 0.72;
}
v15 = 0;
cocos2d::CCPoint::CCPoint(&v102, v97 * 0.5, v98 * 0.5);
v103 = cocos2d::CCNode::convertToNodeSpace(v11, &v102);
*(float *)&v91 = v103.x;
*(float *)&v92 = v103.y;
while ( 2 )
{
v100 = &byte_124B6C8;
switch ( v15 )
{
case 1:
sub_D1798C(&v100, "GJ_savedBtn_001.png", 19, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onSavedLevels;
goto LABEL_7;
case 2:
sub_D1798C(&v100, "GJ_highscoreBtn_001.png", 23, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onLeaderboards;
goto LABEL_7;
case 3:
sub_D1798C(&v100, "GJ_challengeBtn_001.png", 23, v91, v92);
v95 = 0;
v16 = 1;
v17 = CreatorLayer::onChallenge;
goto LABEL_7;
case 4:
sub_D1798C(&v100, "GJ_versusBtn_001.png", 20, v91, v92);
v17 = CreatorLayer::onMultiplayer;
goto LABEL_23;
case 5:
sub_D1798C(&v100, "GJ_mapBtn_001.png", 17, v91, v92);
v17 = CreatorLayer::onAdventureMap;
LABEL_23:
sub_D153B8((int)&v102, v100);
v18 = CCSpriteGrayscale::createWithSpriteFrameName((const char **)&v102);
v22 = (void *)(*(_QWORD *)&v102 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v102 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v83 = (unsigned int *)(*(_QWORD *)&v102 - 8LL);
do
v84 = __ldaxr(v83);
while ( __stlxr(v84 - 1, v83) );
}
else
{
v84 = *(_DWORD *)(*(_QWORD *)&v102 - 8LL);
*(_DWORD *)(*(_QWORD *)&v102 - 8LL) = v84 - 1;
}
if ( v84 <= 0 )
operator delete(v22);
}
CCSpriteWithHue::setEvenLuminance(v18, 1.0);
setColor = v18->setColor;
LOWORD(v102.x) = -20561;
BYTE2(v102.x) = -81;
setColor(v18, (const cocos2d::ccColor3B *)&v102);
v95 = 0;
v16 = 0;
goto LABEL_8;
case 6:
sub_D1798C(&v100, "GJ_dailyBtn_001.png", 19, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onDailyLevel;
goto LABEL_7;
case 7:
sub_D1798C(&v100, "GJ_weeklyBtn_001.png", 20, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onWeeklyLevel;
goto LABEL_7;
case 8:
sub_D1798C(&v100, "GJ_eventBtn_001.png", 19, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onEventLevel;
goto LABEL_7;
case 9:
sub_D1798C(&v100, "GJ_gauntletsBtn_001.png", 23, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onGauntlets;
goto LABEL_7;
case 10:
sub_D1798C(&v100, "GJ_featuredBtn_001.png", 22, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onFeaturedLevels;
goto LABEL_7;
case 11:
sub_D1798C(&v100, "GJ_listsBtn_001.png", 19, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onTopLists;
goto LABEL_7;
case 12:
sub_D1798C(&v100, "GJ_pathsBtn_001.png", 19, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onPaths;
goto LABEL_7;
case 13:
sub_D1798C(&v100, "GJ_mapPacksBtn_001.png", 22, v91, v92);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onMapPacks;
goto LABEL_7;
case 14:
sub_D1798C(&v100, "GJ_searchBtn_001.png", 20, v91, v92);
v16 = 0;
v95 = 1;
v17 = CreatorLayer::onOnlineLevels;
goto LABEL_7;
default:
sub_D1798C(&v100, "GJ_createBtn_001.png", 20);
v95 = 0;
v16 = 0;
v17 = CreatorLayer::onMyLevels;
LABEL_7:
v18 = (CCSpriteGrayscale *)cocos2d::CCSprite::createWithSpriteFrameName(v100);
LABEL_8:
v18->setScale(v18, v12);
v106.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v106.adj = (size_t)v17;
v19 = CCMenuItemSpriteExtra::create(v18, nullptr, v106);
v11->addChild(v11, v19);
v94 = v19->setPosition;
cocos2d::CCPoint::CCPoint(
&v101,
-(float)((float)(v14 * 0.5) - (float)((float)((float)(v15 % 5) - 1.5) * v14)),
(float)-(float)(floorf((float)v15 / 5.0) - 1.0) * v14);
cocos2d::CCPoint::operator+(&v102, v99, &v101);
v94(v19, &v102);
if ( v16 )
{
a1->m_questsSprite = v18;
CreatorLayer::checkQuestsStatus(a1);
}
if ( !v95 || (v24 = GameManager::sharedState(), !GameManager::getGameVariable(v24, "0077")) )
{
v20 = v100;
v21 = v100 - 24;
if ( v100 - 24 != (char *)&qword_124B6B0 )
goto LABEL_34;
LABEL_12:
if ( ++v15 == 15 )
goto LABEL_39;
continue;
}
v19->setEnabled(v19, 0);
v19->setVisible(v19, 0);
v20 = v100;
v21 = v100 - 24;
if ( v100 - 24 == (char *)&qword_124B6B0 )
goto LABEL_12;
LABEL_34:
if ( &pthread_create )
{
v25 = (unsigned int *)(v20 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v20 - 2);
*((_DWORD *)v20 - 2) = v26 - 1;
}
if ( v26 > 0 )
goto LABEL_12;
++v15;
operator delete(v21);
if ( v15 != 15 )
continue;
LABEL_39:
v27 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v28 = v27->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v102, 0.0, 0.0);
v28(v27, &v102);
v29 = v27->setPosition;
v30 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v30);
v32 = v31;
v33 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v33);
cocos2d::CCPoint::CCPoint(&v102, v32 - 1.0, v34 - 1.0);
v29(v27, &v102);
a1->addChild_0(a1, v27, 1);
v35 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v36 = v35->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v102, 1.0, 0.0);
v36(v35, &v102);
v37 = v35->setPosition;
v38 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v38);
v40 = v39;
v41 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenBottom(v41);
cocos2d::CCPoint::CCPoint(&v102, v40 + 1.0, v42 - 1.0);
v37(v35, &v102);
cocos2d::CCSprite::setFlipX(v35, 1);
v43 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v44 = v43->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v102, 0.0, 1.0);
v44(v43, &v102);
v45 = v43->setPosition;
v46 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v46);
v48 = v47;
v49 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v49);
cocos2d::CCPoint::CCPoint(&v102, v48 - 1.0, v50 + 1.0);
v45(v43, &v102);
cocos2d::CCSprite::setFlipY(v43, 1);
a1->addChild_0(a1, v43, -1);
v51 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v52 = v51->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v102, 1.0, 1.0);
v52(v51, &v102);
v53 = v51->setPosition;
v54 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenRight(v54);
v56 = v55;
v57 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v57);
cocos2d::CCPoint::CCPoint(&v102, v56 + 1.0, v58 + 1.0);
v53(v51, &v102);
cocos2d::CCSprite::setFlipY(v51, 1);
cocos2d::CCSprite::setFlipX(v51, 1);
v59 = GameStatsManager::sharedState();
v60 = GameStatsManager::getStat(v59, "13") > 49;
if ( v60 )
v61 = "GJ_lock_open_001.png";
else
v61 = "GJ_lockGray_001.png";
v62 = cocos2d::CCSprite::createWithSpriteFrameName(v61);
v107.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v107.adj = (size_t)CreatorLayer::onSecretVault;
v63 = CCMenuItemSpriteExtra::create(v62, nullptr, v107);
v11->addChild(v11, v63);
v64 = v63->setPosition;
cocos2d::CCPoint::CCPoint(&v101, v97 - 22.0, v98 - 18.0);
v104 = cocos2d::CCNode::convertToNodeSpace(v11, &v101);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v64)(
v63,
&v102,
v104.x,
v104.y);
if ( !v60 )
{
v96 = v63->getContentSize(v63)->width * 0.5;
v85 = (__int64)v63->getContentSize(v63);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v100, v96, (float)(*(float *)(v85 + 4) * 0.5) + -22.0);
v86 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_diamondsIcon_001.png");
v62->addChild(v62, v86);
v87 = v86->setPosition;
cocos2d::CCPoint::CCPoint(&v101, 9.0, -1.0);
cocos2d::CCPoint::operator+(&v102, &v100, &v101);
v87(v86, &v102);
v86->setScale(v86, 0.7);
v88 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)&dword_30 + 2);
cocos2d::CCString::getCString(v88);
v89 = cocos2d::CCLabelBMFont::create();
v62->addChild(v62, v89);
v90 = v89->setPosition;
cocos2d::CCPoint::CCPoint(&v101, -8.5, 0.0);
cocos2d::CCPoint::operator+(&v102, &v100, &v101);
v90(v89, &v102);
v89->setScale(v89, 0.4);
}
CCMenuItemSpriteExtra::setSizeMult(v63, 2.0);
v65 = GameManager::sharedState();
if ( GameManager::getUGV(v65, "5") )
v66 = "secretDoorBtn_open_001.png";
else
v66 = "secretDoorBtn_closed_001.png";
v67 = cocos2d::CCSprite::createWithSpriteFrameName(v66);
a1->m_secretDoorSprite = v67;
v108.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v108.adj = (size_t)CreatorLayer::onTreasureRoom;
v68 = CCMenuItemSpriteExtra::create(v67, nullptr, v108);
v69 = v11->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v68->m_animationEnabled = 0;
addChild = v69->addChild;
v68->m_colorEnabled = 1;
addChild(v11, v68);
v71 = v68->setPosition;
cocos2d::CCPoint::CCPoint(&v101, v97 - 22.0, 24.0);
v105 = cocos2d::CCNode::convertToNodeSpace(v11, &v101);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v71)(
v68,
&v102,
v105.x,
v105.y);
CCMenuItemSpriteExtra::setSizeMult(v68, 1.2);
v72 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v109.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v109.adj = (size_t)CreatorLayer::onBack;
v73 = CCMenuItemSpriteExtra::create(v72, nullptr, v109);
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(&v102, v78 + 24.0, v80 - 23.0);
v75(v74, &v102);
GameManager::sharedState()->m_currentLevelID = 0;
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v73);
v81 = GameManager::sharedState();
if ( v81->m_playerUserID.random == v81->m_playerUserID.seed )
{
v82 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v82);
}
return v93;
}
}
}