//
// GameToolbox::stringSetupToDict from 0x10004abf4 to 0x10004aeb8 (708 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::createObjectsFromSetup @ 0x1003f7afc
// > LevelSettingsObject::objectFromString @ 0x1003f9550
// > StartPosObject::loadSettingsFromString @ 0x10042dbc0
//
// 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 10:57:41 +0000
//
__int64 __fastcall GameToolbox::stringSetupToDict(char *a1, const char *a2)
{
__int64 v4; // x19
char *v5; // x1
std::string *p_str; // x22
_QWORD *v7; // x0
__int64 v8; // x20
std::string::size_type size; // x23
size_t v10; // x0
bool v11; // zf
__int64 v12; // x24
unsigned __int8 *v13; // x8
std::string *v14; // x9
size_t v15; // x11
const char *v16; // x12
std::string::size_type v17; // x22
std::string *v18; // x1
__int64 v19; // x0
__int64 v20; // x26
std::string *v21; // x26
std::string::size_type v22; // x27
size_t v23; // x0
bool v24; // zf
unsigned __int8 *v25; // x8
unsigned __int8 *v26; // x9
size_t v27; // x11
const char *v28; // x12
__int64 v29; // x21
__int64 v30; // x23
__int64 v31; // x0
char *CString; // x0
char *v33; // x22
__int64 v34; // x21
std::string __str; // [xsp+8h] [xbp-98h] BYREF
std::allocator __a[8]; // [xsp+20h] [xbp-80h] BYREF
char v38; // [xsp+37h] [xbp-69h]
std::string v39; // [xsp+38h] [xbp-68h] BYREF
v4 = cocos2d::CCDictionary::create(a1);
if ( a1[23] >= 0 )
v5 = a1;
else
v5 = *(char **)a1;
p_str = &__str;
v7 = sub_100009900(&__str, v5);
v8 = sub_1002E736C(v7);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
{
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
}
else
{
size = __str.__r_.__value_.__l.__size_;
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
}
v10 = strlen(a2);
if ( size )
v11 = v10 == 0;
else
v11 = 1;
if ( v11 )
{
v12 = -1;
}
else
{
v13 = (unsigned __int8 *)p_str + size;
v14 = p_str;
LABEL_13:
v15 = v10;
v16 = a2;
while ( (unsigned __int8)v14->__r_.__value_.__s.__data_[0] != *(unsigned __int8 *)v16 )
{
++v16;
if ( !--v15 )
{
v14 = (std::string *)((char *)v14 + 1);
if ( v14 != (std::string *)v13 )
goto LABEL_13;
v14 = (std::string *)((char *)p_str + size);
break;
}
}
if ( v14 == (std::string *)v13 )
v12 = -1;
else
v12 = (char *)v14 - (char *)p_str;
}
v17 = 0;
do
{
std::string::basic_string(&v39, &__str, v17, v12 - v17, __a);
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v17 == size && !v39.__r_.__value_.__l.__size_ )
goto LABEL_31;
v18 = (std::string *)v39.__r_.__value_.__r.__words[0];
}
else
{
if ( v17 == size && !*((_BYTE *)&v39.__r_.__value_.__s + 23) )
goto LABEL_31;
v18 = &v39;
}
sub_100009900(__a, (char *)v18);
v19 = sub_1003064AC(__a);
sub_1002E74E0(v8, v19);
if ( v38 < 0 )
operator delete(*(void **)&__a[0].std::__non_trivial_if);
LABEL_31:
if ( v12 == -1
|| ((v17 = v12 + 1, (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL)
? (v21 = &__str)
: (v21 = (std::string *)__str.__r_.__value_.__r.__words[0]),
(__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL
? (v22 = HIBYTE(__str.__r_.__value_.__r.__words[2]))
: (v22 = __str.__r_.__value_.__l.__size_),
(v23 = strlen(a2), v22 > v17) ? (v24 = v23 == 0) : (v24 = 1),
v24) )
{
v20 = -1;
}
else
{
v25 = (unsigned __int8 *)v21 + v22;
v26 = (unsigned __int8 *)v21 + v17;
LABEL_49:
v27 = v23;
v28 = a2;
while ( *v26 != *(unsigned __int8 *)v28 )
{
++v28;
if ( !--v27 )
{
if ( ++v26 != v25 )
goto LABEL_49;
v26 = (unsigned __int8 *)v21 + v22;
break;
}
}
if ( v26 == v25 )
v20 = -1;
else
v20 = v26 - (unsigned __int8 *)v21;
}
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v39.__r_.__value_.__l.__data_);
v11 = v12 == -1;
v12 = v20;
}
while ( !v11 );
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( (unsigned int)sub_1002E757C(v8) )
{
v29 = 0;
while ( 1 )
{
v30 = (unsigned int)(v29 + 2);
if ( (unsigned int)sub_1002E757C(v8) < (unsigned int)v30 )
break;
v31 = sub_1002E75A0(v8, v29);
CString = (char *)cocos2d::CCString::getCString(v31);
if ( CString )
{
v33 = CString;
if ( *CString )
{
v34 = sub_1002E75A0(v8, (unsigned int)(v29 + 1));
sub_100009900(&v39, v33);
cocos2d::CCDictionary::setObject(v4, v34, &v39);
if ( SHIBYTE(v39.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v39.__r_.__value_.__l.__data_);
}
}
v29 = v30;
if ( (unsigned int)v30 >= (unsigned int)sub_1002E757C(v8) )
return v4;
}
return 0;
}
return v4;
}