//
// LevelInfoLayer::onRateStars from 0x1402fe220 to 0x1402fe4d4 (692 bytes)
//
// 3 xrefs:
// > LevelInfoLayer::FLAlert_Clicked @ 0x14030055b
// > LevelInfoLayer::init @ 0x1402f84fc
// > ??> @ 0x1406d4274
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=5
void LevelInfoLayer::onRateStars(LevelInfoLayer *a1, cocos2d::CCObject *a2)
{
__int64 v3; // rdx
GameLevelManager *v4; // rcx
_QWORD *v5; // rax
_QWORD *v6; // rcx
const char *v7; // rdx
__int64 v8; // r8
__int64 v9; // rax
FLAlertLayer *v10; // rbx
RateStarsLayer *v11; // rax
__int128 v12; // [rsp+50h] [rbp-48h] BYREF
__int64 v13; // [rsp+60h] [rbp-38h]
__int64 v14; // [rsp+68h] [rbp-30h]
_BYTE v15[40]; // [rsp+70h] [rbp-28h] BYREF
void *v16; // [rsp+A0h] [rbp+8h]
void *v17; // [rsp+A0h] [rbp+8h]
void *v18; // [rsp+A0h] [rbp+8h]
if ( !a1->m_isBusy )
{
v3 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v16 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = qword_1406C2ED8;
}
if ( *(_DWORD *)(v3 + 652) == *(_DWORD *)(v3 + 656) )
{
v4 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v17 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v4 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::updateUserScore(v4);
v3 = qword_1406C2ED8;
}
if ( !v3 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v3 = qword_1406C2ED8;
}
if ( *(_BYTE *)(v3 + 925) )
{
v11 = RateStarsLayer::create(
a1->m_level->m_levelID.random - a1->m_level->m_levelID.seed,
a1->m_level->m_levelLength == 5,
0);
v11->m_delegate = &a1->RateLevelDelegate;
v11->show(v11);
}
else
{
*(_BYTE *)(v3 + 925) = 1;
v12 = 0;
v5 = sub_14003AA10(0x140u);
*(_QWORD *)&v12 = v5;
v13 = 314;
v14 = 319;
v6 = v5;
v7 = "Auto: 1 Star or Moon\n"
"Easy: 2 Stars or Moons\n"
"Normal: 3 Stars or Moons\n"
"Hard: 4 to 5 Stars or Moons\n"
"Harder: 6 to 7 Stars or Moons\n"
"Insane: 8 to 9 Stars or Moons\n"
"Demon: 10 Stars or Moons\n"
"(These values are not assigned before a rating is manually given by RobTop.)";
v8 = 2;
do
{
*(_OWORD *)v6 = *(_OWORD *)v7;
*((_OWORD *)v6 + 1) = *((_OWORD *)v7 + 1);
*((_OWORD *)v6 + 2) = *((_OWORD *)v7 + 2);
*((_OWORD *)v6 + 3) = *((_OWORD *)v7 + 3);
*((_OWORD *)v6 + 4) = *((_OWORD *)v7 + 4);
*((_OWORD *)v6 + 5) = *((_OWORD *)v7 + 5);
*((_OWORD *)v6 + 6) = *((_OWORD *)v7 + 6);
v6 += 16;
*((_OWORD *)v6 - 1) = *((_OWORD *)v7 + 7);
v7 += 128;
--v8;
}
while ( v8 );
*(_OWORD *)v6 = *(_OWORD *)v7;
*((_OWORD *)v6 + 1) = *((_OWORD *)v7 + 1);
*((_OWORD *)v6 + 2) = *((_OWORD *)v7 + 2);
v6[6] = *((_QWORD *)v7 + 6);
*((_WORD *)v6 + 28) = *((_WORD *)v7 + 28);
*((_BYTE *)v5 + 314) = 0;
v9 = sub_14003BDB0((__int64)v15, (__int64)&v12);
v10 = FLAlertLayer::create((int)a1 + 440, (int)"Rating guide", v9, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003A830((__int64)&v12);
v10->setTag(v10, 8);
v10->show(v10);
}
}
}