//
// DS_Dictionary::saveRootSubDictToCompressedFile from 0x5fca44 to 0x5fcbc6 (386 bytes)
//
// 1 xrefs:
// > GManager::saveData @ 0x2f01e8
//
// 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
//
bool DS_Dictionary::saveRootSubDictToCompressedFile(DS_Dictionary *a1, const char *a2)
{
int v4; // r1
int v5; // r3
int v6; // r3
FILE *v7; // r9
int v8; // r1
bool v9; // r9
size_t v11; // [sp+4h] [bp-24h]
char *v12; // [sp+8h] [bp-20h] BYREF
char *v13; // [sp+Ch] [bp-1Ch] BYREF
const char *v14; // [sp+10h] [bp-18h] BYREF
const char *v15; // [sp+14h] [bp-14h] BYREF
DS_Dictionary v16; // [sp+18h] [bp-10h] BYREF
_DWORD v17[64]; // [sp+124h] [bp+FCh] BYREF
sub_776584((int)&v12, (char *)&unk_939830);
FileOperation::getFilePath((FileOperation *)&v13, v4);
sub_774544((int)&v13, (char *)a2);
sub_7753D4((int)&v12, v13);
sub_5FC64C((int)&v14, v12, "2.dat", v5);
sub_5FC64C((int)&v15, v12, "3.dat", v6);
remove(v15);
rename(v14, v15);
if ( rename(v12, v14) )
rename(v15, v14);
else
remove(v15);
DS_Dictionary::saveRootSubDictToString(&v16, &a1->doc);
cocos2d::ZipUtils::compressString(&v16.doc._buffer, (unsigned __int8 **)&v16, 1, 11);
sub_7751A8(&v16);
v7 = fopen(v12, "wb");
if ( v7 && (v11 = fwrite(v16.doc._buffer, 1u, *((_DWORD *)v16.doc._buffer - 3), v7), fclose(v7), v11) )
{
v9 = 1;
}
else
{
sub_770F98(v17, v14, 8);
sub_771148(&v16.doc._memory[16], v12, 48);
v8 = *(_DWORD *)((char *)&v17[30] + *(_DWORD *)(v17[0] - 12));
*(_DWORD *)v16.doc._memory = *(_DWORD *)&v16.doc._memory[*(_DWORD *)(*(_DWORD *)&v16.doc._memory[16] - 12) + 136];
v16.doc._memory[4] = *(_DWORD *)v16.doc._memory == 0;
sub_5FC5F4(&v16.doc._memory[8], v8, *(int *)v16.doc._memory, *(int *)&v16.doc._memory[4]);
sub_770298(&v16.doc._memory[16]);
v9 = 0;
sub_76FF64(v17);
}
sub_774008(&v16.doc._buffer);
sub_774008(&v16);
sub_774008(&v15);
sub_774008(&v14);
sub_774008(&v13);
sub_774008(&v12);
return v9;
}