//
// GameToolbox::stringSetupToDict from 0x3d200c to 0x3d2242 (566 bytes)
//
// 2 xrefs:
// > LevelSettingsObject::objectFromString @ 0x47582a
// > StartPosObject::loadSettingsFromString @ 0x4e888e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:46:41 +0000
//
int __fastcall GameToolbox::stringSetupToDict(cocos2d::CCDictionary *a1, const char *a2)
{
cocos2d::CCDictionary *v2; // r4
int v4; // r0
bool v5; // zf
size_t v6; // r0
cocos2d::CCArray *v7; // r0
cocos2d::CCArray *v8; // r7
unsigned __int8 *v9; // r4
int v10; // r5
size_t v11; // r0
int v12; // r4
unsigned __int8 *v13; // r5
unsigned __int8 *first_of; // r0
unsigned int v15; // r5
int v16; // r3
const char *v17; // r5
size_t v18; // r0
cocos2d::CCObject *v19; // r0
unsigned __int8 *v20; // r12
unsigned int v21; // r4
size_t v22; // r0
unsigned __int8 *v23; // r4
unsigned __int8 *v24; // r0
unsigned int v25; // r4
cocos2d::CCString *v26; // r0
const char *CString; // r0
const char *v28; // r6
unsigned int v29; // r6
cocos2d::CCObject *v30; // r0
cocos2d::CCObject *v31; // r9
size_t v32; // r0
int v34; // [sp+8h] [bp-3Ch]
int v35; // [sp+Ch] [bp-38h]
unsigned __int8 *v36; // [sp+14h] [bp-30h]
int v37; // [sp+18h] [bp-2Ch] BYREF
unsigned int v38; // [sp+1Ch] [bp-28h]
unsigned __int8 *v39; // [sp+20h] [bp-24h]
int v40[3]; // [sp+24h] [bp-20h] BYREF
int v41; // [sp+30h] [bp-14h] BYREF
int v42; // [sp+34h] [bp-10h]
int v43; // [sp+38h] [bp-Ch]
v2 = a1;
v4 = cocos2d::CCDictionary::create(a1);
v5 = (*(_BYTE *)v2 & 1) == 0;
if ( (*(_BYTE *)v2 & 1) == 0 )
v2 = (cocos2d::CCDictionary *)((char *)v2 + 1);
v37 = 0;
if ( !v5 )
v2 = *((cocos2d::CCDictionary **)v2 + 2);
v38 = 0;
v39 = nullptr;
v35 = v4;
v6 = strlen((const char *)v2);
v7 = (cocos2d::CCArray *)std::string::__init(&v37, v2, v6);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
if ( (v37 & 1) != 0 )
{
v9 = v39;
v10 = v38;
}
else
{
v10 = (int)(unsigned __int8)v37 >> 1;
v9 = (unsigned __int8 *)&v37 + 1;
}
v11 = strlen(a2);
if ( v10
&& v11
&& (v13 = &v9[v10],
first_of = std::__find_first_of_ce(
v9,
v13,
(int)a2,
(int)&a2[v11],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
first_of != v13) )
{
v12 = first_of - v9;
}
else
{
v12 = -1;
}
v15 = 0;
if ( (v37 & 1) != 0 )
v16 = v38;
else
v16 = (int)(unsigned __int8)v37 >> 1;
v34 = v16;
while ( 1 )
{
std::string::basic_string(v40, (unsigned __int8 *)&v37, v15, v12 - v15);
if ( (v40[0] & 1) != 0 )
{
if ( v40[1] || v15 != v34 )
{
v17 = (const char *)v40[2];
LABEL_25:
v41 = 0;
v42 = 0;
v43 = 0;
v18 = strlen(v17);
std::string::__init(&v41, v17, v18);
v19 = (cocos2d::CCObject *)cocos2d::CCString::create(&v41);
cocos2d::CCArray::addObject(v8, v19);
std::string::~string((int)&v41);
}
}
else if ( LOBYTE(v40[0]) >> 1 || v15 != v34 )
{
v17 = (char *)v40 + 1;
goto LABEL_25;
}
if ( v12 == -1 )
break;
v15 = v12 + 1;
if ( (v37 & 1) != 0 )
{
v20 = v39;
v21 = v38;
}
else
{
v21 = (int)(unsigned __int8)v37 >> 1;
v20 = (unsigned __int8 *)&v37 + 1;
}
v36 = v20;
v22 = strlen(a2);
if ( v15 >= v21
|| !v22
|| (v23 = &v36[v21],
v24 = std::__find_first_of_ce(
&v36[v15],
v23,
(int)a2,
(int)&a2[v22],
(int (__fastcall *)(_DWORD, int))std::char_traits::eq),
v24 == v23) )
{
v12 = -1;
}
else
{
v12 = v24 - v36;
}
std::string::~string((int)v40);
}
v25 = 0;
std::string::~string((int)v40);
std::string::~string((int)&v37);
while ( 1 )
{
v29 = v25;
if ( v25 >= cocos2d::CCArray::count(v8) )
return v35;
v25 += 2;
if ( cocos2d::CCArray::count(v8) < v25 )
break;
v26 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, v29);
CString = (const char *)cocos2d::CCString::getCString(v26);
v28 = CString;
if ( CString && *CString )
{
v30 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(v8, v25 - 1);
v41 = 0;
v42 = 0;
v43 = 0;
v31 = v30;
v32 = strlen(v28);
std::string::__init(&v41, v28, v32);
cocos2d::CCDictionary::setObject(v35, v31);
std::string::~string((int)&v41);
}
}
return 0;
}