//
// SongCell::loadFromObject from 0x614f60 to 0x615438 (1240 bytes)
//
// 2 xrefs:
// > CustomListView::loadCell @ 0x6206bc
// > ??> @ 0x33af8
//
// 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 SongCell::loadFromObject(SongCell *a1, SongObject *a2)
{
unsigned int v4; // w25
cocos2d::CCLabelBMFont *v5; // x19
cocos2d::CCArray **p_m_pTargetArray; // x0
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x26
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
float width; // s0
void (__fastcall *v10)(cocos2d::CCLabelBMFont *__hidden, float); // x26
float v11; // s8
const char *v12; // x6
cocos2d::CCNode *v13; // x26
CCMenuItemSpriteExtra *v14; // x24
cocos2d::CCNode *v15; // x24
cocos2d::CCNode *v16; // x0
float m_width; // s9
const cocos2d::CCSize *(__fastcall *getContentSize)(const cocos2d::CCNode *__hidden); // x1
void (__fastcall *v19)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
float *v20; // x0
cocos2d::CCString *v21; // x0
cocos2d::CCArray **v22; // x0
cocos2d::CCLabelBMFont *v23; // x20
void (__fastcall *v24)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCLabelBMFont *v25; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v27)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
__int64 v28; // x22
float v29; // s0
void (__fastcall *v30)(cocos2d::CCLabelBMFont *__hidden, float); // x19
void (__fastcall *v31)(cocos2d::CCLabelBMFont *__hidden, float); // x19
float *v32; // x0
void (__fastcall *setScale)(cocos2d::CCLabelBMFont *__hidden, float); // x26
float *v34; // x0
unsigned int *v35; // x1
int v36; // w2
unsigned int *p_m_nExtraKerning; // x1
int m_nExtraKerning; // w2
cocos2d::CCPoint v39; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCLabelBMFont *v40; // [xsp+70h] [xbp+70h] BYREF
cocos2d::SEL_MenuHandler v41; // 0:x2.16
a1->m_mainLayer->removeAllChildrenWithCleanup(a1->m_mainLayer, 1);
a1->m_songObject = a2;
v4 = LevelTools::artistForAudio(a2->m_audioID);
LevelTools::getAudioTitle((LevelTools *)(unsigned int)a2->m_audioID, (__int64)&v40);
v5 = cocos2d::CCLabelBMFont::create();
p_m_pTargetArray = &v40[-1].m_pTargetArray;
if ( &v40[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v40[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v40[-1].m_nExtraKerning;
v40[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
a1->m_mainLayer->addChild(a1->m_mainLayer, v5);
setAnchorPoint = v5->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 0.0, 0.5);
setAnchorPoint(v5, (const cocos2d::CCPoint *)&v40);
v5->setScale(v5, 1.0);
setPosition = v5->setPosition;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 10.0, (float)(a1->m_height * 0.5) + 10.0);
setPosition(v5, (const cocos2d::CCPoint *)&v40);
width = v5->getContentSize(v5)->width;
if ( width > 240.0 )
{
setScale = v5->setScale;
v34 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v5->getContentSize)(v5, width);
setScale(v5, 240.0 / *v34);
}
v10 = v5->setScale;
v11 = 0.7;
if ( v5->getScale(v5) <= 0.7 )
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v5->getScale)(v5, 0.7);
((void (__fastcall *)(cocos2d::CCLabelBMFont *))v10)(v5);
v13 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"View",
(const char *)&dword_30 + 2,
0,
0,
0.6,
"bigFont.fnt",
"GJ_button_01.png",
v12,
30.0);
v41.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v41.adj = (size_t)SongCell::onClick;
v14 = CCMenuItemSpriteExtra::create(v13, nullptr, v41);
CCMenuItemSpriteExtra::setSizeMult(v14, 1.5);
v15 = (cocos2d::CCNode *)cocos2d::CCMenu::create((cocos2d::CCMenu *)v14, nullptr);
a1->m_mainLayer->addChild(a1->m_mainLayer, v15);
v16 = v13;
m_width = a1->m_width;
getContentSize = v13->getContentSize;
v19 = v15->setPosition;
v20 = (float *)getContentSize(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, (float)(m_width - (float)(*v20 * 0.5)) - 9.0, a1->m_height * 0.5);
v19(v15, (const cocos2d::CCPoint *)&v40);
LevelTools::nameForArtist((LevelTools *)v4, (__int64)&v40);
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"By %s", (const char *)v40);
cocos2d::CCString::getCString(v21);
v22 = &v40[-1].m_pTargetArray;
if ( &v40[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)&v40[-1].m_nExtraKerning;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = v40[-1].m_nExtraKerning;
v40[-1].m_nExtraKerning = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v22);
}
v23 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v23);
v24 = v23->setAnchorPoint;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v40, 0.0, 0.5);
v24(v23, (const cocos2d::CCPoint *)&v40);
v23->setScale(v23, 1.0);
v25 = v5;
getPosition = v5->getPosition;
v27 = v23->setPosition;
v28 = (__int64)getPosition(v25);
cocos2d::CCPoint::CCPoint(&v39, 2.0, -21.0);
cocos2d::CCPoint::operator+(&v40, v28, &v39);
v27(v23, (const cocos2d::CCPoint *)&v40);
v29 = v23->getContentSize(v23)->width;
if ( v29 > 140.0 )
{
v31 = v23->setScale;
v32 = (float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *, float))v23->getContentSize)(v23, v29);
v31(v23, 140.0 / *v32);
}
v30 = v23->setScale;
if ( v23->getScale(v23) <= 0.7 )
v11 = v23->getScale(v23);
v30(v23, v11);
}