mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-28 09:59:32 -06:00
minizip-ng: Stop using compatibility mode
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user