//
// ShareLevelLayer::selectRating from 0x6e34e4 to 0x6e3664 (384 bytes)
//
// 4 xrefs:
// > ShareLevelLayer::setupStars @ 0x6e40b8
// > ??> @ 0xa4088
// > ShareLevelLayer::setupStars @ 0x6e3e94
// > ??> @ 0x122dac0
//
// 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 ShareLevelLayer::selectRating(ShareLevelLayer *a1, cocos2d::CCObject *a2)
{
unsigned int i; // w19
__int64 v4; // x20
__int64 v5; // x22
__int64 v6; // x1
__int64 v7; // x0
bool v8; // zf
const char *v9; // x1
ButtonSprite *v10; // x0
int m_starsRequested; // w0
const char *v12; // x1
cocos2d::CCString *v13; // x0
const char *CString; // x1
cocos2d::CCSprite *m_difficultySprite; // x19
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x20
cocos2d::CCSpriteFrameCache *v17; // x0
cocos2d::CCSpriteFrame *v18; // x0
char *v19; // [xsp+48h] [xbp+48h]
if ( a2 )
a1->m_starsRequested = a2->getTag(a2);
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_starsRequested;
v8 = (_DWORD)v4 == (*(unsigned int (__fastcall **)(__int64))(v6 + 64))(v7);
v9 = "GJ_button_04.png";
v10 = (ButtonSprite *)v5;
if ( v8 )
{
v10 = (ButtonSprite *)v5;
v9 = "GJ_button_01.png";
}
ButtonSprite::updateBGImage(v10, v9);
}
a1->m_level->m_starsRequested = a1->m_starsRequested;
m_starsRequested = a1->m_starsRequested;
if ( m_starsRequested <= 1 )
{
CString = "difficulty_auto_btn_001.png";
if ( m_starsRequested == 1 )
goto LABEL_15;
LABEL_17:
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
nullptr);
goto LABEL_14;
}
if ( m_starsRequested == 2 )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
(_BYTE *)&dword_0 + 1);
goto LABEL_14;
}
if ( m_starsRequested == 3 )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
(_BYTE *)&dword_0 + 2);
goto LABEL_14;
}
v12 = (char *)&dword_0 + 3;
if ( m_starsRequested > 5 )
{
v12 = &byte_4;
if ( m_starsRequested > 7 )
{
v12 = &byte_5;
if ( m_starsRequested > 9 )
{
if ( m_starsRequested == 10 )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
&byte_6);
goto LABEL_14;
}
goto LABEL_17;
}
}
}
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"difficulty_%02d_btn_001.png",
v12);
LABEL_14:
CString = cocos2d::CCString::getCString(v13);
LABEL_15:
m_difficultySprite = a1->m_difficultySprite;
v19 = (char *)CString;
setDisplayFrame = m_difficultySprite->setDisplayFrame;
v17 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v18 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v17, v19);
setDisplayFrame(m_difficultySprite, v18);
}