//
// RateStarsLayer::init from 0x1403ca150 to 0x1403ca8d2 (1922 bytes)
//
// 2 xrefs:
// > RateStarsLayer::create @ 0x1403ca115
// > ??> @ 0x1406d7a84
//
// 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
//
// Hidden C++ exception states: #wind=4
bool RateStarsLayer::init(RateStarsLayer *a1, int a2, bool a3, bool a4)
{
bool result; // al
__int64 v9; // rcx
cocos2d::CCDirector *v10; // rax
struct cocos2d::CCRect *v11; // rax
struct cocos2d::extension::CCScale9Sprite *v12; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v13; // rbx
const cocos2d::CCSize *v14; // rax
float v15; // xmm0_4
cocos2d::extension::CCScale9Sprite_vtbl *v16; // rbx
const cocos2d::CCPoint *v17; // rax
int *v18; // rdx
const char *p_Src; // rcx
struct cocos2d::CCLabelBMFont *v20; // rdi
cocos2d::CCLabelBMFont_vtbl *v21; // rbx
double v22; // xmm0_8
const cocos2d::CCPoint *v23; // rax
__int64 v24; // rcx
cocos2d::CCArray *v25; // rax
__int64 v26; // rcx
cocos2d::CCArray *v27; // r12
__int64 v28; // rcx
cocos2d::CCArray *v29; // r13
__int64 v30; // rcx
cocos2d::CCMenu *v31; // rax
int i; // edi
cocos2d::CCMenu *m_buttonMenu; // r14
cocos2d::CCString *v34; // rax
const char *CString; // r15
ButtonSprite *v36; // rbx
CCMenuItemSpriteExtra *v37; // rbx
cocos2d::CCArray *v38; // rcx
double v39; // xmm0_8
struct cocos2d::CCPoint v40; // rax
double v41; // xmm0_8
struct cocos2d::CCPoint v42; // rax
double v43; // xmm0_8
__int64 v44; // rax
double v45; // xmm0_8
GJDifficultySprite *v46; // rax
CCMenuItemSpriteExtra *v47; // rdi
CCMenuItemSpriteExtra_vtbl *v48; // rbx
struct cocos2d::CCPoint v49; // rax
ButtonSprite *v50; // rdi
CCMenuItemSpriteExtra *v51; // rbx
ButtonSprite *v52; // rdi
CCMenuItemSpriteExtra *v53; // rbx
struct cocos2d::CCPoint v54; // rax
float v55; // [rsp+58h] [rbp-59h]
ButtonSprite *v56; // [rsp+60h] [rbp-51h] BYREF
cocos2d::CCRect v57; // [rsp+68h] [rbp-49h] BYREF
char v58[8]; // [rsp+78h] [rbp-39h] BYREF
__int128 Src; // [rsp+80h] [rbp-31h] BYREF
__int64 v60; // [rsp+90h] [rbp-21h]
unsigned __int64 v61; // [rsp+98h] [rbp-19h]
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
a1->m_moderator = a4;
a1->m_levelID = a2;
a1->m_starsRate = -1;
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10);
cocos2d::CCRect::CCRect(&v57, 0.0, 0.0, 80.0, 80.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v11);
v13 = v12->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v56, 380.0, 180.0);
v13->setContentSize(v12, v14);
v15 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v12,
0xFFFFFFFFLL);
v16 = v12->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v15, v55 * 0.5);
v16->setPosition_0(v12, v17);
Src = 0;
v60 = 5;
v61 = 15;
strcpy((char *)&Src, "Rate ");
if ( a1->m_moderator )
{
v60 = 13;
memmove(&Src, "Mod: Suggest ", 0xDu);
BYTE13(Src) = 0;
}
v18 = (int *)"Moons";
if ( !a3 )
v18 = &dword_140581248;
sub_140041270(&Src, v18, 5u);
p_Src = (const char *)&Src;
if ( v61 > 0xF )
p_Src = (const char *)Src;
v20 = cocos2d::CCLabelBMFont::create(p_Src, (const char *)&qword_14052A4D8);
v21 = v20->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v22 = cocos2d::CCPoint::CCPoint(0.0, v55 * 0.5);
v21->setPosition_0(v20, v23);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v20);
v25 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
a1->m_buttons = v25;
cocos2d::CCObject::retain(v25);
v27 = (cocos2d::CCArray *)cocos2d::CCArray::create(v26);
v29 = (cocos2d::CCArray *)cocos2d::CCArray::create(v28);
v31 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v30);
a1->m_buttonMenu = v31;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v31, 10);
for ( i = 1; i <= 10; ++i )
{
m_buttonMenu = a1->m_buttonMenu;
v34 = cocos2d::CCString::createWithFormat("%i", i);
CString = cocos2d::CCString::getCString(v34);
v56 = (ButtonSprite *)operator new(0x2C0u);
v36 = ButtonSprite::ButtonSprite(v56);
if ( v36 )
{
if ( ButtonSprite::init_1(v36, CString, 20, 0, 0.5, 1, (const char *)&qword_14052A4D8, "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v36);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v36->~ButtonSprite)(v36, 1);
v36 = nullptr;
}
}
v37 = CCMenuItemSpriteExtra::create(v36, nullptr, a1, (cocos2d::SEL_MenuHandler *)RateStarsLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *))v37->setScale_0)(v37);
HIDWORD(v37->m_pDisabledImage) = 1065353216;
if ( m_buttonMenu )
m_buttonMenu->addChild_1(m_buttonMenu, v37);
cocos2d::CCArray::addObject(a1->m_buttons, v37);
v37->setTag(v37, i);
v38 = v27;
if ( (unsigned int)i > 5 )
v38 = v29;
cocos2d::CCArray::addObject(v38, v37);
}
v39 = cocos2d::CCPoint::CCPoint(*(float *)&v22, (float)(v55 * 0.5) - 30.0);
v40 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v57.origin);
GameToolbox::alignItemsHorisontally(v27, 18.0, v40, 0);
v41 = cocos2d::CCPoint::CCPoint(*(float *)&v39, (float)(v55 * 0.5) - 30.0);
v42 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v56);
GameToolbox::alignItemsHorisontally(v29, 18.0, v42, 0);
v43 = cocos2d::CCPoint::CCPoint(*(float *)&v41, 172.0);
cocos2d::CCPoint::CCPoint(*(float *)&v43, (float)(v55 * 0.5) - 30.0);
v45 = cocos2d::CCPoint::operator+(v44, v58);
v46 = GJDifficultySprite::create(0, Long);
a1->m_difficultySprite = v46;
((void (__fastcall *)(GJDifficultySprite *))v46->setScale_0)(v46);
if ( a1->m_moderator )
{
v47 = CCMenuItemSpriteExtra::create(
a1->m_difficultySprite,
nullptr,
a1,
(cocos2d::SEL_MenuHandler *)RateStarsLayer::onFeature);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v47);
v48 = v47->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v49 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v57.origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v48->setPosition_0)(v47, v49);
}
else
{
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_difficultySprite, 11);
a1->m_difficultySprite->setPosition_0(a1->m_difficultySprite, (const cocos2d::CCPoint *)v58);
}
cocos2d::CCArray::removeAllObjects(v27);
v50 = ButtonSprite::create_1("Cancel", 0, 0, 1.0, 0, "goldFont.fnt", "GJ_button_01.png", 0.0);
v57.origin = (cocos2d::CCPoint)operator new(0x208u);
v51 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v57.origin);
if ( v51 )
{
if ( CCMenuItemSpriteExtra::init(v51, v50, nullptr, a1, (cocos2d::SEL_MenuHandler *)RateStarsLayer::onClose) )
{
cocos2d::CCObject::autorelease(v51);
goto LABEL_26;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v51->~CCMenuItemSpriteExtra)(v51, 1);
}
v51 = nullptr;
LABEL_26:
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v51);
cocos2d::CCArray::addObject(v27, v51);
v52 = ButtonSprite::create_1("Submit", 0, 0, 1.0, 0, "goldFont.fnt", "GJ_button_01.png", 0.0);
v57.origin = (cocos2d::CCPoint)operator new(0x208u);
v53 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(*(CCMenuItemSpriteExtra **)&v57.origin);
if ( v53 )
{
if ( CCMenuItemSpriteExtra::init(v53, v52, nullptr, a1, (cocos2d::SEL_MenuHandler *)RateStarsLayer::onRate) )
{
cocos2d::CCObject::autorelease(v53);
LABEL_31:
a1->m_submitButton = v53;
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v53);
cocos2d::CCArray::addObject(v27, a1->m_submitButton);
cocos2d::CCPoint::CCPoint(*(float *)&v45, v55 * 0.5);
v54 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v56);
GameToolbox::alignItemsHorisontally(v27, 15.0, v54, 0);
RateStarsLayer::selectRating(a1, nullptr);
sub_14003A830((__int64)&Src);
return 1;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))v53->~CCMenuItemSpriteExtra)(v53, 1);
}
v53 = nullptr;
goto LABEL_31;
}
return result;
}