//
// GJMapPack::parsePackColors from 0x70c23c to 0x70c4ac (624 bytes)
//
// 2 xrefs:
// > GJMapPack::create @ 0x70c80c
// > ??> @ 0xc9108
//
// 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 GJMapPack::parsePackColors(_BYTE *a1, char **a2, char **a3)
{
cocos2d::CCArray *v5; // x25
void *v6; // x0
cocos2d::CCArray *v7; // x21
void *v8; // x0
cocos2d::CCString *v9; // x0
char v10; // w23
cocos2d::CCString *v11; // x0
char v12; // w20
cocos2d::CCString *v13; // x0
char v14; // w0
cocos2d::CCString *v16; // x0
char v17; // w23
cocos2d::CCString *v18; // x0
char v19; // w20
cocos2d::CCString *v20; // x0
char v21; // w0
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
__int64 v26; // [xsp+60h] [xbp+60h] BYREF
sub_D153B8((int)&v26, *a2);
v5 = sub_6F004C(&v26, &byte_F804F8);
v6 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v26 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v26, *a3);
v7 = sub_6F004C(&v26, &byte_F804F8);
v8 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v26 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v8);
}
a1[360] = -1;
a1[361] = -1;
a1[362] = -1;
a1[363] = -1;
a1[364] = -1;
a1[365] = -1;
if ( (unsigned int)cocos2d::CCArray::count(v5) > 2 )
{
v16 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, 0);
v17 = cocos2d::CCString::intValue(v16);
v18 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, 1u);
v19 = cocos2d::CCString::intValue(v18);
v20 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v5, 2u);
v21 = cocos2d::CCString::intValue(v20);
a1[360] = v17;
a1[361] = v19;
a1[362] = v21;
}
if ( (unsigned int)cocos2d::CCArray::count(v7) > 2 )
{
v9 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, 0);
v10 = cocos2d::CCString::intValue(v9);
v11 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, 1u);
v12 = cocos2d::CCString::intValue(v11);
v13 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v7, 2u);
v14 = cocos2d::CCString::intValue(v13);
a1[363] = v10;
a1[364] = v12;
a1[365] = v14;
}
return _stack_chk_guard;
}