//
// SetupSFXPopup::createSFXWidget from 0x5760dc to 0x57627c (416 bytes)
//
// 2 xrefs:
// > SetupSFXPopup::valueDidChange @ 0x5762de
// > SetupSFXPopup::init @ 0x576bf4
//
// 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 SetupSFXPopup::createSFXWidget(SetupSFXPopup *a1)
{
CustomSFXWidget *m_sfxWidget; // r0
MusicDownloadManager *v3; // r0
SFXInfoObject *SFXObject; // r0
CustomSFXWidget *v5; // r0
cocos2d::CCDirector *v6; // r0
MusicDownloadManager *v7; // r0
FMODAudioEngine *v8; // r8
FMODAudioEngine *v9; // r8
int m_sfxLength; // r1
char v11; // [sp+10h] [bp-20h] BYREF
const void *v12; // [sp+14h] [bp-1Ch] BYREF
const void *v13; // [sp+18h] [bp-18h] BYREF
cocos2d::CCSize v14; // [sp+1Ch] [bp-14h] BYREF
cocos2d::CCPoint v15; // [sp+24h] [bp-Ch] BYREF
m_sfxWidget = a1->m_sfxWidget;
if ( m_sfxWidget )
{
m_sfxWidget->removeMeAndCleanup(m_sfxWidget);
a1->m_sfxWidget = nullptr;
}
if ( a1->m_sfxID > 0 )
{
v3 = MusicDownloadManager::sharedState();
SFXObject = MusicDownloadManager::getSFXObject(v3, a1->m_sfxID);
a1->m_sfxLength = 0;
if ( SFXObject )
{
if ( !SFXObject->m_folder )
{
v5 = CustomSFXWidget::create(SFXObject, &a1->CustomSFXDelegate, 0, 1, 1, SFXObject->m_folder, 0);
a1->m_sfxWidget = v5;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v5, 2);
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v14, v6);
cocos2d::CCPoint::CCPoint(&v15, v14.width * 0.5, (float)(v14.height * 0.5) + 70.0);
a1->m_sfxWidget->setPosition(a1->m_sfxWidget, &v15);
v7 = MusicDownloadManager::sharedState();
MusicDownloadManager::pathForSFX((MusicDownloadManager *)&v11, v7, a1->m_sfxID);
v8 = FMODAudioEngine::sharedEngine();
sub_775C20(&v12);
FMODAudioEngine::preloadEffect(v8, &v12);
sub_774008(&v12);
v9 = FMODAudioEngine::sharedEngine();
sub_775C20(&v13);
a1->m_sfxLength = (int)FMODAudioEngine::lengthForSound((int)v9, &v13);
sub_774008(&v13);
m_sfxLength = a1->m_sfxLength;
if ( m_sfxLength )
{
SetupTriggerPopup::setMaxSliderValue(a1, (float)(unsigned int)m_sfxLength, 408);
SetupTriggerPopup::setMaxSliderValue(a1, (float)(unsigned int)a1->m_sfxLength, 410);
SetupTriggerPopup::updateSlider(a1, 408);
SetupTriggerPopup::updateSlider(a1, 410);
}
SetupSFXPopup::updateLength(a1);
a1->m_sfxWidget->setVisible(a1->m_sfxWidget, a1->m_page <= 1);
sub_774008(&v11);
}
}
}
}