//
// EditorSoundConfigInfoLayer::applyConfig from 0x785d78 to 0x785f04 (396 bytes)
//
// 1 xrefs:
// > EditorSoundConfigInfoLayer::FLAlert_Clicked @ 0x788a66
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:59:32 +0000
//
int *__fastcall EditorSoundConfigInfoLayer::applyConfig(int *this, int a2, int a3)
{
int v4; // r2
int *v5; // r6
cocos2d::CCArray **v7; // r0
int v8; // r0
int v9; // r3
const char *v10; // r9
size_t v11; // r0
int *v12; // r0
const char *v13; // r10
size_t v14; // r0
int *v15; // r0
EditorSFXManager *v16; // r0
int v17; // [sp+8h] [bp-28h] BYREF
int v18; // [sp+Ch] [bp-24h]
int v19; // [sp+10h] [bp-20h]
int v20[3]; // [sp+14h] [bp-1Ch] BYREF
char v21[4]; // [sp+20h] [bp-10h] BYREF
int v22; // [sp+24h] [bp-Ch]
const char *v23; // [sp+28h] [bp-8h]
v4 = *(this + 187);
v5 = this;
if ( v4 )
{
v17 = 0;
v18 = 0;
v19 = 0;
if ( *(this + 188) == 2 && *(int *)(v4 + 268) > 0 )
{
v7 = (cocos2d::CCArray **)EditorSFXManager::sharedState((EditorSFXManager *)this);
v8 = EditorSFXManager::applyMyConfig(v7, *(_DWORD *)(v5[187] + 268), a2, &v17);
}
else
{
v16 = (EditorSFXManager *)EditorSFXManager::sharedState((EditorSFXManager *)this);
v8 = EditorSFXManager::applyConfigDirect(v16, v5[187], a2, &v17);
}
if ( v8 )
{
if ( a2 )
v13 = "Sound pack merged into your current sounds.";
else
v13 = "Current sounds replaced with this pack.";
*(_DWORD *)v21 = 0;
v22 = 0;
v23 = nullptr;
v14 = strlen(v13);
std::string::__init((int *)v21, v13, v14);
v15 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Applied", (int)v21, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v15 + 656))(v15);
std::string::~string((int)v21);
if ( a3 )
(*(void (__fastcall **)(int *, _DWORD))(*v5 + 684))(v5, 0);
}
else
{
if ( (v17 & 1) != 0 )
v9 = v18;
else
v9 = (int)(unsigned __int8)v17 >> 1;
if ( v9 )
{
std::string::basic_string((int *)v21, (int)&v17);
}
else
{
*(_DWORD *)v21 = 0;
v22 = 0;
v23 = nullptr;
std::string::__init((int *)v21, "Failed to apply sound pack.", 0x1Bu);
}
if ( (v21[0] & 1) != 0 )
v10 = v23;
else
v10 = &v21[1];
memset(v20, 0, sizeof(v20));
v11 = strlen(v10);
std::string::__init(v20, v10, v11);
v12 = FLAlertLayer::create(0, (cocos2d::CCLabelBMFont *)"Error", (int)v20, (ButtonSprite *)"OK", nullptr);
(*(void (__fastcall **)(int *))(*v12 + 656))(v12);
std::string::~string((int)v20);
std::string::~string((int)v21);
}
return (int *)std::string::~string((int)&v17);
}
return this;
}