//
// GJRateLevelListLayer::init from 0x566d5c to 0x5676f0 (2452 bytes)
//
// 1 xrefs:
// > GJRateLevelListLayer::create @ 0x5677d6
//
// 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:29 +0000
//
int __fastcall GJRateLevelListLayer::init(cocos2d::CCDictionary **this, GJLevelList *a2, cocos2d::CCArray *a3)
{
int v6; // r7
cocos2d::CCDirector *v8; // r0
cocos2d::CCMenu *v9; // r0
cocos2d::CCDictionary *v10; // r0
const char *v11; // r8
int v12; // r0
cocos2d::CCString *v13; // r0
const char *CString; // r8
size_t v15; // r0
const char *v16; // r2
cocos2d::CCLabelBMFont *v17; // r0
cocos2d::CCLabelBMFont *v18; // r8
void (__fastcall *v19)(cocos2d::CCLabelBMFont *, _DWORD *); // r9
float v20; // s17
float v21; // s16
int v22; // r8
int v23; // r2
const char *v24; // r2
cocos2d::CCDictionary *v25; // r0
cocos2d::CCDictionary *v26; // r6
void (__fastcall *v27)(cocos2d::CCDictionary *, _DWORD *); // r8
int v28; // r0
int v29; // r6
const cocos2d::CCPoint *v30; // r0
float v31; // s16
float v32; // s17
float v33; // r0
int v34; // r6
void (__fastcall *v35)(int, _DWORD *); // r8
int v36; // r6
void (__fastcall *v37)(int, _DWORD *); // r2
void (__fastcall *v38)(int, _DWORD *); // r8
GJGameLevel *v39; // r1
char *v40; // r3
char *v41; // r10
char *v42; // r9
int v43; // r3
int v44; // r6
_DWORD *v45; // r3
int v46; // r6
GJRateLevelListLayer **v47; // r3
unsigned int v48; // r6
GJRateLevelListLayer **v49; // r8
GJRateLevelListLayer *v50; // r0
GJRateLevelListLayer *v51; // t1
int v52; // r3
int v53; // t1
int v54; // r8
float v55; // s14
float v56; // s16
int v57; // r6
char v58; // r3
char v59; // r3
float v60; // s15
char v61; // r3
ButtonSprite *v62; // r8
ButtonSprite *v63; // r6
cocos2d::CCArray *v64; // r0
cocos2d::CCArray *v65; // r5
const char *v66; // r1
ButtonSprite *v67; // r0
cocos2d::CCObject *v68; // r6
const char *v69; // r1
ButtonSprite *v70; // r0
cocos2d::CCObject *v71; // r6
const cocos2d::CCPoint *v72; // r6
float v73; // r0
int v74; // r0
float v75; // [sp+10h] [bp-BCh]
float v76; // [sp+10h] [bp-BCh]
float v77; // [sp+50h] [bp-7Ch] BYREF
float v78; // [sp+54h] [bp-78h]
float v79; // [sp+58h] [bp-74h] BYREF
float v80; // [sp+5Ch] [bp-70h]
__int16 v81; // [sp+60h] [bp-6Ch] BYREF
char v82; // [sp+62h] [bp-6Ah]
__int16 v83; // [sp+68h] [bp-64h] BYREF
char v84; // [sp+6Ah] [bp-62h]
int v85; // [sp+70h] [bp-5Ch] BYREF
float v86; // [sp+74h] [bp-58h]
int v87[2]; // [sp+78h] [bp-54h] BYREF
cocos2d::CCLabelBMFont *v88; // [sp+80h] [bp-4Ch]
int v89[3]; // [sp+84h] [bp-48h] BYREF
int v90[3]; // [sp+90h] [bp-3Ch] BYREF
int v91[3]; // [sp+9Ch] [bp-30h] BYREF
char v92[4]; // [sp+A8h] [bp-24h] BYREF
int v93; // [sp+ACh] [bp-20h]
const char *v94; // [sp+B0h] [bp-1Ch]
_DWORD v95[4]; // [sp+B4h] [bp-18h] BYREF
if ( !a2 )
return 0;
v6 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 380.0, 260.0, 1, 0.0);
if ( !v6 )
return 0;
SetupTriggerPopup::preSetup((SetupTriggerPopup *)this);
*(_DWORD *)v92 = 0;
v93 = 0;
v94 = nullptr;
std::string::__init((int *)v92, "Feature List", 0xCu);
SetupTriggerPopup::addTitle(this, v92);
std::string::~string((int)v92);
*(this + 181) = a2;
v8 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
*(this + 182) = a3;
if ( a3 )
v8 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a3);
cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v77);
v9 = (cocos2d::CCMenu *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v79, v77 * 0.5, v78 * 0.5);
v10 = (cocos2d::CCDictionary *)cocos2d::CCMenu::create(v9);
*(this + 111) = v10;
(*(void (__fastcall **)(_DWORD, cocos2d::CCDictionary *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v10,
10);
std::string::basic_string((int *)v92, (int)*(this + 181) + 348);
if ( (v92[0] & 1) != 0 )
v11 = v94;
else
v11 = &v92[1];
v12 = GJLevelList::totalLevels(*(this + 181));
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s (%d levels)", v11, v12);
CString = (const char *)cocos2d::CCString::getCString(v13);
v87[0] = 0;
v87[1] = 0;
v88 = nullptr;
v15 = strlen(CString);
std::string::__init(v87, CString, v15);
std::string::~string((int)v92);
if ( (v87[0] & 1) != 0 )
v17 = v88;
else
v17 = (cocos2d::CCLabelBMFont *)((char *)v87 + 1);
v18 = (cocos2d::CCLabelBMFont *)cocos2d::CCLabelBMFont::create(v17, "goldFont.fnt", v16);
(*(void (__fastcall **)(cocos2d::CCLabelBMFont *, int))(*(_DWORD *)v18 + 80))(v18, 1057803469);
cocos2d::CCLabelBMFont::limitLabelWidth(v18, *((float *)this + 139) - 80.0, 0.55, 0.3);
(*(void (__fastcall **)(_DWORD, cocos2d::CCLabelBMFont *, int))(*(_DWORD *)*(this + 115) + 232))(
*(this + 115),
v18,
2);
v19 = *(void (__fastcall **)(cocos2d::CCLabelBMFont *, _DWORD *))(*(_DWORD *)v18 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v79, (float)(v80 + (float)(*((float *)this + 140) * 0.5)) - 40.0);
v19(v18, v95);
memset(v89, 0, sizeof(v89));
v20 = v79 - 110.0;
v21 = v80 + 42.0;
std::string::__init(v89, "Rank:", 5u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v20, v21);
SetupTriggerPopup::createValueControlAdvanced(this, -10, v89, v95, 1060320051, 1, 2, 4, 1, 0, 0, 0, 0, 0, 2, 0);
std::string::~string((int)v89);
SetupTriggerPopup::updateValue((SetupTriggerPopup *)this, -10, 1.0);
v22 = GJLevelList::totalLevels(*(this + 181));
memset(v90, 0, sizeof(v90));
std::string::__init(v90, "Levels:", 7u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v20, v21 - 46.0);
SetupTriggerPopup::createValueControlAdvanced(this, -11, v90, v95, 1060320051, 1, 2, 4, 1, 0, 0, 0, 0, 0, 2, 0);
std::string::~string((int)v90);
v23 = v22;
if ( v22 >= 1 )
v23 = 1;
SetupTriggerPopup::updateValue((SetupTriggerPopup *)this, -11, (float)v23);
memset(v91, 0, sizeof(v91));
std::string::__init(v91, "Diamonds:", 9u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v20, v21 - 92.0);
SetupTriggerPopup::createValueControlAdvanced(this, -12, v91, v95, 1060320051, 1, 2, 4, 1, 0, 0, 0, 0, 0, 2, 0);
std::string::~string((int)v91);
SetupTriggerPopup::updateValue((SetupTriggerPopup *)this, -12, 0.0);
v25 = (cocos2d::CCDictionary *)cocos2d::CCLabelBMFont::create(
(cocos2d::CCLabelBMFont *)&unk_B6B226,
"chatFont.fnt",
v24);
*(this + 197) = v25;
v26 = v25;
v27 = *(void (__fastcall **)(cocos2d::CCDictionary *, _DWORD *))(*(_DWORD *)v25 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, 0.0, 0.0);
v27(v26, v95);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 197) + 80))(*(this + 197), 1058642330);
(*(void (__fastcall **)(_DWORD, void *))(*(_DWORD *)*(this + 197) + 536))(*(this + 197), &unk_BED0BE);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 197) + 512))(*(this + 197), 150);
(*(void (__fastcall **)(_DWORD, _DWORD, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), *(this + 197), 2);
v28 = cocos2d::CCDictionary::objectForKey(*(this + 153), -12);
v29 = v28;
if ( v28 )
{
v30 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(int))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v85, v30);
v31 = *(float *)&v85;
v32 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v29 + 164))(v29);
v33 = (*(float (__fastcall **)(int))(*(_DWORD *)v29 + 68))(v29);
v34 = (int)*(this + 197);
v35 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v34 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, (float)(v31 + (float)((float)(v32 * v33) * 0.5)) + 4.0, v86);
v35(v34, v95);
}
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v95, 0.0, 0.0, 80.0, 80.0);
v36 = cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v95);
v37 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v36 + 480);
LOWORD(v95[0]) = 0;
BYTE2(v95[0]) = 0;
v37(v36, v95);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v36 + 456))(v36, 75);
v38 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v36 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v95, 180.0, 110.0);
v38(v36, v95);
(*(void (__fastcall **)(_DWORD, int, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), v36, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, v79 + 70.0, v80 - 5.0);
cocos2d::CCPoint::operator=(this + 185, v95);
(*(void (__fastcall **)(int, char *))(*(_DWORD *)v36 + 92))(v36, (char *)this + 740);
v40 = (char *)(this + 186);
v41 = (char *)(this + 196);
v42 = (char *)(this + 186);
do
{
*((_DWORD *)v40 + 1) = 0;
v40 += 4;
}
while ( v40 != v41 );
v43 = (int)*(this + 182);
if ( v43 )
{
v45 = *(_DWORD **)(v43 + 52);
if ( *v45 )
{
v46 = *v45 + 0x40000000;
v47 = (GJRateLevelListLayer **)v45[3];
v48 = (unsigned int)&v47[v46 - 1];
v49 = v47;
while ( (unsigned int)v49 <= v48 )
{
v51 = *v49++;
v50 = v51;
if ( !v51 )
break;
v74 = GJRateLevelListLayer::impliedStarsForLevel(v50, v39);
if ( (unsigned int)(v74 - 1) <= 9 )
*(this + v74 + 186) = (cocos2d::CCDictionary *)((char *)*(this + v74 + 186) + 1);
}
}
}
v44 = 0;
do
{
v53 = *((_DWORD *)v42 + 1);
v42 += 4;
v52 = v53;
if ( v44 < v53 )
v44 = v52;
}
while ( v42 != v41 );
v54 = 0;
v55 = (float)v44 * 10.0;
if ( v55 <= 100.0 )
v56 = 10.0;
else
v56 = 100.0 / (float)v44;
while ( 1 )
{
v57 = (int)*(this + v54 + 187);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, (float)(15 * v54 - 70), -42.0);
cocos2d::CCPoint::operator+(&v85, this + 185, v95);
v81 = -26986;
v82 = -106;
v83 = 0;
v84 = 0;
GameToolbox::intToString((GameToolbox *)v91, v54 + 1);
if ( v57 <= 0 )
{
v81 = 12371;
v82 = 23;
v83 = 8247;
v84 = 16;
std::string::assign(v91, (char *)&unk_B6B226);
v57 = 1;
if ( v56 < 10.0 )
{
v60 = v56;
}
else
{
v60 = v56 * 0.5;
v55 = v86 - (float)((float)(v56 * 0.5) * 0.5);
}
if ( v56 >= 10.0 )
v86 = v55;
}
else
{
switch ( v54 )
{
case 1:
LOBYTE(v81) = 0;
v58 = -109;
goto LABEL_36;
case 2:
v81 = -1536;
v59 = 60;
break;
case 3:
LOBYTE(v81) = 94;
v61 = -40;
goto LABEL_46;
case 4:
v81 = -4610;
v59 = 20;
break;
case 5:
LOBYTE(v81) = -1;
v61 = -73;
goto LABEL_46;
case 6:
LOBYTE(v81) = -1;
v61 = 120;
goto LABEL_46;
case 7:
v81 = 30207;
v59 = -21;
break;
case 8:
v81 = 11775;
v59 = -20;
break;
case 9:
LOBYTE(v81) = -1;
v61 = 45;
LABEL_46:
HIBYTE(v81) = v61;
v59 = 0;
break;
default:
LOBYTE(v81) = 3;
v58 = -45;
LABEL_36:
HIBYTE(v81) = v58;
v59 = -1;
break;
}
v82 = v59;
v60 = v56;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v95, (const cocos2d::CCPoint *)&v85);
std::string::basic_string((int *)v92, (int)v91);
GJRateLevelListLayer::createStatPillar((int)this, 10, (int)v60, v57, v81, v83, (int)v95, (unsigned __int8 *)v92);
std::string::~string((int)v92);
std::string::~string((int)v91);
if ( v54 == 9 )
break;
++v54;
}
v62 = ButtonSprite::create(
(ButtonSprite *)"Unrate",
nullptr,
0,
0.35,
0,
"bigFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(25.0),
v75);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v95,
(float)((float)(*((float *)this + 139) * 0.5) + (float)(v77 * 0.5)) - 40.0,
(float)((float)(*((float *)this + 140) * 0.5) + (float)(v78 * 0.5)) - 22.0);
SetupTriggerPopup::addCustomButton(this, -13, v62, v95, 0, 0);
v63 = ButtonSprite::create(
(ButtonSprite *)"Rank\nOnly",
nullptr,
0,
0.3,
0,
"bigFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(25.0),
v76);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v95,
(float)((float)(*((float *)this + 139) * 0.5) + (float)(v77 * 0.5)) - 30.0,
(float)((float)(v78 * 0.5) - (float)(*((float *)this + 140) * 0.5)) + 20.0);
v64 = (cocos2d::CCArray *)SetupTriggerPopup::addCustomButton(this, -15, v63, v95, 0, 0);
v65 = (cocos2d::CCArray *)cocos2d::CCArray::create(v64);
v67 = ButtonSprite::create((ButtonSprite *)"Cancel", v66);
v85 = 684;
LODWORD(v86) = 1;
v68 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create((int)v67, 0, (int)this, 684, 1);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v68);
cocos2d::CCArray::addObject(v65, v68);
v70 = ButtonSprite::create((ButtonSprite *)"Submit", v69);
v95[1] = 0;
v95[0] = GJRateLevelListLayer::onSubmit;
v71 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v70,
0,
(int)this,
(int)GJRateLevelListLayer::onSubmit,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v71);
cocos2d::CCArray::addObject(v65, v71);
v72 = *(this + 111);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v81,
v77 * 0.5,
(float)((float)(v78 * 0.5) - (float)(*((float *)this + 140) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v83, v72);
GameToolbox::alignItemsHorisontally(*(float *)&v65, 15.0, (int)&v83, 0);
v73 = (*((float (__fastcall **)(cocos2d::CCDictionary **, int))*this + 183))(this, -11);
GJRateLevelListLayer::updateStarSumLabel((GJRateLevelListLayer *)this, (int)v73);
SetupTriggerPopup::postSetup((SetupTriggerPopup *)this);
std::string::~string((int)v87);
return v6;
}