//
// GJRateLevelLayer::selectRating from 0x82029c to 0x820440 (420 bytes)
//
// 4 xrefs:
// > GJRateLevelLayer::init @ 0x8232c8
// > ??> @ 0x5ed58
// > GJRateLevelLayer::init @ 0x822d4c
// > ??> @ 0x122b110
//
// 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
//
void GJRateLevelLayer::selectRating(GJRateLevelLayer *a1, cocos2d::CCObject *a2)
{
unsigned int i; // w19
__int64 v4; // x20
__int64 v5; // x22
__int64 v6; // x1
__int64 v7; // x0
const char *v8; // x1
ButtonSprite *v9; // x0
__int64 (*getNormalImage)(void); // x1
ButtonSprite *v11; // x0
int m_stars; // w0
bool v13; // zf
int v14; // w1
GJDifficultySprite *m_difficultySprite; // x0
ButtonSprite *v16; // x0
if ( a2 )
a1->m_stars = a2->getTag(a2);
else
a1->m_stars = -1;
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(a1->m_starButtons); ++i )
{
v4 = cocos2d::CCArray::objectAtIndex(a1->m_starButtons, i);
v5 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v4 + 1056LL))(v4);
v6 = *(_QWORD *)v4;
v7 = v4;
LODWORD(v4) = a1->m_stars;
v13 = (_DWORD)v4 == (*(unsigned int (__fastcall **)(__int64))(v6 + 64))(v7);
v8 = "GJ_button_04.png";
v9 = (ButtonSprite *)v5;
if ( v13 )
{
v9 = (ButtonSprite *)v5;
v8 = "GJ_button_01.png";
}
ButtonSprite::updateBGImage(v9, v8);
}
getNormalImage = (__int64 (*)(void))a1->m_submitButton->getNormalImage;
if ( a1->m_stars == -1 )
{
v16 = (ButtonSprite *)getNormalImage();
ButtonSprite::setColor(v16, (cocos2d::ccColor3B)-5855578);
}
else
{
v11 = (ButtonSprite *)getNormalImage();
ButtonSprite::setColor(v11, (cocos2d::ccColor3B)&unk_FFFFFF);
}
m_stars = a1->m_stars;
v13 = m_stars == 1;
if ( m_stars <= 1 )
{
m_difficultySprite = a1->m_difficultySprite;
if ( v13 )
v14 = -1;
else
v14 = 0;
}
else if ( m_stars == 2 )
{
v14 = 1;
m_difficultySprite = a1->m_difficultySprite;
}
else if ( m_stars == 3 )
{
v14 = 2;
m_difficultySprite = a1->m_difficultySprite;
}
else
{
v14 = 3;
if ( m_stars > 5 && (v14 = 4, m_stars > 7) && (v14 = 5, m_stars > 9) )
{
if ( m_stars == 10 )
v14 = 6;
else
v14 = 0;
m_difficultySprite = a1->m_difficultySprite;
}
else
{
m_difficultySprite = a1->m_difficultySprite;
}
}
GJDifficultySprite::updateDifficultyFrame(m_difficultySprite, v14, Short);
}