//
// TutorialLayer::loadPage from 0x1404cc310 to 0x1404cc934 (1572 bytes)
//
// 3 xrefs:
// > TutorialLayer::init @ 0x1404cc2be
// > TutorialLayer::onNext @ 0x1404cc304
// > ??> @ 0x1406dd3dc
//
// 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
void TutorialLayer::loadPage(TutorialLayer *a1, int a2)
{
float v2; // xmm0_4
int v3; // edi
__int64 v5; // rcx
int m_page; // edx
cocos2d::CCString *v7; // rax
const char *CString; // rbx
cocos2d::CCTextureCache *v9; // rax
cocos2d::CCDirector *v10; // rax
cocos2d::CCString *v11; // rax
const char *v12; // rax
struct cocos2d::CCSprite *v13; // r14
cocos2d::CCSprite_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
__int64 v16; // rcx
float v17; // xmm0_4
cocos2d::CCSprite_vtbl *v18; // rbx
const cocos2d::CCPoint *v19; // rax
float v20; // xmm8_4
int v21; // xmm10_4
unsigned __int64 v22; // rdx
int v23; // edi
int v24; // edi
int v25; // edi
int v26; // edi
char *v27; // rcx
void **v28; // rax
size_t v29; // r8
const struct cocos2d::CCPoint *v30; // rax
char *v31; // rdi
float v32; // xmm0_4
__int64 v33; // rbx
__int64 v34; // rax
_BOOL8 v35; // rdx
CCMenuItemSpriteExtra *m_nextButton; // rcx
CCMenuItemSpriteExtra_vtbl *v37; // rax
_BOOL8 v38; // rdx
_BOOL8 v39; // rdx
_BOOL8 v40; // rdx
void *v41; // rcx
float v42; // [rsp+48h] [rbp-59h]
__int128 v43; // [rsp+58h] [rbp-49h] BYREF
__int64 v44; // [rsp+68h] [rbp-39h]
__int64 v45; // [rsp+70h] [rbp-31h]
void *Block[2]; // [rsp+80h] [rbp-21h] BYREF
__int64 v47; // [rsp+90h] [rbp-11h]
unsigned __int64 v48; // [rsp+98h] [rbp-9h]
v3 = a2;
LOBYTE(a2) = 1;
a1->m_tutorialLayer->removeAllChildrenWithCleanup(a1->m_tutorialLayer, a2);
m_page = a1->m_page;
if ( m_page )
{
v7 = cocos2d::CCString::createWithFormat("tutorial_%02d.png", m_page);
CString = cocos2d::CCString::getCString(v7);
v9 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::removeTextureForKey(v9, CString);
}
a1->m_page = v3;
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v10);
v11 = cocos2d::CCString::createWithFormat("tutorial_%02d.png", v3);
v12 = cocos2d::CCString::getCString(v11);
v13 = cocos2d::CCSprite::create(v12);
v14 = v13->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v2, 0.0);
v14->setAnchorPoint(v13, v15);
if ( *(_BYTE *)(cocos2d::CCApplication::sharedApplication(v16) + 236) )
((void (__fastcall *)(struct cocos2d::CCSprite *))v13->setScale_0)(v13);
v17 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *))a1->m_tutorialLayer->addChild_1)(
a1->m_tutorialLayer,
v13);
v18 = v13->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v17, (float)((float)(v42 * 0.5) - 210.0) + 10.0);
v18->setPosition_0(v13, v19);
v20 = 0.69999999;
v21 = 1109393408;
*(_OWORD *)Block = 0;
v47 = 0;
v22 = 15;
v48 = 15;
LOBYTE(Block[0]) = 0;
v23 = v3 - 1;
if ( !v23 )
{
v27 = (char *)sub_14003AA10(0x50u);
v47 = 66;
v22 = 79;
strcpy(v27, "Tap the screen to jump.\nHold down to keep jumping.");
goto LABEL_17;
}
v24 = v23 - 1;
if ( !v24 )
{
v27 = (char *)sub_14003AA10(0x40u);
v47 = 52;
v22 = 63;
strcpy(v27, "Hold to fly up.\nRelease to fly down.");
goto LABEL_17;
}
v25 = v24 - 1;
if ( v25 )
{
v26 = v25 - 1;
if ( !v26 )
{
v27 = (char *)sub_14003AA10(0x80u);
v47 = 125;
v22 = 127;
strcpy(
v27,
"You can place checkpoints manually, or use the auto-checkpoint feature.\n"
"Tap the delete button to remove your last checkpoint.");
v20 = 0.55000001;
v21 = 1110704128;
goto LABEL_17;
}
if ( v26 != 1 )
{
v27 = (char *)Block[0];
goto LABEL_18;
}
v27 = (char *)sub_14003AA10(0x90u);
v47 = 129;
v22 = 143;
strcpy(
v27,
"Jump Orbs activate when you are on top of them.\n"
"Tap while touching an orb to interact with it and use its effect.");
}
else
{
v27 = (char *)sub_14003AA10(0x70u);
v47 = 106;
v22 = 111;
strcpy(
v27,
"You can enter practice mode from the pause menu.\nPractice mode lets you place checkpoints.");
}
v20 = 0.60000002;
LABEL_17:
v48 = v22;
Block[0] = v27;
LABEL_18:
v28 = Block;
if ( v22 > 0xF )
v28 = (void **)v27;
v43 = 0;
v44 = 0;
v45 = 0;
v29 = -1;
do
++v29;
while ( *((_BYTE *)v28 + v29) );
sub_14003A930(&v43, v28, v29);
cocos2d::CCPoint::CCPoint(0.0, 0.5);
v31 = TextArea::create((__int64)&v43, &qword_14052A4D8, 1.0, 400.0 / v20, v30, v21, 0);
(*(void (__fastcall **)(char *))(*(_QWORD *)v31 + 160LL))(v31);
v32 = ((float (__fastcall *)(cocos2d::CCLayer *, char *))a1->m_tutorialLayer->addChild_1)(a1->m_tutorialLayer, v31);
v33 = *(_QWORD *)v31;
cocos2d::CCPoint::CCPoint(v32, v42 * 0.5);
(*(void (__fastcall **)(char *, __int64))(v33 + 184))(v31, v34);
m_nextButton = a1->m_nextButton;
v37 = m_nextButton->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( a1->m_page < 5 )
{
LOBYTE(v35) = 1;
v37->setVisible(m_nextButton, v35);
LOBYTE(v40) = 1;
a1->m_nextButton->setEnabled(a1->m_nextButton, v40);
a1->m_exitButton->setVisible(a1->m_exitButton, 0);
v39 = 0;
}
else
{
v37->setVisible(m_nextButton, 0);
a1->m_nextButton->setEnabled(a1->m_nextButton, 0);
LOBYTE(v38) = 1;
a1->m_exitButton->setVisible(a1->m_exitButton, v38);
LOBYTE(v39) = 1;
}
a1->m_exitButton->setEnabled(a1->m_exitButton, v39);
if ( v48 > 0xF )
{
v41 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v41 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v41 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v41);
}
}