//
// SecretLayer4::init from 0x100353e24 to 0x100354854 (2608 bytes)
//
// 1 xrefs:
// > ??> @ 0x1007f3740
//
// 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 SecretLayer4::init(SecretLayer4 *a1)
{
_BOOL4 v2; // w19
cocos2d::CCTextureCache *v3; // x0
cocos2d::CCSpriteFrameCache *v4; // x0
GameManager *v5; // x21
cocos2d::CCDirector *v6; // x0
cocos2d::CCDictionary *v7; // x0
AchievementManager *v8; // x0
cocos2d::CCDictionary *m_messageThreads; // x21
cocos2d::CCNode *v10; // x22
AchievementManager *v11; // x0
cocos2d::CCDictionary *v12; // x21
cocos2d::CCNode *v13; // x22
AchievementManager *v14; // x0
cocos2d::CCDictionary *v15; // x21
cocos2d::CCNode *v16; // x22
AchievementManager *v17; // x0
cocos2d::CCDictionary *v18; // x21
cocos2d::CCNode *v19; // x22
AchievementManager *v20; // x0
cocos2d::CCDictionary *v21; // x21
cocos2d::CCNode *v22; // x22
AchievementManager *v23; // x0
cocos2d::CCDictionary *v24; // x21
cocos2d::CCNode *v25; // x22
AchievementManager *v26; // x0
cocos2d::CCDictionary *v27; // x21
cocos2d::CCNode *v28; // x22
GameManager *v29; // x0
cocos2d::CCDelayTime *v30; // x21
char v31; // w0
__int64 v32; // x1
__int64 v33; // x2
__int64 v34; // x3
__int64 v35; // x4
__int64 v36; // x5
__int64 v37; // x6
__int64 v38; // x7
cocos2d::CCSequence *v39; // x0
cocos2d::CCSprite *v40; // x21
__n128 v41; // q0
__n128 v42; // q1
__n128 v43; // q0
__n128 v44; // q1
cocos2d::CCLabelBMFont *v45; // x21
__n128 v46; // q0
__n128 v47; // q1
__n128 v48; // q0
__n128 v49; // q1
cocos2d::CCLabelBMFont *v50; // x0
__n128 v51; // q0
cocos2d::CCLabelBMFont *m_messageLabel; // x21
__n128 v53; // q1
double v54; // d0
double v55; // d0
cocos2d::extension::CCScale9Sprite *v56; // x21
CCTextInputNode *v57; // x0
CCTextInputNode *m_searchInput; // x0
CCTextInputNode *v59; // x21
cocos2d::CCSprite *v60; // x0
CCMenuItemSpriteExtra *v61; // x22
__int64 v62; // x1
__int64 v63; // x2
__int64 v64; // x3
__int64 v65; // x4
__int64 v66; // x5
__int64 v67; // x6
__int64 v68; // x7
cocos2d::CCMenu *v69; // x21
cocos2d::CCDirector *v70; // x0
float v71; // s8
cocos2d::CCDirector *v72; // x0
__n128 v73; // q1
__n128 v74; // q0
cocos2d::CCNode *v75; // x22
cocos2d::CCSprite *v76; // x23
__n128 v77; // q0
__n128 v78; // q1
CCMenuItemSpriteExtra *v79; // x0
__n128 v80; // q0
CCMenuItemSpriteExtra *m_submitButton; // x22
__n128 v82; // q1
GameStatsManager *v83; // x21
bool isSpecialChestUnlocked; // w0
bool v85; // w21
cocos2d::CCMenu *v86; // x21
GameStatsManager *v87; // x22
__int64 RewardForSpecialChest; // x22
GJChestSprite *v89; // x22
CCMenuItemSpriteExtra *v90; // x20
float v91; // s8
__n128 v92; // q1
__n128 v93; // q0
__n128 v94; // q0
__n128 v95; // q1
float v97; // s1
float v98; // s2
float v99; // s3
std::string __str; // [xsp+10h] [xbp-110h] BYREF
void *v101[2]; // [xsp+28h] [xbp-F8h] BYREF
char v102; // [xsp+3Fh] [xbp-E1h]
void *v103[2]; // [xsp+40h] [xbp-E0h] BYREF
char v104; // [xsp+57h] [xbp-C9h]
cocos2d::CCPoint v105; // [xsp+58h] [xbp-C8h] BYREF
std::string v106; // [xsp+60h] [xbp-C0h] BYREF
float32x2_t v107[2]; // [xsp+78h] [xbp-A8h] BYREF
void *__p[2]; // [xsp+88h] [xbp-98h] BYREF
char v109; // [xsp+9Fh] [xbp-81h]
float32x2_t v110; // [xsp+A0h] [xbp-80h] BYREF
float32x2_t v111; // [xsp+A8h] [xbp-78h] BYREF
float v112[4]; // [xsp+B0h] [xbp-70h] BYREF
float v113; // [xsp+C0h] [xbp-60h]
float v114; // [xsp+C4h] [xbp-5Ch]
void *v115[2]; // [xsp+C8h] [xbp-58h] BYREF
char v116; // [xsp+DFh] [xbp-41h]
cocos2d::CCPoint v117; // 0:kr08_8.8
cocos2d::CCPoint v118; // 0:kr10_8.8
cocos2d::SEL_CallFunc v119; // 0:x1.16
cocos2d::SEL_MenuHandler v120; // 0:x3.16
cocos2d::SEL_MenuHandler v121; // 0:x3.16
cocos2d::SEL_MenuHandler v122; // 0:x3.16
cocos2d::CCRect v123; // 0:kr20_16.16
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v3 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v3, "SecretSheet.png", 0);
v4 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v4, "SecretSheet.plist");
v5 = GameManager::sharedState();
sub_100009900(v115, "secretLoop03.mp3");
GameManager::fadeInMusic((__int64)v5, (__int64)v115);
if ( v116 < 0 )
operator delete(v115[0]);
((void (__fastcall *)(SecretLayer4 *, __int64))a1->setKeypadEnabled)(a1, 1);
((void (__fastcall *)(SecretLayer4 *, __int64))a1->setKeyboardEnabled)(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCDictionary::create();
a1->m_messageThreads = v7;
cocos2d::CCObject::retain(v7);
v8 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v8, "geometry.ach.v3.secret01") )
{
m_messageThreads = a1->m_messageThreads;
v10 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v10->setTag)(v10, 1);
cocos2d::CCDictionary::setObject(m_messageThreads, v10, 1);
}
v11 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v11, "geometry.ach.v3.secret02") )
{
v12 = a1->m_messageThreads;
v13 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v13->setTag)(v13, 2);
cocos2d::CCDictionary::setObject(v12, v13, 2);
}
v14 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v14, "geometry.ach.v3.secret03") )
{
v15 = a1->m_messageThreads;
v16 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v16->setTag)(v16, 3);
cocos2d::CCDictionary::setObject(v15, v16, 3);
}
v17 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v17, "geometry.ach.v3.secret04") )
{
v18 = a1->m_messageThreads;
v19 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v19->setTag)(v19, 4);
cocos2d::CCDictionary::setObject(v18, v19, 4);
}
v20 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v20, "geometry.ach.v3.secret05") )
{
v21 = a1->m_messageThreads;
v22 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v22->setTag)(v22, 5);
cocos2d::CCDictionary::setObject(v21, v22, 5);
}
v23 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v23, "geometry.ach.v3.secret06") )
{
v24 = a1->m_messageThreads;
v25 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v25->setTag)(v25, 6);
cocos2d::CCDictionary::setObject(v24, v25, 6);
}
v26 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v26, "geometry.ach.v3.secret07") )
{
v27 = a1->m_messageThreads;
v28 = cocos2d::CCNode::create();
((void (__fastcall *)(cocos2d::CCNode *, __int64))v28->setTag)(v28, 7);
cocos2d::CCDictionary::setObject(v27, v28, 7);
}
v29 = GameManager::sharedState();
if ( !GameManager::getUGV(v29, "9") )
{
v30 = cocos2d::CCDelayTime::create(0.8);
v119.ptr = (void (*)(void))SecretLayer4::showFirstDialog;
v119.adj = 0;
v31 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v119);
v39 = sub_10018A494(v30, v32, v33, v34, v35, v36, v37, v38, v31);
cocos2d::CCNode::runAction(a1, v39);
a1->m_basicMessageIndex = 30;
}
v40 = cocos2d::CCSprite::create("GJ_gradientBG.png");
v41.n128_u32[0] = 0;
v42.n128_u32[0] = 0;
sub_100022980(v41, v42, v112);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v40->setAnchorPoint)(v40, v112);
((void (__fastcall *)(SecretLayer4 *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v40, 4294967293LL);
((void (__fastcall *)(cocos2d::CCSprite *, float))v40->setScaleX)(
v40,
(float)(v113 + 10.0) / v40->m_obRect.size.width);
v43 = ((__n128 (__fastcall *)(cocos2d::CCSprite *, float))v40->setScaleY)(
v40,
(float)(v114 + 10.0) / v40->m_obRect.size.height);
v43.n128_u32[0] = -5.0;
v44.n128_u32[0] = -5.0;
sub_100022980(v43, v44, v112);
((void (__fastcall *)(cocos2d::CCSprite *, float *))v40->setPosition)(v40, v112);
strcpy((char *)v112, "K\n");
((void (__fastcall *)(cocos2d::CCSprite *, float *))v40->setColor)(v40, v112);
sub_100022990(v112, 0.0, 0.0, 40.0, 40.0);
v45 = cocos2d::CCLabelBMFont::create_1("Chamber of Time", "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v45->setScale)(v45, 1.0);
v46 = ((__n128 (__fastcall *)(SecretLayer4 *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v45);
v46.n128_f32[0] = v113 * 0.5;
v47.n128_f32[0] = v114 + -24.0;
sub_100022980(v46, v47, v107);
v48 = ((__n128 (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v45->setPosition)(v45, v107);
v48.n128_f32[0] = v113 * 0.5;
v49.n128_f32[0] = (float)(v114 * 0.5) + 50.0;
sub_100022980(v48, v49, &v111);
v50 = cocos2d::CCLabelBMFont::create_1(" ", "bigFont.fnt");
a1->m_messageLabel = v50;
v51 = ((__n128 (__fastcall *)(SecretLayer4 *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v50);
m_messageLabel = a1->m_messageLabel;
v53.n128_u32[0] = 1110179840;
v51.n128_u32[0] = 0;
sub_100022980(v51, v53, &v110);
*(float32x2_t *)&v54 = sub_1000229DC(&v111, &v110, v107);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *, double))m_messageLabel->setPosition)(
m_messageLabel,
v107,
v54);
SecretLayer4::getMessage(__p, a1);
SecretLayer4::updateMessageLabel(a1, __p);
if ( v109 < 0 )
operator delete(__p[0]);
v55 = sub_100022B98(v107, (__int64)v112);
v123.origin.x = *(float *)&v55;
v123.origin.y = v97;
v123.size.width = v98;
v123.size.height = v99;
v56 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v123);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, __int64))v56->setOpacity)(v56, 100);
sub_100022988((float *)v107, 200.0, 40.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v56->setContentSize)(v56, v107);
((void (__fastcall *)(SecretLayer4 *, cocos2d::extension::CCScale9Sprite *, __int64))a1->addChild_0)(
a1,
v56,
4294967294LL);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, float32x2_t *))v56->setPosition)(v56, &v111);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, _BYTE *))v56->setColor)(v56, algn_1006455A5);
v57 = CCTextInputNode::create(180.0, 50.0, "...", "Thonburi", 24, "bigFont.fnt");
a1->m_searchInput = v57;
((void (__fastcall *)(SecretLayer4 *, CCTextInputNode *, __int64))a1->addChild_0)(a1, v57, 20);
m_searchInput = a1->m_searchInput;
m_searchInput->m_delegate = &a1->TextInputDelegate;
((void (__fastcall *)(CCTextInputNode *, float32x2_t *))m_searchInput->setPosition)(m_searchInput, &v111);
CCTextInputNode::setMaxLabelScale(a1->m_searchInput, 0.7);
CCTextInputNode::setMaxLabelWidth(a1->m_searchInput, 180.0);
((void (__fastcall *)(cocos2d::CCTextFieldTTF *, _QWORD))a1->m_searchInput->m_textField->setVisible)(
a1->m_searchInput->m_textField,
0);
v59 = a1->m_searchInput;
v59->m_maxLabelLength = 100;
sub_100009900(
&v106,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
CCTextInputNode::setAllowedChars((std::string *)v59, &v106);
if ( SHIBYTE(v106.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v106.__r_.__value_.__l.__data_);
SecretLayer4::updateSearchLabel(a1, "");
v60 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v120.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretLayer4::onBack;
v120.adj = 0;
v61 = CCMenuItemSpriteExtra::create(v60, nullptr, a1, v120);
CCMenuItemSpriteExtra::setSizeMult(v61, 1.5);
v69 = sub_1001D7ED0(v61, v62, v63, v64, v65, v66, v67, v68, 0);
((void (__fastcall *)(SecretLayer4 *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v69, 1);
v70 = cocos2d::CCDirector::sharedDirector();
v71 = sub_1001768D8((__int64)v70) + 24.0;
v72 = cocos2d::CCDirector::sharedDirector();
v73.n128_f32[0] = sub_1001768C8((__int64)v72) + -23.0;
v74.n128_f32[0] = v71;
sub_100022980(v74, v73, &v110);
((void (__fastcall *)(cocos2d::CCMenu *, float32x2_t *))v69->setPosition)(v69, &v110);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v61);
v75 = cocos2d::CCNode::create();
sub_100022988((float *)&v110, 80.0, 80.0);
((void (__fastcall *)(cocos2d::CCNode *, float32x2_t *))v75->setContentSize)(v75, &v110);
v76 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_secretLock3_001.png");
v77 = ((__n128 (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v75->addChild)(v75, v76);
v77.n128_u32[0] = 1109393408;
v78.n128_u32[0] = 1109393408;
sub_100022980(v77, v78, &v110);
((void (__fastcall *)(cocos2d::CCSprite *, float32x2_t *))v76->setPosition)(v76, &v110);
v121.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretLayer4::onSubmit;
v121.adj = 0;
v79 = CCMenuItemSpriteExtra::create(v75, nullptr, a1, v121);
a1->m_submitButton = v79;
v80 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v69->addChild)(v69, v79);
m_submitButton = a1->m_submitButton;
v80.n128_f32[0] = v113 * 0.5;
v82.n128_f32[0] = (float)(v114 * 0.5) + -20.0;
sub_100022980(v80, v82, &v105);
v117 = cocos2d::CCNode::convertToNodeSpace(v69, &v105);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))m_submitButton->setPosition)(
m_submitButton,
&v110,
v117.x,
v117.y);
CCMenuItemSpriteExtra::setSizeMult(a1->m_submitButton, 1.0);
v83 = GameStatsManager::sharedState();
sub_100009900(v103, "0003");
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((__int64)v83, (char *)v103);
v85 = isSpecialChestUnlocked;
if ( v104 < 0 )
{
operator delete(v103[0]);
if ( v85 )
return v2;
}
else if ( isSpecialChestUnlocked )
{
return v2;
}
v86 = cocos2d::CCMenu::create();
((void (__fastcall *)(SecretLayer4 *, cocos2d::CCMenu *, __int64))a1->addChild_0)(a1, v86, 10);
v87 = GameStatsManager::sharedState();
sub_100009900(v101, "0003");
RewardForSpecialChest = GameStatsManager::getRewardForSpecialChest((__int64)v87, (__int64)v101);
if ( v102 < 0 )
operator delete(v101[0]);
v89 = GJChestSprite::create(*(_DWORD *)(RewardForSpecialChest + 64));
GJChestSprite::switchToState(v89, Closed, 0);
((void (__fastcall *)(GJChestSprite *, float))v89->setScale)(v89, 0.6);
v122.ptr = (void (__cdecl *)(cocos2d::CCObject *))SecretLayer4::onChest01;
v122.adj = 0;
v90 = CCMenuItemSpriteExtra::create(v89, nullptr, a1, v122);
sub_100009900(&__str, "chestClick.ogg");
std::string::operator=((std::string *)&v90->m_selectSound, &__str);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
sub_100022988((float *)&v110, 60.0, 48.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *))v90->setContentSize)(v90, &v110);
v91 = *(float *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v90->getContentSize)(v90) * 0.5;
v92.n128_f32[0] = *(float *)(((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v90->getContentSize)(v90) + 4) * 0.5;
v93.n128_f32[0] = v91;
sub_100022980(v93, v92, &v110);
((void (__fastcall *)(GJChestSprite *, float32x2_t *))v89->setPosition)(v89, &v110);
v94 = ((__n128 (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v86->addChild)(v86, v90);
v94.n128_f32[0] = v113 + -60.0;
v95.n128_u32[0] = 1114636288;
sub_100022980(v94, v95, &v105);
v118 = cocos2d::CCNode::convertToNodeSpace(v86, &v105);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v90->setPosition)(
v90,
&v110,
v118.x,
v118.y);
}
return v2;
}