//
// GJMapPack::parsePackColors from 0x10058c640 to 0x10058c8b6 (630 bytes)
//
// 1 xrefs:
// > GJMapPack::create @ 0x100544246
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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 12:32:25 +0000
//
__int64 __fastcall GJMapPack::parsePackColors(__int64 a1, __int64 a2, __int64 a3)
{
const char *v4; // r15
size_t v5; // rax
size_t v6; // r12
char *v7; // r13
size_t v8; // rbx
__int64 v9; // r15
const char *v10; // r14
size_t v11; // rax
size_t v12; // r12
char *v13; // r13
size_t v14; // rbx
__int64 v15; // r14
__int64 v16; // r13
__int64 v17; // rax
unsigned __int8 v18; // r12
__int64 v19; // rax
__int16 v20; // r13
__int64 v21; // rax
__int16 v22; // cx
__int64 result; // rax
__int64 v24; // rax
unsigned __int8 v25; // r15
__int64 v26; // rax
__int16 v27; // r12
__int64 v28; // rax
int v29; // eax
int v30; // ecx
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v32; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
if ( (*(_BYTE *)a2 & 1) != 0 )
v4 = *(const char **)(a2 + 16);
else
v4 = (const char *)(a2 + 1);
v5 = strlen(v4);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_32;
v6 = v5;
if ( v5 >= 0x17 )
{
v8 = 26;
if ( (v5 | 7) != 0x17 )
v8 = (v5 | 7) + 1;
v7 = (char *)operator new(v8);
__p = v7;
__dst = v8 + 1;
v32 = v6;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( v5 )
LABEL_11:
memmove(v7, v4, v6);
v7[v6] = 0;
v9 = sub_10053FBE0((unsigned __int8 *)&__dst, ",");
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)a3 & 1) != 0 )
v10 = *(const char **)(a3 + 16);
else
v10 = (const char *)(a3 + 1);
v11 = strlen(v10);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_32:
sub_100003630();
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = 26;
if ( (v11 | 7) != 0x17 )
v14 = (v11 | 7) + 1;
v13 = (char *)operator new(v14);
__p = v13;
__dst = v14 + 1;
v32 = v12;
goto LABEL_24;
}
LOBYTE(__dst) = 2 * v11;
v13 = (char *)&__dst + 1;
if ( v11 )
LABEL_24:
memmove(v13, v10, v12);
v13[v12] = 0;
v15 = sub_10053FBE0((unsigned __int8 *)&__dst, ",");
v16 = a1;
if ( (__dst & 1) != 0 )
operator delete(__p);
*(_WORD *)(a1 + 396) = -1;
*(_DWORD *)(a1 + 392) = -1;
if ( (unsigned int)sub_1007FEF90(v9) >= 3 )
{
v17 = sub_1007FEFE0(v9, 0);
v18 = cocos2d::CCString::intValue(v17);
v19 = sub_1007FEFE0(v9, 1);
v20 = cocos2d::CCString::intValue(v19);
v21 = sub_1007FEFE0(v9, 2);
*(_BYTE *)(a1 + 394) = cocos2d::CCString::intValue(v21);
v22 = v20 << 8;
v16 = a1;
*(_WORD *)(a1 + 392) = v22 | v18;
}
result = sub_1007FEF90(v15);
if ( (unsigned int)result >= 3 )
{
v24 = sub_1007FEFE0(v15, 0);
v25 = cocos2d::CCString::intValue(v24);
v26 = sub_1007FEFE0(v15, 1);
v27 = cocos2d::CCString::intValue(v26);
v28 = sub_1007FEFE0(v15, 2);
v29 = cocos2d::CCString::intValue(v28);
*(_BYTE *)(v16 + 397) = v29;
v30 = (v29 << 16) | (unsigned __int16)(v27 << 8);
result = v30 | (unsigned int)v25;
*(_WORD *)(v16 + 395) = v30 | v25;
}
return result;
}