//
// GJMapPack::parsePackColors from 0x140170ce0 to 0x140170f8c (684 bytes)
//
// 2 xrefs:
// > GJMapPack::create @ 0x140170b2d
// > ??> @ 0x1406cae90
//
// 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=4
void __fastcall GJMapPack::parsePackColors(__int64 a1, _QWORD *a2, _QWORD *a3)
{
__int64 v4; // rsi
size_t v6; // rbx
size_t v7; // r8
cocos2d::CCArray *v8; // r12
void *v9; // rcx
_BYTE *v10; // rdx
cocos2d::CCArray *v11; // rbp
void *v12; // rcx
cocos2d::CCString *v13; // rax
char v14; // di
cocos2d::CCString *v15; // rax
char v16; // bl
cocos2d::CCString *v17; // rax
cocos2d::CCString *v18; // rax
char v19; // di
cocos2d::CCString *v20; // rax
char v21; // bl
cocos2d::CCString *v22; // rax
void *Block[2]; // [rsp+30h] [rbp-88h] BYREF
__m128i si128; // [rsp+40h] [rbp-78h]
void *v25[2]; // [rsp+50h] [rbp-68h] BYREF
__m128i v26; // [rsp+60h] [rbp-58h]
v4 = (__int64)a2;
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
*(_OWORD *)Block = 0;
si128 = 0;
v6 = -1;
v7 = -1;
do
++v7;
while ( *((_BYTE *)a2 + v7) );
sub_14003A930(Block, a2, v7);
v8 = sub_140140F70((__int64 *)Block, ",");
if ( si128.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
v10 = a3;
if ( a3[3] > 0xFu )
v10 = (_BYTE *)*a3;
*(_OWORD *)v25 = 0;
v26 = 0;
do
++v6;
while ( v10[v6] );
sub_14003A930(v25, v10, v6);
v11 = sub_140140F70((__int64 *)v25, ",");
if ( v26.m128i_i64[1] > 0xFuLL )
{
v12 = v25[0];
if ( (unsigned __int64)(v26.m128i_i64[1] + 1) >= 0x1000 )
{
v12 = *((void **)v25[0] - 1);
if ( (unsigned __int64)((char *)v25[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
v26 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(v25[0]) = 0;
*(_WORD *)(a1 + 408) = -1;
*(_BYTE *)(a1 + 410) = -1;
*(_WORD *)(a1 + 411) = -1;
*(_BYTE *)(a1 + 413) = -1;
if ( cocos2d::CCArray::count(v8) >= 3 )
{
v13 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 2u);
v14 = cocos2d::CCString::intValue(v13);
v15 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 1u);
v16 = cocos2d::CCString::intValue(v15);
v17 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v8, 0);
*(_BYTE *)(a1 + 408) = cocos2d::CCString::intValue(v17);
*(_BYTE *)(a1 + 409) = v16;
*(_BYTE *)(a1 + 410) = v14;
}
if ( cocos2d::CCArray::count(v11) >= 3 )
{
v18 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v11, 2u);
v19 = cocos2d::CCString::intValue(v18);
v20 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v11, 1u);
v21 = cocos2d::CCString::intValue(v20);
v22 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v11, 0);
*(_BYTE *)(a1 + 411) = cocos2d::CCString::intValue(v22);
*(_BYTE *)(a1 + 412) = v21;
*(_BYTE *)(a1 + 413) = v19;
}
sub_14003A830(v4);
sub_14003A830((__int64)a3);
}