//
// GameToolbox::stringSetupToDict from 0x10004572c to 0x1000459e4 (696 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::createObjectsFromSetup @ 0x100357ec4
// > LevelSettingsObject::objectFromString @ 0x100359684
// > StartPosObject::loadSettingsFromString @ 0x100387780
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
cocos2d::CCDictionary *__fastcall GameToolbox::stringSetupToDict(char *a1, const char *a2)
{
cocos2d::CCDictionary *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
cocos2d::CCString *v31; // x0
char *CString; // x22
__int64 v33; // x21
std::string __str; // [xsp+8h] [xbp-98h] BYREF
std::allocator __a[8]; // [xsp+20h] [xbp-80h] BYREF
char v37; // [xsp+37h] [xbp-69h]
std::string v38; // [xsp+38h] [xbp-68h] BYREF
v4 = cocos2d::CCDictionary::create();
if ( a1[23] >= 0 )
v5 = a1;
else
v5 = *(char **)a1;
p_str = &__str;
v7 = sub_100009900(&__str, v5);
v8 = sub_10024A15C(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(&v38, &__str, v17, v12 - v17, __a);
if ( SHIBYTE(v38.__r_.__value_.__r.__words[2]) < 0 )
{
if ( v17 == size && !v38.__r_.__value_.__l.__size_ )
goto LABEL_31;
v18 = (std::string *)v38.__r_.__value_.__r.__words[0];
}
else
{
if ( v17 == size && !*((_BYTE *)&v38.__r_.__value_.__s + 23) )
goto LABEL_31;
v18 = &v38;
}
sub_100009900(__a, (char *)v18);
v19 = sub_100268E48(__a);
sub_10024A2D0(v8, v19);
if ( v37 < 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(v38.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v38.__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_10024A36C(v8) )
{
v29 = 0;
while ( 1 )
{
v30 = (unsigned int)(v29 + 2);
if ( (unsigned int)sub_10024A36C(v8) < (unsigned int)v30 )
break;
v31 = (cocos2d::CCString *)sub_10024A388(v8, v29);
CString = (char *)cocos2d::CCString::getCString(v31);
v33 = sub_10024A388(v8, (unsigned int)(v29 + 1));
sub_100009900(&v38, CString);
cocos2d::CCDictionary::setObject_1(v4, v33, &v38);
if ( SHIBYTE(v38.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v38.__r_.__value_.__l.__data_);
v29 = v30;
if ( (unsigned int)v30 >= (unsigned int)sub_10024A36C(v8) )
return v4;
}
return nullptr;
}
return v4;
}