//
// CustomSFXWidget::updateSFXInfo from 0x1005e3f40 to 0x1005e455c (1564 bytes)
//
// 8 xrefs:
// > CustomSFXWidget::init @ 0x1005e386b
// > CustomSFXWidget::updateSFXObject @ 0x1005e3f23
// > CustomSFXWidget::deleteSFX @ 0x1005e46bc
// > CustomSFXWidget::updateDownloadProgress @ 0x1005e49f9
// > CustomSFXWidget::downloadFailed @ 0x1005e4b11
// > CustomSFXWidget::songStateChanged @ 0x1005e4b25
// > sub_1005E4B30 @ 0x1005e4b3c
// > CustomSFXWidget::updateLengthMod @ 0x1005e4b5d
//
// 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 CustomSFXWidget::updateSFXInfo(CustomSFXWidget *a1)
{
SFXInfoObject *m_sfxObject; // rsi
cocos2d::CCLabelBMFont *m_titleLabel; // rdi
std::array *longStorage; // rsi
SFXInfoObject *v5; // rax
char *v6; // rdi
cocos2d::CCString *v7; // rax
const char *CString; // rax
float m_lengthMod; // xmm2_4
cocos2d::CCString *v10; // rax
const char *v11; // rax
std::string::pointer data; // rsi
SFXInfoObject *v13; // rax
cocos2d::CCSprite *m_clockSprite; // rdi
cocos2d::CCSprite *v15; // r14
cocos2d::CCFadeTo *v16; // r15
cocos2d::CCHide *v17; // rax
cocos2d::CCSequence *v18; // rax
cocos2d::CCLabelBMFont *v19; // rdi
cocos2d::CCLabelBMFont *m_idLabel; // r14
unsigned __int64 *v21; // r15
float v22; // xmm0_4
cocos2d::CCLabelBMFont *m_errorLabel; // r14
__int64 v24; // rax
int m_sfxID; // r14d
MusicDownloadManager *v26; // rax
__int64 v27; // r15
int v28; // eax
CCMenuItemSpriteExtra *m_selectButton; // rdi
void (__cdecl *setEnabled)(cocos2d::CCMenuItemSprite *__hidden, bool); // rcx
cocos2d::CCSpriteFrameCache *v31; // rax
const char *v32; // rsi
MusicDownloadManager *v33; // rax
CCMenuItemSpriteExtra *m_downloadButton; // rdi
cocos2d::CCString *v35; // rax
const char *v36; // rax
char v37; // r14
bool m_showDownload; // al
bool v39; // al
cocos2d::CCSpriteFrame *v40; // rax
unsigned __int64 v41[3]; // [rsp+0h] [rbp-60h] BYREF
float v42; // [rsp+1Ch] [rbp-44h]
std::string v43; // [rsp+20h] [rbp-40h] BYREF
m_sfxObject = a1->m_sfxObject;
m_titleLabel = a1->m_titleLabel;
if ( !m_sfxObject )
{
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_titleLabel->setString)(
m_titleLabel,
"No SFX loaded");
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))a1->m_idLabel->setString)(a1->m_idLabel, "");
goto LABEL_25;
}
if ( (m_sfxObject->m_name.m_data.m_short.sizex2 & 1) != 0 )
longStorage = (std::array *)m_sfxObject->m_name.m_data.m_long.longStorage;
else
longStorage = &m_sfxObject->m_name.m_data.m_short.shortStorage;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::array *))m_titleLabel->setString)(
m_titleLabel,
longStorage);
memset(&v43, 0, sizeof(v43));
v5 = a1->m_sfxObject;
if ( v5->m_folder )
{
sub_100720070(v5[1].__vftable);
v6 = "Files: %i";
LABEL_10:
v7 = (cocos2d::CCString *)sub_1007AB580(v6, v41[0]);
CString = cocos2d::CCString::getCString(v7);
std::string::assign(&v43, CString);
goto LABEL_11;
}
if ( a1->m_compactMode )
{
v6 = "%i";
goto LABEL_10;
}
sub_100589460(v41, v5->m_size);
v35 = (cocos2d::CCString *)sub_1007AB580("ID: %i Size: %s", v41[0]);
v36 = cocos2d::CCString::getCString(v35);
std::string::assign(&v43, v36);
if ( (v41[0] & 1) != 0 )
operator delete((void *)v41[2]);
LABEL_11:
if ( a1->m_sfxObject->m_duration <= 0 )
goto LABEL_20;
m_lengthMod = a1->m_lengthMod;
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
{
if ( m_lengthMod <= 0.0 )
goto LABEL_18;
}
else if ( m_lengthMod <= 0.0 )
{
LABEL_18:
v10 = (cocos2d::CCString *)sub_1007AB580("%s (%.2f s)", v41[0]);
goto LABEL_19;
}
if ( m_lengthMod == 1.0 )
goto LABEL_18;
v10 = (cocos2d::CCString *)sub_1007AB580("%s (%.2f s) (%.2f s)", v41[0]);
LABEL_19:
v11 = cocos2d::CCString::getCString(v10);
std::string::assign(&v43, v11);
LABEL_20:
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
data = v43.__r_.__value_.__l.__data_;
else
data = v43.__r_.__value_.__s.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))a1->m_idLabel->setString)(a1->m_idLabel, data);
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v43.__r_.__value_.__l.__data_);
LABEL_25:
v13 = a1->m_sfxObject;
if ( !v13 || v13->m_folder )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadButton->setVisible)(a1->m_downloadButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_cancelButton->setVisible)(a1->m_cancelButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_selectButton->setVisible)(a1->m_selectButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_playButton->setVisible)(a1->m_playButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteButton->setVisible)(a1->m_deleteButton, 0);
m_clockSprite = a1->m_clockSprite;
if ( !m_clockSprite )
goto LABEL_30;
goto LABEL_28;
}
m_sfxID = v13->m_sfxID;
v26 = MusicDownloadManager::sharedState();
if ( !MusicDownloadManager::isSFXDownloaded(v26, m_sfxID) )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_selectButton->setVisible)(a1->m_selectButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_playButton->setVisible)(a1->m_playButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteButton->setVisible)(a1->m_deleteButton, 0);
v33 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isRunningActionForSongID(v33, a1->m_sfxID) )
{
m_downloadButton = a1->m_downloadButton;
}
else
{
m_downloadButton = a1->m_downloadButton;
if ( !a1->m_showCancel )
{
m_showDownload = a1->m_showDownload;
v37 = 0;
LABEL_46:
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_downloadButton->setVisible)(
m_downloadButton,
m_showDownload);
if ( v37 )
v39 = a1->m_showDownload;
else
v39 = 0;
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_cancelButton->setVisible)(a1->m_cancelButton, v39);
v19 = a1->m_titleLabel;
if ( a1->m_compactMode )
goto LABEL_31;
LABEL_50:
cocos2d::CCLabelBMFont::limitLabelWidth(v19, 210.0, 0.5, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_idLabel, 300.0, 0.60000002, 0.0);
goto LABEL_51;
}
}
v37 = 1;
m_showDownload = 0;
goto LABEL_46;
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_downloadButton->setVisible)(a1->m_downloadButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_cancelButton->setVisible)(a1->m_cancelButton, 0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_deleteButton->setVisible)(
a1->m_deleteButton,
a1->m_showDelete);
if ( a1->m_showDelete && a1->m_delegate )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_selectButton->setVisible)(a1->m_selectButton, 1);
v27 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_selectButton->getNormalImage)(a1->m_selectButton);
v28 = ((__int64 (__fastcall *)(CustomSFXDelegate *))a1->m_delegate->getActiveSFXID)(a1->m_delegate);
m_selectButton = a1->m_selectButton;
setEnabled = m_selectButton->setEnabled;
if ( v28 == m_sfxID )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))setEnabled)(m_selectButton, 0);
v31 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v32 = "GJ_selectSongOnBtn_001.png";
}
else
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))setEnabled)(m_selectButton, 1);
v31 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v32 = "GJ_selectSongBtn_001.png";
}
v40 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v31, v32);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v27 + 1144LL))(v27, v40);
}
else
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_selectButton->setVisible)(a1->m_selectButton, 0);
}
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_playButton->setVisible)(a1->m_playButton, a1->m_showPlay);
m_clockSprite = a1->m_clockSprite;
if ( m_clockSprite )
{
LABEL_28:
if ( ((unsigned __int8 (__fastcall *)(cocos2d::CCSprite *))m_clockSprite->isVisible)(m_clockSprite) )
{
cocos2d::CCNode::stopAllActions(a1->m_clockSprite);
v15 = a1->m_clockSprite;
v16 = cocos2d::CCFadeTo::create(0.2, 0);
v17 = cocos2d::CCHide::create();
v18 = sub_1003B5760(v16, v17, 0);
cocos2d::CCNode::runAction(v15, v18);
}
}
LABEL_30:
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_progressOutlineSprite->setVisible)(
a1->m_progressOutlineSprite,
0);
v19 = a1->m_titleLabel;
if ( !a1->m_compactMode )
goto LABEL_50;
LABEL_31:
cocos2d::CCLabelBMFont::limitLabelWidth(v19, 200.0, 0.40000001, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_idLabel, 200.0, 0.60000002, 0.0);
m_idLabel = a1->m_idLabel;
v21 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_titleLabel->getPosition)(a1->m_titleLabel);
v42 = *(float *)((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_titleLabel->getContentSize)(a1->m_titleLabel);
v22 = ((float (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_titleLabel->getScale)(a1->m_titleLabel);
sub_10028CBE0((float *)v41, (float)(v22 * v42) + 5.0, 0.0);
sub_10028CCE0((double *)&v43, v21, v41);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))m_idLabel->setPosition)(m_idLabel, &v43);
m_errorLabel = a1->m_errorLabel;
v24 = ((__int64 (__fastcall *)(cocos2d::CCLabelBMFont *))a1->m_idLabel->getPosition)(a1->m_idLabel);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))m_errorLabel->setPosition)(m_errorLabel, v24);
LABEL_51:
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_deleteButton->setVisible)(a1->m_deleteButton, 0);
}