//
// EditorSoundConfigInfoLayer::FLAlert_Clicked from 0x1004d3cec to 0x1004d4170 (1156 bytes)
//
// 2 xrefs:
// > sub_1004D4230 @ 0x1004d4234
// > ??> @ 0x1009890a8
//
// 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:30 +0000
//
void __fastcall EditorSoundConfigInfoLayer::FLAlert_Clicked(__int64 a1, __int64 a2, int a3)
{
int v4; // w0
__int64 v5; // x0
__int64 v6; // x0
__int64 v7; // x0
__int64 v8; // x0
__int64 v9; // x8
__int64 v10; // x0
__int64 v11; // x8
_QWORD *v12; // x0
__int64 v13; // x0
void *v14; // x0
__int64 v15; // x0
__int64 v16; // x0
__int64 v17; // x0
void *v18; // x0
std::string *p_dst; // x1
__int64 v20; // x0
void *v21; // x0
std::string *v22; // x1
__int64 v23; // x0
_QWORD v24[2]; // [xsp+0h] [xbp-C0h] BYREF
char v25; // [xsp+17h] [xbp-A9h]
_QWORD v26[2]; // [xsp+18h] [xbp-A8h] BYREF
char v27; // [xsp+2Fh] [xbp-91h]
void *__p[2]; // [xsp+30h] [xbp-90h] BYREF
char v29; // [xsp+47h] [xbp-79h]
void *v30[2]; // [xsp+48h] [xbp-78h] BYREF
char v31; // [xsp+5Fh] [xbp-61h]
std::string __dst; // [xsp+60h] [xbp-60h] BYREF
_QWORD v33[2]; // [xsp+80h] [xbp-40h] BYREF
char v34; // [xsp+97h] [xbp-29h]
std::string v35; // [xsp+98h] [xbp-28h] BYREF
if ( !a3 )
return;
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 64LL))(a2);
if ( v4 <= 7003 )
{
if ( v4 == 7001 )
{
sub_1004D3A2C(a1, 0, 0);
return;
}
if ( v4 == 7002 )
{
sub_100009900(&v35, "");
memset(&__dst, 0, sizeof(__dst));
sub_1004D3C60(a1, (__int64)&v35, &__dst);
v14 = (void *)__dst.__r_.__value_.__r.__words[0];
if ( __dst.__r_.__value_.__r.__words[0] )
{
__dst.__r_.__value_.__l.__size_ = __dst.__r_.__value_.__r.__words[0];
goto LABEL_33;
}
LABEL_65:
if ( (SHIBYTE(v35.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
return;
v18 = (void *)v35.__r_.__value_.__r.__words[0];
goto LABEL_67;
}
if ( v4 != 7003 || !*(_QWORD *)(a1 + 1088) )
return;
memset(&v35, 0, sizeof(v35));
v7 = EditorSFXManager::sharedState();
if ( sub_1004CB5F0(v7, *(_DWORD *)(*(_QWORD *)(a1 + 1088) + 320LL), &v35) )
{
sub_100009900(__p, "Sound pack updated with your current sound settings.");
v8 = sub_10034A8F8(0, (__int64)"Saved", (__int64)__p, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v8 + 1312LL))(v8);
if ( v29 < 0 )
operator delete(__p[0]);
sub_1004D1798(a1);
sub_1004D2A34(a1);
goto LABEL_65;
}
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v35.__r_.__value_.__l.__size_ )
{
sub_1000097D0(&__dst, v35.__r_.__value_.__l.__data_, v35.__r_.__value_.__l.__size_);
goto LABEL_47;
}
}
else if ( *((_BYTE *)&v35.__r_.__value_.__s + 23) )
{
__dst = v35;
LABEL_47:
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
sub_100009900(v26, (char *)p_dst);
v20 = sub_10034A8F8(0, (__int64)"Error", (__int64)v26, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v20 + 1312LL))(v20);
if ( (v27 & 0x80000000) == 0 )
goto LABEL_64;
v21 = (void *)v26[0];
goto LABEL_63;
}
sub_100009900(&__dst, "Failed to overwrite.");
goto LABEL_47;
}
if ( v4 > 7005 )
{
if ( v4 != 7006 )
{
if ( v4 == 7007 )
sub_1004D3630(a1);
return;
}
if ( *(_DWORD *)(a1 + 1096) != 2 || (v11 = *(_QWORD *)(a1 + 1088)) == 0 || *(int *)(v11 + 320) < 1 )
{
sub_1004D3A2C(a1, 1, 1);
return;
}
memset(&v35, 0, sizeof(v35));
v12 = (_QWORD *)EditorSFXManager::sharedState();
if ( (unsigned int)sub_1004CB79C(v12, *(_DWORD *)(*(_QWORD *)(a1 + 1088) + 320LL), 1, &v35) )
{
sub_100009900(v33, "Sound pack merged into your current sounds.");
v13 = sub_10034A8F8(0, (__int64)"Applied", (__int64)v33, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 1312LL))(v13);
if ( v34 < 0 )
{
v14 = (void *)v33[0];
LABEL_33:
operator delete(v14);
goto LABEL_65;
}
goto LABEL_65;
}
if ( SHIBYTE(v35.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v35.__r_.__value_.__l.__size_ )
{
sub_1000097D0(&__dst, v35.__r_.__value_.__l.__data_, v35.__r_.__value_.__l.__size_);
goto LABEL_58;
}
}
else if ( *((_BYTE *)&v35.__r_.__value_.__s + 23) )
{
__dst = v35;
LABEL_58:
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v22 = &__dst;
else
v22 = (std::string *)__dst.__r_.__value_.__r.__words[0];
sub_100009900(v30, (char *)v22);
v23 = sub_10034A8F8(0, (__int64)"Error", (__int64)v30, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v23 + 1312LL))(v23);
if ( (v31 & 0x80000000) == 0 )
goto LABEL_64;
v21 = v30[0];
LABEL_63:
operator delete(v21);
LABEL_64:
if ( (SHIBYTE(__dst.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
goto LABEL_65;
v14 = (void *)__dst.__r_.__value_.__r.__words[0];
goto LABEL_33;
}
sub_100009900(&__dst, "Failed to apply sound pack.");
goto LABEL_58;
}
if ( v4 == 7004 )
{
v9 = *(_QWORD *)(a1 + 1088);
if ( v9 )
{
if ( *(_DWORD *)(a1 + 1096) == 2 && *(int *)(v9 + 320) >= 1 )
{
v10 = EditorSFXManager::sharedState();
sub_1004CB110(v10, *(_DWORD *)(*(_QWORD *)(a1 + 1088) + 320LL));
}
else
{
v15 = EditorSFXManager::sharedState();
sub_1004CAE14(v15, *(_DWORD *)(*(_QWORD *)(a1 + 1088) + 316LL));
}
v16 = *(_QWORD *)(a1 + 1104);
if ( v16 )
j_FLAlertLayer::requestRebuild(v16);
goto LABEL_38;
}
}
else if ( *(_QWORD *)(a1 + 1088) )
{
v5 = EditorSFXManager::sharedState();
if ( sub_1004CB404(v5, *(_QWORD *)(a1 + 1088)) )
{
v6 = *(_QWORD *)(a1 + 1104);
if ( v6 )
sub_1004CE110(v6);
LABEL_38:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)a1 + 1368LL))(a1, 0);
return;
}
sub_100009900(v24, "You already have 50 sound packs. Delete some first.");
v17 = sub_10034A8F8(0, (__int64)"Limit Reached", (__int64)v24, (__int64)"OK", 0);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1312LL))(v17);
if ( v25 < 0 )
{
v18 = (void *)v24[0];
LABEL_67:
operator delete(v18);
}
}
}