summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorflacs <tilkax@gmail.com>2015-09-29 03:46:29 +0200
committerflacs <tilkax@gmail.com>2015-09-29 03:46:29 +0200
commitaaa48e19fea02597c8057fbd2bf309890d64f27d (patch)
treea111d53ca97d0703b93f84bb83c52ffd729d11b3 /Source/Core/DiscIO
parent4c1922ae5a1fbe47b358a6d68170f4fe3d00e96c (diff)
parent21cb13828c768471d6553e10063eccbd61e704ed (diff)
Merge pull request #3097 from JosJuice/blob-type
Fix blob type detection for game right-click menu
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/Blob.h13
-rw-r--r--Source/Core/DiscIO/CISOBlob.h2
-rw-r--r--Source/Core/DiscIO/CompressedBlob.h2
-rw-r--r--Source/Core/DiscIO/DriveBlob.h2
-rw-r--r--Source/Core/DiscIO/FileBlob.h2
-rw-r--r--Source/Core/DiscIO/Volume.h3
-rw-r--r--Source/Core/DiscIO/VolumeDirectory.cpp8
-rw-r--r--Source/Core/DiscIO/VolumeDirectory.h3
-rw-r--r--Source/Core/DiscIO/VolumeGC.cpp4
-rw-r--r--Source/Core/DiscIO/VolumeGC.h5
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp4
-rw-r--r--Source/Core/DiscIO/VolumeWad.h5
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.cpp4
-rw-r--r--Source/Core/DiscIO/VolumeWiiCrypted.h5
-rw-r--r--Source/Core/DiscIO/WbfsBlob.h2
15 files changed, 39 insertions, 25 deletions
diff --git a/Source/Core/DiscIO/Blob.h b/Source/Core/DiscIO/Blob.h
index a20ba1888a..4e8fc5b353 100644
--- a/Source/Core/DiscIO/Blob.h
+++ b/Source/Core/DiscIO/Blob.h
@@ -20,12 +20,23 @@
namespace DiscIO
{
+// Increment CACHE_REVISION if the enum below is modified (ISOFile.cpp & GameFile.cpp)
+enum class BlobType
+{
+ PLAIN,
+ DRIVE,
+ DIRECTORY,
+ GCZ,
+ CISO,
+ WBFS
+};
+
class IBlobReader
{
public:
virtual ~IBlobReader() {}
- virtual bool IsCompressed() const = 0;
+ virtual BlobType GetBlobType() const = 0;
virtual u64 GetRawSize() const = 0;
virtual u64 GetDataSize() const = 0;
// NOT thread-safe - can't call this from multiple threads.
diff --git a/Source/Core/DiscIO/CISOBlob.h b/Source/Core/DiscIO/CISOBlob.h
index 2cbf78ba62..a1b5ae5cb7 100644
--- a/Source/Core/DiscIO/CISOBlob.h
+++ b/Source/Core/DiscIO/CISOBlob.h
@@ -36,7 +36,7 @@ class CISOFileReader : public IBlobReader
public:
static CISOFileReader* Create(const std::string& filename);
- bool IsCompressed() const override { return true; }
+ BlobType GetBlobType() const override { return BlobType::CISO; }
u64 GetDataSize() const override;
u64 GetRawSize() const override;
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 d319ab3927..59cd64d16e 100644
--- a/Source/Core/DiscIO/CompressedBlob.h
+++ b/Source/Core/DiscIO/CompressedBlob.h
@@ -49,7 +49,7 @@ public:
static CompressedBlobReader* Create(const std::string& filename);
~CompressedBlobReader();
const CompressedBlobHeader &GetHeader() const { return m_header; }
- bool IsCompressed() const override { return true; }
+ BlobType GetBlobType() const override { return BlobType::GCZ; }
u64 GetDataSize() const override { return m_header.data_size; }
u64 GetRawSize() const override { return m_file_size; }
u64 GetBlockCompressedSize(u64 block_num) const;
diff --git a/Source/Core/DiscIO/DriveBlob.h b/Source/Core/DiscIO/DriveBlob.h
index 0ae09f5089..ee85aed721 100644
--- a/Source/Core/DiscIO/DriveBlob.h
+++ b/Source/Core/DiscIO/DriveBlob.h
@@ -23,7 +23,7 @@ class DriveReader : public SectorReader
public:
static DriveReader* Create(const std::string& drive);
~DriveReader();
- bool IsCompressed() const override { return false; }
+ BlobType GetBlobType() const override { return BlobType::DRIVE; }
u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; }
diff --git a/Source/Core/DiscIO/FileBlob.h b/Source/Core/DiscIO/FileBlob.h
index 9d5aa630fa..6cce3ad402 100644
--- a/Source/Core/DiscIO/FileBlob.h
+++ b/Source/Core/DiscIO/FileBlob.h
@@ -19,7 +19,7 @@ class PlainFileReader : public IBlobReader
public:
static PlainFileReader* Create(const std::string& filename);
- bool IsCompressed() const override { return false; }
+ BlobType GetBlobType() const override { return BlobType::PLAIN; }
u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;
diff --git a/Source/Core/DiscIO/Volume.h b/Source/Core/DiscIO/Volume.h
index c8172c677e..e9dd63f682 100644
--- a/Source/Core/DiscIO/Volume.h
+++ b/Source/Core/DiscIO/Volume.h
@@ -12,6 +12,7 @@
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
+#include "DiscIO/Blob.h"
namespace DiscIO
{
@@ -101,7 +102,7 @@ public:
virtual bool ChangePartition(u64 offset) { return false; }
virtual ECountry GetCountry() const = 0;
- virtual bool IsCompressed() const = 0;
+ virtual BlobType GetBlobType() const = 0;
// Size of virtual disc (not always accurate)
virtual u64 GetSize() const = 0;
// Size on disc (compressed size)
diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp
index fd3e3d8236..75204593ea 100644
--- a/Source/Core/DiscIO/VolumeDirectory.cpp
+++ b/Source/Core/DiscIO/VolumeDirectory.cpp
@@ -16,6 +16,7 @@
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"
#include "Common/Logging/Log.h"
+#include "DiscIO/Blob.h"
#include "DiscIO/FileBlob.h"
#include "DiscIO/FileMonitor.h"
#include "DiscIO/Volume.h"
@@ -227,9 +228,12 @@ IVolume::EPlatform CVolumeDirectory::GetVolumeType() const
return m_is_wii ? WII_DISC : GAMECUBE_DISC;
}
-bool CVolumeDirectory::IsCompressed() const
+BlobType CVolumeDirectory::GetBlobType() const
{
- return false;
+ // VolumeDirectory isn't actually a blob, but it sort of acts
+ // like one, so it makes sense that it has its own blob type.
+ // It should be made into a proper blob in the future.
+ return BlobType::DIRECTORY;
}
u64 CVolumeDirectory::GetSize() const
diff --git a/Source/Core/DiscIO/VolumeDirectory.h b/Source/Core/DiscIO/VolumeDirectory.h
index 8d90496e55..8d8f664a07 100644
--- a/Source/Core/DiscIO/VolumeDirectory.h
+++ b/Source/Core/DiscIO/VolumeDirectory.h
@@ -10,6 +10,7 @@
#include <vector>
#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
namespace File { struct FSTEntry; }
@@ -51,7 +52,7 @@ public:
ECountry GetCountry() const override;
- bool IsCompressed() const override;
+ BlobType GetBlobType() const override;
u64 GetSize() const override;
u64 GetRawSize() const override;
diff --git a/Source/Core/DiscIO/VolumeGC.cpp b/Source/Core/DiscIO/VolumeGC.cpp
index d1a34a5e0e..b432c0d2ca 100644
--- a/Source/Core/DiscIO/VolumeGC.cpp
+++ b/Source/Core/DiscIO/VolumeGC.cpp
@@ -169,9 +169,9 @@ std::string CVolumeGC::GetApploaderDate() const
return DecodeString(date);
}
-bool CVolumeGC::IsCompressed() const
+BlobType CVolumeGC::GetBlobType() const
{
- return m_pReader ? m_pReader->IsCompressed() : false;
+ return m_pReader ? m_pReader->GetBlobType() : BlobType::PLAIN;
}
u64 CVolumeGC::GetSize() const
diff --git a/Source/Core/DiscIO/VolumeGC.h b/Source/Core/DiscIO/VolumeGC.h
index ed08b50871..eebc7f21f6 100644
--- a/Source/Core/DiscIO/VolumeGC.h
+++ b/Source/Core/DiscIO/VolumeGC.h
@@ -10,6 +10,7 @@
#include <vector>
#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
// --- this volume type is used for GC disc images ---
@@ -17,8 +18,6 @@
namespace DiscIO
{
-class IBlobReader;
-
class CVolumeGC : public IVolume
{
public:
@@ -39,7 +38,7 @@ public:
EPlatform GetVolumeType() const override;
ECountry GetCountry() const override;
- bool IsCompressed() const override;
+ BlobType GetBlobType() const override;
u64 GetSize() const override;
u64 GetRawSize() const override;
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index fb510afefc..7aea6beef9 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -126,9 +126,9 @@ std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames(bool prefer_long)
return ReadWiiNames(name_data);
}
-bool CVolumeWAD::IsCompressed() const
+BlobType CVolumeWAD::GetBlobType() const
{
- return m_pReader ? m_pReader->IsCompressed() : false;
+ return m_pReader ? m_pReader->GetBlobType() : BlobType::PLAIN;
}
u64 CVolumeWAD::GetSize() const
diff --git a/Source/Core/DiscIO/VolumeWad.h b/Source/Core/DiscIO/VolumeWad.h
index 99b1369fea..7af4eeca7b 100644
--- a/Source/Core/DiscIO/VolumeWad.h
+++ b/Source/Core/DiscIO/VolumeWad.h
@@ -10,6 +10,7 @@
#include <vector>
#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
// --- this volume type is used for Wad files ---
@@ -19,8 +20,6 @@
namespace DiscIO
{
-class IBlobReader;
-
class CVolumeWAD : public IVolume
{
public:
@@ -39,7 +38,7 @@ public:
EPlatform GetVolumeType() const override;
ECountry GetCountry() const override;
- bool IsCompressed() const override;
+ BlobType GetBlobType() const override;
u64 GetSize() const override;
u64 GetRawSize() const override;
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.cpp b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
index 87c68f8cd2..2812647c84 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.cpp
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.cpp
@@ -250,9 +250,9 @@ u8 CVolumeWiiCrypted::GetDiscNumber() const
return disc_number;
}
-bool CVolumeWiiCrypted::IsCompressed() const
+BlobType CVolumeWiiCrypted::GetBlobType() const
{
- return m_pReader ? m_pReader->IsCompressed() : false;
+ return m_pReader ? m_pReader->GetBlobType() : BlobType::PLAIN;
}
u64 CVolumeWiiCrypted::GetSize() const
diff --git a/Source/Core/DiscIO/VolumeWiiCrypted.h b/Source/Core/DiscIO/VolumeWiiCrypted.h
index ccf0865122..bfd5c6df8b 100644
--- a/Source/Core/DiscIO/VolumeWiiCrypted.h
+++ b/Source/Core/DiscIO/VolumeWiiCrypted.h
@@ -11,6 +11,7 @@
#include <polarssl/aes.h>
#include "Common/CommonTypes.h"
+#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
// --- this volume type is used for encrypted Wii images ---
@@ -18,8 +19,6 @@
namespace DiscIO
{
-class IBlobReader;
-
class CVolumeWiiCrypted : public IVolume
{
public:
@@ -43,7 +42,7 @@ public:
bool ChangePartition(u64 offset) override;
ECountry GetCountry() const override;
- bool IsCompressed() const override;
+ BlobType GetBlobType() const override;
u64 GetSize() const override;
u64 GetRawSize() const override;
diff --git a/Source/Core/DiscIO/WbfsBlob.h b/Source/Core/DiscIO/WbfsBlob.h
index 75e3af449f..746798edc6 100644
--- a/Source/Core/DiscIO/WbfsBlob.h
+++ b/Source/Core/DiscIO/WbfsBlob.h
@@ -19,7 +19,7 @@ class WbfsFileReader : public IBlobReader
public:
static WbfsFileReader* Create(const std::string& filename);
- bool IsCompressed() const override { return true; }
+ BlobType GetBlobType() const override { return BlobType::WBFS; }
u64 GetDataSize() const override { return m_size; }
u64 GetRawSize() const override { return m_size; }
bool Read(u64 offset, u64 nbytes, u8* out_ptr) override;