//
// RateStarsLayer::init from 0x10028b930 to 0x10028c316 (2534 bytes)
//
// 1 xrefs:
// > RateStarsLayer::create @ 0x10028b8f2
//
// 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)
{
bool inited; // r12
cocos2d::extension::CCScale9Sprite *v8; // r14
const std::string::value_type *v9; // rsi
const char *data; // rdi
cocos2d::CCLabelBMFont *v11; // rbx
cocos2d::CCLayer *m_mainLayer; // rdi
cocos2d::CCArray *v13; // rax
cocos2d::CCArray *v14; // rdi
cocos2d::CCMenu *v15; // rax
cocos2d::CCMenu *m_buttonMenu; // rbx
cocos2d::CCString *v17; // rax
const char *CString; // rax
ButtonSprite *v19; // rax
CCMenuItemSpriteExtra *v20; // r14
cocos2d::CCMenu *v21; // rbx
cocos2d::CCString *v22; // rax
const char *v23; // rax
ButtonSprite *v24; // rax
CCMenuItemSpriteExtra *v25; // r14
cocos2d::CCMenu *v26; // rbx
cocos2d::CCString *v27; // rax
const char *v28; // rax
ButtonSprite *v29; // rax
CCMenuItemSpriteExtra *v30; // r14
cocos2d::CCMenu *v31; // rbx
cocos2d::CCString *v32; // rax
const char *v33; // rax
ButtonSprite *v34; // rax
CCMenuItemSpriteExtra *v35; // r14
cocos2d::CCMenu *v36; // rbx
cocos2d::CCString *v37; // rax
const char *v38; // rax
ButtonSprite *v39; // rax
CCMenuItemSpriteExtra *v40; // r14
RateStarsLayer *v41; // r14
unsigned int i; // r13d
cocos2d::CCMenu *v43; // rbx
cocos2d::CCString *v44; // rax
const char *v45; // rax
ButtonSprite *v46; // rax
CCMenuItemSpriteExtra *v47; // r15
const cocos2d::CCPoint *v48; // rbx
cocos2d::CCPoint v49; // xmm1_8
const cocos2d::CCPoint *v50; // rbx
cocos2d::CCPoint v51; // xmm1_8
GJDifficultySprite *v52; // rax
CCMenuItemSpriteExtra *v53; // rbx
ButtonSprite *v54; // rax
CCMenuItemSpriteExtra *v55; // rbx
ButtonSprite *v56; // rax
CCMenuItemSpriteExtra *v57; // rax
const cocos2d::CCPoint *v58; // rbx
char v60; // [rsp+0h] [rbp-80h]
char v61; // [rsp+0h] [rbp-80h]
char v62; // [rsp+0h] [rbp-80h]
char v63; // [rsp+0h] [rbp-80h]
char v64; // [rsp+0h] [rbp-80h]
char v65; // [rsp+0h] [rbp-80h]
cocos2d::CCArray *v66; // [rsp+8h] [rbp-78h]
_BYTE v67[8]; // [rsp+10h] [rbp-70h] BYREF
std::string v68; // [rsp+18h] [rbp-68h] BYREF
char v69; // [rsp+30h] [rbp-50h] BYREF
char v70; // [rsp+38h] [rbp-48h] BYREF
cocos2d::CCArray *v71; // [rsp+40h] [rbp-40h]
float v72; // [rsp+4Ch] [rbp-34h] BYREF
float v73; // [rsp+50h] [rbp-30h]
bool v74; // [rsp+57h] [rbp-29h]
double v75; // 0:xmm0_8.8
cocos2d::CCPoint v76; // 0:xmm1_8.8
cocos2d::CCRect v77; // 0:xmm0_8.8,8:xmm1_8.8
inited = FLAlertLayer::init_1(a1, 75);
if ( inited )
{
a1->m_moderator = a4;
a1->m_levelID = a2;
a1->m_starsRate = -1;
cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v72);
v77.origin = 0;
v77.size = 0;
sub_10028CC00(&v68, 0.0, 0.0, 80.0, 80.0);
v8 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v77);
sub_10028CBF0(&v68, 380.0, 180.0);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v8->setContentSize)(v8, &v68);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v8,
0xFFFFFFFFLL);
sub_10028CBE0(&v68, v72 * 0.5, v73 * 0.5);
((void (__fastcall *)(cocos2d::extension::CCScale9Sprite *, std::string *))v8->setPosition)(v8, &v68);
strcpy((char *)&v68, "\nRate ");
if ( a1->m_moderator )
std::string::assign(&v68, "Mod: Suggest ");
v9 = "Stars";
if ( a3 )
v9 = "Moons";
std::string::append(&v68, v9);
if ( (*(_BYTE *)&v68.__r_.__value_.__s.0 & 1) != 0 )
data = v68.__r_.__value_.__l.__data_;
else
data = v68.__r_.__value_.__s.__data_;
v11 = cocos2d::CCLabelBMFont::create_3(data, "bigFont.fnt");
sub_10028CBE0(&v69, v72 * 0.5, (float)((float)(0.5 * v73) + 90.0) + -20.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v11->setPosition)(v11, &v69);
m_mainLayer = a1->m_mainLayer;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))m_mainLayer->addChild)(m_mainLayer, v11);
v13 = (cocos2d::CCArray *)sub_10071F9E0(m_mainLayer, v11);
a1->m_buttons = v13;
v14 = v13;
cocos2d::CCObject::retain(v13);
v71 = (cocos2d::CCArray *)sub_10071F9E0(v14, v11);
v66 = (cocos2d::CCArray *)sub_10071F9E0(v14, v11);
v15 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v15;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCMenu *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v15,
10);
v74 = inited;
m_buttonMenu = a1->m_buttonMenu;
v17 = (cocos2d::CCString *)sub_1007AB580("%i", v60);
CString = cocos2d::CCString::getCString(v17);
v19 = ButtonSprite::create_1(CString, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v20 = CCMenuItemSpriteExtra::create(
v19,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v20->setScale)(v20, 1.0);
v20->m_baseScale = 1.0;
if ( m_buttonMenu )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))m_buttonMenu->addChild)(m_buttonMenu, v20);
sub_10071FCD0(a1->m_buttons, v20);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v20->setTag)(v20, 1);
sub_10071FCD0(v71, v20);
v21 = a1->m_buttonMenu;
v22 = (cocos2d::CCString *)sub_1007AB580("%i", v61);
v23 = cocos2d::CCString::getCString(v22);
v24 = ButtonSprite::create_1(v23, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v25 = CCMenuItemSpriteExtra::create(
v24,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v25->setScale)(v25, 1.0);
v25->m_baseScale = 1.0;
if ( v21 )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v21->addChild)(v21, v25);
sub_10071FCD0(a1->m_buttons, v25);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v25->setTag)(v25, 2);
sub_10071FCD0(v71, v25);
v26 = a1->m_buttonMenu;
v27 = (cocos2d::CCString *)sub_1007AB580("%i", v62);
v28 = cocos2d::CCString::getCString(v27);
v29 = ButtonSprite::create_1(v28, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v30 = CCMenuItemSpriteExtra::create(
v29,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v30->setScale)(v30, 1.0);
v30->m_baseScale = 1.0;
if ( v26 )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v26->addChild)(v26, v30);
sub_10071FCD0(a1->m_buttons, v30);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v30->setTag)(v30, 3);
sub_10071FCD0(v71, v30);
v31 = a1->m_buttonMenu;
v32 = (cocos2d::CCString *)sub_1007AB580("%i", v63);
v33 = cocos2d::CCString::getCString(v32);
v34 = ButtonSprite::create_1(v33, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v35 = CCMenuItemSpriteExtra::create(
v34,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v35->setScale)(v35, 1.0);
v35->m_baseScale = 1.0;
if ( v31 )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v31->addChild)(v31, v35);
sub_10071FCD0(a1->m_buttons, v35);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v35->setTag)(v35, 4);
sub_10071FCD0(v71, v35);
v36 = a1->m_buttonMenu;
v37 = (cocos2d::CCString *)sub_1007AB580("%i", v64);
v38 = cocos2d::CCString::getCString(v37);
v39 = ButtonSprite::create_1(v38, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v40 = CCMenuItemSpriteExtra::create(
v39,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v40->setScale)(v40, 1.0);
v40->m_baseScale = 1.0;
if ( v36 )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v36->addChild)(v36, v40);
sub_10071FCD0(a1->m_buttons, v40);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v40->setTag)(v40, 5);
sub_10071FCD0(v71, v40);
v41 = a1;
for ( i = 6; i != 11; ++i )
{
v43 = v41->m_buttonMenu;
v44 = (cocos2d::CCString *)sub_1007AB580("%i", v65);
v45 = cocos2d::CCString::getCString(v44);
v46 = ButtonSprite::create_1(v45, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v47 = CCMenuItemSpriteExtra::create(
v46,
nullptr,
v41,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v47->setScale)(v47, 1.0);
v47->m_baseScale = 1.0;
if ( v43 )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v43->addChild)(v43, v47);
sub_10071FCD0(v41->m_buttons, v47);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v47->setTag)(v47, i);
sub_10071FCD0(v66, v47);
}
v48 = (const cocos2d::CCPoint *)v41->m_buttonMenu;
v49 = (cocos2d::CCPoint)LODWORD(v73);
v49.x = (float)((float)(v73 * 0.5) + 23.0) + 3.0;
sub_10028CBE0(&v70, (float)(v72 * 0.5) + -30.0, v49.x);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v69, v48);
GameToolbox::alignItemsHorisontally(v71, 18.0, v49, (bool)&v69);
v50 = (const cocos2d::CCPoint *)v41->m_buttonMenu;
v51 = (cocos2d::CCPoint)LODWORD(v73);
v51.x = (float)((float)(v73 * 0.5) + -23.0) + 3.0;
sub_10028CBE0(&v70, (float)(v72 * 0.5) + -30.0, v51.x);
inited = v74;
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v69, v50);
GameToolbox::alignItemsHorisontally(v66, 18.0, v51, (bool)&v69);
sub_10028CBE0(&v70, (float)(v72 * 0.5) + -30.0, v73 * 0.5);
sub_10028CBE0(v67, 172.0, 2.0);
sub_10028CCE0(&v69, &v70);
v52 = GJDifficultySprite::create(0, Long);
v41->m_difficultySprite = v52;
((void (__fastcall *)(GJDifficultySprite *, float))v52->setScale)(v52, 1.2);
if ( v41->m_moderator )
{
v53 = CCMenuItemSpriteExtra::create(
v41->m_difficultySprite,
nullptr,
v41,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::onToggleCoins);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v41->m_buttonMenu->addChild)(
v41->m_buttonMenu,
v53);
*(cocos2d::CCPoint *)&v75 = cocos2d::CCNode::convertToNodeSpace(
(cocos2d::CCNode *)&v70,
(const cocos2d::CCPoint *)v41->m_buttonMenu);
((void (__fastcall *)(CCMenuItemSpriteExtra *, char *, double))v53->setPosition)(v53, &v70, v75);
}
else
{
((void (__fastcall *)(cocos2d::CCLayer *, GJDifficultySprite *, __int64))v41->m_mainLayer->addChild_0)(
v41->m_mainLayer,
v41->m_difficultySprite,
11);
((void (__fastcall *)(GJDifficultySprite *, char *))v41->m_difficultySprite->setPosition)(
v41->m_difficultySprite,
&v69);
}
sub_100720270(v71);
v54 = sub_100092A30("Cancel");
v55 = CCMenuItemSpriteExtra::create(
v54,
nullptr,
v41,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::onFeature);
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v41->m_buttonMenu->addChild)(
v41->m_buttonMenu,
v55);
sub_10071FCD0(v71, v55);
v56 = sub_100092A30("Submit");
v57 = CCMenuItemSpriteExtra::create(
v56,
nullptr,
v41,
(cocos2d::SEL_MenuHandler)(unsigned __int64)RateStarsLayer::onClose);
v41->m_submitButton = v57;
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))v41->m_buttonMenu->addChild)(
v41->m_buttonMenu,
v57);
sub_10071FCD0(v71, v41->m_submitButton);
v58 = (const cocos2d::CCPoint *)v41->m_buttonMenu;
v76.y = 0.0;
v76.x = (float)((float)(0.5 * v73) + -90.0) + 25.0;
sub_10028CBE0(v67, v72 * 0.5, v76.x);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v70, v58);
GameToolbox::alignItemsHorisontally(v71, 15.0, v76, (bool)&v70);
RateStarsLayer::selectRating(v41, nullptr);
if ( (*(_BYTE *)&v68.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v68.__r_.__value_.__l.__data_);
}
return inited;
}