//
// GJRateLevelLayer::selectRating from 0x140560040 to 0x14056027c (572 bytes)
//
// 6 xrefs:
// > RateStarsModLayer::init @ 0x14055ff35
// > RateStarsModLayer::init @ 0x14055f8eb
// > ??> @ 0x1408dafa4
// > ??> @ 0x1408dafe0
// > ??> @ 0x1408daff0
// > ??> @ 0x14092c348
//
// 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:14 +0000
//
// Merged with: GJRateLevelLayer::selectRating, RateStarsModLayer::selectRating
__int64 __fastcall GJRateLevelLayer::selectRating(__int64 a1, __int64 a2)
{
int v3; // eax
int v4; // esi
unsigned int i; // r14d
struct cocos2d::CCObject *v6; // rbx
__int64 v7; // rdi
int v8; // eax
const char *v9; // rdx
__int64 v10; // rcx
char v11; // al
_QWORD *v12; // rbx
__int64 v13; // rcx
__int64 v14; // rcx
__int64 v15; // rcx
int v16; // eax
bool v17; // zf
__int16 v19; // [rsp+50h] [rbp+8h] BYREF
char v20; // [rsp+52h] [rbp+Ah]
if ( a2 )
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
else
v3 = -1;
v4 = 0;
*(_DWORD *)(a1 + 716) = v3;
for ( i = 0; i < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 696)); ++i )
{
v6 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 696), i);
v7 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v6 + 952LL))(v6);
v8 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v6 + 56LL))(v6);
v9 = "GJ_button_04.png";
if ( *(_DWORD *)(a1 + 716) == v8 )
v9 = "GJ_button_01.png";
ButtonSprite::updateBGImage(v7, v9);
}
v10 = *(_QWORD *)(a1 + 688);
if ( *(_DWORD *)(a1 + 716) == -1 )
{
v19 = -22874;
v11 = -90;
}
else
{
v19 = -1;
v11 = -1;
}
v20 = v11;
v12 = (_QWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 952LL))(v10);
v13 = v12[79];
if ( v13 )
(**(void (__fastcall ***)(__int64, __int16 *))(v13 + 368))(v13 + 368, &v19);
v14 = v12[80];
if ( v14 )
(**(void (__fastcall ***)(__int64, __int16 *))(v14 + 320))(v14 + 320, &v19);
v15 = v12[82];
if ( v15 || (v15 = v12[81]) != 0 )
(**(void (__fastcall ***)(__int64, __int16 *))(v15 + 320))(v15 + 320, &v19);
v16 = *(_DWORD *)(a1 + 716);
if ( v16 == 10 )
{
switch ( *(_DWORD *)(a1 + 756) )
{
case 1:
v4 = 7;
goto LABEL_40;
case 2:
v4 = 8;
goto LABEL_40;
case 3:
goto LABEL_37;
case 4:
v4 = 9;
goto LABEL_40;
}
if ( *(_DWORD *)(a1 + 756) != 5 )
{
LABEL_37:
v4 = 6;
goto LABEL_40;
}
v4 = 10;
}
else
{
*(_DWORD *)(a1 + 756) = 0;
v17 = v16 == 1;
if ( v16 <= 1 )
goto LABEL_41;
if ( v16 == 2 )
{
v4 = 1;
}
else if ( v16 == 3 )
{
v4 = 2;
}
else if ( v16 > 5 )
{
if ( v16 > 7 )
{
if ( v16 <= 9 )
v4 = 5;
}
else
{
v4 = 4;
}
}
else
{
v4 = 3;
}
}
LABEL_40:
v17 = v16 == 1;
LABEL_41:
if ( v17 )
v4 = -1;
GJDifficultySprite::updateDifficultyFrame(*(cocos2d::CCArray ***)(a1 + 744), v4, 0);
return RateStarsModLayer::updateDemonRow(a1);
}