//
// EditorSFXManager::importFromString from 0x1004caae8 to 0x1004cac90 (424 bytes)
//
// 2 xrefs:
// > sub_1004CAE9C @ 0x1004cafa4
// > sub_1004CB79C @ 0x1004cb8a8
//
// 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::importFromString(_QWORD *a1, __int64 a2, _DWORD *a3, std::string *this)
{
__int64 v5; // x8
std::string::size_type size; // x8
std::string::size_type v9; // x0
__int64 v10; // x20
std::string *p_p; // x0
__int64 v12; // x0
char v13; // w8
std::string __p; // [xsp+0h] [xbp-60h] BYREF
std::string __str; // [xsp+20h] [xbp-40h] BYREF
std::allocator __a; // [xsp+3Fh] [xbp-21h] BYREF
v5 = *(unsigned __int8 *)(a2 + 23);
if ( (v5 & 0x80u) != 0LL )
v5 = *(_QWORD *)(a2 + 8);
if ( v5 )
{
cocos2d::ZipUtils::decompressString((void **)a2, 0, 0, &__str);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( !size )
{
if ( this )
std::string::assign(this, "Invalid or corrupt share string.");
v10 = 0;
goto LABEL_32;
}
v9 = std::string::find(&__str, 59, 0);
if ( v9 == -1 )
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__p, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
__p = __str;
}
else
{
std::string::basic_string(&__p, &__str, 0, v9, &__a);
}
if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_p = &__p;
else
p_p = (std::string *)__p.__r_.__value_.__r.__words[0];
if ( (unsigned int)(atoi((const char *)p_p) - 3) > 0xFFFFFFFD )
{
v12 = EditorSFXManager::deserializeAll(a1, &__str, *a3 == 0);
v10 = v12;
if ( this )
v13 = v12;
else
v13 = 1;
if ( (v13 & 1) != 0 )
{
LABEL_30:
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
LABEL_32:
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
return v10;
}
std::string::assign(this, "Parse error.");
}
else if ( this )
{
std::string::assign(this, "Invalid or corrupt share string.");
}
v10 = 0;
goto LABEL_30;
}
if ( this )
std::string::assign(this, "Empty string.");
return 0;
}