//
// SetupSFXPopup::createSFXWidget from 0xb6d5ac to 0xb6da44 (1176 bytes)
//
// 3 xrefs:
// > SetupSFXPopup::valueDidChange @ 0xb6db48
// > SetupSFXPopup::init @ 0xb6ee2c
// > ??> @ 0x102988
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:02:18 +0000
//
__int64 __fastcall SetupSFXPopup::createSFXWidget(SetupSFXPopup *this)
{
__int64 v2; // x0
MusicDownloadManager *v3; // x0
MusicDownloadManager *v4; // x0
__int64 SFXObject; // x0
CustomSFXWidget *v6; // x21
GameManager *v7; // x0
int v8; // w22
GameManager *v9; // x0
GameManager *v10; // x0
__int64 v11; // x0
MusicDownloadManager *v12; // x0
size_t v13; // x1
EditorSFXManager *v14; // x0
char *v15; // x25
int v16; // w24
char *v17; // x0
size_t v18; // x2
size_t v19; // x2
MusicDownloadManager *v20; // x0
__int64 v21; // x0
__int64 v23; // x0
cocos2d::CCDirector *v24; // x0
cocos2d::CCDirector *v25; // x0
MusicDownloadManager *v26; // x0
MusicDownloadManager *v27; // x0
__int64 *v28; // x0
__int64 v29; // x21
FMODAudioEngine *v30; // x0
__int64 v31; // x22
unsigned int v32; // w0
char v33; // w1
unsigned __int64 v34; // x0
unsigned __int64 v35; // x0
bool v36; // [xsp+8h] [xbp-8h]
__int64 v37; // [xsp+70h] [xbp+60h] BYREF
_BYTE v38[8]; // [xsp+78h] [xbp+68h] BYREF
EditorSFXManager *v39; // [xsp+80h] [xbp+70h] BYREF
size_t v40; // [xsp+88h] [xbp+78h]
void *v41; // [xsp+90h] [xbp+80h]
EditorSFXManager *v42; // [xsp+98h] [xbp+88h] BYREF
size_t v43; // [xsp+A0h] [xbp+90h]
void *v44; // [xsp+A8h] [xbp+98h]
EditorSFXManager *v45; // [xsp+B0h] [xbp+A0h] BYREF
size_t v46; // [xsp+B8h] [xbp+A8h]
MusicDownloadManager *v47; // [xsp+C0h] [xbp+B0h]
v2 = *((_QWORD *)this + 131);
if ( v2 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v2 + 536LL))(v2);
*((_QWORD *)this + 131) = 0;
}
v3 = (MusicDownloadManager *)*((unsigned int *)this + 260);
if ( (int)v3 > 0 )
{
v4 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v3);
SFXObject = MusicDownloadManager::getSFXObject(v4, *((_DWORD *)this + 260));
*((_DWORD *)this + 264) = 0;
v6 = (CustomSFXWidget *)SFXObject;
v8 = (int)(*(float (__fastcall **)(SetupSFXPopup *, __int64))(*(_QWORD *)this + 1464LL))(this, 601);
if ( v8 <= 0 )
{
LABEL_24:
if ( v6 && !*((_BYTE *)v6 + 72) )
{
v23 = CustomSFXWidget::create(v6, (SetupSFXPopup *)((char *)this + 1024), nullptr, 1, 1, 0, 0, 0, 0, v36);
*((_QWORD *)this + 131) = v23;
v24 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73)
+ 464LL))(
*((_QWORD *)this + 73),
v23,
2);
v25 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v24);
cocos2d::CCDirector::getWinSize(&v37, v25);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v38,
*(float *)&v37 * 0.5,
(float)(*((float *)&v37 + 1) * 0.5) + 70.0);
v26 = (MusicDownloadManager *)(*(__int64 (__fastcall **)(_QWORD, _BYTE *))(**((_QWORD **)this + 131) + 184LL))(
*((_QWORD *)this + 131),
v38);
v27 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v26);
v28 = MusicDownloadManager::pathForSFX((__int64 *)&v39, v27, *((_DWORD *)this + 260));
v29 = FMODAudioEngine::sharedEngine((FMODAudioEngine *)v28);
v42 = nullptr;
v43 = 0;
v44 = nullptr;
if ( ((unsigned __int8)v39 & 1) != 0 )
{
std::string::__init((__int64 *)&v42, v41, v40);
}
else
{
v42 = v39;
v43 = v40;
v44 = v41;
}
FMODAudioEngine::preloadEffect(v29, (__int64)&v42);
v30 = (FMODAudioEngine *)(unsigned __int8)v42;
if ( ((unsigned __int8)v42 & 1) != 0 )
operator delete(v44);
v31 = FMODAudioEngine::sharedEngine(v30);
v45 = nullptr;
v46 = 0;
v47 = nullptr;
if ( ((unsigned __int8)v39 & 1) != 0 )
{
std::string::__init((__int64 *)&v45, v41, v40);
}
else
{
v45 = v39;
v46 = v40;
v47 = (MusicDownloadManager *)v41;
}
v32 = FMODAudioEngine::lengthForSound(v31, &v45);
v33 = (char)v45;
*((_DWORD *)this + 264) = v32;
if ( (v33 & 1) != 0 )
{
operator delete(v47);
v32 = *((_DWORD *)this + 264);
}
if ( v32 )
{
SetupTriggerPopup::setMaxSliderValue(this, (float)v32, 408);
SetupTriggerPopup::setMaxSliderValue(this, (float)*((unsigned int *)this + 264), 410);
SetupTriggerPopup::updateSlider((cocos2d::CCDictionary **)this, 0x198u);
SetupTriggerPopup::updateSlider((cocos2d::CCDictionary **)this, 0x19Au);
}
SetupSFXPopup::updateLength(this);
(*(void (__fastcall **)(_QWORD, bool))(**((_QWORD **)this + 131) + 344LL))(
*((_QWORD *)this + 131),
*((_DWORD *)this + 230) <= 1);
if ( ((unsigned __int8)v39 & 1) != 0 )
operator delete(v41);
}
return _stack_chk_guard;
}
v9 = *(GameManager **)(GameManager::sharedState(v7) + 552);
if ( v9 && (v10 = *(GameManager **)(*(_QWORD *)(GameManager::sharedState(v9) + 552) + 3272LL)) != nullptr )
{
v11 = GameManager::sharedState(v10);
LevelSettingsObject::getCustomSFXPathRaw(
*(LevelSettingsObject **)(*(_QWORD *)(v11 + 552) + 3272LL),
*((_DWORD *)this + 260),
v8,
(__int64 *)&v42);
}
else
{
v42 = nullptr;
v43 = 0;
v44 = nullptr;
std::string::__init((__int64 *)&v42, &byte_11B8890, 0);
}
v12 = (MusicDownloadManager *)(unsigned __int8)v42;
v13 = (unsigned __int8)v42 >> 1;
if ( ((unsigned __int8)v42 & 1) != 0 )
v13 = v43;
if ( v13 )
{
LABEL_20:
v20 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v12);
v21 = MusicDownloadManager::resolveSFXPlacement(v20, *((_DWORD *)this + 260), v8, (__int64)&v42);
if ( v21 )
v6 = (CustomSFXWidget *)v21;
if ( ((unsigned __int8)v42 & 1) != 0 )
operator delete(v44);
goto LABEL_24;
}
v14 = (EditorSFXManager *)EditorSFXManager::sharedState((EditorSFXManager *)(unsigned __int8)v42);
EditorSFXManager::getCustomSFXRawPath((__int64 *)&v45, v14, *((_DWORD *)this + 260), v8);
if ( ((unsigned __int8)v42 & 1) != 0 )
{
*(_BYTE *)v44 = 0;
v43 = 0;
if ( ((unsigned __int8)v42 & 1) != 0 )
{
v15 = (char *)v44;
v16 = 1;
v17 = (char *)&v42 + 1;
goto LABEL_14;
}
v34 = (unsigned __int8)v42 >> 1;
if ( v34 > 0x16 )
{
v35 = (v34 + 16) & 0xFFFFFFFFFFFFFFF0LL;
if ( v35 != 23 )
{
v17 = (char *)operator new(v35);
v16 = (unsigned __int8)v42 & 1;
if ( ((unsigned __int8)v42 & 1) == 0 )
{
v15 = (char *)&v42 + 1;
v18 = (unsigned __int8)v42 >> 1;
goto LABEL_15;
}
v15 = (char *)v44;
LABEL_14:
v18 = v43;
LABEL_15:
v19 = v18 + 1;
if ( v19 )
memcpy(v17, v15, v19);
if ( v16 )
operator delete(v15);
}
}
}
v42 = v45;
v43 = v46;
v12 = v47;
v44 = v47;
goto LABEL_20;
}
return _stack_chk_guard;
}