Move DiscIO enums to a new file

At first there weren't many enums in Volume.h, but the number has been
growing, and I'm planning to add one more for regions. To not make
Volume.h too large, and to avoid needing to include Volume.h in code
that doesn't use volume objects, I'm moving the enums to a new file.
I'm also turning them into enum classes while I'm at it.
This commit is contained in:
JosJuice
2016-07-06 20:33:05 +02:00
parent baf9abe911
commit 0a15aaaa12
49 changed files with 665 additions and 574 deletions

View File

@ -12,59 +12,15 @@
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/StringUtil.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
namespace DiscIO
{
enum class BlobType;
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,
ELF_DOL,
NUMBER_OF_PLATFORMS
};
enum ECountry
{
COUNTRY_EUROPE = 0,
COUNTRY_JAPAN,
COUNTRY_USA,
COUNTRY_AUSTRALIA,
COUNTRY_FRANCE,
COUNTRY_GERMANY,
COUNTRY_ITALY,
COUNTRY_KOREA,
COUNTRY_NETHERLANDS,
COUNTRY_RUSSIA,
COUNTRY_SPAIN,
COUNTRY_TAIWAN,
COUNTRY_WORLD,
COUNTRY_UNKNOWN,
NUMBER_OF_COUNTRIES
};
// Languages 0 - 9 match the official Wii language numbering.
// Languages 1 - 6 match the official GC PAL languages 0 - 5.
enum ELanguage
{
LANGUAGE_JAPANESE = 0,
LANGUAGE_ENGLISH = 1,
LANGUAGE_GERMAN = 2,
LANGUAGE_FRENCH = 3,
LANGUAGE_SPANISH = 4,
LANGUAGE_ITALIAN = 5,
LANGUAGE_DUTCH = 6,
LANGUAGE_SIMPLIFIED_CHINESE = 7,
LANGUAGE_TRADITIONAL_CHINESE = 8,
LANGUAGE_KOREAN = 9,
LANGUAGE_UNKNOWN
};
IVolume() {}
virtual ~IVolume() {}
// decrypt parameter must be false if not reading a Wii disc
@ -85,36 +41,21 @@ public:
virtual std::string GetMakerID() const = 0;
virtual u16 GetRevision() const = 0;
virtual std::string GetInternalName() const = 0;
virtual std::map<ELanguage, std::string> GetShortNames() const
{
return std::map<ELanguage, std::string>();
}
virtual std::map<ELanguage, std::string> GetLongNames() const
{
return std::map<ELanguage, std::string>();
}
virtual std::map<ELanguage, std::string> GetShortMakers() const
{
return std::map<ELanguage, std::string>();
}
virtual std::map<ELanguage, std::string> GetLongMakers() const
{
return std::map<ELanguage, std::string>();
}
virtual std::map<ELanguage, std::string> GetDescriptions() const
{
return std::map<ELanguage, std::string>();
}
virtual std::map<Language, std::string> GetShortNames() const { return {{}}; }
virtual std::map<Language, std::string> GetLongNames() const { return {{}}; }
virtual std::map<Language, std::string> GetShortMakers() const { return {{}}; }
virtual std::map<Language, std::string> GetLongMakers() const { return {{}}; }
virtual std::map<Language, std::string> GetDescriptions() const { return {{}}; }
virtual std::vector<u32> GetBanner(int* width, int* height) const = 0;
virtual u64 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0;
// 0 is the first disc, 1 is the second disc
virtual u8 GetDiscNumber() const { return 0; }
virtual EPlatform GetVolumeType() const = 0;
virtual Platform GetVolumeType() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckIntegrity() const { return false; }
virtual bool ChangePartition(u64 offset) { return false; }
virtual ECountry GetCountry() const = 0;
virtual Country GetCountry() const = 0;
virtual BlobType GetBlobType() const = 0;
// Size of virtual disc (not always accurate)
virtual u64 GetSize() const = 0;
@ -132,7 +73,8 @@ protected:
// There doesn't seem to be any GC discs with the country set to Taiwan...
// But maybe they would use Shift_JIS if they existed? Not sure
bool use_shift_jis = (COUNTRY_JAPAN == GetCountry() || COUNTRY_TAIWAN == GetCountry());
bool use_shift_jis =
(Country::COUNTRY_JAPAN == GetCountry() || Country::COUNTRY_TAIWAN == GetCountry());
if (use_shift_jis)
return SHIFTJISToUTF8(string);
@ -140,7 +82,7 @@ protected:
return CP1252ToUTF8(string);
}
static std::map<IVolume::ELanguage, std::string> ReadWiiNames(const std::vector<u8>& data);
static std::map<Language, std::string> ReadWiiNames(const std::vector<u8>& data);
static const size_t NUMBER_OF_LANGUAGES = 10;
static const size_t NAME_STRING_LENGTH = 42;
@ -148,9 +90,4 @@ protected:
static const size_t NAMES_TOTAL_BYTES = NAME_BYTES_LENGTH * NUMBER_OF_LANGUAGES;
};
// Generic Switch function for all volumes
IVolume::ECountry CountrySwitch(u8 country_code);
u8 GetSysMenuRegion(u16 _TitleVersion);
std::string GetCompanyFromID(const std::string& company_id);
} // namespace