From deba9ce2564485c7fe078d4e73d0d2cba722b1ac Mon Sep 17 00:00:00 2001 From: Minty-Meeo <45425365+Minty-Meeo@users.noreply.github.com> Date: Thu, 24 Feb 2022 04:51:52 -0600 Subject: Added a way to check Block Size, Compression Method, and Compression Level flags to dolphin-tool New dolphin-tool command: "header" -b / --block_size -c / --compression -l / --compression_level Informative RVZ/WIA header2 value "compression_level" is now a s32 instead of a u32, because negative compression is a thing. Speaking of, it is now possible to use negative compression levels in dolphin-tool's convert command (not the GUI, though). --- Source/Core/DiscIO/WIABlob.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Source/Core/DiscIO/WIABlob.cpp') diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp index fa83e73043..8ef5a3f6b0 100644 --- a/Source/Core/DiscIO/WIABlob.cpp +++ b/Source/Core/DiscIO/WIABlob.cpp @@ -56,7 +56,7 @@ static void PushBack(std::vector* vector, const T& x) PushBack(vector, x_ptr, x_ptr + sizeof(T)); } -std::pair GetAllowedCompressionLevels(WIARVZCompressionType compression_type) +std::pair GetAllowedCompressionLevels(WIARVZCompressionType compression_type, bool gui) { switch (compression_type) { @@ -68,7 +68,10 @@ std::pair GetAllowedCompressionLevels(WIARVZCompressionType compressio // The actual minimum level can be gotten by calling ZSTD_minCLevel(). However, returning that // would make the UI rather weird, because it is a negative number with very large magnitude. // Note: Level 0 is a special number which means "default level" (level 3 as of this writing). - return {1, ZSTD_maxCLevel()}; + if (gui) + return {1, ZSTD_maxCLevel()}; + else + return {ZSTD_minCLevel(), ZSTD_maxCLevel()}; default: return {0, -1}; } @@ -1985,7 +1988,8 @@ WIARVZFileReader::Convert(BlobReader* infile, const VolumeDisc* infile_volu header_2.disc_type = Common::swap32(disc_type); header_2.compression_type = Common::swap32(static_cast(compression_type)); - header_2.compression_level = Common::swap32(static_cast(compression_level)); + header_2.compression_level = + static_cast(Common::swap32(static_cast(compression_level))); header_2.chunk_size = Common::swap32(static_cast(chunk_size)); header_2.number_of_partition_entries = Common::swap32(static_cast(partition_entries.size())); -- cgit v1.2.3