// // DS_Dictionary::saveRootSubDictToCompressedFile from 0x18001d3d0 to 0x18001dbc7 (2039 bytes) // // 2 xrefs: // > @ 0x1801438a8 // > @ 0x1801aebe4 // // 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=8 _BOOL8 __fastcall DS_Dictionary::saveRootSubDictToCompressedFile(DS_Dictionary *this, const char *a2) { bool v4; // r13 size_t v5; // rsi unsigned __int64 Size; // rdi __int64 v7; // rcx void **v8; // rbx char *v9; // rbx void **v10; // rdx char **v11; // rdx char **v12; // rdx const char *v13; // rcx const char *v14; // rdx const char *v15; // rcx const char *v16; // rdx const char *v17; // rcx int v18; // eax const char *v19; // rcx const char *v20; // rdx __int64 v21; // rax __int64 v22; // rax __int64 v23; // r8 void **v24; // rax const char *v25; // rcx FILE *v26; // rax FILE *v27; // rdi void **v28; // rcx size_t v29; // rbx char **v30; // rdx char **v31; // rdx __int64 v32; // rbx __int64 v33; // r12 unsigned __int8 v34; // r14 char v35; // r15 __int64 v36; // rdi bool v37; // zf __int64 v38; // rbx char i; // si int v40; // eax void *v41; // rcx int v42; // eax void *v43; // rcx char *v44; // rcx char *v45; // rcx void *v46; // rcx char *v47; // rcx __int128 v49; // [rsp+30h] [rbp-D0h] BYREF __int128 v50; // [rsp+40h] [rbp-C0h] BYREF __int128 v51; // [rsp+50h] [rbp-B0h] __int64 v52; // [rsp+60h] [rbp-A0h] BYREF _BYTE v53[8]; // [rsp+68h] [rbp-98h] BYREF _BYTE v54[152]; // [rsp+70h] [rbp-90h] BYREF _BYTE v55[104]; // [rsp+108h] [rbp+8h] BYREF _QWORD v56[2]; // [rsp+170h] [rbp+70h] BYREF _BYTE v57[8]; // [rsp+180h] [rbp+80h] BYREF _BYTE v58[152]; // [rsp+188h] [rbp+88h] BYREF _BYTE v59[96]; // [rsp+220h] [rbp+120h] BYREF char *v60[2]; // [rsp+280h] [rbp+180h] BYREF __int64 v61; // [rsp+290h] [rbp+190h] unsigned __int64 v62; // [rsp+298h] [rbp+198h] char *FileName[2]; // [rsp+2A0h] [rbp+1A0h] BYREF __m128i si128; // [rsp+2B0h] [rbp+1B0h] char *OldFilename[2]; // [rsp+2C0h] [rbp+1C0h] BYREF __m128i v66; // [rsp+2D0h] [rbp+1D0h] void *Src[2]; // [rsp+2E0h] [rbp+1E0h] BYREF __int64 v68; // [rsp+2F0h] [rbp+1F0h] unsigned __int64 v69; // [rsp+2F8h] [rbp+1F8h] void *Block[2]; // [rsp+300h] [rbp+200h] BYREF __int64 v71; // [rsp+310h] [rbp+210h] unsigned __int64 v72; // [rsp+318h] [rbp+218h] void *Buffer[2]; // [rsp+320h] [rbp+220h] BYREF size_t ElementCount; // [rsp+330h] [rbp+230h] unsigned __int64 v75; // [rsp+338h] [rbp+238h] v4 = 0; *(_OWORD *)v60 = 0; v61 = 0; v62 = 15; LOBYTE(v60[0]) = 0; sub_18003D240(Src); v5 = -1; Size = -1; do ++Size; while ( a2[Size] ); v7 = v68; if ( Size > v69 - v68 ) { sub_180007900(Src, Size, 0, a2, Size); } else { v68 += Size; v8 = Src; if ( v69 > 0xF ) v8 = (void **)Src[0]; v9 = (char *)v8 + v7; memmove(v9, a2, Size); v9[Size] = 0; } v10 = Src; if ( v69 > 0xF ) v10 = (void **)Src[0]; do ++v5; while ( *((_BYTE *)v10 + v5) ); sub_180010050((void **)v60, v10, v5); v11 = v60; if ( v62 > 0xF ) v11 = (char **)v60[0]; sub_18001B0B0((char *)OldFilename, v11, ".dat", "2.dat"); v12 = v60; if ( v62 > 0xF ) v12 = (char **)v60[0]; sub_18001B0B0((char *)FileName, v12, ".dat", "3.dat"); v13 = (const char *)FileName; if ( si128.m128i_i64[1] > 0xFuLL ) v13 = FileName[0]; remove(v13); v14 = (const char *)FileName; if ( si128.m128i_i64[1] > 0xFuLL ) v14 = FileName[0]; v15 = (const char *)OldFilename; if ( v66.m128i_i64[1] > 0xFuLL ) v15 = OldFilename[0]; rename(v15, v14); v16 = (const char *)OldFilename; if ( v66.m128i_i64[1] > 0xFuLL ) v16 = OldFilename[0]; v17 = (const char *)v60; if ( v62 > 0xF ) v17 = v60[0]; v18 = rename(v17, v16); v19 = (const char *)FileName; if ( v18 ) { v20 = (const char *)OldFilename; if ( v66.m128i_i64[1] > 0xFuLL ) v20 = OldFilename[0]; if ( si128.m128i_i64[1] > 0xFuLL ) v19 = FileName[0]; rename(v19, v20); } else { if ( si128.m128i_i64[1] > 0xFuLL ) v19 = FileName[0]; remove(v19); } v21 = sub_18007FB10(this, &v50, "plist"); v22 = sub_18007F750(v21, &v49, "gjver"); sub_18007F4A0(v22, "2.0"); pugi::xml_document::save_string((_DWORD)this, (unsigned int)Block, (unsigned int)"\t", 4, 0); LOBYTE(v23) = 1; cocos2d::ZipUtils::compressString(Buffer, Block, v23, 11); v71 = 0; v24 = Block; if ( v72 > 0xF ) v24 = (void **)Block[0]; *(_BYTE *)v24 = 0; v25 = (const char *)v60; if ( v62 > 0xF ) v25 = v60[0]; v26 = fopen(v25, "wb"); v27 = v26; if ( !v26 ) goto LABEL_42; v28 = Buffer; if ( v75 > 0xF ) v28 = (void **)Buffer[0]; v29 = fwrite(v28, 1u, ElementCount, v26); v4 = v29 != 0; fclose(v27); if ( !v29 ) { LABEL_42: v30 = OldFilename; if ( v66.m128i_i64[1] > 0xFuLL ) v30 = (char **)OldFilename[0]; sub_180016A40((__int64)v56, (__int64)v30, 1, 0x40u, 1); v31 = v60; if ( v62 > 0xF ) v31 = (char **)v60[0]; sub_180016B60((__int64)&v52, (__int64)v31, 2, 0x40u, 1); v32 = std::ios::rdbuf((char *)v56 + *(int *)(v56[0] + 4LL)); *(_QWORD *)&v51 = v32; BYTE8(v51) = v32 == 0; BYTE9(v51) = 0; *(_QWORD *)&v49 = 0; WORD4(v49) = 1; v33 = std::ios::rdbuf(&v53[*(int *)(v52 + 4) - 8]); v50 = v49; v49 = v51; v34 = BYTE9(v51); v35 = BYTE8(v50); v36 = v50; v37 = v32 == 0; v38 = v51; if ( !v37 ) goto LABEL_48; for ( i = BYTE8(v49); ; i = 1 ) { if ( !v35 ) { if ( !v36 || (unsigned int)std::streambuf::sgetc(v36) == -1 ) v36 = 0; v35 = 1; } if ( v38 ) { if ( v36 ) { LABEL_60: *(_QWORD *)&v53[*(int *)(v52 + 4) - 8] = &std::ofstream::`vftable'; *(_DWORD *)((char *)&v51 + *(int *)(v52 + 4) + 12) = *(_DWORD *)(v52 + 4) - 168; sub_1800178D0((__int64)v53); std::ostream::~ostream>(v54); std::ios::~ios>(v55); *(_QWORD *)((char *)v56 + *(int *)(v56[0] + 4LL)) = &std::ifstream::`vftable'; *(_DWORD *)&v55[*(int *)(v56[0] + 4LL) + 100] = *(_DWORD *)(v56[0] + 4LL) - 176; sub_1800178D0((__int64)v57); std::istream::~istream>(v58); std::ios::~ios>(v59); break; } } else if ( !v36 ) { goto LABEL_60; } if ( !i ) { if ( !v38 || (v42 = std::streambuf::sgetc(v38), v42 == -1) ) v38 = 0; else v34 = v42; } if ( v33 ) std::streambuf::sputc(v33, v34); if ( !v38 || (unsigned int)std::streambuf::sbumpc(v38) == -1 ) goto LABEL_51; BYTE8(v49) = 0; LABEL_48: if ( !v38 || (v40 = std::streambuf::sgetc(v38), v40 == -1) ) LABEL_51: v38 = 0; else v34 = v40; } } if ( v75 > 0xF ) { v41 = Buffer[0]; if ( v75 + 1 >= 0x1000 ) { v41 = *((void **)Buffer[0] - 1); if ( (unsigned __int64)((char *)Buffer[0] - (char *)v41 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v41); } ElementCount = 0; v75 = 15; LOBYTE(Buffer[0]) = 0; if ( v72 > 0xF ) { v43 = Block[0]; if ( v72 + 1 >= 0x1000 ) { v43 = *((void **)Block[0] - 1); if ( (unsigned __int64)((char *)Block[0] - (char *)v43 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v43); } v71 = 0; v72 = 15; LOBYTE(Block[0]) = 0; if ( si128.m128i_i64[1] > 0xFuLL ) { v44 = FileName[0]; if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 ) { v44 = *((char **)FileName[0] - 1); if ( (unsigned __int64)(FileName[0] - v44 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v44); } si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160); LOBYTE(FileName[0]) = 0; if ( v66.m128i_i64[1] > 0xFuLL ) { v45 = OldFilename[0]; if ( (unsigned __int64)(v66.m128i_i64[1] + 1) >= 0x1000 ) { v45 = *((char **)OldFilename[0] - 1); if ( (unsigned __int64)(OldFilename[0] - v45 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v45); } v66 = _mm_load_si128((const __m128i *)&xmmword_1800E7160); LOBYTE(OldFilename[0]) = 0; if ( v69 > 0xF ) { v46 = Src[0]; if ( v69 + 1 >= 0x1000 ) { v46 = *((void **)Src[0] - 1); if ( (unsigned __int64)((char *)Src[0] - (char *)v46 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v46); } v68 = 0; v69 = 15; LOBYTE(Src[0]) = 0; if ( v62 > 0xF ) { v47 = v60[0]; if ( v62 + 1 >= 0x1000 ) { v47 = *((char **)v60[0] - 1); if ( (unsigned __int64)(v60[0] - v47 - 8) > 0x1F ) invalid_parameter_noinfo_noreturn(); } j_j_free_0(v47); } return v4; }