//
// TutorialLayer::init from 0x1004d7830 to 0x1004d7c8b (1115 bytes)
//
// 2 xrefs:
// > TutorialLayer::create @ 0x1004d77d4
// > ??> @ 0x100b60208
//
// 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
//
char __fastcall TutorialLayer::init(_QWORD *a1)
{
char result; // al
__int64 v2; // rax
_QWORD *v3; // rax
_QWORD *v4; // rax
void *v5; // r14
__int64 v6; // r14
double v7; // xmm0_8
float *v8; // rax
char *v9; // rax
void *v10; // rax
int v11; // r15d
int v12; // edx
int v13; // ecx
int v14; // r8d
int v15; // r9d
__int64 v16; // r15
char *v17; // rax
void *v18; // rax
char *v19; // rax
void *v20; // rax
__int64 v21; // r14
__int64 v22; // r15
__int64 v23; // r14
__int64 v24; // rax
unsigned int v25; // [rsp+4h] [rbp-4Ch] BYREF
unsigned __int64 v26[2]; // [rsp+Ch] [rbp-44h] BYREF
__int64 v27; // [rsp+1Ch] [rbp-34h] BYREF
char v28; // [rsp+27h] [rbp-29h]
LODWORD(v26[0]) = -1778384896;
result = cocos2d::CCLayerColor::initWithColor((__int64)a1, (__int64)v26);
if ( result )
{
v28 = result;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 1000LL))(a1, 1);
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 1072LL))(a1, 1);
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v27, v2);
v3 = cocos2d::CCLayer::create();
a1[73] = v3;
(*(void (__fastcall **)(_QWORD *, _QWORD *))(*a1 + 456LL))(a1, v3);
v4 = cocos2d::CCLayer::create();
a1[83] = v4;
(*(void (__fastcall **)(_QWORD, _QWORD *))(*(_QWORD *)a1[73] + 456LL))(a1[73], v4);
sub_100278270((__int64)v26, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v5 = cocos2d::extension::CCScale9Sprite::create_2((__int64)"GJ_square01.png", v26);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v5 + 912LL))(v5, 255);
sub_100278260((float *)v26, 420.0, 260.0);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v5 + 320LL))(v5, v26);
(*(void (__fastcall **)(_QWORD, void *, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v5, 0xFFFFFFFFLL);
sub_100278250((float *)v26, *(float *)&v27 * 0.5, *((float *)&v27 + 1) * 0.5);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v5 + 184LL))(v5, v26);
v6 = cocos2d::CCLabelBMFont::create_3("How To Play", "bigFont.fnt");
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], v6, 20);
sub_100278250((float *)v26, *(float *)&v27 * 0.5, (float)((float)(*((float *)&v27 + 1) * 0.5) + 130.0) + -25.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v6 + 184LL))(v6, v26);
*(_QWORD *)&v7 = *(unsigned int *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 328LL))(v6);
if ( *(float *)&v7 > 300.0 )
{
v8 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v6 + 328LL))(v6);
v7 = (*(double (__fastcall **)(__int64, float))(*(_QWORD *)v6 + 160LL))(v6, 300.0 / *v8);
}
*((_DWORD *)a1 + 160) = -1;
v9 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_closeBtn_001.png", v7);
v10 = CCMenuItemSpriteExtra::create((__int64)v9, 0, (__int64)a1, (__int64)&TutorialLayer::onClose, 0);
v11 = (int)v10;
CCMenuItemSpriteExtra::setSizeMult((__int64)v10, 1.6);
v16 = sub_1008735E0(v11, 0, v12, v13, v14, v15);
a1[69] = v16;
sub_100278250(
(float *)v26,
(float)((float)(*(float *)&v27 * 0.5) + -210.0) + 10.0,
(float)((float)(*((float *)&v27 + 1) * 0.5) + 130.0) + -10.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v16 + 184LL))(v16, v26);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(*(_QWORD *)a1[73] + 464LL))(a1[73], a1[69], 10);
v17 = ButtonSprite::create_1(
(__int64)"Next",
0xDCu,
0,
0,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_01.png",
0.60000002,
40.0);
v18 = CCMenuItemSpriteExtra::create((__int64)v17, 0, (__int64)a1, (__int64)&TutorialLayer::onNext, 0);
a1[85] = v18;
(*(void (__fastcall **)(_QWORD, void *))(*(_QWORD *)a1[69] + 456LL))(a1[69], v18);
v19 = ButtonSprite::create_1(
(__int64)"Exit",
0xDCu,
0,
0,
(__int64)"bigFont.fnt",
(__int64)"GJ_button_01.png",
0.60000002,
40.0);
v20 = CCMenuItemSpriteExtra::create((__int64)v19, 0, (__int64)a1, (__int64)&TutorialLayer::onClose, 0);
a1[86] = v20;
(*(void (__fastcall **)(_QWORD, void *))(*(_QWORD *)a1[69] + 456LL))(a1[69], v20);
v21 = a1[85];
v22 = a1[69];
sub_100278250(
(float *)&v25,
(float)((float)(*(float *)&v27 * 0.5) + 210.0) + -52.0,
(float)((float)(0.5 * *((float *)&v27 + 1)) + -130.0) + 50.0);
cocos2d::CCNode::convertToNodeSpace((double *)v26, v22, &v25);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v21 + 184LL))(v21, v26);
v23 = a1[86];
v24 = (*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)a1[85] + 192LL))(a1[85]);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v23 + 184LL))(v23, v24);
(*(void (__fastcall **)(_QWORD, _QWORD))(*(_QWORD *)a1[86] + 344LL))(a1[86], 0);
*((_DWORD *)a1 + 168) = 0;
TutorialLayer::loadPage(a1, 1);
return v28;
}
return result;
}