//
// RateStarsLayer::init from 0x9579ac to 0x957ff4 (1608 bytes)
//
// 2 xrefs:
// > RateStarsLayer::create @ 0x958190
// > ??> @ 0xec338
//
// 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 12:57:26 +0000
//
__int64 __fastcall RateStarsLayer::init(RateStarsLayer *this, int a2, unsigned __int8 a3, char a4)
{
int v4; // w24
cocos2d::CCDirector *v8; // x0
unsigned int v9; // w26
cocos2d::CCDirector *v11; // x0
__int64 v12; // x21
void (__fastcall *v13)(__int64, __int64 *); // x25
void (__fastcall *v14)(__int64, __int64 *); // x25
const char *v15; // x2
cocos2d::CCLabelBMFont *v16; // x0
__int64 v17; // x19
void (__fastcall *v18)(__int64, __int64 *); // x21
cocos2d::CCArray *v19; // x0
cocos2d::CCObject *v20; // x0
cocos2d::CCArray *v21; // x0
cocos2d::CCArray *v22; // x25
cocos2d::CCMenu *v23; // x27
__int64 v24; // x0
__int64 v25; // x3
int i; // w19
float *StarsButton; // x21
cocos2d::CCNode *v28; // x21
cocos2d::CCNode *v29; // x21
__int64 v30; // x0
__int64 v31; // x24
void (__fastcall *v32)(__int64, __int64 *); // x21
const char *v33; // x1
__int64 v34; // x2
__int64 v35; // x3
bool v36; // w4
__int64 v37; // x5
const char *v38; // x6
__int64 v39; // x0
cocos2d::CCObject *v40; // x21
const char *v41; // x1
__int64 v42; // x2
__int64 v43; // x3
bool v44; // w4
__int64 v45; // x5
const char *v46; // x6
__int64 v47; // x0
__int64 v48; // x0
__int64 v49; // x2
cocos2d::CCNode *v50; // x21
char *v51; // x1
__int64 v52; // [xsp+78h] [xbp+78h] BYREF
__int64 v53; // [xsp+80h] [xbp+80h] BYREF
_BYTE v54[8]; // [xsp+88h] [xbp+88h] BYREF
__int64 v55[2]; // [xsp+90h] [xbp+90h] BYREF
__int64 v56; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v57; // [xsp+A8h] [xbp+A8h]
void *v58; // [xsp+B0h] [xbp+B0h]
v4 = a3;
v8 = (cocos2d::CCDirector *)(unsigned __int8)FLAlertLayer::init(this, 75);
v9 = (unsigned __int8)v8;
if ( !(_BYTE)v8 )
return v9;
*((_BYTE *)this + 681) = a4;
*((_DWORD *)this + 177) = -1;
*((_DWORD *)this + 176) = a2;
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(&v52, v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v55, 0.0, 0.0, 80.0, 80.0);
v12 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v55);
v13 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v55, 380.0, 180.0);
v13(v12, v55);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v12,
0xFFFFFFFFLL);
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v12 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, *(float *)&v52 * 0.5, *((float *)&v52 + 1) * 0.5);
v14(v12, v55);
v56 = 0;
v57 = 0;
v58 = nullptr;
std::string::__init(&v56, "Rate ", 5u);
if ( *((_BYTE *)this + 681) )
{
if ( (v56 & 1) != 0 )
{
if ( (v56 & 0xFFFFFFFFFFFFFFFELL) - 1 <= 0x10 )
{
std::string::__grow_by_and_replace(
(__int64)&v56,
(v56 & 0xFFFFFFFFFFFFFFFELL) - 1,
18 - (v56 & 0xFFFFFFFFFFFFFFFELL),
v57,
0,
v57,
0x11u,
"Advisor: Suggest ");
goto LABEL_4;
}
v51 = (char *)v58;
}
else
{
v51 = (char *)&v56 + 1;
}
strcpy(v51, "Advisor: Suggest ");
if ( (v56 & 1) != 0 )
v57 = 17;
else
LOBYTE(v56) = 34;
}
LABEL_4:
if ( v4 )
{
std::string::append((__int64)&v56, "Moons", 5u);
if ( (v56 & 1) == 0 )
goto LABEL_6;
}
else
{
std::string::append((__int64)&v56, "Stars", 5u);
if ( (v56 & 1) == 0 )
{
LABEL_6:
v16 = (cocos2d::CCLabelBMFont *)((char *)&v56 + 1);
goto LABEL_7;
}
}
v16 = (cocos2d::CCLabelBMFont *)v58;
LABEL_7:
v17 = cocos2d::CCLabelBMFont::create(v16, "bigFont.fnt", v15);
v18 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v55,
*(float *)&v52 * 0.5,
(float)((float)(*((float *)&v52 + 1) * 0.5) + 90.0) - 20.0);
v18(v17, v55);
v19 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(
*((_QWORD *)this + 73),
v17);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*((_QWORD *)this + 87) = 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);
for ( i = 1; i != 11; ++i )
{
while ( 1 )
{
StarsButton = RateStarsLayer::getStarsButton(
(__int64)this,
(const char *)(unsigned int)i,
(__int64)RateStarsLayer::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_11;
}
cocos2d::CCArray::addObject(v23, (cocos2d::CCObject *)StarsButton);
}
LABEL_11:
v28 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
(float)(*(float *)&v52 * 0.5) + -30.0,
(float)((float)(*((float *)&v52 + 1) * 0.5) + 23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v55, v28, (const cocos2d::CCPoint *)v54);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)v55, 0, 18.0);
v29 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
(float)(*(float *)&v52 * 0.5) + -30.0,
(float)((float)(*((float *)&v52 + 1) * 0.5) + -23.0) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v55, v29, (const cocos2d::CCPoint *)v54);
GameToolbox::alignItemsHorisontally((__int64)v23, (__int64)v55, 0, 18.0);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v54, (float)(*(float *)&v52 * 0.5) + -30.0, *((float *)&v52 + 1) * 0.5);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, 172.0, 2.0);
cocos2d::CCPoint::operator+(&v53, v54);
v30 = GJDifficultySprite::create(0, 1);
*((_QWORD *)this + 92) = v30;
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v30 + 160LL))(v30, 1.2);
if ( *((_BYTE *)this + 681) )
{
v31 = CCMenuItemSpriteExtra::create(*((_QWORD *)this + 92), 0, (__int64)this, (__int64)RateStarsLayer::onFeature, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v31);
v32 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v31 + 184LL);
cocos2d::CCNode::convertToNodeSpace(v55, *((cocos2d::CCNode **)this + 69), (const cocos2d::CCPoint *)&v53);
v32(v31, v55);
}
else
{
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
*((_QWORD *)this + 92),
11);
(*(void (__fastcall **)(_QWORD, __int64 *))(**((_QWORD **)this + 92) + 184LL))(*((_QWORD *)this + 92), &v53);
}
cocos2d::CCArray::removeAllObjects(v22);
v39 = ButtonSprite::create((ButtonSprite *)"Cancel", v33, v34, v35, v36, v37, v38);
v40 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v39, 0, (__int64)this, (__int64)RateStarsLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v40);
cocos2d::CCArray::addObject(v22, v40);
v47 = ButtonSprite::create((ButtonSprite *)"Submit", v41, v42, v43, v44, v45, v46);
v48 = CCMenuItemSpriteExtra::create(v47, 0, (__int64)this, (__int64)RateStarsLayer::onRate, 0);
v49 = *((_QWORD *)this + 69);
*((_QWORD *)this + 86) = v48;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v49 + 456LL))(v49, v48);
cocos2d::CCArray::addObject(v22, *((cocos2d::CCObject **)this + 86));
v50 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v54,
*(float *)&v52 * 0.5,
(float)((float)(*((float *)&v52 + 1) * 0.5) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v55, v50, (const cocos2d::CCPoint *)v54);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)v55, 0, 15.0);
RateStarsLayer::selectRating(this, nullptr);
if ( (v56 & 1) != 0 )
operator delete(v58);
return v9;
}