//
// sub_1008F8520 from 0x1008f8520 to 0x1008f86a6 (390 bytes)
//
// 4 xrefs:
// > sub_1008F84B0 @ 0x1008f84da
// > EditorSoundConfigInfoLayer::musicActionFinished @ 0x1008f873a
// > sub_1008F8750 @ 0x1008f876b
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0x1008f91c0
//
// 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:59 +0000
//
void __fastcall sub_1008F8520(__int64 a1)
{
_DWORD *v1; // r15
__int64 v2; // r14
__int64 v3; // r13
__int64 v4; // rax
char *v5; // rax
const char *CString; // r14
size_t v7; // rax
size_t v8; // r15
char *v9; // r12
size_t v10; // r13
char *v11; // rax
void *v12; // rdi
void *__p; // [rsp+0h] [rbp-70h] BYREF
_BYTE *v14; // [rsp+8h] [rbp-68h]
__int128 v15; // [rsp+18h] [rbp-58h] BYREF
void *v16; // [rsp+28h] [rbp-48h]
__int128 __dst; // [rsp+30h] [rbp-40h] BYREF
void *v18; // [rsp+40h] [rbp-30h]
sub_1008F8190((char **)&__p, a1);
v1 = __p;
v2 = (v14 - (_BYTE *)__p) >> 2;
if ( v14 != __p )
{
v3 = 0;
do
{
v4 = MusicDownloadManager::sharedState();
MusicDownloadManager::downloadSFX(v4, v1[v3++]);
}
while ( (v2 == 0) + v2 != v3 );
}
v5 = sub_10088E820("Downloading %i SFX", v2);
CString = (const char *)cocos2d::CCString::getCString((__int64)v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
v18 = v9;
*(_QWORD *)&__dst = v10 | 1;
*((_QWORD *)&__dst + 1) = v8;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
LABEL_11:
memmove(v9, CString, v8);
v9[v8] = 0;
LOWORD(v15) = 0;
v11 = TextAlertPopup::create(&__dst, 0x96u, &v15, 0.5, 0.60000002);
(*(void (__fastcall **)(__int64, char *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v11, 100);
if ( (v15 & 1) != 0 )
{
operator delete(v16);
if ( (__dst & 1) == 0 )
{
LABEL_14:
v12 = __p;
if ( !__p )
return;
goto LABEL_15;
}
}
else if ( (__dst & 1) == 0 )
{
goto LABEL_14;
}
operator delete(v18);
v12 = __p;
if ( __p )
LABEL_15:
operator delete(v12);
}