//
// CreatorLayer::init from 0x1000b5078 to 0x1000b5c30 (3000 bytes)
//
// 2 xrefs:
// > CreatorLayer::create @ 0x1000b502c
// > ??> @ 0x100781670
//
// 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 __fastcall CreatorLayer::init(CreatorLayer *a1)
{
_BOOL4 v2; // w0
cocos2d::CCDirector *v3; // x0
cocos2d::CCSprite *v4; // x21
__n128 v5; // q0
__n128 v6; // q1
__n128 v7; // q0
__n128 v8; // q1
cocos2d::CCMenu *v9; // x21
cocos2d::CCSprite *v10; // x0
__n128 v11; // q1
__n128 v12; // q0
float v13; // s2
_BOOL4 v14; // w8
_BOOL4 v15; // w9
float v16; // s8
float v17; // s9
unsigned int v18; // w26
int v19; // w19
char v20; // w24
void (__cdecl *v21)(cocos2d::CCObject *); // x23
std::string *v22; // x1
CCSpriteWithHue *v23; // x28
std::string *v24; // x0
CCMenuItemSpriteExtra *v25; // x23
__n128 v26; // q0
__n128 v27; // q1
double v28; // d0
GameManager *v29; // x0
cocos2d::CCSprite *v30; // x23
__n128 v31; // q0
__n128 v32; // q1
cocos2d::CCDirector *v33; // x0
float v34; // s8
cocos2d::CCDirector *v35; // x0
__n128 v36; // q0
__n128 v37; // q1
cocos2d::CCSprite *v38; // x23
__n128 v39; // q0
__n128 v40; // q1
cocos2d::CCDirector *v41; // x0
float v42; // s8
cocos2d::CCDirector *v43; // x0
__n128 v44; // q0
__n128 v45; // q1
cocos2d::CCSprite *v46; // x23
__n128 v47; // q0
__n128 v48; // q1
cocos2d::CCDirector *v49; // x0
float v50; // s8
cocos2d::CCDirector *v51; // x0
__n128 v52; // q0
__n128 v53; // q1
cocos2d::CCSprite *v54; // x22
__n128 v55; // q0
__n128 v56; // q1
cocos2d::CCDirector *v57; // x0
float v58; // s8
cocos2d::CCDirector *v59; // x0
__n128 v60; // q0
__n128 v61; // q1
GameStatsManager *v62; // x0
int Stat; // w24
const char *v64; // x0
cocos2d::CCSprite *v65; // x23
CCMenuItemSpriteExtra *v66; // x22
__n128 v67; // q0
__n128 v68; // q1
float v69; // s8
__n128 v70; // q1
__n128 v71; // q0
cocos2d::CCSprite *v72; // x24
__n128 v73; // q0
__n128 v74; // q1
double v75; // d0
cocos2d::CCString *v76; // x0
const char *CString; // x0
cocos2d::CCLabelBMFont *v78; // x24
__n128 v79; // q0
__n128 v80; // q1
double v81; // d0
GameManager *v82; // x0
const char *v83; // x0
cocos2d::CCSprite *v84; // x0
CCMenuItemSpriteExtra *v85; // x22
__n128 v86; // q0
__n128 v87; // q1
cocos2d::CCSprite *v88; // x0
CCMenuItemSpriteExtra *v89; // x21
__int64 v90; // x22
cocos2d::CCDirector *v91; // x0
float v92; // s8
cocos2d::CCDirector *v93; // x0
__n128 v94; // q0
__n128 v95; // q1
GameManager *v96; // x0
GameLevelManager *v97; // x0
bool v99; // [xsp+14h] [xbp-CCh]
float32x2_t v100; // [xsp+18h] [xbp-C8h] BYREF
void *__p[2]; // [xsp+20h] [xbp-C0h] BYREF
char v102; // [xsp+37h] [xbp-A9h]
std::string v103; // [xsp+38h] [xbp-A8h] BYREF
float32x2_t v104; // [xsp+50h] [xbp-90h] BYREF
float v105; // [xsp+58h] [xbp-88h]
float v106; // [xsp+5Ch] [xbp-84h]
cocos2d::CCPoint v107; // 0:kr10_8.8
cocos2d::CCPoint v108; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v109; // 0:x3.16
cocos2d::SEL_MenuHandler v110; // 0:x3.16
cocos2d::SEL_MenuHandler v111; // 0:x3.16
cocos2d::SEL_MenuHandler v112; // 0:x3.16
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v99 = v2;
GameManager::sharedState()->m_currentLevelID = -1;
((void (__fastcall *)(CreatorLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(CreatorLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
v4 = cocos2d::CCSprite::create("GJ_gradientBG.png");
v5.n128_u32[0] = 0;
v6.n128_u32[0] = 0;
sub_100022980(v5, v6, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v4->setAnchorPoint)(v4, &v103);
((void (__fastcall *)(CreatorLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v4, 4294967294LL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v4->setScaleX)(v4, (float)(v105 + 10.0) / v4->m_obRect.size.width);
v7 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v4->setScaleY)(
v4,
(float)(v106 + 10.0) / v4->m_obRect.size.height);
v7.n128_u32[0] = -5.0;
v8.n128_u32[0] = -5.0;
sub_100022980(v7, v8, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v4->setPosition)(v4, &v103);
v103.__r_.__value_.__s.__data_[2] = -1;
LOWORD(v103.__r_.__value_.__l.__data_) = 26112;
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v4->setColor)(v4, &v103);
v9 = cocos2d::CCMenu::create();
((void (__fastcall *)(CreatorLayer *, cocos2d::CCMenu *))a1->addChild)(a1, v9);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_searchBtn_001.png");
v12.n128_f32[0] = (float)(v105 + -100.0) / (float)((float)(v10->m_obRect.size.width * 0.8) + 360.0);
v13 = 0.9;
v14 = v12.n128_f32[0] <= 0.9;
v15 = v12.n128_f32[0] < 1.0 || v12.n128_f32[0] <= 0.9;
if ( v12.n128_f32[0] >= 1.0 )
v14 = 1;
if ( !v15 )
v13 = 1.0;
if ( v14 )
v12.n128_f32[0] = v13;
v16 = v12.n128_f32[0] * 0.8;
v17 = v12.n128_f32[0] * 90.0;
v12.n128_f32[0] = v105 * 0.5;
v11.n128_f32[0] = v106 * 0.5;
sub_100022980(v12, v11, &v103);
cocos2d::CCNode::convertToNodeSpace(v9, (const cocos2d::CCPoint *)&v103);
v18 = 0;
while ( 2 )
{
memset(&v103, 0, sizeof(v103));
switch ( v18 )
{
case 1u:
std::string::assign(&v103, "GJ_savedBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onSavedLevels;
goto LABEL_34;
case 2u:
std::string::assign(&v103, "GJ_highscoreBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onLeaderboards;
goto LABEL_34;
case 3u:
std::string::assign(&v103, "GJ_challengeBtn_001.png");
v19 = 0;
v20 = 1;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onChallenge;
goto LABEL_34;
case 4u:
std::string::assign(&v103, "GJ_versusBtn_001.png");
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onMultiplayer;
goto LABEL_20;
case 5u:
std::string::assign(&v103, "GJ_mapBtn_001.png");
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onAdventureMap;
LABEL_20:
if ( (v103.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v22 = &v103;
else
v22 = (std::string *)v103.__r_.__value_.__r.__words[0];
sub_100009900(__p, (char *)v22);
v23 = (CCSpriteWithHue *)CCSpriteGrayscale::createWithSpriteFrameName(__p);
if ( v102 < 0 )
operator delete(__p[0]);
CCSpriteWithHue::setEvenLuminance(v23, 1.0);
BYTE2(__p[0]) = -81;
LOWORD(__p[0]) = -20561;
((void (__fastcall *)(CCSpriteWithHue *, void **))v23->setColor)(v23, __p);
v20 = 0;
v19 = 0;
goto LABEL_38;
case 6u:
std::string::assign(&v103, "GJ_dailyBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onDailyLevel;
goto LABEL_34;
case 7u:
std::string::assign(&v103, "GJ_weeklyBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onWeeklyLevel;
goto LABEL_34;
case 8u:
std::string::assign(&v103, "GJ_eventBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onEventLevel;
goto LABEL_34;
case 9u:
std::string::assign(&v103, "GJ_gauntletsBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onGauntlets;
goto LABEL_34;
case 0xAu:
std::string::assign(&v103, "GJ_featuredBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onFeaturedLevels;
goto LABEL_34;
case 0xBu:
std::string::assign(&v103, "GJ_listsBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onTopLists;
goto LABEL_34;
case 0xCu:
std::string::assign(&v103, "GJ_pathsBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onPaths;
goto LABEL_34;
case 0xDu:
std::string::assign(&v103, "GJ_mapPacksBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onMapPacks;
goto LABEL_34;
case 0xEu:
std::string::assign(&v103, "GJ_searchBtn_001.png");
v20 = 0;
v19 = 1;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onOnlineLevels;
goto LABEL_34;
default:
std::string::assign(&v103, "GJ_createBtn_001.png");
v19 = 0;
v20 = 0;
v21 = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onMyLevels;
LABEL_34:
if ( (v103.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v24 = &v103;
else
v24 = (std::string *)v103.__r_.__value_.__r.__words[0];
v23 = (CCSpriteWithHue *)cocos2d::CCSprite::createWithSpriteFrameName((const char *)v24);
LABEL_38:
((void (__fastcall *)(CCSpriteWithHue *, float))v23->setScale)(v23, v16);
v109.ptr = v21;
v109.adj = 0;
v25 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, v109);
v26 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v9->addChild)(v9, v25);
v26.n128_f32[0] = (float)(v17 * -0.5) + (float)((float)((float)((unsigned __int8)v18 % 5u) + -1.5) * v17);
v27.n128_f32[0] = -(float)((float)(floorf((float)v18 / 5.0) + -1.0) * v17);
sub_100022980(v26, v27, &v100);
*(float32x2_t *)&v28 = sub_1000229DC(&v104, &v100, (float32x2_t *)__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, void **, double))v25->setPosition)(v25, __p, v28);
if ( (v20 & 1) != 0 )
{
a1->m_questsSprite = v23;
CreatorLayer::checkQuestsStatus(a1);
}
if ( v19 )
{
v29 = GameManager::sharedState();
if ( GameManager::getGameVariable(v29, "0077") )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v25->setEnabled)(v25, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v25->setVisible)(v25, 0);
}
}
if ( SHIBYTE(v103.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v103.__r_.__value_.__l.__data_);
if ( ++v18 != 15 )
continue;
v30 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v31.n128_u32[0] = 0;
v32.n128_u32[0] = 0;
sub_100022980(v31, v32, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v30->setAnchorPoint)(v30, &v103);
v33 = cocos2d::CCDirector::sharedDirector();
v34 = sub_1001768D8(v33) + -1.0;
v35 = cocos2d::CCDirector::sharedDirector();
v36.n128_f64[0] = sub_1001768D0(v35);
v37.n128_f32[0] = v36.n128_f32[0] + -1.0;
v36.n128_f32[0] = v34;
sub_100022980(v36, v37, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v30->setPosition)(v30, &v103);
((void (__fastcall *)(CreatorLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v30, 1);
v38 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v39.n128_u32[0] = 1.0;
v40.n128_u32[0] = 0;
sub_100022980(v39, v40, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v38->setAnchorPoint)(v38, &v103);
v41 = cocos2d::CCDirector::sharedDirector();
v42 = sub_1001768E0(v41) + 1.0;
v43 = cocos2d::CCDirector::sharedDirector();
v44.n128_f64[0] = sub_1001768D0(v43);
v45.n128_f32[0] = v44.n128_f32[0] + -1.0;
v44.n128_f32[0] = v42;
sub_100022980(v44, v45, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v38->setPosition)(v38, &v103);
cocos2d::CCSprite::setFlipX(v38, 1);
v46 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v47.n128_u32[0] = 0;
v48.n128_u32[0] = 1.0;
sub_100022980(v47, v48, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v46->setAnchorPoint)(v46, &v103);
v49 = cocos2d::CCDirector::sharedDirector();
v50 = sub_1001768D8(v49) + -1.0;
v51 = cocos2d::CCDirector::sharedDirector();
v52.n128_f64[0] = sub_1001768C8(v51);
v53.n128_f32[0] = v52.n128_f32[0] + 1.0;
v52.n128_f32[0] = v50;
sub_100022980(v52, v53, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v46->setPosition)(v46, &v103);
cocos2d::CCSprite::setFlipY(v46, 1);
((void (__fastcall *)(CreatorLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v46, 0xFFFFFFFFLL);
v54 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
v55.n128_u32[0] = 1.0;
v56.n128_u32[0] = 1.0;
sub_100022980(v55, v56, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v54->setAnchorPoint)(v54, &v103);
v57 = cocos2d::CCDirector::sharedDirector();
v58 = sub_1001768E0(v57) + 1.0;
v59 = cocos2d::CCDirector::sharedDirector();
v60.n128_f64[0] = sub_1001768C8(v59);
v61.n128_f32[0] = v60.n128_f32[0] + 1.0;
v60.n128_f32[0] = v58;
sub_100022980(v60, v61, &v103);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))v54->setPosition)(v54, &v103);
cocos2d::CCSprite::setFlipY(v54, 1);
cocos2d::CCSprite::setFlipX(v54, 1);
v62 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v62, "13");
if ( Stat <= 49 )
v64 = "GJ_lockGray_001.png";
else
v64 = "GJ_lock_open_001.png";
v65 = cocos2d::CCSprite::createWithSpriteFrameName(v64);
v110.ptr = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onSecretVault;
v110.adj = 0;
v66 = CCMenuItemSpriteExtra::create(v65, nullptr, a1, v110);
v67 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v9->addChild)(v9, v66);
v67.n128_f32[0] = v105 + -22.0;
v68.n128_f32[0] = v106 + -18.0;
sub_100022980(v67, v68, __p);
v107 = cocos2d::CCNode::convertToNodeSpace(v9, (const cocos2d::CCPoint *)__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v66->setPosition)(
v66,
&v103,
v107.x,
v107.y);
if ( Stat <= 49 )
{
v69 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v66->getContentSize)(v66) * 0.5;
v70.n128_f32[0] = (float)(*(float *)(((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v66->getContentSize)(v66)
+ 4)
* 0.5)
+ -22.0;
v71.n128_f32[0] = v69;
sub_100022980(v71, v70, &v103);
v72 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_diamondsIcon_001.png");
v73 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *))v65->addChild)(v65, v72);
v73.n128_u32[0] = 9.0;
v74.n128_u32[0] = -1.0;
sub_100022980(v73, v74, &v100);
*(float32x2_t *)&v75 = sub_1000229DC((float32x2_t *)&v103, &v100, (float32x2_t *)__p);
((void (__fastcall *)(cocos2d::CCSprite *, void **, double))v72->setPosition)(v72, __p, v75);
((void (__fastcall *)(cocos2d::CCSprite *, float))v72->setScale)(v72, 0.7);
v76 = (cocos2d::CCString *)sub_100268F4C("%i", 50);
CString = cocos2d::CCString::getCString(v76);
v78 = cocos2d::CCLabelBMFont::create_1(CString, "bigFont.fnt");
v79 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCLabelBMFont *))v65->addChild)(v65, v78);
v79.n128_u32[0] = -8.5;
v80.n128_u32[0] = 0;
sub_100022980(v79, v80, &v100);
*(float32x2_t *)&v81 = sub_1000229DC((float32x2_t *)&v103, &v100, (float32x2_t *)__p);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void **, double))v78->setPosition)(v78, __p, v81);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v78->setScale)(v78, 0.4);
}
CCMenuItemSpriteExtra::setSizeMult(v66, 2.0);
v82 = GameManager::sharedState();
if ( GameManager::getUGV(v82, "5") )
v83 = "secretDoorBtn_open_001.png";
else
v83 = "secretDoorBtn_closed_001.png";
v84 = cocos2d::CCSprite::createWithSpriteFrameName(v83);
a1->m_secretDoorSprite = v84;
v111.ptr = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onTreasureRoom;
v111.adj = 0;
v85 = CCMenuItemSpriteExtra::create(v84, nullptr, a1, v111);
*(_WORD *)&v85->m_animationEnabled = 256;
v86 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v9->addChild)(v9, v85);
v86.n128_f32[0] = v105 + -22.0;
v87.n128_u32[0] = 24.0;
sub_100022980(v86, v87, __p);
v108 = cocos2d::CCNode::convertToNodeSpace(v9, (const cocos2d::CCPoint *)__p);
((void (__fastcall *)(CCMenuItemSpriteExtra *, std::string *, float, float))v85->setPosition)(
v85,
&v103,
v108.x,
v108.y);
CCMenuItemSpriteExtra::setSizeMult(v85, 1.2);
v88 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v112.ptr = (void (__cdecl *)(cocos2d::CCObject *))CreatorLayer::onBack;
v112.adj = 0;
v89 = CCMenuItemSpriteExtra::create(v88, nullptr, a1, v112);
CCMenuItemSpriteExtra::setSizeMult(v89, 1.6);
v90 = sub_1001D7ED0(v89);
((void (__fastcall *)(CreatorLayer *, __int64, __int64))a1->addChild_0)(a1, v90, 1);
v91 = cocos2d::CCDirector::sharedDirector();
v92 = sub_1001768D8(v91) + 24.0;
v93 = cocos2d::CCDirector::sharedDirector();
v94.n128_f64[0] = sub_1001768C8(v93);
v95.n128_f32[0] = v94.n128_f32[0] + -23.0;
v94.n128_f32[0] = v92;
sub_100022980(v94, v95, &v103);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v90 + 184LL))(v90, &v103);
GameManager::sharedState()->m_currentLevelID = 0;
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v89);
v96 = GameManager::sharedState();
if ( v96->m_playerUserID.random == v96->m_playerUserID.seed )
{
v97 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v97);
}
LOBYTE(v2) = v99;
break;
}
break;
}
}
return v2;
}