//
// SFXBrowser::sfxFolderPicked from 0xb90f84 to 0xb9144c (1224 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'SFXBrowser::sfxFolderPicked @ 0xb91450
// > ??> @ 0xf5848
// > ??> @ 0x14d6c48
//
// 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:38 +0000
//
__int64 __fastcall SFXBrowser::sfxFolderPicked(FLAlertLayer *a1, __int64 a2, int a3, char *a4)
{
int v6; // w1
MusicDownloadManager *v7; // x0
cocos2d::CCDictionary **v8; // x24
char v9; // w0
unsigned int v10; // w22
MusicDownloadManager *v11; // x0
__int64 v12; // x1
cocos2d::CCObject *CustomSFXPlacement; // x21
MusicDownloadManager *v14; // x0
MusicDownloadManager *v15; // x0
__int64 v16; // x0
const char *v17; // x1
cocos2d::CCString *v18; // x0
const char *v19; // x1
size_t v20; // x0
void (__fastcall *v21)(FLAlertLayer *, __int64, __int64); // x22
__int64 v22; // x0
__int64 v23; // x0
MusicDownloadManager *v25; // x19
MusicDownloadManager *v26; // x22
int v27; // w24
unsigned int v28; // w25
unsigned int v29; // w26
MusicDownloadManager *v30; // x0
__int64 CustomSFXObject; // x0
MusicDownloadManager *v32; // x0
MusicDownloadManager *v33; // x0
MusicDownloadManager *v34; // x0
__int64 CustomSFXFolderForID; // x0
__int64 v36; // x3
const char *v37; // x2
cocos2d::CCString *v38; // x0
char *CString; // x0
void (__fastcall *v40)(FLAlertLayer *, __int64, __int64); // x22
__int64 v41; // x0
MusicDownloadManager *v42; // x1
MusicDownloadManager *v43; // x1
MusicDownloadManager *v44; // x0
char *v46; // [xsp+58h] [xbp+58h]
__int64 v47; // [xsp+60h] [xbp+60h] BYREF
size_t v48; // [xsp+68h] [xbp+68h]
void *v49; // [xsp+70h] [xbp+70h]
__int64 v50; // [xsp+78h] [xbp+78h] BYREF
size_t v51; // [xsp+80h] [xbp+80h]
void *v52; // [xsp+88h] [xbp+88h]
MusicDownloadManager *v53; // [xsp+90h] [xbp+90h] BYREF
__int64 v54; // [xsp+98h] [xbp+98h]
void *v55; // [xsp+A0h] [xbp+A0h]
v6 = *((_DWORD *)a1 + 257);
v7 = (MusicDownloadManager *)_stack_chk_guard;
if ( v6 <= 0 )
{
v25 = *((MusicDownloadManager **)a1 + 125);
v26 = (FLAlertLayer *)((char *)a1 + 1008);
v27 = 0;
v28 = 0;
v29 = 0;
while ( v25 != v26 )
{
while ( 1 )
{
v30 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v7);
CustomSFXObject = MusicDownloadManager::getCustomSFXObject(v30, *((_DWORD *)v25 + 7));
if ( CustomSFXObject )
{
v32 = (MusicDownloadManager *)*(unsigned int *)(CustomSFXObject + 60);
if ( (_DWORD)v32 == a3 )
{
++v27;
}
else
{
v44 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v32);
if ( (unsigned __int8)MusicDownloadManager::moveCustomSFXObject(v44, *((_DWORD *)v25 + 7), a3) )
++v29;
else
++v28;
}
}
v7 = *((MusicDownloadManager **)v25 + 1);
if ( !v7 )
break;
do
{
v25 = v7;
v7 = *(MusicDownloadManager **)v7;
}
while ( v7 );
if ( v25 == v26 )
goto LABEL_30;
}
do
{
v42 = v25;
v25 = *((MusicDownloadManager **)v25 + 2);
v7 = *(MusicDownloadManager **)v25;
if ( v42 == *(MusicDownloadManager **)v25 )
break;
v43 = v25;
v25 = *((MusicDownloadManager **)v25 + 2);
v7 = *(MusicDownloadManager **)v25;
}
while ( v43 != *(MusicDownloadManager **)v25 );
}
LABEL_30:
v33 = (MusicDownloadManager *)std::__tree::clear((_QWORD *)a1 + 125);
v34 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v33);
CustomSFXFolderForID = MusicDownloadManager::getCustomSFXFolderForID(v34, a3);
if ( CustomSFXFolderForID )
{
v36 = CustomSFXFolderForID + 80;
v37 = (const char *)(CustomSFXFolderForID + 81);
if ( (*(_BYTE *)(CustomSFXFolderForID + 80) & 1) != 0 )
v37 = *(const char **)(CustomSFXFolderForID + 96);
}
else
{
v37 = "folder";
}
v47 = 0;
v48 = 0;
v49 = nullptr;
if ( v29 | v28 )
{
if ( v28 )
{
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Moved %i to %s, skipped %i",
(const char *)v29,
v37,
v28);
goto LABEL_36;
}
}
else if ( v27 )
{
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Already in %s", v37);
LABEL_36:
CString = (char *)cocos2d::CCString::getCString(v38);
std::string::assign(&v47, CString);
v40 = *(void (__fastcall **)(FLAlertLayer *, __int64, __int64))(*(_QWORD *)a1 + 464LL);
v50 = 0;
v51 = 0;
v52 = nullptr;
if ( (v47 & 1) != 0 )
{
std::string::__init(&v50, v49, v48);
}
else
{
v50 = v47;
v51 = v48;
v52 = v49;
}
v53 = nullptr;
v54 = 0;
v55 = nullptr;
std::string::__init((__int64 *)&v53, &byte_11B8890, 0);
v41 = TextAlertPopup::create((char *)&v50, 150, (char *)&v53, 0.75, 0.5);
v40(a1, v41, 100);
if ( ((unsigned __int8)v53 & 1) != 0 )
operator delete(v55);
if ( (v50 & 1) != 0 )
operator delete(v52);
goto LABEL_18;
}
v38 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Moved %i to %s",
(const char *)v29,
v37,
v36);
goto LABEL_36;
}
v8 = (cocos2d::CCDictionary **)MusicDownloadManager::sharedState(_stack_chk_guard);
v53 = nullptr;
v54 = 0;
v9 = *a4;
v55 = nullptr;
v10 = *((_DWORD *)a1 + 257);
if ( (v9 & 1) != 0 )
{
std::string::__init((__int64 *)&v53, *((void **)a4 + 2), *((_QWORD *)a4 + 1));
}
else
{
v11 = *(MusicDownloadManager **)a4;
v12 = *((_QWORD *)a4 + 1);
v55 = *((void **)a4 + 2);
v53 = v11;
v54 = v12;
}
CustomSFXPlacement = MusicDownloadManager::createCustomSFXPlacement(v8, v10, a3, (__int64)&v53, *((_DWORD *)a1 + 258));
v14 = (MusicDownloadManager *)(unsigned __int8)v53;
if ( ((unsigned __int8)v53 & 1) != 0 )
operator delete(v55);
*((_DWORD *)a1 + 257) = 0;
*((_DWORD *)a1 + 258) = 0;
v15 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v14);
v16 = MusicDownloadManager::getCustomSFXFolderForID(v15, *((_DWORD *)CustomSFXPlacement + 15));
if ( v16 )
{
v17 = (const char *)(v16 + 81);
if ( (*(_BYTE *)(v16 + 80) & 1) != 0 )
v17 = *(const char **)(v16 + 96);
v18 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Added to %s", v17);
v19 = (const char *)cocos2d::CCString::getCString(v18);
}
else
{
v19 = "Sound added";
}
v46 = (char *)v19;
v47 = 0;
v48 = 0;
v49 = nullptr;
v20 = strlen(v19);
std::string::__init(&v47, v46, v20);
v21 = *(void (__fastcall **)(FLAlertLayer *, __int64, __int64))(*(_QWORD *)a1 + 464LL);
v50 = 0;
v51 = 0;
v52 = nullptr;
if ( (v47 & 1) != 0 )
{
std::string::__init(&v50, v49, v48);
}
else
{
v50 = v47;
v51 = v48;
v52 = v49;
}
v53 = nullptr;
v54 = 0;
v55 = nullptr;
std::string::__init((__int64 *)&v53, &byte_11B8890, 0);
v22 = TextAlertPopup::create((char *)&v50, 150, (char *)&v53, 0.75, 0.5);
v21(a1, v22, 100);
if ( ((unsigned __int8)v53 & 1) != 0 )
operator delete(v55);
if ( (v50 & 1) != 0 )
operator delete(v52);
v23 = *((_QWORD *)a1 + 89);
if ( v23 && (unsigned int)(*(_DWORD *)(v23 + 140) - 3) <= 1 )
LABEL_18:
FLAlertLayer::requestRebuild(a1);
if ( (v47 & 1) != 0 )
operator delete(v49);
return _stack_chk_guard;
}