//
// SongCell::loadFromObject from 0x100246da0 to 0x10024715a (954 bytes)
//
// 1 xrefs:
// > CustomListView::loadCell @ 0x1002425c6
//
// 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 SongCell::loadFromObject(SongCell *a1, SongObject *a2)
{
unsigned int v3; // r15d
const char *v4; // rdi
cocos2d::CCLabelBMFont *v5; // r14
float *v6; // rax
double v7; // xmm0_8
ButtonSprite *v8; // r12
CCMenuItemSpriteExtra *v9; // rax
int v10; // r13d
int v11; // edx
int v12; // ecx
int v13; // r8d
int v14; // r9d
__int64 v15; // r13
float v16; // xmm2_4
cocos2d::CCString *v17; // rax
const char *CString; // r15
cocos2d::CCLabelBMFont *v19; // r15
__int64 v20; // rbx
float *v21; // rax
double v22; // xmm0_8
char v23; // [rsp+0h] [rbp-50h]
_BYTE v24[8]; // [rsp+4h] [rbp-4Ch] BYREF
float m_width; // [rsp+Ch] [rbp-44h]
char v26; // [rsp+10h] [rbp-40h] BYREF
char v27; // [rsp+11h] [rbp-3Fh] BYREF
void *__p; // [rsp+20h] [rbp-30h]
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_mainLayer->removeAllChildrenWithCleanup)(a1->m_mainLayer, 1);
a1->m_songObject = a2;
v3 = LevelTools::artistForAudio(a2->m_audioID);
LevelTools::getAudioTitle(&v26, (unsigned int)a2->m_audioID);
if ( (v26 & 1) != 0 )
v4 = (const char *)__p;
else
v4 = &v27;
v5 = cocos2d::CCLabelBMFont::create_3(v4, "bigFont.fnt");
if ( (v26 & 1) != 0 )
operator delete(__p);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v5);
sub_10028CBE0(&v26, 0.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v5->setAnchorPoint)(v5, &v26);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v5->setScale)(v5, 1.0);
sub_10028CBE0(&v26, 10.0, (float)(a1->m_height * 0.5) + 10.0);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v5->setPosition)(v5, &v26);
if ( *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getContentSize)(v5) > 240.0 )
{
v6 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getContentSize)(v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v5->setScale)(v5, 240.0 / *v6);
}
v7 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getScale)(v5);
if ( *(float *)&v7 <= 0.69999999 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getScale)(v5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v5->setScale)(v5);
v8 = ButtonSprite::create_1("View", 50, 0, 0.60000002, 0, "bigFont.fnt", "GJ_button_01.png", 30.0);
v9 = CCMenuItemSpriteExtra::create(v8, nullptr, a1, (cocos2d::SEL_MenuHandler)(unsigned __int64)SongCell::onClick);
v10 = (int)v9;
CCMenuItemSpriteExtra::setSizeMult(v9, 1.5);
v15 = sub_100792C50(v10, 0, v11, v12, v13, v14);
((void (__fastcall *)(cocos2d::CCLayer *, __int64))a1->m_mainLayer->addChild)(a1->m_mainLayer, v15);
m_width = a1->m_width;
v16 = (float)(m_width - (float)(*(float *)((__int64 (__fastcall *)(ButtonSprite *))v8->getContentSize)(v8) * 0.5))
+ -9.0;
sub_10028CBE0(&v26, v16, 0.5 * a1->m_height);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v15 + 184LL))(v15, &v26);
LevelTools::nameForArtist(&v26, v3);
v17 = (cocos2d::CCString *)sub_1007AB580("By %s", v23);
CString = cocos2d::CCString::getCString(v17);
if ( (v26 & 1) != 0 )
operator delete(__p);
v19 = cocos2d::CCLabelBMFont::create_3(CString, "goldFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *))a1->m_mainLayer->addChild)(a1->m_mainLayer, v19);
sub_10028CBE0(&v26, 0.0, 0.5);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v19->setAnchorPoint)(v19, &v26);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v19->setScale)(v19, 1.0);
v20 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v5->getPosition)(v5);
sub_10028CBE0(v24, 2.0, -21.0);
sub_10028CCE0(&v26, v20);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *))v19->setPosition)(v19, &v26);
if ( *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v19->getContentSize)(v19) > 140.0 )
{
v21 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))v19->getContentSize)(v19);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v19->setScale)(v19, 140.0 / *v21);
}
v22 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))v19->getScale)(v19);
if ( *(float *)&v22 <= 0.69999999 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v19->getScale)(v19);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v19->setScale)(v19);
}