//
// EditorSFXManager::serializeAll from 0xcc2ad4 to 0xcc2fa0 (1228 bytes)
//
// 3 xrefs:
// > EditorSFXManager::serializeCompressed @ 0xcc2fcc
// > EditorSFXManager::encodeDataTo @ 0xcc722c
// > ??> @ 0xfeba8
//
// 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:18 +0000
//
__int64 *__usercall EditorSFXManager::serializeAll@(EditorSFXManager *this@, __int64 *a2@)
{
_QWORD *v4; // x25
cocos2d::CCArray **v5; // x20
cocos2d::CCArray *v6; // x0
unsigned int j; // w19
__int64 v8; // x0
int v9; // w2
_QWORD *v10; // x1
MusicDownloadManager *v11; // x19
GameManager *v12; // x0
int v13; // w4
int v14; // w5
int v15; // w6
int v16; // w7
_QWORD *v17; // x3
__int64 v18; // x3
size_t v19; // x0
__int64 *k; // x24
__int64 v21; // x21
size_t v22; // x0
__int64 *v23; // x0
float v24; // s0
size_t v25; // x0
__int64 v26; // x1
void *v27; // x1
size_t v28; // x2
unsigned int m; // w19
SFXTriggerGameObject *v30; // x0
char *v31; // x1
size_t v32; // x2
void *v33; // x19
char *v35; // x1
size_t v36; // x2
char v37; // [xsp+0h] [xbp+0h]
void *v38; // [xsp+78h] [xbp+78h] BYREF
_QWORD *v39; // [xsp+80h] [xbp+80h]
unsigned __int64 i; // [xsp+88h] [xbp+88h]
_QWORD *v41; // [xsp+90h] [xbp+90h] BYREF
_QWORD v42[2]; // [xsp+98h] [xbp+98h] BYREF
__int64 v43[2]; // [xsp+A8h] [xbp+A8h] BYREF
void *v44; // [xsp+B8h] [xbp+B8h]
__int64 v45[2]; // [xsp+C0h] [xbp+C0h] BYREF
void *v46; // [xsp+D0h] [xbp+D0h]
char s[16]; // [xsp+D8h] [xbp+D8h] BYREF
char v48[32]; // [xsp+E8h] [xbp+E8h] BYREF
char v49[64]; // [xsp+108h] [xbp+108h] BYREF
v38 = nullptr;
v4 = *((_QWORD **)this + 2);
v39 = nullptr;
for ( i = 0; v4; v4 = (_QWORD *)*v4 )
{
v5 = (cocos2d::CCArray **)v4[3];
if ( v5 )
{
v6 = *v5;
if ( *v5 )
{
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(v6); ++j )
{
v8 = cocos2d::CCArray::objectAtIndex(*v5, j);
if ( v8 )
{
v9 = *(_DWORD *)(v8 + 1864);
if ( v9 > 0 )
{
v10 = v39;
HIDWORD(v41) = *(_DWORD *)(v8 + 1868);
LODWORD(v41) = v9;
if ( (unsigned __int64)v39 >= i )
{
std::vector>::__push_back_slow_path>(&v38, &v41);
}
else
{
if ( v39 )
{
*v39 = v41;
v10 = v39;
}
v39 = v10 + 1;
}
}
}
v6 = *v5;
}
}
}
}
v42[0] = 0;
v42[1] = 0;
v41 = v42;
v11 = (MusicDownloadManager *)MusicDownloadManager::sharedState((MusicDownloadManager *)v42);
v12 = (GameManager *)GameManager::sharedState((EditorSFXManager *)((char *)this + 120));
if ( (unsigned __int8)GameManager::getGameVariable(v12, "0233") )
v17 = &v41;
else
v17 = nullptr;
MusicDownloadManager::rebuildCustomSFXMappings(
v11,
(int **)&v38,
(__int64)this + 120,
(__int64)v17,
v13,
v14,
v15,
v16,
v37);
if ( *((_QWORD *)this + 17) )
v18 = 2;
else
v18 = 1;
snprintf(s, 0x10u, "%d;", v18);
*a2 = 0;
a2[1] = 0;
a2[2] = 0;
v19 = strlen(s);
std::string::__init(a2, s, v19);
for ( k = *((__int64 **)this + 2); k; k = (__int64 *)*k )
{
v21 = k[3];
if ( v21 && *(_QWORD *)v21 && (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)v21) )
{
snprintf(v49, 0x40u, "%d,%d,%d,%d", 1, *((_DWORD *)k + 4), 2, *(_DWORD *)(v21 + 8));
v22 = strlen(v49);
std::string::append((__int64)a2, v49, v22);
v23 = std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 10,
(int *)k + 4);
if ( v23 )
{
v24 = *((float *)v23 + 5);
if ( v24 > 0.0 )
{
snprintf(v48, 0x20u, ",%d,%g", 3, v24);
v25 = strlen(v48);
std::string::append((__int64)a2, v48, v25);
}
}
v26 = *(_BYTE *)(v21 + 16) >> 1;
if ( (*(_BYTE *)(v21 + 16) & 1) != 0 )
v26 = *(_QWORD *)(v21 + 24);
if ( v26 )
{
std::string::push_back(a2, 44);
if ( (*(_BYTE *)(v21 + 16) & 1) != 0 )
{
v27 = *(void **)(v21 + 32);
v28 = *(_QWORD *)(v21 + 24);
}
else
{
v27 = (void *)(v21 + 17);
v28 = *(_BYTE *)(v21 + 16) >> 1;
}
std::string::append((__int64)a2, v27, v28);
}
std::string::push_back(a2, 59);
for ( m = 0; m < (unsigned int)cocos2d::CCArray::count(*(cocos2d::CCArray **)v21); ++m )
{
if ( m )
std::string::push_back(a2, 58);
v30 = (SFXTriggerGameObject *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)v21, m);
EditorSFXManager::encodeSound(v30, v43);
if ( (v43[0] & 1) != 0 )
{
v31 = (char *)v44;
v32 = v43[1];
}
else
{
v32 = LOBYTE(v43[0]) >> 1;
v31 = (char *)v43 + 1;
}
std::string::append((__int64)a2, v31, v32);
if ( (v43[0] & 1) != 0 )
operator delete(v44);
}
std::string::push_back(a2, 59);
}
}
if ( *((_QWORD *)this + 17) )
{
std::string::append((__int64)a2, "M|", 2u);
MusicDownloadManager::encodeCustomSFXMappingEntries((_QWORD *)this + 15, v45);
if ( (v45[0] & 1) != 0 )
{
v35 = (char *)v46;
v36 = v45[1];
}
else
{
v36 = LOBYTE(v45[0]) >> 1;
v35 = (char *)v45 + 1;
}
std::string::append((__int64)a2, v35, v36);
if ( (v45[0] & 1) != 0 )
operator delete(v46);
}
v33 = (void *)v42[0];
if ( v42[0] )
{
std::__tree::destroy((__int64)&v41, *(_QWORD **)v42[0]);
std::__tree::destroy((__int64)&v41, *(_QWORD **)&byte_8[(_QWORD)v33]);
operator delete(v33);
}
if ( v38 )
{
if ( v38 != v39 )
v39 += ~((unsigned __int64)((char *)(v39 - 1) - (_BYTE *)v38) >> 3);
operator delete(v38);
}
return a2;
}