//
// SecretLayer6::init from 0xa96e28 to 0xa9721c (1012 bytes)
//
// 3 xrefs:
// > SecretLayer6::create @ 0xa97274
// > ??> @ 0xb0388
// > ??> @ 0x11f3a00
//
// 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 SecretLayer6::init(SecretLayer6 *a1)
{
bool v2; // w23
cocos2d::CCTextureCache *v4; // x0
cocos2d::CCSpriteFrameCache *v5; // x0
GameManager *v6; // x20
void *v7; // x0
cocos2d::CCDirector *v8; // x0
const char *v9; // x1
cocos2d::CCNode *v10; // x20
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
cocos2d::CCLabelBMFont *v14; // x20
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
SecretGame01Layer *v16; // x0
cocos2d::CCSprite *v17; // x0
CCMenuItemSpriteExtra *v18; // x24
cocos2d::CCNode *v19; // x20
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x25
cocos2d::CCDirector *v21; // x0
float v22; // s0
float v23; // s9
cocos2d::CCDirector *v24; // x0
float v25; // s0
cocos2d::CCSequence *v26; // x20
cocos2d::CCFiniteTimeAction *v27; // x0
cocos2d::CCAction *v28; // x0
unsigned int *v29; // x2
int v30; // w1
float v31; // [xsp+78h] [xbp+78h]
float v32; // [xsp+7Ch] [xbp+7Ch]
cocos2d::CCPoint v33; // [xsp+80h] [xbp+80h] BYREF
cocos2d::SEL_MenuHandler v34; // 0:x2.16
v2 = cocos2d::CCLayer::init(a1);
if ( v2 )
{
v4 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v4, "SecretSheet.png", 0);
v5 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v5, "SecretSheet.plist");
v6 = GameManager::sharedState();
sub_D153B8((int)&v33, "secretLoop03.mp3");
GameManager::fadeInMusic((__int64)v6, &v33);
v7 = (void *)(*(_QWORD *)&v33 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v33 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(*(_QWORD *)&v33 - 8LL);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(*(_QWORD *)&v33 - 8LL);
*(_DWORD *)(*(_QWORD *)&v33 - 8LL) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v7);
}
a1->setKeypadEnabled(a1, 1);
a1->setKeyboardEnabled(a1, 1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v10 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_gradientBG.png", v9);
setAnchorPoint = v10->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v33, 0.0, 0.0);
setAnchorPoint(v10, &v33);
a1->addChild_0(a1, v10, -3);
v10->setScaleX(v10, (float)(v31 + 10.0) / v10[1].m_obContentSize.height);
v10->setScaleY(v10, (float)(v32 + 10.0) / v10[1].m_sAdditionalTransform.a);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v33, -5.0, -5.0);
setPosition(v10, &v33);
getTag = v10->__vftable[1].getTag;
LOWORD(v33.x) = 30;
BYTE2(v33.x) = 60;
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCPoint *))getTag)(v10, &v33);
v14 = cocos2d::CCLabelBMFont::create();
v14->setScale(v14, 1.0);
a1->addChild(a1, v14);
v15 = v14->setPosition;
cocos2d::CCPoint::CCPoint(&v33, v31 * 0.5, v32 - 24.0);
v15(v14, &v33);
v16 = SecretGame01Layer::create();
a1->m_gameLayer = v16;
a1->addChild_0(a1, v16, 100);
v17 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_arrow_01_001.png");
v34.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v34.adj = (size_t)SecretLayer6::onBack;
v18 = CCMenuItemSpriteExtra::create(v17, nullptr, v34);
CCMenuItemSpriteExtra::setSizeMult(v18, 1.5);
v19 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v18, nullptr);
a1->addChild_0(a1, v19, 1);
v20 = v19->setPosition;
v21 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenLeft(v21);
v23 = v22;
v24 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getScreenTop(v24);
cocos2d::CCPoint::CCPoint(&v33, v23 + 24.0, v25 - 23.0);
v20(v19, &v33);
if ( PlatformToolbox::isControllerConnected() )
GameToolbox::addBackButton(a1, v18);
v26 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.5);
v27 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, SecretLayer6::startGame01, 0);
v28 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v26, v27, 0);
cocos2d::CCNode::runAction(a1, v28);
}
return v2;
}