//
// GameToolbox::stringSetupToDict from 0x140065c60 to 0x140065e4c (492 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::createObjectsFromSetup @ 0x1402d39fd
// > PlayLayer::prepareCreateObjectsFromSetup @ 0x1403acf83
// > StartPosObject::loadSettingsFromString @ 0x1404b208c
// > ??> @ 0x1406c5dd8
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GameToolbox::stringSetupToDict(_QWORD *a1)
{
__int64 v2; // r14
size_t v3; // r8
cocos2d::CCArray *v4; // rbp
void *v5; // rcx
unsigned int v6; // edi
cocos2d::CCString *v7; // rax
const char *CString; // rbx
struct cocos2d::CCObject *v9; // rsi
size_t v10; // r8
void *v11; // rcx
void *Block[2]; // [rsp+20h] [rbp-68h] BYREF
__m128i si128; // [rsp+30h] [rbp-58h]
__int128 v15; // [rsp+40h] [rbp-48h] BYREF
__int64 v16; // [rsp+50h] [rbp-38h]
unsigned __int64 v17; // [rsp+58h] [rbp-30h]
v2 = cocos2d::CCDictionary::create();
if ( a1[3] > 0xFu )
a1 = (_QWORD *)*a1;
*(_OWORD *)Block = 0;
si128 = 0;
v3 = -1;
do
++v3;
while ( *((_BYTE *)a1 + v3) );
sub_14003A930(Block, a1, v3);
v4 = sub_140063EF0((__int64 *)Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v5 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v5 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v5 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v5);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
v6 = 0;
if ( !cocos2d::CCArray::count(v4) )
return v2;
while ( cocos2d::CCArray::count(v4) >= v6 + 2 )
{
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v4, v6);
CString = cocos2d::CCString::getCString(v7);
v9 = cocos2d::CCArray::objectAtIndex(v4, v6 + 1);
v15 = 0;
v16 = 0;
v17 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003A930(&v15, CString, v10);
cocos2d::CCDictionary::setObject(v2, v9, &v15);
if ( v17 > 0xF )
{
v11 = (void *)v15;
if ( v17 + 1 >= 0x1000 )
{
v11 = *(void **)(v15 - 8);
if ( (unsigned __int64)(v15 - (_QWORD)v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v11);
}
v6 += 2;
if ( v6 >= cocos2d::CCArray::count(v4) )
return v2;
}
return 0;
}