//
// RateLevelLayer::init from 0x79ab3c to 0x79af18 (988 bytes)
//
// 2 xrefs:
// > RateLevelLayer::create @ 0x79aff0
// > ??> @ 0x927d8
//
// 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 RateLevelLayer::init(RateLevelLayer *a1, int a2)
{
char v4; // w26
unsigned int v6; // w20
cocos2d::CCDirector *v7; // x0
cocos2d::CCNode *v8; // x21
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCLabelBMFont *v11; // x21
void (__fastcall *v12)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCArray *v13; // x0
cocos2d::CCArray *v14; // x0
cocos2d::CCArray *v15; // x0
cocos2d::CCArray *v16; // x22
cocos2d::CCMenu *v17; // x0
cocos2d::CCString *v18; // x0
const char *i; // x0
cocos2d::CCString *v20; // x0
cocos2d::CCSprite *v21; // x21
CCMenuItemSpriteExtra *v22; // x0
__int64 v23; // x1
cocos2d::CCNode *v24; // x21
cocos2d::CCMenu *m_buttonMenu; // x21
const char *v26; // x1
__int64 v27; // x2
__int64 v28; // x3
bool v29; // w4
__int64 v30; // x5
const char *v31; // x6
cocos2d::CCNode *v32; // x0
CCMenuItemSpriteExtra *v33; // x21
const char *v34; // x1
__int64 v35; // x2
__int64 v36; // x3
bool v37; // w4
__int64 v38; // x5
const char *v39; // x6
cocos2d::CCNode *v40; // x0
CCMenuItemSpriteExtra *v41; // x0
cocos2d::CCMenu *v42; // x21
_QWORD v43[2]; // [xsp+0h] [xbp+0h] BYREF
float v44; // [xsp+68h] [xbp+68h]
float v45; // [xsp+6Ch] [xbp+6Ch]
cocos2d::CCRect v46; // [xsp+78h] [xbp+78h] BYREF
cocos2d::SEL_MenuHandler v47; // 0:x2.16
cocos2d::SEL_MenuHandler v48; // 0:x2.16
cocos2d::SEL_MenuHandler v49; // 0:x2.16
cocos2d::CCPoint v50; // 0:s1.4,4:s2.4
cocos2d::CCPoint v51; // 0:s1.4,4:s2.4
cocos2d::CCRect v52; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v4 = FLAlertLayer::init(a1, 0x4Bu);
if ( v4 )
{
a1->m_levelID = a2;
v6 = 0;
v7 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v7);
cocos2d::CCRect::CCRect(&v46, 0.0, 0.0, 80.0, 80.0);
v8 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v46,
v52);
setContentSize = v8->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v46, 360.0, 180.0);
setContentSize(v8, (const cocos2d::CCSize *)&v46);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v8, -1);
setPosition = v8->setPosition;
cocos2d::CCPoint::CCPoint(&v46.origin, v44 * 0.5, v45 * 0.5);
setPosition(v8, &v46.origin);
v11 = cocos2d::CCLabelBMFont::create();
v12 = v11->setPosition;
cocos2d::CCPoint::CCPoint(&v46.origin, v44 * 0.5, (float)((float)(v45 * 0.5) + 90.0) - 20.0);
v12(v11, &v46.origin);
v13 = (cocos2d::CCArray *)((__int64 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v11);
v14 = (cocos2d::CCArray *)cocos2d::CCArray::create(v13);
a1->m_difficulties = v14;
cocos2d::CCObject::retain(v14);
v16 = (cocos2d::CCArray *)cocos2d::CCArray::create(v15);
v17 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v17;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v17, 10);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
nullptr);
cocos2d::CCString::getCString(v18);
for ( i = "difficulty_auto_btn_001.png"; ; i = cocos2d::CCString::getCString(v20) )
{
v21 = cocos2d::CCSprite::createWithSpriteFrameName(i);
cocos2d::CCArray::addObject(a1->m_difficulties, v21);
v21->setScale(v21, 1.0);
v47.adj = (size_t)RateLevelLayer::selectRating;
v47.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v22 = CCMenuItemSpriteExtra::create(v21, nullptr, v47);
v23 = v6;
v24 = v22;
++v6;
v22->setTag(v22, v23);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v24);
cocos2d::CCArray::addObject(v16, v24);
if ( v6 == 7 )
break;
v20 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
(const char *)v6);
}
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v46.origin, v44 * 0.5, v45 * 0.5);
LODWORD(v50.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v46.origin).y);
GameToolbox::alignItemsHorisontally(v16, 16.0, v50, (unsigned __int8)v43 + 112);
cocos2d::CCArray::removeAllObjects(v16);
v32 = (cocos2d::CCNode *)ButtonSprite::create((ButtonSprite *)"Cancel", v26, v27, v28, v29, v30, v31);
v48.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v48.adj = (size_t)RateLevelLayer::onClose;
v33 = CCMenuItemSpriteExtra::create(v32, nullptr, v48);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33);
cocos2d::CCArray::addObject(v16, v33);
v40 = (cocos2d::CCNode *)ButtonSprite::create((ButtonSprite *)"Submit", v34, v35, v36, v37, v38, v39);
v49.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v49.adj = (size_t)RateLevelLayer::onRate;
v41 = CCMenuItemSpriteExtra::create(v40, nullptr, v49);
a1->m_submitButton = v41;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v41);
cocos2d::CCArray::addObject(v16, a1->m_submitButton);
v42 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v46.origin, v44 * 0.5, (float)((float)(v45 * 0.5) + -90.0) + 25.0);
LODWORD(v51.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(v42, &v46.origin).y);
GameToolbox::alignItemsHorisontally(v16, 15.0, v51, (unsigned __int8)v43 + 112);
RateLevelLayer::selectRating(a1, nullptr);
}
return v4;
}