//
// GJMapPack::create from 0x100532340 to 0x100532a73 (1843 bytes)
//
// 1 xrefs:
// > GameLevelManager::createAndGetMapPacks @ 0x1005322a2
//
// 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
//
GJMapPack *__fastcall GJMapPack::create(cocos2d::CCDictionary *a1)
{
double v1; // xmm0_8
cocos2d::CCString *v2; // rax
cocos2d::CCString *v3; // rax
const char *CString; // r15
size_t v5; // rax
size_t v6; // rbx
char *v7; // r12
cocos2d::CCString *v8; // rax
const char *v9; // r15
size_t v10; // rax
size_t v11; // rbx
char *v12; // r12
cocos2d::CCString *v13; // rax
int v14; // ebx
cocos2d::CCString *v15; // rax
int v16; // r15d
cocos2d::CCString *v17; // rax
cocos2d::CCString *v18; // rax
const char *v19; // rbx
size_t v20; // rax
size_t v21; // r15
char *v22; // r12
cocos2d::CCString *v23; // rax
const char *v24; // rbx
size_t v25; // rax
size_t v26; // r14
char *v27; // r15
char *v28; // r14
double v29; // xmm0_8
int v30; // eax
char v31; // r15
size_t v32; // r13
size_t v33; // r13
size_t v34; // r13
size_t v35; // r12
char v36; // bl
char v37; // r12
char v38; // r13
__int16 v40; // [rsp+8h] [rbp-148h] BYREF
char v41; // [rsp+Ah] [rbp-146h]
void *v42; // [rsp+18h] [rbp-138h]
std::string __str; // [rsp+20h] [rbp-130h] BYREF
std::string v44; // [rsp+40h] [rbp-110h] BYREF
__int128 v45; // [rsp+60h] [rbp-F0h] BYREF
void *v46; // [rsp+70h] [rbp-E0h]
__int128 v47; // [rsp+80h] [rbp-D0h] BYREF
void *v48; // [rsp+90h] [rbp-C0h]
__int128 v49; // [rsp+A0h] [rbp-B0h] BYREF
void *v50; // [rsp+B0h] [rbp-A0h]
int v51; // [rsp+B8h] [rbp-98h]
int v52; // [rsp+BCh] [rbp-94h]
int v53; // [rsp+C0h] [rbp-90h]
int v54; // [rsp+C4h] [rbp-8Ch]
__int128 __dst; // [rsp+C8h] [rbp-88h] BYREF
void *__p; // [rsp+D8h] [rbp-78h]
__int128 v57; // [rsp+E0h] [rbp-70h] BYREF
void *v58; // [rsp+F0h] [rbp-60h]
__int128 v59; // [rsp+F8h] [rbp-58h] BYREF
void *v60; // [rsp+108h] [rbp-48h]
__int128 v61; // [rsp+110h] [rbp-40h] BYREF
void *v62; // [rsp+120h] [rbp-30h]
LOWORD(__dst) = 12546;
BYTE2(__dst) = 0;
v2 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&__dst);
v51 = cocos2d::CCString::intValue(v2);
if ( (__dst & 1) != 0 )
operator delete(__p);
LOWORD(v59) = 12802;
BYTE2(v59) = 0;
v3 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v59);
CString = cocos2d::CCString::getCString(v3);
v5 = strlen(CString);
if ( v5 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v6 = v5;
if ( v5 >= 0x17 )
{
v32 = 26;
if ( (v5 | 7) != 0x17 )
v32 = (v5 | 7) + 1;
v7 = (char *)operator new(v32);
__p = v7;
*(_QWORD *)&__dst = v32 | 1;
*((_QWORD *)&__dst + 1) = v6;
}
else
{
LOBYTE(__dst) = 2 * v5;
v7 = (char *)&__dst + 1;
if ( !v5 )
{
BYTE1(__dst) = 0;
if ( (v59 & 1) == 0 )
goto LABEL_8;
goto LABEL_7;
}
}
memmove(v7, CString, v6);
v7[v6] = 0;
if ( (v59 & 1) != 0 )
LABEL_7:
operator delete(v60);
LABEL_8:
LOWORD(v61) = 13058;
BYTE2(v61) = 0;
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v61);
v9 = cocos2d::CCString::getCString(v8);
v10 = strlen(v9);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v11 = v10;
if ( v10 >= 0x17 )
{
v33 = 26;
if ( (v10 | 7) != 0x17 )
v33 = (v10 | 7) + 1;
v12 = (char *)operator new(v33);
v60 = v12;
*(_QWORD *)&v59 = v33 | 1;
*((_QWORD *)&v59 + 1) = v11;
}
else
{
LOBYTE(v59) = 2 * v10;
v12 = (char *)&v59 + 1;
if ( !v10 )
{
BYTE1(v59) = 0;
if ( (v61 & 1) == 0 )
goto LABEL_13;
goto LABEL_12;
}
}
memmove(v12, v9, v11);
v12[v11] = 0;
if ( (v61 & 1) != 0 )
LABEL_12:
operator delete(v62);
LABEL_13:
LOWORD(v61) = 13314;
BYTE2(v61) = 0;
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v61);
v14 = cocos2d::CCString::intValue(v13);
if ( (v61 & 1) != 0 )
operator delete(v62);
LOWORD(v61) = 13570;
BYTE2(v61) = 0;
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v61);
v16 = cocos2d::CCString::intValue(v15);
if ( (v61 & 1) != 0 )
operator delete(v62);
LOWORD(v61) = 13826;
BYTE2(v61) = 0;
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v61);
v52 = cocos2d::CCString::intValue(v17);
v54 = v16;
v53 = v14;
if ( (v61 & 1) != 0 )
operator delete(v62);
LOWORD(v57) = 14082;
BYTE2(v57) = 0;
v18 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v57);
v19 = cocos2d::CCString::getCString(v18);
v20 = strlen(v19);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v21 = v20;
if ( v20 >= 0x17 )
{
v34 = 26;
if ( (v20 | 7) != 0x17 )
v34 = (v20 | 7) + 1;
v22 = (char *)operator new(v34);
v62 = v22;
*(_QWORD *)&v61 = v34 | 1;
*((_QWORD *)&v61 + 1) = v21;
}
else
{
LOBYTE(v61) = 2 * v20;
v22 = (char *)&v61 + 1;
if ( !v20 )
{
BYTE1(v61) = 0;
if ( (v57 & 1) == 0 )
goto LABEL_24;
goto LABEL_23;
}
}
memmove(v22, v19, v21);
v22[v21] = 0;
if ( (v57 & 1) != 0 )
LABEL_23:
operator delete(v58);
LABEL_24:
v40 = 14338;
v41 = 0;
v23 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v40);
v24 = cocos2d::CCString::getCString(v23);
v25 = strlen(v24);
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v26 = v25;
if ( v25 >= 0x17 )
{
v35 = 26;
if ( (v25 | 7) != 0x17 )
v35 = (v25 | 7) + 1;
v27 = (char *)operator new(v35);
v58 = v27;
*(_QWORD *)&v57 = v35 | 1;
*((_QWORD *)&v57 + 1) = v26;
}
else
{
LOBYTE(v57) = 2 * v25;
v27 = (char *)&v57 + 1;
if ( !v25 )
{
BYTE1(v57) = 0;
if ( (v40 & 1) == 0 )
goto LABEL_29;
goto LABEL_28;
}
}
memmove(v27, v24, v26);
v27[v26] = 0;
if ( (v40 & 1) != 0 )
LABEL_28:
operator delete(v42);
LABEL_29:
v28 = (char *)operator new(0x198u);
cocos2d::CCNode::CCNode((__int64)v28);
*(_QWORD *)v28 = off_100960F90;
*((_WORD *)v28 + 184) = 0;
*((_DWORD *)v28 + 100) = 0;
v28[404] = 0;
v29 = 0.0;
*((_OWORD *)v28 + 20) = 0;
*(_OWORD *)(v28 + 330) = 0;
std::string::assign((std::string *)(v28 + 344), "");
v30 = dword_1009A28EC;
*((_DWORD *)v28 + 100) = dword_1009A28EC;
dword_1009A28EC = v30 + 1;
*((_QWORD *)v28 + 40) = 0;
*((_QWORD *)v28 + 42) = 0;
*((_DWORD *)v28 + 82) = 0;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v28);
*((_DWORD *)v28 + 82) = v51;
v31 = __dst;
if ( (__dst & 1) != 0 )
{
sub_100006B70(&__str, __p, *((unsigned __int64 *)&__dst + 1), 0.0);
}
else
{
__str.__r_.__value_.__r.__words[2] = (std::string::size_type)__p;
v29 = *(double *)&__dst;
*(_OWORD *)&__str.__r_.__value_.__l.0 = __dst;
}
std::string::operator=((std::string *)(v28 + 344), &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
*((_DWORD *)v28 + 84) = v53;
*((_DWORD *)v28 + 85) = v54;
*((_DWORD *)v28 + 83) = v52;
v36 = v59;
if ( (v59 & 1) != 0 )
{
sub_100006B70(&v44, v60, *((unsigned __int64 *)&v59 + 1), v29);
}
else
{
v44.__r_.__value_.__r.__words[2] = (std::string::size_type)v60;
v29 = *(double *)&v59;
*(_OWORD *)&v44.__r_.__value_.__l.0 = v59;
}
std::string::operator=((std::string *)(v28 + 368), &v44);
if ( (*(_BYTE *)&v44.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v44.__r_.__value_.__l.__data_);
if ( (v36 & 1) != 0 )
{
sub_100006B70(&v45, v60, *((unsigned __int64 *)&v59 + 1), v29);
}
else
{
v46 = v60;
v29 = *(double *)&v59;
v45 = v59;
}
GJMapPack::parsePackLevels(v28, &v45);
if ( (v45 & 1) != 0 )
operator delete(v46);
v37 = v61;
if ( (v61 & 1) != 0 )
{
sub_100006B70(&v47, v62, *((unsigned __int64 *)&v61 + 1), v29);
}
else
{
v48 = v62;
v29 = *(double *)&v61;
v47 = v61;
}
v38 = v57;
if ( (v57 & 1) != 0 )
{
sub_100006B70(&v49, v58, *((unsigned __int64 *)&v57 + 1), v29);
}
else
{
v50 = v58;
v49 = v57;
}
GJMapPack::parsePackColors(v28, &v47, &v49);
if ( (v49 & 1) != 0 )
{
operator delete(v50);
if ( (v47 & 1) == 0 )
{
LABEL_72:
if ( (v38 & 1) == 0 )
goto LABEL_73;
goto LABEL_80;
}
}
else if ( (v47 & 1) == 0 )
{
goto LABEL_72;
}
operator delete(v48);
if ( (v38 & 1) == 0 )
{
LABEL_73:
if ( (v37 & 1) == 0 )
goto LABEL_74;
goto LABEL_81;
}
LABEL_80:
operator delete(v58);
if ( (v37 & 1) == 0 )
{
LABEL_74:
if ( (v36 & 1) == 0 )
goto LABEL_75;
LABEL_82:
operator delete(v60);
if ( (v31 & 1) == 0 )
return (GJMapPack *)v28;
goto LABEL_76;
}
LABEL_81:
operator delete(v62);
if ( (v36 & 1) != 0 )
goto LABEL_82;
LABEL_75:
if ( (v31 & 1) != 0 )
LABEL_76:
operator delete(__p);
return (GJMapPack *)v28;
}