//
// CustomSFXWidget::updateSFXInfo from 0xa31d8c to 0xa3248c (1792 bytes)
//
// 9 xrefs:
// > CustomSFXWidget::deleteSFX @ 0xa32500
// > CustomSFXWidget::updateSFXObject @ 0xa32740
// > CustomSFXWidget::updateSFXObject @ 0xa32758
// > CustomSFXWidget::init @ 0xa335b4
// > CustomSFXWidget::downloadFailed @ 0xa33850
// > CustomSFXWidget::updateDownloadProgress @ 0xa338b8
// > CustomSFXWidget::songStateChanged @ 0xa338cc
// > CustomSFXWidget::updateLengthMod @ 0xa338ec
// > ??> @ 0x8cb98
//
// 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; // x0
cocos2d::CCLabelBMFont *m_titleLabel; // x2
SFXInfoObject *v4; // x1
_BOOL4 m_folder; // w2
unsigned int m_sfxID; // w22
cocos2d::CCString *v7; // x0
size_t v8; // x0
__n128 v9; // q0
void *v10; // x0
int m_duration; // w0
float m_lengthMod; // s1
float v13; // s0
cocos2d::CCString *v14; // x0
size_t v15; // x0
char *v16; // x1
SFXInfoObject *v17; // x0
CCMenuItemSpriteExtra *m_deleteButton; // x2
_BOOL8 m_showPlay; // x1
cocos2d::CCLabelBMFont *m_idLabel; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24
const cocos2d::CCPoint *v22; // x25
float width; // s8
float v24; // s0
cocos2d::CCLabelBMFont *m_errorLabel; // x21
void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
const cocos2d::CCPoint *v27; // x0
cocos2d::CCString *v28; // x0
size_t v29; // x0
int v30; // w21
MusicDownloadManager *v31; // x0
cocos2d::CCNode *v32; // x22
int v33; // w0
CCMenuItemSpriteExtra *m_selectButton; // x2
void (__fastcall *setSkewY)(cocos2d::CCNode *__hidden, float); // x21
cocos2d::CCSpriteFrameCache *v36; // x0
cocos2d::CCSpriteFrame *v37; // x0
unsigned int v38; // w0
MusicDownloadManager *v39; // x0
void (*setVisible)(void); // x2
unsigned int *v41; // x0
int v42; // w2
cocos2d::CCSpriteFrameCache *v43; // x0
unsigned int *v44; // x1
int v45; // w2
const char *CString; // [xsp+58h] [xbp+58h]
const char *v47; // [xsp+58h] [xbp+58h]
const char *v48; // [xsp+58h] [xbp+58h]
char *v49; // [xsp+68h] [xbp+68h] BYREF
__int64 v50; // [xsp+70h] [xbp+70h] BYREF
m_sfxObject = a1->m_sfxObject;
m_titleLabel = a1->m_titleLabel;
if ( !m_sfxObject )
{
m_titleLabel->setString(a1->m_titleLabel, "No SFX loaded");
a1->m_idLabel->setString(a1->m_idLabel, (const unsigned __int8 *)&byte_F288A0);
goto LABEL_11;
}
m_titleLabel->setString(a1->m_titleLabel, (const unsigned __int8 *)m_sfxObject->m_name.m_data.m_data);
v4 = a1->m_sfxObject;
m_folder = v4->m_folder;
v49 = &byte_124B6C8;
if ( m_folder )
{
v38 = cocos2d::CCArray::count((cocos2d::CCArray *)v4[1].__vftable);
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Files: %i", (const char *)v38);
}
else
{
if ( !a1->m_compactMode )
{
m_sfxID = v4->m_sfxID;
formatBytes(v4->m_size, (__int64)&v50);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"ID: %i Size: %s",
(const char *)m_sfxID,
v50);
CString = cocos2d::CCString::getCString(v7);
v8 = strlen(CString);
v9 = sub_D1798C(&v49, CString, v8);
v10 = (void *)(v50 - 24);
if ( (__int64 *)(v50 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v50 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(v50 - 8);
*(_DWORD *)(v50 - 8) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v10);
}
goto LABEL_5;
}
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)v4->m_sfxID);
}
v48 = cocos2d::CCString::getCString(v28);
v29 = strlen(v48);
v9 = sub_D1798C(&v49, v48, v29);
LABEL_5:
m_duration = a1->m_sfxObject->m_duration;
if ( m_duration > 0 )
{
m_lengthMod = a1->m_lengthMod;
v13 = (float)m_duration / 100.0;
if ( m_lengthMod <= 0.0 || m_lengthMod == 1.0 )
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%s (%.2f s)", v49, v13);
else
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s (%.2f s) (%.2f s)",
v49,
v13,
(float)(v13 / m_lengthMod));
v47 = cocos2d::CCString::getCString(v14);
v15 = strlen(v47);
v9 = sub_D1798C(&v49, v47, v15);
}
((void (__fastcall *)(cocos2d::CCLabelBMFont *, char *, long double))a1->m_idLabel->setString)(
a1->m_idLabel,
v49,
*(long double *)&v9);
v16 = v49 - 24;
if ( v49 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(v49 - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v49 - 2);
*((_DWORD *)v49 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v16);
}
LABEL_11:
v17 = a1->m_sfxObject;
if ( !v17 || 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);
m_deleteButton = a1->m_deleteButton;
m_showPlay = 0;
LABEL_14:
m_deleteButton->setVisible(m_deleteButton, m_showPlay);
CustomSFXWidget::hideLoadingArt(a1);
goto LABEL_15;
}
v30 = v17->m_sfxID;
v31 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isSFXDownloaded(v31, v30) )
{
a1->m_downloadButton->setVisible(a1->m_downloadButton, 0);
a1->m_cancelButton->setVisible(a1->m_cancelButton, 0);
a1->m_deleteButton->setVisible(a1->m_deleteButton, a1->m_showDelete);
if ( a1->m_showDelete && a1->m_delegate )
{
a1->m_selectButton->setVisible(a1->m_selectButton, 1);
v32 = a1->m_selectButton->getNormalImage(a1->m_selectButton);
v33 = a1->m_delegate->getActiveSFXID(a1->m_delegate);
m_selectButton = a1->m_selectButton;
if ( v30 == v33 )
{
m_selectButton->setEnabled(a1->m_selectButton, 0);
setSkewY = v32->__vftable[1].setSkewY;
v43 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v37 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v43, "GJ_selectSongOnBtn_001.png");
}
else
{
m_selectButton->setEnabled(a1->m_selectButton, 1);
setSkewY = v32->__vftable[1].setSkewY;
v36 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v37 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v36, "GJ_selectSongBtn_001.png");
}
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSpriteFrame *))setSkewY)(v32, v37);
}
else
{
a1->m_selectButton->setVisible(a1->m_selectButton, 0);
}
m_deleteButton = a1->m_playButton;
m_showPlay = a1->m_showPlay;
goto LABEL_14;
}
a1->m_selectButton->setVisible(a1->m_selectButton, 0);
a1->m_playButton->setVisible(a1->m_playButton, 0);
a1->m_deleteButton->setVisible(a1->m_deleteButton, 0);
v39 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isRunningActionForSongID(v39, a1->m_sfxID) || a1->m_showCancel )
{
a1->m_downloadButton->setVisible(a1->m_downloadButton, 0);
setVisible = (void (*)(void))a1->m_cancelButton->setVisible;
}
else
{
a1->m_downloadButton->setVisible(a1->m_downloadButton, a1->m_showDownload);
setVisible = (void (*)(void))a1->m_cancelButton->setVisible;
}
setVisible();
LABEL_15:
if ( a1->m_compactMode )
{
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_titleLabel, 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;
v22 = a1->m_titleLabel->getPosition(a1->m_titleLabel);
width = a1->m_titleLabel->getContentSize(a1->m_titleLabel)->width;
v24 = a1->m_titleLabel->getScale(a1->m_titleLabel);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v49, (float)(width * v24) + 5.0, 0.0);
cocos2d::CCPoint::operator+(&v50, v22, &v49);
setPosition(m_idLabel, (const cocos2d::CCPoint *)&v50);
m_errorLabel = a1->m_errorLabel;
v26 = m_errorLabel->setPosition;
v27 = a1->m_idLabel->getPosition(a1->m_idLabel);
v26(m_errorLabel, v27);
}
else
{
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_titleLabel, 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);
}