//
// LoadingLayer::init from 0x14032e4c0 to 0x14032ecdc (2076 bytes)
//
// 2 xrefs:
// > LoadingLayer::scene @ 0x14032e475
// > ??> @ 0x1406d4fa0
//
// 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=6
bool LoadingLayer::init(LoadingLayer *a1, bool a2)
{
bool result; // al
__int64 v5; // rcx
FMODAudioEngine *v6; // rcx
__int64 v7; // rax
GameLevelManager *v8; // rcx
cocos2d::CCTextureCache *v9; // rax
__int64 v10; // rcx
cocos2d::CCSpriteFrameCache *v11; // rax
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
GameManager *v14; // rcx
cocos2d::CCString *v15; // rax
const char *CString; // rax
struct cocos2d::CCSprite *v17; // rdi
float v18; // xmm0_4
cocos2d::CCSprite_vtbl *v19; // rbx
const cocos2d::CCPoint *v20; // rax
__int64 v21; // rdx
__int64 v22; // rcx
__int64 v23; // rcx
cocos2d::CCDirector *v24; // rax
struct cocos2d::CCSprite *v25; // rsi
float v26; // xmm0_4
cocos2d::CCSprite_vtbl *v27; // rbx
const cocos2d::CCPoint *v28; // rax
struct cocos2d::CCSprite *v29; // rdi
float v30; // xmm0_4
__int64 v31; // rax
struct cocos2d::CCSprite *v32; // rsi
float v33; // xmm0_4
cocos2d::CCSprite_vtbl *v34; // rbx
const cocos2d::CCPoint *v35; // rax
struct cocos2d::CCSprite *v36; // rdi
float v37; // xmm0_4
__int64 v38; // rax
const char *LoadingString; // rax
cocos2d::CCLabelBMFont *v40; // rax
float v41; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v42; // rbx
const cocos2d::CCPoint *v43; // rax
const char *v44; // rax
size_t v45; // r8
const struct cocos2d::CCPoint *v46; // rax
char *v47; // rax
float v48; // xmm0_4
TextArea_vtbl *v49; // rbx
const cocos2d::CCPoint *v50; // rax
cocos2d::CCLabelBMFont *m_caption; // rcx
cocos2d::CCLabelBMFont_vtbl *v52; // rbx
struct cocos2d::CCSprite *v53; // rdi
struct cocos2d::CCSprite *v54; // rax
cocos2d::CCTexture2D *v55; // rax
float v56; // xmm0_4
cocos2d::CCSprite_vtbl *v57; // rbx
__int64 v58; // rax
float v59; // xmm0_4
cocos2d::CCSprite_vtbl *v60; // rbx
double v61; // xmm0_8
const cocos2d::CCPoint *v62; // rax
cocos2d::CCSprite_vtbl *v63; // rbx
const cocos2d::CCPoint *v64; // rax
const cocos2d::CCPoint *v65; // rax
__int64 v66; // rcx
__int64 v67; // rdi
__int64 v68; // rbx
struct cocos2d::CCDelayTime *v69; // rax
struct cocos2d::CCSequence *v70; // rbx
GameManager *v71; // rax
bool v72; // [rsp+28h] [rbp-79h]
FMODAudioEngine *v73; // [rsp+48h] [rbp-59h] BYREF
float v74; // [rsp+50h] [rbp-51h]
__int128 *v75; // [rsp+58h] [rbp-49h]
__int16 v76; // [rsp+60h] [rbp-41h]
__int16 v77; // [rsp+64h] [rbp-3Dh] BYREF
char v78; // [rsp+66h] [rbp-3Bh]
__int128 v79; // [rsp+68h] [rbp-39h] BYREF
__int64 v80; // [rsp+78h] [rbp-29h]
__int64 v81; // [rsp+80h] [rbp-21h]
struct cocos2d::_ccTexParams v82; // [rsp+88h] [rbp-19h] BYREF
result = cocos2d::CCLayer::init(a1);
if ( result )
{
a1->m_fromRefresh = a2;
*(_BYTE *)(cocos2d::CCDirector::sharedDirector(v5) + 209) = 1;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
if ( !a1->m_fromRefresh )
{
v6 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v73 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v73);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v6 = (FMODAudioEngine *)qword_1406C2E88;
}
FMODAudioEngine::setup(v6);
}
v7 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v73 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v73);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v7 = qword_1406C2ED8;
}
if ( *(_BYTE *)(v7 + 1025) )
{
*(_BYTE *)(v7 + 1025) = 0;
v8 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v73 = (FMODAudioEngine *)operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v73);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v8 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::getLevelSaveData(v8);
}
v9 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v9, "GJ_LaunchSheet.png", 0);
v11 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v10);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v11, "GJ_LaunchSheet.plist");
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13);
v14 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v73 = (FMODAudioEngine *)operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v73);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = (GameManager *)qword_1406C2ED8;
}
GameManager::loadBackground(v14, 1);
v15 = cocos2d::CCString::createWithFormat("game_bg_%02d_001.png", 1);
CString = cocos2d::CCString::getCString(v15);
v17 = cocos2d::CCSprite::create(CString);
v18 = ((float (__fastcall *)(LoadingLayer *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v17);
v19 = v17->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v18, v74 * 0.5);
v19->setPosition_0(v17, v20);
cocos2d::CCApplication::sharedApplication(v22, v21);
v24 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v23);
cocos2d::CCDirector::getScreenScaleFactorMax(v24);
((void (__fastcall *)(struct cocos2d::CCSprite *))v17->setScale_0)(v17);
v76 = 26112;
v77 = 26112;
v78 = -1;
v17->setColor(&v17->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v77);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_logo_001.png");
v26 = ((float (__fastcall *)(LoadingLayer *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v25);
v27 = v25->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v26, v74 * 0.5);
v27->setPosition_0(v25, v28);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("RobTopLogoBig_001.png");
v30 = ((float (__fastcall *)(LoadingLayer *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v29);
cocos2d::CCPoint::CCPoint(v30, 0.0);
v31 = (__int64)v25->getPosition_0(v25);
cocos2d::CCPoint::operator+(v31, &v73);
v29->setPosition_0(v29, (const cocos2d::CCPoint *)&v73);
a1->m_unknown2 = 1;
a1->m_loadStep = 0;
v32 = cocos2d::CCSprite::createWithSpriteFrameName("cocos2DxLogo.png");
v33 = ((float (__fastcall *)(LoadingLayer *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v32);
v34 = v32->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v33, v74 - 34.0);
v34->setPosition_0(v32, v35);
((void (__fastcall *)(struct cocos2d::CCSprite *))v32->setScale_0)(v32);
v36 = cocos2d::CCSprite::createWithSpriteFrameName("fmodLogo.png");
v37 = ((float (__fastcall *)(LoadingLayer *, struct cocos2d::CCSprite *))a1->addChild_1)(a1, v36);
cocos2d::CCPoint::CCPoint(v37, 0.0);
v38 = (__int64)v32->getPosition_0(v32);
cocos2d::CCPoint::operator+(v38, &v73);
v36->setPosition_0(v36, (const cocos2d::CCPoint *)&v73);
((void (__fastcall *)(struct cocos2d::CCSprite *))v36->setScale_0)(v36);
v36->setColor(&v36->cocos2d::CCRGBAProtocol, &stru_140529B7C);
LoadingString = LoadingLayer::getLoadingString(a1);
v40 = cocos2d::CCLabelBMFont::create(LoadingString, "goldFont.fnt");
a1->m_caption = v40;
v41 = ((float (__fastcall *)(LoadingLayer *, cocos2d::CCLabelBMFont *))a1->addChild_1)(a1, v40);
v42 = a1->m_caption->__vftable;
cocos2d::CCPoint::CCPoint(v41, v74 * 0.5);
v42->setPosition_0(a1->m_caption, v43);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_caption->setScale_0)(a1->m_caption);
a1->m_caption->setVisible(a1->m_caption, 0);
v75 = &v79;
v44 = LoadingLayer::getLoadingString(a1);
v79 = 0;
v80 = 0;
v81 = 0;
v45 = -1;
do
++v45;
while ( v44[v45] );
sub_14003A930(&v79, v44, v45);
cocos2d::CCPoint::CCPoint(0.0, 0.5);
v47 = TextArea::create((__int64)&v79, "goldFont.fnt", 1.0, 440.0, v46, 1105199104, 0);
a1->m_textArea = (TextArea *)v47;
v48 = ((float (__fastcall *)(LoadingLayer *, char *))a1->addChild_1)(a1, v47);
v49 = a1->m_textArea->__vftable;
cocos2d::CCPoint::CCPoint(v48, v74 * 0.5);
v49->setPosition_0(a1->m_textArea, v50);
((void (__fastcall *)(TextArea *))a1->m_textArea->setScale_0)(a1->m_textArea);
if ( a1->m_caption->getContentSize(a1->m_caption)->width > 300.0 )
{
m_caption = a1->m_caption;
v52 = m_caption->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
m_caption->getContentSize(m_caption);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v52->setScale_0)(a1->m_caption);
}
fminf(
0.69999999,
COERCE_FLOAT(COERCE_UNSIGNED_INT64(((double (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_caption->getScale)(a1->m_caption))));
((void (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_caption->setScale_0)(a1->m_caption);
v53 = cocos2d::CCSprite::create("slidergroove.png");
a1->addChild_0(a1, v53, 3);
v54 = cocos2d::CCSprite::create("sliderBar.png");
a1->m_sliderBar = v54;
a1->m_sliderGrooveXPos = v53->m_obRect.size.width - 4.0;
a1->m_sliderGrooveHeight = 8.0;
v82.minFilter = 9729;
v82.magFilter = 9729;
v82.wrapS = 10497;
v82.wrapT = 10497;
v55 = v54->getTexture(&v54->cocos2d::CCTextureProtocol);
cocos2d::CCTexture2D::setTexParameters(v55, &v82);
v56 = ((float (__fastcall *)(struct cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v53->addChild_0)(
v53,
a1->m_sliderBar,
0xFFFFFFFFLL);
v57 = a1->m_sliderBar->__vftable;
cocos2d::CCPoint::CCPoint(v56, 0.0);
v59 = ((float (__fastcall *)(cocos2d::CCSprite *, __int64))v57->setAnchorPoint)(a1->m_sliderBar, v58);
v60 = a1->m_sliderBar->__vftable;
v61 = cocos2d::CCPoint::CCPoint(v59, 2.0);
v60->setPosition_0(a1->m_sliderBar, v62);
v63 = v53->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_textArea->getPosition_0(a1->m_textArea);
v64 = a1->m_caption->getPosition_0(a1->m_caption);
cocos2d::CCPoint::CCPoint(*(float *)&v61, v64->x);
v63->setPosition_0(v53, v65);
LoadingLayer::updateProgress(a1, 0);
v67 = cocos2d::CCDirector::sharedDirector(v66);
v68 = cocos2d::CCCallFunc::create(a1, LoadingLayer::loadAssets);
v69 = cocos2d::CCDelayTime::create(0.0);
v70 = cocos2d::CCSequence::create(v69, v68, 0);
v71 = (GameManager *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v67 + 128LL))(v67);
cocos2d::CCActionManager::addAction(v71, v70, a1, 0, v72);
return 1;
}
return result;
}