//
// SecretLayer::init from 0x1005fa9b0 to 0x1005fb504 (2900 bytes)
//
// 3 xrefs:
// > SecretLayer::scene @ 0x1005fa860
// > SecretLayer::create @ 0x1005fa96b
// > ??> @ 0x10097ce18
//
// 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 SecretLayer::init(SecretLayer *a1)
{
__m128 v1; // xmm0
bool result; // al
GameManager *v4; // rax
cocos2d::CCDictionary *v5; // rax
AchievementManager *v6; // rax
cocos2d::CCDictionary *m_messageThreads; // r14
cocos2d::CCNode *v8; // r15
cocos2d::CCDictionary *v9; // r14
cocos2d::CCNode *v10; // r15
AchievementManager *v11; // rax
cocos2d::CCDictionary *v12; // r14
cocos2d::CCNode *v13; // r15
cocos2d::CCDictionary *v14; // r14
cocos2d::CCNode *v15; // r15
AchievementManager *v16; // rax
cocos2d::CCDictionary *v17; // r14
cocos2d::CCNode *v18; // r15
cocos2d::CCDictionary *v19; // r14
cocos2d::CCNode *v20; // r15
AchievementManager *v21; // rax
cocos2d::CCDictionary *v22; // r14
cocos2d::CCNode *v23; // r15
cocos2d::CCDictionary *v24; // r14
cocos2d::CCNode *v25; // r15
AchievementManager *v26; // rax
cocos2d::CCDictionary *v27; // r14
cocos2d::CCNode *v28; // r15
cocos2d::CCDictionary *v29; // r14
cocos2d::CCNode *v30; // r15
AchievementManager *v31; // rax
cocos2d::CCDictionary *v32; // r14
cocos2d::CCNode *v33; // r15
cocos2d::CCDictionary *v34; // r14
cocos2d::CCNode *v35; // r15
AchievementManager *v36; // rax
cocos2d::CCDictionary *v37; // r14
cocos2d::CCNode *v38; // r15
cocos2d::CCDictionary *v39; // r14
cocos2d::CCNode *v40; // r15
AchievementManager *v41; // rax
cocos2d::CCDictionary *v42; // r14
cocos2d::CCNode *v43; // r15
AchievementManager *v44; // rax
cocos2d::CCDictionary *v45; // r14
cocos2d::CCNode *v46; // r15
AchievementManager *v47; // rax
cocos2d::CCDictionary *v48; // r14
cocos2d::CCNode *v49; // r15
AchievementManager *v50; // rax
cocos2d::CCDictionary *v51; // r14
cocos2d::CCNode *v52; // r15
AchievementManager *v53; // rax
GameManager *v54; // rax
cocos2d::CCDictionary *v55; // r14
cocos2d::CCNode *v56; // r15
cocos2d::CCSprite *v57; // r14
cocos2d::CCLabelBMFont *v58; // r14
cocos2d::CCLabelBMFont *v59; // rax
cocos2d::CCLabelBMFont *m_messageLabel; // r15
double v61; // xmm0_8
cocos2d::CCLabelBMFont *v62; // rdi
std::string::pointer data; // rsi
cocos2d::extension::CCScale9Sprite *v64; // r15
CCTextInputNode *v65; // rax
CCTextInputNode *m_searchInput; // rdi
CCTextInputNode *v67; // r14
cocos2d::CCSprite *v68; // rax
CCMenuItemSpriteExtra *v69; // r15
int v70; // edx
int v71; // ecx
int v72; // r8d
int v73; // r9d
const cocos2d::CCPoint *v74; // r14
cocos2d::CCDirector *v75; // rax
cocos2d::CCDirector *v76; // rax
float v77; // xmm1_4
cocos2d::CCSprite *v78; // rax
CCMenuItemSpriteExtra *v79; // rax
CCMenuItemSpriteExtra *m_submitButton; // r15
float v81; // [rsp+8h] [rbp-B8h] BYREF
unsigned __int64 v82; // [rsp+10h] [rbp-B0h] BYREF
__m128 v83; // [rsp+18h] [rbp-A8h] BYREF
std::string v84; // [rsp+28h] [rbp-98h] BYREF
unsigned __int64 v85; // [rsp+40h] [rbp-80h] BYREF
unsigned __int8 v86; // [rsp+48h] [rbp-78h] BYREF
_BYTE v87[23]; // [rsp+49h] [rbp-77h] BYREF
std::string v88; // [rsp+60h] [rbp-60h] BYREF
unsigned __int64 v89[2]; // [rsp+78h] [rbp-48h] BYREF
float v90; // [rsp+88h] [rbp-38h]
float v91; // [rsp+8Ch] [rbp-34h] BYREF
float v92; // [rsp+90h] [rbp-30h]
bool v93; // [rsp+97h] [rbp-29h]
double v94; // 0:xmm0_8.8
double v95; // 0:xmm0_8.8
cocos2d::CCRect v96; // 0:xmm0_8.8,8:xmm1_8.8
result = cocos2d::CCLayer::init(a1);
if ( !result )
return result;
v93 = result;
v4 = GameManager::sharedState();
v86 = 28;
strcpy(v87, "secretLoop.mp3");
GameManager::fadeInMusic(v1, (__int64)v4, &v86);
if ( (v86 & 1) != 0 )
operator delete(*(void **)&v87[15]);
((void (__fastcall *)(SecretLayer *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(SecretLayer *, __int64))a1->setKeyboardEnabled)(a1, 1);
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v94 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v91);
v5 = cocos2d::CCDictionary::create();
a1->m_messageThreads = v5;
cocos2d::CCObject::retain(v5);
v6 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v6, "geometry.ach.secret06") )
{
m_messageThreads = a1->m_messageThreads;
v8 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64, double))v8->setTag)(v8, 6, v94);
cocos2d::CCDictionary::setObject(m_messageThreads, v8, 6);
}
v9 = a1->m_messageThreads;
v10 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64, double))v10->setTag)(v10, 101, v94);
cocos2d::CCDictionary::setObject(v9, v10, 101);
v11 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v11, "geometry.ach.secret07") )
{
v12 = a1->m_messageThreads;
v13 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v13->setTag)(v13, 7);
cocos2d::CCDictionary::setObject(v12, v13, 7);
}
v14 = a1->m_messageThreads;
v15 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v15->setTag)(v15, 102);
cocos2d::CCDictionary::setObject(v14, v15, 102);
v16 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v16, "geometry.ach.secret08") )
{
v17 = a1->m_messageThreads;
v18 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v18->setTag)(v18, 8);
cocos2d::CCDictionary::setObject(v17, v18, 8);
}
v19 = a1->m_messageThreads;
v20 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v20->setTag)(v20, 103);
cocos2d::CCDictionary::setObject(v19, v20, 103);
v21 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v21, "geometry.ach.secret09") )
{
v22 = a1->m_messageThreads;
v23 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v23->setTag)(v23, 9);
cocos2d::CCDictionary::setObject(v22, v23, 9);
}
v24 = a1->m_messageThreads;
v25 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v25->setTag)(v25, 104);
cocos2d::CCDictionary::setObject(v24, v25, 104);
v26 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v26, "geometry.ach.secret10") )
{
v27 = a1->m_messageThreads;
v28 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v28->setTag)(v28, 10);
cocos2d::CCDictionary::setObject(v27, v28, 10);
}
v29 = a1->m_messageThreads;
v30 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v30->setTag)(v30, 105);
cocos2d::CCDictionary::setObject(v29, v30, 105);
v31 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v31, "geometry.ach.secret13") )
{
v32 = a1->m_messageThreads;
v33 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v33->setTag)(v33, 13);
cocos2d::CCDictionary::setObject(v32, v33, 13);
}
v34 = a1->m_messageThreads;
v35 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v35->setTag)(v35, 120);
cocos2d::CCDictionary::setObject(v34, v35, 120);
v36 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v36, "geometry.ach.secret14") )
{
v37 = a1->m_messageThreads;
v38 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v38->setTag)(v38, 14);
cocos2d::CCDictionary::setObject(v37, v38, 14);
}
v39 = a1->m_messageThreads;
v40 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v40->setTag)(v40, 121);
cocos2d::CCDictionary::setObject(v39, v40, 121);
v41 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v41, "geometry.ach.secret15") )
{
v42 = a1->m_messageThreads;
v43 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v43->setTag)(v43, 15);
cocos2d::CCDictionary::setObject(v42, v43, 15);
}
v44 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v44, "geometry.ach.secret16") )
{
v45 = a1->m_messageThreads;
v46 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v46->setTag)(v46, 16);
cocos2d::CCDictionary::setObject(v45, v46, 16);
}
v47 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v47, "geometry.ach.secret17") )
{
v48 = a1->m_messageThreads;
v49 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v49->setTag)(v49, 17);
cocos2d::CCDictionary::setObject(v48, v49, 17);
}
v50 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v50, "geometry.ach.secret19") )
{
v51 = a1->m_messageThreads;
v52 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v52->setTag)(v52, 19);
cocos2d::CCDictionary::setObject(v51, v52, 19);
}
v53 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v53, "geometry.ach.v2.secret03") )
{
v54 = GameManager::sharedState();
if ( GameManager::getUGV(v54, "2") )
{
v55 = a1->m_messageThreads;
v56 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v56->setTag)(v56, 11);
cocos2d::CCDictionary::setObject(v55, v56, 11);
}
}
v57 = cocos2d::CCSprite::create_1("GJ_gradientBG.png");
sub_10028CBE0((float *)v89, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v57->setAnchorPoint)(v57, v89);
((void (__fastcall *)(SecretLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v57, 4294967293LL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v57->setScaleX)(v57, (float)(v91 + 10.0) / v57->m_obRect.size.width);
((void (__fastcall *)(cocos2d::CCSprite *, float))v57->setScaleY)(
v57,
(float)(v92 + 10.0) / v57->m_obRect.size.height);
sub_10028CBE0((float *)v89, -5.0, -5.0);
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v57->setPosition)(v57, v89);
BYTE2(v89[0]) = 100;
LOWORD(v89[0]) = 19200;
((void (__fastcall *)(cocos2d::CCSprite *, unsigned __int64 *))v57->setColor)(v57, v89);
sub_10028CC00((__int64)v89, 0.0, 0.0, (__m128)0x42200000u, (__m128)0x42200000u);
v58 = cocos2d::CCLabelBMFont::create_3("The Vault", "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v58->setScale)(v58, 1.0);
((void (__fastcall *)(SecretLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v58);
sub_10028CBE0(v83.f32, v91 * 0.5, v92 + -24.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __m128 *))v58->setPosition)(v58, &v83);
sub_10028CBE0((float *)&v82, v91 * 0.5, (float)(v92 * 0.5) + 50.0);
v59 = cocos2d::CCLabelBMFont::create_3(" ", "bigFont.fnt");
a1->m_messageLabel = v59;
((void (__fastcall *)(SecretLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v59);
m_messageLabel = a1->m_messageLabel;
sub_10028CBE0((float *)&v85, 0.0, 43.0);
sub_10028CCE0((double *)v83.i64, &v82, &v85);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __m128 *))m_messageLabel->setPosition)(m_messageLabel, &v83);
if ( !a1->m_selectedThread )
{
*(_QWORD *)&v61 = 1065353216;
if ( a1->m_doomedIndex <= 0 )
{
v90 = (float)((float)a1->m_basicMessageCount * -0.079999998) + 1.0;
HIDWORD(v61) = 0;
*(float *)&v61 = (float)rand() * 4.6566129e-10;
if ( *(float *)&v61 > v90 )
SecretLayer::selectAThread(a1);
}
if ( !a1->m_selectedThread )
{
SecretLayer::getBasicMessage(&v88, a1, v61);
v62 = a1->m_messageLabel;
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_35;
LABEL_37:
data = v88.__r_.__value_.__s.__data_;
goto LABEL_38;
}
}
SecretLayer::getThreadMessage(&v88);
v62 = a1->m_messageLabel;
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_37;
LABEL_35:
data = v88.__r_.__value_.__l.__data_;
LABEL_38:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))v62->setString)(v62, data);
v96.size = (cocos2d::CCSize)1058642330LL;
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 320.0, 0.60000002, 0.0);
if ( (*(_BYTE *)&v88.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v88.__r_.__value_.__l.__data_);
*(double *)&v96.origin = sub_10028D180(&v83, v89);
v64 = cocos2d::extension::CCScale9Sprite::create_2("square02b_small.png", v96);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v64->setOpacity)(v64, 100);
sub_10028CBF0(v83.f32, 200.0, 40.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __m128 *))v64->setContentSize)(v64, &v83);
((void (__fastcall *)(SecretLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->addChild_0)(
a1,
v64,
4294967294LL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, unsigned __int64 *))v64->setPosition)(v64, &v82);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, void *))v64->setColor)(v64, &unk_100821C64);
v65 = CCTextInputNode::create(180.0, 50.0, "...", "Thonburi", 24, "bigFont.fnt");
a1->m_searchInput = v65;
((void (__fastcall *)(SecretLayer *, CCTextInputNode *, __int64))a1->addChild_0)(a1, v65, 20);
m_searchInput = a1->m_searchInput;
m_searchInput->m_delegate = &a1->TextInputDelegate;
((void (__fastcall *)(CCTextInputNode *, unsigned __int64 *))m_searchInput->setPosition)(m_searchInput, &v82);
CCTextInputNode::setMaxLabelScale(a1->m_searchInput, 0.69999999);
CCTextInputNode::setMaxLabelWidth(a1->m_searchInput, 180.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))a1->m_searchInput->m_textField->setVisible)(
a1->m_searchInput->m_textField,
0);
v67 = a1->m_searchInput;
v67->m_maxLabelLength = 20;
v84.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v84.__r_.__value_.__r.__words[0] = 65;
v84.__r_.__value_.__l.__size_ = 63;
strcpy(v84.__r_.__value_.__l.__data_, " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
CCTextInputNode::setAllowedChars((std::string *)v67, &v84);
if ( (*(_BYTE *)&v84.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v84.__r_.__value_.__l.__data_);
SecretLayer::updateSearchLabel(a1, "");
v68 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v69 = CCMenuItemSpriteExtra::create(v68, nullptr, a1, (cocos2d::SEL_MenuHandler)(unsigned __int64)SecretLayer::onBack);
CCMenuItemSpriteExtra::setSizeMult(v69, 1.5);
v74 = (const cocos2d::CCPoint *)sub_100792C50((_DWORD)v69, 0, v70, v71, v72, v73);
((void (__fastcall *)(SecretLayer *, const cocos2d::CCPoint *, __int64))a1->addChild_0)(a1, v74, 1);
v75 = cocos2d::CCDirector::sharedDirector();
v90 = sub_100484D90((__int64)v75) + 24.0;
v76 = cocos2d::CCDirector::sharedDirector();
v77 = sub_100484D70((__int64)v76) + -23.0;
sub_10028CBE0((float *)&v85, v90, v77);
(*(void (__fastcall **)(const cocos2d::CCPoint *, unsigned __int64 *))(*(_QWORD *)v74 + 184LL))(v74, &v85);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v69);
v78 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock_001.png");
v79 = CCMenuItemSpriteExtra::create(
v78,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)SecretLayer::onSubmit);
a1->m_submitButton = v79;
(*(void (__fastcall **)(const cocos2d::CCPoint *, CCMenuItemSpriteExtra *))(*(_QWORD *)v74 + 440LL))(v74, v79);
m_submitButton = a1->m_submitButton;
sub_10028CBE0(&v81, v91 * 0.5, (float)(0.5 * v92) + -20.0);
*(cocos2d::CCPoint *)&v95 = cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v85, v74);
((void (__fastcall *)(CCMenuItemSpriteExtra *, unsigned __int64 *, double))m_submitButton->setPosition)(
m_submitButton,
&v85,
v95);
CCMenuItemSpriteExtra::setSizeMult(a1->m_submitButton, 0.69999999);
return v93;
}