//
// MusicDownloadManager::createCustomSFXFolder from 0x1001d6958 to 0x1001d6aa0 (328 bytes)
//
// 4 xrefs:
// > sub_1001D852C @ 0x1001d8818
// > sub_1001D852C @ 0x1001d88cc
// > SFXBrowser::setTextPopupClosed @ 0x1001f7710
// > SFXFolderPickerPopup::setTextPopupClosed @ 0x100529cc4
//
// 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 11:00:25 +0000
//
char *__fastcall MusicDownloadManager::createCustomSFXFolder(__int64 a1, __int64 a2, int a3, int a4)
{
__int64 CustomSFXRoot; // x21
__int64 v8; // x0
char *v9; // x22
void *__p[2]; // [xsp+0h] [xbp-50h] BYREF
__int64 v12; // [xsp+10h] [xbp-40h]
__int128 v13; // [xsp+18h] [xbp-38h] BYREF
__int64 v14; // [xsp+28h] [xbp-28h]
CustomSFXRoot = sub_1001D6784(a1, a3);
if ( !CustomSFXRoot )
CustomSFXRoot = MusicDownloadManager::getCustomSFXRoot(a1);
sub_1001D6ABC((__int64 *)&v13, (std::string *)a2);
if ( *(char *)(a2 + 23) < 0 )
operator delete(*(void **)a2);
*(_OWORD *)a2 = v13;
*(_QWORD *)(a2 + 16) = v14;
if ( (*(char *)(a2 + 23) & 0x8000000000000000LL) != 0 )
{
if ( *(_QWORD *)(a2 + 8) )
goto LABEL_7;
LABEL_14:
std::string::assign((std::string *)a2, "New Folder");
goto LABEL_7;
}
if ( !*(_BYTE *)(a2 + 23) )
goto LABEL_14;
LABEL_7:
if ( (unsigned int)(a4 - 2) > 0xFFFFFD
|| (v8 = *(_QWORD *)(a1 + 824)) != 0 && cocos2d::CCDictionary::objectForKey_1(v8, (unsigned int)a4) )
{
a4 = sub_1001D68F0(a1);
}
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__p, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__p = *(_OWORD *)a2;
v12 = *(_QWORD *)(a2 + 16);
}
v9 = sub_1001D6418(a4, (__int64)__p);
if ( SHIBYTE(v12) < 0 )
operator delete(__p[0]);
*((_DWORD *)v9 + 19) = a4;
cocos2d::CCDictionary::setObject_1(*(_QWORD *)(a1 + 824), v9, a4);
sub_1002E74E0(*(_QWORD *)(CustomSFXRoot + 152), v9);
return v9;
}