//
// TutorialLayer::loadPage from 0x1004d7db0 to 0x1004d81bb (1035 bytes)
//
// 2 xrefs:
// > TutorialLayer::init @ 0x1004d7c73
// > TutorialLayer::onNext @ 0x1004d7d96
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:31:14 +0000
//
void __fastcall TutorialLayer::loadPage(__int64 a1, int a2)
{
__int64 v3; // rdi
__int64 CString; // r15
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
char *v9; // r15
const std::string::value_type *v10; // rsi
const std::string::value_type *v11; // rsi
const char *data; // r14
size_t v13; // rax
size_t v14; // r15
char *v15; // r12
size_t v16; // r13
char *v17; // r14
int v18; // r14d
__int64 v19; // rdi
void (__fastcall *v20)(__int64, __int64); // rax
char v21; // [rsp+0h] [rbp-80h]
__int128 __dst; // [rsp+8h] [rbp-78h] BYREF
void *__p; // [rsp+18h] [rbp-68h]
__int64 v24; // [rsp+20h] [rbp-60h] BYREF
std::string v25; // [rsp+28h] [rbp-58h] BYREF
__int64 v26; // [rsp+44h] [rbp-3Ch] BYREF
float v27; // [rsp+4Ch] [rbp-34h]
float v28; // [rsp+50h] [rbp-30h]
float v29; // [rsp+54h] [rbp-2Ch]
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 664) + 584LL))(*(_QWORD *)(a1 + 664), 1);
if ( *(_DWORD *)(a1 + 672) )
{
v3 = sub_10088E820("tutorial_%02d.png", v21);
CString = cocos2d::CCString::getCString(v3);
v5 = cocos2d::CCTextureCache::sharedTextureCache(v3);
cocos2d::CCTextureCache::removeTextureForKey(v5, CString);
}
*(_DWORD *)(a1 + 672) = a2;
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v26, v6);
v7 = sub_10088E820("tutorial_%02d.png", v21);
v8 = cocos2d::CCString::getCString(v7);
v9 = cocos2d::CCSprite::create_1(v8);
v28 = 0.0;
sub_100278250((float *)&v25, 0.0, 0.0);
(*(void (__fastcall **)(char *, std::string *))(*(_QWORD *)v9 + 296LL))(v9, &v25);
if ( *(_BYTE *)(AppDelegate::get(v9, &v25) + 84) == 1 )
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v9 + 160LL))(v9, 2.0);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 664) + 456LL))(*(_QWORD *)(a1 + 664), v9);
sub_100278250(
(float *)&v25,
(float)((float)(*(float *)&v26 * 0.5) + -210.0) + 10.0,
(float)((float)(0.5 * *((float *)&v26 + 1)) + -130.0) + 10.0);
(*(void (__fastcall **)(char *, std::string *))(*(_QWORD *)v9 + 184LL))(v9, &v25);
*(_WORD *)&v25.__r_.__value_.__l.0 = 0;
v29 = 0.69999999;
v27 = 40.0;
switch ( a2 )
{
case 1:
v10 = "Tap the screen to jump.\nHold down to keep jumping.";
goto LABEL_12;
case 2:
v10 = "Hold to fly up.\nRelease to fly down.";
LABEL_12:
std::string::assign(&v25, v10);
break;
case 3:
v11 = "You can enter practice mode from the pause menu.\n"
"Practice mode lets you place checkpoints.";
goto LABEL_9;
case 4:
std::string::assign(
&v25,
"You can place checkpoints manually, or use the auto-checkpoint feature.\n"
"Tap the delete button to remove your last checkpoint.");
v29 = 0.55000001;
v28 = -13.0;
v27 = 45.0;
break;
case 5:
v11 = "Jump Orbs activate when you are on top of them.\n"
"Tap while touching an orb to interact with it and use its effect.";
LABEL_9:
std::string::assign(&v25, v11);
v29 = 0.60000002;
v28 = -13.0;
break;
default:
break;
}
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) != 0 )
data = v25.__r_.__value_.__l.__data_;
else
data = v25.__r_.__value_.__s.__data_;
v13 = strlen(data);
if ( v13 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v14 = v13;
if ( v13 >= 0x17 )
{
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v15 = (char *)operator new(v16);
__p = v15;
*(_QWORD *)&__dst = v16 | 1;
*((_QWORD *)&__dst + 1) = v14;
goto LABEL_23;
}
LOBYTE(__dst) = 2 * v13;
v15 = (char *)&__dst + 1;
if ( v13 )
LABEL_23:
memmove(v15, data, v14);
v15[v14] = 0;
sub_100278250((float *)&v24, 0.5, 1.0);
v17 = TextArea::create(&__dst, (__int64)"bigFont.fnt", &v24, 0, 0, 1.0, 400.0 / v29, v27);
if ( (__dst & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v17 + 160LL))(v17, v29);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 664) + 456LL))(*(_QWORD *)(a1 + 664), v17);
sub_100278250(
(float *)&v24,
*(float *)&v26 * 0.5,
v28 + (float)((float)((float)(0.5 * *((float *)&v26 + 1)) + 130.0) + -75.0));
(*(void (__fastcall **)(char *, __int64 *))(*(_QWORD *)v17 + 184LL))(v17, &v24);
v18 = *(_DWORD *)(a1 + 672);
v19 = *(_QWORD *)(a1 + 680);
v20 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 344LL);
if ( v18 < 5 )
{
v20(v19, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 680) + 1056LL))(*(_QWORD *)(a1 + 680), 1);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 688) + 344LL))(*(_QWORD *)(a1 + 688), 0);
}
else
{
v20(v19, 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 680) + 1056LL))(*(_QWORD *)(a1 + 680), 0);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 688) + 344LL))(*(_QWORD *)(a1 + 688), 1);
}
(*(void (__fastcall **)(_QWORD, bool))(**(_QWORD **)(a1 + 688) + 1056LL))(*(_QWORD *)(a1 + 688), v18 >= 5);
if ( (*(_BYTE *)&v25.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v25.__r_.__value_.__l.__data_);
}