//
// TutorialLayer::init from 0x1404cbda0 to 0x1404cc2e7 (1351 bytes)
//
// 5 xrefs:
// > TutorialLayer::create @ 0x1404cbd53
// > TutorialLayer::create @ 0x1404cbd5a
// > TutorialLayer::create @ 0x1404cbd44
// > ??> @ 0x140621b10
// > ??> @ 0x1406dd3d0
//
// 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
//
// Hidden C++ exception states: #wind=2
bool TutorialLayer::init(TutorialLayer *a1)
{
bool result; // al
_BOOL8 v3; // rdx
_BOOL8 v4; // rdx
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
cocos2d::CCLayer *v7; // rax
cocos2d::CCLayer *v8; // rax
struct cocos2d::CCRect *v9; // rax
struct cocos2d::extension::CCScale9Sprite *v10; // rdi
__int64 v11; // rdx
cocos2d::extension::CCScale9Sprite_vtbl *v12; // rbx
const cocos2d::CCSize *v13; // rax
float v14; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v15; // rbx
const cocos2d::CCPoint *v16; // rax
struct cocos2d::CCLabelBMFont *v17; // rdi
float v18; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v19; // rbx
const cocos2d::CCPoint *v20; // rax
float width; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v22; // rbx
struct cocos2d::CCSprite *v23; // rax
CCMenuItemSpriteExtra *v24; // rax
cocos2d::CCMenu *v25; // rax
cocos2d::CCMenu_vtbl *v26; // rbx
const cocos2d::CCPoint *v27; // rax
ButtonSprite *v28; // rax
cocos2d::CCNode *v29; // rbx
CCMenuItemSpriteExtra *v30; // rax
ButtonSprite *v31; // rax
cocos2d::CCNode *v32; // rbx
CCMenuItemSpriteExtra *v33; // rax
float v34; // xmm0_4
CCMenuItemSpriteExtra_vtbl *v35; // rbx
struct cocos2d::CCPoint v36; // rax
CCMenuItemSpriteExtra_vtbl *v37; // rbx
const cocos2d::CCPoint *v38; // rax
cocos2d::CCRect v39; // [rsp+50h] [rbp-58h] BYREF
ButtonSprite *v40; // [rsp+B8h] [rbp+10h] BYREF
float v41; // [rsp+C0h] [rbp+18h]
struct cocos2d::CCPoint v42; // [rsp+C8h] [rbp+20h] BYREF
LODWORD(v40) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&v40);
if ( result )
{
LOBYTE(v3) = 1;
a1->setTouchEnabled(a1, v3);
LOBYTE(v4) = 1;
a1->setKeypadEnabled(a1, v4);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v7;
a1->addChild_1(a1, v7);
v8 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_tutorialLayer = v8;
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v8);
cocos2d::CCRect::CCRect(&v39, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v9);
LOBYTE(v11) = -1;
v10->setOpacity(&v10->cocos2d::CCRGBAProtocol, v11);
v12 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v40, 420.0, 260.0);
v12->setContentSize(v10, v13);
v14 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
0xFFFFFFFFLL);
v15 = v10->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v14, v41 * 0.5);
v15->setPosition_0(v10, v16);
v17 = cocos2d::CCLabelBMFont::create("How To Play", &qword_14052A4D8);
v18 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v17,
20);
v19 = v17->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v18, v41 * 0.5);
v19->setPosition_0(v17, v20);
width = v17->getContentSize(v17)->width;
if ( width > 300.0 )
{
v22 = v17->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v17->getContentSize(v17);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v22->setScale_0)(v17);
}
a1->m_joystickConnected = -1;
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v24 = CCMenuItemSpriteExtra::create(v23, nullptr, a1, (cocos2d::SEL_MenuHandler *)TutorialLayer::onClose);
HIDWORD(v24->m_pfnSelector.adj) = 1070386381;
v25 = cocos2d::CCMenu::create(v24, 0);
a1->m_buttonMenu = v25;
v26 = v25->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(width, (float)((float)(v41 * 0.5) - 210.0) + 10.0);
v26->setPosition_0(a1->m_buttonMenu, v27);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
v40 = (ButtonSprite *)operator new(0x2C0u);
v28 = ButtonSprite::ButtonSprite(v40);
v29 = v28;
if ( v28 )
{
if ( ButtonSprite::init_1(
v28,
"Next",
220,
0,
0.60000002,
0,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
40.0) )
{
cocos2d::CCObject::autorelease(v29);
}
else
{
((void (__fastcall *)(cocos2d::CCNode *, __int64))v29->~CCNode)(v29, 1);
v29 = nullptr;
}
}
v30 = CCMenuItemSpriteExtra::create(v29, nullptr, a1, (cocos2d::SEL_MenuHandler *)TutorialLayer::onNext);
a1->m_nextButton = v30;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v30);
v40 = (ButtonSprite *)operator new(0x2C0u);
v31 = ButtonSprite::ButtonSprite(v40);
v32 = v31;
if ( v31 )
{
if ( ButtonSprite::init_1(
v31,
"Exit",
220,
0,
0.60000002,
0,
(const char *)&qword_14052A4D8,
"GJ_button_01.png",
40.0) )
{
cocos2d::CCObject::autorelease(v32);
}
else
{
((void (__fastcall *)(cocos2d::CCNode *, __int64))v32->~CCNode)(v32, 1);
v32 = nullptr;
}
}
v33 = CCMenuItemSpriteExtra::create(v32, nullptr, a1, (cocos2d::SEL_MenuHandler *)TutorialLayer::onClose);
a1->m_exitButton = v33;
v34 = ((float (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild_1)(
a1->m_buttonMenu,
v33);
v35 = a1->m_nextButton->__vftable;
cocos2d::CCPoint::CCPoint(v34, (float)((float)(v41 * 0.5) + 210.0) - 52.0);
v36 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v42);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v35->setPosition_0)(a1->m_nextButton, v36);
v37 = a1->m_exitButton->__vftable;
v38 = a1->m_nextButton->getPosition_0(a1->m_nextButton);
v37->setPosition_0(a1->m_exitButton, v38);
a1->m_exitButton->setVisible(a1->m_exitButton, 0);
a1->m_page = 0;
TutorialLayer::loadPage(a1, 1);
return 1;
}
return result;
}