//
// LevelPage::init from 0x79cf20 to 0x79daac (2956 bytes)
//
// 2 xrefs:
// > LevelPage::create @ 0x79db5c
// > ??> @ 0x90c18
//
// 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 LevelPage::init(LevelPage *a1, GJGameLevel *a2)
{
bool v3; // w25
int v5; // w23
cocos2d::CCDirector *v6; // x0
cocos2d::CCArray *v7; // x0
cocos2d::CCArray *v8; // x0
cocos2d::CCArray *v9; // x0
cocos2d::CCArray *v10; // x0
cocos2d::CCMenu *v11; // x0
cocos2d::CCMenu *m_levelMenu; // x26
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::extension::CCScale9Sprite *v14; // x0
cocos2d::extension::CCScale9Sprite_vtbl *v15; // x2
cocos2d::extension::CCScale9Sprite *m_levelDisplay; // x21
void (__fastcall *v17)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x21
const cocos2d::CCSize *v19; // x0
cocos2d::extension::CCScale9Sprite *v20; // x0
void (__fastcall *v21)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
float *v22; // x0
cocos2d::extension::CCScale9Sprite *v23; // x21
__int64 v24; // x0
CCMenuItemSpriteExtra *v25; // x1
cocos2d::CCMenu *v26; // x0
cocos2d::CCMenu_vtbl *v27; // x3
const char *v28; // x1
cocos2d::CCNode *v29; // x26
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const char *v31; // x1
cocos2d::CCSprite *v32; // x0
cocos2d::CCSprite_vtbl *v33; // x1
cocos2d::CCSprite *m_normalProgressBar; // x1
float width; // s0
void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // x4
float v37; // s13
cocos2d::CCSprite *v38; // x27
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCSprite *v40; // x27
void (__fastcall *v41)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
__int64 v42; // x0
const char *v43; // x1
cocos2d::CCNode *v44; // x24
void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
__int64 v46; // x27
const char *v47; // x1
cocos2d::CCSprite *v48; // x0
cocos2d::CCSprite_vtbl *v49; // x1
cocos2d::CCSprite *m_practiceProgressBar; // x0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x5
cocos2d::CCSprite *v52; // x21
void (__fastcall *v53)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCSprite *v54; // x21
void (__fastcall *v55)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x28
const cocos2d::CCPoint *v56; // x0
cocos2d::CCLabelBMFont *v57; // x0
void (__fastcall *v58)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
__int64 v59; // x0
cocos2d::CCLabelBMFont *v60; // x0
void (__fastcall *v61)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
__int64 v62; // x0
cocos2d::CCLabelBMFont *v63; // x27
cocos2d::CCLabelBMFont *v64; // x27
cocos2d::CCLabelBMFont *v65; // x0
cocos2d::CCSprite *v66; // x0
cocos2d::extension::CCScale9Sprite *v67; // x2
cocos2d::CCSprite *v68; // x0
cocos2d::extension::CCScale9Sprite *v69; // x2
cocos2d::CCLabelBMFont *v70; // x0
cocos2d::extension::CCScale9Sprite *v71; // x2
cocos2d::CCLabelBMFont *m_starsLabel; // x21
void (__fastcall *v73)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCLabelBMFont *v74; // x21
void (__fastcall *v75)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
cocos2d::CCArray *v76; // x0
cocos2d::CCArray *v77; // x0
cocos2d::CCSprite *v78; // x21
float v79; // s0
void (__fastcall *v80)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x24
cocos2d::CCArray *v81; // x0
cocos2d::CCArray *v82; // x0
bool isControllerConnected; // w0
cocos2d::CCSprite *v84; // x21
void (__fastcall *v85)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
const cocos2d::CCPoint *v86; // x26
cocos2d::CCSprite *v87; // [xsp+98h] [xbp+98h]
float v88; // [xsp+A0h] [xbp+A0h]
cocos2d::CCLabelBMFont *m_normalProgressLabel; // [xsp+A0h] [xbp+A0h]
cocos2d::CCLabelBMFont *m_practiceProgressLabel; // [xsp+A0h] [xbp+A0h]
__int64 v91; // [xsp+A0h] [xbp+A0h]
__int64 v92; // [xsp+A0h] [xbp+A0h]
void (__fastcall *v93)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
void (__fastcall *v94)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // [xsp+A0h] [xbp+A0h]
const cocos2d::CCPoint *v95; // [xsp+A0h] [xbp+A0h]
void (__fastcall *v96)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B0h] [xbp+B0h]
void (__fastcall *v97)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B0h] [xbp+B0h]
cocos2d::CCLabelBMFont *v98; // [xsp+B0h] [xbp+B0h]
cocos2d::CCSprite *m_starsSprite; // [xsp+B0h] [xbp+B0h]
_BYTE v100[8]; // [xsp+C8h] [xbp+C8h] BYREF
float v101; // [xsp+D0h] [xbp+D0h]
float v102; // [xsp+D4h] [xbp+D4h]
cocos2d::CCPoint v103; // [xsp+D8h] [xbp+D8h] BYREF
cocos2d::CCPoint v104; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCRect v105; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::SEL_MenuHandler v106; // 0:x2.16
cocos2d::CCRect v107; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v3 = cocos2d::CCLayer::init(a1);
if ( v3 )
{
v5 = 2;
a1->setTouchEnabled(a1, 1);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v105, 340.0, 95.0);
v7 = (cocos2d::CCArray *)cocos2d::CCSize::operator=(&a1->m_levelDisplaySize, &v105);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
a1->m_progressObjects = v8;
cocos2d::CCObject::retain(v8);
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
a1->m_levelObjects = v10;
cocos2d::CCObject::retain(v10);
v11 = cocos2d::CCMenu::create();
a1->m_levelMenu = v11;
a1->addChild_0(a1, v11, -1);
m_levelMenu = a1->m_levelMenu;
setPosition = m_levelMenu->setPosition;
cocos2d::CCPoint::CCPoint(&v105.origin, v101 * 0.5, (float)(v102 * 0.5) + 60.0);
setPosition(m_levelMenu, &v105.origin);
cocos2d::CCRect::CCRect(&v105, 0.0, 0.0, 80.0, 80.0);
v14 = (cocos2d::extension::CCScale9Sprite *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_001.png",
(const char *)&v105,
v107);
v15 = v14->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_levelDisplay = v14;
v15->setOpacity(v14, 125);
a1->m_levelDisplay->setContentSize(a1->m_levelDisplay, &a1->m_levelDisplaySize);
m_levelDisplay = a1->m_levelDisplay;
v17 = m_levelDisplay->setPosition;
cocos2d::CCPoint::CCPoint(&v105.origin, v101 * 0.5, (float)(v102 * 0.5) + 50.0);
v17(m_levelDisplay, &v105.origin);
v87 = cocos2d::CCSprite::create();
v87->addChild(v87, a1->m_levelDisplay);
setContentSize = v87->setContentSize;
v19 = a1->m_levelDisplay->getContentSize(a1->m_levelDisplay);
setContentSize(v87, v19);
v20 = a1->m_levelDisplay;
v21 = v20->setPosition;
v22 = (float *)v20->getContentSize(v20);
v23 = a1->m_levelDisplay;
v88 = *v22 * 0.5;
v24 = (__int64)v23->getContentSize(v23);
cocos2d::CCPoint::CCPoint(&v105.origin, v88, *(float *)(v24 + 4) * 0.5);
v21(v23, &v105.origin);
v106.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v106.adj = (size_t)LevelPage::onPlay;
v25 = CCMenuItemSpriteExtra::create(v87, nullptr, v106);
v26 = a1->m_levelMenu;
v27 = v26->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v25->m_scaleMultiplier = 1.1;
v27->addChild(v26, v25);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_levelMenu);
v100[0] = 0;
v100[1] = 0;
v100[2] = 0;
v29 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v28);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v29->__vftable[1].getTag)(v29, v100);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v29->__vftable[1].~CCNode_0)(v29, 125);
v29->setScale(v29, 1.0);
a1->addChild_0(a1, v29, 3);
v30 = v29->setPosition;
cocos2d::CCPoint::CCPoint(&v105.origin, v101 * 0.5, (float)(v102 * 0.5) + -30.0);
v30(v29, &v105.origin);
cocos2d::CCArray::addObject(a1->m_progressObjects, v29);
v32 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v31);
v33 = v32->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_normalProgressBar = v32;
((void (__fastcall *)(float))v33->setScaleX)(0.992);
a1->m_normalProgressBar->setScaleY(a1->m_normalProgressBar, 0.86);
a1->m_normalProgressBar->setColor(a1->m_normalProgressBar, (const cocos2d::ccColor3B *)&unk_ECFC68);
m_normalProgressBar = a1->m_normalProgressBar;
width = m_normalProgressBar->m_obRect.size.width;
addChild_0 = v29->addChild_0;
v37 = width - (float)(width * 0.992);
a1->m_progressWidth = width;
addChild_0(v29, m_normalProgressBar, 1);
v38 = a1->m_normalProgressBar;
setAnchorPoint = v38->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v105.origin, 0.0, 0.5);
setAnchorPoint(v38, &v105.origin);
v40 = a1->m_normalProgressBar;
v41 = v40->setPosition;
v42 = (__int64)v29->getContentSize(v29);
cocos2d::CCPoint::CCPoint(&v105.origin, v37 * 0.5, *(float *)(v42 + 4) * 0.5);
v41(v40, &v105.origin);
v44 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v43);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v44->__vftable[1].getTag)(v44, v100);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v44->__vftable[1].~CCNode_0)(v44, 125);
v44->setScale(v44, 1.0);
a1->addChild_0(a1, v44, 3);
v45 = v44->setPosition;
v46 = (__int64)v29->getPosition(v29);
cocos2d::CCPoint::CCPoint(&v104, 0.0, -50.0);
cocos2d::CCPoint::operator+(&v105, v46, &v104);
v45(v44, &v105.origin);
cocos2d::CCArray::addObject(a1->m_progressObjects, v44);
v48 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v47);
v49 = v48->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_practiceProgressBar = v48;
((void (__fastcall *)(float))v49->setScaleX)(0.992);
a1->m_practiceProgressBar->setScaleY(a1->m_practiceProgressBar, 0.86);
m_practiceProgressBar = a1->m_practiceProgressBar;
setColor = m_practiceProgressBar->setColor;
BYTE2(v105.origin.x) = -1;
LOWORD(v105.origin.x) = -256;
setColor(m_practiceProgressBar, (const cocos2d::ccColor3B *)&v105);
v44->addChild_0(v44, a1->m_practiceProgressBar, 1);
v52 = a1->m_practiceProgressBar;
v53 = v52->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v105.origin, 0.0, 0.5);
v53(v52, &v105.origin);
v54 = a1->m_practiceProgressBar;
v55 = v54->setPosition;
v56 = a1->m_normalProgressBar->getPosition(a1->m_normalProgressBar);
v55(v54, v56);
v57 = cocos2d::CCLabelBMFont::create();
a1->m_normalProgressLabel = v57;
a1->addChild_0(a1, v57, 4);
m_normalProgressLabel = a1->m_normalProgressLabel;
v58 = m_normalProgressLabel->setPosition;
v59 = (__int64)v29->getPosition(v29);
v58(m_normalProgressLabel, (const cocos2d::CCPoint *)v59);
a1->m_normalProgressLabel->setScale(a1->m_normalProgressLabel, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_normalProgressLabel);
v60 = cocos2d::CCLabelBMFont::create();
a1->m_practiceProgressLabel = v60;
a1->addChild_0(a1, v60, 4);
m_practiceProgressLabel = a1->m_practiceProgressLabel;
v61 = m_practiceProgressLabel->setPosition;
v62 = (__int64)v44->getPosition(v44);
v61(m_practiceProgressLabel, (const cocos2d::CCPoint *)v62);
a1->m_practiceProgressLabel->setScale(a1->m_practiceProgressLabel, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_practiceProgressLabel);
v63 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v63, 4);
v96 = v63->setPosition;
v91 = (__int64)v29->getPosition(v29);
cocos2d::CCPoint::CCPoint(&v104, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v105, v91, &v104);
v96(v63, &v105.origin);
v63->setScale(v63, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, v63);
v64 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v64, 4);
v97 = v64->setPosition;
v92 = (__int64)v44->getPosition(v44);
cocos2d::CCPoint::CCPoint(&v104, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v105, v92, &v104);
v97(v64, &v105.origin);
v64->setScale(v64, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, v64);
v65 = cocos2d::CCLabelBMFont::create();
a1->m_nameLabel = v65;
v98 = v65;
v93 = v65->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v105.origin, 0.0, 0.5);
v93(v98, &v105.origin);
a1->m_levelDisplay->addChild(a1->m_levelDisplay, a1->m_nameLabel);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_nameLabel);
v66 = cocos2d::CCSprite::createWithSpriteFrameName("diffIcon_01_btn_001.png");
v67 = a1->m_levelDisplay;
a1->m_difficultySprite = v66;
v67->addChild(v67, v66);
a1->m_difficultySprite->setScale(a1->m_difficultySprite, 1.1);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_difficultySprite);
v68 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
v69 = a1->m_levelDisplay;
a1->m_starsSprite = v68;
v69->addChild(v69, v68);
a1->m_starsSprite->setScale(a1->m_starsSprite, 0.7);
m_starsSprite = a1->m_starsSprite;
v94 = m_starsSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v105.origin, a1->m_levelDisplaySize.width - 15.0, a1->m_levelDisplaySize.height - 13.0);
v94(m_starsSprite, &v105.origin);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsSprite);
v70 = cocos2d::CCLabelBMFont::create();
v71 = a1->m_levelDisplay;
a1->m_starsLabel = v70;
v71->addChild(v71, v70);
m_starsLabel = a1->m_starsLabel;
v73 = m_starsLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v105.origin, 1.0, 0.5);
v73(m_starsLabel, &v105.origin);
v74 = a1->m_starsLabel;
v75 = v74->setPosition;
v95 = a1->m_starsSprite->getPosition(a1->m_starsSprite);
cocos2d::CCPoint::CCPoint(&v104, -12.0, 0.5);
cocos2d::CCPoint::operator+(&v105, v95, &v104);
v75(v74, &v105.origin);
a1->m_starsLabel->setScale(a1->m_starsLabel, 0.5);
v76 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsLabel);
v77 = (cocos2d::CCArray *)cocos2d::CCArray::create(v76);
a1->m_coins = v77;
cocos2d::CCObject::retain(v77);
cocos2d::CCPoint::CCPoint(&v103, a1->m_levelDisplaySize.width - 16.0, 16.0);
do
{
v78 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon_001.png");
a1->m_levelDisplay->addChild(a1->m_levelDisplay, v78);
v78->setScale(v78, 1.0);
v79 = (float)v5--;
v80 = v78->setPosition;
cocos2d::CCPoint::CCPoint(&v104, v79 * -26.0, 0.0);
cocos2d::CCPoint::operator+(&v105, &v103, &v104);
v80(v78, &v105.origin);
cocos2d::CCArray::addObject(a1->m_coins, v78);
v81 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(a1->m_levelObjects, v78);
}
while ( v5 != -1 );
v82 = (cocos2d::CCArray *)cocos2d::CCArray::create(v81);
a1->m_dynamicObjects = v82;
cocos2d::CCObject::retain(v82);
isControllerConnected = PlatformToolbox::isControllerConnected();
if ( isControllerConnected )
{
v3 = isControllerConnected;
v84 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
v87->addChild_0(v87, v84, 10);
v85 = v84->setPosition;
v86 = a1->m_levelDisplay->getPosition(a1->m_levelDisplay);
cocos2d::CCPoint::CCPoint(&v104, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v105, v86, &v104);
v85(v84, &v105.origin);
cocos2d::CCArray::addObject(a1->m_levelObjects, v84);
}
}
return v3;
}