//
// LoadingLayer::init from 0x1003a2690 to 0x1003a2ddb (1867 bytes)
//
// 2 xrefs:
// > LoadingLayer::scene @ 0x1003a2561
// > LoadingLayer::create @ 0x1003a2651
//
// 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 __fastcall LoadingLayer::init(LoadingLayer *a1, bool a2)
{
bool result; // al
FMODAudioEngine *v3; // rax
GameLevelManager *v4; // rax
cocos2d::CCTextureCache *v5; // rax
cocos2d::CCSpriteFrameCache *v6; // rax
GameManager *v7; // rax
const char *BGTexture; // rax
cocos2d::CCSprite *v9; // r14
AppDelegate *v10; // rax
cocos2d::CCSprite *v11; // r14
cocos2d::CCSprite *v12; // r15
unsigned __int64 *v13; // r14
cocos2d::CCSprite *v14; // r14
cocos2d::CCSprite *v15; // r15
unsigned __int64 *v16; // r14
const char *LoadingString; // rax
cocos2d::CCLabelBMFont *v18; // rax
cocos2d::CCLabelBMFont *m_caption; // r14
const char *v20; // r15
size_t v21; // rax
size_t v22; // r14
char *v23; // r12
size_t v24; // r13
TextArea *m_textArea; // rax
TextArea *v26; // r14
cocos2d::CCLabelBMFont *v27; // r14
float *v28; // rax
cocos2d::CCLabelBMFont *v29; // r14
cocos2d::CCSprite *v30; // r14
cocos2d::CCSprite *v31; // rax
cocos2d::CCTexture2D *v32; // rax
cocos2d::CCSprite *m_sliderBar; // r15
cocos2d::CCSprite *v34; // r15
__int64 v35; // rax
__m128 m_sliderGrooveXPos_low; // xmm2
cocos2d::CCSprite *v37; // r14
cocos2d::CCDirector *v38; // rax
cocos2d::CCActionManager *v39; // r14
unsigned int v40; // eax
int v41; // ecx
int v42; // r8d
int v43; // r9d
cocos2d::CCAction *v44; // rax
cocos2d::ccTexParams v45; // [rsp+0h] [rbp-80h] BYREF
__int128 __dst; // [rsp+18h] [rbp-68h] BYREF
void *__p; // [rsp+28h] [rbp-58h]
float v48; // [rsp+34h] [rbp-4Ch]
double v49[2]; // [rsp+38h] [rbp-48h] BYREF
__int16 v50; // [rsp+48h] [rbp-38h] BYREF
char v51; // [rsp+4Ah] [rbp-36h]
float v52; // [rsp+4Ch] [rbp-34h] BYREF
float v53; // [rsp+50h] [rbp-30h]
bool v54; // [rsp+57h] [rbp-29h]
double v55; // 0:xmm0_8.8
result = cocos2d::CCLayer::init(a1);
if ( !result )
return result;
v54 = result;
a1->m_fromRefresh = a2;
cocos2d::CCDirector::sharedDirector()->m_bDisplayStats = 1;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
if ( !a1->m_fromRefresh )
{
v3 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setup(v3);
}
if ( GameManager::sharedState()->m_canGetLevelSaveData )
{
GameManager::sharedState()->m_canGetLevelSaveData = 0;
v4 = GameLevelManager::sharedState();
GameLevelManager::getLevelSaveData(v4);
}
v5 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v5, "GJ_LaunchSheet.png", 0);
v6 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile_2(v6, "GJ_LaunchSheet.plist");
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v55 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v52);
v7 = GameManager::sharedState();
BGTexture = GameManager::getBGTexture(v7, 1);
v9 = cocos2d::CCSprite::create_1(BGTexture);
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *, double))a1->addChild)(a1, v9, v55);
sub_10028CBE0((float *)v49, v52 * 0.5, v53 * 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v9->setPosition)(v9, v49);
v10 = AppDelegate::get();
*(float *)&v55 = AppDelegate::bgScale(v10);
((void (__fastcall *)(cocos2d::CCSprite *, float))v9->setScale)(v9, *(float *)&v55);
v51 = -1;
v50 = 26112;
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *))v9->setColor)(v9, &v50);
v11 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_logo_001.png");
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *))a1->addChild)(a1, v11);
sub_10028CBE0((float *)v49, v52 * 0.5, (float)(v53 * 0.5) + 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v11->setPosition)(v11, v49);
v12 = cocos2d::CCSprite::createWithSpriteFrameName("RobTopLogoBig_001.png");
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *))a1->addChild)(a1, v12);
v13 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v11->getPosition)(v11);
sub_10028CBE0((float *)&v45.minFilter, 0.0, 80.0);
sub_10028CCE0(v49, v13, (unsigned __int64 *)&v45.minFilter);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v12->setPosition)(v12, v49);
a1->m_unknown2 = 1;
a1->m_loadStep = 0;
v14 = cocos2d::CCSprite::createWithSpriteFrameName("cocos2DxLogo.png");
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *))a1->addChild)(a1, v14);
sub_10028CBE0((float *)v49, v52 + -34.0, 13.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v14->setPosition)(v14, v49);
((void (__fastcall *)(cocos2d::CCSprite *, float))v14->setScale)(v14, 0.60000002);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("fmodLogo.png");
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *))a1->addChild)(a1, v15);
v16 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v14->getPosition)(v14);
sub_10028CBE0((float *)&v45.minFilter, 0.0, 20.0);
sub_10028CCE0(v49, v16, (unsigned __int64 *)&v45.minFilter);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v15->setPosition)(v15, v49);
((void (__fastcall *)(cocos2d::CCSprite *, float))v15->setScale)(v15, 0.60000002);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v15->setColor)(v15, &unk_10081A69C);
LoadingString = LoadingLayer::getLoadingString(a1);
v18 = cocos2d::CCLabelBMFont::create_3(LoadingString, "goldFont.fnt");
a1->m_caption = v18;
((void (__fastcall *)(LoadingLayer *, cocos2d::CCLabelBMFont *))a1->addChild)(a1, v18);
m_caption = a1->m_caption;
sub_10028CBE0((float *)v49, v52 * 0.5, (float)(0.5 * v53) + -70.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))m_caption->setPosition)(m_caption, v49);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_caption->setScale)(a1->m_caption, 0.69999999);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _QWORD))a1->m_caption->setVisible)(a1->m_caption, 0);
v20 = LoadingLayer::getLoadingString(a1);
v21 = strlen(v20);
if ( v21 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(COERCE_DOUBLE(1060320051));
v22 = v21;
if ( v21 >= 0x17 )
{
v24 = 26;
if ( (v21 | 7) != 0x17 )
v24 = (v21 | 7) + 1;
v23 = (char *)operator new(v24);
__p = v23;
*(_QWORD *)&__dst = v24 + 1;
*((_QWORD *)&__dst + 1) = v22;
}
else
{
LOBYTE(__dst) = 2 * v21;
v23 = (char *)&__dst + 1;
if ( !v21 )
goto LABEL_14;
}
memmove(v23, v20, v22);
LABEL_14:
v23[v22] = 0;
sub_10028CBE0((float *)v49, 0.5, 0.5);
m_textArea = (TextArea *)TextArea::create(&__dst, (__int64)"goldFont.fnt", v49, 0, 1.0, 440.0, 28.0);
a1->m_textArea = m_textArea;
if ( (__dst & 1) != 0 )
{
operator delete(__p);
m_textArea = a1->m_textArea;
}
((void (__fastcall *)(LoadingLayer *, TextArea *))a1->addChild)(a1, m_textArea);
v26 = a1->m_textArea;
sub_10028CBE0((float *)v49, v52 * 0.5, (float)(0.5 * v53) + -100.0);
((void (__fastcall *)(TextArea *, double *))v26->setPosition)(v26, v49);
((void (__fastcall *)(TextArea *, float))a1->m_textArea->setScale)(a1->m_textArea, 0.69999999);
if ( *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_caption->getContentSize)(a1->m_caption) > 300.0 )
{
v27 = a1->m_caption;
v28 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v27->getContentSize)(v27);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v27->setScale)(v27, 300.0 / *v28);
}
v29 = a1->m_caption;
if ( ((float (__fastcall *)(cocos2d::CCLabelBMFont *))v29->getScale)(v29) < 0.69999999 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))a1->m_caption->getScale)(a1->m_caption, 0.69999999);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double))v29->setScale)(v29, COERCE_DOUBLE(1060320051));
v30 = cocos2d::CCSprite::create_1("slidergroove.png");
((void (__fastcall *)(LoadingLayer *, cocos2d::CCSprite *, __int64))a1->addChild_0)(a1, v30, 3);
v31 = cocos2d::CCSprite::create_1("sliderBar.png");
a1->m_sliderBar = v31;
a1->m_sliderGrooveXPos = v30->m_obRect.size.width + -4.0;
a1->m_sliderGrooveHeight = 8.0;
v45 = (cocos2d::ccTexParams)xmmword_100815E00;
v32 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v31->getTexture)(v31);
cocos2d::CCTexture2D::setTexParameters(v32, &v45);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v30->addChild_0)(
v30,
a1->m_sliderBar,
0xFFFFFFFFLL);
m_sliderBar = a1->m_sliderBar;
sub_10028CBE0((float *)v49, 0.0, 0.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))m_sliderBar->setAnchorPoint)(m_sliderBar, v49);
v34 = a1->m_sliderBar;
sub_10028CBE0((float *)v49, 2.0, 4.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v34->setPosition)(v34, v49);
v48 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_caption->getPosition)(a1->m_caption);
v35 = ((__int64 (__fastcall *)(TextArea *))a1->m_textArea->getPosition)(a1->m_textArea);
sub_10028CBE0((float *)v49, v48, *(float *)(v35 + 4) + 40.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v30->setPosition)(v30, v49);
m_sliderGrooveXPos_low = (__m128)LODWORD(a1->m_sliderGrooveXPos);
m_sliderGrooveXPos_low.f32[0] = fminf(m_sliderGrooveXPos_low.f32[0] * 0.0, a1->m_sliderGrooveXPos);
v37 = a1->m_sliderBar;
sub_10028CC00((__int64)v49, 0.0, 0.0, m_sliderGrooveXPos_low, (__m128)LODWORD(a1->m_sliderGrooveHeight));
((void (__fastcall *)(cocos2d::CCSprite *, double *))v37->setTextureRect)(v37, v49);
v38 = cocos2d::CCDirector::sharedDirector();
v39 = (cocos2d::CCActionManager *)((__int64 (__fastcall *)(cocos2d::CCDirector *))v38->getActionManager)(v38);
LODWORD(v34) = (unsigned int)cocos2d::CCDelayTime::create(0.0);
v40 = (unsigned int)cocos2d::CCCallFunc::create(a1, (cocos2d::SEL_CallFunc)(unsigned __int64)LoadingLayer::loadAssets);
v44 = (cocos2d::CCAction *)sub_1003B5760((_DWORD)v34, v40, 0, v41, v42, v43);
cocos2d::CCActionManager::addAction(v39, v44, a1, 0);
return v54;
}