//
// LoadingLayer::init from 0x5c51f4 to 0x5c5984 (1936 bytes)
//
// 2 xrefs:
// > LoadingLayer::create @ 0x5c5a30
// > ??> @ 0x8d6d8
//
// 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)
{
bool v4; // w25
cocos2d::CCTextureCache *v6; // x0
cocos2d::CCSpriteFrameCache *v7; // x0
cocos2d::CCDirector *v8; // x0
GameManager *v9; // x0
cocos2d::CCSprite *BGTexture; // x0
const char *v11; // x1
cocos2d::CCNode *v12; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *setScale)(cocos2d::CCNode *__hidden, float); // x24
AppDelegate *v15; // x0
float v16; // s0
cocos2d::CCNode_vtbl *v17; // x2
int (__fastcall *getTag)(const cocos2d::CCObject *__hidden); // x2
cocos2d::CCSprite *v19; // x23
void (__fastcall *v20)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v21; // x24
cocos2d::CCSprite *v22; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v24)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
__int64 v25; // x27
cocos2d::CCSprite *v26; // x24
void (__fastcall *v27)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v28; // x23
cocos2d::CCSprite *v29; // x0
const cocos2d::CCPoint *(__fastcall *v30)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v31)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
__int64 v32; // x27
cocos2d::CCLabelBMFont *v33; // x0
LoadingLayer_vtbl *v34; // x2
cocos2d::CCLabelBMFont *m_caption; // x23
void (__fastcall *v36)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
char *LoadingString; // x0
void *v38; // x0
TextArea *m_textArea; // x23
void (__fastcall *v40)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
float width; // s0
cocos2d::CCLabelBMFont *v42; // x23
void (__fastcall *v43)(cocos2d::CCLabelBMFont *__hidden, float); // x24
long double v44; // q0
const char *v45; // x1
cocos2d::CCNode *v46; // x23
const char *v47; // x1
cocos2d::CCSprite *v48; // x0
cocos2d::CCSprite_vtbl *v49; // x3
float height; // s0
__int64 (*getTexture)(void); // x2
cocos2d::CCTexture2D *v52; // x0
cocos2d::CCSprite *m_sliderBar; // x20
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v55; // x20
void (__fastcall *v56)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
void (__fastcall *v57)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
const cocos2d::CCPoint *v58; // x0
cocos2d::CCDirector *v59; // x0
cocos2d::CCActionManager *v60; // x20
cocos2d::CCSequence *v61; // x21
cocos2d::CCFiniteTimeAction *v62; // x0
cocos2d::CCAction *v63; // x0
FMODAudioEngine *v64; // x0
GameLevelManager *v65; // x0
cocos2d::CCLabelBMFont *v66; // x23
void (__fastcall *v67)(cocos2d::CCLabelBMFont *__hidden, float); // x24
float *v68; // x0
unsigned int *v69; // x3
int v70; // w1
float x; // [xsp+70h] [xbp+70h]
_BYTE v72[8]; // [xsp+90h] [xbp+90h] BYREF
float v73; // [xsp+98h] [xbp+98h]
float v74; // [xsp+9Ch] [xbp+9Ch]
cocos2d::CCPoint v75; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::ccTexParams v76; // [xsp+A8h] [xbp+A8h] BYREF
v4 = cocos2d::CCLayer::init(a1);
if ( !v4 )
return v4;
a1->m_fromRefresh = a2;
cocos2d::CCDirector::sharedDirector()->m_bDisplayStats = 1;
cocos2d::CCTexture2D::setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888);
if ( a1->m_fromRefresh )
{
if ( !GameManager::sharedState()->m_canGetLevelSaveData )
goto LABEL_5;
}
else
{
v64 = FMODAudioEngine::sharedEngine();
FMODAudioEngine::setup(v64);
if ( !GameManager::sharedState()->m_canGetLevelSaveData )
goto LABEL_5;
}
GameManager::sharedState()->m_canGetLevelSaveData = 0;
v65 = GameLevelManager::sharedState();
GameLevelManager::getLevelSaveData(v65);
LABEL_5:
v6 = cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v6, "GJ_LaunchSheet.png", 0);
v7 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v7, "GJ_LaunchSheet.plist");
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v9 = GameManager::sharedState();
BGTexture = (cocos2d::CCSprite *)GameManager::getBGTexture(v9, 1);
v12 = (cocos2d::CCNode *)cocos2d::CCSprite::create(BGTexture, v11);
a1->addChild(a1, v12);
setPosition = v12->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v76, v73 * 0.5, v74 * 0.5);
setPosition(v12, (const cocos2d::CCPoint *)&v76);
setScale = v12->setScale;
v15 = AppDelegate::get();
v16 = AppDelegate::bgScale(v15);
setScale(v12, v16);
v17 = v12->__vftable;
v72[1] = 102;
getTag = v17[1].getTag;
v72[2] = -1;
v72[0] = 0;
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))getTag)(v12, v72);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_logo_001.png");
a1->addChild(a1, v19);
v20 = v19->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v76, v73 * 0.5, (float)(v74 * 0.5) + 0.0);
v20(v19, (const cocos2d::CCPoint *)&v76);
v21 = cocos2d::CCSprite::createWithSpriteFrameName("RobTopLogoBig_001.png");
a1->addChild(a1, v21);
v22 = v19;
getPosition = v19->getPosition;
v24 = v21->setPosition;
v25 = (__int64)getPosition(v22);
cocos2d::CCPoint::CCPoint(&v75, 0.0, 80.0);
cocos2d::CCPoint::operator+(&v76, v25, &v75);
v24(v21, (const cocos2d::CCPoint *)&v76);
a1->m_loadStep = 0;
a1->m_unknown2 = 1;
v26 = cocos2d::CCSprite::createWithSpriteFrameName("cocos2DxLogo.png");
a1->addChild(a1, v26);
v27 = v26->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v76, v73 - 34.0, 13.0);
v27(v26, (const cocos2d::CCPoint *)&v76);
v26->setScale(v26, 0.6);
v28 = cocos2d::CCSprite::createWithSpriteFrameName("fmodLogo.png");
a1->addChild(a1, v28);
v29 = v26;
v30 = v26->getPosition;
v31 = v28->setPosition;
v32 = (__int64)v30(v29);
cocos2d::CCPoint::CCPoint(&v75, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v76, v32, &v75);
v31(v28, (const cocos2d::CCPoint *)&v76);
v28->setScale(v28, 0.6);
v28->setColor(v28, (const cocos2d::ccColor3B *)&unk_EA2340);
LoadingLayer::getLoadingString(a1);
v33 = cocos2d::CCLabelBMFont::create();
v34 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_caption = v33;
((void (__fastcall *)(LoadingLayer *))v34->addChild)(a1);
m_caption = a1->m_caption;
v36 = m_caption->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v76, v73 * 0.5, (float)(v74 * 0.5) + -70.0);
v36(m_caption, (const cocos2d::CCPoint *)&v76);
a1->m_caption->setScale(a1->m_caption, 0.7);
a1->m_caption->setVisible(a1->m_caption, 0);
LoadingString = (char *)LoadingLayer::getLoadingString(a1);
sub_D153B8((int)&v76, LoadingString);
cocos2d::CCPoint::CCPoint(&v75, 0.5, 0.5);
a1->m_textArea = (TextArea *)TextArea::create((__int64)&v76, "goldFont.fnt", &v75, 0, 1.0, 440.0, 28.0);
v38 = (void *)(*(_QWORD *)&v76.minFilter - 24LL);
if ( (__int64 *)(*(_QWORD *)&v76.minFilter - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(*(_QWORD *)&v76.minFilter - 8LL);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *(_DWORD *)(*(_QWORD *)&v76.minFilter - 8LL);
*(_DWORD *)(*(_QWORD *)&v76.minFilter - 8LL) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v38);
}
((void (__fastcall *)(LoadingLayer *))a1->addChild)(a1);
m_textArea = a1->m_textArea;
v40 = m_textArea->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v76, v73 * 0.5, (float)(v74 * 0.5) + -100.0);
v40(m_textArea, (const cocos2d::CCPoint *)&v76);
a1->m_textArea->setScale(a1->m_textArea, 0.7);
width = a1->m_caption->getContentSize(a1->m_caption)->width;
if ( width > 300.0 )
{
v66 = a1->m_caption;
v67 = v66->setScale;
v68 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v66->getContentSize)(v66, width);
v67(v66, 300.0 / *v68);
}
v42 = a1->m_caption;
v43 = v42->setScale;
if ( v42->getScale(v42) < 0.7 )
{
v42 = a1->m_caption;
v42->getScale(v42);
}
else
{
LODWORD(v44) = 1060320051;
}
v43(v42, v44);
v46 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"slidergroove.png", v45);
a1->addChild_0(a1, v46, 3);
v48 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"sliderBar.png", v47);
v49 = v48->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
height = v46[1].m_obContentSize.height;
a1->m_sliderBar = v48;
*(_QWORD *)&v76.minFilter = 0x260100002601LL;
getTexture = (__int64 (*)(void))v49->getTexture;
v76.wrapS = 10497;
v76.wrapT = 10497;
a1->m_sliderGrooveXPos = height - 4.0;
a1->m_sliderGrooveHeight = 8.0;
v52 = (cocos2d::CCTexture2D *)getTexture();
cocos2d::CCTexture2D::setTexParameters(v52, &v76);
v46->addChild_0(v46, a1->m_sliderBar, -1);
m_sliderBar = a1->m_sliderBar;
setAnchorPoint = m_sliderBar->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v75, 0.0, 0.0);
setAnchorPoint(m_sliderBar, &v75);
v55 = a1->m_sliderBar;
v56 = v55->setPosition;
cocos2d::CCPoint::CCPoint(&v75, 2.0, 4.0);
v56(v55, &v75);
v57 = v46->setPosition;
x = a1->m_caption->getPosition(a1->m_caption)->x;
v58 = a1->m_textArea->getPosition(a1->m_textArea);
cocos2d::CCPoint::CCPoint(&v75, x, v58->y + 40.0);
v57(v46, &v75);
LoadingLayer::updateProgress(a1, 0);
v59 = cocos2d::CCDirector::sharedDirector();
v60 = v59->getActionManager(v59);
v61 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(0.0);
v62 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, LoadingLayer::loadAssets, 0);
v63 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v61, v62, 0);
cocos2d::CCActionManager::addAction(v60, v63, a1, 0);
return v4;
}