//
// SecretLayer4::init from 0x622b90 to 0x6233ce (2110 bytes)
//
// 1 xrefs:
// > SecretLayer4::create @ 0x620d54
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:55:07 +0000
//
int __fastcall SecretLayer4::init(SecretLayer4 *this)
{
cocos2d::CCTextureCache *v2; // r0
cocos2d::CCTextureCache *v3; // r10
cocos2d::CCTextureCache *v4; // r0
cocos2d::CCSpriteFrameCache *v5; // r0
cocos2d::CCSpriteFrameCache *v6; // r0
GameManager *v7; // r0
FMODAudioEngine *v8; // r6
cocos2d::CCDirector *v9; // r0
cocos2d::CCDictionary *WinSize; // r0
cocos2d::CCObject *v11; // r0
AchievementManager *v12; // r0
AchievementManager *v13; // r0
AchievementManager *isAchievementEarned; // r0
cocos2d::CCDictionary *v15; // r6
cocos2d::CCObject *v16; // r0
AchievementManager *v17; // r0
AchievementManager *v18; // r0
cocos2d::CCDictionary *v19; // r6
cocos2d::CCObject *v20; // r0
AchievementManager *v21; // r0
AchievementManager *v22; // r0
cocos2d::CCDictionary *v23; // r6
cocos2d::CCObject *v24; // r0
AchievementManager *v25; // r0
AchievementManager *v26; // r0
cocos2d::CCDictionary *v27; // r6
cocos2d::CCObject *v28; // r0
AchievementManager *v29; // r0
AchievementManager *v30; // r0
cocos2d::CCDictionary *v31; // r6
cocos2d::CCObject *v32; // r0
AchievementManager *v33; // r0
AchievementManager *v34; // r0
cocos2d::CCDictionary *v35; // r6
cocos2d::CCObject *v36; // r0
AchievementManager *v37; // r0
GameManager *v38; // r0
cocos2d::CCDictionary *v39; // r6
cocos2d::CCObject *v40; // r0
GameManager *v41; // r0
const char *v42; // r1
cocos2d::CCSequence *v43; // r0
cocos2d::CCSequence *v44; // r8
cocos2d::CCFiniteTimeAction *v45; // r0
cocos2d::CCAction *v46; // r0
float *v47; // r8
void (__fastcall *v48)(float *, _DWORD *); // r9
void (__fastcall *v49)(float *, _DWORD *); // r9
void (__fastcall *v50)(float *, _DWORD *); // r3
const char *v51; // r2
int v52; // r8
void (__fastcall *v53)(int, _DWORD *); // r11
const char *v54; // r2
int v55; // r0
int v56; // r3
int v57; // r11
int v58; // r9
int *v59; // r0
int v60; // r3
int v61; // r8
const char *v62; // r1
int v63; // r0
cocos2d::CCMenu *v64; // r8
const cocos2d::CCPoint *v65; // r9
cocos2d::CCDirector *v66; // r0
int (__fastcall *v67)(const cocos2d::CCPoint *, _DWORD *); // r11
cocos2d::CCDirector *v68; // r0
float v69; // s18
cocos2d::CCDirector *v70; // r0
float v71; // s14
PlatformToolbox *v72; // r0
cocos2d::CCNode *isControllerConnected; // r0
cocos2d::CCMenuItem *v74; // r2
int v75; // r6
void (__fastcall *v76)(int, _DWORD *); // r8
const char *v77; // r1
int v78; // r8
int v79; // r0
GameStatsManager *v80; // r0
int v81; // r0
int v82; // r9
int isSpecialChestUnlocked; // r8
cocos2d::CCMenu *v84; // r0
const cocos2d::CCPoint *v85; // r9
GameStatsManager *v86; // r0
int v87; // r0
int v88; // r11
int RewardForSpecialChest; // r8
int v90; // r1
cocos2d::CCSprite *v91; // r8
int v92; // r0
_DWORD *v93; // r4
void (__fastcall *v94)(_DWORD *, _BYTE *); // r5
void (__fastcall *v95)(cocos2d::CCSprite *, _BYTE *); // r5
float v96; // s17
int v97; // r0
void (__fastcall *v98)(_DWORD *, _BYTE *); // r7
char *v99; // r1
size_t v100; // r2
const char *v102; // [sp+8h] [bp-84h]
void (__fastcall *v103)(int, _DWORD *); // [sp+Ch] [bp-80h]
void (__fastcall *v104)(int, _DWORD *); // [sp+Ch] [bp-80h]
void (__fastcall *v105)(int, _DWORD *); // [sp+14h] [bp-78h]
int v106; // [sp+14h] [bp-78h]
float v107; // [sp+18h] [bp-74h] BYREF
float v108; // [sp+1Ch] [bp-70h]
_BYTE v109[8]; // [sp+20h] [bp-6Ch] BYREF
_BYTE v110[8]; // [sp+28h] [bp-64h] BYREF
_BYTE v111[8]; // [sp+30h] [bp-5Ch] BYREF
_BYTE v112[8]; // [sp+38h] [bp-54h] BYREF
unsigned int (__fastcall *v113)(SecretLayer4 *); // [sp+40h] [bp-4Ch]
int v114; // [sp+44h] [bp-48h]
int (__fastcall *v115)(SecretLayer4 *, cocos2d::CCObject *); // [sp+48h] [bp-44h]
int v116; // [sp+4Ch] [bp-40h]
_DWORD v117[2]; // [sp+50h] [bp-3Ch] BYREF
int v118; // [sp+58h] [bp-34h] BYREF
size_t v119; // [sp+5Ch] [bp-30h]
int v120; // [sp+60h] [bp-2Ch]
_BYTE v121[16]; // [sp+64h] [bp-28h] BYREF
_DWORD v122[4]; // [sp+74h] [bp-18h] BYREF
v2 = (cocos2d::CCTextureCache *)cocos2d::CCLayer::init(this);
v3 = v2;
if ( v2 )
{
v4 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v2);
v5 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCTextureCache::addImage(v4, "SecretSheet.png", 0);
v6 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v5);
v7 = (GameManager *)cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v6, "SecretSheet.plist");
v118 = 0;
v119 = 0;
v120 = 0;
v8 = (FMODAudioEngine *)GameManager::sharedState(v7);
std::string::__init(&v118, "secretLoop03.mp3", 0x10u);
GameManager::fadeInMusic(v8, (unsigned __int8 *)&v118);
std::string::~string((int)&v118);
(*(void (__fastcall **)(SecretLayer4 *, int))(*(_DWORD *)this + 536))(this, 1);
v9 = (cocos2d::CCDirector *)(*(int (__fastcall **)(SecretLayer4 *, int))(*(_DWORD *)this + 544))(this, 1);
cocos2d::CCDirector::sharedDirector(v9);
WinSize = (cocos2d::CCDictionary *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v107);
v11 = (cocos2d::CCObject *)cocos2d::CCDictionary::create(WinSize);
*((_DWORD *)this + 91) = v11;
v12 = (AchievementManager *)cocos2d::CCObject::retain(v11);
v13 = (AchievementManager *)AchievementManager::sharedState(v12);
isAchievementEarned = (AchievementManager *)AchievementManager::isAchievementEarned(v13, "geometry.ach.v3.secret01");
if ( !isAchievementEarned )
{
v15 = *((cocos2d::CCDictionary **)this + 91);
v16 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 1);
isAchievementEarned = (AchievementManager *)cocos2d::CCDictionary::setObject(v15, v16, 1);
}
v17 = (AchievementManager *)AchievementManager::sharedState(isAchievementEarned);
v18 = (AchievementManager *)AchievementManager::isAchievementEarned(v17, "geometry.ach.v3.secret02");
if ( !v18 )
{
v19 = *((cocos2d::CCDictionary **)this + 91);
v20 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 2);
v18 = (AchievementManager *)cocos2d::CCDictionary::setObject(v19, v20, 2);
}
v21 = (AchievementManager *)AchievementManager::sharedState(v18);
v22 = (AchievementManager *)AchievementManager::isAchievementEarned(v21, "geometry.ach.v3.secret03");
if ( !v22 )
{
v23 = *((cocos2d::CCDictionary **)this + 91);
v24 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 3);
v22 = (AchievementManager *)cocos2d::CCDictionary::setObject(v23, v24, 3);
}
v25 = (AchievementManager *)AchievementManager::sharedState(v22);
v26 = (AchievementManager *)AchievementManager::isAchievementEarned(v25, "geometry.ach.v3.secret04");
if ( !v26 )
{
v27 = *((cocos2d::CCDictionary **)this + 91);
v28 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 4);
v26 = (AchievementManager *)cocos2d::CCDictionary::setObject(v27, v28, 4);
}
v29 = (AchievementManager *)AchievementManager::sharedState(v26);
v30 = (AchievementManager *)AchievementManager::isAchievementEarned(v29, "geometry.ach.v3.secret05");
if ( !v30 )
{
v31 = *((cocos2d::CCDictionary **)this + 91);
v32 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 5);
v30 = (AchievementManager *)cocos2d::CCDictionary::setObject(v31, v32, 5);
}
v33 = (AchievementManager *)AchievementManager::sharedState(v30);
v34 = (AchievementManager *)AchievementManager::isAchievementEarned(v33, "geometry.ach.v3.secret06");
if ( !v34 )
{
v35 = *((cocos2d::CCDictionary **)this + 91);
v36 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 6);
v34 = (AchievementManager *)cocos2d::CCDictionary::setObject(v35, v36, 6);
}
v37 = (AchievementManager *)AchievementManager::sharedState(v34);
v38 = (GameManager *)AchievementManager::isAchievementEarned(v37, "geometry.ach.v3.secret07");
if ( !v38 )
{
v39 = *((cocos2d::CCDictionary **)this + 91);
v40 = (cocos2d::CCObject *)SecretLayer4::nodeWithTag(this, 7);
v38 = (GameManager *)cocos2d::CCDictionary::setObject(v39, v40, 7);
}
v41 = (GameManager *)GameManager::sharedState(v38);
if ( !GameManager::getUGV(v41, (char *)&a1i2r3e45s789g[11]) )
{
v43 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create((cocos2d::CCDelayTime *)0x3F4CCCCD, *(float *)&v42);
v114 = 0;
v113 = SecretLayer4::showFirstDialog;
v44 = v43;
v45 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, SecretLayer4::showFirstDialog, 0);
v46 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v44, v45, 0);
cocos2d::CCNode::runAction(this, v46);
*((_DWORD *)this + 83) = 30;
}
v47 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v42);
v48 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v47 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v122, 0.0, 0.0);
v48(v47, v122);
(*(void (__fastcall **)(SecretLayer4 *, float *, int))(*(_DWORD *)this + 232))(this, v47, -3);
(*(void (__fastcall **)(float *, _DWORD))(*(_DWORD *)v47 + 64))(v47, (float)(v107 + 10.0) / v47[86]);
(*(void (__fastcall **)(float *, _DWORD))(*(_DWORD *)v47 + 72))(v47, (float)(v108 + 10.0) / v47[87]);
v49 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v122, -5.0, -5.0);
v49(v47, v122);
v50 = *(void (__fastcall **)(float *, _DWORD *))(*(_DWORD *)v47 + 480);
strcpy((char *)v122, "K\n");
v50(v47, v122);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v121, 0.0, 0.0, 40.0, 40.0);
v52 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Chamber of Time", "goldFont.fnt", v51);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v52 + 80))(v52, 1065353216);
(*(void (__fastcall **)(SecretLayer4 *, int))(*(_DWORD *)this + 228))(this, v52);
v53 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v52 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v122, v107 * 0.5, v108 - 24.0);
v53(v52, v122);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v109, v107 * 0.5, (float)(v108 * 0.5) + 50.0);
v55 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)" ", "bigFont.fnt", v54);
v56 = *(_DWORD *)this;
*((_DWORD *)this + 89) = v55;
(*(void (__fastcall **)(SecretLayer4 *, int))(v56 + 228))(this, v55);
v57 = *((_DWORD *)this + 89);
v105 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v57 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v117, 0.0, 43.0);
cocos2d::CCPoint::operator+(v122, v109, v117);
v105(v57, v122);
SecretLayer4::getMessage((SecretLayer4 *)&v118, this);
SecretLayer4::updateMessageLabel((int)this, (int)&v118);
std::string::~string((int)&v118);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v122, (const cocos2d::CCRect *)v121);
v58 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v122);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v58 + 456))(v58, 100);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v110, 200.0, 40.0);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v58 + 160))(v58, v110);
(*(void (__fastcall **)(SecretLayer4 *, int, int))(*(_DWORD *)this + 232))(this, v58, -2);
(*(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v58 + 92))(v58, v109);
(*(void (__fastcall **)(int, void *))(*(_DWORD *)v58 + 480))(v58, &unk_BEEC46);
v59 = CCTextInputNode::create(
(CCTextInputNode *)0x43340000,
50.0,
"...",
"Thonburi",
(const char *)&dword_18,
"bigFont.fnt",
v102);
v60 = *(_DWORD *)this;
*((_DWORD *)this + 88) = v59;
(*(void (__fastcall **)(SecretLayer4 *, int *, int))(v60 + 232))(this, v59, 20);
*(_DWORD *)(*((_DWORD *)this + 88) + 420) = (char *)this + 316;
(*(void (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 88) + 92))(*((_DWORD *)this + 88), v109);
CCTextInputNode::setMaxLabelScale(*((_DWORD *)this + 88), 0.7);
CCTextInputNode::setMaxLabelWidth(*((_DWORD *)this + 88), 180.0);
(*(void (__fastcall **)(_DWORD, _DWORD))(**(_DWORD **)(*((_DWORD *)this + 88) + 416) + 172))(
*(_DWORD *)(*((_DWORD *)this + 88) + 416),
0);
*(_DWORD *)(*((_DWORD *)this + 88) + 424) = 100;
v61 = *((_DWORD *)this + 88);
v118 = 0;
v119 = 0;
v120 = 0;
std::string::__init(
&v118,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~",
0x61u);
CCTextInputNode::setAllowedChars(v61, (unsigned __int8 *)&v118);
std::string::~string((int)&v118);
SecretLayer4::updateSearchLabel(this, (const char *)&unk_B6B226);
v63 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_01_001.png", v62);
v116 = 0;
v115 = SecretLayer4::onBack;
v64 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v63, 0, (int)this, (int)SecretLayer4::onBack, 0);
CCMenuItemSpriteExtra::setSizeMult((int)v64, 1.5);
v65 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create(v64, nullptr);
v66 = (cocos2d::CCDirector *)(*(int (__fastcall **)(SecretLayer4 *, const cocos2d::CCPoint *, int))(*(_DWORD *)this + 232))(
this,
v65,
1);
v67 = *(int (__fastcall **)(const cocos2d::CCPoint *, _DWORD *))(*(_DWORD *)v65 + 92);
v68 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v66);
v69 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v68));
v70 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)LODWORD(v69));
v71 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v70));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v122, v69 + 24.0, v71 - 23.0);
v72 = (PlatformToolbox *)v67(v65, v122);
isControllerConnected = (cocos2d::CCNode *)PlatformToolbox::isControllerConnected(v72);
if ( isControllerConnected )
isControllerConnected = (cocos2d::CCNode *)GameToolbox::addBackButton(this, v64, v74);
v75 = cocos2d::CCNode::create(isControllerConnected);
v76 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v75 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v122, 80.0, 80.0);
v76(v75, v122);
v78 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_secretLock3_001.png", v77);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v75 + 228))(v75, v78);
v103 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v78 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v122, 40.0, 40.0);
v103(v78, v122);
v117[1] = 0;
v117[0] = SecretLayer4::onSubmit;
v79 = CCMenuItemSpriteExtra::create(v75, 0, (int)this, (int)SecretLayer4::onSubmit, 0);
*((_DWORD *)this + 90) = v79;
(*(void (__fastcall **)(const cocos2d::CCPoint *, int))(*(_DWORD *)v65 + 228))(v65, v79);
v106 = *((_DWORD *)this + 90);
v104 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v106 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, v107 * 0.5, (float)(v108 * 0.5) - 20.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v122, v65);
v104(v106, v122);
v80 = (GameStatsManager *)CCMenuItemSpriteExtra::setSizeMult(*((_DWORD *)this + 90), 1.0);
v81 = GameStatsManager::sharedState(v80);
v118 = 0;
v119 = 0;
v120 = 0;
v82 = v81;
std::string::__init(&v118, "0003", 4u);
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v82, (int)&v118);
v84 = (cocos2d::CCMenu *)std::string::~string((int)&v118);
if ( isSpecialChestUnlocked )
{
return isSpecialChestUnlocked;
}
else
{
v85 = (const cocos2d::CCPoint *)cocos2d::CCMenu::create(v84);
v86 = (GameStatsManager *)(*(int (__fastcall **)(SecretLayer4 *, const cocos2d::CCPoint *, int))(*(_DWORD *)this + 232))(
this,
v85,
10);
v87 = GameStatsManager::sharedState(v86);
v118 = 0;
v119 = 0;
v120 = 0;
v88 = v87;
std::string::__init(&v118, "0003", 4u);
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest(v88, (int)&v118);
std::string::~string((int)&v118);
v91 = GJChestSprite::create(*(GJChestSprite **)(RewardForSpecialChest + 60), v90);
GJChestSprite::switchToState(v91, 2, 0);
(*(void (__fastcall **)(cocos2d::CCSprite *, int))(*(_DWORD *)v91 + 80))(v91, 1058642330);
v122[1] = 0;
v122[0] = SecretLayer4::onChest01;
v92 = CCMenuItemSpriteExtra::create((int)v91, 0, (int)this, (int)SecretLayer4::onChest01, 0);
v118 = 0;
v119 = 0;
v120 = 0;
v93 = (_DWORD *)v92;
std::string::__init(&v118, "chestClick.ogg", 0xEu);
if ( v93 + 85 != &v118 )
{
if ( (v118 & 1) != 0 )
{
v99 = (char *)v120;
v100 = v119;
}
else
{
v100 = (int)(unsigned __int8)v118 >> 1;
v99 = (char *)&v118 + 1;
}
std::string::assign(v93 + 85, v99, v100);
}
std::string::~string((int)&v118);
v94 = *(void (__fastcall **)(_DWORD *, _BYTE *))(*v93 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v112, 60.0, 48.0);
v94(v93, v112);
v95 = *(void (__fastcall **)(cocos2d::CCSprite *, _BYTE *))(*(_DWORD *)v91 + 92);
v96 = *(float *)(*(int (__fastcall **)(_DWORD *))(*v93 + 164))(v93);
v97 = (*(int (__fastcall **)(_DWORD *))(*v93 + 164))(v93);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v112, v96 * 0.5, *(float *)(v97 + 4) * 0.5);
v95(v91, v112);
(*(void (__fastcall **)(const cocos2d::CCPoint *, _DWORD *))(*(_DWORD *)v85 + 228))(v85, v93);
v98 = *(void (__fastcall **)(_DWORD *, _BYTE *))(*v93 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v111, v107 - 60.0, 60.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v112, v85);
v98(v93, v112);
}
}
return (int)v3;
}