//
// GameObject::loadGroupsFromString from 0x647304 to 0x647528 (548 bytes)
//
// 2 xrefs:
// > GameObject::objectFromVector @ 0x655154
// > ??> @ 0xa0aa0
//
// 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 GameObject::loadGroupsFromString(GameObject *this, unsigned __int8 **a2, long double a3)
{
unsigned __int8 *v3; // x19
__int64 v6; // x0
unsigned __int64 v7; // x19
__int64 v8; // x27
__int64 v9; // x3
__int16 *v10; // x21
const char *v11; // x19
long double v12; // q0
char *v13; // x0
unsigned int *v14; // x19
int v15; // w1
int v17; // w1
unsigned __int8 *v18; // x1
unsigned __int8 *v19; // x0
int v20; // w1
int v21; // t1
const char *v22; // [xsp+70h] [xbp+70h] BYREF
v3 = *a2;
v6 = *((_QWORD *)*a2 - 3);
if ( v6 )
{
if ( !this->m_groups )
{
v17 = 10;
if ( !this->m_editorEnabled )
{
v18 = v3;
if ( (*((_DWORD *)v3 - 2) & 0x80000000) == 0 )
{
sub_D176A8(a2);
v3 = *a2;
if ( (*((_DWORD *)*a2 - 2) & 0x80000000) != 0 )
{
v6 = *((_QWORD *)v3 - 3);
v18 = *a2;
}
else
{
sub_D176A8(a2);
v18 = *a2;
v6 = *((_QWORD *)*a2 - 3);
}
}
v19 = &v18[v6];
if ( v3 == v19 )
{
v17 = 1;
}
else
{
v20 = 0;
do
{
v21 = *v3++;
if ( v21 == 46 )
++v20;
}
while ( v3 != v19 );
v17 = v20 + 1;
}
}
GameObject::createGroupContainer(this, v17);
}
v7 = 0;
v8 = sub_D16674(a2, 46, 0, a3);
v9 = v8;
v10 = &this->m_groups->__elems_[this->m_groupCount];
while ( 1 )
{
sub_D14F84(&v22, a2, v7, v9);
v11 = v22;
*v10 = atoi(v22);
v13 = (char *)(v11 - 24);
if ( v11 - 24 == (const char *)&qword_124B6B0 )
goto LABEL_4;
if ( &pthread_create )
{
v14 = (unsigned int *)(v11 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v11 - 2);
*((_DWORD *)v11 - 2) = v15 - 1;
}
if ( v15 > 0 )
{
LABEL_4:
++this->m_groupCount;
if ( v8 == -1 )
return _stack_chk_guard;
}
else
{
operator delete(v13);
++this->m_groupCount;
if ( v8 == -1 )
return _stack_chk_guard;
}
v7 = v8 + 1;
v8 = sub_D16674(a2, 46, v8 + 1, v12);
v9 = v8 - v7;
v10 = &this->m_groups->__elems_[this->m_groupCount];
if ( v7 > *((_QWORD *)*a2 - 3) )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v7,
*((_QWORD *)*a2 - 3));
}
}
return _stack_chk_guard;
}