//
// DS_Dictionary::saveRootSubDictToCompressedFile from 0x10015b370 to 0x10015ba30 (1728 bytes)
//
// 0 xrefs:
//
// 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:25:06 +0000
//
__int64 __fastcall DS_Dictionary::saveRootSubDictToCompressedFile(__int64 a1, const std::string::value_type *a2)
{
const std::string::value_type *data; // rsi
const char *v4; // rbx
char *v5; // rsi
char *v6; // rsi
const std::__fs::filesystem::path *v7; // r13
const std::__fs::filesystem::path *v8; // rdi
std::error_code *v9; // rdx
const char *v10; // r14
const std::__fs::filesystem::path *v11; // rdi
std::error_code *v12; // rdx
const std::__fs::filesystem::path *v13; // rdi
std::error_code *v14; // rsi
int v15; // eax
std::error_code *v16; // rdx
const std::__fs::filesystem::path *v17; // rsi
const char *v18; // rdi
FILE *v19; // rax
FILE *v20; // r15
std::string::pointer v21; // rdi
size_t size; // rdx
size_t v23; // r12
int v24; // eax
char v25; // cl
std::string::size_type v26; // rdx
FILE *v28; // rax
FILE *v29; // rax
std::string v30; // [rsp+10h] [rbp-540h] BYREF
__int16 v31; // [rsp+28h] [rbp-528h] BYREF
__int64 v32; // [rsp+30h] [rbp-520h]
void *v33; // [rsp+38h] [rbp-518h]
std::string v34; // [rsp+40h] [rbp-510h] BYREF
std::string v35; // [rsp+58h] [rbp-4F8h] BYREF
std::string v36; // [rsp+70h] [rbp-4E0h] BYREF
_WORD v37[8]; // [rsp+88h] [rbp-4C8h] BYREF
char *v38; // [rsp+98h] [rbp-4B8h]
char v39; // [rsp+A7h] [rbp-4A9h] BYREF
__int64 (__fastcall **v40)(); // [rsp+A8h] [rbp-4A8h] BYREF
_BYTE v41[120]; // [rsp+B0h] [rbp-4A0h] BYREF
FILE *v42; // [rsp+128h] [rbp-428h]
int v43; // [rsp+238h] [rbp-318h]
int v44; // [rsp+23Ch] [rbp-314h]
std::ios_base v45; // [rsp+248h] [rbp-308h] BYREF
__int64 v46; // [rsp+2D0h] [rbp-280h]
int v47; // [rsp+2D8h] [rbp-278h]
_QWORD v48[2]; // [rsp+2E0h] [rbp-270h] BYREF
_BYTE __sb[120]; // [rsp+2F0h] [rbp-260h] BYREF
FILE *v50; // [rsp+368h] [rbp-1E8h]
int v51; // [rsp+478h] [rbp-D8h]
int v52; // [rsp+47Ch] [rbp-D4h]
std::ios_base v53; // [rsp+488h] [rbp-C8h] BYREF
__int64 v54; // [rsp+510h] [rbp-40h]
int v55; // [rsp+518h] [rbp-38h]
v37[0] = 0;
FileOperation::getFilePath(&v30);
std::string::append(&v30, a2);
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
data = v30.__r_.__value_.__l.__data_;
else
data = v30.__r_.__value_.__s.__data_;
std::string::assign((std::string *)v37, data);
v4 = (char *)v37 + 1;
v5 = (char *)v37 + 1;
if ( (v37[0] & 1) != 0 )
v5 = v38;
sub_10015AF20(&v36, v5, "2.dat");
v6 = (char *)v37 + 1;
if ( (v37[0] & 1) != 0 )
v6 = v38;
sub_10015AF20(&v35, v6, "3.dat");
v7 = (const std::__fs::filesystem::path *)((char *)&v35.__r_.__value_.__l.0 + 1);
v8 = (const std::__fs::filesystem::path *)((char *)&v35.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) != 0 )
v8 = (const std::__fs::filesystem::path *)v35.__r_.__value_.__l.__data_;
remove(v8, (std::error_code *)v6);
v10 = v36.__r_.__value_.__s.__data_;
v11 = (const std::__fs::filesystem::path *)((char *)&v36.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
{
v11 = (const std::__fs::filesystem::path *)v36.__r_.__value_.__l.__data_;
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_12:
rename(v11, (const std::__fs::filesystem::path *)((char *)&v35.__r_.__value_.__l.0 + 1), v9);
v13 = (const std::__fs::filesystem::path *)((char *)v37 + 1);
if ( (v37[0] & 1) == 0 )
goto LABEL_13;
goto LABEL_21;
}
}
else if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_12;
}
rename(v11, (const std::__fs::filesystem::path *)v35.__r_.__value_.__l.__data_, v9);
v13 = (const std::__fs::filesystem::path *)((char *)v37 + 1);
if ( (v37[0] & 1) == 0 )
{
LABEL_13:
v14 = (std::error_code *)((char *)&v36.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_14;
goto LABEL_22;
}
LABEL_21:
v13 = (const std::__fs::filesystem::path *)v38;
v14 = (std::error_code *)((char *)&v36.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_14:
rename(v13, (const std::__fs::filesystem::path *)((char *)&v36.__r_.__value_.__l.0 + 1), v12);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_15;
LABEL_23:
v7 = (const std::__fs::filesystem::path *)v35.__r_.__value_.__l.__data_;
if ( v15 )
goto LABEL_16;
LABEL_24:
remove(v7, v14);
goto LABEL_25;
}
LABEL_22:
v14 = (std::error_code *)v36.__r_.__value_.__l.__data_;
rename(v13, (const std::__fs::filesystem::path *)v36.__r_.__value_.__l.__data_, v12);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_23;
LABEL_15:
if ( !v15 )
goto LABEL_24;
LABEL_16:
v17 = (const std::__fs::filesystem::path *)((char *)&v36.__r_.__value_.__l.0 + 1);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
v17 = (const std::__fs::filesystem::path *)v36.__r_.__value_.__l.__data_;
rename(v7, v17, v16);
LABEL_25:
v40 = (__int64 (__fastcall **)())sub_100718180(a1, "plist");
v48[0] = sub_1007186B0(&v40, "gjver");
sub_100717700(v48, "2.0");
sub_10071FBD0(&v31, a1, "\t", 4, 0);
cocos2d::ZipUtils::compressString(&v34);
if ( (v31 & 1) != 0 )
{
*(_BYTE *)v33 = 0;
v32 = 0;
v18 = (char *)v37 + 1;
if ( (v37[0] & 1) == 0 )
goto LABEL_30;
goto LABEL_29;
}
v31 = 0;
v18 = (char *)v37 + 1;
if ( (v37[0] & 1) != 0 )
LABEL_29:
v18 = v38;
LABEL_30:
v19 = fopen(v18, "wb");
v20 = v19;
if ( v19 )
{
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
{
v21 = v34.__r_.__value_.__l.__data_;
size = v34.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v34.__r_.__value_.__l.0 >> 1;
v21 = v34.__r_.__value_.__s.__data_;
}
v23 = fwrite(v21, 1u, size, v19);
v24 = fclose(v20);
v25 = *(_BYTE *)&v34.__r_.__value_.__s.0 & 1;
if ( (*(_BYTE *)&v34.__r_.__value_.__s.0 & 1) != 0 )
{
v26 = v34.__r_.__value_.__l.__size_;
if ( v24 )
goto LABEL_39;
LABEL_38:
LOBYTE(v20) = 1;
if ( v23 == v26 )
goto LABEL_48;
goto LABEL_39;
}
v26 = *(_BYTE *)&v34.__r_.__value_.__l.0 >> 1;
if ( !v24 )
goto LABEL_38;
}
LABEL_39:
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
v10 = v36.__r_.__value_.__l.__data_;
v53.__loc_ = nullptr;
v48[0] = &off_100AC75D0;
v53.__vftable = (std::ios_base_vtbl *)&off_100AC75F8;
v48[1] = 0;
std::ios_base::init(&v53, __sb);
v54 = 0;
v55 = -1;
v48[0] = &off_100AC7560;
v53.__vftable = (std::ios_base_vtbl *)off_100AC7588;
sub_100162D10(__sb);
if ( v50 || (v28 = fopen(v10, "r"), (v50 = v28) == nullptr) )
{
std::ios_base::clear(
(std::ios_base *)((char *)v48 + *(_QWORD *)(v48[0] - 24LL)),
*(_DWORD *)&__sb[*(_QWORD *)(v48[0] - 24LL) + 16] | 4);
}
else
{
v51 = 8;
if ( v52 == 34 )
{
setbuf(v28, nullptr);
v52 = 0;
}
}
if ( (v37[0] & 1) != 0 )
v4 = v38;
v45.__loc_ = nullptr;
v40 = (__int64 (__fastcall **)())&off_100AC7460;
v45.__vftable = (std::ios_base_vtbl *)&off_100AC7488;
std::ios_base::init(&v45, v41);
v46 = 0;
v47 = -1;
v40 = &off_100AC73F0;
v45.__vftable = (std::ios_base_vtbl *)off_100AC7418;
sub_100162D10(v41);
if ( v42 || (v29 = fopen(v4, "w"), (v42 = v29) == nullptr) )
{
std::ios_base::clear((std::ios_base *)&v41[(_QWORD)*(v40 - 3) - 8], *(_DWORD *)&v41[(_QWORD)*(v40 - 3) + 24] | 4);
}
else
{
v43 = 16;
if ( v44 == 34 )
{
setbuf(v29, nullptr);
v44 = 0;
}
}
sub_100162E50(&v39, *(_QWORD *)&__sb[*(_QWORD *)(v48[0] - 24LL) + 24], 0, *(_QWORD *)&v41[(_QWORD)*(v40 - 3) + 32]);
v40 = &off_100AC73F0;
v45.__vftable = (std::ios_base_vtbl *)off_100AC7418;
sub_100161420(v41);
std::ostream::~ostream(&v40, off_100AC7430);
std::ios::~ios(&v45);
v48[0] = &off_100AC7560;
v53.__vftable = (std::ios_base_vtbl *)off_100AC7588;
sub_100161420(__sb);
std::istream::~istream(v48, off_100AC75A0);
std::ios::~ios(&v53);
v25 = *(_BYTE *)&v34.__r_.__value_.__s.0 & 1;
LODWORD(v20) = 0;
LABEL_48:
if ( v25 )
operator delete(v34.__r_.__value_.__l.__data_);
if ( (v31 & 1) != 0 )
{
operator delete(v33);
if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_52:
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_53;
goto LABEL_58;
}
}
else if ( (*(_BYTE *)&v35.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_52;
}
operator delete(v35.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_53:
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_54;
LABEL_59:
operator delete(v30.__r_.__value_.__l.__data_);
if ( (v37[0] & 1) == 0 )
return (unsigned int)v20;
LABEL_60:
operator delete(v38);
return (unsigned int)v20;
}
LABEL_58:
operator delete(v36.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v30.__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_59;
LABEL_54:
if ( (v37[0] & 1) != 0 )
goto LABEL_60;
return (unsigned int)v20;
}