//
// RateDemonLayer::init from 0x100270730 to 0x100270d39 (1545 bytes)
//
// 1 xrefs:
// > sub_100270500 @ 0x1002706cd
//
// 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:27:37 +0000
//
__int64 __fastcall RateDemonLayer::init(__int64 a1, int a2)
{
__int64 result; // rax
__int64 v4; // rdx
__int64 v5; // rdx
__int64 v6; // rax
unsigned int v7; // ecx
char v8; // al
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // r14
const char *v12; // rdi
__int64 v13; // r14
__int64 v14; // rdi
__int64 v15; // rax
__int64 v16; // rdi
__int64 v17; // r14
__int64 v18; // rax
__int64 v19; // rax
__int64 CString; // rax
__int64 v21; // r13
void *v22; // r13
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // r13
void *v26; // r13
__int64 v27; // rax
__int64 v28; // rax
__int64 v29; // r13
void *v30; // r13
__int64 v31; // rax
__int64 v32; // rax
__int64 v33; // r13
void *v34; // r13
__int64 v35; // rax
__int64 v36; // rax
__int64 v37; // r15
void *v38; // r15
__int64 v39; // r15
__int64 v40; // rax
void *v41; // r15
__int64 v42; // rax
void *v43; // rax
__int64 v44; // r15
char v45; // [rsp+0h] [rbp-50h]
char v46; // [rsp+0h] [rbp-50h]
char v47; // [rsp+0h] [rbp-50h]
char v48; // [rsp+0h] [rbp-50h]
char v49; // [rsp+0h] [rbp-50h]
unsigned int v50; // [rsp+4h] [rbp-4Ch] BYREF
double v51[2]; // [rsp+Ch] [rbp-44h] BYREF
float v52; // [rsp+1Ch] [rbp-34h] BYREF
float v53; // [rsp+20h] [rbp-30h]
unsigned __int8 v54; // [rsp+27h] [rbp-29h]
result = FLAlertLayer::init_1(a1, 75);
if ( (_BYTE)result )
{
v54 = result;
GameManager::sharedState(a1, 75, v4);
v7 = *(_DWORD *)(v6 + 1036) - *(_DWORD *)(v6 + 1032);
v8 = 1;
if ( v7 <= 0xFFFFFFFD )
{
GameManager::sharedState(a1, 75, v5);
v8 = *(_BYTE *)(v9 + 1044);
}
*(_BYTE *)(a1 + 720) = v8;
*(_DWORD *)(a1 + 712) = a2;
*(_DWORD *)(a1 + 716) = -1;
v10 = cocos2d::CCDirector::sharedDirector(a1, 75);
cocos2d::CCDirector::getWinSize(&v52, v10);
sub_100278270(v51, 0.0, 0.0, COERCE_DOUBLE(1117782016), COERCE_DOUBLE(1117782016));
v11 = cocos2d::extension::CCScale9Sprite::create_2("GJ_square01.png", v51);
sub_100278260(v51, COERCE_DOUBLE(1136525312), COERCE_DOUBLE(1127481344));
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v11 + 320LL))(v11, v51);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v11,
0xFFFFFFFFLL);
sub_100278250(v51, v52 * 0.5, v53 * 0.5);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v11 + 184LL))(v11, v51);
v12 = "Rate Demon";
if ( *(_BYTE *)(a1 + 720) )
v12 = "Advisor: Rate Demon";
v13 = cocos2d::CCLabelBMFont::create_3(v12, "bigFont.fnt");
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v13 + 160LL))(v13, 0.89999998);
sub_100278250(v51, v52 * 0.5, (float)((float)(v53 * 0.5) + 90.0) + -20.0);
(*(void (__fastcall **)(__int64, double *))(*(_QWORD *)v13 + 184LL))(v13, v51);
v14 = *(_QWORD *)(a1 + 584);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 456LL))(v14, v13);
v15 = sub_1007FE900(v14);
*(_QWORD *)(a1 + 696) = v15;
v16 = v15;
cocos2d::CCObject::retain(v15);
v17 = sub_1007FE900(v16);
v18 = cocos2d::CCMenu::create();
*(_QWORD *)(a1 + 552) = v18;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v18, 10);
v19 = sub_10088E820("difficulty_%02d_btn2_001.png", v45);
CString = cocos2d::CCString::getCString(v19);
v21 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
(*(void (__fastcall **)(__int64, __int64, float))(*(_QWORD *)v21 + 160LL))(v21, 7, 1.1);
v22 = CCMenuItemSpriteExtra::create(v21, 0, a1, (__int64)RateDemonLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v22);
sub_1007FEBF0(*(_QWORD *)(a1 + 696), v22);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v22 + 72LL))(v22, 1);
sub_1007FEBF0(v17, v22);
v23 = sub_10088E820("difficulty_%02d_btn2_001.png", v46);
v24 = cocos2d::CCString::getCString(v23);
v25 = cocos2d::CCSprite::createWithSpriteFrameName(v24);
(*(void (__fastcall **)(__int64, __int64, float))(*(_QWORD *)v25 + 160LL))(v25, 8, 1.1);
v26 = CCMenuItemSpriteExtra::create(v25, 0, a1, (__int64)RateDemonLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v26);
sub_1007FEBF0(*(_QWORD *)(a1 + 696), v26);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v26 + 72LL))(v26, 2);
sub_1007FEBF0(v17, v26);
v27 = sub_10088E820("difficulty_%02d_btn2_001.png", v47);
v28 = cocos2d::CCString::getCString(v27);
v29 = cocos2d::CCSprite::createWithSpriteFrameName(v28);
(*(void (__fastcall **)(__int64, __int64, float))(*(_QWORD *)v29 + 160LL))(v29, 6, 1.1);
v30 = CCMenuItemSpriteExtra::create(v29, 0, a1, (__int64)RateDemonLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v30);
sub_1007FEBF0(*(_QWORD *)(a1 + 696), v30);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v30 + 72LL))(v30, 3);
sub_1007FEBF0(v17, v30);
v31 = sub_10088E820("difficulty_%02d_btn2_001.png", v48);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCSprite::createWithSpriteFrameName(v32);
(*(void (__fastcall **)(__int64, __int64, float))(*(_QWORD *)v33 + 160LL))(v33, 9, 1.1);
v34 = CCMenuItemSpriteExtra::create(v33, 0, a1, (__int64)RateDemonLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v34);
sub_1007FEBF0(*(_QWORD *)(a1 + 696), v34);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v34 + 72LL))(v34, 4);
sub_1007FEBF0(v17, v34);
v35 = sub_10088E820("difficulty_%02d_btn2_001.png", v49);
v36 = cocos2d::CCString::getCString(v35);
v37 = cocos2d::CCSprite::createWithSpriteFrameName(v36);
(*(void (__fastcall **)(__int64, __int64, float))(*(_QWORD *)v37 + 160LL))(v37, 10, 1.1);
v38 = CCMenuItemSpriteExtra::create(v37, 0, a1, (__int64)RateDemonLayer::selectRating, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v38);
sub_1007FEBF0(*(_QWORD *)(a1 + 696), v38);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v38 + 72LL))(v38, 5);
sub_1007FEBF0(v17, v38);
v39 = *(_QWORD *)(a1 + 552);
sub_100278250(&v50, v52 * 0.5, (float)(v53 * 0.5) + 3.0);
cocos2d::CCNode::convertToNodeSpace(v51, v39, &v50);
GameToolbox::alignItemsHorisontally(v17, v51, 0, 18.0);
sub_1007FF190(v17);
v40 = sub_100059E00((__int64)"Cancel");
v41 = CCMenuItemSpriteExtra::create(v40, 0, a1, (__int64)RateDemonLayer::onClose, 0);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v41);
sub_1007FEBF0(v17, v41);
v42 = sub_100059E00((__int64)"Submit");
v43 = CCMenuItemSpriteExtra::create(v42, 0, a1, (__int64)RateDemonLayer::onRate, 0);
*(_QWORD *)(a1 + 688) = v43;
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v43);
sub_1007FEBF0(v17, *(_QWORD *)(a1 + 688));
v44 = *(_QWORD *)(a1 + 552);
sub_100278250(&v50, v52 * 0.5, (float)((float)(0.5 * v53) + -90.0) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v51, v44, &v50);
GameToolbox::alignItemsHorisontally(v17, v51, 0, 15.0);
RateDemonLayer::selectRating(a1, 0);
return v54;
}
return result;
}