//
// SetupSFXPopup::createSFXWidget from 0x6b13ac to 0x6b16ce (802 bytes)
//
// 2 xrefs:
// > SetupSFXPopup::valueDidChange @ 0x6b175c
// > SetupSFXPopup::init @ 0x6b221e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:56:39 +0000
//
float __fastcall SetupSFXPopup::createSFXWidget(SetupSFXPopup *this)
{
float result; // r0
MusicDownloadManager *v3; // r0
cocos2d::CCDictionary *SFXObject; // r0
bool *v5; // r7
int v6; // r9
GameManager *v7; // r0
GameManager *v8; // r0
int v9; // r0
MusicDownloadManager *CustomSFXPathRaw; // r0
int v11; // r3
int v12; // r0
bool v13; // zf
int v14; // r3
int v15; // r0
unsigned int v16; // r3
unsigned int v17; // r0
char *v18; // r11
int v19; // r10
char *v20; // r0
int v21; // r2
size_t v22; // r2
int v23; // r0
unsigned int v24; // r1
void *v25; // r2
MusicDownloadManager *v26; // r0
SFXInfoObject *v27; // r0
cocos2d::CCNode *v28; // r0
cocos2d::CCDirector *v29; // r0
MusicDownloadManager *v30; // r0
MusicDownloadManager *v31; // r0
FMODAudioEngine *v32; // r0
int v33; // r8
FMODAudioEngine *v34; // r0
int v35; // r8
unsigned int v36; // r1
bool v37; // [sp+14h] [bp-40h]
float v38[2]; // [sp+18h] [bp-3Ch] BYREF
_BYTE v39[8]; // [sp+20h] [bp-34h] BYREF
_BYTE v40[12]; // [sp+28h] [bp-2Ch] BYREF
int v41; // [sp+34h] [bp-20h] BYREF
unsigned int v42; // [sp+38h] [bp-1Ch]
void *v43; // [sp+3Ch] [bp-18h]
int v44; // [sp+40h] [bp-14h] BYREF
unsigned int v45; // [sp+44h] [bp-10h]
void *v46; // [sp+48h] [bp-Ch]
result = *((float *)this + 182);
if ( result != 0.0 )
{
result = COERCE_FLOAT((*(int (__fastcall **)(float))(*(_DWORD *)LODWORD(result) + 268))(COERCE_FLOAT(LODWORD(result))));
*((_DWORD *)this + 182) = 0;
}
if ( *((int *)this + 181) > 0 )
{
v3 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)LODWORD(result));
SFXObject = MusicDownloadManager::getSFXObject(v3, *((_DWORD *)this + 181));
*((_DWORD *)this + 183) = 0;
v5 = (bool *)SFXObject;
result = (*(float (__fastcall **)(SetupSFXPopup *, int))(*(_DWORD *)this + 732))(this, 601);
v6 = (int)result;
if ( (int)result <= 0 )
{
LABEL_40:
if ( v5 && !v5[68] )
{
v28 = CustomSFXWidget::create(
(CustomSFXWidget *)v5,
(SetupSFXPopup *)((char *)this + 716),
(CustomSFXDelegate *)v5[68],
1,
1,
v5[68],
v5[68],
v5[68],
v5[68],
v37);
*((_DWORD *)this + 182) = v28;
v29 = (cocos2d::CCDirector *)(*(int (__fastcall **)(_DWORD, cocos2d::CCNode *, int))(**((_DWORD **)this + 115)
+ 232))(
*((_DWORD *)this + 115),
v28,
2);
cocos2d::CCDirector::sharedDirector(v29);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v38);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v39, v38[0] * 0.5, (float)(v38[1] * 0.5) + 70.0);
v30 = (MusicDownloadManager *)(*(int (__fastcall **)(_DWORD, _BYTE *))(**((_DWORD **)this + 182) + 92))(
*((_DWORD *)this + 182),
v39);
v31 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v30);
v32 = MusicDownloadManager::pathForSFX((MusicDownloadManager *)v40, v31, *((_DWORD *)this + 181));
v33 = FMODAudioEngine::sharedEngine(v32);
std::string::basic_string(&v41, (int)v40);
FMODAudioEngine::preloadEffect(v33, (int)&v41);
v34 = (FMODAudioEngine *)std::string::~string((int)&v41);
v35 = FMODAudioEngine::sharedEngine(v34);
std::string::basic_string(&v44, (int)v40);
*((_DWORD *)this + 183) = FMODAudioEngine::lengthForSound(v35, (unsigned __int8 *)&v44);
std::string::~string((int)&v44);
v36 = *((_DWORD *)this + 183);
if ( v36 )
{
SetupTriggerPopup::setMaxSliderValue(this, COERCE_COCOS2D_CCFLOAT_((float)v36), 408);
SetupTriggerPopup::setMaxSliderValue(this, COERCE_COCOS2D_CCFLOAT_((float)*((unsigned int *)this + 183)), 410);
SetupTriggerPopup::updateSlider((cocos2d::CCDictionary **)this, 408);
SetupTriggerPopup::updateSlider((cocos2d::CCDictionary **)this, 410);
}
SetupSFXPopup::updateLength((CustomSFXWidget **)this);
(*(void (__fastcall **)(_DWORD, bool))(**((_DWORD **)this + 182) + 172))(
*((_DWORD *)this + 182),
*((_DWORD *)this + 165) <= 1);
return COERCE_FLOAT(std::string::~string((int)v40));
}
return result;
}
v7 = (GameManager *)GameManager::sharedState((GameManager *)LODWORD(result));
if ( *((_DWORD *)v7 + 102)
&& (v8 = (GameManager *)GameManager::sharedState(v7), *(_DWORD *)(*((_DWORD *)v8 + 102) + 2084)) )
{
v9 = GameManager::sharedState(v8);
CustomSFXPathRaw = LevelSettingsObject::getCustomSFXPathRaw(
(LevelSettingsObject *)&v41,
*(_DWORD *)(*(_DWORD *)(v9 + 408) + 2084),
*((_DWORD *)this + 181),
v6);
}
else
{
v41 = 0;
v42 = 0;
v43 = nullptr;
CustomSFXPathRaw = (MusicDownloadManager *)std::string::__init(&v41, &unk_B6B226, 0);
}
if ( (v41 & 1) != 0 )
v11 = v42;
else
v11 = (int)(unsigned __int8)v41 >> 1;
if ( v11 )
{
LABEL_37:
v26 = (MusicDownloadManager *)MusicDownloadManager::sharedState(CustomSFXPathRaw);
v27 = MusicDownloadManager::resolveSFXPlacement(v26, *((_DWORD *)this + 181), v6, (unsigned __int8 *)&v41);
if ( v27 )
v5 = (bool *)v27;
result = COERCE_FLOAT(std::string::~string((int)&v41));
goto LABEL_40;
}
v12 = EditorSFXManager::sharedState(CustomSFXPathRaw);
EditorSFXManager::getCustomSFXRawPath((EditorSFXManager *)&v44, v12, *((_DWORD *)this + 181));
v14 = v41 & 1;
v13 = v14 == 0;
if ( (v41 & 1) != 0 )
{
v14 = 0;
*(_BYTE *)v43 = 0;
}
else
{
LOBYTE(v41) = v14;
BYTE1(v41) = v14;
}
if ( !v13 )
v42 = v14;
if ( (v41 & 1) != 0 )
{
v15 = v42;
v16 = (v41 & 0xFFFFFFFE) - 1;
if ( v42 <= 0xA )
{
if ( (v41 & 0xFFFFFFFE) != 0xB )
goto LABEL_25;
goto LABEL_36;
}
}
else
{
v15 = (int)(unsigned __int8)v41 >> 1;
if ( v15 <= 10 )
goto LABEL_36;
v16 = 10;
}
v17 = (v15 + 16) & 0xFFFFFFF0;
if ( v17 - 1 != v16 )
{
if ( v17 != 11 )
{
v20 = (char *)operator new(v17);
v19 = v41 & 1;
if ( (v41 & 1) != 0 )
v18 = (char *)v43;
else
v18 = (char *)&v41 + 1;
LABEL_29:
if ( (v41 & 1) != 0 )
v21 = v42;
else
v21 = (int)(unsigned __int8)v41 >> 1;
v22 = v21 + 1;
if ( v22 )
memcpy(v20, v18, v22);
if ( v19 )
operator delete(v18);
goto LABEL_36;
}
LABEL_25:
v18 = (char *)v43;
v19 = 1;
v20 = (char *)&v41 + 1;
goto LABEL_29;
}
LABEL_36:
v23 = v44;
v24 = v45;
v25 = v46;
v44 = 0;
v45 = 0;
v46 = nullptr;
v41 = v23;
v42 = v24;
v43 = v25;
CustomSFXPathRaw = (MusicDownloadManager *)std::string::~string((int)&v44);
goto LABEL_37;
}
return result;
}