//
// GJEffectManager::setupFromString from 0x8c06b8 to 0x8c0adc (1060 bytes)
//
// 2 xrefs:
// > LevelSettingsObject::objectFromDict @ 0x6694d8
// > ??> @ 0x8d4f8
//
// 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
//
__int64 __fastcall GJEffectManager::setupFromString(GJEffectManager *a1, char **a2)
{
cocos2d::CCArray *v2; // x0
cocos2d::CCArray *v3; // x24
__int64 v4; // x21
__int64 v5; // x3
unsigned __int64 v6; // x19
__int64 v7; // x27
const std::string *v8; // x1
cocos2d::CCObject *v9; // x0
char *v10; // x0
unsigned int *v11; // x1
int v12; // w2
void *v13; // x0
unsigned int v14; // w19
cocos2d::CCString *v15; // x0
char *CString; // x0
ColorAction *v17; // x0
ColorAction *v18; // x25
char *v19; // x0
int m_colorID; // w2
char *v21; // x0
unsigned int *v23; // x1
int v24; // w2
unsigned int *v25; // x1
int v26; // w2
__int64 v28; // [xsp+90h] [xbp+90h] BYREF
char *v29; // [xsp+98h] [xbp+98h] BYREF
std::string v30; // [xsp+A0h] [xbp+A0h] BYREF
v2 = (cocos2d::CCArray *)sub_D153B8((int)&v28, *a2);
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
v4 = sub_D168E0((int)&v28, "|", 0, 1u);
v5 = v4;
v6 = 0;
v7 = *(_QWORD *)(v28 - 24);
while ( 1 )
{
sub_D14F84(&v29, &v28, v6, v5);
if ( v7 != v6 || *((_QWORD *)v29 - 3) )
{
sub_D153B8((int)&v30, v29);
v9 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v30, v8);
cocos2d::CCArray::addObject(v3, v9);
if ( (__int64 *)v30.m_data.m_data - 3 != &qword_124B6B0 )
break;
}
if ( v4 == -1 )
goto LABEL_15;
LABEL_7:
v6 = v4 + 1;
v4 = sub_D168E0((int)&v28, "|", (int)v4 + 1, 1u);
v10 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v29 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
v5 = v4 - v6;
if ( *(_QWORD *)(v28 - 24) < v6 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v6,
*(_QWORD *)(v28 - 24));
}
sub_8A26E8((char *)v30.m_data.m_data - 24);
if ( v4 != -1 )
goto LABEL_7;
LABEL_15:
if ( v29 - 24 == (char *)&qword_124B6B0 )
{
v13 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) == &qword_124B6B0 )
goto LABEL_17;
LABEL_38:
sub_8A26E8(v13);
}
else
{
sub_8A26E8(v29 - 24);
v13 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
goto LABEL_38;
}
LABEL_17:
v14 = 0;
while ( v14 < (unsigned int)cocos2d::CCArray::count(v3) )
{
v15 = cocos2d::CCArray::stringAtIndex(v3, v14);
CString = (char *)cocos2d::CCString::getCString(v15);
v17 = (ColorAction *)sub_D153B8((int)&v29, CString);
v18 = (ColorAction *)ColorAction::create(v17);
sub_D18D28(&v30);
ColorAction::setupFromString(v18, &v30);
v19 = (char *)v30.m_data.m_data - 24;
if ( (__int64 *)v30.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)((char *)v30.m_data.m_data - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v30.m_data.m_data - 2);
*((_DWORD *)v30.m_data.m_data - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v19);
}
m_colorID = v18->m_colorID;
if ( m_colorID <= 1101 )
GJEffectManager::setColorAction(a1, v18, m_colorID);
v21 = v29 - 24;
if ( v29 - 24 == (char *)&qword_124B6B0 )
goto LABEL_22;
if ( &pthread_create )
{
v23 = (unsigned int *)(v29 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v24 - 1;
}
if ( v24 > 0 )
{
LABEL_22:
++v14;
}
else
{
++v14;
operator delete(v21);
}
}
return _stack_chk_guard;
}