//
// sub_1002778C0 from 0x1002778c0 to 0x100277a09 (329 bytes)
//
// 7 xrefs:
// > RateStarsLayer::init @ 0x100277780
// > RateStarsLayer::init @ 0x100277019
// > RateStarsLayer::init @ 0x1002770e3
// > RateStarsLayer::init @ 0x1002771ad
// > RateStarsLayer::init @ 0x100277277
// > RateStarsLayer::init @ 0x100277341
// > RateStarsLayer::init @ 0x1002773c0
//
// 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:39 +0000
//
__int64 __fastcall sub_1002778C0(__int64 a1, __int64 a2)
{
int v2; // eax
unsigned int v3; // r14d
__int64 v4; // r15
__int64 v5; // r12
int v6; // r13d
const char *v7; // rsi
int v8; // r14d
_QWORD *v9; // rax
unsigned int v10; // eax
__int64 v11; // rcx
__int64 v12; // rsi
if ( a2 )
v2 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
else
v2 = -1;
*(_DWORD *)(a1 + 708) = v2;
if ( (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 696)) )
{
v3 = 0;
do
{
v4 = sub_1007FEFE0(*(_QWORD *)(a1 + 696), v3);
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 1072LL))(v4);
v6 = *(_DWORD *)(a1 + 708);
v7 = "GJ_button_04.png";
if ( v6 == (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v4 + 64LL))(v4) )
v7 = "GJ_button_01.png";
ButtonSprite::updateBGImage(v5, (__int64)v7);
++v3;
}
while ( v3 < (unsigned int)sub_1007FEF90(*(_QWORD *)(a1 + 696)) );
}
v8 = *(_DWORD *)(a1 + 708) != -1;
v9 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 688) + 1072LL))(*(_QWORD *)(a1 + 688));
ButtonSprite::setColor(v9, -v8 | 0xFFA6A6A6);
v10 = *(_DWORD *)(a1 + 708);
v11 = 0;
if ( (int)v10 >= 2 )
{
if ( v10 == 2 )
{
v11 = 1;
}
else if ( v10 == 3 )
{
v11 = 2;
}
else
{
v11 = 3;
if ( v10 >= 6 )
{
v11 = 4;
if ( v10 >= 8 )
{
v11 = 5;
if ( v10 >= 0xA )
{
v11 = 6;
if ( v10 != 10 )
v11 = 0;
}
}
}
}
}
v12 = 0xFFFFFFFFLL;
if ( v10 != 1 )
v12 = (unsigned int)v11;
return GJDifficultySprite::updateDifficultyFrame(*(_QWORD *)(a1 + 736), v12, 0, v11);
}