//
// ShareLevelLayer::selectRating from 0x14048ff90 to 0x140490119 (393 bytes)
//
// 5 xrefs:
// > ShareLevelLayer::setupStars @ 0x14048ff3e
// > ShareLevelLayer::setupStars @ 0x14048fcb8
// > ??> @ 0x1406a6e34
// > ??> @ 0x1406a6e68
// > ??> @ 0x1406dc038
//
// 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)
{
int *p_m_starsRequested; // r14
int v4; // esi
unsigned int v5; // r15d
struct cocos2d::CCObject *v6; // rbx
ButtonSprite *v7; // rdi
int v8; // eax
const char *v9; // rdx
int v10; // eax
const char *CString; // rdi
cocos2d::CCString *v12; // rax
cocos2d::CCSprite *m_difficultySprite; // rcx
cocos2d::CCSprite_vtbl *v14; // rbx
cocos2d::CCSpriteFrameCache *v15; // rax
struct cocos2d::CCSpriteFrame *v16; // rax
p_m_starsRequested = &a1->m_starsRequested;
if ( a2 )
*p_m_starsRequested = a2->getTag(a2);
v4 = 0;
v5 = 0;
if ( cocos2d::CCArray::count(a1->m_starButtons) )
{
do
{
v6 = cocos2d::CCArray::objectAtIndex(a1->m_starButtons, v5);
v7 = (ButtonSprite *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v6->__vftable[13].copyWithZone)(v6);
v8 = v6->getTag(v6);
v9 = "GJ_button_04.png";
if ( *p_m_starsRequested == v8 )
v9 = "GJ_button_01.png";
ButtonSprite::updateBGImage(v7, v9);
++v5;
}
while ( v5 < cocos2d::CCArray::count(a1->m_starButtons) );
p_m_starsRequested = &a1->m_starsRequested;
}
a1->m_level->m_starsRequested = *p_m_starsRequested;
v10 = *p_m_starsRequested;
if ( *p_m_starsRequested > 1 )
{
if ( v10 == 2 )
{
v4 = 1;
}
else if ( v10 == 3 )
{
v4 = 2;
}
else if ( v10 > 5 )
{
if ( v10 > 7 )
{
if ( v10 > 9 )
{
if ( v10 == 10 )
v4 = 6;
}
else
{
v4 = 5;
}
}
else
{
v4 = 4;
}
}
else
{
v4 = 3;
}
goto LABEL_23;
}
if ( v10 != 1 )
{
LABEL_23:
v12 = cocos2d::CCString::createWithFormat("difficulty_%02d_btn_001.png", v4);
CString = cocos2d::CCString::getCString(v12);
goto LABEL_24;
}
CString = "difficulty_auto_btn_001.png";
LABEL_24:
m_difficultySprite = a1->m_difficultySprite;
v14 = m_difficultySprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v15 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(m_difficultySprite);
v16 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v15, CString);
v14->setDisplayFrame(a1->m_difficultySprite, v16);
}