//
// sub_1004D1798 from 0x1004d1798 to 0x1004d1c7c (1252 bytes)
//
// 3 xrefs:
// > sub_1004CF9C0 @ 0x1004d06e8
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0x1004d3e10
// > EditorSoundConfigInfoLayer::downloadEditorSoundFinished @ 0x1004d444c
//
// This function is hookable on this platform (idp: arm, 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:06:29 +0000
//
void __fastcall sub_1004D1798(__int64 a1)
{
__int64 v1; // x8
__int64 v3; // x20
double v4; // d0
__int64 v5; // x8
__int64 v6; // x8
const char *v7; // x0
void *v8; // x21
__n128 v9; // q0
__int64 v10; // x8
__int64 v11; // x25
unsigned __int64 v12; // x26
float v13; // s10
const char *v14; // x0
__int64 v15; // x24
__int64 v16; // x27
void *v17; // x23
const char *v18; // x9
void *v19; // x0
char *CString; // x0
void **v21; // x0
void *v22; // x24
float v23; // s10
float v24; // s14
float v25; // s0
__n128 v26; // q0
void *v27; // x21
__n128 v28; // q0
void *__p[2]; // [xsp+10h] [xbp-D0h] BYREF
__int64 v30; // [xsp+20h] [xbp-C0h]
__int64 v31; // [xsp+28h] [xbp-B8h] BYREF
__int64 v32; // [xsp+30h] [xbp-B0h]
__int64 v33; // [xsp+40h] [xbp-A0h] BYREF
float v34; // [xsp+48h] [xbp-98h] BYREF
v1 = *(_QWORD *)(a1 + 1240);
if ( !v1 )
return;
v3 = *(_QWORD *)(v1 + 416);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v3 + 584LL))(v3, 1);
v4 = sub_100026438(&v33, (double *)(*(_QWORD *)(a1 + 1240) + 424LL));
v5 = *(_QWORD *)(a1 + 1088);
if ( !v5 )
{
if ( *(_BYTE *)(a1 + 1120) )
v7 = "Loading...";
else
v7 = "No sound data.";
LABEL_12:
v8 = cocos2d::CCLabelBMFont::create_1(v7, "bigFont.fnt", v4);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v8 + 160LL))(v8, 0.5);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v8 + 1024LL))(v8, 150);
sub_1000262BC((float *)&v31, *(float *)&v33 * 0.5, *((float *)&v33 + 1) * -0.5);
(*(void (__fastcall **)(void *, __int64 *))(*(_QWORD *)v8 + 184LL))(v8, &v31);
v9 = ((__n128 (__fastcall *)(__int64, void *))*(_QWORD *)(*(_QWORD *)v3 + 456LL))(v3, v8);
v9.n128_u32[0] = HIDWORD(v33);
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), v9);
return;
}
if ( (*(_BYTE *)(v5 + 496) & 1) == 0 )
{
v7 = "Loading...";
if ( (*(_BYTE *)(a1 + 1120) & 1) == 0 && *(int *)(v5 + 316) <= 0 )
v7 = "No sound data.";
goto LABEL_12;
}
if ( *(char *)(v5 + 495) < 0 )
{
sub_1000097D0(__p, *(void **)(v5 + 472), *(_QWORD *)(v5 + 480));
}
else
{
v6 = v5 + 472;
*(_OWORD *)__p = *(_OWORD *)v6;
v30 = *(_QWORD *)(v6 + 16);
}
sub_1004C9C38((__int64)__p, (__int64)&v31);
if ( SHIBYTE(v30) < 0 )
operator delete(__p[0]);
v10 = v31;
if ( v31 == v32 )
{
v27 = cocos2d::CCLabelBMFont::create_1("No sounds in this pack.", "bigFont.fnt");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v27 + 160LL))(v27, 0.5);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v27 + 1024LL))(v27, 150);
sub_1000262BC(&v34, *(float *)&v33 * 0.5, *((float *)&v33 + 1) * -0.5);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v27 + 184LL))(v27, &v34);
v28 = ((__n128 (__fastcall *)(__int64, void *))*(_QWORD *)(*(_QWORD *)v3 + 456LL))(v3, v27);
v28.n128_u32[0] = HIDWORD(v33);
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), v28);
}
else
{
v11 = 0;
v12 = 0;
v13 = -8.0;
do
{
v14 = sub_1004C85E8(*(_DWORD *)(v10 + v11));
v16 = *(_QWORD *)(v31 + v11 + 8);
v15 = *(_QWORD *)(v31 + v11 + 16);
if ( !v14 )
v14 = "Action";
v17 = cocos2d::CCLabelBMFont::create_1(v14, "bigFont.fnt");
sub_1000262BC((float *)__p, 0.0, 0.5);
(*(void (__fastcall **)(void *, void **))(*(_QWORD *)v17 + 296LL))(v17, __p);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v17 + 160LL))(v17, 0.33);
cocos2d::CCLabelBMFont::limitLabelWidth((__int64)v17, *(float *)&v33 + -90.0, 0.33, 0.2);
BYTE2(__p[0]) = 120;
LOWORD(__p[0]) = -8961;
(*(void (__fastcall **)(void *, void **))(*(_QWORD *)v17 + 1072LL))(v17, __p);
v18 = "Sounds";
if ( (unsigned int)((unsigned __int64)(v15 - v16) >> 2) == 1 )
v18 = "Sound";
v19 = sub_1003065B0(": %d %s", (unsigned __int64)(v15 - v16) >> 2, v18);
CString = (char *)cocos2d::CCString::getCString((__int64)v19);
sub_100009900(__p, CString);
if ( v30 >= 0 )
v21 = __p;
else
v21 = (void **)__p[0];
v22 = cocos2d::CCLabelBMFont::create_1((const char *)v21, "bigFont.fnt");
sub_1000262BC(&v34, 0.0, 0.5);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 296LL))(v22, &v34);
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v22 + 160LL))(v22, 0.33);
BYTE2(v34) = -116;
LOWORD(v34) = -136;
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 1072LL))(v22, &v34);
v23 = v13 + -9.0;
sub_1000262BC(&v34, 12.0, v23);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v17 + 184LL))(v17, &v34);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v3 + 456LL))(v3, v17);
v24 = *(float *)(*(__int64 (__fastcall **)(void *))(*(_QWORD *)v17 + 328LL))(v17);
v25 = (*(float (__fastcall **)(void *))(*(_QWORD *)v17 + 136LL))(v17);
sub_1000262BC(&v34, (float)((float)(v24 * v25) + 12.0) + 4.0, v23);
(*(void (__fastcall **)(void *, float *))(*(_QWORD *)v22 + 184LL))(v22, &v34);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v3 + 456LL))(v3, v22);
if ( SHIBYTE(v30) < 0 )
operator delete(__p[0]);
v13 = v23 + -9.0;
++v12;
v10 = v31;
v11 += 32;
}
while ( v12 < (v32 - v31) >> 5 );
v26.n128_f32[0] = 8.0 - v13;
if ( (float)(8.0 - v13) < *((float *)&v33 + 1) )
v26.n128_f32[0] = *((float *)&v33 + 1);
ScrollableContentLayer::setContentHeight(*(_QWORD *)(a1 + 1240), v26);
}
__p[0] = &v31;
sub_1004CBAF0((void ***)__p);
}