//
// EditorSFXManager::deserializeAll from 0x1004c7680 to 0x1004c7d9c (1820 bytes)
//
// 2 xrefs:
// > EditorSFXManager::ensureLoaded @ 0x1004c7640
// > EditorSFXManager::importFromString @ 0x1004cac30
//
// 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:23 +0000
//
__int64 __fastcall EditorSFXManager::deserializeAll(_QWORD *a1, std::string *this, int a3)
{
std::string::size_type size; // x8
std::string::size_type v7; // x0
char v8; // w22
std::string *p_dst; // x0
__int64 v10; // x19
std::string::size_type v11; // x8
std::string::size_type v12; // x22
std::string::size_type v13; // x22
std::string::size_type v14; // x8
std::string::size_type v15; // x23
std::string::size_type v16; // x8
void *v17; // x0
int v18; // w24
__int64 v19; // x23
float v20; // s8
std::string::size_type v21; // x8
std::string::size_type v22; // x25
void **v23; // x26
const char *v24; // x0
int v25; // w0
std::string::size_type v26; // x8
void **v27; // x1
std::string::size_type v28; // x2
const std::string::value_type *v29; // x1
std::string::size_type v30; // x2
const char *v31; // x0
const char *v32; // x0
const char *v33; // x0
std::string::size_type v34; // x8
std::string::size_type v35; // x25
__int64 *v36; // x0
__int64 *v37; // x26
__int64 v38; // x0
unsigned int i; // w22
unsigned int v40; // w8
__int64 v41; // x0
__int64 v42; // x0
_BOOL4 v43; // w22
__int64 v44; // x0
__int64 *v45; // x26
int v46; // w0
__int64 v47; // x8
std::string::size_type v48; // x8
char v50; // [xsp+Ch] [xbp-164h]
__int64 v51; // [xsp+10h] [xbp-160h] BYREF
std::allocator v52[8]; // [xsp+18h] [xbp-158h] BYREF
__int64 v53; // [xsp+20h] [xbp-150h]
__int64 v54; // [xsp+28h] [xbp-148h]
std::allocator __a[16]; // [xsp+30h] [xbp-140h] BYREF
__int128 v56; // [xsp+40h] [xbp-130h]
int v57; // [xsp+50h] [xbp-120h]
void *__p[2]; // [xsp+60h] [xbp-110h] BYREF
__int64 v59; // [xsp+70h] [xbp-100h]
void *v60; // [xsp+80h] [xbp-F0h] BYREF
std::string::size_type v61; // [xsp+88h] [xbp-E8h]
__int64 v62; // [xsp+90h] [xbp-E0h]
void *v63; // [xsp+98h] [xbp-D8h] BYREF
std::string::size_type v64; // [xsp+A0h] [xbp-D0h]
__int64 v65; // [xsp+A8h] [xbp-C8h]
__int64 v66; // [xsp+B0h] [xbp-C0h] BYREF
std::string v67; // [xsp+B8h] [xbp-B8h] BYREF
std::string __str; // [xsp+D0h] [xbp-A0h] BYREF
std::string __dst; // [xsp+F0h] [xbp-80h] BYREF
size = HIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (size & 0x80u) != 0LL )
size = this->__r_.__value_.__l.__size_;
if ( !size )
return 0;
v7 = std::string::find(this, 59, 0);
if ( v7 == -1 )
{
if ( SHIBYTE(this->__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, this->__r_.__value_.__l.__data_, this->__r_.__value_.__l.__size_);
else
__dst = *this;
}
else
{
std::string::basic_string(&__dst, this, 0, v7, __a);
}
v8 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (SHIBYTE(__dst.__r_.__value_.__r.__words[2]) & 0x80000000) == 0 )
{
if ( *((_BYTE *)&__dst.__r_.__value_.__s + 23) )
{
p_dst = &__dst;
goto LABEL_15;
}
return 0;
}
if ( !__dst.__r_.__value_.__l.__size_ )
{
v10 = 0;
LABEL_152:
operator delete(__dst.__r_.__value_.__l.__data_);
return v10;
}
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
LABEL_15:
if ( (unsigned int)(atoi((const char *)p_dst) - 3) >= 0xFFFFFFFE )
{
if ( a3 )
EditorSFXManager::clearAll(a1);
memset(&__str, 0, sizeof(__str));
v11 = HIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v11 & 0x80u) != 0LL )
v11 = this->__r_.__value_.__l.__size_;
if ( v11 )
{
v12 = std::string::find(this, 59, 0);
if ( v12 == -1 )
{
v12 = SHIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v12 & 0x8000000000000000LL) != 0 )
v12 = this->__r_.__value_.__l.__size_;
}
std::string::basic_string((std::string *)__a, this, 0, v12, (std::allocator *)&v67);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
*(_OWORD *)&__str.__r_.__value_.__l.__data_ = *(_OWORD *)&__a[0].std::__non_trivial_if;
__str.__r_.__value_.__r.__words[2] = v56;
v13 = v12 + 1;
v14 = HIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v14 & 0x80u) != 0LL )
v14 = this->__r_.__value_.__l.__size_;
if ( v13 < v14 )
{
do
{
v15 = std::string::find(this, 59, v13);
if ( v15 == -1 )
{
v15 = SHIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v15 & 0x8000000000000000LL) != 0 )
v15 = this->__r_.__value_.__l.__size_;
}
std::string::basic_string((std::string *)__a, this, v13, v15 - v13, (std::allocator *)&v67);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
__str.__r_.__value_.__r.__words[2] = v56;
*(_OWORD *)&__str.__r_.__value_.__l.__data_ = *(_OWORD *)&__a[0].std::__non_trivial_if;
v13 = v15 + 1;
if ( SBYTE7(v56) < 0 )
{
if ( !__str.__r_.__value_.__l.__size_ )
goto LABEL_137;
if ( *__str.__r_.__value_.__l.__data_ == 77
&& (__str.__r_.__value_.__l.__size_ == 1 || *(_BYTE *)(__str.__r_.__value_.__r.__words[0] + 1) == 124) )
{
v16 = __str.__r_.__value_.__l.__size_;
LABEL_47:
if ( v16 < 3 )
goto LABEL_137;
std::string::basic_string(
(std::string *)__a,
&__str,
2u,
0xFFFFFFFFFFFFFFFFLL,
(std::allocator *)&v67);
sub_1001D7AA0((__int64)__a, (__int64)(a1 + 15), 1);
if ( (SBYTE7(v56) & 0x80000000) == 0 )
goto LABEL_137;
v17 = *(void **)&__a[0].std::__non_trivial_if;
goto LABEL_136;
}
}
else
{
if ( !BYTE7(v56) )
goto LABEL_137;
if ( __str.__r_.__value_.__s.__data_[0] == 77
&& (BYTE7(v56) == 1 || __str.__r_.__value_.__s.__data_[1] == 124) )
{
v16 = BYTE7(v56);
goto LABEL_47;
}
}
v50 = 0;
v18 = 0;
memset(&v67, 0, sizeof(v67));
v65 = 0;
v66 = 0;
v63 = nullptr;
v64 = 0;
v60 = nullptr;
v61 = 0;
v19 = 0xFFFFFFFFLL;
v20 = 0.0;
v62 = 0;
while ( (unsigned int)sub_1004C9710((int)&__str, (int)&v66, (int)&v63, 44) )
{
v21 = HIBYTE(v65);
if ( v65 < 0 )
v21 = v64;
if ( v21 )
{
if ( !(unsigned int)sub_1004C9710((int)&__str, (int)&v66, (int)&v60, 44) )
break;
v22 = HIBYTE(v65);
v23 = (void **)v63;
if ( v65 >= 0 )
v24 = (const char *)&v63;
else
v24 = (const char *)v63;
v25 = atoi(v24);
switch ( v25 )
{
case 3:
if ( v62 >= 0 )
v31 = (const char *)&v60;
else
v31 = (const char *)v60;
v20 = atof(v31);
v50 = 1;
break;
case 2:
if ( v62 >= 0 )
v33 = (const char *)&v60;
else
v33 = (const char *)v60;
v18 = atoi(v33);
break;
case 1:
if ( v62 >= 0 )
v32 = (const char *)&v60;
else
v32 = (const char *)v60;
v19 = atoi(v32);
break;
default:
v26 = HIBYTE(v67.__r_.__value_.__r.__words[2]);
if ( (v67.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v26 = v67.__r_.__value_.__l.__size_;
if ( v26 )
{
std::string::push_back(&v67, 44);
v22 = HIBYTE(v65);
v23 = (void **)v63;
}
if ( (v22 & 0x80u) == 0LL )
v27 = &v63;
else
v27 = v23;
if ( (v22 & 0x80u) == 0LL )
v28 = v22;
else
v28 = v64;
std::string::append(&v67, (const std::string::value_type *)v27, v28);
std::string::push_back(&v67, 44);
if ( v62 >= 0 )
v29 = (const std::string::value_type *)&v60;
else
v29 = (const std::string::value_type *)v60;
if ( v62 >= 0 )
v30 = HIBYTE(v62);
else
v30 = v61;
std::string::append(&v67, v29, v30);
break;
}
}
}
if ( (v19 & 0x80000000) != 0 )
goto LABEL_142;
__p[0] = nullptr;
__p[1] = nullptr;
v59 = 0;
v34 = HIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v34 & 0x80u) != 0LL )
v34 = this->__r_.__value_.__l.__size_;
if ( v13 >= v34 )
{
LABEL_142:
if ( SHIBYTE(v62) < 0 )
operator delete(v60);
if ( SHIBYTE(v65) < 0 )
operator delete(v63);
if ( SHIBYTE(v67.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v67.__r_.__value_.__l.__data_);
goto LABEL_148;
}
v35 = std::string::find(this, 59, v13);
if ( v35 == -1 )
{
v35 = SHIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v35 & 0x8000000000000000LL) != 0 )
v35 = this->__r_.__value_.__l.__size_;
}
std::string::basic_string((std::string *)__a, this, v13, v35 - v13, v52);
if ( SHIBYTE(v59) < 0 )
operator delete(__p[0]);
*(_OWORD *)__p = *(_OWORD *)&__a[0].std::__non_trivial_if;
v59 = v56;
if ( a3
|| (*(_DWORD *)&__a[0].std::__non_trivial_if = v19, (v36 = sub_100019268(a1, (int *)__a)) == nullptr) )
{
*(_OWORD *)&__a[0].std::__non_trivial_if = 0u;
v56 = 0u;
v43 = 1;
v57 = 1065353216;
}
else
{
v37 = (__int64 *)v36[3];
*(_OWORD *)&__a[0].std::__non_trivial_if = 0u;
v56 = 0u;
v57 = 1065353216;
if ( !v37 )
goto LABEL_112;
v38 = *v37;
if ( !*v37 )
goto LABEL_112;
for ( i = 0; ; ++i )
{
v40 = sub_1002E757C(v38);
v41 = *v37;
if ( i >= v40 )
break;
v42 = sub_1002E75A0(v41, i);
sub_1004C8EF4(v52, v42, v42);
sub_10008DE14((unsigned __int64)__a, (__int64)v52, (__int64)v52);
if ( SHIBYTE(v54) < 0 )
operator delete(*(void **)&v52[0].std::__non_trivial_if);
v38 = *v37;
}
if ( v41 )
v43 = sub_1002E757C(v41) == 0;
else
LABEL_112:
v43 = 1;
}
v44 = sub_1004C7E84(a1, v19);
v45 = (__int64 *)v44;
if ( v43 )
{
*(_DWORD *)(v44 + 8) = v18;
std::string::operator=((std::string *)(v44 + 16), &v67);
if ( (v50 & 1) != 0 )
sub_1004C84C4(a1, v19, v20);
}
v13 = v35 + 1;
v51 = 0;
*(_QWORD *)&v52[0].std::__non_trivial_if = 0;
v53 = 0;
v54 = 0;
while ( 1 )
{
v46 = sub_1004C9710((int)__p, (int)&v51, (int)v52, 58);
v47 = HIBYTE(v54);
if ( !v46 )
break;
if ( v54 < 0 )
v47 = v53;
if ( v47 && ((a3 & 1) != 0 || !sub_10008E5E0(__a, (__int64 *)v52)) )
{
if ( EditorSFXManager::decodeSound() )
{
sub_1002E74E0(*v45);
if ( (a3 & 1) == 0 )
sub_1001E7F3C((unsigned __int64)__a, (__int64 *)v52, (__int64)v52);
}
}
}
if ( v54 < 0 )
operator delete(*(void **)&v52[0].std::__non_trivial_if);
sub_10008DD98((void **)__a);
if ( SHIBYTE(v59) < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v62) < 0 )
operator delete(v60);
if ( SHIBYTE(v65) < 0 )
operator delete(v63);
if ( SHIBYTE(v67.__r_.__value_.__r.__words[2]) < 0 )
{
v17 = (void *)v67.__r_.__value_.__r.__words[0];
LABEL_136:
operator delete(v17);
}
LABEL_137:
v48 = HIBYTE(this->__r_.__value_.__r.__words[2]);
if ( (v48 & 0x80u) != 0LL )
v48 = this->__r_.__value_.__l.__size_;
}
while ( v13 < v48 );
}
v10 = 1;
}
else
{
LABEL_148:
v10 = 0;
}
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (*((_BYTE *)&__dst.__r_.__value_.__s + 23) & 0x80) != 0 )
goto LABEL_152;
return v10;
}
v10 = 0;
if ( v8 < 0 )
goto LABEL_152;
return v10;
}