//
// SFXBrowser::refreshLevelIDList from 0x14061b8a0 to 0x14061bcba (1050 bytes)
//
// 6 xrefs:
// > SFXBrowser::setupSFXBrowser @ 0x140618e91
// > SFXBrowser::setupSFXBrowser @ 0x1406192b2
// > SFXBrowser::setupSFXBrowser @ 0x14061939f
// > SFXBrowser::switchToView @ 0x14061b736
// > SFXBrowser::refreshCustomList @ 0x14061bcde
// > ??> @ 0x140930260
//
// 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:20 +0000
//
// Hidden C++ exception states: #wind=9
void __fastcall SFXBrowser::refreshLevelIDList(__int64 a1, _QWORD *a2)
{
int v3; // ebx
__int64 v4; // rax
cocos2d::CCObject *v5; // rcx
__int64 v6; // rax
__int64 v7; // rcx
__int64 v8; // rax
cocos2d::CCArray *v9; // r15
unsigned __int64 v10; // rsi
char *v11; // r14
__int64 v12; // r12
int v13; // edi
__int128 *CustomSFXPathRaw; // rax
void *v15; // rcx
struct cocos2d::CCObject *v16; // rdi
void *v17; // rcx
cocos2d::CCDictionary *v18; // rcx
cocos2d::CCObject *v19; // rcx
char *v20; // rax
void *v21; // [rsp+30h] [rbp-69h]
void *v22; // [rsp+30h] [rbp-69h]
unsigned __int64 v23; // [rsp+30h] [rbp-69h]
__int64 v24; // [rsp+38h] [rbp-61h]
void *Block[2]; // [rsp+40h] [rbp-59h] BYREF
__int64 v26; // [rsp+50h] [rbp-49h]
__int128 v27; // [rsp+58h] [rbp-41h] BYREF
__int64 v28; // [rsp+68h] [rbp-31h]
unsigned __int64 v29; // [rsp+70h] [rbp-29h]
void *v30; // [rsp+78h] [rbp-21h]
void *v31; // [rsp+80h] [rbp-19h]
__int128 v32; // [rsp+88h] [rbp-11h] BYREF
__int128 v33; // [rsp+98h] [rbp-1h]
_BYTE v34[32]; // [rsp+A8h] [rbp+Fh] BYREF
v3 = 0;
v4 = a2[19];
if ( v4 != a2[20] )
a2[20] = v4;
v5 = (cocos2d::CCObject *)a2[11];
if ( v5 )
{
cocos2d::CCObject::release(v5);
a2[11] = 0;
}
v6 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v21 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = qword_14090BFD0;
}
v7 = *(_QWORD *)(v6 + 568);
if ( v7 )
{
*(_OWORD *)Block = 0;
v26 = 0;
LevelEditorLayer::getSFXUsagePairs(v7, (__int64)Block);
v8 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v22 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v8 = qword_14090BFD0;
}
v24 = *(_QWORD *)(*(_QWORD *)(v8 + 568) + 3528LL);
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create(v24);
v10 = 0;
v11 = (char *)Block[0];
v23 = ((char *)Block[1] - (char *)Block[0]) >> 3;
if ( v23 )
{
do
{
v12 = *(int *)&v11[8 * v10];
v13 = *(_DWORD *)&v11[8 * v10 + 4];
if ( v13 > 0 )
{
if ( v24 )
{
CustomSFXPathRaw = (__int128 *)LevelSettingsObject::getCustomSFXPathRaw(v24, (__int64)v34, v12, v13);
v3 |= 1u;
}
else
{
v27 = 0;
v28 = 0;
v29 = 15;
LOBYTE(v27) = 0;
CustomSFXPathRaw = &v27;
v3 |= 2u;
}
v32 = 0;
v33 = 0u;
v32 = *CustomSFXPathRaw;
v33 = CustomSFXPathRaw[1];
*((_QWORD *)CustomSFXPathRaw + 2) = 0;
*((_QWORD *)CustomSFXPathRaw + 3) = 15;
*(_BYTE *)CustomSFXPathRaw = 0;
if ( (v3 & 2) != 0 )
{
v3 &= ~2u;
if ( v29 > 0xF )
{
v15 = (void *)v27;
if ( v29 + 1 >= 0x1000 )
{
v15 = *(void **)(v27 - 8);
if ( (unsigned __int64)(v27 - (_QWORD)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
}
if ( (v3 & 1) != 0 )
{
v3 &= ~1u;
sub_14003D310((__int64)v34);
}
if ( !qword_14090C070 )
{
v30 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v30);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
v16 = MusicDownloadManager::resolveSFXPlacement(qword_14090C070, v12, v13, (__int64 *)&v32);
if ( *((_QWORD *)&v33 + 1) > 0xFu )
{
v17 = (void *)v32;
if ( (unsigned __int64)(*((_QWORD *)&v33 + 1) + 1LL) >= 0x1000 )
{
v17 = *(void **)(v32 - 8);
if ( (unsigned __int64)(v32 - (_QWORD)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
*(_QWORD *)&v33 = 0;
*((_QWORD *)&v33 + 1) = 15;
LOBYTE(v32) = 0;
if ( v16 )
goto LABEL_53;
}
if ( !qword_14090C070 )
{
v31 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v31);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
v18 = *(cocos2d::CCDictionary **)(qword_14090C070 + 408);
if ( v18 )
{
v16 = cocos2d::CCDictionary::objectForKey(v18, v12);
if ( v16 )
{
LABEL_53:
if ( !*((_BYTE *)v16 + 72) && !cocos2d::CCArray::containsObject(v9, v16) )
cocos2d::CCArray::addObject(v9, v16);
}
}
++v10;
}
while ( v10 < v23 );
}
if ( (cocos2d::CCArray *)a2[11] != v9 )
{
if ( v9 )
cocos2d::CCObject::retain(v9);
v19 = (cocos2d::CCObject *)a2[11];
if ( v19 )
cocos2d::CCObject::release(v19);
a2[11] = v9;
}
if ( v11 )
{
v20 = v11;
if ( ((v26 - (_QWORD)v11) & 0xFFFFFFFFFFFFFFF8uLL) >= 0x1000 )
{
v11 = *((char **)v11 - 1);
if ( (unsigned __int64)(v20 - v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
}
}