//
// RateLevelLayer::init from 0x14055dc40 to 0x14055e158 (1304 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::onRate @ 0x1404235f2
// > ??> @ 0x14092c228
//
// 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:34:13 +0000
//
// Hidden C++ exception states: #wind=3
bool __fastcall RateLevelLayer::init(__int64 a1, int a2)
{
bool result; // al
__int64 v5; // rcx
__int64 v6; // rax
__int64 v7; // rax
__int64 *v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
__int64 v11; // rbx
__int64 v12; // rax
struct cocos2d::CCLabelBMFont *v13; // rdi
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rcx
cocos2d::CCObject *v17; // rax
__int64 v18; // rcx
cocos2d::CCArray *v19; // rbp
__int64 v20; // rcx
__int64 v21; // rax
int i; // edi
cocos2d::CCString *v23; // rax
const char *CString; // rax
const char *v25; // rcx
struct cocos2d::CCObject *v26; // r14
__int64 *v27; // rax
cocos2d::CCObject *v28; // rbx
__int64 v29; // rbx
__int64 v30; // rax
__int64 v31; // rax
__int64 *v32; // rdi
cocos2d::CCObject *v33; // rbx
__int64 *v34; // rdi
cocos2d::CCObject *v35; // rbx
__int64 v36; // rbx
__int64 v37; // rax
__int64 v38; // rax
_BYTE v39[16]; // [rsp+40h] [rbp-68h] BYREF
float v40; // [rsp+C0h] [rbp+18h] BYREF
float v41; // [rsp+C4h] [rbp+1Ch]
void *v42; // [rsp+C8h] [rbp+20h] BYREF
result = FLAlertLayer::init_1(a1, 75);
if ( !result )
return result;
*(_DWORD *)(a1 + 680) = a2;
v6 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6, &v40);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v39, 0.0, 0.0, 80.0, 80.0);
v8 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v7);
v9 = *v8;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v42, 360.0, 180.0);
(*(void (__fastcall **)(__int64 *, __int64))(v9 + 312))(v8, v10);
(*(void (__fastcall **)(_QWORD, __int64 *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v8,
0xFFFFFFFFLL);
v11 = *v8;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v40 * 0.5, v41 * 0.5);
(*(void (__fastcall **)(__int64 *, __int64))(v11 + 184))(v8, v12);
v13 = cocos2d::CCLabelBMFont::create("Rate Difficulty", (const char *)&qword_140704F78);
v14 = *(_QWORD *)v13;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v40 * 0.5, (float)((float)(v41 * 0.5) + 90.0) - 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v14 + 184))(v13, v15);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v13);
v17 = (cocos2d::CCObject *)cocos2d::CCArray::create(v16);
*(_QWORD *)(a1 + 672) = v17;
cocos2d::CCObject::retain(v17);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v18);
v21 = cocos2d::CCMenu::create(v20);
*(_QWORD *)(a1 + 552) = v21;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v21, 10);
for ( i = 0; i <= 6; ++i )
{
v23 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn_001.png", i);
CString = cocos2d::CCString::getCString(v23);
v25 = "difficulty_auto_btn_001.png";
if ( i )
v25 = CString;
v26 = cocos2d::CCSprite::createWithSpriteFrameName(v25);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(a1 + 672), v26);
(*(void (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v26 + 160LL))(v26);
v42 = operator new(0x208u);
v27 = (__int64 *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v42);
v28 = (cocos2d::CCObject *)v27;
if ( v27 )
{
if ( CCMenuItemSpriteExtra::init(v27, (__int64 *)v26, 0, a1, (__int64)RateLevelLayer::selectRating) )
{
cocos2d::CCObject::autorelease(v28);
goto LABEL_10;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v28 + 8LL))(v28, 1);
}
v28 = nullptr;
LABEL_10:
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v28 + 64LL))(v28, (unsigned int)i);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v28);
cocos2d::CCArray::addObject(v19, v28);
}
v29 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v40 * 0.5, v41 * 0.5);
cocos2d::CCNode::convertToNodeSpace(v29, v39, v30);
GameToolbox::alignItemsHorisontally((__int64)v19, 16.0, v31, 0);
cocos2d::CCArray::removeAllObjects(v19);
v32 = (__int64 *)ButtonSprite::create_1(
(int)"Cancel",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v42 = operator new(0x208u);
v33 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v42);
if ( v33 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v33, v32, 0, a1, (__int64)RateLevelLayer::onClose) )
{
cocos2d::CCObject::autorelease(v33);
goto LABEL_16;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v33 + 8LL))(v33, 1);
}
v33 = nullptr;
LABEL_16:
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v33);
cocos2d::CCArray::addObject(v19, v33);
v34 = (__int64 *)ButtonSprite::create_1(
(int)"Submit",
0,
0,
1.0,
0,
(__int64)"goldFont.fnt",
(__int64)"GJ_button_01.png",
0);
v42 = operator new(0x208u);
v35 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v42);
if ( v35 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v35, v34, 0, a1, (__int64)RateLevelLayer::onRate) )
{
cocos2d::CCObject::autorelease(v35);
goto LABEL_21;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v35 + 8LL))(v35, 1);
}
v35 = nullptr;
LABEL_21:
*(_QWORD *)(a1 + 664) = v35;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v35);
cocos2d::CCArray::addObject(v19, *(struct cocos2d::CCObject **)(a1 + 664));
v36 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v42, v40 * 0.5, (float)((float)(v41 * 0.5) - 90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v36, v39, v37);
GameToolbox::alignItemsHorisontally((__int64)v19, 15.0, v38, 0);
RateLevelLayer::selectRating(a1, 0);
return 1;
}