//
// GJRateLevelLayer::init from 0x1404196d0 to 0x140419fcd (2301 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onRateStarsMod @ 0x140423c20
// > ??> @ 0x14092660c
//
// This function is hookable on this platform (idp: pc, 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 11:32:06 +0000
//
// Hidden C++ exception states: #wind=3
char __fastcall GJRateLevelLayer::init(__int64 a1, cocos2d::CCObject *a2, __int64 a3, int a4)
{
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rcx
cocos2d::CCObject *v9; // rax
__int64 v10; // rcx
cocos2d::CCArray *v11; // r12
__int64 v12; // rcx
__int64 v13; // r13
__int64 v14; // rcx
__int64 v15; // rax
struct cocos2d::CCSprite *v16; // rax
cocos2d::CCObject *v17; // rsi
__int64 v18; // rdi
__int64 v19; // rbx
__int64 v20; // rax
__int64 v21; // rax
char v22; // cl
void **v23; // rdx
unsigned int i; // edi
__int64 v25; // rsi
cocos2d::CCString *v26; // rax
const char *CString; // r15
cocos2d::CCObject *v28; // rbx
struct cocos2d::CCObject *v29; // rbx
cocos2d::CCArray *v30; // rcx
__int64 v31; // rbx
__int64 v32; // rax
__int64 v33; // rax
__int64 v34; // rbx
__int64 v35; // rax
__int64 v36; // rax
cocos2d::CCSprite *v37; // rax
cocos2d::CCObject *v38; // rdi
__int64 v39; // rbx
__int64 v40; // rax
__int64 v41; // rax
_QWORD *v42; // rsi
void (__fastcall **v43)(_QWORD, _QWORD); // rdx
void (__fastcall *v44)(_QWORD *, _QWORD); // rax
__int64 v45; // rbx
__int64 v46; // rax
__int64 v47; // rax
cocos2d::CCLayerColor *v48; // rax
__int64 *v49; // rdi
__int64 v50; // rbx
__int64 v51; // rax
int v52; // eax
struct cocos2d::CCObject *v53; // rbx
int v54; // eax
cocos2d::CCObject *v55; // rax
__int64 v56; // rbx
__int64 v57; // rax
__int64 v58; // rax
__int64 v59; // rcx
char v61[8]; // [rsp+58h] [rbp-49h] BYREF
__int128 v62; // [rsp+60h] [rbp-41h] BYREF
__int64 v63; // [rsp+70h] [rbp-31h]
__int64 v64; // [rsp+78h] [rbp-29h]
void *v65; // [rsp+110h] [rbp+6Fh] BYREF
_BYTE v66[3]; // [rsp+118h] [rbp+77h] BYREF
float v67; // [rsp+120h] [rbp+7Fh] BYREF
float v68; // [rsp+124h] [rbp+83h]
if ( !a2 || !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, a4, 1133576192, 1, 0) )
return 0;
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v62 = 0;
v63 = 0;
v64 = 0;
sub_14003D230(&v62, "Suggest Rating", 0xEu);
SetupTriggerPopup::addTitle(a1, &v62);
*(_QWORD *)(a1 + 1032) = a2;
cocos2d::CCObject::retain(a2);
*(_DWORD *)(a1 + 1064) = -1;
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v67);
v9 = (cocos2d::CCObject *)cocos2d::CCArray::create(v8);
*(_QWORD *)(a1 + 1056) = v9;
cocos2d::CCObject::retain(v9);
v11 = (cocos2d::CCArray *)cocos2d::CCArray::create(v10);
v13 = cocos2d::CCArray::create(v12);
v15 = cocos2d::CCMenu::create(v14);
*(_QWORD *)(a1 + 552) = v15;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v15, 10);
v16 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_coinsIcon2_001.png");
*(_QWORD *)(a1 + 1072) = v16;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v16 + 160LL))(v16);
v17 = CCMenuItemSpriteExtra::create(*(_QWORD *)(a1 + 1072), 0, a1, (__int64)GJRateLevelLayer::onToggleCoins);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v17);
v18 = *(_QWORD *)v17;
v19 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v65,
(float)(v67 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5),
(float)(*(float *)(a1 + 736) * 0.5) + (float)(v68 * 0.5));
cocos2d::CCNode::convertToNodeSpace(v19, v66, v20);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v18 + 184))(v17, v21);
*(_BYTE *)(a1 + 1068) = 0;
memset(&v65, 50, 3);
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 1072) + 320LL))(*(_QWORD *)(a1 + 1072) + 320LL, &v65);
v22 = *(_BYTE *)(a1 + 1068);
*(_BYTE *)(a1 + 1068) = v22 == 0;
if ( v22 )
{
LOWORD(v65) = 12850;
memset(v66, 50, sizeof(v66));
v23 = (void **)v66;
}
else
{
LOWORD(v65) = -1;
BYTE2(v65) = -1;
v23 = &v65;
}
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 1072) + 320LL))(*(_QWORD *)(a1 + 1072) + 320LL, v23);
for ( i = 1; (int)i <= 10; ++i )
{
v25 = *(_QWORD *)(a1 + 552);
v26 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, i);
CString = cocos2d::CCString::getCString(v26);
v65 = operator new(0x2C8u);
v28 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v65);
if ( v28 )
{
if ( ButtonSprite::init_1(
(__int64)v28,
(__int64)CString,
20,
0,
1056964608,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v28);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v28 + 8LL))(v28, 1);
LODWORD(v28) = 0;
}
}
v29 = CCMenuItemSpriteExtra::create((int)v28, 0, a1, (__int64)sub_14041B3F0);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v29 + 160LL))(v29);
*((_DWORD *)v29 + 101) = 1061158912;
if ( v25 )
(*(void (__fastcall **)(__int64, struct cocos2d::CCObject *))(*(_QWORD *)v25 + 464LL))(v25, v29);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 1056), v29);
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v29 + 64LL))(v29, i);
v30 = v11;
if ( i > 5 )
v30 = (cocos2d::CCArray *)v13;
cocos2d::CCArray::addObject(v30, v29);
}
v31 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v65,
(float)(v67 * 0.5) - 90.0,
(float)((float)(v68 * 0.5) + 19.550001) + 75.0);
cocos2d::CCNode::convertToNodeSpace(v31, v66, v32);
GameToolbox::alignItemsHorisontally((__int64)v11, 13.6, v33, 0);
v34 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v65,
(float)(v67 * 0.5) - 90.0,
(float)((float)(v68 * 0.5) - 19.550001) + 75.0);
cocos2d::CCNode::convertToNodeSpace(v34, v66, v35);
GameToolbox::alignItemsHorisontally(v13, 13.6, v36, 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v61,
(float)((float)(v67 * 0.5) - 90.0) + 140.0,
(float)(v68 * 0.5) + 75.0);
v37 = GJDifficultySprite::create();
*(_QWORD *)(a1 + 1088) = v37;
(*(void (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)v37 + 160LL))(v37);
v38 = CCMenuItemSpriteExtra::create(*(_QWORD *)(a1 + 1088), 0, a1, (__int64)GJRateLevelLayer::onFeature);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v38);
v39 = *(_QWORD *)v38;
cocos2d::CCNode::convertToNodeSpace(*(_QWORD *)(a1 + 552), &v65, v61);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v39 + 184))(v38, v40);
cocos2d::CCArray::removeAllObjects(v11);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v62, 0.0, 0.0, 80.0, 80.0);
v42 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("GJ_square02.png", v41);
LOWORD(v65) = 0;
BYTE2(v65) = 0;
(*(void (__fastcall **)(_QWORD *, void **))v42[40])(v42 + 40, &v65);
v43 = (void (__fastcall **)(_QWORD, _QWORD))v42[40];
v44 = (void (__fastcall *)(_QWORD *, _QWORD))v43[5];
LOBYTE(v43) = 75;
v44(v42 + 40, v43);
v45 = *v42;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v65, 280.0, 110.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v45 + 312))(v42, v46);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v42, 1);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, (float)(v67 * 0.5) + 50.0, (float)(v68 * 0.5) - 32.0);
cocos2d::CCPoint::operator=(a1 + 1112, v47);
(*(void (__fastcall **)(_QWORD *, __int64))(*v42 + 184LL))(v42, a1 + 1112);
v48 = LoadingCircle::create();
*(_QWORD *)(a1 + 1104) = v48;
(*(void (__fastcall **)(cocos2d::CCLayerColor *))(*(_QWORD *)v48 + 160LL))(v48);
*(_QWORD *)(*(_QWORD *)(a1 + 1104) + 552LL) = *(_QWORD *)(a1 + 584);
*(_BYTE *)(*(_QWORD *)(a1 + 1104) + 560LL) = 0;
cocos2d::CCObject::retain(*(cocos2d::CCObject **)(a1 + 1104));
v49 = *(__int64 **)(*(_QWORD *)(a1 + 1104) + 544LL);
v50 = *v49;
v51 = (*(__int64 (__fastcall **)(_QWORD *))(*v42 + 200LL))(v42);
(*(void (__fastcall **)(__int64 *, __int64))(v50 + 184))(v49, v51);
LoadingCircle::show(*(_QWORD *)(a1 + 1104));
v52 = (unsigned int)ButtonSprite::create_1(
(int)"Cancel",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v53 = CCMenuItemSpriteExtra::create(v52, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v53);
cocos2d::CCArray::addObject(v11, v53);
v54 = (unsigned int)ButtonSprite::create_1(
(int)"Submit",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v55 = CCMenuItemSpriteExtra::create(v54, 0, a1, (__int64)sub_14041B5F0);
*(_QWORD *)(a1 + 1048) = v55;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v55);
cocos2d::CCArray::addObject(v11, *(struct cocos2d::CCObject **)(a1 + 1048));
v56 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v65,
v67 * 0.5,
(float)((float)(v68 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v56, v66, v57);
GameToolbox::alignItemsHorisontally((__int64)v11, 15.0, v58, 0);
sub_14041B3F0(a1, 0);
v59 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v65 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v65);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v59 = *(_QWORD *)&qword_14090BFB0;
}
*(_QWORD *)(v59 + 1592) = a1 + 1016;
GameLevelManager::getLevelRateInfo(
(cocos2d::CCActionManager **)v59,
*(_DWORD *)(*(_QWORD *)(a1 + 1032) + 328LL) - *(_DWORD *)(*(_QWORD *)(a1 + 1032) + 332LL));
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}