//
// EditorSoundConfigInfoLayer::applyConfig from 0xcce9d4 to 0xccecac (728 bytes)
//
// 3 xrefs:
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0xcd3790
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0xcd3844
// > ??> @ 0xb3d88
//
// 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 13:06:25 +0000
//
__int64 __fastcall EditorSoundConfigInfoLayer::applyConfig(
EditorSoundConfigInfoLayer *this,
unsigned __int8 a2,
unsigned __int8 a3)
{
int v3; // w21
int v5; // w22
EditorSFXManager *v6; // x0
int v7; // w1
EditorSFXManager *v8; // x0
char v9; // w0
const char *v10; // x1
size_t v11; // x0
__int64 v12; // x0
EditorSFXManager *v14; // x0
const char *v15; // x1
size_t v16; // x0
__int64 v17; // x0
char *v18; // [xsp+48h] [xbp+48h]
char *v19; // [xsp+48h] [xbp+48h]
__int64 v20; // [xsp+50h] [xbp+50h] BYREF
size_t v21; // [xsp+58h] [xbp+58h]
void *v22; // [xsp+60h] [xbp+60h]
__int64 v23[2]; // [xsp+68h] [xbp+68h] BYREF
void *v24; // [xsp+78h] [xbp+78h]
__int64 v25; // [xsp+80h] [xbp+80h] BYREF
size_t v26; // [xsp+88h] [xbp+88h]
void *v27; // [xsp+90h] [xbp+90h]
v3 = a2;
v5 = a3;
v6 = *((EditorSFXManager **)this + 136);
if ( !v6 )
return _stack_chk_guard;
v7 = *((_DWORD *)this + 274);
v20 = 0;
v21 = 0;
v22 = nullptr;
if ( v7 == 2 && (v6 = (EditorSFXManager *)*((unsigned int *)v6 + 80), (int)v6 > 0) )
{
v14 = (EditorSFXManager *)EditorSFXManager::sharedState(v6);
v9 = EditorSFXManager::applyMyConfig(v14, *(_DWORD *)(*((_QWORD *)this + 136) + 320LL), v3, &v20);
}
else
{
v8 = (EditorSFXManager *)EditorSFXManager::sharedState(v6);
v9 = EditorSFXManager::applyConfigDirect(v8, *((_QWORD *)this + 136), v3, &v20);
}
if ( !v9 )
{
if ( (v20 & 1) != 0 )
{
if ( v21 )
{
v25 = 0;
v26 = 0;
v27 = nullptr;
std::string::__init(&v25, v22, v21);
LABEL_20:
v15 = (char *)&v25 + 1;
if ( (v25 & 1) != 0 )
v15 = (const char *)v27;
v19 = (char *)v15;
v23[0] = 0;
v23[1] = 0;
v24 = nullptr;
v16 = strlen(v15);
std::string::__init(v23, v19, v16);
v17 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (char *)v23, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v17 + 1312LL))(v17);
if ( (v23[0] & 1) != 0 )
operator delete(v24);
if ( (v25 & 1) != 0 )
operator delete(v27);
goto LABEL_9;
}
}
else if ( (int)(unsigned __int8)v20 >> 1 )
{
v27 = v22;
v25 = v20;
v26 = v21;
goto LABEL_20;
}
v25 = 0;
v26 = 0;
v27 = nullptr;
std::string::__init(&v25, "Failed to apply sound pack.", 0x1Bu);
goto LABEL_20;
}
if ( v3 )
v10 = "Sound pack merged into your current sounds.";
else
v10 = "Current sounds replaced with this pack.";
v18 = (char *)v10;
v25 = 0;
v26 = 0;
v27 = nullptr;
v11 = strlen(v10);
std::string::__init(&v25, v18, v11);
v12 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Applied", (char *)&v25, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v12 + 1312LL))(v12);
if ( (v25 & 1) != 0 )
{
operator delete(v27);
if ( !v5 )
goto LABEL_9;
}
else if ( !v5 )
{
goto LABEL_9;
}
(*(void (__fastcall **)(EditorSoundConfigInfoLayer *, _QWORD))(*(_QWORD *)this + 1368LL))(this, 0);
LABEL_9:
if ( (v20 & 1) != 0 )
operator delete(v22);
return _stack_chk_guard;
}