//
// RateStarsLayer::init from 0x14055e4e0 to 0x14055ecbc (2012 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onRateStars @ 0x140423a00
// > ??> @ 0x14092c270
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:34:14 +0000
//
// Hidden C++ exception states: #wind=4
bool __fastcall RateStarsLayer::init(__int64 a1, int a2, char a3)
{
bool result; // al
__int64 v7; // rcx
__int64 v8; // rax
__int64 v9; // rax
__int64 *v10; // rdi
__int64 v11; // rbx
__int64 v12; // rax
__int64 v13; // rbx
__int64 v14; // rax
char *v15; // rax
int *v16; // rdx
const char *p_Src; // rcx
struct cocos2d::CCLabelBMFont *v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rcx
cocos2d::CCObject *v22; // rax
__int64 v23; // rcx
cocos2d::CCArray *v24; // r12
__int64 v25; // rcx
__int64 v26; // r13
__int64 v27; // rcx
__int64 v28; // rax
unsigned int i; // edi
__int64 v30; // r14
cocos2d::CCString *v31; // rax
const char *CString; // r15
cocos2d::CCObject *v33; // rbx
struct cocos2d::CCObject *v34; // rbx
cocos2d::CCArray *v35; // rcx
__int64 v36; // rbx
__int64 v37; // rax
__int64 v38; // rax
__int64 v39; // rbx
__int64 v40; // rax
__int64 v41; // rax
__int64 v42; // rax
__int64 v43; // rbx
__int64 v44; // rax
cocos2d::CCSprite *v45; // rax
cocos2d::CCObject *v46; // rdi
__int64 v47; // rbx
__int64 v48; // rax
__int64 *v49; // rdi
cocos2d::CCObject *v50; // rbx
__int64 *v51; // rdi
cocos2d::CCObject *v52; // rbx
__int64 v53; // rbx
__int64 v54; // rax
__int64 v55; // rax
float v56; // [rsp+58h] [rbp-59h] BYREF
float v57; // [rsp+5Ch] [rbp-55h]
void *v58; // [rsp+60h] [rbp-51h] BYREF
__int64 v59[2]; // [rsp+68h] [rbp-49h] BYREF
_BYTE v60[8]; // [rsp+78h] [rbp-39h] BYREF
__int128 Src; // [rsp+80h] [rbp-31h] BYREF
__int64 v62; // [rsp+90h] [rbp-21h]
unsigned __int64 v63; // [rsp+98h] [rbp-19h]
result = FLAlertLayer::init_1(a1, 75);
if ( result )
{
*(_BYTE *)(a1 + 681) = 0;
*(_DWORD *)(a1 + 704) = a2;
*(_DWORD *)(a1 + 708) = -1;
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v56);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v59, 0.0, 0.0, 80.0, 80.0);
v10 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v9);
v11 = *v10;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v58, 380.0, 180.0);
(*(void (__fastcall **)(__int64 *, __int64))(v11 + 312))(v10, v12);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v10,
0xFFFFFFFFLL);
v13 = *v10;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, v56 * 0.5, v57 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v13 + 184))(v10, v14);
Src = 0;
v62 = 5;
v63 = 15;
strcpy((char *)&Src, "Rate ");
if ( *(_BYTE *)(a1 + 681) )
{
v15 = (char *)sub_14003D460(0x20u);
v62 = 17;
v63 = 31;
strcpy(v15, "Advisor: Suggest ");
*(_QWORD *)&Src = v15;
}
v16 = (int *)"Moons";
if ( !a3 )
v16 = &dword_1407850A8;
sub_140044D80(&Src, v16, 5u);
p_Src = (const char *)&Src;
if ( v63 > 0xF )
p_Src = (const char *)Src;
v18 = cocos2d::CCLabelBMFont::create(p_Src, (const char *)&qword_140704F78);
v19 = *(_QWORD *)v18;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, v56 * 0.5, (float)((float)(v57 * 0.5) + 90.0) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v19 + 184))(v18, v20);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v18);
v22 = (cocos2d::CCObject *)cocos2d::CCArray::create(v21);
*(_QWORD *)(a1 + 696) = v22;
cocos2d::CCObject::retain(v22);
v24 = (cocos2d::CCArray *)cocos2d::CCArray::create(v23);
v26 = cocos2d::CCArray::create(v25);
v28 = cocos2d::CCMenu::create(v27);
*(_QWORD *)(a1 + 552) = v28;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v28, 10);
for ( i = 1; (int)i <= 10; ++i )
{
v30 = *(_QWORD *)(a1 + 552);
v31 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, i);
CString = cocos2d::CCString::getCString(v31);
v58 = operator new(0x2C8u);
v33 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v58);
if ( v33 )
{
if ( ButtonSprite::init_1(
(__int64)v33,
(__int64)CString,
20,
0,
1056964608,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v33);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v33 + 8LL))(v33, 1);
LODWORD(v33) = 0;
}
}
v34 = CCMenuItemSpriteExtra::create((int)v33, 0, a1, (__int64)RateStarsLayer::selectRating);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v34 + 160LL))(v34);
*((_DWORD *)v34 + 101) = 1065353216;
if ( v30 )
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)v30 + 464LL))(v30, v34);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 696), v34);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v34 + 64LL))(v34, i);
v35 = v24;
if ( i > 5 )
v35 = (cocos2d::CCArray *)v26;
cocos2d::CCArray::addObject(v35, v34);
}
v36 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v58,
(float)(v56 * 0.5) - 30.0,
(float)((float)(v57 * 0.5) + 23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v36, v59, v37);
GameToolbox::alignItemsHorisontally((__int64)v24, 18.0, v38, 0);
v39 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v59,
(float)(v56 * 0.5) - 30.0,
(float)((float)(v57 * 0.5) - 23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v39, &v58, v40);
GameToolbox::alignItemsHorisontally(v26, 18.0, v41, 0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, 172.0, 2.0);
v43 = v42;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v58, (float)(v56 * 0.5) - 30.0, v57 * 0.5);
cocos2d::CCPoint::operator+(v44, v60, v43);
v45 = GJDifficultySprite::create();
*(_QWORD *)(a1 + 736) = v45;
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v45 + 160LL))(v45);
if ( *(_BYTE *)(a1 + 681) )
{
v46 = CCMenuItemSpriteExtra::create(*(_QWORD *)(a1 + 736), 0, a1, (__int64)RateStarsLayer::onFeature);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v46);
v47 = *(_QWORD *)v46;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v59, v60);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v47 + 184))(v46, v48);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 736),
11);
(*(void (__fastcall **)(_QWORD, _BYTE *))(**(_QWORD **)(a1 + 736) + 184LL))(*(_QWORD *)(a1 + 736), v60);
}
cocos2d::CCArray::removeAllObjects(v24);
v49 = (__int64 *)ButtonSprite::create_1(
(int)"Cancel",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v59[0] = (__int64)operator new(0x208u);
v50 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v59[0]);
if ( v50 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v50, v49, 0, a1, (__int64)RateStarsLayer::onClose) )
{
cocos2d::CCObject::autorelease(v50);
goto LABEL_26;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v50 + 8LL))(v50, 1);
}
v50 = nullptr;
LABEL_26:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v50);
cocos2d::CCArray::addObject(v24, v50);
v51 = (__int64 *)ButtonSprite::create_1(
(int)"Submit",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v59[0] = (__int64)operator new(0x208u);
v52 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v59[0]);
if ( v52 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v52, v51, 0, a1, (__int64)RateStarsLayer::onRate) )
{
cocos2d::CCObject::autorelease(v52);
LABEL_31:
*(_QWORD *)(a1 + 688) = v52;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v52);
cocos2d::CCArray::addObject(v24, *(struct cocos2d::CCObject **)(a1 + 688));
v53 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v56 * 0.5, (float)((float)(v57 * 0.5) - 90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v53, &v58, v54);
GameToolbox::alignItemsHorisontally((__int64)v24, 15.0, v55, 0);
RateStarsLayer::selectRating(a1, 0);
sub_14003D310((__int64)&Src);
return 1;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v52 + 8LL))(v52, 1);
}
v52 = nullptr;
goto LABEL_31;
}
return result;
}