//
// RateStarsModLayer::init from 0x14055f4b0 to 0x14055ff91 (2785 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onRateStarsMod @ 0x140423d88
// > ??> @ 0x14092c330
//
// 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=6
bool __fastcall RateStarsModLayer::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
int *v15; // rdx
const char *p_Src; // rcx
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rcx
cocos2d::CCObject *v21; // rax
__int64 v22; // rcx
cocos2d::CCObject *v23; // rax
__int64 v24; // rcx
cocos2d::CCArray *v25; // r15
__int64 v26; // rcx
__int64 v27; // r13
__int64 v28; // rcx
__int64 v29; // rax
struct cocos2d::CCSprite *v30; // rax
cocos2d::CCObject *v31; // rsi
__int64 v32; // rdi
__int64 v33; // rbx
__int64 v34; // rax
__int64 v35; // rax
unsigned int i; // edi
__int64 v37; // rsi
cocos2d::CCString *v38; // rax
const char *CString; // r12
cocos2d::CCObject *v40; // rbx
struct cocos2d::CCObject *v41; // rbx
cocos2d::CCArray *v42; // rcx
__int64 v43; // rbx
__int64 v44; // rax
__int64 v45; // rax
__int64 v46; // rbx
__int64 v47; // rax
__int64 v48; // rax
cocos2d::CCSprite *v49; // rax
__int64 *v50; // rbx
__int64 *v51; // rdi
__int64 v52; // rbx
__int64 v53; // rax
__int64 v54; // rax
__int64 v55; // rdi
__int64 v56; // rbx
__int64 v57; // rax
__int64 v58; // rbx
__int64 v59; // rax
__int64 v60; // rdx
__int64 j; // rdi
cocos2d::CCString *v62; // rax
const char *v63; // rax
__int64 *v64; // rsi
__int64 *v65; // rax
cocos2d::CCObject *v66; // rbx
__int64 v67; // rbx
__int64 v68; // rax
__int64 v69; // rax
__int64 *v70; // rdi
cocos2d::CCObject *v71; // rbx
__int64 *v72; // rdi
cocos2d::CCObject *v73; // rbx
__int64 v74; // rbx
__int64 v75; // rax
__int64 v76; // rax
float v77; // [rsp+58h] [rbp-B0h] BYREF
float v78; // [rsp+5Ch] [rbp-ACh]
__int64 v79[2]; // [rsp+60h] [rbp-A8h] BYREF
_BYTE v80[16]; // [rsp+70h] [rbp-98h] BYREF
_BYTE v81[8]; // [rsp+80h] [rbp-88h] BYREF
_OWORD v82[2]; // [rsp+88h] [rbp-80h]
int v83; // [rsp+A8h] [rbp-60h]
int v84; // [rsp+ACh] [rbp-5Ch]
__int128 Src; // [rsp+B0h] [rbp-58h] BYREF
__int64 v86; // [rsp+C0h] [rbp-48h]
unsigned __int64 v87; // [rsp+C8h] [rbp-40h]
result = FLAlertLayer::init_1(a1, 75);
if ( !result )
return result;
*(_DWORD *)(a1 + 712) = a2;
*(_DWORD *)(a1 + 716) = -1;
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, &v77);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v79, 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 *)v80, 380.0, 250.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 *)v80, v77 * 0.5, v78 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v13 + 184))(v10, v14);
Src = 0;
v86 = 0;
v87 = 0;
*(_QWORD *)&Src = sub_14003D460(0x20u);
v86 = 17;
v87 = 31;
strcpy((char *)Src, "Advisor: Suggest ");
v15 = (int *)"Moons";
if ( !a3 )
v15 = &dword_1407850A8;
sub_140044D80(&Src, v15, 5u);
p_Src = (const char *)&Src;
if ( v87 > 0xF )
p_Src = (const char *)Src;
v17 = cocos2d::CCLabelBMFont::create(p_Src, (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 160LL))(v17);
v18 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v80, v77 * 0.5, (float)((float)(v78 * 0.5) + 125.0) - 22.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v18 + 184))(v17, v19);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v17);
v21 = (cocos2d::CCObject *)cocos2d::CCArray::create(v20);
*(_QWORD *)(a1 + 696) = v21;
cocos2d::CCObject::retain(v21);
v23 = (cocos2d::CCObject *)cocos2d::CCArray::create(v22);
*(_QWORD *)(a1 + 704) = v23;
cocos2d::CCObject::retain(v23);
v25 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
v27 = cocos2d::CCArray::create(v26);
v29 = cocos2d::CCMenu::create(v28);
*(_QWORD *)(a1 + 552) = v29;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v29, 10);
v30 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon2_001.png");
*(_QWORD *)(a1 + 728) = v30;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v30 + 160LL))(v30);
v31 = CCMenuItemSpriteExtra::create(*(_QWORD *)(a1 + 728), 0, a1, (__int64)RateStarsModLayer::onToggleCoins);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v31);
v32 = *(_QWORD *)v31;
v33 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v80,
(float)((float)(v77 * 0.5) - 190.0) + 23.0,
(float)((float)(v78 * 0.5) + 125.0) - 23.0);
cocos2d::CCNode::convertToNodeSpace(v33, v79, v34);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v32 + 184))(v31, v35);
*(_BYTE *)(a1 + 720) = 1;
(**(void (__fastcall ***)(__int64, __int16 *))(*(_QWORD *)(a1 + 728) + 320LL))(
*(_QWORD *)(a1 + 728) + 320LL,
&word_140704614);
for ( i = 1; (int)i <= 10; ++i )
{
v37 = *(_QWORD *)(a1 + 552);
v38 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, i);
CString = cocos2d::CCString::getCString(v38);
v79[0] = (__int64)operator new(0x2C8u);
v40 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite(v79[0]);
if ( v40 )
{
if ( ButtonSprite::init_1(
(__int64)v40,
(__int64)CString,
20,
0,
1056964608,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v40);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v40 + 8LL))(v40, 1);
LODWORD(v40) = 0;
}
}
v41 = CCMenuItemSpriteExtra::create((int)v40, 0, a1, (__int64)GJRateLevelLayer::selectRating);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v41 + 160LL))(v41);
*((_DWORD *)v41 + 101) = 1065353216;
if ( v37 )
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)v37 + 464LL))(v37, v41);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 696), v41);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v41 + 64LL))(v41, i);
v42 = v25;
if ( i > 5 )
v42 = (cocos2d::CCArray *)v27;
cocos2d::CCArray::addObject(v42, v41);
}
v43 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v79,
(float)(v77 * 0.5) - 30.0,
(float)((float)(v78 * 0.5) + 23.0) + 34.0);
cocos2d::CCNode::convertToNodeSpace(v43, v80, v44);
GameToolbox::alignItemsHorisontally((__int64)v25, 18.0, v45, 0);
v46 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v79,
(float)(v77 * 0.5) - 30.0,
(float)((float)(v78 * 0.5) - 23.0) + 34.0);
cocos2d::CCNode::convertToNodeSpace(v46, v80, v47);
GameToolbox::alignItemsHorisontally(v27, 18.0, v48, 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v81,
(float)((float)(v77 * 0.5) - 30.0) + 172.0,
(float)((float)(v78 * 0.5) + 34.0) + 2.0);
v49 = GJDifficultySprite::create();
*(_QWORD *)(a1 + 744) = v49;
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v49 + 160LL))(v49);
v50 = *(__int64 **)(a1 + 744);
v79[0] = (__int64)operator new(0x208u);
v51 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v79[0]);
if ( !v51 )
goto LABEL_20;
if ( !CCMenuItemSpriteExtra::init(v51, v50, 0, a1, (__int64)RateStarsModLayer::onFeature) )
{
(*(void (__fastcall **)(__int64 *, __int64))(*v51 + 8))(v51, 1);
LABEL_20:
v51 = nullptr;
goto LABEL_21;
}
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v51);
LABEL_21:
(*(void (__fastcall **)(_QWORD, __int64 *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v51);
v52 = *v51;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), v79, v81);
(*(void (__fastcall **)(__int64 *, __int64))(v52 + 184))(v51, v53);
cocos2d::CCArray::removeAllObjects(v25);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v80, 0.0, 0.0, 40.0, 40.0);
v55 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v54);
v56 = *(_QWORD *)v55;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v79, 280.0, 56.0);
(*(void (__fastcall **)(__int64, __int64))(v56 + 312))(v55, v57);
v58 = *(_QWORD *)v55;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v79, v77 * 0.5, (float)(v78 * 0.5) - 45.0);
(*(void (__fastcall **)(__int64, __int64))(v58 + 184))(v55, v59);
(**(void (__fastcall ***)(__int64, void *))(v55 + 320))(v55 + 320, &unk_14070460C);
LOBYTE(v60) = 35;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)(v55 + 320) + 40LL))(v55 + 320, v60);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v55, 0);
v82[0] = _mm_load_si128((const __m128i *)&xmmword_1408367E0);
v82[1] = _mm_load_si128((const __m128i *)&xmmword_140836800);
v83 = 5;
v84 = 10;
for ( j = 0; j < 5; ++j )
{
v62 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn2_001.png", *((_DWORD *)v82 + 2 * j + 1));
v63 = cocos2d::CCString::getCString(v62);
v64 = (__int64 *)cocos2d::CCSprite::createWithSpriteFrameName(v63);
(*(void (__fastcall **)(__int64 *))(*v64 + 160))(v64);
v79[0] = (__int64)operator new(0x208u);
v65 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v79[0]);
v66 = (cocos2d::CCObject *)v65;
if ( v65 )
{
if ( CCMenuItemSpriteExtra::init(v65, v64, 0, a1, (__int64)RateStarsModLayer::selectDemon) )
{
cocos2d::CCObject::autorelease(v66);
goto LABEL_27;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v66 + 8LL))(v66, 1);
}
v66 = nullptr;
LABEL_27:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v66);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 704), v66);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v66 + 64LL))(v66, *((unsigned int *)v82 + 2 * j));
cocos2d::CCArray::addObject(v25, v66);
}
v67 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v79, v77 * 0.5, (float)(v78 * 0.5) - 42.0);
cocos2d::CCNode::convertToNodeSpace(v67, v80, v68);
GameToolbox::alignItemsHorisontally((__int64)v25, 18.0, v69, 0);
cocos2d::CCArray::removeAllObjects(v25);
v70 = (__int64 *)ButtonSprite::create_1(
(int)"Cancel",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v79[0] = (__int64)operator new(0x208u);
v71 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v79[0]);
if ( v71 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v71, v70, 0, a1, (__int64)RateStarsModLayer::onClose) )
{
cocos2d::CCObject::autorelease(v71);
goto LABEL_33;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v71 + 8LL))(v71, 1);
}
v71 = nullptr;
LABEL_33:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v71);
cocos2d::CCArray::addObject(v25, v71);
v72 = (__int64 *)ButtonSprite::create_1(
(int)"Submit",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v79[0] = (__int64)operator new(0x208u);
v73 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v79[0]);
if ( v73 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v73, v72, 0, a1, (__int64)GJRateLevelLayer::onRate) )
{
cocos2d::CCObject::autorelease(v73);
goto LABEL_38;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v73 + 8LL))(v73, 1);
}
v73 = nullptr;
LABEL_38:
*(_QWORD *)(a1 + 688) = v73;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v73);
cocos2d::CCArray::addObject(v25, *(struct cocos2d::CCObject **)(a1 + 688));
v74 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v79, v77 * 0.5, (float)((float)(v78 * 0.5) - 125.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v74, v80, v75);
GameToolbox::alignItemsHorisontally((__int64)v25, 15.0, v76, 0);
GJRateLevelLayer::selectRating(a1, 0);
sub_14003D310((__int64)&Src);
return 1;
}