//
// RateLevelLayer::init from 0x100594ba0 to 0x100595255 (1717 bytes)
//
// 1 xrefs:
// > sub_1005949B0 @ 0x100594b4c
//
// 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 12:32:28 +0000
//
__int64 __fastcall RateLevelLayer::init(__int64 a1, int a2)
{
__int64 result; // rax
__int64 v4; // rax
void *v5; // r14
__int64 v6; // r14
double v7; // xmm0_8
__int64 v8; // rdi
__int64 v9; // rsi
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // r14
__int64 v13; // rdx
__int64 v14; // rcx
__int64 v15; // rax
__int64 v16; // rax
char *v17; // r13
void *v18; // r13
__int64 v19; // rax
__int64 CString; // rax
char *v21; // r13
void *v22; // r13
__int64 v23; // rax
__int64 v24; // rax
char *v25; // r13
void *v26; // r13
__int64 v27; // rax
__int64 v28; // rax
char *v29; // r13
void *v30; // r13
__int64 v31; // rax
__int64 v32; // rax
char *v33; // r13
void *v34; // r13
__int64 v35; // rax
__int64 v36; // rax
char *v37; // r13
void *v38; // r13
__int64 v39; // rax
__int64 v40; // rax
char *v41; // rsi
void *v42; // r15
__int64 v43; // r15
__int64 v44; // rax
void *v45; // r15
__int64 v46; // rax
void *v47; // rax
__int64 v48; // r15
char v49; // [rsp+0h] [rbp-50h]
char v50; // [rsp+0h] [rbp-50h]
char v51; // [rsp+0h] [rbp-50h]
char v52; // [rsp+0h] [rbp-50h]
char v53; // [rsp+0h] [rbp-50h]
char v54; // [rsp+0h] [rbp-50h]
char v55; // [rsp+0h] [rbp-50h]
unsigned int v56; // [rsp+4h] [rbp-4Ch] BYREF
unsigned __int64 v57[2]; // [rsp+Ch] [rbp-44h] BYREF
__int64 v58; // [rsp+1Ch] [rbp-34h] BYREF
unsigned __int8 v59; // [rsp+27h] [rbp-29h]
result = FLAlertLayer::init_1((_BYTE *)a1, 75);
if ( (_BYTE)result )
{
*(_DWORD *)(a1 + 680) = a2;
v59 = result;
v4 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v58, v4);
sub_100278270((__int64)v57, 0.0, 0.0, (__m128)0x42A00000u, (__m128)0x42A00000u);
v5 = cocos2d::extension::CCScale9Sprite::create_2((__int64)"GJ_square01.png", v57);
sub_100278260((float *)v57, 360.0, 180.0);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v5 + 320LL))(v5, v57);
(*(void (__fastcall **)(_QWORD, void *, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v5,
0xFFFFFFFFLL);
sub_100278250((float *)v57, *(float *)&v58 * 0.5, *((float *)&v58 + 1) * 0.5);
(*(void (__fastcall **)(void *, unsigned __int64 *))(*(_QWORD *)v5 + 184LL))(v5, v57);
v6 = cocos2d::CCLabelBMFont::create_3("Rate Difficulty", "bigFont.fnt");
*(_QWORD *)&v7 = (unsigned int)v58;
*(float *)&v7 = *(float *)&v58 * 0.5;
sub_100278250((float *)v57, *(float *)&v58 * 0.5, (float)((float)(*((float *)&v58 + 1) * 0.5) + 90.0) + -20.0);
(*(void (__fastcall **)(__int64, unsigned __int64 *))(*(_QWORD *)v6 + 184LL))(v6, v57);
v8 = *(_QWORD *)(a1 + 584);
v9 = v6;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v8 + 456LL))(v8, v6);
v10 = sub_1007FE900(v8);
*(_QWORD *)(a1 + 672) = v10;
v11 = v10;
cocos2d::CCObject::retain(v10);
v12 = sub_1007FE900(v11);
v15 = cocos2d::CCMenu::create(v11, v9, v13, v14);
*(_QWORD *)(a1 + 552) = v15;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v15, 10);
v16 = sub_10088E820("difficulty_%02d_btn_001.png", v49);
cocos2d::CCString::getCString(v16);
v17 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"difficulty_auto_btn_001.png", v7);
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v17);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v17 + 160LL))(v17, 1.0);
v18 = CCMenuItemSpriteExtra::create((__int64)v17, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, _QWORD))(*(_QWORD *)v18 + 72LL))(v18, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v18);
sub_1007FEBF0(v12, v18);
v19 = sub_10088E820("difficulty_%02d_btn_001.png", v50);
CString = cocos2d::CCString::getCString(v19);
v21 = cocos2d::CCSprite::createWithSpriteFrameName(CString, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v21);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v21 + 160LL))(v21, 1.0);
v22 = CCMenuItemSpriteExtra::create((__int64)v21, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v22 + 72LL))(v22, 1);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v22);
sub_1007FEBF0(v12, v22);
v23 = sub_10088E820("difficulty_%02d_btn_001.png", v51);
v24 = cocos2d::CCString::getCString(v23);
v25 = cocos2d::CCSprite::createWithSpriteFrameName(v24, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v25);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v25 + 160LL))(v25, 1.0);
v26 = CCMenuItemSpriteExtra::create((__int64)v25, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v26 + 72LL))(v26, 2);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v26);
sub_1007FEBF0(v12, v26);
v27 = sub_10088E820("difficulty_%02d_btn_001.png", v52);
v28 = cocos2d::CCString::getCString(v27);
v29 = cocos2d::CCSprite::createWithSpriteFrameName(v28, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v29);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v29 + 160LL))(v29, 1.0);
v30 = CCMenuItemSpriteExtra::create((__int64)v29, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v30 + 72LL))(v30, 3);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v30);
sub_1007FEBF0(v12, v30);
v31 = sub_10088E820("difficulty_%02d_btn_001.png", v53);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSprite::createWithSpriteFrameName(v32, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v33);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v33 + 160LL))(v33, 1.0);
v34 = CCMenuItemSpriteExtra::create((__int64)v33, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v34 + 72LL))(v34, 4);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v34);
sub_1007FEBF0(v12, v34);
v35 = sub_10088E820("difficulty_%02d_btn_001.png", v54);
v36 = cocos2d::CCString::getCString(v35);
v37 = cocos2d::CCSprite::createWithSpriteFrameName(v36, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v37);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v37 + 160LL))(v37, 1.0);
v38 = CCMenuItemSpriteExtra::create((__int64)v37, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v38 + 72LL))(v38, 5);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v38);
sub_1007FEBF0(v12, v38);
v39 = sub_10088E820("difficulty_%02d_btn_001.png", v55);
v40 = cocos2d::CCString::getCString(v39);
v41 = cocos2d::CCSprite::createWithSpriteFrameName(v40, COERCE_DOUBLE(1065353216));
sub_1007FEBF0(*(_QWORD *)(a1 + 672), v41);
(*(void (__fastcall **)(char *, float))(*(_QWORD *)v41 + 160LL))(v41, 1.0);
v42 = CCMenuItemSpriteExtra::create((__int64)v41, 0, a1, (__int64)RateLevelLayer::selectRating, 0);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v42 + 72LL))(v42, 6);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v42);
sub_1007FEBF0(v12, v42);
v43 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)&v56, *(float *)&v58 * 0.5, *((float *)&v58 + 1) * 0.5);
cocos2d::CCNode::convertToNodeSpace((double *)v57, v43, &v56);
GameToolbox::alignItemsHorisontally(v12, v57, 0, (__m128)0x41800000u);
sub_1007FF190(v12);
v44 = sub_100059E00((__int64)"Cancel");
v45 = CCMenuItemSpriteExtra::create(v44, 0, a1, (__int64)RateLevelLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v45);
sub_1007FEBF0(v12, v45);
v46 = sub_100059E00((__int64)"Submit");
v47 = CCMenuItemSpriteExtra::create(v46, 0, a1, (__int64)RateLevelLayer::onRate, 0);
*(_QWORD *)(a1 + 664) = v47;
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v47);
sub_1007FEBF0(v12, *(_QWORD *)(a1 + 664));
v48 = *(_QWORD *)(a1 + 552);
sub_100278250((float *)&v56, *(float *)&v58 * 0.5, (float)((float)(0.5 * *((float *)&v58 + 1)) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace((double *)v57, v48, &v56);
GameToolbox::alignItemsHorisontally(v12, v57, 0, (__m128)0x41700000u);
RateLevelLayer::selectRating(a1, 0);
return v59;
}
return result;
}