//
// RateStarsModLayer::init from 0xcfd014 to 0xcfd88c (2168 bytes)
//
// 2 xrefs:
// > RateStarsModLayer::create @ 0xcfda48
// > ??> @ 0x42bf8
//
// This function is hookable on this platform (idp: arm, 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 13:06:52 +0000
//
__int64 __fastcall RateStarsModLayer::init(RateStarsModLayer *this, int a2, unsigned __int8 a3)
{
int v3; // w23
cocos2d::CCDirector *v6; // x0
unsigned int v7; // w28
cocos2d::CCDirector *v9; // x0
__int64 v10; // x20
void (__fastcall *v11)(__int64, __int64 *); // x25
void (__fastcall *v12)(__int64, __int64 *); // x25
const char *v13; // x2
cocos2d::CCLabelBMFont *v14; // x0
__int64 v15; // x20
void (__fastcall *v16)(__int64, __int64 *); // x22
cocos2d::CCArray *v17; // x0
cocos2d::CCObject *v18; // x0
cocos2d::CCArray *v19; // x0
cocos2d::CCObject *v20; // x0
cocos2d::CCArray *v21; // x0
cocos2d::CCArray *v22; // x23
cocos2d::CCMenu *v23; // x27
__int64 v24; // x0
__int64 v25; // x3
const char *v26; // x1
__int64 v27; // x0
__int64 v28; // x20
void (__fastcall *v29)(__int64, __int64 *); // x22
cocos2d::CCNode *v30; // x25
__int64 v31; // x2
int i; // w20
float *StarsButton; // x22
cocos2d::CCNode *v34; // x20
cocos2d::CCNode *v35; // x20
__int64 v36; // x0
__int64 v37; // x20
void (__fastcall *v38)(__int64, __int64 *); // x22
__int64 v39; // x20
void (__fastcall *v40)(__int64, __int64 *); // x22
void (__fastcall *v41)(__int64, __int64 *); // x22
__int64 v42; // x22
unsigned int v43; // w27
cocos2d::CCString *v44; // x0
cocos2d::CCSprite *CString; // x0
const char *v46; // x1
__int64 v47; // x20
cocos2d::CCObject *v48; // x20
cocos2d::CCNode *v49; // x20
const char *v50; // x1
__int64 v51; // x2
__int64 v52; // x3
bool v53; // w4
__int64 v54; // x5
const char *v55; // x6
__int64 v56; // x0
cocos2d::CCObject *v57; // x20
const char *v58; // x1
__int64 v59; // x2
__int64 v60; // x3
bool v61; // w4
__int64 v62; // x5
const char *v63; // x6
__int64 v64; // x0
__int64 v65; // x0
__int64 v66; // x2
cocos2d::CCNode *v67; // x20
__int64 v68; // [xsp+80h] [xbp+80h] BYREF
_BYTE v69[8]; // [xsp+88h] [xbp+88h] BYREF
_BYTE v70[8]; // [xsp+90h] [xbp+90h] BYREF
__int64 v71[2]; // [xsp+98h] [xbp+98h] BYREF
__int64 v72[2]; // [xsp+A8h] [xbp+A8h] BYREF
void *v73; // [xsp+B8h] [xbp+B8h]
_DWORD v74[10]; // [xsp+C0h] [xbp+C0h] BYREF
v3 = a3;
v6 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init(this, 75);
v7 = (unsigned __int8)v6;
if ( !(_BYTE)v6 )
return v7;
*((_DWORD *)this + 178) = a2;
*((_DWORD *)this + 179) = -1;
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(&v68, v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v71, 0.0, 0.0, 80.0, 80.0);
v10 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v71);
v11 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v71, 380.0, 250.0);
v11(v10, v71);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v10,
0xFFFFFFFFLL);
v12 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, *(float *)&v68 * 0.5, *((float *)&v68 + 1) * 0.5);
v12(v10, v71);
v72[0] = 0;
v72[1] = 0;
v73 = nullptr;
std::string::__init(v72, "Advisor: Suggest ", 0x11u);
if ( v3 )
{
std::string::append((__int64)v72, "Moons", 5u);
if ( (v72[0] & 1) == 0 )
goto LABEL_5;
}
else
{
std::string::append((__int64)v72, "Stars", 5u);
if ( (v72[0] & 1) == 0 )
{
LABEL_5:
v14 = (cocos2d::CCLabelBMFont *)((char *)v72 + 1);
goto LABEL_6;
}
}
v14 = (cocos2d::CCLabelBMFont *)v73;
LABEL_6:
v15 = cocos2d::CCLabelBMFont::create(v14, "bigFont.fnt", v13);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v15 + 160LL))(v15, 0.65);
v16 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v15 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v71,
*(float *)&v68 * 0.5,
(float)((float)(*((float *)&v68 + 1) * 0.5) + 125.0) - 22.0);
v16(v15, v71);
v17 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v15);
v18 = (cocos2d::CCObject *)cocos2d::CCArray::create(v17);
*((_QWORD *)this + 87) = v18;
v19 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v18);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*((_QWORD *)this + 88) = v20;
v21 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v20);
v22 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
v23 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v22);
v24 = cocos2d::CCMenu::create(v23);
v25 = *((_QWORD *)this + 73);
*((_QWORD *)this + 69) = v24;
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)v25 + 464LL))(v25, v24, 10);
v27 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_coinsIcon2_001.png", v26);
*((_QWORD *)this + 91) = v27;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 1.2);
v28 = CCMenuItemSpriteExtra::create(
*((_QWORD *)this + 91),
0,
(__int64)this,
(__int64)RateStarsModLayer::onToggleCoins,
0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v28);
v29 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v28 + 184LL);
v30 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
(float)((float)(*(float *)&v68 * 0.5) + -190.0) + 23.0,
(float)((float)(*((float *)&v68 + 1) * 0.5) + 125.0) - 23.0);
cocos2d::CCNode::convertToNodeSpace(v71, v30, (const cocos2d::CCPoint *)v70);
v29(v28, v71);
v31 = *((_QWORD *)this + 91);
*((_BYTE *)this + 720) = 1;
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v31 + 960LL))(v31, &qword_11A5870);
for ( i = 1; i != 11; ++i )
{
while ( 1 )
{
StarsButton = RateStarsModLayer::getStarsButton(
(__int64)this,
(const char *)(unsigned int)i,
(__int64)RateStarsModLayer::selectRating,
0,
*((_QWORD *)this + 69),
1.0);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 87), (cocos2d::CCObject *)StarsButton);
(*(void (__fastcall **)(float *, _QWORD))(*(_QWORD *)StarsButton + 72LL))(StarsButton, (unsigned int)i);
if ( i > 5 )
break;
cocos2d::CCArray::addObject(v22, (cocos2d::CCObject *)StarsButton);
if ( ++i == 11 )
goto LABEL_10;
}
cocos2d::CCArray::addObject(v23, (cocos2d::CCObject *)StarsButton);
}
LABEL_10:
v34 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
(float)(*(float *)&v68 * 0.5) + -30.0,
(float)((float)(*((float *)&v68 + 1) * 0.5) + 23.0) + 34.0);
cocos2d::CCNode::convertToNodeSpace(v71, v34, (const cocos2d::CCPoint *)v70);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)v71, 0, 18.0);
v35 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
(float)(*(float *)&v68 * 0.5) + -30.0,
(float)((float)(*((float *)&v68 + 1) * 0.5) + -23.0) + 34.0);
cocos2d::CCNode::convertToNodeSpace(v71, v35, (const cocos2d::CCPoint *)v70);
GameToolbox::alignItemsHorisontally((__int64)v23, (__int64)v71, 0, 18.0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v69,
(float)((float)(*(float *)&v68 * 0.5) + -30.0) + 172.0,
(float)((float)(*((float *)&v68 + 1) * 0.5) + 34.0) + 2.0);
v36 = GJDifficultySprite::create(0, 1);
*((_QWORD *)this + 93) = v36;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v36 + 160LL))(v36, 1.2);
v37 = CCMenuItemSpriteExtra::create(
*((_QWORD *)this + 93),
0,
(__int64)this,
(__int64)RateStarsModLayer::onFeature,
0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v37);
v38 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCNode::convertToNodeSpace(v71, *((cocos2d::CCNode **)this + 69), (const cocos2d::CCPoint *)v69);
v38(v37, v71);
cocos2d::CCArray::removeAllObjects(v22);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v71, 0.0, 0.0, 40.0, 40.0);
v39 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v71);
v40 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v39 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v71, 280.0, 56.0);
v40(v39, v71);
v41 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v71, *(float *)&v68 * 0.5, (float)(*((float *)&v68 + 1) * 0.5) + -45.0);
v41(v39, v71);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v39 + 960LL))(v39, algn_11A5878);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v39 + 912LL))(v39, 35);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**((_QWORD **)this + 73) + 464LL))(*((_QWORD *)this + 73), v39, 0);
v74[0] = 1;
v74[1] = 7;
v74[2] = 2;
v42 = 0;
v74[3] = 8;
v74[4] = 3;
v74[5] = 6;
v74[6] = 4;
v74[7] = 9;
v74[8] = 5;
v74[9] = 10;
do
{
v43 = v74[v42];
v44 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn2_001.png",
(const char *)(unsigned int)v74[v42 + 1]);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v44);
v47 = cocos2d::CCSprite::createWithSpriteFrameName(CString, v46);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v47 + 160LL))(v47, 0.85);
v48 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v47,
0,
(__int64)this,
(__int64)RateStarsModLayer::selectDemon,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(
*((_QWORD *)this + 69),
v48);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 88), v48);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v48 + 72LL))(v48, v43);
cocos2d::CCArray::addObject(v22, v48);
v42 += 2;
}
while ( v42 != 10 );
v49 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, *(float *)&v68 * 0.5, (float)(*((float *)&v68 + 1) * 0.5) + -42.0);
cocos2d::CCNode::convertToNodeSpace(v71, v49, (const cocos2d::CCPoint *)v70);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)v71, 0, 18.0);
cocos2d::CCArray::removeAllObjects(v22);
v56 = ButtonSprite::create((ButtonSprite *)"Cancel", v50, v51, v52, v53, v54, v55);
v57 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v56,
0,
(__int64)this,
(__int64)RateStarsModLayer::onClose,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v57);
cocos2d::CCArray::addObject(v22, v57);
v64 = ButtonSprite::create((ButtonSprite *)"Submit", v58, v59, v60, v61, v62, v63);
v65 = CCMenuItemSpriteExtra::create(v64, 0, (__int64)this, (__int64)RateStarsModLayer::onRate, 0);
v66 = *((_QWORD *)this + 69);
*((_QWORD *)this + 86) = v65;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v66 + 456LL))(v66, v65);
cocos2d::CCArray::addObject(v22, *((cocos2d::CCObject **)this + 86));
v67 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v70,
*(float *)&v68 * 0.5,
(float)((float)(*((float *)&v68 + 1) * 0.5) + -125.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v71, v67, (const cocos2d::CCPoint *)v70);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)v71, 0, 15.0);
RateStarsModLayer::selectRating(this, nullptr);
if ( (v72[0] & 1) != 0 )
operator delete(v73);
return v7;
}