//
// SecretLayer2::init from 0x4ee608 to 0x4eef9c (2452 bytes)
//
// 1 xrefs:
// > SecretLayer2::create @ 0x4ec078
//
// 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 SecretLayer2::init(SecretLayer2 *a1)
{
cocos2d::CCTextureCache *v2; // r0
cocos2d::CCSpriteFrameCache *v3; // r0
GameManager *v4; // r6
int v5; // r2
int v6; // r3
cocos2d::CCDirector *v7; // r0
cocos2d::CCDictionary *v8; // r0
AchievementManager *v9; // r0
cocos2d::CCDictionary *m_messageThreads; // r6
cocos2d::CCNode *v11; // r0
AchievementManager *v12; // r0
AchievementManager *v13; // r0
cocos2d::CCDictionary *v14; // r6
cocos2d::CCNode *v15; // r0
AchievementManager *v16; // r0
cocos2d::CCDictionary *v17; // r6
cocos2d::CCNode *v18; // r0
AchievementManager *v19; // r0
cocos2d::CCDictionary *v20; // r6
cocos2d::CCNode *v21; // r0
AchievementManager *v22; // r0
cocos2d::CCDictionary *v23; // r6
cocos2d::CCNode *v24; // r0
AchievementManager *v25; // r0
cocos2d::CCDictionary *v26; // r6
cocos2d::CCNode *v27; // r0
AchievementManager *v28; // r0
cocos2d::CCDictionary *v29; // r6
cocos2d::CCNode *v30; // r0
GameManager *v31; // r0
const char *v32; // r1
cocos2d::CCDictionary *v33; // r6
cocos2d::CCNode *v34; // r0
cocos2d::CCNode *v35; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r3
cocos2d::CCLabelBMFont *v39; // r6
void (__fastcall *v40)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v41; // r0
SecretLayer2_vtbl *v42; // r3
cocos2d::CCLabelBMFont *m_messageLabel; // r11
void (__fastcall *v44)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
char *v45; // r2
cocos2d::CCNode *v46; // r9
CCTextInputNode *v47; // r0
SecretLayer2_vtbl *v48; // r3
CCTextInputNode *m_searchInput; // r6
cocos2d::CCSprite *v50; // r0
CCMenuItemSpriteExtra *v51; // r9
cocos2d::CCNode *v52; // r6
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCDirector *v54; // r0
float v55; // s18
cocos2d::CCDirector *v56; // r0
float v57; // r0
cocos2d::CCSprite *v58; // r9
cocos2d::CCSprite *v59; // r11
void (__fastcall *v60)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r10
CCMenuItemSpriteExtra *v61; // r0
cocos2d::CCNode_vtbl *v62; // r3
CCMenuItemSpriteExtra *m_submitButton; // r9
void (__fastcall *v64)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
GameManager *v65; // r0
const char *v66; // r0
cocos2d::CCSprite *v67; // r0
CCMenuItemSpriteExtra *v68; // r0
cocos2d::CCNode_vtbl *v69; // r3
CCMenuItemSpriteExtra *m_secretDoorButton; // r11
void (__fastcall *v71)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCArray *v72; // r0
cocos2d::CCArray *v73; // r0
cocos2d::CCSprite *v74; // r9
CCMenuItemSpriteExtra *v75; // r0
cocos2d::CCNode_vtbl *v76; // r3
CCMenuItemSpriteExtra *m_secretLevelButton; // r8
void (__fastcall *v78)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCLabelBMFont *v79; // r8
void (__fastcall *v80)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCLabelBMFont *v81; // r11
int v82; // r8
GameStatsManager *v83; // r0
cocos2d::CCSprite *v84; // r9
void (__fastcall *v85)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCString *v86; // r0
cocos2d::CCLabelBMFont *v87; // r8
void (__fastcall *v88)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
GameManager *v89; // r0
unsigned int UGV; // r6
GameManager *v91; // r0
int v92; // r0
GameLevelManager *v93; // r0
GJGameLevel *MainLevel; // r0
cocos2d::CCDelayTime *v95; // r0
cocos2d::CCSequence *v96; // r8
cocos2d::CCFiniteTimeAction *v97; // r0
cocos2d::CCAction *v98; // r0
float v100; // r2
float v101; // r3
_BOOL4 v102; // [sp+Ch] [bp-88h]
void (__fastcall *v103)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-80h]
cocos2d::CCSize v104; // [sp+1Ch] [bp-78h] BYREF
cocos2d::CCPoint v105; // [sp+24h] [bp-70h] BYREF
cocos2d::CCSize v106; // [sp+2Ch] [bp-68h] BYREF
cocos2d::CCPoint v107; // [sp+34h] [bp-60h] BYREF
_BYTE v108[8]; // [sp+3Ch] [bp-58h] BYREF
cocos2d::CCPoint v109; // [sp+44h] [bp-50h] BYREF
void (*v110)(SecretLayer2 *, cocos2d::CCObject *); // [sp+4Ch] [bp-48h]
int v111; // [sp+50h] [bp-44h]
void (*v112)(SecretLayer2 *, cocos2d::CCObject *); // [sp+54h] [bp-40h]
int v113; // [sp+58h] [bp-3Ch]
void (*v114)(SecretLayer2 *, cocos2d::CCObject *); // [sp+5Ch] [bp-38h]
int v115; // [sp+60h] [bp-34h]
cocos2d::CCPoint v116; // [sp+64h] [bp-30h] BYREF
cocos2d::CCRect v117; // [sp+6Ch] [bp-28h] BYREF
cocos2d::CCRect v118; // [sp+7Ch] [bp-18h] BYREF
cocos2d::CCSize v119; // 0:^0.8
cocos2d::CCRect v120; // 0:kr00_16.16
v102 = cocos2d::CCLayer::init(a1);
if ( v102 )
{
v2 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v2, "SecretSheet.png", 0);
v3 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v3, "SecretSheet.plist");
v4 = GameManager::sharedState();
sub_776584((int)&v118, "secretLoop02.mp3");
GameManager::fadeInMusic((int)v4, &v118, v5, v6);
sub_774008(&v118);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v104, v7);
v8 = cocos2d::CCDictionary::create();
a1->m_messageThreads = v8;
cocos2d::CCObject::retain(v8);
v9 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v9, "geometry.ach.v2.secret01") )
{
m_messageThreads = a1->m_messageThreads;
v11 = SecretLayer2::nodeWithTag(a1, 1);
cocos2d::CCDictionary::setObject(m_messageThreads, v11, 1);
}
v12 = AchievementManager::sharedState();
if ( AchievementManager::isAchievementEarned(v12, "geometry.ach.secret06") )
{
v13 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v13, "geometry.ach.v2.secret03") )
{
v14 = a1->m_messageThreads;
v15 = SecretLayer2::nodeWithTag(a1, 3);
cocos2d::CCDictionary::setObject(v14, v15, 3);
}
}
v16 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v16, "geometry.ach.v2.secret05") )
{
v17 = a1->m_messageThreads;
v18 = SecretLayer2::nodeWithTag(a1, 5);
cocos2d::CCDictionary::setObject(v17, v18, 5);
}
v19 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v19, "geometry.ach.v2.secret06") )
{
v20 = a1->m_messageThreads;
v21 = SecretLayer2::nodeWithTag(a1, 6);
cocos2d::CCDictionary::setObject(v20, v21, 6);
}
v22 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v22, "geometry.ach.v2.secret08") )
{
v23 = a1->m_messageThreads;
v24 = SecretLayer2::nodeWithTag(a1, 8);
cocos2d::CCDictionary::setObject(v23, v24, 8);
}
v25 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v25, "geometry.ach.v2.secret09") )
{
v26 = a1->m_messageThreads;
v27 = SecretLayer2::nodeWithTag(a1, 9);
cocos2d::CCDictionary::setObject(v26, v27, 9);
}
v28 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v28, "geometry.ach.v2.secret10") )
{
v29 = a1->m_messageThreads;
v30 = SecretLayer2::nodeWithTag(a1, 10);
cocos2d::CCDictionary::setObject(v29, v30, 10);
}
v31 = GameManager::sharedState();
if ( !GameManager::getUGV(v31, (const char *)&aO1i2r3e45s7t89[1]) )
{
v33 = a1->m_messageThreads;
v34 = SecretLayer2::nodeWithTag(a1, 20);
cocos2d::CCDictionary::setObject(v33, v34, 20);
}
v35 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v32);
setAnchorPoint = v35->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v118.origin, 0.0, 0.0);
setAnchorPoint(v35, &v118.origin);
a1->addChild_0(a1, v35, -3);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v35->setScaleX)(v35, (float)(v104.width + 10.0) / v35[1].m_fSkewX);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v35->setScaleY)(v35, (float)(v104.height + 10.0) / v35[1].m_fSkewY);
setPosition = v35->setPosition;
cocos2d::CCPoint::CCPoint(&v118.origin, -5.0, -5.0);
setPosition(v35, &v118.origin);
getTag = v35->__vftable[1].getTag;
LOWORD(v118.origin.x) = 75;
BYTE2(v118.origin.x) = 100;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v35, &v118);
cocos2d::CCRect::CCRect(&v117, 0.0, 0.0, 40.0, 40.0);
v39 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v39->setScale)(v39, 1065353216);
a1->addChild(a1, v39);
v40 = v39->setPosition;
cocos2d::CCPoint::CCPoint(&v118.origin, v104.width * 0.5, v104.height - 24.0);
v40(v39, &v118.origin);
cocos2d::CCPoint::CCPoint(&v105, v104.width * 0.5, (float)(v104.height * 0.5) + 50.0);
v41 = cocos2d::CCLabelBMFont::create();
v42 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_messageLabel = v41;
v42->addChild(a1, v41);
m_messageLabel = a1->m_messageLabel;
v44 = m_messageLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v116, 0.0, 43.0);
cocos2d::CCPoint::operator+(&v118, &v105, &v116);
v44(m_messageLabel, &v118.origin);
SecretLayer2::getMessage((SecretLayer2 *)&v118, a1, v45);
SecretLayer2::updateMessageLabel((int)a1, &v118);
sub_774008(&v118);
cocos2d::CCRect::CCRect(&v118, &v117);
v120.origin.x = v100;
v120.origin.y = v101;
v120.size = v119;
v46 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v118,
v120);
((void (__fastcall *)(cocos2d::CCNode *, int))v46->__vftable[1].~CCNode_0)(v46, 100);
cocos2d::CCSize::CCSize(&v106, 200.0, 40.0);
v46->setContentSize(v46, &v106);
a1->addChild_0(a1, v46, -2);
v46->setPosition(v46, &v105);
((void (__fastcall *)(cocos2d::CCNode *, void *))v46->__vftable[1].getTag)(v46, &unk_9ACA58);
v47 = CCTextInputNode::create(180.0, 50.0, "...", "Thonburi");
v48 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_searchInput = v47;
((void (__fastcall *)(SecretLayer2 *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))v48->addChild_0)(
a1,
v47,
20,
v48->addChild_0,
&dword_18,
"bigFont.fnt");
a1->m_searchInput->m_delegate = &a1->TextInputDelegate;
a1->m_searchInput->setPosition(a1->m_searchInput, &v105);
CCTextInputNode::setMaxLabelScale(a1->m_searchInput, 0.7);
CCTextInputNode::setMaxLabelWidth(a1->m_searchInput, 180.0);
a1->m_searchInput->m_textField->setVisible(a1->m_searchInput->m_textField, 0);
m_searchInput = a1->m_searchInput;
m_searchInput->m_maxLabelLength = 100;
sub_776584(
(int)&v118,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
CCTextInputNode::setAllowedChars((int)m_searchInput, (int)&v118);
sub_774008(&v118);
SecretLayer2::updateSearchLabel(a1, (const char *)&unk_939830);
v50 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v111 = 0;
v110 = SecretLayer2::onBack;
v51 = CCMenuItemSpriteExtra::create(
v50,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer2::onBack, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v51, 1.5);
v52 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v51, nullptr);
a1->addChild_0(a1, v52, 1);
v53 = v52->setPosition;
v54 = cocos2d::CCDirector::sharedDirector();
v55 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v54));
v56 = cocos2d::CCDirector::sharedDirector();
v57 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v56));
cocos2d::CCPoint::CCPoint(&v118.origin, v55 + 24.0, v57 - 23.0);
v53(v52, &v118.origin);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v51);
v58 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock2_001.png");
v59 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock2_2_001.png");
v58->addChild_0(v58, v59, -1);
v60 = v59->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v118.origin, v58, &stru_AC6FC4);
v60(v59, &v118.origin);
v113 = 0;
v112 = SecretLayer2::onSubmit;
v61 = CCMenuItemSpriteExtra::create(
v58,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer2::onSubmit, (unsigned int)a1));
v62 = v52->__vftable;
a1->m_submitButton = v61;
v62->addChild(v52, v61);
m_submitButton = a1->m_submitButton;
v64 = m_submitButton->setPosition;
cocos2d::CCPoint::CCPoint(&v116, v104.width * 0.5, (float)(v104.height * 0.5) - 20.0);
cocos2d::CCNode::convertToNodeSpace(&v118.origin, v52, &v116);
v64(m_submitButton, &v118.origin);
CCMenuItemSpriteExtra::setSizeMult(a1->m_submitButton, 0.7);
v65 = GameManager::sharedState();
if ( GameManager::getUGV(v65, (const char *)&aO1i2r3e45s7t89[7]) )
v66 = "secretDoor_open_001.png";
else
v66 = "secretDoor_closed_001.png";
v67 = cocos2d::CCSprite::createWithSpriteFrameName(v66);
v115 = 0;
v114 = SecretLayer2::onDoor;
v68 = CCMenuItemSpriteExtra::create(
v67,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer2::onDoor, (unsigned int)a1));
a1->m_secretDoorButton = v68;
v68->m_colorEnabled = 1;
v69 = v52->__vftable;
v68->m_animationEnabled = 0;
v69->addChild(v52, v68);
m_secretDoorButton = a1->m_secretDoorButton;
v71 = m_secretDoorButton->setPosition;
cocos2d::CCPoint::CCPoint(&v116, v104.width - 45.0, 45.0);
cocos2d::CCNode::convertToNodeSpace(&v118.origin, v52, &v116);
v72 = (cocos2d::CCArray *)((int (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCRect *))v71)(
m_secretDoorButton,
&v118);
v73 = (cocos2d::CCArray *)cocos2d::CCArray::create(v72);
a1->m_secretLevelLabels = v73;
cocos2d::CCObject::retain(v73);
v74 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_playBtn2_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v74->setScale)(v74, 1056964608);
v116.y = 0.0;
LODWORD(v116.x) = SecretLayer2::onSecretLevel;
v75 = CCMenuItemSpriteExtra::create(
v74,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer2::onSecretLevel, (unsigned int)a1));
v76 = v52->__vftable;
a1->m_secretLevelButton = v75;
v76->addChild(v52, v75);
cocos2d::CCPoint::CCPoint(&v107, v104.width - 45.0, 130.0);
m_secretLevelButton = a1->m_secretLevelButton;
v78 = m_secretLevelButton->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v118.origin, v52, &v107);
v78(m_secretLevelButton, &v118.origin);
v79 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v79->setScale)(v79, 1053609165);
a1->addChild(a1, v79);
v80 = v79->setPosition;
cocos2d::CCPoint::CCPoint(&v109, 0.0, 46.0);
cocos2d::CCPoint::operator+(&v118, &v107, &v109);
v80(v79, &v118.origin);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v79);
v81 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v81->setScale)(v81, 1053609165);
a1->addChild(a1, v81);
v103 = v81->setPosition;
v82 = (int)v79->getPosition(v79);
cocos2d::CCPoint::CCPoint(&v109, 0.0, -15.0);
cocos2d::CCPoint::operator+(&v118, v82, &v109);
v103(v81, &v118.origin);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v81);
v83 = GameStatsManager::sharedState();
if ( GameStatsManager::getStat(v83, "13") <= 199 )
{
cocos2d::CCPoint::CCPoint(&v118.origin, 3.0, -30.0);
cocos2d::CCPoint::operator+(v108, &v107, &v118);
v84 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_diamondsIcon_001.png");
a1->addChild(a1, v84);
v85 = v84->setPosition;
cocos2d::CCPoint::CCPoint(&v109, 12.0, -1.0);
cocos2d::CCPoint::operator+(&v118, v108, &v109);
v85(v84, &v118.origin);
((void (__fastcall *)(cocos2d::CCSprite *, int))v84->setScale)(v84, 1060320051);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v84);
v86 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)&dword_C8);
cocos2d::CCString::getCString(v86);
v87 = cocos2d::CCLabelBMFont::create();
a1->addChild(a1, v87);
v88 = v87->setPosition;
cocos2d::CCPoint::CCPoint(&v109, -8.5, 0.0);
cocos2d::CCPoint::operator+(&v118, v108, &v109);
v88(v87, &v118.origin);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v87->setScale)(v87, 1053609165);
cocos2d::CCArray::addObject(a1->m_secretLevelLabels, v87);
}
v89 = GameManager::sharedState();
UGV = GameManager::getUGV(v89, (const char *)&aO1i2r3e45s7t89[1]);
if ( !UGV )
{
a1->m_secretLevelButton->setEnabled(a1->m_secretLevelButton, 0);
a1->m_secretLevelButton->setVisible(a1->m_secretLevelButton, 0);
while ( UGV < cocos2d::CCArray::count(a1->m_secretLevelLabels) )
{
v92 = cocos2d::CCArray::objectAtIndex(a1->m_secretLevelLabels, UGV++);
(*(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v92 + 164))(v92, 0);
}
}
v91 = GameManager::sharedState();
if ( !GameManager::getUGV(v91, (const char *)&aO1i2r3e45s7t89[7]) )
{
v93 = GameLevelManager::sharedState();
MainLevel = GameLevelManager::getMainLevel(v93, 3001, 1);
if ( GJGameLevel::getNormalPercent(MainLevel) > 99 )
{
v95 = cocos2d::CCDelayTime::create(0.8);
v118.origin.y = 0.0;
LODWORD(v118.origin.x) = SecretLayer2::showCompletedLevel;
v96 = (cocos2d::CCSequence *)v95;
v97 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, SecretLayer2::showCompletedLevel, 0);
v98 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v96, v97, 0);
cocos2d::CCNode::runAction(a1, v98);
}
}
}
return v102;
}