//
// GameLevelManager::onDownloadEditorSoundCompleted from 0x4c3798 to 0x4c392e (406 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x4db0fa
//
// 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:50:26 +0000
//
int __fastcall GameLevelManager::onDownloadEditorSoundCompleted(GameLevelManager *this, int a2, unsigned __int8 *a3)
{
const char *v6; // r1
int v7; // r3
unsigned int v8; // r3
char *v9; // r0
int v10; // r6
_BOOL4 v11; // r9
int result; // r0
bool v13; // nf
size_t v14; // r0
cocos2d::CCArray *v15; // r5
cocos2d::CCString *v16; // r0
const char *CString; // r9
size_t v18; // r0
GJEditorSoundConfig *v19; // r0
cocos2d::CCDictionary *v20; // r1
int v21; // r9
int v22; // r0
int v23[3]; // [sp+Ch] [bp-20h] BYREF
int v24; // [sp+18h] [bp-14h] BYREF
int v25; // [sp+1Ch] [bp-10h]
char *v26; // [sp+20h] [bp-Ch]
if ( (*a3 & 1) != 0 )
v6 = *((const char **)a3 + 2);
else
v6 = (const char *)(a3 + 1);
GameLevelManager::removeDLFromActive(this, v6);
v7 = *a3;
if ( (v7 & 1) != 0 )
v8 = *((_DWORD *)a3 + 1);
else
v8 = v7 >> 1;
if ( v8 <= 6 )
{
v10 = 0;
}
else
{
std::string::basic_string(&v24, a3, 6u, 0xFFFFFFFF);
if ( (v24 & 1) != 0 )
v9 = v26;
else
v9 = (char *)&v24 + 1;
v10 = atoi(v9);
std::string::~string((int)&v24);
}
v24 = 0;
v25 = 0;
v26 = nullptr;
std::string::__init(&v24, "-1", 2u);
v11 = sub_4A9CC4((unsigned __int8 *)a2, (unsigned __int8 *)&v24);
std::string::~string((int)&v24);
if ( v11 )
{
result = *((_DWORD *)this + 219);
if ( result )
return (*(int (__fastcall **)(int))(*(_DWORD *)result + 4))(result);
}
else
{
v13 = (*(_BYTE *)a2 & 1) != 0;
if ( (*(_BYTE *)a2 & 1) == 0 )
++a2;
v24 = 0;
if ( v13 )
a2 = *(_DWORD *)(a2 + 8);
v25 = 0;
v26 = nullptr;
v14 = strlen((const char *)a2);
std::string::__init(&v24, (const void *)a2, v14);
v15 = sub_4C1A88(&v24, "#");
std::string::~string((int)&v24);
if ( v15 && cocos2d::CCArray::count(v15) )
{
v16 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 0);
memset(v23, 0, sizeof(v23));
CString = (const char *)cocos2d::CCString::getCString(v16);
v18 = strlen(CString);
std::string::__init(v23, CString, v18);
std::string::basic_string(&v24, (int)v23);
v19 = (GJEditorSoundConfig *)GameLevelManager::responseToDict((cocos2d::CCDictionary *)&v24, 0);
v21 = GJEditorSoundConfig::create(v19, v20);
std::string::~string((int)&v24);
v22 = *((_DWORD *)this + 219);
if ( v21 && *(_BYTE *)(v21 + 384) )
{
if ( v22 )
(**(void (__fastcall ***)(int, int))v22)(v22, v21);
}
else if ( v22 )
{
(*(void (__fastcall **)(int, int, int))(*(_DWORD *)v22 + 4))(v22, v10, -3);
}
return std::string::~string((int)v23);
}
else
{
result = *((_DWORD *)this + 219);
if ( result )
return (*(int (__fastcall **)(int))(*(_DWORD *)result + 4))(result);
}
}
return result;
}