//
// RateStarsLayer::init from 0x1000801c4 to 0x1000806f8 (1332 bytes)
//
// 1 xrefs:
// > RateStarsLayer::create @ 0x100080174
//
// 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 __fastcall RateStarsLayer::init(RateStarsLayer *a1, int a2, bool a3, bool a4)
{
_BOOL4 v5; // w21
_BOOL4 inited; // w19
cocos2d::CCDirector *v9; // x0
cocos2d::extension::CCScale9Sprite *v10; // x22
__n128 v11; // q0
__n128 v12; // q1
const std::string::value_type *v13; // x1
std::string *v14; // x0
cocos2d::CCLabelBMFont *v15; // x21
__n128 v16; // q0
__n128 v17; // q1
__int64 v18; // x0
cocos2d::CCArray *v19; // x0
__int64 v20; // x0
cocos2d::CCArray *v21; // x21
cocos2d::CCArray *v22; // x22
__int64 v23; // x23
__int64 v24; // x25
__n128 v25; // q0
cocos2d::CCArray *v26; // x0
__n128 v27; // q0
__n128 v28; // q1
cocos2d::CCMenu *m_buttonMenu; // x23
cocos2d::CCMenu *v30; // x23
__n128 v31; // q0
__n128 v32; // q1
__n128 v33; // q0
__n128 v34; // q1
__n128 v35; // q0
__n128 v36; // q1
GJDifficultySprite *v37; // x0
CCMenuItemSpriteExtra *v38; // x22
ButtonSprite *v39; // x0
CCMenuItemSpriteExtra *v40; // x22
ButtonSprite *v41; // x0
__n128 v42; // q0
cocos2d::CCMenu *v43; // x22
__n128 v44; // q1
float32x2_t v46; // [xsp+8h] [xbp-78h] BYREF
float32x2_t v47; // [xsp+10h] [xbp-70h] BYREF
float32x2_t v48; // [xsp+18h] [xbp-68h] BYREF
std::string v49; // [xsp+20h] [xbp-60h] BYREF
float v50; // [xsp+38h] [xbp-48h]
float v51; // [xsp+3Ch] [xbp-44h]
cocos2d::CCPoint v52; // 0:kr18_8.8
cocos2d::SEL_MenuHandler v53; // 0:x3.16
cocos2d::SEL_MenuHandler v54; // 0:x3.16
cocos2d::SEL_MenuHandler v55; // 0:x3.16
cocos2d::CCPoint v56; // 0:s1.4,4:s2.4
cocos2d::CCPoint v57; // 0:s1.4,4:s2.4
cocos2d::CCPoint v58; // 0:s1.4,4:s2.4
cocos2d::CCRect v59; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v5 = a3;
inited = FLAlertLayer::init_1(a1, 75);
if ( inited )
{
a1->m_moderator = a4;
a1->m_levelID = a2;
a1->m_starsRate = -1;
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v9);
sub_100022990((float *)&v49, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v59);
sub_100022988((float *)&v49, 380.0, 180.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v10->setContentSize)(v10, &v49);
v11 = ((__n128 (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v10,
0xFFFFFFFFLL);
v11.n128_f32[0] = v50 * 0.5;
v12.n128_f32[0] = v51 * 0.5;
sub_100022980(v11, v12, &v49);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v10->setPosition)(v10, &v49);
sub_100009900(&v49, "Rate ");
if ( a1->m_moderator )
std::string::assign(&v49, "Mod: Suggest ");
if ( v5 )
v13 = "Moons";
else
v13 = "Stars";
std::string::append(&v49, v13);
if ( (v49.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &v49;
else
v14 = (std::string *)v49.__r_.__value_.__r.__words[0];
v15 = cocos2d::CCLabelBMFont::create_1((const char *)v14, "bigFont.fnt");
v16.n128_f32[0] = v50 * 0.5;
v17.n128_f32[0] = (float)((float)(v51 * 0.5) + 90.0) + -20.0;
sub_100022980(v16, v17, &v48);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float32x2_t *))v15->setPosition)(v15, &v48);
v18 = ((__int64 (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v15);
v19 = (cocos2d::CCArray *)sub_10024A15C(v18);
a1->m_buttons = v19;
cocos2d::CCObject::retain(v19);
v21 = (cocos2d::CCArray *)sub_10024A15C(v20);
v22 = (cocos2d::CCArray *)sub_10024A15C(v21);
a1->m_buttonMenu = cocos2d::CCMenu::create();
((void (__fastcall *)(cocos2d::CCLayer *))a1->m_mainLayer->addChild_0)(a1->m_mainLayer);
v23 = 1;
do
{
v24 = sub_100080758(a1, v23, RateStarsLayer::selectRating, 0, a1->m_buttonMenu, 1.0);
v25 = sub_10024A2D0(a1->m_buttons, v24);
(*(void (__fastcall **)(__int64, __int64, __n128))(*(_QWORD *)v24 + 72LL))(v24, v23, v25);
if ( (unsigned int)v23 >= 6 )
v26 = v22;
else
v26 = v21;
v27 = sub_10024A2D0(v26, v24);
v23 = (unsigned int)(v23 + 1);
}
while ( (_DWORD)v23 != 11 );
m_buttonMenu = a1->m_buttonMenu;
v27.n128_f32[0] = (float)(v50 * 0.5) + -30.0;
v28.n128_f32[0] = (float)((float)(v51 * 0.5) + 23.0) + 3.0;
sub_100022980(v27, v28, &v47);
LODWORD(v56.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(
m_buttonMenu,
(const cocos2d::CCPoint *)&v47).y);
GameToolbox::alignItemsHorisontally(v21, 18.0, v56, (bool)&v48);
v30 = a1->m_buttonMenu;
v31.n128_f32[0] = (float)(v50 * 0.5) + -30.0;
v32.n128_f32[0] = (float)((float)(v51 * 0.5) + -23.0) + 3.0;
sub_100022980(v31, v32, &v47);
LODWORD(v57.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(v30, (const cocos2d::CCPoint *)&v47).y);
GameToolbox::alignItemsHorisontally(v22, 18.0, v57, (bool)&v48);
v33.n128_f32[0] = (float)(v50 * 0.5) + -30.0;
v34.n128_f32[0] = v51 * 0.5;
sub_100022980(v33, v34, &v47);
v35.n128_u32[0] = 1126957056;
v36.n128_u32[0] = 2.0;
sub_100022980(v35, v36, &v46);
sub_1000229DC(&v47, &v46, &v48);
v37 = GJDifficultySprite::create(0, Long);
a1->m_difficultySprite = v37;
((void (__fastcall *)(GJDifficultySprite *, float))v37->setScale)(v37, 1.2);
if ( a1->m_moderator )
{
v53.ptr = (void (__cdecl *)(cocos2d::CCObject *))RateStarsLayer::onFeature;
v53.adj = 0;
v38 = CCMenuItemSpriteExtra::create(a1->m_difficultySprite, nullptr, a1, v53);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(
a1->m_buttonMenu,
v38);
v52 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const cocos2d::CCPoint *)&v48);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float32x2_t *, float, float))v38->setPosition)(
v38,
&v47,
v52.x,
v52.y);
}
else
{
((void (__fastcall *)(cocos2d::CCLayer *, GJDifficultySprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
a1->m_difficultySprite,
11);
((void (__fastcall *)(GJDifficultySprite *, float32x2_t *))a1->m_difficultySprite->setPosition)(
a1->m_difficultySprite,
&v48);
}
sub_10024A45C(v21);
v39 = sub_10005F294("Cancel");
v54.ptr = (void (__cdecl *)(cocos2d::CCObject *))RateStarsLayer::onClose;
v54.adj = 0;
v40 = CCMenuItemSpriteExtra::create(v39, nullptr, a1, v54);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu, v40);
sub_10024A2D0(v21, v40);
v41 = sub_10005F294("Submit");
v55.ptr = (void (__cdecl *)(cocos2d::CCObject *))RateStarsLayer::onRate;
v55.adj = 0;
a1->m_submitButton = CCMenuItemSpriteExtra::create(v41, nullptr, a1, v55);
((void (__fastcall *)(cocos2d::CCMenu *))a1->m_buttonMenu->addChild)(a1->m_buttonMenu);
v42 = sub_10024A2D0(v21, a1->m_submitButton);
v43 = a1->m_buttonMenu;
v42.n128_f32[0] = v50 * 0.5;
v44.n128_f32[0] = (float)((float)(v51 * 0.5) + -90.0) + 25.0;
sub_100022980(v42, v44, &v46);
LODWORD(v58.x) = COERCE_UNSIGNED_INT(cocos2d::CCNode::convertToNodeSpace(v43, (const cocos2d::CCPoint *)&v46).y);
GameToolbox::alignItemsHorisontally(v21, 15.0, v58, (bool)&v47);
RateStarsLayer::selectRating(a1, nullptr);
if ( SHIBYTE(v49.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v49.__r_.__value_.__l.__data_);
}
return inited;
}