//
// SFXBrowser::setTextPopupClosed from 0xb8f1b4 to 0xb8f618 (1124 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'SFXBrowser::setTextPopupClosed @ 0xb8f620
// > ??> @ 0xc9940
// > ??> @ 0x14d6c58
//
// 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:36 +0000
//
__int64 __fastcall SFXBrowser::setTextPopupClosed(FLAlertLayer *this, __int64 a2, unsigned __int8 *a3)
{
GameManager *v4; // x0
MusicDownloadManager *v5; // x0
__int64 v6; // x1
GameManager *v8; // x0
__int64 v9; // x21
int v10; // w0
void *v11; // x0
__int64 v12; // x5
MusicDownloadManager *v13; // x0
__int64 v14; // x1
MusicDownloadManager *v15; // x0
cocos2d::CCString *v16; // x0
const char *CString; // x0
size_t v18; // x0
__int64 v19; // x1
void (__fastcall *v20)(FLAlertLayer *, __int64, __int64); // x23
__int64 v21; // x0
MusicDownloadManager *v22; // x23
char v23; // w0
int v24; // w22
__int64 v25; // x0
__int64 v26; // x1
void *v27; // x1
size_t v28; // x2
SFXSearchResult *v29; // x0
MusicDownloadManager *ActiveFolder; // x0
cocos2d::CCDictionary **v31; // x22
char v32; // w0
__int64 v33; // x0
__int64 v34; // x1
__int64 v35; // x0
MusicDownloadManager *v36; // x0
char *v38; // [xsp+48h] [xbp+48h]
char *v41; // [xsp+50h] [xbp+50h] BYREF
__int64 v42; // [xsp+58h] [xbp+58h] BYREF
__int64 v43; // [xsp+60h] [xbp+60h]
void *v44; // [xsp+68h] [xbp+68h]
__int64 v45; // [xsp+70h] [xbp+70h] BYREF
size_t v46; // [xsp+78h] [xbp+78h]
void *v47; // [xsp+80h] [xbp+80h]
__int64 v48; // [xsp+88h] [xbp+88h] BYREF
size_t v49; // [xsp+90h] [xbp+90h]
void *v50; // [xsp+98h] [xbp+98h]
__int64 v51; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v52; // [xsp+A8h] [xbp+A8h]
void *v53; // [xsp+B0h] [xbp+B0h]
v4 = (GameManager *)*((unsigned __int8 *)this + 944);
if ( !(_DWORD)v4 )
{
v5 = (MusicDownloadManager *)*a3;
v6 = (unsigned __int8)v5 >> 1;
if ( *((int *)this + 259) <= 1 )
{
if ( ((unsigned __int8)v5 & 1) != 0 )
v6 = *((_QWORD *)a3 + 1);
if ( v6 )
{
v29 = *((SFXSearchResult **)this + 89);
if ( v29 )
{
if ( *((_DWORD *)v29 + 35) == 4 )
{
ActiveFolder = (MusicDownloadManager *)SFXSearchResult::getActiveFolder(v29);
if ( ActiveFolder )
{
v31 = (cocos2d::CCDictionary **)MusicDownloadManager::sharedState(ActiveFolder);
v51 = 0;
v52 = 0;
v32 = *a3;
v53 = nullptr;
if ( (v32 & 1) != 0 )
{
std::string::__init(&v51, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v33 = *(_QWORD *)a3;
v34 = *((_QWORD *)a3 + 1);
v53 = *((void **)a3 + 2);
v51 = v33;
v52 = v34;
}
v35 = SFXSearchResult::getActiveFolder(*((SFXSearchResult **)this + 89));
MusicDownloadManager::createCustomSFXFolder(v31, (__int64)&v51, *(_DWORD *)(v35 + 76), 0);
if ( (v51 & 1) != 0 )
operator delete(v53);
}
}
}
}
}
else
{
if ( ((unsigned __int8)v5 & 1) != 0 )
v6 = *((_QWORD *)a3 + 1);
if ( v6 )
{
v22 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v5);
v51 = 0;
v52 = 0;
v23 = *a3;
v53 = nullptr;
v24 = *((_DWORD *)this + 259);
if ( (v23 & 1) != 0 )
{
std::string::__init(&v51, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v25 = *(_QWORD *)a3;
v26 = *((_QWORD *)a3 + 1);
v53 = *((void **)a3 + 2);
v51 = v25;
v52 = v26;
}
MusicDownloadManager::renameCustomSFXObject(v22, v24, (__int64)&v51);
if ( (v51 & 1) != 0 )
operator delete(v53);
}
*((_DWORD *)this + 259) = 0;
}
FLAlertLayer::requestRebuild(this);
return _stack_chk_guard;
}
*((_BYTE *)this + 944) = 0;
v8 = *(GameManager **)(GameManager::sharedState(v4) + 552);
if ( !v8 )
return _stack_chk_guard;
v9 = *(_QWORD *)(*(_QWORD *)(GameManager::sharedState(v8) + 552) + 3272LL);
if ( !v9 )
return _stack_chk_guard;
v10 = *a3;
if ( (v10 & 1) != 0 )
{
if ( *((_QWORD *)a3 + 1) )
{
v27 = *((void **)a3 + 2);
v28 = *((_QWORD *)a3 + 1);
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, v27, v28);
goto LABEL_14;
}
LABEL_47:
v42 = 0;
v43 = 0;
v44 = nullptr;
std::string::__init(&v42, "Imported", 8u);
goto LABEL_14;
}
if ( !(v10 >> 1) )
goto LABEL_47;
v11 = *((void **)a3 + 2);
v12 = *((_QWORD *)a3 + 1);
v42 = *(_QWORD *)a3;
v43 = v12;
v44 = v11;
LABEL_14:
v13 = (MusicDownloadManager *)*(unsigned __int8 *)(v9 + 608);
v41 = nullptr;
v14 = (unsigned __int8)v13 >> 1;
if ( ((unsigned __int8)v13 & 1) != 0 )
v14 = *(_QWORD *)(v9 + 616);
if ( v14 )
{
v15 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v13);
MusicDownloadManager::importCustomSFXSetup(v15, v9 + 608, (char *)&v42, 0, &v41, (_DWORD *)&v41 + 1);
}
else
{
v36 = (MusicDownloadManager *)MusicDownloadManager::sharedState(v13);
MusicDownloadManager::importCustomSFXMappings(v36, (_QWORD **)(v9 + 584), (__int64)&v42, &v41, (_DWORD *)&v41 + 1);
}
if ( SHIDWORD(v41) <= 0 )
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Imported %i",
(const char *)(unsigned int)v41);
else
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Imported %i (%i existing)",
(const char *)(unsigned int)v41);
CString = (const char *)cocos2d::CCString::getCString(v16);
v45 = 0;
v38 = (char *)CString;
v46 = 0;
v47 = nullptr;
v18 = strlen(CString);
std::string::__init(&v45, v38, v18);
v19 = *(_QWORD *)this;
v48 = 0;
v49 = 0;
v50 = nullptr;
v20 = *(void (__fastcall **)(FLAlertLayer *, __int64, __int64))(v19 + 464);
if ( (v45 & 1) != 0 )
{
std::string::__init(&v48, v47, v46);
}
else
{
v50 = v47;
v48 = v45;
v49 = v46;
}
v51 = 0;
v52 = 0;
v53 = nullptr;
std::string::__init(&v51, &byte_11B8890, 0);
v21 = TextAlertPopup::create((char *)&v48, 150, (char *)&v51, 0.9, 0.5);
v20(this, v21, 100);
if ( (v51 & 1) != 0 )
operator delete(v53);
if ( (v48 & 1) != 0 )
operator delete(v50);
FLAlertLayer::requestRebuild(this);
if ( (v45 & 1) != 0 )
operator delete(v47);
if ( (v42 & 1) != 0 )
operator delete(v44);
return _stack_chk_guard;
}