diff options
| author | JosJuice <josjuice@gmail.com> | 2020-06-21 20:41:50 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-06-21 20:47:23 +0200 |
| commit | d494e0230c2ebfd580bb66b2a741d19ef830d658 (patch) | |
| tree | edd701dfdd98be00f0971dc747eea0dcbe5f7c71 /Source/Core/DiscIO | |
| parent | 99822518994d62def4e336f6746d6a2e2d108fb2 (diff) | |
Show file format details in game properties
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Blob.cpp | 30 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Blob.h | 3 | ||||
| -rw-r--r-- | Source/Core/DiscIO/CISOBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/CompressedBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/DirectoryBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/DriveBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/FileBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/ScrubbedBlob.h | 4 | ||||
| -rw-r--r-- | Source/Core/DiscIO/TGCBlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeFileBlobReader.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/DiscIO/VolumeFileBlobReader.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WIABlob.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WIABlob.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/WbfsBlob.h | 1 |
14 files changed, 71 insertions, 0 deletions
diff --git a/Source/Core/DiscIO/Blob.cpp b/Source/Core/DiscIO/Blob.cpp index 50146c9c91..e24c52f181 100644 --- a/Source/Core/DiscIO/Blob.cpp +++ b/Source/Core/DiscIO/Blob.cpp @@ -12,6 +12,7 @@ #include "Common/CDUtils.h" #include "Common/CommonTypes.h" #include "Common/File.h" +#include "Common/MsgHandler.h" #include "DiscIO/Blob.h" #include "DiscIO/CISOBlob.h" @@ -25,6 +26,35 @@ namespace DiscIO { +std::string GetName(BlobType blob_type, bool translate) +{ + const auto translate_str = [translate](const std::string& str) { + return translate ? Common::GetStringT(str.c_str()) : str; + }; + + switch (blob_type) + { + case BlobType::PLAIN: + return "ISO"; + case BlobType::DIRECTORY: + return translate_str("Directory"); + case BlobType::GCZ: + return "GCZ"; + case BlobType::CISO: + return "CISO"; + case BlobType::WBFS: + return "WBFS"; + case BlobType::TGC: + return "TGC"; + case BlobType::WIA: + return "WIA"; + case BlobType::RVZ: + return "RVZ"; + default: + return ""; + } +} + void SectorReader::SetSectorSize(int blocksize) { m_block_size = std::max(blocksize, 0); diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h index e2a1c3c9e9..aa5274618a 100644 --- a/Source/Core/DiscIO/Blob.h +++ b/Source/Core/DiscIO/Blob.h @@ -41,6 +41,8 @@ enum class BlobType RVZ, }; +std::string GetName(BlobType blob_type, bool translate); + class BlobReader { public: @@ -55,6 +57,7 @@ public: // Returns 0 if the format does not use blocks virtual u64 GetBlockSize() const = 0; virtual bool HasFastRandomAccessInBlock() const = 0; + virtual std::string GetCompressionMethod() const = 0; // NOT thread-safe - can't call this from multiple threads. virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0; diff --git a/Source/Core/DiscIO/CISOBlob.h b/Source/Core/DiscIO/CISOBlob.h index 40d44aaa9d..97ef23ab5e 100644 --- a/Source/Core/DiscIO/CISOBlob.h +++ b/Source/Core/DiscIO/CISOBlob.h @@ -46,6 +46,7 @@ public: u64 GetBlockSize() const override { return m_block_size; } bool HasFastRandomAccessInBlock() const override { return true; } + std::string GetCompressionMethod() const override { return {}; } bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/CompressedBlob.h b/Source/Core/DiscIO/CompressedBlob.h index 602d21d91a..d1b2459145 100644 --- a/Source/Core/DiscIO/CompressedBlob.h +++ b/Source/Core/DiscIO/CompressedBlob.h @@ -58,6 +58,7 @@ public: u64 GetBlockSize() const override { return m_header.block_size; } bool HasFastRandomAccessInBlock() const override { return false; } + std::string GetCompressionMethod() const override { return "Deflate"; } u64 GetBlockCompressedSize(u64 block_num) const; bool GetBlock(u64 block_num, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index d526c26ea2..9e6a834151 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -168,6 +168,7 @@ public: u64 GetBlockSize() const override { return 0; } bool HasFastRandomAccessInBlock() const override { return true; } + std::string GetCompressionMethod() const override { return {}; } private: struct PartitionWithType diff --git a/Source/Core/DiscIO/DriveBlob.h b/Source/Core/DiscIO/DriveBlob.h index 65356feb41..ec100185e8 100644 --- a/Source/Core/DiscIO/DriveBlob.h +++ b/Source/Core/DiscIO/DriveBlob.h @@ -32,6 +32,7 @@ public: u64 GetBlockSize() const override { return ECC_BLOCK_SIZE; } bool HasFastRandomAccessInBlock() const override { return false; } + std::string GetCompressionMethod() const override { return {}; } private: DriveReader(const std::string& drive); diff --git a/Source/Core/DiscIO/FileBlob.h b/Source/Core/DiscIO/FileBlob.h index bb97cea7e4..d418976fa3 100644 --- a/Source/Core/DiscIO/FileBlob.h +++ b/Source/Core/DiscIO/FileBlob.h @@ -27,6 +27,7 @@ public: u64 GetBlockSize() const override { return 0; } bool HasFastRandomAccessInBlock() const override { return true; } + std::string GetCompressionMethod() const override { return {}; } bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/ScrubbedBlob.h b/Source/Core/DiscIO/ScrubbedBlob.h index badeb457f8..5bd8652ad5 100644 --- a/Source/Core/DiscIO/ScrubbedBlob.h +++ b/Source/Core/DiscIO/ScrubbedBlob.h @@ -30,6 +30,10 @@ public: { return m_blob_reader->HasFastRandomAccessInBlock(); } + std::string GetCompressionMethod() const override + { + return m_blob_reader->GetCompressionMethod(); + } bool Read(u64 offset, u64 size, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/TGCBlob.h b/Source/Core/DiscIO/TGCBlob.h index b76a282d6e..101e969c89 100644 --- a/Source/Core/DiscIO/TGCBlob.h +++ b/Source/Core/DiscIO/TGCBlob.h @@ -50,6 +50,7 @@ public: u64 GetBlockSize() const override { return 0; } bool HasFastRandomAccessInBlock() const override { return true; } + std::string GetCompressionMethod() const override { return {}; } bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/VolumeFileBlobReader.cpp b/Source/Core/DiscIO/VolumeFileBlobReader.cpp index eb80003adc..3f50f1332d 100644 --- a/Source/Core/DiscIO/VolumeFileBlobReader.cpp +++ b/Source/Core/DiscIO/VolumeFileBlobReader.cpp @@ -54,6 +54,11 @@ bool VolumeFileBlobReader::HasFastRandomAccessInBlock() const return m_volume.GetBlobReader().HasFastRandomAccessInBlock(); } +std::string VolumeFileBlobReader::GetCompressionMethod() const +{ + return m_volume.GetBlobReader().GetCompressionMethod(); +} + bool VolumeFileBlobReader::Read(u64 offset, u64 length, u8* out_ptr) { if (offset + length > m_file_info->GetSize()) diff --git a/Source/Core/DiscIO/VolumeFileBlobReader.h b/Source/Core/DiscIO/VolumeFileBlobReader.h index 8e227ece63..5cdb7baf7c 100644 --- a/Source/Core/DiscIO/VolumeFileBlobReader.h +++ b/Source/Core/DiscIO/VolumeFileBlobReader.h @@ -30,6 +30,7 @@ public: u64 GetBlockSize() const override; bool HasFastRandomAccessInBlock() const override; + std::string GetCompressionMethod() const override; bool Read(u64 offset, u64 length, u8* out_ptr) override; diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp index 6f64b3ba01..4886ceaf7c 100644 --- a/Source/Core/DiscIO/WIABlob.cpp +++ b/Source/Core/DiscIO/WIABlob.cpp @@ -291,6 +291,26 @@ BlobType WIARVZFileReader<RVZ>::GetBlobType() const } template <bool RVZ> +std::string WIARVZFileReader<RVZ>::GetCompressionMethod() const +{ + switch (m_compression_type) + { + case WIARVZCompressionType::Purge: + return "Purge"; + case WIARVZCompressionType::Bzip2: + return "bzip2"; + case WIARVZCompressionType::LZMA: + return "LZMA"; + case WIARVZCompressionType::LZMA2: + return "LZMA2"; + case WIARVZCompressionType::Zstd: + return "Zstandard"; + default: + return {}; + } +} + +template <bool RVZ> bool WIARVZFileReader<RVZ>::Read(u64 offset, u64 size, u8* out_ptr) { if (offset + size > Common::swap64(m_header_1.iso_file_size)) diff --git a/Source/Core/DiscIO/WIABlob.h b/Source/Core/DiscIO/WIABlob.h index 789a3e7dd5..8f941ce98b 100644 --- a/Source/Core/DiscIO/WIABlob.h +++ b/Source/Core/DiscIO/WIABlob.h @@ -56,6 +56,7 @@ public: u64 GetBlockSize() const override { return Common::swap32(m_header_2.chunk_size); } bool HasFastRandomAccessInBlock() const override { return false; } + std::string GetCompressionMethod() const override; bool Read(u64 offset, u64 size, u8* out_ptr) override; bool SupportsReadWiiDecrypted() const override; diff --git a/Source/Core/DiscIO/WbfsBlob.h b/Source/Core/DiscIO/WbfsBlob.h index 0f985fe3d4..d3bca22ecc 100644 --- a/Source/Core/DiscIO/WbfsBlob.h +++ b/Source/Core/DiscIO/WbfsBlob.h @@ -34,6 +34,7 @@ public: u64 GetBlockSize() const override { return m_wbfs_sector_size; } bool HasFastRandomAccessInBlock() const override { return true; } + std::string GetCompressionMethod() const override { return {}; } bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; |
