//
// CustomSFXWidget::updateSFXInfo from 0x56df88 to 0x56e34a (962 bytes)
//
// 7 xrefs:
// > CustomSFXWidget::deleteSFX @ 0x56e3d4
// > CustomSFXWidget::updateSFXObject @ 0x56e4ec
// > CustomSFXWidget::init @ 0x56eed8
// > CustomSFXWidget::downloadFailed @ 0x56f060
// > CustomSFXWidget::updateDownloadProgress @ 0x56f0a6
// > CustomSFXWidget::songStateChanged @ 0x56f0c0
// > CustomSFXWidget::updateLengthMod @ 0x56f0da
//
// 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 CustomSFXWidget::updateSFXInfo(CustomSFXWidget *a1)
{
SFXInfoObject *m_sfxObject; // r3
cocos2d::CCLabelBMFont *m_titleLabel; // r0
SFXInfoObject *v4; // r3
const char *v5; // r1
cocos2d::CCString *v6; // r0
char *v7; // r0
const char *m_sfxID; // r8
cocos2d::CCString *v9; // r0
char *CString; // r0
int m_duration; // r3
float v12; // s15
float m_lengthMod; // s14
double v14; // d6
cocos2d::CCString *v15; // r0
char *v16; // r0
SFXInfoObject *v17; // r3
_BOOL4 m_folder; // r5
int v19; // r8
MusicDownloadManager *v20; // r0
CCMenuItemSpriteExtra *m_selectButton; // r0
cocos2d::CCNode *v22; // r7
int v23; // r0
void (*setEnabled)(void); // r3
void (__fastcall *setSkewY)(cocos2d::CCNode *__hidden, float); // r5
cocos2d::CCSpriteFrameCache *v26; // r0
const char *v27; // r1
cocos2d::CCSpriteFrame *v28; // r0
void (*setVisible)(void); // r3
MusicDownloadManager *v30; // r0
_BOOL4 v31; // r7
_BOOL4 v32; // r1
cocos2d::CCLabelBMFont *v33; // r0
cocos2d::CCLabelBMFont *m_idLabel; // r8
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
const cocos2d::CCPoint *v36; // r10
float width; // s16
float v38; // r0
cocos2d::CCLabelBMFont *m_errorLabel; // r5
void (__fastcall *v40)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r7
const cocos2d::CCPoint *v41; // r0
cocos2d::CCPoint v42; // [sp+Ch] [bp-14h] BYREF
cocos2d::CCPoint v43; // [sp+14h] [bp-Ch] BYREF
m_sfxObject = a1->m_sfxObject;
m_titleLabel = a1->m_titleLabel;
if ( !m_sfxObject )
{
m_titleLabel->setString(m_titleLabel, "No SFX loaded");
a1->m_idLabel->setString(a1->m_idLabel, (const unsigned __int8 *)&unk_939830);
goto LABEL_16;
}
m_titleLabel->setString(m_titleLabel, (const unsigned __int8 *)m_sfxObject->m_name.m_data.m_data);
LODWORD(v42.x) = &unk_ACDDA8;
v4 = a1->m_sfxObject;
if ( v4->m_folder )
{
v5 = (const char *)cocos2d::CCArray::count((cocos2d::CCArray *)v4[1].__vftable);
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Files: %i", v5);
}
else
{
if ( !a1->m_compactMode )
{
m_sfxID = (const char *)v4->m_sfxID;
formatBytes((int)&v43, v4->m_size);
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"ID: %i Size: %s",
m_sfxID,
v43.x);
CString = (char *)cocos2d::CCString::getCString(v9);
sub_7753D4((int)&v42, CString);
sub_774008(&v43);
goto LABEL_9;
}
v6 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v4->m_sfxID);
}
v7 = (char *)cocos2d::CCString::getCString(v6);
sub_7753D4((int)&v42, v7);
LABEL_9:
m_duration = a1->m_sfxObject->m_duration;
if ( m_duration > 0 )
{
v12 = (float)m_duration / 100.0;
m_lengthMod = a1->m_lengthMod;
v14 = v12;
if ( m_lengthMod <= 0.0 || m_lengthMod == 1.0 )
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%.2f s)",
(const char *)LODWORD(v42.x),
v14);
else
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%.2f s) (%.2f s)",
(const char *)LODWORD(v42.x),
v14,
(float)(v12 / m_lengthMod));
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_7753D4((int)&v42, v16);
}
a1->m_idLabel->setString(a1->m_idLabel, (const unsigned __int8 *)LODWORD(v42.x));
sub_774008(&v42);
LABEL_16:
v17 = a1->m_sfxObject;
if ( !v17 || (m_folder = v17->m_folder) )
{
a1->m_downloadButton->setVisible(a1->m_downloadButton, 0);
a1->m_cancelButton->setVisible(a1->m_cancelButton, 0);
a1->m_selectButton->setVisible(a1->m_selectButton, 0);
a1->m_playButton->setVisible(a1->m_playButton, 0);
setVisible = (void (*)(void))a1->m_deleteButton->setVisible;
LABEL_37:
setVisible();
CustomSFXWidget::hideLoadingArt(a1);
goto LABEL_38;
}
v19 = v17->m_sfxID;
v20 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isSFXDownloaded(v20, v19) )
{
a1->m_downloadButton->setVisible(a1->m_downloadButton, m_folder);
a1->m_cancelButton->setVisible(a1->m_cancelButton, m_folder);
a1->m_deleteButton->setVisible(a1->m_deleteButton, a1->m_showDelete);
m_selectButton = a1->m_selectButton;
if ( a1->m_showDelete && a1->m_delegate )
{
m_selectButton->setVisible(m_selectButton, 1);
v22 = a1->m_selectButton->getNormalImage(a1->m_selectButton);
v23 = a1->m_delegate->getActiveSFXID(a1->m_delegate);
setEnabled = (void (*)(void))a1->m_selectButton->setEnabled;
if ( v23 == v19 )
{
setEnabled();
setSkewY = v22->__vftable[1].setSkewY;
v26 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v27 = "GJ_selectSongOnBtn_001.png";
}
else
{
setEnabled();
setSkewY = v22->__vftable[1].setSkewY;
v26 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v27 = "GJ_selectSongBtn_001.png";
}
v28 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v26, v27);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSpriteFrame *))setSkewY)(v22, v28);
}
else
{
m_selectButton->setVisible(m_selectButton, 0);
}
setVisible = (void (*)(void))a1->m_playButton->setVisible;
goto LABEL_37;
}
a1->m_selectButton->setVisible(a1->m_selectButton, m_folder);
a1->m_playButton->setVisible(a1->m_playButton, m_folder);
a1->m_deleteButton->setVisible(a1->m_deleteButton, m_folder);
v30 = MusicDownloadManager::sharedState();
v31 = MusicDownloadManager::isRunningActionForSongID(v30, a1->m_sfxID) || a1->m_showCancel;
v32 = !v31 && a1->m_showDownload;
a1->m_downloadButton->setVisible(a1->m_downloadButton, v32);
if ( v31 )
m_folder = a1->m_showDownload;
a1->m_cancelButton->setVisible(a1->m_cancelButton, m_folder);
LABEL_38:
v33 = a1->m_titleLabel;
if ( a1->m_compactMode )
{
cocos2d::CCLabelBMFont::limitLabelWidth(v33, 200.0, 0.4, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_idLabel, 200.0, 0.6, 0.0);
m_idLabel = a1->m_idLabel;
setPosition = m_idLabel->setPosition;
v36 = a1->m_titleLabel->getPosition(a1->m_titleLabel);
width = a1->m_titleLabel->getContentSize(a1->m_titleLabel)->width;
v38 = a1->m_titleLabel->getScale(a1->m_titleLabel);
cocos2d::CCPoint::CCPoint(&v42, (float)(width * v38) + 5.0, 0.0);
cocos2d::CCPoint::operator+(&v43, v36, &v42);
setPosition(m_idLabel, &v43);
m_errorLabel = a1->m_errorLabel;
v40 = m_errorLabel->setPosition;
v41 = a1->m_idLabel->getPosition(a1->m_idLabel);
v40(m_errorLabel, v41);
}
else
{
cocos2d::CCLabelBMFont::limitLabelWidth(v33, 210.0, 0.5, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_idLabel, 300.0, 0.6, 0.0);
}
a1->m_deleteButton->setVisible(a1->m_deleteButton, 0);
}