Display all compressed formats in blue in GUI

In the past, only GCZ was shown as compressed, not CISO and WBFS.
This commit is contained in:
JosJuice 2015-09-26 15:24:29 +02:00
parent 94ee720a07
commit 6935d28112
17 changed files with 36 additions and 5 deletions

View File

@ -25,7 +25,8 @@ class IBlobReader
public: public:
virtual ~IBlobReader() {} virtual ~IBlobReader() {}
virtual u64 GetRawSize() const = 0; virtual bool IsCompressed() const = 0;
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0; virtual u64 GetDataSize() const = 0;
// NOT thread-safe - can't call this from multiple threads. // NOT thread-safe - can't call this from multiple threads.
virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0; virtual bool Read(u64 offset, u64 size, u8* out_ptr) = 0;

View File

@ -36,6 +36,7 @@ class CISOFileReader : public IBlobReader
public: public:
static CISOFileReader* Create(const std::string& filename); static CISOFileReader* Create(const std::string& filename);
bool IsCompressed() const override { return true; }
u64 GetDataSize() const override; u64 GetDataSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;

View File

@ -49,6 +49,7 @@ public:
static CompressedBlobReader* Create(const std::string& filename); static CompressedBlobReader* Create(const std::string& filename);
~CompressedBlobReader(); ~CompressedBlobReader();
const CompressedBlobHeader &GetHeader() const { return m_header; } const CompressedBlobHeader &GetHeader() const { return m_header; }
bool IsCompressed() const override { return true; }
u64 GetDataSize() const override { return m_header.data_size; } u64 GetDataSize() const override { return m_header.data_size; }
u64 GetRawSize() const override { return m_file_size; } u64 GetRawSize() const override { return m_file_size; }
u64 GetBlockCompressedSize(u64 block_num) const; u64 GetBlockCompressedSize(u64 block_num) const;

View File

@ -23,6 +23,7 @@ class DriveReader : public SectorReader
public: public:
static DriveReader* Create(const std::string& drive); static DriveReader* Create(const std::string& drive);
~DriveReader(); ~DriveReader();
bool IsCompressed() const override { return false; }
u64 GetDataSize() const override { return m_size; } u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; } u64 GetRawSize() const override { return m_size; }

View File

@ -19,6 +19,7 @@ class PlainFileReader : public IBlobReader
public: public:
static PlainFileReader* Create(const std::string& filename); static PlainFileReader* Create(const std::string& filename);
bool IsCompressed() const override { return false; }
u64 GetDataSize() const override { return m_size; } u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; } u64 GetRawSize() const override { return m_size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;

View File

@ -101,8 +101,9 @@ public:
virtual bool ChangePartition(u64 offset) { return false; } virtual bool ChangePartition(u64 offset) { return false; }
virtual ECountry GetCountry() const = 0; virtual ECountry GetCountry() const = 0;
virtual bool IsCompressed() const = 0;
// Size of virtual disc (not always accurate)
virtual u64 GetSize() const = 0; virtual u64 GetSize() const = 0;
// Size on disc (compressed size) // Size on disc (compressed size)
virtual u64 GetRawSize() const = 0; virtual u64 GetRawSize() const = 0;

View File

@ -225,6 +225,11 @@ IVolume::EPlatform CVolumeDirectory::GetVolumeType() const
return m_is_wii ? WII_DISC : GAMECUBE_DISC; return m_is_wii ? WII_DISC : GAMECUBE_DISC;
} }
bool CVolumeDirectory::IsCompressed() const
{
return false;
}
u64 CVolumeDirectory::GetSize() const u64 CVolumeDirectory::GetSize() const
{ {
return 0; return 0;

View File

@ -51,6 +51,7 @@ public:
ECountry GetCountry() const override; ECountry GetCountry() const override;
bool IsCompressed() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -168,6 +168,11 @@ std::string CVolumeGC::GetApploaderDate() const
return DecodeString(date); return DecodeString(date);
} }
bool CVolumeGC::IsCompressed() const
{
return m_pReader ? m_pReader->IsCompressed() : false;
}
u64 CVolumeGC::GetSize() const u64 CVolumeGC::GetSize() const
{ {
if (m_pReader) if (m_pReader)

View File

@ -39,6 +39,7 @@ public:
EPlatform GetVolumeType() const override; EPlatform GetVolumeType() const override;
ECountry GetCountry() const override; ECountry GetCountry() const override;
bool IsCompressed() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -124,6 +124,11 @@ std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames(bool prefer_long)
return ReadWiiNames(name_data); return ReadWiiNames(name_data);
} }
bool CVolumeWAD::IsCompressed() const
{
return m_pReader ? m_pReader->IsCompressed() : false;
}
u64 CVolumeWAD::GetSize() const u64 CVolumeWAD::GetSize() const
{ {
if (m_pReader) if (m_pReader)

View File

@ -37,8 +37,9 @@ public:
std::string GetApploaderDate() const override { return ""; } std::string GetApploaderDate() const override { return ""; }
EPlatform GetVolumeType() const override; EPlatform GetVolumeType() const override;
ECountry GetCountry() const override; ECountry GetCountry() const override;
bool IsCompressed() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -250,6 +250,11 @@ u8 CVolumeWiiCrypted::GetDiscNumber() const
return disc_number; return disc_number;
} }
bool CVolumeWiiCrypted::IsCompressed() const
{
return m_pReader ? m_pReader->IsCompressed() : false;
}
u64 CVolumeWiiCrypted::GetSize() const u64 CVolumeWiiCrypted::GetSize() const
{ {
if (m_pReader) if (m_pReader)

View File

@ -43,6 +43,7 @@ public:
bool ChangePartition(u64 offset) override; bool ChangePartition(u64 offset) override;
ECountry GetCountry() const override; ECountry GetCountry() const override;
bool IsCompressed() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -19,6 +19,7 @@ class WbfsFileReader : public IBlobReader
public: public:
static WbfsFileReader* Create(const std::string& filename); static WbfsFileReader* Create(const std::string& filename);
bool IsCompressed() const override { return true; }
u64 GetDataSize() const override { return m_size; } u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; } u64 GetRawSize() const override { return m_size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override; bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;

View File

@ -113,7 +113,7 @@ GameFile::GameFile(const QString& fileName)
m_volume_size = volume->GetSize(); m_volume_size = volume->GetSize();
m_unique_id = QString::fromStdString(volume->GetUniqueID()); m_unique_id = QString::fromStdString(volume->GetUniqueID());
m_compressed = DiscIO::IsGCZBlob(fileName.toStdString()); m_compressed = volume->IsCompressed();
m_disc_number = volume->GetDiscNumber(); m_disc_number = volume->GetDiscNumber();
m_revision = volume->GetRevision(); m_revision = volume->GetRevision();

View File

@ -111,7 +111,7 @@ GameListItem::GameListItem(const std::string& _rFileName, const std::unordered_m
m_VolumeSize = pVolume->GetSize(); m_VolumeSize = pVolume->GetSize();
m_UniqueID = pVolume->GetUniqueID(); m_UniqueID = pVolume->GetUniqueID();
m_BlobCompressed = DiscIO::IsGCZBlob(_rFileName); m_BlobCompressed = pVolume->IsCompressed();
m_disc_number = pVolume->GetDiscNumber(); m_disc_number = pVolume->GetDiscNumber();
m_Revision = pVolume->GetRevision(); m_Revision = pVolume->GetRevision();