//
// DS_Dictionary::loadRootSubDictFromCompressedFile from 0x18001ba20 to 0x18001bd68 (840 bytes)
//
// 3 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aea7c
// > ??> @ 0x1801aea88
//
// 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=3
__int64 __fastcall DS_Dictionary::loadRootSubDictFromCompressedFile(DS_Dictionary *this, const char *a2)
{
std::vector
*p_dictTree; // rbx
std::_Simple_types::value_type *Myfirst; // rax
_QWORD *v6; // rax
_BYTE *Mylast; // rdx
size_t v8; // rsi
unsigned __int64 Size; // rdi
__int64 v10; // rcx
void **v11; // rbx
char *v12; // rbx
void **v13; // rdx
struct cocos2d::CCFileUtils *v14; // rax
void **v15; // rdx
void *v16; // rdi
const struct __crt_strtox::big_integer *v17; // rdx
int v18; // r8d
void **v19; // r8
__int64 buffer; // rax
void *v21; // rcx
std::_Vector_val>::pointer v22; // rbx
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
unsigned __int8 v26; // bl
void *v27; // rcx
void *v28; // rcx
int v30; // [rsp+30h] [rbp-79h] BYREF
cocos2d::CCThread v31; // [rsp+38h] [rbp-71h] BYREF
_BYTE v32[8]; // [rsp+40h] [rbp-69h] BYREF
__int128 v33; // [rsp+48h] [rbp-61h] BYREF
__int64 v34; // [rsp+58h] [rbp-51h]
_BYTE v35[24]; // [rsp+60h] [rbp-49h] BYREF
void *Src[2]; // [rsp+78h] [rbp-31h] BYREF
__int64 v37; // [rsp+88h] [rbp-21h]
unsigned __int64 v38; // [rsp+90h] [rbp-19h]
void *v39[2]; // [rsp+98h] [rbp-11h] BYREF
__int64 v40; // [rsp+A8h] [rbp-1h]
unsigned __int64 v41; // [rsp+B0h] [rbp+7h]
void *Block[3]; // [rsp+B8h] [rbp+Fh] BYREF
unsigned __int64 v43; // [rsp+D0h] [rbp+27h]
p_dictTree = &this->dictTree;
Myfirst = this->dictTree._Mypair._Myval2._Myfirst;
if ( Myfirst != this->dictTree._Mypair._Myval2._Mylast )
this->dictTree._Mypair._Myval2._Mylast = Myfirst;
v6 = (_QWORD *)pugi::xml_node::xml_node(&v31);
Mylast = p_dictTree->_Mypair._Myval2._Mylast;
if ( Mylast == (_BYTE *)p_dictTree->_Mypair._Myval2._Myend )
{
sub_180015D80((const void **)&p_dictTree->_Mypair._Myval2._Myfirst, Mylast, v6);
}
else
{
*(_QWORD *)Mylast = *v6;
++p_dictTree->_Mypair._Myval2._Mylast;
}
*(_OWORD *)v39 = 0;
v40 = 0;
v41 = 15;
LOBYTE(v39[0]) = 0;
sub_18003D240(Src);
v8 = -1;
Size = -1;
do
++Size;
while ( a2[Size] );
v10 = v37;
if ( Size > v38 - v37 )
{
sub_180007900(Src, Size, 0, a2, Size);
}
else
{
v37 += Size;
v11 = Src;
if ( v38 > 0xF )
v11 = (void **)Src[0];
v12 = (char *)v11 + v10;
memmove(v12, a2, Size);
v12[Size] = 0;
}
v13 = Src;
if ( v38 > 0xF )
v13 = (void **)Src[0];
do
++v8;
while ( *((_BYTE *)v13 + v8) );
sub_180010050(v39, v13, v8);
v30 = 0;
v14 = cocos2d::CCFileUtils::sharedFileUtils();
v15 = v39;
if ( v41 > 0xF )
v15 = (void **)v39[0];
v16 = (void *)((__int64 (__fastcall *)(struct cocos2d::CCFileUtils *, void **, const char *, int *))v14->addSearchResolutionsOrder)(
v14,
v15,
"r",
&v30);
sub_18007F3A0(&v33);
if ( v16 )
{
LOBYTE(v18) = 1;
cocos2d::ZipUtils::decompressString2((unsigned int)Block, (_DWORD)v16, v18, v30, 11);
v19 = Block;
if ( v43 > 0xF )
v19 = (void **)Block[0];
buffer = pugi::xml_document::load_buffer(this, v35, v19, Block[2], 116, 0);
v33 = *(_OWORD *)buffer;
v34 = *(_QWORD *)(buffer + 16);
v17 = (const struct __crt_strtox::big_integer *)v43;
if ( v43 > 0xF )
{
v21 = Block[0];
if ( v43 + 1 >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v21);
}
}
if ( __crt_strtox::is_zero((__crt_strtox *)&v33, v17) && v16 )
{
v22 = this->dictTree._Mypair._Myval2._Mylast;
v23 = sub_18007FB10(this, &v31, "plist");
v22[-1]._root = *(pugi::xml_node_struct **)sub_18007FB10(v23, v32, "dict");
j_j_free_0(v16);
v24 = sub_18007FB10(this, v32, "plist");
v25 = sub_18007FAB0(v24, &v31, "gjver");
this->compatible = (int)sub_18007FA30(v25, 0) < 2;
v26 = 1;
}
else
{
v26 = 0;
}
if ( v38 > 0xF )
{
v27 = Src[0];
if ( v38 + 1 >= 0x1000 )
{
v27 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v27 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v27);
}
v37 = 0;
v38 = 15;
LOBYTE(Src[0]) = 0;
if ( v41 > 0xF )
{
v28 = v39[0];
if ( v41 + 1 >= 0x1000 )
{
v28 = *((void **)v39[0] - 1);
if ( (unsigned __int64)((char *)v39[0] - (char *)v28 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v28);
}
return v26;
}