Volume: Return volume type as an enum

ISOFile and GameFile were using IsWiiDisc() and IsWadFile() to set
an enum value. The volume might as well return an enum directly.

I increased the Qt CACHE_REVISION because m_platform now is saved as u32
instead of int, but increasing the wx CACHE_REVISION is not necessary.
This commit is contained in:
JosJuice
2015-06-04 16:26:36 +02:00
parent f5b0468179
commit 0ed3118141
21 changed files with 98 additions and 112 deletions

View File

@ -76,7 +76,7 @@ void ReadFileSystem(const std::string& filename)
if (!OpenISO)
return;
if (!OpenISO->IsWadFile())
if (OpenISO->GetVolumeType() != DiscIO::IVolume::WII_WAD)
{
pFileSystem = DiscIO::CreateFileSystem(OpenISO);

View File

@ -19,6 +19,14 @@ class IVolume
{
public:
// Increment CACHE_REVISION if the enums below are modified (ISOFile.cpp & GameFile.cpp)
enum EPlatform
{
GAMECUBE_DISC = 0,
WII_DISC,
WII_WAD,
NUMBER_OF_PLATFORMS
};
enum ECountry
{
COUNTRY_EUROPE = 0,
@ -86,8 +94,7 @@ public:
// 0 is the first disc, 1 is the second disc
virtual u8 GetDiscNumber() const { return 0; }
virtual bool IsWiiDisc() const { return false; }
virtual bool IsWadFile() const { return false; }
virtual EPlatform GetVolumeType() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckIntegrity() const { return false; }
virtual bool ChangePartition(u64 offset) { return false; }

View File

@ -220,9 +220,9 @@ std::string CVolumeDirectory::GetApploaderDate() const
return "VOID";
}
bool CVolumeDirectory::IsWiiDisc() const
IVolume::EPlatform CVolumeDirectory::GetVolumeType() const
{
return m_is_wii;
return m_is_wii ? WII_DISC : GAMECUBE_DISC;
}
u64 CVolumeDirectory::GetSize() const

View File

@ -47,7 +47,7 @@ public:
u32 GetFSTSize() const override;
std::string GetApploaderDate() const override;
bool IsWiiDisc() const override;
EPlatform GetVolumeType() const override;
ECountry GetCountry() const override;

View File

@ -272,6 +272,11 @@ u8 CVolumeGC::GetDiscNumber() const
return disc_number;
}
IVolume::EPlatform CVolumeGC::GetVolumeType() const
{
return GAMECUBE_DISC;
}
bool CVolumeGC::LoadBannerFile() const
{
// The methods GetNames, GetDescriptions, GetCompany and GetBanner

View File

@ -37,6 +37,7 @@ public:
std::string GetApploaderDate() const override;
u8 GetDiscNumber() const override;
EPlatform GetVolumeType() const override;
ECountry GetCountry() const override;
u64 GetSize() const override;
u64 GetRawSize() const override;

View File

@ -112,9 +112,9 @@ u16 CVolumeWAD::GetRevision() const
return Common::swap16(revision);
}
bool CVolumeWAD::IsWadFile() const
IVolume::EPlatform CVolumeWAD::GetVolumeType() const
{
return true;
return WII_WAD;
}
std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetNames() const

View File

@ -36,7 +36,7 @@ public:
u32 GetFSTSize() const override { return 0; }
std::string GetApploaderDate() const override { return ""; }
bool IsWadFile() const override;
EPlatform GetVolumeType() const override;
ECountry GetCountry() const override;
u64 GetSize() const override;

View File

@ -238,9 +238,9 @@ std::string CVolumeWiiCrypted::GetApploaderDate() const
return date;
}
bool CVolumeWiiCrypted::IsWiiDisc() const
IVolume::EPlatform CVolumeWiiCrypted::GetVolumeType() const
{
return true;
return WII_DISC;
}
u8 CVolumeWiiCrypted::GetDiscNumber() const

View File

@ -37,7 +37,7 @@ public:
std::string GetApploaderDate() const override;
u8 GetDiscNumber() const override;
bool IsWiiDisc() const override;
EPlatform GetVolumeType() const override;
bool SupportsIntegrityCheck() const override { return true; }
bool CheckIntegrity() const override;
bool ChangePartition(u64 offset) override;