//
// GJRateLevelLayer::init from 0x565b9c to 0x566106 (1386 bytes)
//
// 1 xrefs:
// > GJRateLevelLayer::create @ 0x5661e6
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:52:28 +0000
//
int __fastcall GJRateLevelLayer::init(GJRateLevelLayer *this, GJGameLevel *a2)
{
cocos2d::CCDirector *v5; // r0
cocos2d::CCArray *WinSize; // r0
cocos2d::CCObject *v7; // r0
cocos2d::CCArray *v8; // r0
cocos2d::CCArray *v9; // r8
cocos2d::CCMenu *v10; // r9
int v11; // r0
const char *v12; // r1
int v13; // r0
int v14; // r0
int v15; // r11
int v16; // r0
const char *v17; // r10
void (__fastcall *v18)(int, _DWORD *); // r2
int v19; // r2
cocos2d::CCObject *StarsButton; // r11
cocos2d::CCArray *v22; // r0
const cocos2d::CCPoint *v23; // r6
const cocos2d::CCPoint *v24; // r6
int v25; // r0
int v26; // r0
int v27; // r9
int v28; // r9
void (__fastcall *v29)(int, _DWORD *); // r2
void (__fastcall *v30)(int, _DWORD *); // r11
LoadingCircle *v31; // r0
cocos2d::CCLayerColor *v32; // r0
int v33; // r10
void (__fastcall *v34)(int, int); // r11
int v35; // r0
const char *v36; // r1
ButtonSprite *v37; // r0
cocos2d::CCObject *v38; // r5
const char *v39; // r1
ButtonSprite *v40; // r0
int v41; // r0
const cocos2d::CCPoint *v42; // r10
GameLevelManager *v43; // r0
GameLevelManager *v44; // r0
GameLevelManager *v45; // r0
int v46; // [sp+10h] [bp-74h]
void (__fastcall *v47)(int, _DWORD *); // [sp+14h] [bp-70h]
void (__fastcall *v48)(int, _DWORD *); // [sp+14h] [bp-70h]
cocos2d::CCPoint *v49; // [sp+1Ch] [bp-68h]
float v50; // [sp+20h] [bp-64h] BYREF
float v51; // [sp+24h] [bp-60h]
_BYTE v52[8]; // [sp+28h] [bp-5Ch] BYREF
_BYTE v53[8]; // [sp+30h] [bp-54h] BYREF
_BYTE v54[8]; // [sp+38h] [bp-4Ch] BYREF
int (__fastcall *v55)(GJRateLevelLayer *, cocos2d::CCObject *, int); // [sp+40h] [bp-44h]
int v56; // [sp+44h] [bp-40h]
int (__fastcall *v57)(GJRateLevelLayer *, cocos2d::CCObject *); // [sp+48h] [bp-3Ch]
int v58; // [sp+4Ch] [bp-38h]
int (__fastcall *v59)(GJRateLevelLayer *, cocos2d::CCObject *); // [sp+50h] [bp-34h]
int v60; // [sp+54h] [bp-30h]
_DWORD v61[2]; // [sp+58h] [bp-2Ch] BYREF
int v62[3]; // [sp+60h] [bp-24h] BYREF
_DWORD v63[4]; // [sp+6Ch] [bp-18h] BYREF
if ( !a2 )
return 0;
v46 = SetupTriggerPopup::init(this, nullptr, nullptr, 420.0, 290.0, 1, 0.0);
if ( !v46 )
return 0;
SetupTriggerPopup::preSetup(this);
memset(v62, 0, sizeof(v62));
std::string::__init(v62, "Suggest Rating", 0xEu);
SetupTriggerPopup::addTitle(this, v62);
std::string::~string((int)v62);
*((_DWORD *)this + 182) = a2;
v5 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
*((_DWORD *)this + 186) = -1;
cocos2d::CCDirector::sharedDirector(v5);
WinSize = (cocos2d::CCArray *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v50);
v7 = (cocos2d::CCObject *)cocos2d::CCArray::create(WinSize);
*((_DWORD *)this + 185) = v7;
v8 = (cocos2d::CCArray *)cocos2d::CCObject::retain(v7);
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v8);
v10 = (cocos2d::CCMenu *)cocos2d::CCArray::create(v9);
v11 = cocos2d::CCMenu::create(v10);
*((_DWORD *)this + 111) = v11;
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v11, 10);
v13 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_coinsIcon2_001.png", v12);
*((_DWORD *)this + 188) = v13;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v13 + 80))(v13, 1068708659);
v14 = *((_DWORD *)this + 188);
v56 = 0;
v55 = GJRateLevelLayer::onToggleCoins;
v15 = CCMenuItemSpriteExtra::create(v14, 0, (int)this, (int)GJRateLevelLayer::onToggleCoins, 0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v15);
v47 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v15 + 92);
v49 = *((cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(v50 * 0.5) - (float)(*((float *)this + 139) * 0.5),
(float)(*((float *)this + 140) * 0.5) + (float)(v51 * 0.5));
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v63, v49);
v47(v15, v63);
v16 = *((_DWORD *)this + 188);
*((_BYTE *)this + 748) = 0;
v17 = (_BYTE *)(&dword_0 + 1);
v18 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v16 + 480);
memset(v63, 50, 3);
v18(v16, v63);
GJRateLevelLayer::onToggleCoins(this, nullptr, v19);
do
{
v58 = 0;
v57 = GJRateLevelLayer::selectRating;
StarsButton = (cocos2d::CCObject *)GJRateLevelLayer::getStarsButton(
(int)this,
v17,
COERCE_FLOAT(GJRateLevelLayer::selectRating),
0,
*((_DWORD *)this + 111),
COERCE_INT(0.75));
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 185), StarsButton);
(*(void (__fastcall **)(cocos2d::CCObject *, const char *))(*(_DWORD *)StarsButton + 36))(StarsButton, v17);
if ( (int)v17++ <= 5 )
v22 = v9;
else
v22 = v10;
cocos2d::CCArray::addObject(v22, StarsButton);
}
while ( v17 != &byte_9[2] );
v23 = *((const cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(v50 * 0.5) - 90.0,
(float)((float)(v51 * 0.5) + 19.55) + 75.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v63, v23);
GameToolbox::alignItemsHorisontally(*(float *)&v9, 13.6, (int)v63, 0);
v24 = *((const cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)(v50 * 0.5) - 90.0,
(float)((float)(v51 * 0.5) - 19.55) + 75.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v63, v24);
GameToolbox::alignItemsHorisontally(*(float *)&v10, 13.6, (int)v63, 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v52,
(float)((float)(v50 * 0.5) - 90.0) + 140.0,
(float)(v51 * 0.5) + 75.0);
v25 = GJDifficultySprite::create(0, 1);
*((_DWORD *)this + 190) = v25;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v25 + 80))(v25, 1067030938);
v26 = *((_DWORD *)this + 190);
v60 = 0;
v59 = GJRateLevelLayer::onFeature;
v27 = CCMenuItemSpriteExtra::create(v26, 0, (int)this, (int)GJRateLevelLayer::onFeature, 0);
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v27);
v48 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v27 + 92);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v63, *((const cocos2d::CCPoint **)this + 111));
v48(v27, v63);
cocos2d::CCArray::removeAllObjects(v9);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v63, 0.0, 0.0, 80.0, 80.0);
v28 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v63);
v29 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v28 + 480);
LOWORD(v63[0]) = 0;
BYTE2(v63[0]) = 0;
v29(v28, v63);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v28 + 456))(v28, 75);
v30 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v28 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v63, 280.0, 110.0);
v30(v28, v63);
(*(void (__fastcall **)(_DWORD, int, int))(**((_DWORD **)this + 115) + 232))(*((_DWORD *)this + 115), v28, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v63, (float)(v50 * 0.5) + 50.0, (float)(v51 * 0.5) - 32.0);
cocos2d::CCPoint::operator=((char *)this + 772, v63);
v31 = (LoadingCircle *)(*(int (__fastcall **)(int, char *))(*(_DWORD *)v28 + 92))(v28, (char *)this + 772);
v32 = LoadingCircle::create(v31);
*((_DWORD *)this + 192) = v32;
(*(void (__fastcall **)(cocos2d::CCLayerColor *, int))(*(_DWORD *)v32 + 80))(v32, 1060320051);
*(_DWORD *)(*((_DWORD *)this + 192) + 444) = *((_DWORD *)this + 115);
*(_BYTE *)(*((_DWORD *)this + 192) + 448) = 0;
cocos2d::CCObject::retain(*((cocos2d::CCObject **)this + 192));
v33 = *(_DWORD *)(*((_DWORD *)this + 192) + 440);
v34 = *(void (__fastcall **)(int, int))(*(_DWORD *)v33 + 92);
v35 = (*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
v34(v33, v35);
LoadingCircle::show(*((cocos2d::CCNode ***)this + 192));
v37 = ButtonSprite::create((ButtonSprite *)"Cancel", v36);
v61[0] = 684;
v61[1] = 1;
v38 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v37, 0, (int)this, 684, 1);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v38);
cocos2d::CCArray::addObject(v9, v38);
v40 = ButtonSprite::create((ButtonSprite *)"Submit", v39);
v63[1] = 0;
v63[0] = GJRateLevelLayer::onRate;
v41 = CCMenuItemSpriteExtra::create((int)v40, 0, (int)this, (int)GJRateLevelLayer::onRate, 0);
*((_DWORD *)this + 184) = v41;
(*(void (__fastcall **)(_DWORD, int))(**((_DWORD **)this + 111) + 228))(*((_DWORD *)this + 111), v41);
cocos2d::CCArray::addObject(v9, *((cocos2d::CCObject **)this + 184));
v42 = *((const cocos2d::CCPoint **)this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v53,
v50 * 0.5,
(float)((float)(v51 * 0.5) - (float)(*((float *)this + 140) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v54, v42);
GameToolbox::alignItemsHorisontally(*(float *)&v9, 15.0, (int)v54, 0);
v43 = (GameLevelManager *)GJRateLevelLayer::selectRating(this, nullptr);
v44 = (GameLevelManager *)GameLevelManager::sharedState(v43);
*((_DWORD *)v44 + 235) = (char *)this + 720;
v45 = (GameLevelManager *)GameLevelManager::sharedState(v44);
GameLevelManager::getLevelRateInfo(
v45,
(const char *)(*(_DWORD *)(*((_DWORD *)this + 182) + 268) - *(_DWORD *)(*((_DWORD *)this + 182) + 272)));
SetupTriggerPopup::postSetup(this);
return v46;
}