//
// EditorSFXManager::dataLoaded from 0x14018af20 to 0x14018b3c7 (1191 bytes)
//
// 3 xrefs:
// > GameManager::dataLoaded @ 0x140283371
// > ??> @ 0x140918f08
// > ??> @ 0x140918f14
//
// 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=2
void __fastcall EditorSFXManager::dataLoaded(__int64 a1, DS_Dictionary *a2)
{
int IntegerForKey; // r13d
__int64 StringForKey; // rbx
int v6; // r15d
__int64 v7; // rdx
__int64 v8; // r8
int v9; // r12d
void **v10; // rsi
size_t v11; // rbx
__int64 v12; // rax
__int64 v13; // rax
bool v14; // si
__int64 v15; // rbx
cocos2d::CCArray *v16; // rcx
cocos2d::CCArray *v17; // rcx
char v18; // al
_BYTE *v19; // rax
void **v20; // rdx
cocos2d::CCArray *v21; // rcx
int i; // esi
cocos2d::CCString *v23; // rax
const char *CString; // rax
size_t v25; // r8
const char *v26; // rdx
__int64 v27; // rax
struct cocos2d::CCObject *v28; // rbx
cocos2d::CCArray *v29; // rcx
cocos2d::CCArray *v30; // rcx
int j; // esi
cocos2d::CCString *v32; // rax
const char *v33; // rax
size_t v34; // r8
const char *v35; // rdx
__int64 v36; // rax
struct cocos2d::CCObject *v37; // rbx
cocos2d::CCArray *v38; // rcx
void *v39; // rcx
int v40; // eax
int v41; // edx
float FloatForKey; // xmm0_4
float v43; // xmm1_4
void *Block[2]; // [rsp+30h] [rbp-50h] BYREF
size_t Size[2]; // [rsp+40h] [rbp-40h]
__int128 v46; // [rsp+50h] [rbp-30h] BYREF
__int128 v47; // [rsp+60h] [rbp-20h]
if ( a2 )
{
IntegerForKey = DS_Dictionary::getIntegerForKey(a2, "editorSFXVersion");
*(_OWORD *)Block = 0;
Size[0] = 0;
Size[1] = 15;
LOBYTE(Block[0]) = 0;
if ( IntegerForKey > 0 )
{
StringForKey = DS_Dictionary::getStringForKey(a2, &v46, "editorSFX");
if ( Block != (void **)StringForKey )
{
Size[0] = 0;
Size[1] = 15;
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)StringForKey;
*(_OWORD *)Size = *(_OWORD *)(StringForKey + 16);
*(_QWORD *)(StringForKey + 16) = 0;
*(_QWORD *)(StringForKey + 24) = 15;
*(_BYTE *)StringForKey = 0;
}
sub_14003D310((__int64)&v46);
}
v6 = DS_Dictionary::getIntegerForKey(a2, "editorSFXFavoriteCount");
v9 = DS_Dictionary::getIntegerForKey(a2, "editorSFXMyCount");
v10 = Block;
if ( Size[1] > 0xF )
v10 = (void **)Block[0];
v14 = Size[0]
&& (v11 = (size_t)v10 + Size[0], LOBYTE(v8) = 59, v12 = sub_140677120(v10, (char *)v10 + Size[0], v8), v12 != v11)
&& (v13 = v12 - (_QWORD)v10, v13 != -1)
&& v13 + 1 < Size[0]
|| v6 > 0
|| v9 > 0;
if ( *(_QWORD *)(a1 + 16)
|| (v15 = a1 + 232, sub_14018AEB0((_QWORD *)(a1 + 232), v7, v8))
|| (v16 = *(cocos2d::CCArray **)(a1 + 208)) != nullptr && cocos2d::CCArray::count(v16)
|| (v17 = *(cocos2d::CCArray **)(a1 + 216)) != nullptr && cocos2d::CCArray::count(v17) )
{
v18 = 1;
v15 = a1 + 232;
}
else
{
v18 = 0;
}
if ( v14 || !v18 )
{
EditorSFXManager::clearAll((_QWORD *)a1);
*(_QWORD *)(v15 + 16) = 0;
v19 = (_BYTE *)v15;
if ( *(_QWORD *)(v15 + 24) > 0xFu )
v19 = *(_BYTE **)v15;
*v19 = 0;
if ( Size[0] && (void **)v15 != Block )
{
v20 = Block;
if ( Size[1] > 0xF )
v20 = (void **)Block[0];
sub_1400405A0((void **)v15, v20, Size[0]);
}
v21 = *(cocos2d::CCArray **)(a1 + 208);
if ( v21 )
cocos2d::CCArray::removeAllObjects(v21);
for ( i = 0; i < v6; ++i )
{
v23 = cocos2d::CCString::createWithFormat("editorSFXFavorite_%d", i);
CString = cocos2d::CCString::getCString(v23);
v46 = 0;
v47 = 0;
v25 = -1;
do
++v25;
while ( CString[v25] );
sub_14003D230(&v46, CString, v25);
v26 = (const char *)&v46;
if ( *((_QWORD *)&v47 + 1) > 0xFu )
v26 = (const char *)v46;
if ( DS_Dictionary::stepIntoSubDictWithKey(a2, v26) )
{
v27 = GJEditorSoundConfig::create_1();
v28 = (struct cocos2d::CCObject *)v27;
if ( v27 )
{
GJEditorSoundConfig::dataLoaded(v27, a2);
v29 = *(cocos2d::CCArray **)(a1 + 208);
if ( v29 )
cocos2d::CCArray::addObject(v29, v28);
}
DS_Dictionary::stepOutOfSubDict(a2);
}
sub_14003D310((__int64)&v46);
}
v30 = *(cocos2d::CCArray **)(a1 + 216);
if ( v30 )
cocos2d::CCArray::removeAllObjects(v30);
for ( j = 0; j < v9; ++j )
{
v32 = cocos2d::CCString::createWithFormat("editorSFXMy_%d", j);
v33 = cocos2d::CCString::getCString(v32);
v46 = 0;
v47 = 0;
v34 = -1;
do
++v34;
while ( v33[v34] );
sub_14003D230(&v46, v33, v34);
v35 = (const char *)&v46;
if ( *((_QWORD *)&v47 + 1) > 0xFu )
v35 = (const char *)v46;
if ( DS_Dictionary::stepIntoSubDictWithKey(a2, v35) )
{
v36 = GJEditorSoundConfig::create_1();
v37 = (struct cocos2d::CCObject *)v36;
if ( v36 )
{
GJEditorSoundConfig::dataLoaded(v36, a2);
v38 = *(cocos2d::CCArray **)(a1 + 216);
if ( v38 )
cocos2d::CCArray::addObject(v38, v37);
}
DS_Dictionary::stepOutOfSubDict(a2);
}
if ( *((_QWORD *)&v47 + 1) > 0xFu )
{
v39 = (void *)v46;
if ( (unsigned __int64)(*((_QWORD *)&v47 + 1) + 1LL) >= 0x1000 )
{
v39 = *(void **)(v46 - 8);
if ( (unsigned __int64)(v46 - (_QWORD)v39 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v39);
}
}
v40 = DS_Dictionary::getIntegerForKey(a2, "editorSFXNextLocalID");
v41 = 1;
if ( v40 > 0 )
v41 = v40;
*(_DWORD *)(a1 + 224) = v41;
*(_DWORD *)(a1 + 264) = 1065353216;
if ( IntegerForKey > 0 )
{
FloatForKey = DS_Dictionary::getFloatForKey(a2, "editorSFXGlobalVolume");
v43 = 0.0;
if ( FloatForKey >= 0.0 )
v43 = fminf(1.0, FloatForKey);
*(float *)(a1 + 264) = v43;
}
}
sub_14003D310((__int64)Block);
}
}