//
// RateStarsLayer::init from 0x455ad8 to 0x455f32 (1114 bytes)
//
// 1 xrefs:
// > RateStarsLayer::create @ 0x456030
//
// 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 RateStarsLayer::init(RateStarsLayer *a1, int a2, bool a3, bool a4)
{
_BOOL4 v7; // r11
cocos2d::CCDirector *v8; // r0
cocos2d::CCNode *v9; // r6
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
char *v12; // r1
cocos2d::CCLabelBMFont *v13; // r6
void (__fastcall *v14)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
cocos2d::CCArray *v15; // r0
cocos2d::CCArray *v16; // r0
cocos2d::CCArray *v17; // r0
cocos2d::CCArray *v18; // r6
cocos2d::CCArray *v19; // r10
cocos2d::CCMenu *v20; // r0
int i; // r8
CCMenuItemSpriteExtra *StarsButton; // r11
cocos2d::CCArray *v23; // r0
cocos2d::CCMenu *m_buttonMenu; // r11
cocos2d::CCMenu *v25; // r11
GJDifficultySprite *v26; // r0
GJDifficultySprite_vtbl *v27; // r3
GJDifficultySprite *m_difficultySprite; // r0
CCMenuItemSpriteExtra *v29; // r5
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11
const char *v31; // r1
ButtonSprite *v32; // r0
CCMenuItemSpriteExtra *v33; // r5
const char *v34; // r1
ButtonSprite *v35; // r0
CCMenuItemSpriteExtra *v36; // r0
cocos2d::CCMenu *v37; // r8
float v39; // r2
float v40; // r3
bool v41; // [sp+0h] [bp-6Ch]
bool v42; // [sp+0h] [bp-6Ch]
int v43; // [sp+Ch] [bp-60h]
cocos2d::CCLabelBMFont *v44; // [sp+18h] [bp-54h] BYREF
cocos2d::CCSize v45; // [sp+1Ch] [bp-50h] BYREF
cocos2d::CCPoint v46; // [sp+24h] [bp-48h] BYREF
cocos2d::CCPoint v47; // [sp+2Ch] [bp-40h] BYREF
cocos2d::CCPoint v48; // [sp+34h] [bp-38h] BYREF
void (*v49)(RateStarsLayer *, cocos2d::CCObject *); // [sp+3Ch] [bp-30h]
int v50; // [sp+40h] [bp-2Ch]
void (*v51)(RateStarsLayer *, cocos2d::CCObject *); // [sp+44h] [bp-28h]
int v52; // [sp+48h] [bp-24h]
cocos2d::CCPoint v53; // [sp+4Ch] [bp-20h] BYREF
cocos2d::CCRect v54; // [sp+54h] [bp-18h] BYREF
cocos2d::CCSize v55; // 0:^0.8
cocos2d::CCRect v56; // 0:kr00_16.16
v7 = a3;
v43 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)75);
if ( v43 )
{
a1->m_moderator = a4;
a1->m_levelID = a2;
a1->m_starsRate = -1;
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v45, v8);
cocos2d::CCRect::CCRect(&v54, 0.0, 0.0, 80.0, 80.0);
v56.origin.x = v39;
v56.origin.y = v40;
v56.size = v55;
v9 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v54,
v56);
setContentSize = v9->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v54, 380.0, 180.0);
setContentSize(v9, (const cocos2d::CCSize *)&v54);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v9, -1);
setPosition = v9->setPosition;
cocos2d::CCPoint::CCPoint(&v54.origin, v45.width * 0.5, v45.height * 0.5);
setPosition(v9, &v54.origin);
sub_776584((int)&v44, "Rate ");
if ( a1->m_moderator )
sub_7753D4((int)&v44, "Mod: Suggest ");
if ( v7 )
v12 = "Moons";
else
v12 = "Stars";
sub_774544((int)&v44, v12);
v13 = cocos2d::CCLabelBMFont::create();
v14 = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v54.origin, v45.width * 0.5, (float)((float)(v45.height * 0.5) + 90.0) - 20.0);
v14(v13, &v54.origin);
v15 = (cocos2d::CCArray *)((int (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(
a1->m_mainLayer,
v13);
v16 = (cocos2d::CCArray *)cocos2d::CCArray::create(v15);
a1->m_buttons = v16;
cocos2d::CCObject::retain(v16);
v18 = (cocos2d::CCArray *)cocos2d::CCArray::create(v17);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
v20 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v20;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v20, 10);
for ( i = 1; i != 11; ++i )
{
v49 = RateStarsLayer::selectRating;
v50 = 0;
StarsButton = RateStarsLayer::getStarsButton(
a1,
i,
(cocos2d::SEL_MenuHandler)(unsigned int)RateStarsLayer::selectRating,
a1->m_buttonMenu,
1.0);
cocos2d::CCArray::addObject(a1->m_buttons, StarsButton);
StarsButton->setTag(StarsButton, i);
if ( i > 5 )
v23 = v19;
else
v23 = v18;
cocos2d::CCArray::addObject(v23, StarsButton);
}
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v53, (float)(v45.width * 0.5) - 30.0, (float)((float)(v45.height * 0.5) + 23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(&v54.origin, m_buttonMenu, &v53);
GameToolbox::alignItemsHorisontally(v18, 18.0, (cocos2d::CCPoint)(unsigned int)&v54, v41);
v25 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v53, (float)(v45.width * 0.5) - 30.0, (float)((float)(v45.height * 0.5) - 23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(&v54.origin, v25, &v53);
GameToolbox::alignItemsHorisontally(v19, 18.0, (cocos2d::CCPoint)(unsigned int)&v54, v42);
cocos2d::CCPoint::CCPoint(&v53, (float)(v45.width * 0.5) - 30.0, v45.height * 0.5);
cocos2d::CCPoint::CCPoint(&v54.origin, 172.0, 2.0);
cocos2d::CCPoint::operator+(&v46, &v53, &v54);
v26 = GJDifficultySprite::create(0, Long);
v27 = v26->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_difficultySprite = v26;
((void (__fastcall *)(GJDifficultySprite *, int))v27->setScale)(v26, 1067030938);
if ( a1->m_moderator )
{
m_difficultySprite = a1->m_difficultySprite;
v52 = 0;
v51 = RateStarsLayer::onFeature;
v29 = CCMenuItemSpriteExtra::create(
m_difficultySprite,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RateStarsLayer::onFeature, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29);
v30 = v29->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v54.origin, a1->m_buttonMenu, &v46);
v30(v29, &v54.origin);
}
else
{
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_difficultySprite, 11);
a1->m_difficultySprite->setPosition(a1->m_difficultySprite, &v46);
}
cocos2d::CCArray::removeAllObjects(v18);
v32 = ButtonSprite::create((ButtonSprite *)"Cancel", v31);
v53.y = 0.0;
LODWORD(v53.x) = RateStarsLayer::onClose;
v33 = CCMenuItemSpriteExtra::create(
v32,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RateStarsLayer::onClose, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33);
cocos2d::CCArray::addObject(v18, v33);
v35 = ButtonSprite::create((ButtonSprite *)"Submit", v34);
v54.origin.y = 0.0;
LODWORD(v54.origin.x) = RateStarsLayer::onRate;
v36 = CCMenuItemSpriteExtra::create(
v35,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(RateStarsLayer::onRate, (unsigned int)a1));
a1->m_submitButton = v36;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v36);
cocos2d::CCArray::addObject(v18, a1->m_submitButton);
v37 = a1->m_buttonMenu;
cocos2d::CCPoint::CCPoint(&v47, v45.width * 0.5, (float)((float)(v45.height * 0.5) - 90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(&v48, v37, &v47);
GameToolbox::alignItemsHorisontally(v18, 15.0, (cocos2d::CCPoint)(unsigned int)&v48, 0);
RateStarsLayer::selectRating(a1, nullptr);
sub_774008(&v44);
}
return v43;
}