//
// RateDemonLayer::init from 0xa84354 to 0xa84784 (1072 bytes)
//
// 2 xrefs:
// > RateDemonLayer::create @ 0xa84900
// > ??> @ 0xc3478
//
// 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:00:33 +0000
//
__int64 __fastcall RateDemonLayer::init(cocos2d::CCObject **this, int a2)
{
GameManager *v4; // x0
char v5; // w20
unsigned int v6; // w27
__int64 v8; // x0
__int64 v9; // x0
cocos2d::CCDirector *v10; // x0
__int64 v11; // x20
void (__fastcall *v12)(__int64, _BYTE *); // x21
void (__fastcall *v13)(__int64, _BYTE *); // x21
const char *v14; // x2
char *v15; // x0
__int64 v16; // x21
__int64 v17; // x20
void (__fastcall *v18)(__int64, _BYTE *); // x24
cocos2d::CCArray *v19; // x0
cocos2d::CCObject *v20; // x0
cocos2d::CCArray *v21; // x0
cocos2d::CCMenu *v22; // x24
__int64 v23; // x0
cocos2d::CCString *v24; // x0
cocos2d::CCSprite *CString; // x0
const char *v26; // x1
__int64 v27; // x20
cocos2d::CCObject *v28; // x20
cocos2d::CCNode *v29; // x21
const char *v30; // x1
__int64 v31; // x2
__int64 v32; // x3
bool v33; // w4
__int64 v34; // x5
const char *v35; // x6
__int64 v36; // x0
cocos2d::CCObject *v37; // x21
const char *v38; // x1
__int64 v39; // x2
__int64 v40; // x3
bool v41; // w4
__int64 v42; // x5
const char *v43; // x6
__int64 v44; // x0
__int64 v45; // x0
cocos2d::CCNode *v46; // x21
__int64 v47; // [xsp+88h] [xbp+88h] BYREF
__int64 v48; // [xsp+90h] [xbp+90h] BYREF
_BYTE v49[16]; // [xsp+98h] [xbp+98h] BYREF
v4 = (GameManager *)FLAlertLayer::init((FLAlertLayer *)this, 75);
v5 = (char)v4;
v6 = (unsigned __int8)v4;
if ( (_BYTE)v4 )
{
v8 = GameManager::sharedState(v4);
v9 = (unsigned int)(*(_DWORD *)(v8 + 1032) - *(_DWORD *)(v8 + 1036) - 1);
if ( (unsigned int)v9 > 1 )
{
v9 = GameManager::sharedState((GameManager *)v9);
v5 = *(_BYTE *)(v9 + 1044);
}
*((_BYTE *)this + 720) = v5;
*((_DWORD *)this + 179) = -1;
*((_DWORD *)this + 178) = a2;
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v9);
cocos2d::CCDirector::getWinSize(&v47, v10);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v49, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v49);
v12 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v11 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v49, 380.0, 180.0);
v12(v11, v49);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(
*(this + 73),
v11,
0xFFFFFFFFLL);
v13 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v11 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, *(float *)&v47 * 0.5, *((float *)&v47 + 1) * 0.5);
v13(v11, v49);
if ( *((_BYTE *)this + 720) )
v15 = "Advisor: Rate Demon";
else
v15 = "Rate Demon";
v16 = 0;
v17 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)v15, "bigFont.fnt", v14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v17 + 160LL))(v17, 0.9);
v18 = *(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v17 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v49,
*(float *)&v47 * 0.5,
(float)((float)(*((float *)&v47 + 1) * 0.5) + 90.0) - 20.0);
v18(v17, v49);
v19 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 73) + 456LL))(
*(this + 73),
v17);
v20 = (cocos2d::CCObject *)cocos2d::CCArray::create(v19);
*(this + 87) = v20;
v21 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v20);
v22 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v21);
v23 = cocos2d::CCMenu::create(v22);
*(this + 69) = (cocos2d::CCObject *)v23;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v23, 10);
do
{
v24 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn2_001.png",
(const char *)dword_1176D30[v16]);
CString = (cocos2d::CCSprite *)cocos2d::CCString::getCString(v24);
v27 = cocos2d::CCSprite::createWithSpriteFrameName(CString, v26);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v27 + 160LL))(v27, 1.1);
v28 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
v27,
0,
(__int64)this,
(__int64)RateDemonLayer::selectRating,
0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v28);
cocos2d::CCArray::addObject(*(this + 87), v28);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v28 + 72LL))(v28, (unsigned int)++v16);
cocos2d::CCArray::addObject(v22, v28);
}
while ( v16 != 5 );
v29 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v49, *(float *)&v47 * 0.5, (float)(*((float *)&v47 + 1) * 0.5) + 3.0);
cocos2d::CCNode::convertToNodeSpace(&v48, v29, (const cocos2d::CCPoint *)v49);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)&v48, 0, 18.0);
cocos2d::CCArray::removeAllObjects(v22);
v36 = ButtonSprite::create((ButtonSprite *)"Cancel", v30, v31, v32, v33, v34, v35);
v37 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(v36, 0, (__int64)this, (__int64)RateDemonLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v37);
cocos2d::CCArray::addObject(v22, v37);
v44 = ButtonSprite::create((ButtonSprite *)"Submit", v38, v39, v40, v41, v42, v43);
v45 = CCMenuItemSpriteExtra::create(v44, 0, (__int64)this, (__int64)RateDemonLayer::onRate, 0);
*(this + 86) = (cocos2d::CCObject *)v45;
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v45);
cocos2d::CCArray::addObject(v22, *(this + 86));
v46 = *(this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v49,
*(float *)&v47 * 0.5,
(float)((float)(*((float *)&v47 + 1) * 0.5) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(&v48, v46, (const cocos2d::CCPoint *)v49);
GameToolbox::alignItemsHorisontally((__int64)v22, (__int64)&v48, 0, 15.0);
RateDemonLayer::selectRating((RateDemonLayer *)this, nullptr);
}
return v6;
}