//
// CustomSFXWidget::updateSFXInfo from 0x1400c1f60 to 0x1400c25f7 (1687 bytes)
//
// 8 xrefs:
// > CustomSFXWidget::init @ 0x1400c15ed
// > CustomSFXWidget::updateDownloadProgress @ 0x1400c1ebf
// > CustomSFXWidget::songStateChanged @ 0x1400c1f57
// > CustomSFXWidget::downloadSFXFailed @ 0x1400c2763
// > CustomSFXWidget::FLAlert_Clicked @ 0x1400c2877
// > SetupSFXPopup::updateLength @ 0x1404488f3
// > SetupSFXPopup::createSFXWidget @ 0x140448bd6
// > ??> @ 0x1406c7fbc
//
// 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
//
// Hidden C++ exception states: #wind=2
void CustomSFXWidget::updateSFXInfo(CustomSFXWidget *a1)
{
SFXInfoObject *m_sfxObject; // rdx
cocos2d::CCLabelBMFont **p_m_titleLabel; // r14
cocos2d::CCLabelBMFont **p_m_idLabel; // rsi
std::string *p_m_name; // rdx
SFXInfoObject *v6; // rdx
unsigned int v7; // eax
cocos2d::CCString *v8; // rax
char *CString; // rax
size_t v10; // rbx
size_t v11; // r8
cocos2d::CCString *v12; // rax
__int64 v13; // rax
cocos2d::CCString *v14; // rax
char *v15; // rax
size_t v16; // r8
int m_duration; // ecx
float v18; // xmm1_4
float m_lengthMod; // xmm2_4
void **v20; // rdx
cocos2d::CCString *v21; // rax
char *v22; // rax
void **v23; // rdx
cocos2d::CCString *v24; // rax
void **v25; // rdx
void *v26; // rcx
SFXInfoObject *v27; // rax
int m_sfxID; // ebx
MusicDownloadManager *v29; // rax
_BOOL8 v30; // rdx
cocos2d::CCNode *v31; // rsi
int v32; // eax
_BOOL8 v33; // rdx
CCMenuItemSpriteExtra *m_selectButton; // rcx
CCMenuItemSpriteExtra_vtbl *v35; // r8
cocos2d::CCNode_vtbl *v36; // rbx
cocos2d::CCSpriteFrameCache *v37; // rax
const char *v38; // rdx
struct cocos2d::CCSpriteFrame *v39; // rax
MusicDownloadManager *v40; // rax
_BOOL8 v41; // rdx
char v42; // si
bool *p_m_showDownload; // rbx
_BOOL8 v44; // rdx
cocos2d::CCLabelBMFont *v45; // rcx
float *v46; // rbx
double v47; // xmm0_8
__int64 v48; // rax
cocos2d::CCLabelBMFont_vtbl *v49; // rbx
__int64 v50; // rax
cocos2d::CCPoint v51; // [rsp+28h] [rbp-29h] BYREF
cocos2d::CCPoint v52; // [rsp+30h] [rbp-21h] BYREF
void *Block[2]; // [rsp+38h] [rbp-19h] BYREF
__m128i si128; // [rsp+48h] [rbp-9h]
_BYTE v55[32]; // [rsp+58h] [rbp+7h] BYREF
m_sfxObject = a1->m_sfxObject;
if ( !m_sfxObject )
{
p_m_titleLabel = &a1->m_titleLabel;
a1->m_titleLabel->setString(&a1->m_titleLabel->cocos2d::CCLabelProtocol, "No SFX loaded");
p_m_idLabel = &a1->m_idLabel;
a1->m_idLabel->setString(&a1->m_idLabel->cocos2d::CCLabelProtocol, byte_140518980);
goto LABEL_38;
}
p_m_name = &m_sfxObject->m_name;
if ( p_m_name->m_data.m_capacity > 0xF )
p_m_name = (std::string *)p_m_name->m_data.m_bigStorage;
p_m_titleLabel = &a1->m_titleLabel;
a1->m_titleLabel->setString(&a1->m_titleLabel->cocos2d::CCLabelProtocol, p_m_name->m_data.m_smallStorage._Elems);
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
v6 = a1->m_sfxObject;
if ( v6->m_folder )
{
v7 = cocos2d::CCArray::count((cocos2d::CCArray *)v6[1].__vftable);
v8 = cocos2d::CCString::createWithFormat("Files: %i", v7);
CString = (char *)cocos2d::CCString::getCString(v8);
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
}
else
{
if ( !a1->m_compactMode )
{
v13 = sub_14033C3F0(v55, (unsigned int)v6->m_size);
if ( *(_QWORD *)(v13 + 24) > 0xFu )
v13 = *(_QWORD *)v13;
v14 = cocos2d::CCString::createWithFormat("ID: %i Size: %s", a1->m_sfxObject->m_sfxID, (const char *)v13);
v15 = (char *)cocos2d::CCString::getCString(v14);
v10 = -1;
v16 = -1;
do
++v16;
while ( v15[v16] );
sub_14003CCE0(Block, v15, v16);
sub_14003A830((__int64)v55);
goto LABEL_18;
}
v12 = cocos2d::CCString::createWithFormat("%i", v6->m_sfxID);
CString = (char *)cocos2d::CCString::getCString(v12);
v10 = -1;
v11 = -1;
do
++v11;
while ( CString[v11] );
}
sub_14003CCE0(Block, CString, v11);
LABEL_18:
m_duration = a1->m_sfxObject->m_duration;
if ( m_duration > 0 )
{
v18 = (float)m_duration / 100.0;
m_lengthMod = a1->m_lengthMod;
if ( m_lengthMod <= 0.0 || m_lengthMod == 1.0 )
{
v23 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v23 = (void **)Block[0];
v24 = cocos2d::CCString::createWithFormat("%s (%.2f s)", v23, v18);
v22 = (char *)cocos2d::CCString::getCString(v24);
do
++v10;
while ( v22[v10] );
}
else
{
v20 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v20 = (void **)Block[0];
v21 = cocos2d::CCString::createWithFormat("%s (%.2f s) (%.2f s)", v20, v18, (float)(v18 / m_lengthMod));
v22 = (char *)cocos2d::CCString::getCString(v21);
do
++v10;
while ( v22[v10] );
}
sub_14003CCE0(Block, v22, v10);
}
v25 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v25 = (void **)Block[0];
p_m_idLabel = &a1->m_idLabel;
a1->m_idLabel->setString(&a1->m_idLabel->cocos2d::CCLabelProtocol, (const char *)v25);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v26 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v26 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v26 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v26);
}
LABEL_38:
v27 = a1->m_sfxObject;
if ( !v27 || v27->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);
a1->m_deleteButton->setVisible(a1->m_deleteButton, 0);
CustomSFXWidget::hideLoadingArt(a1);
goto LABEL_61;
}
m_sfxID = v27->m_sfxID;
v29 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isSFXDownloaded(v29, m_sfxID) )
{
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 )
{
LOBYTE(v30) = 1;
a1->m_selectButton->setVisible(a1->m_selectButton, v30);
v31 = a1->m_selectButton->getNormalImage(a1->m_selectButton);
v32 = a1->m_delegate->getActiveSFXID(a1->m_delegate);
m_selectButton = a1->m_selectButton;
v35 = m_selectButton->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v32 == m_sfxID )
{
v35->setEnabled(m_selectButton, 0);
v36 = v31->__vftable;
v37 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v38 = "GJ_selectSongOnBtn_001.png";
}
else
{
LOBYTE(v33) = 1;
v35->setEnabled(m_selectButton, v33);
v36 = v31->__vftable;
v37 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v38 = "GJ_selectSongBtn_001.png";
}
v39 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v37, v38);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCSpriteFrame *))v36[1].setScaleX)(v31, v39);
}
else
{
a1->m_selectButton->setVisible(a1->m_selectButton, 0);
}
a1->m_playButton->setVisible(a1->m_playButton, a1->m_showPlay);
CustomSFXWidget::hideLoadingArt(a1);
p_m_titleLabel = &a1->m_titleLabel;
p_m_idLabel = &a1->m_idLabel;
goto LABEL_61;
}
a1->m_selectButton->setVisible(a1->m_selectButton, 0);
a1->m_playButton->setVisible(a1->m_playButton, 0);
a1->m_deleteButton->setVisible(a1->m_deleteButton, 0);
v40 = MusicDownloadManager::sharedState();
if ( MusicDownloadManager::isRunningActionForSongID(v40, a1->m_sfxID) || a1->m_showCancel )
{
v42 = 1;
p_m_showDownload = &a1->m_showDownload;
}
else
{
v42 = 0;
p_m_showDownload = &a1->m_showDownload;
if ( a1->m_showDownload )
{
LOBYTE(v41) = 1;
goto LABEL_55;
}
}
v41 = 0;
LABEL_55:
a1->m_downloadButton->setVisible(a1->m_downloadButton, v41);
if ( v42 && *p_m_showDownload )
LOBYTE(v44) = 1;
else
v44 = 0;
a1->m_cancelButton->setVisible(a1->m_cancelButton, v44);
p_m_titleLabel = &a1->m_titleLabel;
p_m_idLabel = &a1->m_idLabel;
LABEL_61:
v45 = *p_m_titleLabel;
if ( a1->m_compactMode )
{
cocos2d::CCLabelBMFont::limitLabelWidth(v45, 200.0, 0.40000001, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(*p_m_idLabel, 200.0, 0.60000002, 0.0);
v46 = (float *)(*p_m_titleLabel)->getContentSize(*p_m_titleLabel);
v47 = ((double (__fastcall *)(cocos2d::CCLabelBMFont *))(*p_m_titleLabel)->getScale)(*p_m_titleLabel);
cocos2d::CCPoint::CCPoint(&v52, (float)(*(float *)&v47 * *v46) + 5.0, 0.0);
v48 = (__int64)(*p_m_titleLabel)->getPosition_0(*p_m_titleLabel);
cocos2d::CCPoint::operator+(v48, &v51);
(*p_m_idLabel)->setPosition_0(*p_m_idLabel, &v51);
v49 = a1->m_errorLabel->__vftable;
v50 = (__int64)(*p_m_idLabel)->getPosition_0(*p_m_idLabel);
v49->setPosition_0(a1->m_errorLabel, (const cocos2d::CCPoint *)v50);
}
else
{
cocos2d::CCLabelBMFont::limitLabelWidth(v45, 210.0, 0.5, 0.0);
cocos2d::CCLabelBMFont::limitLabelWidth(*p_m_idLabel, 300.0, 0.60000002, 0.0);
}
a1->m_deleteButton->setVisible(a1->m_deleteButton, 0);
}