//
// DS_Dictionary::loadRootSubDictFromCompressedFile from 0x18001b940 to 0x18001bc62 (802 bytes)
//
// 3 xrefs:
// > ??> @ 0x18014cf68
// > ??> @ 0x1801b8ad0
// > ??> @ 0x1801b8adc
//
// 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 11:21:26 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall DS_Dictionary::loadRootSubDictFromCompressedFile(
DS_Dictionary *this,
const char *a2,
unsigned __int8 a3)
{
__int64 v6; // rax
__int64 v7; // rax
size_t v8; // rax
char *v9; // rbx
size_t v10; // rax
struct cocos2d::CCFileUtils *v11; // rax
void **v12; // rdx
void *v13; // rsi
void **v14; // r8
__int64 buffer; // rax
void *v16; // rcx
char v17; // al
__int64 v18; // rbx
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
unsigned __int8 v22; // bl
char *v23; // rcx
void *v24; // rcx
int v26; // [rsp+30h] [rbp-79h] BYREF
_BYTE v27[8]; // [rsp+38h] [rbp-71h] BYREF
_BYTE v28[8]; // [rsp+40h] [rbp-69h] BYREF
__int128 v29; // [rsp+48h] [rbp-61h] BYREF
__int64 v30; // [rsp+58h] [rbp-51h]
_BYTE v31[24]; // [rsp+60h] [rbp-49h] BYREF
char *Str[2]; // [rsp+78h] [rbp-31h] BYREF
__m128i v33; // [rsp+88h] [rbp-21h]
void *v34[2]; // [rsp+98h] [rbp-11h] BYREF
__m128i si128; // [rsp+A8h] [rbp-1h]
void *Block[3]; // [rsp+B8h] [rbp+Fh] BYREF
unsigned __int64 v37; // [rsp+D0h] [rbp+27h]
v6 = *((_QWORD *)this + 26);
if ( v6 != *((_QWORD *)this + 27) )
*((_QWORD *)this + 27) = v6;
v7 = cocos2d::CCThread::CCThread((cocos2d::CCThread *)v27);
sub_18001C710((char *)this + 208, v7);
*(_OWORD *)v34 = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LOBYTE(v34[0]) = 0;
sub_18003D940(Str);
v8 = strlen(a2);
sub_180007DF0(Str, a2, v8);
v9 = (char *)Str;
if ( v33.m128i_i64[1] > 0xFuLL )
v9 = Str[0];
v10 = strlen(v9);
sub_1800101E0(v34, v9, v10);
v26 = 0;
v11 = cocos2d::CCFileUtils::sharedFileUtils();
v12 = v34;
if ( si128.m128i_i64[1] > 0xFuLL )
v12 = (void **)v34[0];
v13 = (void *)(*(__int64 (__fastcall **)(struct cocos2d::CCFileUtils *, void **, const char *, int *))(*(_QWORD *)v11 + 24LL))(
v11,
v12,
"r",
&v26);
sub_1800822F0(&v29);
if ( !v13 )
goto LABEL_15;
cocos2d::ZipUtils::decompressString2((unsigned int)Block, (_DWORD)v13, a3, v26, 11);
v14 = Block;
if ( v37 > 0xF )
v14 = (void **)Block[0];
buffer = pugi::xml_document::load_buffer(this, v31, v14, Block[2], 116, 0);
v29 = *(_OWORD *)buffer;
v30 = *(_QWORD *)(buffer + 16);
if ( v37 > 0xF )
{
v16 = Block[0];
if ( v37 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v16);
v17 = sub_180082410(&v29);
}
else
{
LABEL_15:
v17 = sub_180082410(&v29);
if ( !v13 )
goto LABEL_19;
}
if ( v17 )
{
v18 = *((_QWORD *)this + 27);
v19 = sub_180082A40(this, v27, "plist");
*(_QWORD *)(v18 - 8) = *(_QWORD *)sub_180082A40(v19, v28, "dict");
j_j_free_0(v13);
v20 = sub_180082A40(this, v28, "plist");
v21 = sub_1800829C0(v20, v27, "gjver");
*((_BYTE *)this + 232) = (int)sub_180082940(v21, 0) < 2;
v22 = 1;
goto LABEL_20;
}
j_j_free_0(v13);
LABEL_19:
v22 = 0;
LABEL_20:
if ( v33.m128i_i64[1] > 0xFuLL )
{
v23 = Str[0];
if ( (unsigned __int64)(v33.m128i_i64[1] + 1) >= 0x1000 )
{
v23 = *((char **)Str[0] - 1);
if ( (unsigned __int64)(Str[0] - v23 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v23);
}
v33 = _mm_load_si128((const __m128i *)&xmmword_1800EC500);
LOBYTE(Str[0]) = 0;
if ( si128.m128i_i64[1] > 0xFuLL )
{
v24 = v34[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v24 = *((void **)v34[0] - 1);
if ( (unsigned __int64)((char *)v34[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free_0(v24);
}
return v22;
}