//
// sub_1008FF950 from 0x1008ff950 to 0x1008ffb98 (584 bytes)
//
// 1 xrefs:
// > sub_1008FF5F0 @ 0x1008ff7ed
//
// 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:38:02 +0000
//
__int64 __fastcall sub_1008FF950(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax
size_t v4; // rax
size_t v5; // rbx
char *v6; // r14
char *v7; // rax
char *v8; // rdi
size_t v9; // r15
char *v10; // rax
_QWORD v12[2]; // [rsp+8h] [rbp-E8h] BYREF
char *v13; // [rsp+18h] [rbp-D8h]
void *v14; // [rsp+20h] [rbp-D0h] BYREF
_BYTE *v15; // [rsp+28h] [rbp-C8h]
_QWORD __dst[2]; // [rsp+38h] [rbp-B8h] BYREF
void *__p; // [rsp+48h] [rbp-A8h]
char __str[128]; // [rsp+50h] [rbp-A0h] BYREF
v2 = EditorSFXManager::sharedState();
sub_1008EE080((char **)&v14, v2);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1072LL))(a1, 0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 528LL))(a1, 1);
if ( v14 == v15 )
{
v13 = (char *)operator new(0x1Au);
v12[0] = 27;
v12[1] = 23;
strcpy(v13, "No SFX IDs to download.");
v7 = FLAlertLayer::create_1(0, (int)"Download", (__int64)v12, (int)"OK", 0, 260.0);
(*(void (__fastcall **)(char *))(*(_QWORD *)v7 + 1312LL))(v7);
if ( (v12[0] & 1) == 0 )
goto LABEL_15;
v8 = v13;
goto LABEL_14;
}
v3 = EditorSFXManager::sharedState();
sub_1008EE290(v3);
snprintf(
__str,
0x80u,
"Requested download for %u SFX. Missing files will be fetched in the background.",
(unsigned __int64)(v15 - (_BYTE *)v14) >> 2);
v4 = strlen(__str);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v5 = v4;
if ( v4 >= 0x17 )
{
v9 = 26;
if ( (v4 | 7) != 0x17 )
v9 = (v4 | 7) + 1;
v6 = (char *)operator new(v9);
__p = v6;
__dst[0] = v9 | 1;
__dst[1] = v5;
}
else
{
LOBYTE(__dst[0]) = 2 * v4;
v6 = (char *)__dst + 1;
if ( !v4 )
goto LABEL_12;
}
memcpy(v6, __str, v5);
LABEL_12:
v6[v5] = 0;
v10 = FLAlertLayer::create_1(0, (int)"Download", (__int64)__dst, (int)"OK", 0, 320.0);
(*(void (__fastcall **)(char *))(*(_QWORD *)v10 + 1312LL))(v10);
if ( (__dst[0] & 1) == 0 )
goto LABEL_15;
v8 = (char *)__p;
LABEL_14:
operator delete(v8);
LABEL_15:
if ( v14 )
{
v15 = v14;
operator delete(v14);
}
return __stack_chk_guard;
}