//
// MusicDownloadManager::createCustomSFXPlacement from 0x56e318 to 0x56e480 (360 bytes)
//
// 2 xrefs:
// > sub_575E04 @ 0x5760a2
// > SFXBrowser::sfxFolderPicked @ 0x6c5188
//
// 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:52:35 +0000
//
SFXInfoObject *__fastcall MusicDownloadManager::createCustomSFXPlacement(
cocos2d::CCDictionary **a1,
const char *a2,
int a3,
unsigned __int8 *a4,
int a5)
{
int v8; // r8
int CustomSFXFolderForID; // r10
cocos2d::CCDictionary *SFXObject; // r6
int v11; // r0
int v12; // r1
int v13; // r2
int v14; // r3
int v15; // r2
int v16; // r3
cocos2d::CCString *v17; // r0
const char *CString; // r0
size_t v19; // r0
int v20; // r0
int v21; // r1
int v22; // r2
int v23; // r3
int v24; // r1
SFXInfoObject *v25; // r4
const char *v27; // [sp+Ch] [bp-18h]
int v28; // [sp+10h] [bp-14h] BYREF
int v29; // [sp+14h] [bp-10h]
int v30; // [sp+18h] [bp-Ch]
v8 = a5;
CustomSFXFolderForID = MusicDownloadManager::getCustomSFXFolderForID((MusicDownloadManager *)a1, a3);
if ( !CustomSFXFolderForID )
CustomSFXFolderForID = MusicDownloadManager::getCustomSFXRoot(a1);
SFXObject = MusicDownloadManager::getSFXObject((MusicDownloadManager *)a1, (int)a2);
sub_56D02C(&v28, a4);
if ( (*a4 & 1) != 0 )
{
**((_BYTE **)a4 + 2) = 0;
*((_DWORD *)a4 + 1) = 0;
}
else
{
a4[1] = 0;
*a4 = 0;
}
std::string::reserve((int *)a4, 0);
v11 = v28;
v12 = v29;
v13 = v30;
v28 = 0;
v29 = 0;
v30 = 0;
*(_DWORD *)a4 = v11;
*((_DWORD *)a4 + 1) = v12;
*((_DWORD *)a4 + 2) = v13;
std::string::~string((int)&v28);
v14 = *a4;
v15 = v14 << 31;
if ( (v14 & 1) != 0 )
v16 = *((_DWORD *)a4 + 1);
else
v16 = v14 >> 1;
if ( !v16 )
{
if ( SFXObject )
{
std::string::basic_string(&v28, (int)SFXObject + 76);
}
else
{
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"SFX %i", a2, v15);
CString = (const char *)cocos2d::CCString::getCString(v17);
v28 = 0;
v29 = 0;
v30 = 0;
v27 = CString;
v19 = strlen(CString);
std::string::__init(&v28, v27, v19);
}
if ( (*a4 & 1) != 0 )
{
**((_BYTE **)a4 + 2) = 0;
*((_DWORD *)a4 + 1) = 0;
}
else
{
a4[1] = 0;
*a4 = 0;
}
std::string::reserve((int *)a4, 0);
v20 = v28;
v21 = v29;
v22 = v30;
v28 = 0;
v29 = 0;
v30 = 0;
*(_DWORD *)a4 = v20;
*((_DWORD *)a4 + 1) = v21;
*((_DWORD *)a4 + 2) = v22;
std::string::~string((int)&v28);
}
if ( (unsigned int)(a5 - 2) > 0xFFFFFD || MusicDownloadManager::getCustomSFXObject((MusicDownloadManager *)a1, a5) )
v8 = MusicDownloadManager::mintCustomSFXID((MusicDownloadManager *)a1);
std::string::basic_string(&v28, (int)a4);
if ( SFXObject )
{
v23 = *((_DWORD *)SFXObject + 15);
v24 = *((_DWORD *)SFXObject + 16);
}
else
{
v23 = 0;
v24 = 0;
}
v25 = SFXInfoObject::create((int)a2, (int)&v28, *(_DWORD *)(CustomSFXFolderForID + 72), v23, v24);
std::string::~string((int)&v28);
*((_DWORD *)v25 + 18) = v8;
cocos2d::CCDictionary::setObject(a1[133], v25, v8);
cocos2d::CCArray::addObject(*(cocos2d::CCArray **)(CustomSFXFolderForID + 112), v25);
return v25;
}