From 820e70cd945bc555734c77b99f32bdf06259edde Mon Sep 17 00:00:00 2001 From: JustAnotherGuid <46401660+JustAnotherGuid@users.noreply.github.com> Date: Thu, 14 Mar 2019 01:08:48 +0100 Subject: [PATCH] Clean-up mpqapi_reg_store_modification_time (#623) * Clean-up AddChest. * (Work in progress) Clean-up InitL1Triggers * Clean-up InitL1Triggers (Binary-exact version) * Add /FAs flag. * Rebase * Accidental add. * Minor modifications. * Clean-Up mpqapi_reg_store_modification_time. * Change to DWORD. --- Source/mpqapi.cpp | 31 ++++++++++++++----------------- Source/mpqapi.h | 2 +- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index a79be494a..9beddeb7f 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -101,27 +101,24 @@ void __fastcall mpqapi_update_multi_creation_time(DWORD dwChar) { } -BOOLEAN __fastcall mpqapi_reg_store_modification_time(char *pbData, int dwLen) +BOOLEAN __fastcall mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen) { - int v2; // ebx - char *v3; // ebp - char *v4; // edi - unsigned int v5; // esi - char *v6; // ecx + char *pbCurrentData; + DWORD i; + char *pbDataToXor; - v2 = dwLen; - v3 = pbData; - v4 = pbData; - if ((unsigned int)dwLen >= 8) { - v5 = (unsigned int)dwLen >> 3; + pbCurrentData = pbData; + if (dwLen >= 8) { + i = dwLen >> 3; do { - v6 = v4; - v4 += 8; - mpqapi_xor_buf(v6); - --v5; - } while (v5); + pbDataToXor = pbCurrentData; + pbCurrentData += 8; + mpqapi_xor_buf(pbDataToXor); + --i; + } while (i); } - return SRegSaveData("Diablo", "Video Player ", 0, (unsigned char *)v3, v2); + + return SRegSaveData("Diablo", "Video Player ", 0, (unsigned char *)pbData, dwLen); } void __fastcall mpqapi_remove_hash_entry(const char *pszName) diff --git a/Source/mpqapi.h b/Source/mpqapi.h index 5d6046ea8..71d2c05bc 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -11,7 +11,7 @@ void __fastcall mpqapi_store_creation_time(const char *pszArchive, int dwChar); BOOLEAN __fastcall mpqapi_reg_load_modification_time(char *dst, int size); void __fastcall mpqapi_xor_buf(char *pbData); void __fastcall mpqapi_update_multi_creation_time(DWORD dwChar); -BOOLEAN __fastcall mpqapi_reg_store_modification_time(char *pbData, int dwLen); +BOOLEAN __fastcall mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen); _BLOCKENTRY *__fastcall j_mpqapi_remove_hash_entry(char *pszName); void __fastcall mpqapi_remove_hash_entry(const char *pszName); void __fastcall mpqapi_free_block(int block_offset, int block_size);