//
// EditorSFXManager::encodeDataTo from 0x14018ab70 to 0x14018aea5 (821 bytes)
//
// 2 xrefs:
// > GameManager::encodeDataTo @ 0x140285f15
// > ??> @ 0x140918ee4
//
// This function is hookable on this platform (idp: pc, 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:27:40 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall EditorSFXManager::encodeDataTo(__int64 a1, DS_Dictionary *a2)
{
__int64 v4; // rdx
__int64 v5; // r8
void **v6; // rax
cocos2d::CCArray *v7; // rcx
signed int v8; // ebp
signed int i; // ebx
struct cocos2d::CCObject *v10; // rdi
cocos2d::CCString *v11; // rax
const char *CString; // rax
size_t v13; // r8
const char *v14; // rdx
void *v15; // rcx
cocos2d::CCArray *v16; // rcx
signed int v17; // ebp
signed int j; // ebx
struct cocos2d::CCObject *v19; // rdi
cocos2d::CCString *v20; // rax
const char *v21; // rax
size_t v22; // r8
const char *v23; // rdx
void *v24; // rcx
__int128 v25; // [rsp+30h] [rbp-48h] BYREF
__int128 v26; // [rsp+40h] [rbp-38h]
if ( a2 )
{
DS_Dictionary::setIntegerForKey(a2, "editorSFXVersion", 1);
EditorSFXManager::ensureLoaded(a1, v4, v5);
v6 = EditorSFXManager::serializeAll((_QWORD *)a1, (void **)&v25);
DS_Dictionary::setStringForKey(a2, "editorSFX", v6);
sub_14003D310((__int64)&v25);
v7 = *(cocos2d::CCArray **)(a1 + 208);
if ( v7 )
v8 = cocos2d::CCArray::count(v7);
else
v8 = 0;
DS_Dictionary::setIntegerForKey(a2, "editorSFXFavoriteCount", v8);
for ( i = 0; i < v8; ++i )
{
v10 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 208), i);
if ( v10 )
{
v11 = cocos2d::CCString::createWithFormat("editorSFXFavorite_%d", i);
CString = cocos2d::CCString::getCString(v11);
v25 = 0;
v26 = 0;
v13 = -1;
do
++v13;
while ( CString[v13] );
sub_14003D230(&v25, CString, v13);
v14 = (const char *)&v25;
if ( *((_QWORD *)&v26 + 1) > 0xFu )
v14 = (const char *)v25;
DS_Dictionary::setSubDictForKey(a2, v14, 0, 1);
(*(void (__fastcall **)(struct cocos2d::CCObject *, DS_Dictionary *))(*(_QWORD *)v10 + 40LL))(v10, a2);
DS_Dictionary::stepOutOfSubDict(a2);
if ( *((_QWORD *)&v26 + 1) > 0xFu )
{
v15 = (void *)v25;
if ( (unsigned __int64)(*((_QWORD *)&v26 + 1) + 1LL) >= 0x1000 )
{
v15 = *(void **)(v25 - 8);
if ( (unsigned __int64)(v25 - (_QWORD)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
}
}
v16 = *(cocos2d::CCArray **)(a1 + 216);
if ( v16 )
v17 = cocos2d::CCArray::count(v16);
else
v17 = 0;
DS_Dictionary::setIntegerForKey(a2, "editorSFXMyCount", v17);
DS_Dictionary::setIntegerForKey(a2, "editorSFXNextLocalID", *(_DWORD *)(a1 + 224));
for ( j = 0; j < v17; ++j )
{
v19 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 216), j);
if ( v19 )
{
v20 = cocos2d::CCString::createWithFormat("editorSFXMy_%d", j);
v21 = cocos2d::CCString::getCString(v20);
v25 = 0;
v26 = 0;
v22 = -1;
do
++v22;
while ( v21[v22] );
sub_14003D230(&v25, v21, v22);
v23 = (const char *)&v25;
if ( *((_QWORD *)&v26 + 1) > 0xFu )
v23 = (const char *)v25;
DS_Dictionary::setSubDictForKey(a2, v23, 0, 1);
(*(void (__fastcall **)(struct cocos2d::CCObject *, DS_Dictionary *))(*(_QWORD *)v19 + 40LL))(v19, a2);
DS_Dictionary::stepOutOfSubDict(a2);
if ( *((_QWORD *)&v26 + 1) > 0xFu )
{
v24 = (void *)v25;
if ( (unsigned __int64)(*((_QWORD *)&v26 + 1) + 1LL) >= 0x1000 )
{
v24 = *(void **)(v25 - 8);
if ( (unsigned __int64)(v25 - (_QWORD)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
}
}
DS_Dictionary::setFloatForKey(a2, "editorSFXGlobalVolume", *(float *)(a1 + 264));
}
}