//
// CreatorLayer::init from 0x1000da9fc to 0x1000db688 (3212 bytes)
//
// 2 xrefs:
// > CreatorLayer::create @ 0x1000da9b0
// > ??> @ 0x1008cf290
//
// 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 10:58:59 +0000
//
__int64 __fastcall CreatorLayer::init(__int64 *a1)
{
__int64 result; // x0
__int64 v3; // x0
__int64 v4; // x0
__int64 v5; // x0
float *v6; // x21
__int64 v7; // x0
__int64 v8; // x21
__int64 v9; // x0
float v10; // s0
float v11; // s2
_BOOL4 v12; // w8
_BOOL4 v13; // w9
float v14; // s8
float v15; // s9
__n128 v16; // q0
int v17; // w23
int v18; // w28
char v19; // w19
__int64 (__fastcall *v20)(); // x26
std::string *v21; // x1
__int64 v22; // x25
std::string *v23; // x0
__int64 v24; // x26
double v25; // d0
__int64 v26; // x0
_BOOL8 canCollectQuests; // x0
__int64 *v28; // x8
__int64 v29; // x0
__int64 v30; // x0
__int64 v31; // x0
int v32; // w0
int v33; // w8
__int64 v34; // x0
__int64 v35; // x0
__int64 v36; // x0
__int64 v37; // x23
__int64 v38; // x0
__int64 v39; // x0
double v40; // d0
float v41; // s8
__int64 v42; // x0
__int64 v43; // x0
float v44; // s0
__int64 v45; // x23
__int64 v46; // x0
__int64 v47; // x0
double v48; // d0
float v49; // s8
__int64 v50; // x0
__int64 v51; // x0
float v52; // s0
__int64 v53; // x23
__int64 v54; // x0
__int64 v55; // x0
double v56; // d0
float v57; // s8
__int64 v58; // x0
__int64 v59; // x0
float v60; // s0
__int64 v61; // x22
__int64 v62; // x0
__int64 v63; // x0
double v64; // d0
float v65; // s8
__int64 v66; // x0
__int64 v67; // x0
float v68; // s0
__int64 v69; // x0
int v70; // w0
int Stat; // w24
const char *v72; // x0
__int64 v73; // x23
__int64 v74; // x22
__n128 v75; // q0
float v76; // s8
__int64 v77; // x0
__int64 v78; // x24
double v79; // d0
__int64 v80; // x0
__int64 CString; // x0
__int64 v82; // x24
double v83; // d0
__int64 v84; // x0
__int64 v85; // x0
const char *v86; // x0
__int64 v87; // x0
_WORD *v88; // x22
__n128 v89; // q0
__int64 v90; // x0
__int64 v91; // x21
__int64 v92; // x22
__int64 v93; // x0
__int64 v94; // x0
double v95; // d0
float v96; // s8
__int64 v97; // x0
__int64 v98; // x0
float v99; // s0
__int64 v100; // x0
__int64 v101; // x0
__int64 v102; // x0
__int64 isControllerConnected; // x0
__int64 v104; // x0
__int64 v105; // x0
unsigned int v106; // [xsp+Ch] [xbp-E4h]
float32x2_t v107; // [xsp+20h] [xbp-D0h] BYREF
void *__p[2]; // [xsp+28h] [xbp-C8h] BYREF
char v109; // [xsp+3Fh] [xbp-B1h]
std::string v110; // [xsp+40h] [xbp-B0h] BYREF
float32x2_t v111; // [xsp+58h] [xbp-98h] BYREF
__int64 v112; // [xsp+60h] [xbp-90h] BYREF
result = cocos2d::CCLayer::init();
if ( (_DWORD)result )
{
v106 = result;
v3 = GameManager::sharedState(result);
*(_DWORD *)(v3 + 964) = -1;
*(_DWORD *)(GameManager::sharedState(v3) + 968) = -1;
(*(void (__fastcall **)(__int64 *, __int64))(*a1 + 1072))(a1, 1);
v4 = (*(__int64 (__fastcall **)(__int64 *, __int64))(*a1 + 1088))(a1, 1);
v5 = cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(&v112, v5);
v6 = (float *)cocos2d::CCSprite::create("GJ_gradientBG.png");
sub_1000262BC((float *)&v110, 0.0, 0.0);
(*(void (__fastcall **)(float *, std::string *))(*(_QWORD *)v6 + 296LL))(v6, &v110);
(*(void (__fastcall **)(__int64 *, float *, __int64))(*a1 + 464))(a1, v6, 4294967294LL);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v6 + 128LL))(v6, (float)(*(float *)&v112 + 10.0) / v6[108]);
(*(void (__fastcall **)(float *, float))(*(_QWORD *)v6 + 144LL))(
v6,
(float)(*((float *)&v112 + 1) + 10.0) / v6[109]);
sub_1000262BC((float *)&v110, -5.0, -5.0);
(*(void (__fastcall **)(float *, std::string *))(*(_QWORD *)v6 + 184LL))(v6, &v110);
v110.__r_.__value_.__s.__data_[2] = -1;
LOWORD(v110.__r_.__value_.__l.__data_) = 26112;
v7 = (*(__int64 (__fastcall **)(float *, std::string *))(*(_QWORD *)v6 + 960LL))(v6, &v110);
v8 = cocos2d::CCMenu::create(v7);
(*(void (__fastcall **)(__int64 *, __int64))(*a1 + 456))(a1, v8);
v9 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_searchBtn_001.png");
v10 = (float)(*(float *)&v112 + -100.0) / (float)((float)(*(float *)(v9 + 432) * 0.8) + 360.0);
v11 = 0.9;
v12 = v10 <= 0.9;
v13 = v10 < 1.0 || v10 <= 0.9;
if ( v10 >= 1.0 )
v12 = 1;
if ( !v13 )
v11 = 1.0;
if ( v12 )
v10 = v11;
v14 = v10 * 0.8;
v15 = v10 * 90.0;
sub_1000262BC((float *)&v110, *(float *)&v112 * 0.5, *((float *)&v112 + 1) * 0.5);
cocos2d::CCNode::convertToNodeSpace(&v111, v8, &v110, v16);
v17 = 0;
while ( 2 )
{
memset(&v110, 0, sizeof(v110));
switch ( v17 )
{
case 1:
std::string::assign(&v110, "GJ_savedBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onSavedLevels;
goto LABEL_34;
case 2:
std::string::assign(&v110, "GJ_highscoreBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onLeaderboards;
goto LABEL_34;
case 3:
std::string::assign(&v110, "GJ_challengeBtn_001.png");
v18 = 0;
v19 = 1;
v20 = CreatorLayer::onChallenge;
goto LABEL_34;
case 4:
std::string::assign(&v110, "GJ_versusBtn_001.png");
v20 = CreatorLayer::onMultiplayer;
goto LABEL_20;
case 5:
std::string::assign(&v110, "GJ_mapBtn_001.png");
v20 = CreatorLayer::onAdventureMap;
LABEL_20:
if ( (v110.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v21 = &v110;
else
v21 = (std::string *)v110.__r_.__value_.__r.__words[0];
sub_100009900(__p, (char *)v21);
v22 = CCSpriteGrayscale::createWithSpriteFrameName(__p);
if ( v109 < 0 )
operator delete(__p[0]);
CCSpriteWithHue::setEvenLuminance(v22, 1.0);
BYTE2(__p[0]) = -81;
LOWORD(__p[0]) = -20561;
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v22 + 960LL))(v22, __p);
v19 = 0;
v18 = 0;
goto LABEL_38;
case 6:
std::string::assign(&v110, "GJ_dailyBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onDailyLevel;
goto LABEL_34;
case 7:
std::string::assign(&v110, "GJ_weeklyBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onWeeklyLevel;
goto LABEL_34;
case 8:
std::string::assign(&v110, "GJ_eventBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onEventLevel;
goto LABEL_34;
case 9:
std::string::assign(&v110, "GJ_gauntletsBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onGauntlets;
goto LABEL_34;
case 10:
std::string::assign(&v110, "GJ_featuredBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onFeaturedLevels;
goto LABEL_34;
case 11:
std::string::assign(&v110, "GJ_listsBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onTopLists;
goto LABEL_34;
case 12:
std::string::assign(&v110, "GJ_pathsBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onPaths;
goto LABEL_34;
case 13:
std::string::assign(&v110, "GJ_mapPacksBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onMapPacks;
goto LABEL_34;
case 14:
std::string::assign(&v110, "GJ_searchBtn_001.png");
v19 = 0;
v18 = 1;
v20 = CreatorLayer::onOnlineLevels;
goto LABEL_34;
default:
std::string::assign(&v110, "GJ_createBtn_001.png");
v18 = 0;
v19 = 0;
v20 = CreatorLayer::onMyLevels;
LABEL_34:
if ( (v110.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &v110;
else
v23 = (std::string *)v110.__r_.__value_.__r.__words[0];
v22 = cocos2d::CCSprite::createWithSpriteFrameName(v23);
LABEL_38:
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v22 + 160LL))(v22, v14);
v24 = CCMenuItemSpriteExtra::create(v22, 0, a1, v20, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 456LL))(v8, v24);
sub_1000262BC(
(float *)&v107,
(float)(v15 * -0.5) + (float)((float)((float)((unsigned __int8)v17 % 5u) + -1.5) * v15),
-(float)((float)(floorf((float)(unsigned int)v17 / 5.0) + -1.0) * v15));
*(float32x2_t *)&v25 = sub_100026318(&v111, &v107, (float32x2_t *)__p);
v26 = (*(__int64 (__fastcall **)(__int64, void **, double))(*(_QWORD *)v24 + 184LL))(v24, __p, v25);
if ( (v19 & 1) != 0 )
{
a1[55] = v22;
canCollectQuests = ChallengesPage::canCollectQuests(v26);
v26 = sub_1000DC620(v22, canCollectQuests);
}
if ( v17 > 7 )
{
v28 = a1 + 58;
if ( v17 != 8 )
{
if ( v17 != 9 )
goto LABEL_48;
v28 = a1 + 59;
}
LABEL_47:
*v28 = v22;
goto LABEL_48;
}
v28 = a1 + 56;
if ( v17 == 6 )
goto LABEL_47;
v28 = a1 + 57;
if ( v17 == 7 )
goto LABEL_47;
LABEL_48:
v29 = GameManager::sharedState(v26);
v30 = GameManager::offlineModeEnabled(v29);
if ( (_DWORD)v30 )
{
if ( (unsigned int)v17 > 0xC || ((1 << v17) & 0x100B) == 0 )
goto LABEL_56;
}
else
{
v31 = GameManager::sharedState(v30);
v32 = GameManager::onlyCuratedLevels(v31);
if ( v17 == 11 )
v33 = 1;
else
v33 = v18;
if ( (v33 & v32) == 1 )
{
LABEL_56:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 1056LL))(v24, 0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 344LL))(v24, 0);
}
}
if ( SHIBYTE(v110.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v110.__r_.__value_.__l.__data_);
if ( ++v17 != 15 )
continue;
CreatorLayer::checkTimedStatus(a1);
v34 = GameLevelManager::sharedState();
if ( (*(_BYTE *)(v34 + 912) & 1) == 0 )
{
v35 = GameManager::sharedState(v34);
if ( (GameManager::offlineModeEnabled(v35) & 1) == 0 )
{
*(_QWORD *)(GameLevelManager::sharedState() + 1440) = a1 + 53;
v36 = GameLevelManager::sharedState();
GameLevelManager::getGJContentStatus(v36);
}
}
v37 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
sub_1000262BC((float *)&v110, 0.0, 0.0);
v38 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v37 + 296LL))(v37, &v110);
v39 = cocos2d::CCDirector::sharedDirector(v38);
v40 = sub_100207EA8(v39);
v41 = *(float *)&v40 + -1.0;
v43 = cocos2d::CCDirector::sharedDirector(v42);
v44 = sub_100207EA0(v43);
sub_1000262BC((float *)&v110, v41, v44 + -1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v37 + 184LL))(v37, &v110);
(*(void (__fastcall **)(__int64 *, __int64, __int64))(*a1 + 464))(a1, v37, 1);
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
sub_1000262BC((float *)&v110, 1.0, 0.0);
v46 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v45 + 296LL))(v45, &v110);
v47 = cocos2d::CCDirector::sharedDirector(v46);
v48 = sub_100207EB0(v47);
v49 = *(float *)&v48 + 1.0;
v51 = cocos2d::CCDirector::sharedDirector(v50);
v52 = sub_100207EA0(v51);
sub_1000262BC((float *)&v110, v49, v52 + -1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v45 + 184LL))(v45, &v110);
cocos2d::CCSprite::setFlipX(v45, 1);
v53 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
sub_1000262BC((float *)&v110, 0.0, 1.0);
v54 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v53 + 296LL))(v53, &v110);
v55 = cocos2d::CCDirector::sharedDirector(v54);
v56 = sub_100207EA8(v55);
v57 = *(float *)&v56 + -1.0;
v59 = cocos2d::CCDirector::sharedDirector(v58);
v60 = sub_100207E98(v59);
sub_1000262BC((float *)&v110, v57, v60 + 1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v53 + 184LL))(v53, &v110);
cocos2d::CCSprite::setFlipY(v53, 1);
(*(void (__fastcall **)(__int64 *, __int64, __int64))(*a1 + 464))(a1, v53, 0xFFFFFFFFLL);
v61 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_sideArt_001.png");
sub_1000262BC((float *)&v110, 1.0, 1.0);
v62 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v61 + 296LL))(v61, &v110);
v63 = cocos2d::CCDirector::sharedDirector(v62);
v64 = sub_100207EB0(v63);
v65 = *(float *)&v64 + 1.0;
v67 = cocos2d::CCDirector::sharedDirector(v66);
v68 = sub_100207E98(v67);
sub_1000262BC((float *)&v110, v65, v68 + 1.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v61 + 184LL))(v61, &v110);
cocos2d::CCSprite::setFlipY(v61, 1);
v69 = cocos2d::CCSprite::setFlipX(v61, 1);
v70 = GameStatsManager::sharedState(v69);
Stat = GameStatsManager::getStat(v70, "13");
if ( Stat <= 49 )
v72 = "GJ_lockGray_001.png";
else
v72 = "GJ_lock_open_001.png";
v73 = cocos2d::CCSprite::createWithSpriteFrameName(v72);
v74 = CCMenuItemSpriteExtra::create(v73, 0, a1, CreatorLayer::onSecretVault, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 456LL))(v8, v74);
sub_1000262BC((float *)__p, *(float *)&v112 + -22.0, *((float *)&v112 + 1) + -18.0);
cocos2d::CCNode::convertToNodeSpace(&v110, v8, __p, v75);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v74 + 184LL))(v74, &v110);
if ( Stat <= 49 )
{
v76 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v74 + 328LL))(v74) * 0.5;
v77 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v74 + 328LL))(v74);
sub_1000262BC((float *)&v110, v76, (float)(*(float *)(v77 + 4) * 0.5) + -22.0);
v78 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_diamondsIcon_001.png");
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v73 + 456LL))(v73, v78);
sub_1000262BC((float *)&v107, 9.0, -1.0);
*(float32x2_t *)&v79 = sub_100026318((float32x2_t *)&v110, &v107, (float32x2_t *)__p);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v78 + 184LL))(v78, __p, v79);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v78 + 160LL))(v78, 0.7);
v80 = sub_1003065B0("%i", 50);
CString = cocos2d::CCString::getCString(v80);
v82 = cocos2d::CCLabelBMFont::create_1(CString, "bigFont.fnt");
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v73 + 456LL))(v73, v82);
sub_1000262BC((float *)&v107, -8.5, 0.0);
*(float32x2_t *)&v83 = sub_100026318((float32x2_t *)&v110, &v107, (float32x2_t *)__p);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v82 + 184LL))(v82, __p, v83);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v82 + 160LL))(v82, 0.4);
}
v84 = CCMenuItemSpriteExtra::setSizeMult(2.0);
v85 = GameManager::sharedState(v84);
if ( (unsigned int)GameManager::getUGV(v85, "5") )
v86 = "secretDoorBtn_open_001.png";
else
v86 = "secretDoorBtn_closed_001.png";
v87 = cocos2d::CCSprite::createWithSpriteFrameName(v86);
a1[54] = v87;
v88 = (_WORD *)CCMenuItemSpriteExtra::create(v87, 0, a1, CreatorLayer::onTreasureRoom, 0);
v88[204] = 256;
(*(void (__fastcall **)(__int64, _WORD *))(*(_QWORD *)v8 + 456LL))(v8, v88);
sub_1000262BC((float *)__p, *(float *)&v112 + -22.0, 24.0);
cocos2d::CCNode::convertToNodeSpace(&v110, v8, __p, v89);
(*(void (__fastcall **)(_WORD *, std::string *))(*(_QWORD *)v88 + 184LL))(v88, &v110);
CCMenuItemSpriteExtra::setSizeMult(1.2);
v90 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_03_001.png");
v91 = CCMenuItemSpriteExtra::create(v90, 0, a1, CreatorLayer::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult(1.6);
v92 = sub_100270434(v91);
v93 = (*(__int64 (__fastcall **)(__int64 *, __int64, __int64))(*a1 + 464))(a1, v92, 1);
v94 = cocos2d::CCDirector::sharedDirector(v93);
v95 = sub_100207EA8(v94);
v96 = *(float *)&v95 + 24.0;
v98 = cocos2d::CCDirector::sharedDirector(v97);
v99 = sub_100207E98(v98);
sub_1000262BC((float *)&v110, v96, v99 + -23.0);
v100 = (*(__int64 (__fastcall **)(__int64, std::string *))(*(_QWORD *)v92 + 184LL))(v92, &v110);
v101 = GameManager::sharedState(v100);
*(_DWORD *)(v101 + 964) = 0;
v102 = GameManager::sharedState(v101);
*(_DWORD *)(v102 + 968) = 0;
isControllerConnected = PlatformToolbox::isControllerConnected(v102);
if ( (_DWORD)isControllerConnected )
isControllerConnected = GameToolbox::addBackButton((__int64)a1, v91);
v104 = GameManager::sharedState(isControllerConnected);
if ( *(_DWORD *)(v104 + 660) == *(_DWORD *)(v104 + 664) )
{
v105 = GameLevelManager::sharedState();
GameLevelManager::updateUserScore(v105);
}
result = v106;
break;
}
break;
}
}
return result;
}