//
// LoadingLayer::init from 0x30c184 to 0x30c6e4 (1376 bytes)
//
// 1 xrefs:
// > LoadingLayer::create @ 0x30c76a
//
// 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 LoadingLayer::init(LoadingLayer *a1, bool a2)
{
_BOOL4 v4; // r10
FMODAudioEngine *v5; // r0
GameLevelManager *v6; // r0
cocos2d::CCTextureCache *v7; // r0
cocos2d::CCSpriteFrameCache *v8; // r0
cocos2d::CCDirector *v9; // r0
GameManager *v10; // r0
cocos2d::CCSprite *BGTexture; // r0
const char *v12; // r1
cocos2d::CCNode *v13; // r6
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
void (__fastcall *setScale)(cocos2d::CCNode *__hidden, float); // r7
AppDelegate *v16; // r0
float v17; // r0
cocos2d::CCNode_vtbl *v18; // r3
cocos2d::CCSprite *v19; // r6
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v21; // r7
int v22; // r8
cocos2d::CCSprite *v23; // r8
void (__fastcall *v24)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v25; // r7
int v26; // r8
cocos2d::CCLabelBMFont *v27; // r0
LoadingLayer_vtbl *v28; // r3
cocos2d::CCLabelBMFont *m_caption; // r7
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
char *LoadingString; // r0
TextArea *m_textArea; // r7
void (__fastcall *v33)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCLabelBMFont *v34; // r7
void (__fastcall *v35)(cocos2d::CCLabelBMFont *__hidden, float); // r8
float *v36; // r0
cocos2d::CCLabelBMFont *v37; // r7
void (__fastcall *v38)(cocos2d::CCLabelBMFont *__hidden, float); // r8
int v39; // r1
const char *v40; // r1
cocos2d::CCNode *v41; // r7
const char *v42; // r1
cocos2d::CCSprite *v43; // r0
float m_fSkewX; // s15
cocos2d::CCTexture2D *v45; // r0
cocos2d::CCSprite *m_sliderBar; // r5
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCSprite *v48; // r5
void (__fastcall *v49)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *v50)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r5
float x; // r8
const cocos2d::CCPoint *v52; // r0
cocos2d::CCDirector *v53; // r0
cocos2d::CCActionManager *v54; // r7
cocos2d::CCDelayTime *v55; // r0
cocos2d::CCSequence *v56; // r8
cocos2d::CCFiniteTimeAction *v57; // r0
cocos2d::CCAction *v58; // r0
void (__fastcall *v60)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-38h]
void (__fastcall *v61)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-38h]
_BYTE v62[4]; // [sp+20h] [bp-2Ch] BYREF
cocos2d::CCSize v63; // [sp+24h] [bp-28h] BYREF
cocos2d::CCPoint v64; // [sp+2Ch] [bp-20h] BYREF
cocos2d::ccTexParams v65; // [sp+34h] [bp-18h] BYREF
v4 = cocos2d::CCLayer::init(a1);
if ( v4 )
{
a1->m_fromRefresh = a2;
cocos2d::CCDirector::sharedDirector()->m_bDisplayStats = 1;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
if ( !a1->m_fromRefresh )
{
v5 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setup(v5);
}
if ( GameManager::sharedState()->m_canGetLevelSaveData )
{
GameManager::sharedState()->m_canGetLevelSaveData = 0;
v6 = GameLevelManager::sharedState();
GameLevelManager::getLevelSaveData(v6);
}
v7 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v7, "GJ_LaunchSheet.png", 0);
v8 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v8, "GJ_LaunchSheet.plist");
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v63, v9);
v10 = GameManager::sharedState();
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v10, 1);
v13 = (cocos2d::CCNode *)cocos2d::CCSprite::create(BGTexture, v12);
a1->addChild(a1, v13);
setPosition = v13->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v63.width * 0.5, v63.height * 0.5);
setPosition(v13, (const cocos2d::CCPoint *)&v65);
setScale = v13->setScale;
v16 = AppDelegate::get();
v17 = AppDelegate::bgScale(v16);
((void (__fastcall *)(cocos2d::CCNode *, _DWORD))setScale)(v13, LODWORD(v17));
v62[1] = 102;
v62[2] = -1;
v18 = v13->__vftable;
v62[0] = 0;
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v18[1].getTag)(v13, v62);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_logo_001.png");
a1->addChild(a1, v19);
v20 = v19->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v63.width * 0.5, (float)(v63.height * 0.5) + 0.0);
v20(v19, (const cocos2d::CCPoint *)&v65);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("RobTopLogoBig_001.png");
a1->addChild(a1, v21);
v60 = v21->setPosition;
v22 = (int)v19->getPosition(v19);
cocos2d::CCPoint::CCPoint(&v64, 0.0, 80.0);
cocos2d::CCPoint::operator+(&v65, v22, &v64);
v60(v21, (const cocos2d::CCPoint *)&v65);
a1->m_loadStep = 0;
a1->m_unknown2 = 1;
v23 = cocos2d::CCSprite::createWithSpriteFrameName("cocos2DxLogo.png");
a1->addChild(a1, v23);
v24 = v23->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v63.width - 34.0, 13.0);
v24(v23, (const cocos2d::CCPoint *)&v65);
((void (__fastcall *)(cocos2d::CCSprite *, int))v23->setScale)(v23, 1058642330);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("fmodLogo.png");
a1->addChild(a1, v25);
v61 = v25->setPosition;
v26 = (int)v23->getPosition(v23);
cocos2d::CCPoint::CCPoint(&v64, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v65, v26, &v64);
v61(v25, (const cocos2d::CCPoint *)&v65);
((void (__fastcall *)(cocos2d::CCSprite *, int))v25->setScale)(v25, 1058642330);
v25->setColor(v25, &stru_9A9FFC);
LoadingLayer::getLoadingString(a1);
v27 = cocos2d::CCLabelBMFont::create();
v28 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_caption = v27;
v28->addChild(a1, v27);
m_caption = a1->m_caption;
v30 = m_caption->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v63.width * 0.5, (float)(v63.height * 0.5) - 70.0);
v30(m_caption, (const cocos2d::CCPoint *)&v65);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_caption->setScale)(a1->m_caption, 1060320051);
a1->m_caption->setVisible(a1->m_caption, 0);
LoadingString = (char *)LoadingLayer::getLoadingString(a1);
sub_776584((int)&v64, LoadingString);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, 0.5, 0.5);
a1->m_textArea = (TextArea *)TextArea::create(
(TextArea *)&v64,
(std::string)"goldFont.fnt",
(const char *)0x3F800000,
1138491392,
(const cocos2d::CCPoint *)&v65,
(cocos2d::CCPoint)1105199104LL);
sub_774008(&v64);
a1->addChild(a1, a1->m_textArea);
m_textArea = a1->m_textArea;
v33 = m_textArea->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, v63.width * 0.5, (float)(v63.height * 0.5) - 100.0);
v33(m_textArea, (const cocos2d::CCPoint *)&v65);
((void (__fastcall *)(TextArea *, int))a1->m_textArea->setScale)(a1->m_textArea, 1060320051);
if ( a1->m_caption->getContentSize(a1->m_caption)->width > 300.0 )
{
v34 = a1->m_caption;
v35 = v34->setScale;
v36 = (float *)v34->getContentSize(v34);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _DWORD))v35)(v34, 300.0 / *v36);
}
v37 = a1->m_caption;
v38 = v37->setScale;
if ( v37->getScale(v37) >= 0.7 )
{
v39 = 1060320051;
}
else
{
v37 = a1->m_caption;
v39 = ((int (__fastcall *)(cocos2d::CCLabelBMFont *))v37->getScale)(v37);
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v38)(v37, v39);
v41 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"slidergroove.png", v40);
a1->addChild_0(a1, v41, 3);
v43 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"sliderBar.png", v42);
m_fSkewX = v41[1].m_fSkewX;
a1->m_sliderGrooveHeight = 8.0;
a1->m_sliderGrooveXPos = m_fSkewX - 4.0;
a1->m_sliderBar = v43;
v65.minFilter = 9729;
v65.magFilter = 9729;
v65.wrapS = 10497;
v65.wrapT = 10497;
v45 = v43->getTexture(v43);
cocos2d::CCTexture2D::setTexParameters(v45, &v65);
v41->addChild_0(v41, a1->m_sliderBar, -1);
m_sliderBar = a1->m_sliderBar;
setAnchorPoint = m_sliderBar->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v64, 0.0, 0.0);
setAnchorPoint(m_sliderBar, &v64);
v48 = a1->m_sliderBar;
v49 = v48->setPosition;
cocos2d::CCPoint::CCPoint(&v64, 2.0, 4.0);
v49(v48, &v64);
v50 = v41->setPosition;
x = a1->m_caption->getPosition(a1->m_caption)->x;
v52 = a1->m_textArea->getPosition(a1->m_textArea);
cocos2d::CCPoint::CCPoint(&v64, x, v52->y + 40.0);
v50(v41, &v64);
LoadingLayer::updateProgress(a1, 0);
v53 = cocos2d::CCDirector::sharedDirector();
v54 = v53->getActionManager(v53);
v55 = cocos2d::CCDelayTime::create(0.0);
v64.y = 0.0;
LODWORD(v64.x) = LoadingLayer::loadAssets;
v56 = (cocos2d::CCSequence *)v55;
v57 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, LoadingLayer::loadAssets, 0);
v58 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v56, v57, 0);
cocos2d::CCActionManager::addAction(v54, v58, a1, 0);
}
return v4;
}