//
// ShareLevelLayer::setupStars from 0x100280e70 to 0x1002811c8 (856 bytes)
//
// 1 xrefs:
// > ShareLevelLayer::init @ 0x100280a74
//
// 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 __fastcall ShareLevelLayer::setupStars(ShareLevelLayer *a1)
{
cocos2d::CCDirector *v2; // rsi
cocos2d::CCArray *v3; // rax
cocos2d::CCArray *v4; // rdi
cocos2d::CCArray *v5; // r15
unsigned int v6; // r12d
cocos2d::CCArray *v7; // rdi
cocos2d::CCMenu *m_buttonMenu; // r13
cocos2d::CCString *v9; // rax
const char *CString; // rax
ButtonSprite *v11; // rax
CCMenuItemSpriteExtra *v12; // r14
cocos2d::CCMenu *v13; // r12
GJGameLevel *m_level; // rdi
bool isPlatformer; // al
const char *v16; // rdx
__int64 v17; // rcx
cocos2d::CCLabelBMFont *v18; // r14
cocos2d::CCSprite *v19; // rax
cocos2d::CCSprite *m_difficultySprite; // r14
char v21; // [rsp+0h] [rbp-70h] BYREF
float v22[2]; // [rsp+8h] [rbp-68h] BYREF
_BYTE v23[8]; // [rsp+10h] [rbp-60h] BYREF
cocos2d::CCArray *v24; // [rsp+18h] [rbp-58h]
_BYTE v25[8]; // [rsp+20h] [rbp-50h] BYREF
char v26; // [rsp+28h] [rbp-48h] BYREF
_BYTE v27[13]; // [rsp+29h] [rbp-47h] BYREF
char v28; // [rsp+36h] [rbp-3Ah]
void *__p; // [rsp+38h] [rbp-38h]
_BYTE v30[48]; // [rsp+40h] [rbp-30h] BYREF
cocos2d::CCPoint v31; // 0:xmm1_8.8
v2 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v22);
v3 = (cocos2d::CCArray *)sub_10071F9E0(v22, v2);
a1->m_starButtons = v3;
v4 = v3;
cocos2d::CCObject::retain(v3);
v5 = (cocos2d::CCArray *)sub_10071F9E0(v4, v2);
v6 = 1;
v24 = (cocos2d::CCArray *)sub_10071F9E0(v4, v2);
do
{
m_buttonMenu = a1->m_buttonMenu;
v9 = (cocos2d::CCString *)sub_1007AB580("%i", v21);
CString = cocos2d::CCString::getCString(v9);
v11 = ButtonSprite::create_1(CString, 20, 0, 0.5, 1, "bigFont.fnt", "GJ_button_01.png", 30.0);
v12 = CCMenuItemSpriteExtra::create(
v11,
nullptr,
a1,
(cocos2d::SEL_MenuHandler)(unsigned __int64)ShareLevelLayer::selectRating);
((void (__fastcall *)(CCMenuItemSpriteExtra *, float))v12->setScale)(v12, 0.80000001);
v12->m_baseScale = 0.80000001;
if ( m_buttonMenu )
((void (__fastcall *)(cocos2d::CCMenu *, CCMenuItemSpriteExtra *))m_buttonMenu->addChild)(m_buttonMenu, v12);
sub_10071FCD0(a1->m_starButtons, v12);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v12->setTag)(v12, v6);
v7 = v24;
if ( v6 < 6 )
v7 = v5;
sub_10071FCD0(v7, v12);
++v6;
}
while ( v6 != 11 );
v31.y = 0.0;
v31.x = (float)((float)((float)(0.5 * v22[1]) + -50.0) + 35.0) + 2.0;
sub_10028CBE0(v23, v22[0] * 0.5, v31.x);
v13 = a1->m_buttonMenu;
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)&v26, (const cocos2d::CCPoint *)a1->m_mainLayer);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)&v21, (const cocos2d::CCPoint *)v13);
sub_10028CC60(&v26);
GameToolbox::alignItemsHorisontally(v5, 18.0, v31, (bool)&v26);
sub_10028CBE0(v30, 0.0, -35.0);
sub_10028CCE0(&v26, &v21);
GameToolbox::alignItemsHorisontally(v24, 18.0, (cocos2d::CCPoint)3255566336LL, (bool)&v26);
m_level = a1->m_level;
a1->m_starsRequested = m_level->m_starsRequested;
isPlatformer = GJGameLevel::isPlatformer(m_level);
v16 = "Request Stars";
if ( isPlatformer )
v16 = "Request Moons";
v26 = 26;
v17 = *(_QWORD *)(v16 + 5);
*(_QWORD *)v27 = *(_QWORD *)v16;
*(_QWORD *)&v27[5] = v17;
v28 = 0;
v18 = cocos2d::CCLabelBMFont::create_3(v27, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v18->setScale)(v18, 0.5);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v18,
2);
sub_10028CBE0(v25, 0.0, 30.0);
sub_10028CCE0(v30, v23);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, _BYTE *))v18->setPosition)(v18, v30);
v19 = cocos2d::CCSprite::createWithSpriteFrameName("difficulty_00_btn_001.png");
a1->m_difficultySprite = v19;
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v19,
3);
m_difficultySprite = a1->m_difficultySprite;
sub_10028CBE0(v25, 155.0, -18.0);
sub_10028CCE0(v30, v23);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *))m_difficultySprite->setPosition)(m_difficultySprite, v30);
ShareLevelLayer::selectRating(a1, nullptr);
if ( (v26 & 1) != 0 )
operator delete(__p);
}