//
// SFXBrowser::setTextPopupClosed from 0x14061e530 to 0x14061eb21 (1521 bytes)
//
// 2 xrefs:
// > ??> @ 0x1408153a8
// > ??> @ 0x140930314
//
// This function is hookable on this platform (idp: pc, 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:35:21 +0000
//
// Hidden C++ exception states: #wind=14
void __fastcall SFXBrowser::setTextPopupClosed(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v5; // rax
__int64 v6; // r14
__int64 v7; // r14
__int64 v8; // rax
char v9; // bl
void *v10; // rcx
__int64 v11; // rcx
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r8
__int64 v15; // rax
__int64 v16; // rbx
__int64 v17; // rdx
__int64 v18; // r8
cocos2d::CCNode *v19; // rax
void *v20; // rcx
size_t *v21; // rbx
__int64 v22; // rax
__int64 v23; // rdx
cocos2d::CCDictionary *v24; // rcx
struct cocos2d::CCObject *v25; // r14
_QWORD *v26; // rax
size_t v27; // r8
void *v28; // rdx
unsigned __int64 v29; // rcx
unsigned __int64 v30; // r9
unsigned __int64 v31; // rdx
char *v32; // r8
char *v33; // rax
char *v34; // rax
char *v35; // rax
__int64 v36; // rax
__int64 v37; // rbx
__int64 v38; // rcx
size_t *v39; // [rsp+30h] [rbp-99h] BYREF
void *v40; // [rsp+38h] [rbp-91h] BYREF
void **v41; // [rsp+40h] [rbp-89h]
void *Block[2]; // [rsp+48h] [rbp-81h] BYREF
__int64 v43; // [rsp+58h] [rbp-71h]
unsigned __int64 v44; // [rsp+60h] [rbp-69h]
__int64 v45; // [rsp+68h] [rbp-61h]
_QWORD v46[2]; // [rsp+70h] [rbp-59h] BYREF
unsigned __int64 v47; // [rsp+80h] [rbp-49h]
unsigned __int64 v48; // [rsp+88h] [rbp-41h]
void *v49[2]; // [rsp+90h] [rbp-39h] BYREF
__int128 v50; // [rsp+A0h] [rbp-29h]
_BYTE v51[32]; // [rsp+B0h] [rbp-19h] BYREF
__int128 v52; // [rsp+D0h] [rbp+7h] BYREF
__int64 v53; // [rsp+E0h] [rbp+17h]
__int64 v54; // [rsp+E8h] [rbp+1Fh]
v45 = a3;
LODWORD(v39) = 0;
if ( *(_BYTE *)(a1 + 264) )
{
*(_BYTE *)(a1 + 264) = 0;
v5 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v40 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v5 = qword_14090BFD0;
}
v6 = *(_QWORD *)(v5 + 568);
if ( v6 )
{
v7 = *(_QWORD *)(v6 + 3528);
if ( v7 )
{
if ( *(_QWORD *)(a3 + 16) )
{
v8 = sub_14003F4F0((__int64)v51, a3);
v9 = 2;
}
else
{
Block[1] = nullptr;
v43 = 8;
v44 = 15;
Block[0] = (void *)0x646574726F706D49LL;
v8 = (__int64)Block;
v9 = 1;
}
*(_OWORD *)v49 = *(_OWORD *)v8;
v50 = *(_OWORD *)(v8 + 16);
*(_QWORD *)(v8 + 16) = 0;
*(_QWORD *)(v8 + 24) = 15;
*(_BYTE *)v8 = 0;
if ( (v9 & 2) != 0 )
{
v9 &= ~2u;
sub_14003D310((__int64)v51);
}
if ( (v9 & 1) != 0 && v44 > 0xF )
{
v10 = Block[0];
if ( v44 + 1 >= 0x1000 )
{
v10 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v10 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v10);
}
LODWORD(v40) = 0;
LODWORD(v39) = 0;
v11 = qword_14090C070;
if ( *(_QWORD *)(v7 + 680) )
{
if ( !qword_14090C070 )
{
v41 = (void **)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v11 = qword_14090C070;
}
MusicDownloadManager::importCustomSFXSetup(v11, (__int64 *)(v7 + 664), (__int64)v49, 0, &v40, &v39);
}
else
{
if ( !qword_14090C070 )
{
v41 = (void **)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v41);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v11 = qword_14090C070;
}
MusicDownloadManager::importCustomSFXMappings(v11, (__int64 **)(v7 + 648), (__int64)v49, &v40, &v39);
}
if ( (int)v39 <= 0 )
v12 = cocos2d::CCString::createWithFormat("Imported %i", (_DWORD)v40);
else
v12 = cocos2d::CCString::createWithFormat("Imported %i (%i existing)", (_DWORD)v40, (_DWORD)v39);
CString = cocos2d::CCString::getCString(v12);
v52 = 0;
v53 = 0;
v54 = 0;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003D230(&v52, CString, v14);
v41 = Block;
*(_OWORD *)Block = 0;
v43 = 0;
v44 = 15;
LOBYTE(Block[0]) = 0;
v15 = sub_14003F4F0((__int64)v51, (__int64)&v52);
v16 = *(_QWORD *)(a1 - 688);
v19 = TextAlertPopup::create(v15, v17, v18, 150, (__int64)Block);
(*(void (__fastcall **)(__int64, cocos2d::CCNode *, __int64))(v16 + 456))(a1 - 688, v19, 100);
cocos2d::CCNode::scheduleOnce(a1 - 688, FLAlertLayer::rebuildContentDeferred);
sub_14003D310((__int64)&v52);
if ( *((_QWORD *)&v50 + 1) > 0xFu )
{
v20 = v49[0];
if ( (unsigned __int64)(*((_QWORD *)&v50 + 1) + 1LL) >= 0x1000 )
{
v20 = *((void **)v49[0] - 1);
if ( (unsigned __int64)((char *)v49[0] - (char *)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
}
}
}
else
{
if ( *(int *)(a1 + 348) <= 1 )
{
if ( *(_QWORD *)(a3 + 16) )
{
v36 = *(_QWORD *)(a1 + 24);
if ( v36 )
{
if ( *(_DWORD *)(v36 + 148) == 4 && *(_QWORD *)(v36 + 184) )
{
v41 = (void **)v51;
v37 = sub_14003F4F0((__int64)v51, a3);
v38 = qword_14090C070;
if ( !qword_14090C070 )
{
v39 = (size_t *)operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v39);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v38 = qword_14090C070;
}
MusicDownloadManager::createCustomSFXFolder(
v38,
v37,
*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 184LL) + 76LL),
0);
}
}
}
}
else
{
if ( *(_QWORD *)(a3 + 16) )
{
v41 = (void **)v51;
v21 = (size_t *)sub_14003F4F0((__int64)v51, a3);
v39 = v21;
v22 = qword_14090C070;
if ( !qword_14090C070 )
{
v40 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v40);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v22 = qword_14090C070;
}
v23 = *(int *)(a1 + 348);
v24 = *(cocos2d::CCDictionary **)(v22 + 920);
if ( v24 && (int)v23 > 0 )
v25 = cocos2d::CCDictionary::objectForKey(v24, v23);
else
v25 = nullptr;
v26 = sub_140486190(v49, (char *)v21);
sub_140059C40((__int64)v21, (__int64)v26);
sub_14003D310((__int64)v49);
if ( v25 )
{
v27 = v21[2];
if ( v27 )
{
if ( (size_t *)((char *)v25 + 80) != v21 )
{
v28 = v21;
if ( v21[3] > 0xF )
v28 = (void *)*v21;
sub_1400405A0((void **)v25 + 10, v28, v27);
}
sub_14003F4F0((__int64)v46, (__int64)v21);
v29 = 0;
v30 = v47;
if ( v47 )
{
v31 = v48;
v32 = (char *)v46[0];
do
{
v33 = (char *)v46;
if ( v31 > 0xF )
v33 = v32;
if ( v33[v29] >= 65 )
{
v34 = (char *)v46;
if ( v31 > 0xF )
v34 = v32;
if ( v34[v29] <= 90 )
{
v35 = (char *)v46;
if ( v31 > 0xF )
v35 = v32;
v35[v29] += 32;
v31 = v48;
v30 = v47;
v32 = (char *)v46[0];
}
}
++v29;
}
while ( v29 < v30 );
}
sub_140059C40((__int64)v25 + 112, (__int64)v46);
sub_14003D310((__int64)v46);
}
}
sub_14003D310((__int64)v21);
}
*(_DWORD *)(a1 + 348) = 0;
}
cocos2d::CCNode::scheduleOnce(a1 - 688, FLAlertLayer::rebuildContentDeferred);
}
sub_14003D310(a3);
}