//
// sub_1008F5C20 from 0x1008f5c20 to 0x1008f620e (1518 bytes)
//
// 3 xrefs:
// > sub_1008F3770 @ 0x1008f436e
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0x1008f9018
// > EditorSoundConfigInfoLayer::downloadEditorSoundFinished @ 0x1008f97d9
//
// 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:58 +0000
//
void __fastcall sub_1008F5C20(__int64 a1)
{
__int64 v1; // rax
__int64 v3; // r12
__int64 v4; // rax
__int128 *v5; // rax
const char *v6; // rdi
char *v7; // rax
__int64 v8; // rbx
__int64 v9; // r13
const std::string::value_type *v10; // rax
unsigned __int64 v11; // r15
void *v12; // rbx
unsigned __int64 v13; // r15
const char *v14; // rdx
char *v15; // rax
const char *CString; // r15
size_t v17; // rax
size_t v18; // r12
char *v19; // r14
char *v20; // rdi
__int64 v21; // r12
void *v22; // r15
float v23; // xmm0_4
size_t v24; // r13
void *v25; // rbx
void *v26; // rbx
_BYTE *v27; // rbx
_BYTE *v28; // r14
void *v29; // rdi
void *v30; // rdi
__int64 v31; // [rsp+8h] [rbp-98h]
__int64 v32; // [rsp+10h] [rbp-90h]
__int64 v33; // [rsp+18h] [rbp-88h]
float v35; // [rsp+2Ch] [rbp-74h]
void *v36; // [rsp+30h] [rbp-70h] BYREF
_BYTE *v37; // [rsp+38h] [rbp-68h]
float v38; // [rsp+48h] [rbp-58h] BYREF
__int128 __dst; // [rsp+50h] [rbp-50h] BYREF
void *__p; // [rsp+60h] [rbp-40h]
__int64 v41; // [rsp+6Ch] [rbp-34h] BYREF
float v42; // [rsp+74h] [rbp-2Ch]
v1 = *(_QWORD *)(a1 + 1240);
if ( !v1 )
return;
v3 = *(_QWORD *)(v1 + 416);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v3 + 584LL))(v3, 1);
sub_100278630(&v41, (_QWORD *)(*(_QWORD *)(a1 + 1240) + 424LL));
v4 = *(_QWORD *)(a1 + 1088);
if ( !v4 )
{
v6 = "No sound data.";
if ( *(_BYTE *)(a1 + 1120) )
v6 = "Loading...";
goto LABEL_36;
}
if ( !*(_BYTE *)(v4 + 496) )
{
if ( *(_BYTE *)(a1 + 1120) )
{
v6 = "Loading...";
}
else
{
v6 = "No sound data.";
if ( *(int *)(v4 + 316) > 0 )
v6 = "Loading...";
}
LABEL_36:
v25 = cocos2d::CCLabelBMFont::create_3((__int64)v6, (__int64)"bigFont.fnt");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v25 + 160LL))(v25, 0.5);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v25 + 1024LL))(v25, 150);
sub_100278250((float *)&v36, 0.5 * *(float *)&v41, *((float *)&v41 + 1) * -0.5);
(*(void (__fastcall **)(void *, void **))(*(_QWORD *)v25 + 184LL))(v25, &v36);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v3 + 456LL))(v3, v25);
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), *((float *)&v41 + 1));
return;
}
if ( (*(_BYTE *)(v4 + 472) & 1) != 0 )
{
sub_10001AD30(&__dst, *(const void **)(v4 + 488), *(_QWORD *)(v4 + 480));
}
else
{
v5 = (__int128 *)(v4 + 472);
__p = *((void **)v5 + 2);
__dst = *v5;
}
sub_1008EB390((__int64)&v36, (unsigned __int8 *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v7 = (char *)v36;
if ( v36 == v37 )
{
v26 = cocos2d::CCLabelBMFont::create_3((__int64)"No sounds in this pack.", (__int64)"bigFont.fnt");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v26 + 160LL))(v26, 0.5);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v26 + 1024LL))(v26, 150);
sub_100278250((float *)&__dst, *(float *)&v41 * 0.5, *((float *)&v41 + 1) * -0.5);
(*(void (__fastcall **)(void *, __int128 *))(*(_QWORD *)v26 + 184LL))(v26, &__dst);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v3 + 456LL))(v3, v26);
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), *((float *)&v41 + 1));
goto LABEL_38;
}
v42 = -8.0;
v8 = 0;
v9 = 0;
v33 = v3;
do
{
v31 = v9;
v10 = sub_1008E3CD0(*(_DWORD *)&v7[v8]);
v32 = v8;
v11 = *(_QWORD *)((char *)v36 + v8 + 16) - *(_QWORD *)((char *)v36 + v8 + 8);
if ( !v10 )
v10 = "Action";
v12 = cocos2d::CCLabelBMFont::create_3((__int64)v10, (__int64)"bigFont.fnt");
sub_100278250((float *)&__dst, 0.0, 0.5);
(*(void (__fastcall **)(void *, __int128 *))(*(_QWORD *)v12 + 296LL))(v12, &__dst);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v12 + 160LL))(v12, 0.33000001);
cocos2d::CCLabelBMFont::limitLabelWidth(
(__int64)v12,
*(float *)&v41 + -90.0,
(__m128)0x3EA8F5C3u,
(__m128)0x3E4CCCCDu);
BYTE2(__dst) = 120;
LOWORD(__dst) = -8961;
(*(void (__fastcall **)(void *, __int128 *))(*(_QWORD *)v12 + 1072LL))(v12, &__dst);
v13 = v11 >> 2;
v14 = "Sounds";
if ( (_DWORD)v13 == 1 )
v14 = "Sound";
v15 = sub_10088E820(": %d %s", v13, v14);
CString = (const char *)cocos2d::CCString::getCString((__int64)v15);
v17 = strlen(CString);
if ( v17 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v18 = v17;
if ( v17 >= 0x17 )
{
v24 = (v17 | 7) + 1;
if ( (v17 | 7) == 0x17 )
v24 = 26;
v19 = (char *)operator new(v24);
__p = v19;
*(_QWORD *)&__dst = v24 | 1;
*((_QWORD *)&__dst + 1) = v18;
}
else
{
LOBYTE(__dst) = 2 * v17;
v19 = (char *)&__dst + 1;
if ( !v17 )
{
BYTE1(__dst) = 0;
v20 = (char *)&__dst + 1;
if ( (__dst & 1) == 0 )
goto LABEL_26;
LABEL_25:
v20 = (char *)__p;
goto LABEL_26;
}
}
memmove(v19, CString, v18);
v19[v18] = 0;
v20 = (char *)&__dst + 1;
if ( (__dst & 1) != 0 )
goto LABEL_25;
LABEL_26:
v21 = v33;
v22 = cocos2d::CCLabelBMFont::create_3((__int64)v20, (__int64)"bigFont.fnt");
sub_100278250(&v38, 0.0, 0.5);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 296LL))(v22, &v38);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.33000001);
BYTE2(v38) = -116;
LOWORD(v38) = -136;
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 1072LL))(v22, &v38);
v42 = v42 + -9.0;
sub_100278250(&v38, 12.0, v42);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v12 + 184LL))(v12, &v38);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v21 + 456LL))(v21, v12);
v35 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v12 + 328LL))(v12);
v23 = (float)((float)(v35 * (*(float (__fastcall **)(void *))(*(_QWORD *)v12 + 136LL))(v12)) + 12.0) + 4.0;
sub_100278250(&v38, v23, v42);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 184LL))(v22, &v38);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v21 + 456LL))(v21, v22);
v42 = v42 + -9.0;
if ( (__dst & 1) != 0 )
operator delete(__p);
v9 = v31 + 1;
v7 = (char *)v36;
v8 = v32 + 32;
}
while ( v31 + 1 < (unsigned __int64)((v37 - (_BYTE *)v36) >> 5) );
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), fmaxf(*((float *)&v41 + 1), 8.0 - v42));
LABEL_38:
v27 = v36;
if ( v36 )
{
v28 = v37;
v29 = v36;
if ( v37 != v36 )
{
do
{
v30 = *((void **)v28 - 3);
if ( v30 )
{
*((_QWORD *)v28 - 2) = v30;
operator delete(v30);
}
v28 -= 32;
}
while ( v28 != v27 );
v29 = v36;
}
v37 = v27;
operator delete(v29);
}
}