//
// SecretLayer::init from 0x4cb1dc to 0x4cb91a (1854 bytes)
//
// 1 xrefs:
// > SecretLayer::create @ 0x4c95f4
//
// 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 SecretLayer::init(SecretLayer *a1)
{
_BOOL4 v2; // r8
GameManager *v3; // r6
int v4; // r2
int v5; // r3
cocos2d::CCDirector *v6; // r0
cocos2d::CCDictionary *v7; // r0
AchievementManager *v8; // r0
cocos2d::CCDictionary *m_messageThreads; // r6
cocos2d::CCNode *v10; // r0
cocos2d::CCDictionary *v11; // r6
cocos2d::CCNode *v12; // r0
AchievementManager *v13; // r0
cocos2d::CCDictionary *v14; // r6
cocos2d::CCNode *v15; // r0
cocos2d::CCDictionary *v16; // r6
cocos2d::CCNode *v17; // r0
AchievementManager *v18; // r0
cocos2d::CCDictionary *v19; // r6
cocos2d::CCNode *v20; // r0
cocos2d::CCDictionary *v21; // r6
cocos2d::CCNode *v22; // r0
AchievementManager *v23; // r0
cocos2d::CCDictionary *v24; // r6
cocos2d::CCNode *v25; // r0
cocos2d::CCDictionary *v26; // r6
cocos2d::CCNode *v27; // r0
AchievementManager *v28; // r0
cocos2d::CCDictionary *v29; // r6
cocos2d::CCNode *v30; // r0
cocos2d::CCDictionary *v31; // r6
cocos2d::CCNode *v32; // r0
AchievementManager *v33; // r0
cocos2d::CCDictionary *v34; // r6
cocos2d::CCNode *v35; // r0
cocos2d::CCDictionary *v36; // r6
cocos2d::CCNode *v37; // r0
AchievementManager *v38; // r0
cocos2d::CCDictionary *v39; // r6
cocos2d::CCNode *v40; // r0
cocos2d::CCDictionary *v41; // r6
cocos2d::CCNode *v42; // r0
AchievementManager *v43; // r0
cocos2d::CCDictionary *v44; // r6
cocos2d::CCNode *v45; // r0
AchievementManager *v46; // r0
cocos2d::CCDictionary *v47; // r6
cocos2d::CCNode *v48; // r0
AchievementManager *v49; // r0
cocos2d::CCDictionary *v50; // r6
cocos2d::CCNode *v51; // r0
AchievementManager *v52; // r0
cocos2d::CCDictionary *v53; // r6
cocos2d::CCNode *v54; // r0
AchievementManager *v55; // r0
const char *v56; // r1
GameManager *v57; // r0
cocos2d::CCNode *v58; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // r3
cocos2d::CCLabelBMFont *v62; // r6
void (__fastcall *v63)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCLabelBMFont *v64; // r0
SecretLayer_vtbl *v65; // r3
cocos2d::CCLabelBMFont *m_messageLabel; // r6
cocos2d::CCNode *v67; // r6
CCTextInputNode *v68; // r0
SecretLayer_vtbl *v69; // r3
CCTextInputNode *m_searchInput; // r6
cocos2d::CCSprite *v71; // r0
CCMenuItemSpriteExtra *v72; // r9
cocos2d::CCNode *v73; // r6
void (__fastcall *v74)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10
cocos2d::CCDirector *v75; // r0
float v76; // s18
cocos2d::CCDirector *v77; // r0
float v78; // r0
cocos2d::CCSprite *v79; // r0
CCMenuItemSpriteExtra *v80; // r0
cocos2d::CCNode_vtbl *v81; // r3
CCMenuItemSpriteExtra *m_submitButton; // r9
void (__fastcall *v83)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
cocos2d::CCDictionary *v85; // r6
cocos2d::CCNode *v86; // r0
float v87; // r2
float v88; // r3
void (__fastcall *v89)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+Ch] [bp-60h]
cocos2d::CCSize v90; // [sp+14h] [bp-58h] BYREF
cocos2d::CCPoint v91; // [sp+1Ch] [bp-50h] BYREF
cocos2d::CCSize v92; // [sp+24h] [bp-48h] BYREF
cocos2d::CCPoint v93; // [sp+2Ch] [bp-40h] BYREF
cocos2d::CCPoint v94; // [sp+34h] [bp-38h] BYREF
cocos2d::CCPoint v95; // [sp+3Ch] [bp-30h] BYREF
cocos2d::CCRect v96; // [sp+44h] [bp-28h] BYREF
cocos2d::CCRect v97; // [sp+54h] [bp-18h] BYREF
cocos2d::CCSize v98; // 0:^0.8
cocos2d::CCRect v99; // 0:kr00_16.16
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v3 = GameManager::sharedState();
sub_776584((int)&v97, "secretLoop.mp3");
GameManager::fadeInMusic((int)v3, &v97, v4, v5);
sub_774008(&v97);
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v90, v6);
v7 = cocos2d::CCDictionary::create();
a1->m_messageThreads = v7;
cocos2d::CCObject::retain(v7);
v8 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v8, "geometry.ach.secret06") )
{
m_messageThreads = a1->m_messageThreads;
v10 = SecretLayer::nodeWithTag(a1, 6);
cocos2d::CCDictionary::setObject(m_messageThreads, v10, 6);
}
v11 = a1->m_messageThreads;
v12 = SecretLayer::nodeWithTag(a1, 101);
cocos2d::CCDictionary::setObject(v11, v12, 101);
v13 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v13, "geometry.ach.secret07") )
{
v14 = a1->m_messageThreads;
v15 = SecretLayer::nodeWithTag(a1, 7);
cocos2d::CCDictionary::setObject(v14, v15, 7);
}
v16 = a1->m_messageThreads;
v17 = SecretLayer::nodeWithTag(a1, 102);
cocos2d::CCDictionary::setObject(v16, v17, 102);
v18 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v18, "geometry.ach.secret08") )
{
v19 = a1->m_messageThreads;
v20 = SecretLayer::nodeWithTag(a1, 8);
cocos2d::CCDictionary::setObject(v19, v20, 8);
}
v21 = a1->m_messageThreads;
v22 = SecretLayer::nodeWithTag(a1, 103);
cocos2d::CCDictionary::setObject(v21, v22, 103);
v23 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v23, "geometry.ach.secret09") )
{
v24 = a1->m_messageThreads;
v25 = SecretLayer::nodeWithTag(a1, 9);
cocos2d::CCDictionary::setObject(v24, v25, 9);
}
v26 = a1->m_messageThreads;
v27 = SecretLayer::nodeWithTag(a1, 104);
cocos2d::CCDictionary::setObject(v26, v27, 104);
v28 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v28, "geometry.ach.secret10") )
{
v29 = a1->m_messageThreads;
v30 = SecretLayer::nodeWithTag(a1, 10);
cocos2d::CCDictionary::setObject(v29, v30, 10);
}
v31 = a1->m_messageThreads;
v32 = SecretLayer::nodeWithTag(a1, 105);
cocos2d::CCDictionary::setObject(v31, v32, 105);
v33 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v33, "geometry.ach.secret13") )
{
v34 = a1->m_messageThreads;
v35 = SecretLayer::nodeWithTag(a1, 13);
cocos2d::CCDictionary::setObject(v34, v35, 13);
}
v36 = a1->m_messageThreads;
v37 = SecretLayer::nodeWithTag(a1, 120);
cocos2d::CCDictionary::setObject(v36, v37, 120);
v38 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v38, "geometry.ach.secret14") )
{
v39 = a1->m_messageThreads;
v40 = SecretLayer::nodeWithTag(a1, 14);
cocos2d::CCDictionary::setObject(v39, v40, 14);
}
v41 = a1->m_messageThreads;
v42 = SecretLayer::nodeWithTag(a1, 121);
cocos2d::CCDictionary::setObject(v41, v42, 121);
v43 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v43, "geometry.ach.secret15") )
{
v44 = a1->m_messageThreads;
v45 = SecretLayer::nodeWithTag(a1, 15);
cocos2d::CCDictionary::setObject(v44, v45, 15);
}
v46 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v46, "geometry.ach.secret16") )
{
v47 = a1->m_messageThreads;
v48 = SecretLayer::nodeWithTag(a1, 16);
cocos2d::CCDictionary::setObject(v47, v48, 16);
}
v49 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v49, "geometry.ach.secret17") )
{
v50 = a1->m_messageThreads;
v51 = SecretLayer::nodeWithTag(a1, 17);
cocos2d::CCDictionary::setObject(v50, v51, 17);
}
v52 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v52, "geometry.ach.secret19") )
{
v53 = a1->m_messageThreads;
v54 = SecretLayer::nodeWithTag(a1, 19);
cocos2d::CCDictionary::setObject(v53, v54, 19);
}
v55 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v55, "geometry.ach.v2.secret03") )
{
v57 = GameManager::sharedState();
if ( GameManager::getUGV(v57, (const char *)&aO1i2r3e45s7t89[3]) )
{
v85 = a1->m_messageThreads;
v86 = SecretLayer::nodeWithTag(a1, 11);
cocos2d::CCDictionary::setObject(v85, v86, 11);
}
}
v58 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v56);
setAnchorPoint = v58->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v97.origin, 0.0, 0.0);
setAnchorPoint(v58, &v97.origin);
a1->addChild_0(a1, v58, -3);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v58->setScaleX)(v58, (float)(v90.width + 10.0) / v58[1].m_fSkewX);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))v58->setScaleY)(v58, (float)(v90.height + 10.0) / v58[1].m_fSkewY);
setPosition = v58->setPosition;
cocos2d::CCPoint::CCPoint(&v97.origin, -5.0, -5.0);
setPosition(v58, &v97.origin);
getTag = v58->__vftable[1].getTag;
LOWORD(v97.origin.x) = 19200;
BYTE2(v97.origin.x) = 100;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *))getTag)(v58, &v97);
cocos2d::CCRect::CCRect(&v96, 0.0, 0.0, 40.0, 40.0);
v62 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v62->setScale)(v62, 1065353216);
a1->addChild(a1, v62);
v63 = v62->setPosition;
cocos2d::CCPoint::CCPoint(&v97.origin, v90.width * 0.5, v90.height - 24.0);
v63(v62, &v97.origin);
cocos2d::CCPoint::CCPoint(&v91, v90.width * 0.5, (float)(v90.height * 0.5) + 50.0);
v64 = cocos2d::CCLabelBMFont::create();
v65 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_messageLabel = v64;
v65->addChild(a1, v64);
m_messageLabel = a1->m_messageLabel;
v89 = m_messageLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v95, 0.0, 43.0);
cocos2d::CCPoint::operator+(&v97, &v91, &v95);
v89(m_messageLabel, &v97.origin);
SecretLayer::getMessage((SecretLayer *)&v97, a1);
SecretLayer::updateMessageLabel((int)a1, &v97);
sub_774008(&v97);
cocos2d::CCRect::CCRect(&v97, &v96);
v99.origin.x = v87;
v99.origin.y = v88;
v99.size = v98;
v67 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02b_small.png",
(const char *)&v97,
v99);
((void (__fastcall *)(cocos2d::CCNode *, int))v67->__vftable[1].~CCNode_0)(v67, 100);
cocos2d::CCSize::CCSize(&v92, 200.0, 40.0);
v67->setContentSize(v67, &v92);
a1->addChild_0(a1, v67, -2);
v67->setPosition(v67, &v91);
((void (__fastcall *)(cocos2d::CCNode *, void *))v67->__vftable[1].getTag)(v67, &unk_9AC5AA);
v68 = CCTextInputNode::create(180.0, 50.0, "...", "Thonburi");
v69 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_searchInput = v68;
((void (__fastcall *)(SecretLayer *, CCTextInputNode *, int, void (__fastcall *)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int), int *, const char *))v69->addChild_0)(
a1,
v68,
20,
v69->addChild_0,
&dword_18,
"bigFont.fnt");
a1->m_searchInput->m_delegate = &a1->TextInputDelegate;
a1->m_searchInput->setPosition(a1->m_searchInput, &v91);
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 = 20;
sub_776584((int)&v97, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
CCTextInputNode::setAllowedChars((int)m_searchInput, (int)&v97);
sub_774008(&v97);
SecretLayer::updateSearchLabel(a1, (const char *)&unk_939830);
v71 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
LODWORD(v95.x) = SecretLayer::onBack;
v95.y = 0.0;
v72 = CCMenuItemSpriteExtra::create(
v71,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer::onBack, (unsigned int)a1));
CCMenuItemSpriteExtra::setSizeMult(v72, 1.5);
v73 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v72, nullptr);
a1->addChild_0(a1, v73, 1);
v74 = v73->setPosition;
v75 = cocos2d::CCDirector::sharedDirector();
v76 = COERCE_FLOAT(cocos2d::CCDirector::getScreenLeft(v75));
v77 = cocos2d::CCDirector::sharedDirector();
v78 = COERCE_FLOAT(cocos2d::CCDirector::getScreenTop(v77));
cocos2d::CCPoint::CCPoint(&v97.origin, v76 + 24.0, v78 - 23.0);
v74(v73, &v97.origin);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v72);
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock_001.png");
LODWORD(v97.origin.x) = SecretLayer::onSubmit;
v97.origin.y = 0.0;
v80 = CCMenuItemSpriteExtra::create(
v79,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SecretLayer::onSubmit, (unsigned int)a1));
v81 = v73->__vftable;
a1->m_submitButton = v80;
v81->addChild(v73, v80);
m_submitButton = a1->m_submitButton;
v83 = m_submitButton->setPosition;
cocos2d::CCPoint::CCPoint(&v93, v90.width * 0.5, (float)(v90.height * 0.5) - 20.0);
cocos2d::CCNode::convertToNodeSpace(&v94, v73, &v93);
v83(m_submitButton, &v94);
CCMenuItemSpriteExtra::setSizeMult(a1->m_submitButton, 0.7);
}
return v2;
}