diff options
| author | Joshua Vandaƫle <joshua@vandaele.software> | 2025-02-25 11:12:08 +0100 |
|---|---|---|
| committer | Joshua Vandaƫle <joshua@vandaele.software> | 2025-05-22 12:51:55 +0200 |
| commit | 2ed5f166009bf64ee1b1a222c9bb0ca7d6b638da (patch) | |
| tree | dd6ae7c9e163ba22e65e55deddb4c31bb1b15e84 /Source/Core/DiscIO/VolumeVerifier.cpp | |
| parent | 1dc4dc6b6d660f29226bdff29d0b1bae122dda7e (diff) | |
minizip-ng: Stop using compatibility mode
Diffstat (limited to 'Source/Core/DiscIO/VolumeVerifier.cpp')
| -rw-r--r-- | Source/Core/DiscIO/VolumeVerifier.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp index db42bf6874..40e71d48dd 100644 --- a/Source/Core/DiscIO/VolumeVerifier.cpp +++ b/Source/Core/DiscIO/VolumeVerifier.cpp @@ -13,8 +13,11 @@ #include <unordered_set> #include <mbedtls/md5.h> +#include <mz.h> +#include <mz_strm.h> +#include <mz_zip.h> +#include <mz_zip_rw.h> #include <pugixml.hpp> -#include <unzip.h> #include "Common/Align.h" #include "Common/Assert.h" @@ -157,25 +160,28 @@ RedumpVerifier::DownloadStatus RedumpVerifier::DownloadDatfile(const std::string std::vector<u8> RedumpVerifier::ReadDatfile(const std::string& system) { - unzFile file = unzOpen(GetPathForSystem(system).c_str()); - if (!file) + void* zip_reader = mz_zip_reader_create(); + if (!zip_reader) return {}; - Common::ScopeGuard file_guard{[&] { unzClose(file); }}; + Common::ScopeGuard file_guard{[&] { mz_zip_reader_delete(&zip_reader); }}; + + if (mz_zip_reader_open_file(zip_reader, GetPathForSystem(system).c_str()) != MZ_OK) + return {}; // Check that the zip file contains exactly one file - if (unzGoToFirstFile(file) != UNZ_OK) + if (mz_zip_reader_goto_first_entry(zip_reader) != MZ_OK) return {}; - if (unzGoToNextFile(file) != UNZ_END_OF_LIST_OF_FILE) + if (mz_zip_reader_goto_next_entry(zip_reader) != MZ_END_OF_LIST) return {}; // Read the file - if (unzGoToFirstFile(file) != UNZ_OK) + if (mz_zip_reader_goto_first_entry(zip_reader) != MZ_OK) return {}; - unz_file_info file_info; - unzGetCurrentFileInfo(file, &file_info, nullptr, 0, nullptr, 0, nullptr, 0); - std::vector<u8> data(file_info.uncompressed_size); - if (!Common::ReadFileFromZip(file, &data)) + mz_zip_file* file_info; + mz_zip_reader_entry_get_info(zip_reader, &file_info); + std::vector<u8> data(file_info->uncompressed_size); + if (!Common::ReadFileFromZip(zip_reader, data.data(), file_info->uncompressed_size)) return {}; return data; |
