//
// sub_1008F0AC0 from 0x1008f0ac0 to 0x1008f1087 (1479 bytes)
//
// 5 xrefs:
// > sub_1008F0610 @ 0x1008f062b
// > sub_1008F0640 @ 0x1008f069a
// > sub_1008F0860 @ 0x1008f086c
// > sub_1008F0880 @ 0x1008f0976
// > EditorSoundBrowserLayer::rebuildContent @ 0x1008f18bc
//
// 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 12:37:56 +0000
//
__int64 __fastcall sub_1008F0AC0(__int64 a1, int a2, int a3)
{
__int64 v4; // r12
int v5; // xmm0_4
__int64 v6; // rax
__int64 v7; // rdi
__int64 v8; // rdi
_DWORD *v9; // rdi
int v10; // eax
__int64 v11; // rax
__int64 v12; // rax
unsigned int v13; // eax
int v14; // r15d
__int64 v15; // rax
__int64 v16; // r15
void *v17; // r14
int v18; // eax
int v19; // ebx
int v20; // eax
int v21; // ecx
__int64 v22; // rax
int v23; // esi
bool v24; // cc
int v25; // esi
char *v26; // rax
const std::string::value_type *CString; // rax
char *v28; // r15
__int64 v29; // rbx
const std::string::value_type *Key; // rax
std::string *v31; // rax
std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 v32; // r12
std::string::value_type v33; // r13
std::string::pointer data; // r14
__int64 v35; // rcx
__int64 v36; // rax
const char *v37; // rsi
__int64 v38; // rdi
void *v39; // rsi
_QWORD *v40; // rax
__int64 v41; // rax
signed int v43; // r12d
int v44; // r13d
__int64 v45; // rax
__int64 v46; // rax
void *v47; // rax
std::string v48; // [rsp+8h] [rbp-98h] BYREF
std::string v49; // [rsp+20h] [rbp-80h] BYREF
__int64 v50; // [rsp+38h] [rbp-68h]
std::string v51; // [rsp+40h] [rbp-60h] BYREF
_BYTE v52[14]; // [rsp+60h] [rbp-40h]
v4 = a1;
v5 = 0;
if ( a3 )
{
v6 = *(_QWORD *)(a1 + 1056);
if ( v6 )
{
v7 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v6 + 544) + 424LL) + 488LL);
v5 = *(_DWORD *)((*(__int64 (__fastcall **)(__int64, double))(*(_QWORD *)v7 + 192LL))(v7, 0.0) + 4);
}
}
*(_DWORD *)(v4 + 1200) = v5;
v8 = *(_QWORD *)(v4 + 1056);
if ( v8 )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 536LL))(v8);
*(_QWORD *)(v4 + 1056) = 0;
}
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(v4 + 584) + 568LL))(*(_QWORD *)(v4 + 584), 9999, 1);
v9 = *(_DWORD **)(v4 + 1104);
if ( v9 )
{
cocos2d::CCObject::release(v9);
*(_QWORD *)(v4 + 1104) = 0;
}
if ( (*(_BYTE *)(v4 + 1144) & 1) != 0 )
{
**(_BYTE **)(v4 + 1160) = 0;
*(_QWORD *)(v4 + 1152) = 0;
v10 = *(_DWORD *)(v4 + 1048);
if ( v10 != 9 )
{
LABEL_10:
if ( v10 == 1 )
{
if ( EditorSFXManager::sharedState() )
{
v15 = EditorSFXManager::sharedState();
v12 = sub_1008ED460(v15);
LABEL_22:
v16 = v12;
v17 = sub_1007FE900();
if ( v16 )
{
v18 = *(_DWORD *)(v4 + 1052);
if ( v18 > 0 )
{
while ( 1 )
{
v19 = 10 * v18;
v20 = sub_1007FEF90(v16);
v21 = *(_DWORD *)(v4 + 1052);
if ( v19 < v20 )
break;
v18 = v21 - 1;
*(_DWORD *)(v4 + 1052) = v21 - 1;
if ( v21 <= 1 )
goto LABEL_53;
}
v18 = *(_DWORD *)(v4 + 1052);
}
LABEL_53:
v50 = v4;
v43 = 10 * v18;
if ( 10 * v18 < (int)sub_1007FEF90(v16) )
{
v44 = v43 + 9;
do
{
v45 = sub_1007FEFE0(v16, v43);
sub_1007FEBF0((__int64)v17, v45);
if ( v43 + 1 >= (int)sub_1007FEF90(v16) )
break;
v24 = v43++ < v44;
}
while ( v24 );
}
v4 = v50;
*(_DWORD *)(v50 + 1112) = sub_1007FEF90(v16);
}
goto LABEL_58;
}
}
else
{
if ( v10 )
{
memset(&v51, 0, sizeof(v51));
v14 = 6;
switch ( v10 )
{
case 2:
if ( !GJAccountManager::sharedState((__int64)v9, 9999) )
goto LABEL_62;
v22 = GJAccountManager::sharedState((__int64)v9, 9999);
v23 = *(_DWORD *)(v22 + 352);
v24 = v23 <= *(_DWORD *)(v22 + 356);
v25 = v23 - *(_DWORD *)(v22 + 356);
if ( v24 )
goto LABEL_62;
v26 = sub_10088E820("%d", v25);
CString = (const std::string::value_type *)cocos2d::CCString::getCString((__int64)v26);
v14 = 5;
std::string::assign(&v51, CString);
goto LABEL_18;
case 4:
v14 = 3;
goto LABEL_18;
case 5:
if ( GJAccountManager::sharedState((__int64)v9, 9999) )
{
v46 = GJAccountManager::sharedState((__int64)v9, 9999);
v14 = 13;
if ( *(_DWORD *)(v46 + 352) > *(_DWORD *)(v46 + 356) )
goto LABEL_18;
}
LABEL_62:
*(_DWORD *)(v4 + 1112) = 0;
v47 = sub_1007FE900();
sub_1008F1170(v4, v47, "No lists found.");
sub_1008F13A0(v4);
goto LABEL_49;
case 6:
v14 = 2;
goto LABEL_18;
case 7:
v14 = 1;
goto LABEL_18;
case 8:
v14 = 4;
goto LABEL_18;
default:
goto LABEL_18;
}
}
if ( EditorSFXManager::sharedState() )
{
v11 = EditorSFXManager::sharedState();
v12 = sub_1008ED030(v11);
goto LABEL_22;
}
}
v17 = sub_1007FE900();
LABEL_58:
v38 = v4;
v39 = v17;
goto LABEL_59;
}
}
else
{
*(_WORD *)(v4 + 1144) = 0;
v10 = *(_DWORD *)(v4 + 1048);
if ( v10 != 9 )
goto LABEL_10;
}
v13 = *(unsigned __int8 *)(v4 + 1120);
if ( (v13 & 1) == 0 )
{
if ( v13 >> 1 )
goto LABEL_17;
LABEL_43:
*(_DWORD *)(v4 + 1112) = 0;
v38 = v4;
v39 = sub_1007FE900();
LABEL_59:
sub_1008F1170(v38, v39, "No lists found.");
return sub_1008F13A0(v4);
}
if ( !*(_QWORD *)(v4 + 1128) )
goto LABEL_43;
LABEL_17:
memset(&v51, 0, sizeof(v51));
v14 = 0;
std::string::operator=(&v51, (const std::string *)(v4 + 1120));
LABEL_18:
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
sub_10001AD30(&v49, v51.__r_.__value_.__l.__data_, v51.__r_.__value_.__l.__size_);
else
v49 = v51;
v28 = GJSearchObject::create_1(v14, &v49);
LODWORD(v50) = a2;
if ( (*(_BYTE *)&v49.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v49.__r_.__value_.__l.__data_);
v29 = v4;
*((_DWORD *)v28 + 98) = *(_DWORD *)(v4 + 1052);
v48.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)6;
*(_DWORD *)((char *)&v48.__r_.__value_.__l.0 + 1) = 6255461;
Key = (const std::string::value_type *)GJSearchObject::getKey((__int64)v28);
v31 = std::string::append(&v48, Key);
v32 = v31->__r_.__value_.__s.0;
v33 = v31->__r_.__value_.__s.__data_[0];
*(_QWORD *)&v52[6] = v31->__r_.__value_.__l.__size_;
*(_QWORD *)v52 = *(std::string::size_type *)((char *)v31->__r_.__value_.__r.__words + 2);
data = v31->__r_.__value_.__l.__data_;
*(_OWORD *)&v31->__r_.__value_.__l.0 = 0;
v31->__r_.__value_.__r.__words[2] = 0;
if ( (*(_BYTE *)(v29 + 1144) & 1) != 0 )
operator delete(*(void **)(v29 + 1160));
*(std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0 *)(v29 + 1144) = v32;
*(_BYTE *)(v29 + 1145) = v33;
v35 = *(_QWORD *)&v52[6];
*(_QWORD *)(v29 + 1146) = *(_QWORD *)v52;
*(_QWORD *)(v29 + 1152) = v35;
*(_QWORD *)(v29 + 1160) = data;
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v48.__r_.__value_.__l.__data_);
if ( (_BYTE)v50 )
{
v36 = GameLevelManager::sharedState();
if ( (*(_BYTE *)(v29 + 1144) & 1) != 0 )
v37 = *(const char **)(v29 + 1160);
else
v37 = (const char *)(v29 + 1145);
GameLevelManager::resetTimerForKey(v36, v37);
}
*(_QWORD *)(GameLevelManager::sharedState() + 1328) = v29 + 1016;
if ( !*(_QWORD *)(v29 + 1096) )
{
v40 = LoadingCircle::create();
*(_QWORD *)(v29 + 1096) = v40;
v40[69] = *(_QWORD *)(v29 + 584);
LoadingCircle::show((__int64)v40);
}
v41 = GameLevelManager::sharedState();
sub_10055BD10(v41, (__int64)v28);
LABEL_49:
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v51.__r_.__value_.__l.__data_);
return __stack_chk_guard;
}