//
// CustomSongWidget::updateSongInfo from 0x3de124 to 0x3deab8 (2452 bytes)
//
// 10 xrefs:
// > CustomSongWidget::updateSongObject @ 0x3deb4a
// > CustomSongWidget::init @ 0x3df72e
// > CustomSongWidget::getSongInfoIfUnloaded @ 0x3df936
// > CustomSongWidget::downloadFailed @ 0x3df99e
// > CustomSongWidget::onSelect @ 0x3df9d0
// > CustomSongWidget::updateDownloadProgress @ 0x3dfa28
// > CustomSongWidget::songStateChanged @ 0x3dfa40
// > CustomSongWidget::updateLengthMod @ 0x3dfa5a
// > CustomSongWidget::deleteSong @ 0x3dfac4
// > CustomSongWidget::updateMultiAssetInfo @ 0x3dfde2
//
// 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 CustomSongWidget::updateSongInfo(CustomSongWidget *a1)
{
cocos2d::CCLabelBMFont *m_songLabel; // r8
void (__fastcall *v3)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // r10
int v4; // r8
cocos2d::CCString *v5; // r0
char *v6; // r0
SongInfoObject *v7; // r0
int v8; // r2
cocos2d::CCString *v9; // r0
char *v10; // r0
SongInfoObject *v11; // r3
cocos2d::CCString *v12; // r0
const unsigned __int8 *v13; // r0
float m_lengthMod; // s15
SongInfoObject *v15; // r3
int v16; // r0
cocos2d::CCString *v17; // r0
char *v18; // r0
cocos2d::CCPoint *v19; // r0
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // r10
SongInfoObject *m_songInfoObject; // r0
int ExtraArtistCount; // r2
cocos2d::CCString *v23; // r0
char *CString; // r0
SongInfoObject *v25; // r3
int m_duration; // r1
float m_fileSize; // s15
cocos2d::CCString *v28; // r0
char *v29; // r0
_BOOL4 m_hasSFX; // r9
void *m_deleteBtn; // r0
SongInfoObject *v32; // r8
int m_songID; // r10
MusicDownloadManager *v34; // r0
_BOOL4 m_showDownloadBtn; // r1
CCMenuItemSpriteExtra *v36; // r11
void (__fastcall *setVisible)(cocos2d::CCNode *__hidden, bool); // r8
CCMenuItemSpriteExtra *m_selectSongBtn; // r0
cocos2d::CCNode *v39; // r8
int v40; // r0
void (*setEnabled)(void); // r3
void (__fastcall *setSkewY)(cocos2d::CCNode *__hidden, float); // r9
cocos2d::CCSpriteFrameCache *v43; // r0
const char *v44; // r1
cocos2d::CCSpriteFrame *v45; // r0
void (*v46)(void); // r3
_BOOL4 m_isRobtopSong; // r9
MusicDownloadManager *v48; // r0
_BOOL4 v49; // r8
_BOOL4 v50; // r1
_BOOL4 v51; // r1
void *m_sliderGroove; // r0
int m_isMusicLibrary; // r8
int (*isVisible)(void); // r3
cocos2d::CCLabelBMFont *v55; // r0
float v56; // r1
float v57; // r2
const cocos2d::CCPoint *v58; // r0
CCMenuItemSpriteExtra *v59; // r9
cocos2d::CCNode *v60; // r11
float v61; // s16
float v62; // r0
SongInfoObject *v63; // r3
float v64; // s16
float v65; // s17
float width; // s18
float v67; // s15
float v68; // s17
float v69; // s17
float v70; // s18
int v71; // r0
CCMenuItemSpriteExtra *m_moreBtn; // r9
float v73; // s15
cocos2d::CCNode *v74; // r11
cocos2d::CCNode *v75; // r10
cocos2d::CCLabelBMFont *m_artistLabel; // r6
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r7
cocos2d::CCLabelBMFont *v78; // r6
void (__fastcall *v79)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
float v80; // s17
const cocos2d::CCSize *v81; // r0
char *m_BPM; // [sp+Ch] [bp-20h]
char *v83; // [sp+Ch] [bp-20h]
char *setPosition; // [sp+Ch] [bp-20h]
const cocos2d::CCPoint *v85; // [sp+14h] [bp-18h]
cocos2d::CCPoint v86; // [sp+1Ch] [bp-10h] BYREF
cocos2d::CCPoint v87; // [sp+24h] [bp-8h] BYREF
cocos2d::CCPoint v88; // [sp+2Ch] [bp+0h] BYREF
cocos2d::CCPoint v89; // [sp+34h] [bp+8h] BYREF
CustomSongWidget::positionInfoObjects(a1);
m_songLabel = a1->m_songLabel;
if ( a1->m_songInfoObject )
{
if ( a1->m_isMusicLibrary )
{
setString = m_songLabel->setString;
sub_775C20(&v89);
setString(m_songLabel, (const unsigned __int8 *)LODWORD(v89.x));
sub_774008(&v89);
sub_775C20(&v87);
m_songInfoObject = a1->m_songInfoObject;
if ( m_songInfoObject->m_artistIDs._M_h._M_element_count )
{
ExtraArtistCount = SongInfoObject::getExtraArtistCount(m_songInfoObject);
if ( ExtraArtistCount > 0 )
{
v23 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s +%i",
(const char *)LODWORD(v87.x),
ExtraArtistCount);
CString = (char *)cocos2d::CCString::getCString(v23);
sub_7753D4((int)&v87, CString);
}
}
a1->m_artistLabel->setString(a1->m_artistLabel, (const unsigned __int8 *)LODWORD(v87.x));
if ( a1->m_hasSFX )
goto LABEL_36;
v25 = a1->m_songInfoObject;
m_duration = v25->m_duration;
m_fileSize = v25->m_fileSize;
LODWORD(v88.x) = &unk_ACDDA8;
if ( m_duration <= 0 )
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"ID: %i Size: %.01fMB",
(const char *)v25->m_songID,
m_fileSize);
else
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"ID: %i Size: %.01fMB (%is)",
(const char *)v25->m_songID,
m_fileSize,
m_duration);
v29 = (char *)cocos2d::CCString::getCString(v28);
sub_7753D4((int)&v88, v29);
SongInfoObject::getTagsString((SongInfoObject *)&v89, (bool)a1->m_songInfoObject);
if ( *(_DWORD *)(LODWORD(v89.x) - 12) )
{
sub_774544((int)&v88, " ");
sub_77441C(&v88, &v89);
}
a1->m_songIDLabel->setString(a1->m_songIDLabel, (const unsigned __int8 *)LODWORD(v88.x));
sub_774008(&v89);
v19 = &v88;
}
else
{
v3 = m_songLabel->setString;
sub_775C20(&v89);
v3(m_songLabel, (const unsigned __int8 *)LODWORD(v89.x));
sub_774008(&v89);
sub_776584((int)&v87, (char *)&unk_939830);
sub_775C20(&v88);
v4 = *(_DWORD *)(LODWORD(v88.x) - 12);
sub_774008(&v88);
if ( v4 )
{
sub_775C20(&v89);
v5 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"By: %s",
(const char *)LODWORD(v89.x));
v6 = (char *)cocos2d::CCString::getCString(v5);
sub_7753D4((int)&v87, v6);
sub_774008(&v89);
}
v7 = a1->m_songInfoObject;
if ( v7->m_artistIDs._M_h._M_element_count )
{
v8 = SongInfoObject::getExtraArtistCount(v7);
if ( v8 > 0 )
{
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s +%i",
(const char *)LODWORD(v87.x),
v8);
v10 = (char *)cocos2d::CCString::getCString(v9);
sub_7753D4((int)&v87, v10);
}
}
a1->m_artistLabel->setString(a1->m_artistLabel, (const unsigned __int8 *)LODWORD(v87.x));
if ( a1->m_hasSFX )
goto LABEL_36;
if ( a1->m_isRobtopSong )
{
a1->m_songIDLabel->setString(a1->m_songIDLabel, (const unsigned __int8 *)&unk_939830);
LABEL_36:
sub_774008(&v87);
goto LABEL_37;
}
v11 = a1->m_songInfoObject;
if ( v11->m_unloaded )
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"SongID: %i",
(const char *)v11->m_songID);
else
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"SongID: %i Size: %.02fMB",
(const char *)v11->m_songID,
v11->m_fileSize);
v13 = (const unsigned __int8 *)cocos2d::CCString::getCString(v12);
a1->m_songIDLabel->setString(a1->m_songIDLabel, v13);
if ( a1->m_songInfoObject->m_BPM <= 0 )
goto LABEL_36;
a1->m_errorLabel->setColor(a1->m_errorLabel, (const cocos2d::ccColor3B *)&unk_9AAD36);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))a1->m_errorLabel->setScale)(a1->m_errorLabel, 1053609165);
m_lengthMod = a1->m_lengthMod;
LODWORD(v89.x) = &unk_ACDDA8;
v15 = a1->m_songInfoObject;
if ( m_lengthMod <= 0.0 || m_lengthMod == 1.0 )
{
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"BPM: %i",
(const char *)v15->m_BPM);
}
else
{
m_BPM = (char *)v15->m_BPM;
v16 = lroundf();
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"BPM: %i (%i)", m_BPM, v16);
}
v18 = (char *)cocos2d::CCString::getCString(v17);
sub_7753D4((int)&v89, v18);
a1->m_errorLabel->setString(a1->m_errorLabel, (const unsigned __int8 *)LODWORD(v89.x));
CustomSongWidget::showError(a1, 0);
v19 = &v89;
}
sub_774008(v19);
goto LABEL_36;
}
m_songLabel->setString(a1->m_songLabel, "No song loaded");
a1->m_artistLabel->setString(a1->m_artistLabel, (const unsigned __int8 *)&unk_939830);
if ( !a1->m_hasSFX )
a1->m_songIDLabel->setString(a1->m_songIDLabel, (const unsigned __int8 *)&unk_939830);
LABEL_37:
m_hasSFX = a1->m_hasSFX;
if ( a1->m_hasSFX )
{
a1->m_downloadBtn->setVisible(a1->m_downloadBtn, a1->m_unkBool2);
a1->m_cancelDownloadBtn->setVisible(a1->m_cancelDownloadBtn, 0);
a1->m_selectSongBtn->setVisible(a1->m_selectSongBtn, 0);
a1->m_playbackBtn->setVisible(a1->m_playbackBtn, 0);
a1->m_sliderGroove->setVisible(a1->m_sliderGroove, 0);
a1->m_getSongInfoBtn->setVisible(a1->m_getSongInfoBtn, 0);
m_deleteBtn = a1->m_deleteBtn;
LABEL_55:
v46 = *(void (**)(void))(*(_DWORD *)m_deleteBtn + 164);
LABEL_76:
v46();
goto LABEL_77;
}
v32 = a1->m_songInfoObject;
if ( !v32 )
{
a1->m_downloadBtn->setVisible(a1->m_downloadBtn, 0);
a1->m_cancelDownloadBtn->setVisible(a1->m_cancelDownloadBtn, 0);
a1->m_selectSongBtn->setVisible(a1->m_selectSongBtn, 0);
a1->m_playbackBtn->setVisible(a1->m_playbackBtn, 0);
m_sliderGroove = a1->m_sliderGroove;
goto LABEL_75;
}
m_songID = v32->m_songID;
v34 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isSongDownloaded(v34, m_songID) )
{
a1->m_downloadBtn->setVisible(a1->m_downloadBtn, m_hasSFX);
a1->m_cancelDownloadBtn->setVisible(a1->m_cancelDownloadBtn, m_hasSFX);
if ( a1->m_songInfoObject->m_unloaded )
m_showDownloadBtn = a1->m_showDownloadBtn;
else
m_showDownloadBtn = m_hasSFX;
a1->m_getSongInfoBtn->setVisible(a1->m_getSongInfoBtn, m_showDownloadBtn);
v36 = a1->m_deleteBtn;
setVisible = v36->setVisible;
if ( a1->m_showDownloadBtn
&& !((int (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_getSongInfoBtn->isVisible)(a1->m_getSongInfoBtn) )
{
m_hasSFX = a1->m_deleteBtn->getTag(a1->m_deleteBtn) != -999;
}
setVisible(v36, m_hasSFX);
m_selectSongBtn = a1->m_selectSongBtn;
if ( a1->m_showSelectSongBtn && a1->m_songDelegate )
{
m_selectSongBtn->setVisible(m_selectSongBtn, 1);
a1->m_deleteBtn->setVisible(a1->m_deleteBtn, 0);
v39 = a1->m_selectSongBtn->getNormalImage(a1->m_selectSongBtn);
v40 = a1->m_songDelegate->getActiveSongID(a1->m_songDelegate);
setEnabled = (void (*)(void))a1->m_selectSongBtn->setEnabled;
if ( v40 == m_songID )
{
setEnabled();
setSkewY = v39->__vftable[1].setSkewY;
v43 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v44 = "GJ_selectSongOnBtn_001.png";
}
else
{
setEnabled();
setSkewY = v39->__vftable[1].setSkewY;
v43 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v44 = "GJ_selectSongBtn_001.png";
}
v45 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v43, v44);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSpriteFrame *))setSkewY)(v39, v45);
}
else
{
m_selectSongBtn->setVisible(m_selectSongBtn, 0);
}
a1->m_playbackBtn->setVisible(a1->m_playbackBtn, a1->m_showPlayMusicBtn);
m_deleteBtn = a1->m_sliderGroove;
goto LABEL_55;
}
a1->m_selectSongBtn->setVisible(a1->m_selectSongBtn, 0);
a1->m_playbackBtn->setVisible(a1->m_playbackBtn, 0);
a1->m_deleteBtn->setVisible(a1->m_deleteBtn, 0);
m_isRobtopSong = a1->m_isRobtopSong;
if ( a1->m_isRobtopSong )
{
a1->m_downloadBtn->setVisible(a1->m_downloadBtn, 0);
m_sliderGroove = a1->m_cancelDownloadBtn;
LABEL_75:
(*(void (__fastcall **)(void *, _DWORD))(*(_DWORD *)m_sliderGroove + 164))(m_sliderGroove, 0);
a1->m_getSongInfoBtn->setVisible(a1->m_getSongInfoBtn, 0);
v46 = (void (*)(void))a1->m_deleteBtn->setVisible;
goto LABEL_76;
}
v48 = MusicDownloadManager::sharedState();
v49 = MusicDownloadManager::isRunningActionForSongID(v48, a1->m_customSongID) || a1->m_isNotDownloading;
if ( v49 )
v50 = 0;
else
v50 = !a1->m_songInfoObject->m_unloaded && a1->m_showDownloadBtn;
a1->m_downloadBtn->setVisible(a1->m_downloadBtn, v50);
if ( v49 )
v51 = !a1->m_songInfoObject->m_unloaded && a1->m_showDownloadBtn;
else
v51 = 0;
a1->m_cancelDownloadBtn->setVisible(a1->m_cancelDownloadBtn, v51);
if ( a1->m_songInfoObject->m_unloaded )
m_isRobtopSong = a1->m_showDownloadBtn;
a1->m_getSongInfoBtn->setVisible(a1->m_getSongInfoBtn, m_isRobtopSong);
CustomSongWidget::toggleUpdateButton(a1, !v49);
LABEL_77:
m_isMusicLibrary = a1->m_isMusicLibrary;
isVisible = (int (*)(void))a1->m_ncsLogo->isVisible;
if ( a1->m_isMusicLibrary )
{
v64 = 140.0;
v65 = 80.0;
if ( isVisible() )
v64 = 130.0;
if ( ((int (__fastcall *)(cocos2d::CCSprite *))a1->m_ncsLogo->isVisible)(a1->m_ncsLogo) )
v65 = 55.0;
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songLabel, v64, 0.5, 0.0);
width = a1->m_songLabel->getContentSize(a1->m_songLabel)->width;
v67 = v64
- (float)(width
* COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_songLabel->getScale)(a1->m_songLabel)));
if ( v67 <= 0.0 )
v67 = 0.0;
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_artistLabel, v65 + v67, 0.5, 0.0);
if ( !a1->m_hasSFX )
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songIDLabel, 220.0, 0.6, 0.0);
v68 = a1->m_songLabel->getContentSize(a1->m_songLabel)->width;
v69 = v68 * COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_songLabel->getScale)(a1->m_songLabel));
v70 = a1->m_artistLabel->getContentSize(a1->m_artistLabel)->width;
*(float *)&v71 = COERCE_FLOAT(((int (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_artistLabel->getScale)(a1->m_artistLabel));
m_moreBtn = a1->m_moreBtn;
setPosition = (char *)m_moreBtn->setPosition;
v73 = *(float *)&v71;
v74 = m_moreBtn->getParent(m_moreBtn);
v75 = a1->m_songLabel->getParent(a1->m_songLabel);
v85 = a1->m_songLabel->getPosition(a1->m_songLabel);
cocos2d::CCPoint::CCPoint(&v86, (float)(v69 + (float)((float)(v70 * v73) * 0.5)) + 4.0, 0.0);
cocos2d::CCPoint::operator+(&v87, v85, &v86);
cocos2d::CCNode::convertToWorldSpace(&v88, v75, &v87);
cocos2d::CCNode::convertToNodeSpace(&v89, v74, &v88);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))setPosition)(m_moreBtn, &v89);
m_artistLabel = a1->m_artistLabel;
setAnchorPoint = m_artistLabel->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v89, 0.5, 0.5);
setAnchorPoint(m_artistLabel, &v89);
v78 = a1->m_artistLabel;
v79 = v78->setPosition;
v80 = a1->m_moreBtn->getContentSize(a1->m_moreBtn)->width;
v81 = a1->m_moreBtn->getContentSize(a1->m_moreBtn);
cocos2d::CCPoint::CCPoint(&v89, v80 * 0.5, v81->height * 0.5);
v79(v78, &v89);
}
else
{
if ( isVisible() )
{
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songLabel, 190.0, 0.75, 0.0);
v55 = a1->m_artistLabel;
v56 = 165.0;
v57 = 0.75;
}
else
{
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songLabel, 240.0, 0.8, 0.0);
v55 = a1->m_artistLabel;
v56 = 175.0;
v57 = 0.8;
}
cocos2d::CCLabelBMFont::limitLabelWidth(v55, v56, v57, 0.0);
if ( !a1->m_hasSFX )
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_songIDLabel, 300.0, 0.4, 0.0);
v58 = a1->m_artistLabel->getPosition(a1->m_artistLabel);
cocos2d::CCNode::convertToWorldSpace(&v86, a1, v58);
v59 = a1->m_moreBtn;
v83 = (char *)v59->setPosition;
v60 = v59->getParent(v59);
v61 = a1->m_artistLabel->getContentSize(a1->m_artistLabel)->width;
v62 = a1->m_artistLabel->getScaleX(a1->m_artistLabel);
cocos2d::CCPoint::CCPoint(&v87, (float)(v61 * v62) + 35.0, -2.0);
cocos2d::CCPoint::operator+(&v88, &v86, &v87);
cocos2d::CCNode::convertToNodeSpace(&v89, v60, &v88);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *))v83)(v59, &v89);
v63 = a1->m_songInfoObject;
if ( v63 )
m_isMusicLibrary = !v63->m_unloaded;
a1->m_moreBtn->setVisible(a1->m_moreBtn, m_isMusicLibrary);
}
}