//
// LevelPage::init from 0x409598 to 0x409de6 (2126 bytes)
//
// 1 xrefs:
// > LevelPage::create @ 0x409e62
//
// 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)
{
cocos2d::CCDirector *v3; // r0
cocos2d::CCArray *v4; // r0
cocos2d::CCArray *v5; // r0
cocos2d::CCArray *v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCMenu *v8; // r0
LevelPage_vtbl *v9; // r3
cocos2d::CCMenu *m_levelMenu; // r7
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::extension::CCScale9Sprite *v12; // r0
cocos2d::extension::CCScale9Sprite_vtbl *v13; // r3
cocos2d::extension::CCScale9Sprite *m_levelDisplay; // r6
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCSprite *v16; // r10
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r6
const cocos2d::CCSize *v18; // r0
cocos2d::extension::CCScale9Sprite *v19; // r0
void (__fastcall *v20)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
float *v21; // r0
cocos2d::extension::CCScale9Sprite *v22; // r6
float v23; // s17
int v24; // r0
cocos2d::CCNode *v25; // r0
const char *v26; // r1
cocos2d::CCNode *v27; // r6
void (__fastcall *v28)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
const char *v29; // r1
cocos2d::CCSprite *v30; // r0
cocos2d::CCSprite_vtbl *v31; // r3
float width; // s15
void (__fastcall *addChild_0)(cocos2d::CCNode *__hidden, cocos2d::CCNode *, int); // r3
void (__fastcall *setAnchorPoint)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
void (__fastcall *v35)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
int v36; // r0
const char *v37; // r1
cocos2d::CCNode *v38; // r7
const char *v39; // r1
cocos2d::CCSprite *v40; // r0
cocos2d::CCSprite_vtbl *v41; // r3
cocos2d::CCSprite *m_practiceProgressBar; // r0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
cocos2d::CCSprite *v44; // r11
void (__fastcall *v45)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCSprite *v46; // r11
void (__fastcall *v47)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v48; // r0
cocos2d::CCLabelBMFont *v49; // r0
LevelPage_vtbl *v50; // r3
void (__fastcall *v51)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
int v52; // r0
cocos2d::CCLabelBMFont *v53; // r0
LevelPage_vtbl *v54; // r3
void (__fastcall *v55)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
int v56; // r0
cocos2d::CCLabelBMFont *v57; // r11
int v58; // r6
cocos2d::CCLabelBMFont *v59; // r6
void (__fastcall *v60)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
int v61; // r7
cocos2d::CCLabelBMFont *v62; // r0
cocos2d::CCLabelBMFont_vtbl *v63; // r3
cocos2d::CCLabelBMFont *v64; // r7
void (__fastcall *v65)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r6
cocos2d::CCSprite *v66; // r0
cocos2d::CCSprite *v67; // r0
cocos2d::CCSprite *m_starsSprite; // r7
void (__fastcall *v69)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r6
cocos2d::CCLabelBMFont *v70; // r0
cocos2d::CCLabelBMFont *m_starsLabel; // r6
void (__fastcall *v72)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v73; // r6
void (__fastcall *v74)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
const cocos2d::CCPoint *v75; // r9
int v76; // r8
cocos2d::CCArray *v77; // r0
cocos2d::CCArray *v78; // r0
cocos2d::CCSprite *v79; // r6
void (__fastcall *v80)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
cocos2d::CCArray *v81; // r0
cocos2d::CCArray *v83; // r0
_BOOL4 isControllerConnected; // r8
cocos2d::CCSprite *v85; // r6
void (__fastcall *v86)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v87; // r10
float v89; // r2
float v90; // r3
cocos2d::CCSprite *m_normalProgressBar; // [sp+8h] [bp-4Ch]
cocos2d::CCSprite *v92; // [sp+8h] [bp-4Ch]
cocos2d::CCLabelBMFont *v93; // [sp+8h] [bp-4Ch]
_BOOL4 v94; // [sp+Ch] [bp-48h]
void (__fastcall *v95)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-40h]
cocos2d::CCLabelBMFont *m_normalProgressLabel; // [sp+14h] [bp-40h]
cocos2d::CCLabelBMFont *m_practiceProgressLabel; // [sp+14h] [bp-40h]
void (__fastcall *v98)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+14h] [bp-40h]
_BYTE v99[4]; // [sp+18h] [bp-3Ch] BYREF
cocos2d::CCSize v100; // [sp+1Ch] [bp-38h] BYREF
cocos2d::CCPoint v101; // [sp+24h] [bp-30h] BYREF
cocos2d::CCPoint v102; // [sp+2Ch] [bp-28h] BYREF
cocos2d::CCPoint v103; // [sp+34h] [bp-20h] BYREF
cocos2d::CCRect v104; // [sp+3Ch] [bp-18h] BYREF
cocos2d::CCSize v105; // 0:^0.8
cocos2d::CCRect v106; // 0:kr00_16.16
v94 = cocos2d::CCLayer::init(a1);
if ( v94 )
{
a1->setTouchEnabled(a1, 1);
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v100, v3);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v104, 340.0, 95.0);
v4 = (cocos2d::CCArray *)cocos2d::CCSize::operator=(&a1->m_levelDisplaySize, &v104);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
a1->m_progressObjects = v5;
cocos2d::CCObject::retain(v5);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_levelObjects = v7;
cocos2d::CCObject::retain(v7);
v8 = cocos2d::CCMenu::create();
v9 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_levelMenu = v8;
v9->addChild_0(a1, v8, -1);
m_levelMenu = a1->m_levelMenu;
setPosition = m_levelMenu->setPosition;
cocos2d::CCPoint::CCPoint(&v104.origin, v100.width * 0.5, (float)(v100.height * 0.5) + 60.0);
setPosition(m_levelMenu, &v104.origin);
cocos2d::CCRect::CCRect(&v104, 0.0, 0.0, 80.0, 80.0);
v106.origin.x = v89;
v106.origin.y = v90;
v106.size = v105;
v12 = (cocos2d::extension::CCScale9Sprite *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_001.png",
(const char *)&v104,
v106);
v13 = v12->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_levelDisplay = v12;
v13->setOpacity(v12, 125);
a1->m_levelDisplay->setContentSize(a1->m_levelDisplay, &a1->m_levelDisplaySize);
m_levelDisplay = a1->m_levelDisplay;
v15 = m_levelDisplay->setPosition;
cocos2d::CCPoint::CCPoint(&v104.origin, v100.width * 0.5, (float)(v100.height * 0.5) + 50.0);
v15(m_levelDisplay, &v104.origin);
v16 = cocos2d::CCSprite::create();
v16->addChild(v16, a1->m_levelDisplay);
setContentSize = v16->setContentSize;
v18 = a1->m_levelDisplay->getContentSize(a1->m_levelDisplay);
setContentSize(v16, v18);
v19 = a1->m_levelDisplay;
v20 = v19->setPosition;
v21 = (float *)v19->getContentSize(v19);
v22 = a1->m_levelDisplay;
v23 = *v21;
v24 = (int)v22->getContentSize(v22);
cocos2d::CCPoint::CCPoint(&v104.origin, v23 * 0.5, *(float *)(v24 + 4) * 0.5);
v20(v22, &v104.origin);
LODWORD(v104.origin.x) = LevelPage::onPlay;
v104.origin.y = 0.0;
v25 = CCMenuItemSpriteExtra::create(
v16,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(LevelPage::onPlay, (unsigned int)a1));
v25[1].m_unknown5 = 1066192077;
a1->m_levelMenu->addChild(a1->m_levelMenu, v25);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_levelMenu);
v99[0] = 0;
v99[1] = 0;
v99[2] = 0;
v27 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v26);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v27->__vftable[1].getTag)(v27, v99);
((void (__fastcall *)(cocos2d::CCNode *, int))v27->__vftable[1].~CCNode_0)(v27, 125);
((void (__fastcall *)(cocos2d::CCNode *, int))v27->setScale)(v27, 1065353216);
a1->addChild_0(a1, v27, 3);
v28 = v27->setPosition;
cocos2d::CCPoint::CCPoint(&v103, v100.width * 0.5, (float)(v100.height * 0.5) - 30.0);
v28(v27, &v103);
cocos2d::CCArray::addObject(a1->m_progressObjects, v27);
v30 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v29);
v31 = v30->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_normalProgressBar = v30;
((void (__fastcall *)(cocos2d::CCSprite *, int))v31->setScaleX)(v30, 1065218998);
((void (__fastcall *)(cocos2d::CCSprite *, int))a1->m_normalProgressBar->setScaleY)(
a1->m_normalProgressBar,
1063004406);
a1->m_normalProgressBar->setColor(a1->m_normalProgressBar, (const cocos2d::ccColor3B *)&unk_9AB380);
width = a1->m_normalProgressBar->m_obRect.size.width;
addChild_0 = v27->addChild_0;
a1->m_progressWidth = width;
((void (__fastcall *)(cocos2d::CCNode *))addChild_0)(v27);
m_normalProgressBar = a1->m_normalProgressBar;
setAnchorPoint = m_normalProgressBar->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v103, 0.0, 0.5);
setAnchorPoint(m_normalProgressBar, &v103);
v92 = a1->m_normalProgressBar;
v35 = v92->setPosition;
v36 = (int)v27->getContentSize(v27);
cocos2d::CCPoint::CCPoint(&v103, (float)(width - (float)(width * 0.992)) * 0.5, *(float *)(v36 + 4) * 0.5);
v35(v92, &v103);
v38 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v37);
((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v38->__vftable[1].getTag)(v38, v99);
((void (__fastcall *)(cocos2d::CCNode *, int))v38->__vftable[1].~CCNode_0)(v38, 125);
((void (__fastcall *)(cocos2d::CCNode *, int))v38->setScale)(v38, 1065353216);
a1->addChild_0(a1, v38, 3);
v95 = v38->setPosition;
v93 = (cocos2d::CCLabelBMFont *)v27->getPosition(v27);
cocos2d::CCPoint::CCPoint(&v102, 0.0, -50.0);
cocos2d::CCPoint::operator+(&v103, v93, &v102);
v95(v38, &v103);
cocos2d::CCArray::addObject(a1->m_progressObjects, v38);
v40 = (cocos2d::CCSprite *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v39);
v41 = v40->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_practiceProgressBar = v40;
((void (__fastcall *)(cocos2d::CCSprite *, int))v41->setScaleX)(v40, 1065218998);
((void (__fastcall *)(cocos2d::CCSprite *, int))a1->m_practiceProgressBar->setScaleY)(
a1->m_practiceProgressBar,
1063004406);
m_practiceProgressBar = a1->m_practiceProgressBar;
setColor = m_practiceProgressBar->setColor;
LOWORD(v103.x) = -256;
BYTE2(v103.x) = -1;
setColor(m_practiceProgressBar, (const cocos2d::ccColor3B *)&v103);
v38->addChild_0(v38, a1->m_practiceProgressBar, 1);
v44 = a1->m_practiceProgressBar;
v45 = v44->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v103, 0.0, 0.5);
v45(v44, &v103);
v46 = a1->m_practiceProgressBar;
v47 = v46->setPosition;
v48 = a1->m_normalProgressBar->getPosition(a1->m_normalProgressBar);
v47(v46, v48);
v49 = cocos2d::CCLabelBMFont::create();
v50 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_normalProgressLabel = v49;
v50->addChild_0(a1, v49, 4);
m_normalProgressLabel = a1->m_normalProgressLabel;
v51 = m_normalProgressLabel->setPosition;
v52 = (int)v27->getPosition(v27);
v51(m_normalProgressLabel, (const cocos2d::CCPoint *)v52);
((void (__fastcall *)(_DWORD, _DWORD))a1->m_normalProgressLabel->setScale)(a1->m_normalProgressLabel, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_normalProgressLabel);
v53 = cocos2d::CCLabelBMFont::create();
v54 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_practiceProgressLabel = v53;
v54->addChild_0(a1, v53, 4);
m_practiceProgressLabel = a1->m_practiceProgressLabel;
v55 = m_practiceProgressLabel->setPosition;
v56 = (int)v38->getPosition(v38);
v55(m_practiceProgressLabel, (const cocos2d::CCPoint *)v56);
((void (__fastcall *)(_DWORD, _DWORD))a1->m_practiceProgressLabel->setScale)(a1->m_practiceProgressLabel, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, a1->m_practiceProgressLabel);
v57 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v57, 4);
v98 = v57->setPosition;
v58 = (int)v27->getPosition(v27);
cocos2d::CCPoint::CCPoint(&v102, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v103, v58, &v102);
v98(v57, &v103);
v57->setScale(v57, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, v57);
v59 = cocos2d::CCLabelBMFont::create();
a1->addChild_0(a1, v59, 4);
v60 = v59->setPosition;
v61 = (int)v38->getPosition(v38);
cocos2d::CCPoint::CCPoint(&v102, 0.0, 20.0);
cocos2d::CCPoint::operator+(&v103, v61, &v102);
v60(v59, &v103);
v59->setScale(v59, 0.5);
cocos2d::CCArray::addObject(a1->m_progressObjects, v59);
v62 = cocos2d::CCLabelBMFont::create();
v63 = v62->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v64 = v62;
a1->m_nameLabel = v62;
v65 = v63->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v103, 0.0, 0.5);
v65(v64, &v103);
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");
a1->m_difficultySprite = v66;
a1->m_levelDisplay->addChild(a1->m_levelDisplay, v66);
((void (__fastcall *)(cocos2d::CCSprite *, int))a1->m_difficultySprite->setScale)(
a1->m_difficultySprite,
1066192077);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_difficultySprite);
v67 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_starsIcon_001.png");
a1->m_starsSprite = v67;
a1->m_levelDisplay->addChild(a1->m_levelDisplay, v67);
((void (__fastcall *)(cocos2d::CCSprite *, int))a1->m_starsSprite->setScale)(a1->m_starsSprite, 1060320051);
m_starsSprite = a1->m_starsSprite;
v69 = m_starsSprite->setPosition;
cocos2d::CCPoint::CCPoint(&v103, a1->m_levelDisplaySize.width - 15.0, a1->m_levelDisplaySize.height - 13.0);
v69(m_starsSprite, &v103);
cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsSprite);
v70 = cocos2d::CCLabelBMFont::create();
a1->m_starsLabel = v70;
a1->m_levelDisplay->addChild(a1->m_levelDisplay, v70);
m_starsLabel = a1->m_starsLabel;
v72 = m_starsLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v103, 1.0, 0.5);
v72(m_starsLabel, &v103);
v73 = a1->m_starsLabel;
v74 = v73->setPosition;
v75 = a1->m_starsSprite->getPosition(a1->m_starsSprite);
cocos2d::CCPoint::CCPoint(&v102, -12.0, 0.5);
cocos2d::CCPoint::operator+(&v103, v75, &v102);
v76 = 2;
v74(v73, &v103);
((void (__fastcall *)(_DWORD, _DWORD))a1->m_starsLabel->setScale)(a1->m_starsLabel, 0.5);
v77 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(a1->m_levelObjects, a1->m_starsLabel);
v78 = (cocos2d::CCArray *)cocos2d::CCArray::create(v77);
a1->m_coins = v78;
cocos2d::CCObject::retain(v78);
cocos2d::CCPoint::CCPoint(&v101, a1->m_levelDisplaySize.width - 16.0, 16.0);
do
{
v79 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon_001.png");
a1->m_levelDisplay->addChild(a1->m_levelDisplay, v79);
((void (__fastcall *)(cocos2d::CCSprite *, int))v79->setScale)(v79, 1065353216);
v80 = v79->setPosition;
cocos2d::CCPoint::CCPoint(&v102, (float)v76 * -26.0, 0.0);
cocos2d::CCPoint::operator+(&v103, &v101, &v102);
v80(v79, &v103);
cocos2d::CCArray::addObject(a1->m_coins, v79);
v81 = (cocos2d::CCArray *)cocos2d::CCArray::addObject(a1->m_levelObjects, v79);
}
while ( v76-- != 0 );
v83 = (cocos2d::CCArray *)cocos2d::CCArray::create(v81);
a1->m_dynamicObjects = v83;
cocos2d::CCObject::retain(v83);
isControllerConnected = PlatformToolbox::isControllerConnected();
if ( isControllerConnected )
{
v85 = cocos2d::CCSprite::createWithSpriteFrameName("controllerBtn_Start_001.png");
v16->addChild_0(v16, v85, 10);
v86 = v85->setPosition;
v87 = a1->m_levelDisplay->getPosition(a1->m_levelDisplay);
cocos2d::CCPoint::CCPoint(&v102, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v103, v87, &v102);
v86(v85, &v103);
cocos2d::CCArray::addObject(a1->m_levelObjects, v85);
LOBYTE(v94) = isControllerConnected;
}
}
return v94;
}