//
// EditorSFXManager::encodeDataTo from 0x1004ca428 to 0x1004ca688 (608 bytes)
//
// 1 xrefs:
// > GameManager::encodeDataTo @ 0x1003ba7a8
//
// 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 11:06:25 +0000
//
__int64 __fastcall EditorSFXManager::encodeDataTo(__int64 result, __int64 a2)
{
__int64 v3; // x20
__int64 v4; // x0
__int64 v5; // x0
int v6; // w21
unsigned int i; // w22
__int64 v8; // x0
__int64 v9; // x24
void *v10; // x0
char *CString; // x0
std::string *v12; // x1
__int64 v13; // x0
__int64 v14; // x21
unsigned int v15; // w22
__int64 v16; // x0
__int64 v17; // x24
void *v18; // x0
char *v19; // x0
std::string *p_p; // x1
std::string __p; // [xsp+8h] [xbp-58h] BYREF
if ( a2 )
{
v3 = result;
DS_Dictionary::setIntegerForKey_1(a2, (__int64)"editorSFXVersion", 1);
EditorSFXManager::ensureLoaded(v3);
sub_1004C97AC(v3, &__p);
sub_1001EB144(a2, (__int64)"editorSFX", (__int64)&__p);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
v4 = *(_QWORD *)(v3 + 144);
if ( v4 )
{
v5 = sub_1002E757C(v4);
v6 = v5;
DS_Dictionary::setIntegerForKey_1(a2, (__int64)"editorSFXFavoriteCount", v5);
if ( v6 >= 1 )
{
for ( i = 0; i != v6; ++i )
{
v8 = sub_1002E75A0(*(_QWORD *)(v3 + 144), i);
if ( v8 )
{
v9 = v8;
v10 = sub_1003065B0("editorSFXFavorite_%d", i);
CString = (char *)cocos2d::CCString::getCString((__int64)v10);
sub_100009900(&__p, CString);
v12 = (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL
? &__p
: (std::string *)__p.__r_.__value_.__r.__words[0];
DS_Dictionary::setSubDictForKey(a2, (const char *)v12, 0, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 48LL))(v9, a2);
sub_1001EA32C(a2);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
}
}
}
}
else
{
DS_Dictionary::setIntegerForKey_1(a2, (__int64)"editorSFXFavoriteCount", 0);
}
v13 = *(_QWORD *)(v3 + 152);
if ( v13 )
v14 = sub_1002E757C(v13);
else
v14 = 0;
DS_Dictionary::setIntegerForKey_1(a2, (__int64)"editorSFXMyCount", v14);
DS_Dictionary::setIntegerForKey_1(a2, (__int64)"editorSFXNextLocalID", *(unsigned int *)(v3 + 160));
if ( (int)v14 >= 1 )
{
v15 = 0;
do
{
v16 = sub_1002E75A0(*(_QWORD *)(v3 + 152), v15);
if ( v16 )
{
v17 = v16;
v18 = sub_1003065B0("editorSFXMy_%d", v15);
v19 = (char *)cocos2d::CCString::getCString((__int64)v18);
sub_100009900(&__p, v19);
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
DS_Dictionary::setSubDictForKey(a2, (const char *)p_p, 0, 1);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v17 + 48LL))(v17, a2);
sub_1001EA32C(a2);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
}
++v15;
}
while ( (_DWORD)v14 != v15 );
}
return DS_Dictionary::setFloatForKey_1(a2, (__int64)"editorSFXGlobalVolume");
}
return result;
}