Merge pull request #3983 from JosJuice/discio-enums

Move DiscIO enums to a new file
This commit is contained in:
Pierre Bourdon 2016-07-13 19:51:01 +02:00 committed by GitHub
commit 014037ebb7
49 changed files with 665 additions and 574 deletions

View File

@ -33,6 +33,7 @@
#include "Core/PowerPC/Profiler.h" #include "Core/PowerPC/Profiler.h"
#include "Core/State.h" #include "Core/State.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -226,15 +227,14 @@ static int GetCountry(std::string filename)
if (pVolume != nullptr) if (pVolume != nullptr)
{ {
DiscIO::IVolume::ECountry country = pVolume->GetCountry(); int country = static_cast<int>(pVolume->GetCountry());
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Country Code: %i", country); __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Country Code: %i", country);
return country; return country;
} }
// Return UNKNOWN return static_cast<int>(DiscIO::Country::COUNTRY_UNKNOWN);
return 13;
} }
static int GetPlatform(std::string filename) static int GetPlatform(std::string filename)
@ -245,13 +245,13 @@ static int GetPlatform(std::string filename)
{ {
switch (pVolume->GetVolumeType()) switch (pVolume->GetVolumeType())
{ {
case DiscIO::IVolume::GAMECUBE_DISC: case DiscIO::Platform::GAMECUBE_DISC:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a GameCube disc."); __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a GameCube disc.");
return 0; return 0;
case DiscIO::IVolume::WII_DISC: case DiscIO::Platform::WII_DISC:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc."); __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii disc.");
return 1; return 1;
case DiscIO::IVolume::WII_WAD: case DiscIO::Platform::WII_WAD:
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD."); __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Volume is a Wii WAD.");
return 2; return 2;
} }
@ -269,13 +269,13 @@ static std::string GetTitle(std::string filename)
if (pVolume != nullptr) if (pVolume != nullptr)
{ {
std::map<DiscIO::IVolume::ELanguage, std::string> titles = pVolume->GetLongNames(); std::map<DiscIO::Language, std::string> titles = pVolume->GetLongNames();
if (titles.empty()) if (titles.empty())
titles = pVolume->GetShortNames(); titles = pVolume->GetShortNames();
/* /*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC; bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title); DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
auto it = titles.find(language); auto it = titles.find(language);
if (it != end) if (it != end)
@ -284,8 +284,8 @@ static std::string GetTitle(std::string filename)
auto end = titles.end(); auto end = titles.end();
// English tends to be a good fallback when the requested language isn't available // English tends to be a good fallback when the requested language isn't available
// if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) { // if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = titles.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH); auto it = titles.find(DiscIO::Language::LANGUAGE_ENGLISH);
if (it != end) if (it != end)
return it->second; return it->second;
//} //}
@ -312,11 +312,11 @@ static std::string GetDescription(std::string filename)
if (volume != nullptr) if (volume != nullptr)
{ {
std::map<DiscIO::IVolume::ELanguage, std::string> descriptions = volume->GetDescriptions(); std::map<DiscIO::Language, std::string> descriptions = volume->GetDescriptions();
/* /*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC; bool is_wii_title = pVolume->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title); DiscIO::Language language = SConfig::GetInstance().GetCurrentLanguage(is_wii_title);
auto it = descriptions.find(language); auto it = descriptions.find(language);
if (it != end) if (it != end)
@ -325,8 +325,8 @@ static std::string GetDescription(std::string filename)
auto end = descriptions.end(); auto end = descriptions.end();
// English tends to be a good fallback when the requested language isn't available // English tends to be a good fallback when the requested language isn't available
// if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) { // if (language != DiscIO::Language::LANGUAGE_ENGLISH) {
auto it = descriptions.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH); auto it = descriptions.find(DiscIO::Language::LANGUAGE_ENGLISH);
if (it != end) if (it != end)
return it->second; return it->second;
//} //}

View File

@ -31,7 +31,9 @@
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/PowerPC/SignatureDB.h" #include "Core/PowerPC/SignatureDB.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
bool CBoot::DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt) bool CBoot::DVDRead(u64 dvd_offset, u32 output_address, u32 length, bool decrypt)
@ -263,7 +265,7 @@ bool CBoot::BootUp()
const DiscIO::IVolume& pVolume = DVDInterface::GetVolume(); const DiscIO::IVolume& pVolume = DVDInterface::GetVolume();
if ((pVolume.GetVolumeType() == DiscIO::IVolume::WII_DISC) != _StartupPara.bWii) if ((pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC) != _StartupPara.bWii)
{ {
PanicAlertT("Warning - starting ISO in wrong console mode!"); PanicAlertT("Warning - starting ISO in wrong console mode!");
} }
@ -278,7 +280,7 @@ bool CBoot::BootUp()
WII_IPC_HLE_Interface::ES_DIVerify(tmd_buffer); WII_IPC_HLE_Interface::ES_DIVerify(tmd_buffer);
} }
_StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::IVolume::WII_DISC; _StartupPara.bWii = pVolume.GetVolumeType() == DiscIO::Platform::WII_DISC;
// HLE BS2 or not // HLE BS2 or not
if (_StartupPara.bHLE_BS2) if (_StartupPara.bHLE_BS2)
@ -338,7 +340,7 @@ bool CBoot::BootUp()
BS2Success = EmulatedBS2(dolWii); BS2Success = EmulatedBS2(dolWii);
} }
else if ((!DVDInterface::VolumeIsValid() || else if ((!DVDInterface::VolumeIsValid() ||
DVDInterface::GetVolume().GetVolumeType() != DiscIO::IVolume::WII_DISC) && DVDInterface::GetVolume().GetVolumeType() != DiscIO::Platform::WII_DISC) &&
!_StartupPara.m_strDefaultISO.empty()) !_StartupPara.m_strDefaultISO.empty())
{ {
DVDInterface::SetVolumeName(_StartupPara.m_strDefaultISO); DVDInterface::SetVolumeName(_StartupPara.m_strDefaultISO);
@ -409,7 +411,7 @@ bool CBoot::BootUp()
// Poor man's bootup // Poor man's bootup
if (_StartupPara.bWii) if (_StartupPara.bWii)
SetupWiiMemory(DiscIO::IVolume::COUNTRY_UNKNOWN); SetupWiiMemory(DiscIO::Country::COUNTRY_UNKNOWN);
else else
EmulatedBS2_GC(true); EmulatedBS2_GC(true);

View File

@ -7,7 +7,10 @@
#include <cstdlib> #include <cstdlib>
#include <string> #include <string>
#include "DiscIO/Volume.h" namespace DiscIO
{
enum class Country;
}
struct CountrySetting struct CountrySetting
{ {
@ -54,5 +57,5 @@ private:
static bool Load_BS2(const std::string& _rBootROMFilename); static bool Load_BS2(const std::string& _rBootROMFilename);
static void Load_FST(bool _bIsWii); static void Load_FST(bool _bIsWii);
static bool SetupWiiMemory(DiscIO::IVolume::ECountry country); static bool SetupWiiMemory(DiscIO::Country country);
}; };

View File

@ -20,6 +20,9 @@
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
void CBoot::RunFunction(u32 _iAddr) void CBoot::RunFunction(u32 _iAddr)
{ {
PC = _iAddr; PC = _iAddr;
@ -178,21 +181,21 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
return true; return true;
} }
bool CBoot::SetupWiiMemory(DiscIO::IVolume::ECountry country) bool CBoot::SetupWiiMemory(DiscIO::Country country)
{ {
static const CountrySetting SETTING_EUROPE = {"EUR", "PAL", "EU", "LE"}; static const CountrySetting SETTING_EUROPE = {"EUR", "PAL", "EU", "LE"};
static const CountrySetting SETTING_USA = {"USA", "NTSC", "US", "LU"}; static const CountrySetting SETTING_USA = {"USA", "NTSC", "US", "LU"};
static const CountrySetting SETTING_JAPAN = {"JPN", "NTSC", "JP", "LJ"}; static const CountrySetting SETTING_JAPAN = {"JPN", "NTSC", "JP", "LJ"};
static const CountrySetting SETTING_KOREA = {"KOR", "NTSC", "KR", "LKH"}; static const CountrySetting SETTING_KOREA = {"KOR", "NTSC", "KR", "LKH"};
static const std::map<DiscIO::IVolume::ECountry, const CountrySetting> country_settings = { static const std::map<DiscIO::Country, const CountrySetting> country_settings = {
{DiscIO::IVolume::COUNTRY_EUROPE, SETTING_EUROPE}, {DiscIO::Country::COUNTRY_EUROPE, SETTING_EUROPE},
{DiscIO::IVolume::COUNTRY_USA, SETTING_USA}, {DiscIO::Country::COUNTRY_USA, SETTING_USA},
{DiscIO::IVolume::COUNTRY_JAPAN, SETTING_JAPAN}, {DiscIO::Country::COUNTRY_JAPAN, SETTING_JAPAN},
{DiscIO::IVolume::COUNTRY_KOREA, SETTING_KOREA}, {DiscIO::Country::COUNTRY_KOREA, SETTING_KOREA},
// TODO: Determine if Taiwan have their own specific settings. // TODO: Determine if Taiwan have their own specific settings.
// Also determine if there are other specific settings // Also determine if there are other specific settings
// for other countries. // for other countries.
{DiscIO::IVolume::COUNTRY_TAIWAN, SETTING_JAPAN}}; {DiscIO::Country::COUNTRY_TAIWAN, SETTING_JAPAN}};
auto entryPos = country_settings.find(country); auto entryPos = country_settings.find(country);
const CountrySetting& country_setting = const CountrySetting& country_setting =
(entryPos != country_settings.end()) ? (entryPos != country_settings.end()) ?
@ -333,7 +336,7 @@ bool CBoot::EmulatedBS2_Wii()
INFO_LOG(BOOT, "Faking Wii BS2..."); INFO_LOG(BOOT, "Faking Wii BS2...");
// Setup Wii memory // Setup Wii memory
DiscIO::IVolume::ECountry country_code = DiscIO::IVolume::COUNTRY_UNKNOWN; DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
if (DVDInterface::VolumeIsValid()) if (DVDInterface::VolumeIsValid())
country_code = DVDInterface::GetVolume().GetCountry(); country_code = DVDInterface::GetVolume().GetCountry();
if (SetupWiiMemory(country_code) == false) if (SetupWiiMemory(country_code) == false)
@ -342,7 +345,7 @@ bool CBoot::EmulatedBS2_Wii()
// Execute the apploader // Execute the apploader
bool apploaderRan = false; bool apploaderRan = false;
if (DVDInterface::VolumeIsValid() && if (DVDInterface::VolumeIsValid() &&
DVDInterface::GetVolume().GetVolumeType() == DiscIO::IVolume::WII_DISC) DVDInterface::GetVolume().GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
// This is some kind of consistency check that is compared to the 0x00 // This is some kind of consistency check that is compared to the 0x00
// values as the game boots. This location keeps the 4 byte ID for as long // values as the game boots. This location keeps the 4 byte ID for as long

View File

@ -4,6 +4,7 @@
#include <memory> #include <memory>
#include "Common/CommonFuncs.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Boot/ElfReader.h" #include "Core/Boot/ElfReader.h"

View File

@ -20,6 +20,7 @@
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -92,7 +93,7 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
if (!SetupWiiMemory(ContentLoader.GetCountry())) if (!SetupWiiMemory(ContentLoader.GetCountry()))
return false; return false;
// this sets a bit that is used to detect NTSC-J // this sets a bit that is used to detect NTSC-J
if (ContentLoader.GetCountry() == DiscIO::IVolume::COUNTRY_JAPAN) if (ContentLoader.GetCountry() == DiscIO::Country::COUNTRY_JAPAN)
{ {
VideoInterface::SetRegionReg('J'); VideoInterface::SetRegionReg('J');
} }

View File

@ -19,7 +19,9 @@
#include "Core/HW/SI.h" #include "Core/HW/SI.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
SConfig* SConfig::m_Instance; SConfig* SConfig::m_Instance;
@ -672,31 +674,31 @@ void SConfig::LoadDefaults()
m_revision = 0; m_revision = 0;
} }
static const char* GetRegionOfCountry(DiscIO::IVolume::ECountry country) static const char* GetRegionOfCountry(DiscIO::Country country)
{ {
switch (country) switch (country)
{ {
case DiscIO::IVolume::COUNTRY_USA: case DiscIO::Country::COUNTRY_USA:
return USA_DIR; return USA_DIR;
case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::Country::COUNTRY_TAIWAN:
case DiscIO::IVolume::COUNTRY_KOREA: case DiscIO::Country::COUNTRY_KOREA:
// TODO: Should these have their own Region Dir? // TODO: Should these have their own Region Dir?
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::Country::COUNTRY_JAPAN:
return JAP_DIR; return JAP_DIR;
case DiscIO::IVolume::COUNTRY_AUSTRALIA: case DiscIO::Country::COUNTRY_AUSTRALIA:
case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::Country::COUNTRY_EUROPE:
case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::Country::COUNTRY_FRANCE:
case DiscIO::IVolume::COUNTRY_GERMANY: case DiscIO::Country::COUNTRY_GERMANY:
case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::Country::COUNTRY_ITALY:
case DiscIO::IVolume::COUNTRY_NETHERLANDS: case DiscIO::Country::COUNTRY_NETHERLANDS:
case DiscIO::IVolume::COUNTRY_RUSSIA: case DiscIO::Country::COUNTRY_RUSSIA:
case DiscIO::IVolume::COUNTRY_SPAIN: case DiscIO::Country::COUNTRY_SPAIN:
case DiscIO::IVolume::COUNTRY_WORLD: case DiscIO::Country::COUNTRY_WORLD:
return EUR_DIR; return EUR_DIR;
case DiscIO::IVolume::COUNTRY_UNKNOWN: case DiscIO::Country::COUNTRY_UNKNOWN:
default: default:
return nullptr; return nullptr;
} }
@ -745,7 +747,7 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
m_revision = pVolume->GetRevision(); m_revision = pVolume->GetRevision();
// Check if we have a Wii disc // Check if we have a Wii disc
bWii = pVolume->GetVolumeType() == DiscIO::IVolume::WII_DISC; bWii = pVolume->GetVolumeType() == DiscIO::Platform::WII_DISC;
const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry()); const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry());
if (!retrieved_region_dir) if (!retrieved_region_dir)
@ -947,17 +949,19 @@ void SConfig::CheckMemcardPath(std::string& memcardPath, const std::string& game
} }
} }
DiscIO::IVolume::ELanguage SConfig::GetCurrentLanguage(bool wii) const DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{ {
DiscIO::IVolume::ELanguage language; int language_value;
if (wii) if (wii)
language = (DiscIO::IVolume::ELanguage)SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG"); language_value = SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
else else
language = (DiscIO::IVolume::ELanguage)(SConfig::GetInstance().SelectedLanguage + 1); language_value = SConfig::GetInstance().SelectedLanguage + 1;
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);
// Get rid of invalid values (probably doesn't matter, but might as well do it) // Get rid of invalid values (probably doesn't matter, but might as well do it)
if (language > DiscIO::IVolume::ELanguage::LANGUAGE_UNKNOWN || language < 0) if (language > DiscIO::Language::LANGUAGE_UNKNOWN ||
language = DiscIO::IVolume::ELanguage::LANGUAGE_UNKNOWN; language < DiscIO::Language::LANGUAGE_JAPANESE)
language = DiscIO::Language::LANGUAGE_UNKNOWN;
return language; return language;
} }

View File

@ -12,7 +12,11 @@
#include "Common/SysConf.h" #include "Common/SysConf.h"
#include "Core/HW/EXI_Device.h" #include "Core/HW/EXI_Device.h"
#include "Core/HW/SI_Device.h" #include "Core/HW/SI_Device.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
enum class Language;
}
// DSP Backend Types // DSP Backend Types
#define BACKEND_NULLSOUND _trans("No audio output") #define BACKEND_NULLSOUND _trans("No audio output")
@ -177,7 +181,7 @@ struct SConfig : NonCopyable
bool AutoSetup(EBootBS2 _BootBS2); bool AutoSetup(EBootBS2 _BootBS2);
const std::string& GetUniqueID() const { return m_strUniqueID; } const std::string& GetUniqueID() const { return m_strUniqueID; }
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA); void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
DiscIO::IVolume::ELanguage GetCurrentLanguage(bool wii) const; DiscIO::Language GetCurrentLanguage(bool wii) const;
IniFile LoadDefaultGameIni() const; IniFile LoadDefaultGameIni() const;
IniFile LoadLocalGameIni() const; IniFile LoadLocalGameIni() const;

View File

@ -28,6 +28,7 @@
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -1417,7 +1418,7 @@ s64 CalculateRawDiscReadTime(u64 offset, s64 length)
// Note that the speed at a track (in bytes per second) is the same as // Note that the speed at a track (in bytes per second) is the same as
// the radius of that track because of the length unit used. // the radius of that track because of the length unit used.
double speed; double speed;
if (s_inserted_volume->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (s_inserted_volume->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
speed = std::sqrt(((average_offset - WII_DISC_LOCATION_1_OFFSET) / WII_BYTES_PER_AREA_UNIT + speed = std::sqrt(((average_offset - WII_DISC_LOCATION_1_OFFSET) / WII_BYTES_PER_AREA_UNIT +
WII_DISC_AREA_UP_TO_LOCATION_1) / WII_DISC_AREA_UP_TO_LOCATION_1) /

View File

@ -27,6 +27,7 @@
#include "Core/HW/Sram.h" #include "Core/HW/Sram.h"
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#define MC_STATUS_BUSY 0x80 #define MC_STATUS_BUSY 0x80
@ -135,7 +136,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder) : card_index(ind
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb) void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
{ {
DiscIO::IVolume::ECountry country_code = DiscIO::IVolume::COUNTRY_UNKNOWN; DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
auto strUniqueID = SConfig::GetInstance().m_strUniqueID; auto strUniqueID = SConfig::GetInstance().m_strUniqueID;
u32 CurrentGameId = 0; u32 CurrentGameId = 0;
@ -158,14 +159,14 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX); std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
switch (country_code) switch (country_code)
{ {
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::Country::COUNTRY_JAPAN:
ascii = false; ascii = false;
strDirectoryName += JAP_DIR DIR_SEP; strDirectoryName += JAP_DIR DIR_SEP;
break; break;
case DiscIO::IVolume::COUNTRY_USA: case DiscIO::Country::COUNTRY_USA:
strDirectoryName += USA_DIR DIR_SEP; strDirectoryName += USA_DIR DIR_SEP;
break; break;
case DiscIO::IVolume::COUNTRY_UNKNOWN: case DiscIO::Country::COUNTRY_UNKNOWN:
{ {
// The current game's region is not passed down to the EXI device level. // The current game's region is not passed down to the EXI device level.
// Usually, we can retrieve the region from SConfig::GetInstance().m_strUniqueId. // Usually, we can retrieve the region from SConfig::GetInstance().m_strUniqueId.
@ -185,20 +186,20 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
std::string region = memcardFilename.substr(memcardFilename.size() - 7, 3); std::string region = memcardFilename.substr(memcardFilename.size() - 7, 3);
if (region == JAP_DIR) if (region == JAP_DIR)
{ {
country_code = DiscIO::IVolume::COUNTRY_JAPAN; country_code = DiscIO::Country::COUNTRY_JAPAN;
ascii = false; ascii = false;
strDirectoryName += JAP_DIR DIR_SEP; strDirectoryName += JAP_DIR DIR_SEP;
break; break;
} }
else if (region == USA_DIR) else if (region == USA_DIR)
{ {
country_code = DiscIO::IVolume::COUNTRY_USA; country_code = DiscIO::Country::COUNTRY_USA;
strDirectoryName += USA_DIR DIR_SEP; strDirectoryName += USA_DIR DIR_SEP;
break; break;
} }
} }
default: default:
country_code = DiscIO::IVolume::COUNTRY_EUROPE; country_code = DiscIO::Country::COUNTRY_EUROPE;
strDirectoryName += EUR_DIR DIR_SEP; strDirectoryName += EUR_DIR DIR_SEP;
} }
strDirectoryName += StringFromFormat("Card %c", 'A' + card_index); strDirectoryName += StringFromFormat("Card %c", 'A' + card_index);

View File

@ -24,7 +24,7 @@
const int NO_INDEX = -1; const int NO_INDEX = -1;
static const char* MC_HDR = "MC_SYSTEM_AREA"; static const char* MC_HDR = "MC_SYSTEM_AREA";
int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region, int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Country card_region,
bool currentGameOnly) bool currentGameOnly)
{ {
File::IOFile gcifile(fileName, "rb"); File::IOFile gcifile(fileName, "rb");
@ -39,15 +39,15 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
return NO_INDEX; return NO_INDEX;
} }
DiscIO::IVolume::ECountry gci_region; DiscIO::Country gci_region;
// check region // check region
switch (gci.m_gci_header.Gamecode[3]) switch (gci.m_gci_header.Gamecode[3])
{ {
case 'J': case 'J':
gci_region = DiscIO::IVolume::COUNTRY_JAPAN; gci_region = DiscIO::Country::COUNTRY_JAPAN;
break; break;
case 'E': case 'E':
gci_region = DiscIO::IVolume::COUNTRY_USA; gci_region = DiscIO::Country::COUNTRY_USA;
break; break;
case 'C': case 'C':
// Used by Datel Action Replay Save // Used by Datel Action Replay Save
@ -55,7 +55,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
gci_region = card_region; gci_region = card_region;
break; break;
default: default:
gci_region = DiscIO::IVolume::COUNTRY_EUROPE; gci_region = DiscIO::Country::COUNTRY_EUROPE;
break; break;
} }
@ -146,8 +146,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::IVolume::EC
} }
GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb, GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb,
bool ascii, DiscIO::IVolume::ECountry card_region, bool ascii, DiscIO::Country card_region, int gameId)
int gameId)
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1), m_hdr(slot, sizeMb, ascii), : MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1), m_hdr(slot, sizeMb, ascii),
m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory), m_exiting(false) m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory), m_exiting(false)
{ {

View File

@ -14,7 +14,7 @@
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/NonCopyable.h" #include "Common/NonCopyable.h"
#include "Core/HW/GCMemcard.h" #include "Core/HW/GCMemcard.h"
#include "DiscIO/Volume.h" #include "DiscIO/Enums.h"
// Uncomment this to write the system data of the memorycard from directory to disc // Uncomment this to write the system data of the memorycard from directory to disc
//#define _WRITE_MC_HEADER 1 //#define _WRITE_MC_HEADER 1
@ -25,8 +25,7 @@ class GCMemcardDirectory : public MemoryCardBase, NonCopyable
public: public:
GCMemcardDirectory(const std::string& directory, int slot = 0, u16 sizeMb = MemCard2043Mb, GCMemcardDirectory(const std::string& directory, int slot = 0, u16 sizeMb = MemCard2043Mb,
bool ascii = true, bool ascii = true,
DiscIO::IVolume::ECountry card_region = DiscIO::IVolume::COUNTRY_EUROPE, DiscIO::Country card_region = DiscIO::Country::COUNTRY_EUROPE, int gameId = 0);
int gameId = 0);
~GCMemcardDirectory(); ~GCMemcardDirectory();
void FlushToFile(); void FlushToFile();
void FlushThread(); void FlushThread();
@ -37,8 +36,7 @@ public:
void DoState(PointerWrap& p) override; void DoState(PointerWrap& p) override;
private: private:
int LoadGCI(const std::string& fileName, DiscIO::IVolume::ECountry card_region, int LoadGCI(const std::string& fileName, DiscIO::Country card_region, bool currentGameOnly);
bool currentGameOnly);
inline s32 SaveAreaRW(u32 block, bool writing = false); inline s32 SaveAreaRW(u32 block, bool writing = false);
// s32 DirectoryRead(u32 offset, u32 length, u8* destaddress); // s32 DirectoryRead(u32 offset, u32 length, u8* destaddress);
s32 DirectoryWrite(u32 destaddress, u32 length, u8* srcaddress); s32 DirectoryWrite(u32 destaddress, u32 length, u8* srcaddress);

View File

@ -15,6 +15,7 @@
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h" #include "Core/IPC_HLE/WII_IPC_HLE_Device_DI.h"
#include "DiscIO/Volume.h"
CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName) CWII_IPC_HLE_Device_di::CWII_IPC_HLE_Device_di(u32 _DeviceID, const std::string& _rDeviceName)
: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)

View File

@ -53,6 +53,7 @@
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/ec_wii.h" #include "Core/ec_wii.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>

View File

@ -34,6 +34,7 @@
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/State.h" #include "Core/State.h"
#include "DiscIO/Enums.h"
#include "InputCommon/GCPadStatus.h" #include "InputCommon/GCPadStatus.h"
#include "VideoCommon/Fifo.h" #include "VideoCommon/Fifo.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
@ -82,7 +83,7 @@ static u8 s_bongos, s_memcards;
static u8 s_revision[20]; static u8 s_revision[20];
static u32 s_DSPiromHash = 0; static u32 s_DSPiromHash = 0;
static u32 s_DSPcoefHash = 0; static u32 s_DSPcoefHash = 0;
static u8 s_language = 10; // Set to unknown until language is known static u8 s_language = static_cast<u8>(DiscIO::Language::LANGUAGE_UNKNOWN);
static bool s_bRecordingFromSaveState = false; static bool s_bRecordingFromSaveState = false;
static bool s_bPolled = false; static bool s_bPolled = false;

View File

@ -22,7 +22,7 @@
namespace DiscIO namespace DiscIO
{ {
// Increment CACHE_REVISION if the enum below is modified (ISOFile.cpp & GameFile.cpp) // Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the enum below is modified
enum class BlobType enum class BlobType
{ {
PLAIN, PLAIN,

View File

@ -4,12 +4,13 @@ set(SRCS Blob.cpp
CompressedBlob.cpp CompressedBlob.cpp
DiscScrubber.cpp DiscScrubber.cpp
DriveBlob.cpp DriveBlob.cpp
Enums.cpp
FileBlob.cpp FileBlob.cpp
FileMonitor.cpp FileMonitor.cpp
FileSystemGCWii.cpp FileSystemGCWii.cpp
Filesystem.cpp Filesystem.cpp
NANDContentLoader.cpp NANDContentLoader.cpp
VolumeCommon.cpp Volume.cpp
VolumeCreator.cpp VolumeCreator.cpp
VolumeDirectory.cpp VolumeDirectory.cpp
VolumeGC.cpp VolumeGC.cpp

View File

@ -40,12 +40,13 @@
<ClCompile Include="CompressedBlob.cpp" /> <ClCompile Include="CompressedBlob.cpp" />
<ClCompile Include="DiscScrubber.cpp" /> <ClCompile Include="DiscScrubber.cpp" />
<ClCompile Include="DriveBlob.cpp" /> <ClCompile Include="DriveBlob.cpp" />
<ClCompile Include="Enums.cpp" />
<ClCompile Include="FileBlob.cpp" /> <ClCompile Include="FileBlob.cpp" />
<ClCompile Include="FileMonitor.cpp" /> <ClCompile Include="FileMonitor.cpp" />
<ClCompile Include="Filesystem.cpp" /> <ClCompile Include="Filesystem.cpp" />
<ClCompile Include="FileSystemGCWii.cpp" /> <ClCompile Include="FileSystemGCWii.cpp" />
<ClCompile Include="NANDContentLoader.cpp" /> <ClCompile Include="NANDContentLoader.cpp" />
<ClCompile Include="VolumeCommon.cpp" /> <ClCompile Include="Volume.cpp" />
<ClCompile Include="VolumeCreator.cpp" /> <ClCompile Include="VolumeCreator.cpp" />
<ClCompile Include="VolumeDirectory.cpp" /> <ClCompile Include="VolumeDirectory.cpp" />
<ClCompile Include="VolumeGC.cpp" /> <ClCompile Include="VolumeGC.cpp" />
@ -60,6 +61,7 @@
<ClInclude Include="CompressedBlob.h" /> <ClInclude Include="CompressedBlob.h" />
<ClInclude Include="DiscScrubber.h" /> <ClInclude Include="DiscScrubber.h" />
<ClInclude Include="DriveBlob.h" /> <ClInclude Include="DriveBlob.h" />
<ClInclude Include="Enums.h" />
<ClInclude Include="FileBlob.h" /> <ClInclude Include="FileBlob.h" />
<ClInclude Include="FileMonitor.h" /> <ClInclude Include="FileMonitor.h" />
<ClInclude Include="Filesystem.h" /> <ClInclude Include="Filesystem.h" />

View File

@ -54,9 +54,6 @@
<ClCompile Include="FileMonitor.cpp"> <ClCompile Include="FileMonitor.cpp">
<Filter>Volume</Filter> <Filter>Volume</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="VolumeCommon.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="VolumeCreator.cpp"> <ClCompile Include="VolumeCreator.cpp">
<Filter>Volume</Filter> <Filter>Volume</Filter>
</ClCompile> </ClCompile>
@ -72,6 +69,12 @@
<ClCompile Include="VolumeWiiCrypted.cpp"> <ClCompile Include="VolumeWiiCrypted.cpp">
<Filter>Volume</Filter> <Filter>Volume</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Enums.cpp">
<Filter>Volume</Filter>
</ClCompile>
<ClCompile Include="Volume.cpp">
<Filter>Volume</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="DiscScrubber.h"> <ClInclude Include="DiscScrubber.h">
@ -128,6 +131,9 @@
<ClInclude Include="VolumeWiiCrypted.h"> <ClInclude Include="VolumeWiiCrypted.h">
<Filter>Volume</Filter> <Filter>Volume</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Enums.h">
<Filter>Volume</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />

View File

@ -1,146 +1,83 @@
// Copyright 2009 Dolphin Emulator Project // Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <algorithm>
#include <map> #include <map>
#include <string> #include <string>
#include <utility>
#include <vector>
#include "Common/ColorUtil.h" #include "DiscIO/Enums.h"
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "DiscIO/Volume.h"
namespace DiscIO namespace DiscIO
{ {
static const unsigned int WII_BANNER_WIDTH = 192; // Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
static const unsigned int WII_BANNER_HEIGHT = 64;
static const unsigned int WII_BANNER_SIZE = WII_BANNER_WIDTH * WII_BANNER_HEIGHT * 2;
static const unsigned int WII_BANNER_OFFSET = 0xA0;
std::vector<u32> IVolume::GetWiiBanner(int* width, int* height, u64 title_id) Country CountrySwitch(u8 country_code)
{
*width = 0;
*height = 0;
std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
File::GetUserPath(D_WIIROOT_IDX).c_str(),
(u32)(title_id >> 32), (u32)title_id);
if (!File::Exists(file_name))
return std::vector<u32>();
if (File::GetSize(file_name) < WII_BANNER_OFFSET + WII_BANNER_SIZE)
return std::vector<u32>();
File::IOFile file(file_name, "rb");
if (!file.Seek(WII_BANNER_OFFSET, SEEK_SET))
return std::vector<u32>();
std::vector<u8> banner_file(WII_BANNER_SIZE);
if (!file.ReadBytes(banner_file.data(), banner_file.size()))
return std::vector<u32>();
std::vector<u32> image_buffer(WII_BANNER_WIDTH * WII_BANNER_HEIGHT);
ColorUtil::decode5A3image(image_buffer.data(), (u16*)banner_file.data(), WII_BANNER_WIDTH,
WII_BANNER_HEIGHT);
*width = WII_BANNER_WIDTH;
*height = WII_BANNER_HEIGHT;
return image_buffer;
}
std::map<IVolume::ELanguage, std::string> IVolume::ReadWiiNames(const std::vector<u8>& data)
{
std::map<IVolume::ELanguage, std::string> names;
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
{
size_t name_start = NAME_BYTES_LENGTH * i;
size_t name_end = name_start + NAME_BYTES_LENGTH;
if (data.size() >= name_end)
{
u16* temp = (u16*)(data.data() + name_start);
std::wstring out_temp(NAME_STRING_LENGTH, '\0');
std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16);
out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end());
std::string name = UTF16ToUTF8(out_temp);
if (!name.empty())
names[(IVolume::ELanguage)i] = name;
}
}
return names;
}
// Increment CACHE_REVISION if the code below is modified (ISOFile.cpp & GameFile.cpp)
IVolume::ECountry CountrySwitch(u8 country_code)
{ {
switch (country_code) switch (country_code)
{ {
// Worldwide // Worldwide
case 'A': case 'A':
return IVolume::COUNTRY_WORLD; return Country::COUNTRY_WORLD;
// PAL // PAL
case 'D': case 'D':
return IVolume::COUNTRY_GERMANY; return Country::COUNTRY_GERMANY;
case 'X': // Used by a couple PAL games case 'X': // Used by a couple PAL games
case 'Y': // German, French case 'Y': // German, French
case 'L': // Japanese import to PAL regions case 'L': // Japanese import to PAL regions
case 'M': // Japanese import to PAL regions case 'M': // Japanese import to PAL regions
case 'P': case 'P':
return IVolume::COUNTRY_EUROPE; return Country::COUNTRY_EUROPE;
case 'U': case 'U':
return IVolume::COUNTRY_AUSTRALIA; return Country::COUNTRY_AUSTRALIA;
case 'F': case 'F':
return IVolume::COUNTRY_FRANCE; return Country::COUNTRY_FRANCE;
case 'I': case 'I':
return IVolume::COUNTRY_ITALY; return Country::COUNTRY_ITALY;
case 'H': case 'H':
return IVolume::COUNTRY_NETHERLANDS; return Country::COUNTRY_NETHERLANDS;
case 'R': case 'R':
return IVolume::COUNTRY_RUSSIA; return Country::COUNTRY_RUSSIA;
case 'S': case 'S':
return IVolume::COUNTRY_SPAIN; return Country::COUNTRY_SPAIN;
// NTSC // NTSC
case 'E': case 'E':
case 'N': // Japanese import to USA and other NTSC regions case 'N': // Japanese import to USA and other NTSC regions
case 'Z': // Prince of Persia - The Forgotten Sands (Wii) case 'Z': // Prince of Persia - The Forgotten Sands (Wii)
case 'B': // Ufouria: The Saga (Virtual Console) case 'B': // Ufouria: The Saga (Virtual Console)
return IVolume::COUNTRY_USA; return Country::COUNTRY_USA;
case 'J': case 'J':
return IVolume::COUNTRY_JAPAN; return Country::COUNTRY_JAPAN;
case 'K': case 'K':
case 'Q': // Korea with Japanese language case 'Q': // Korea with Japanese language
case 'T': // Korea with English language case 'T': // Korea with English language
return IVolume::COUNTRY_KOREA; return Country::COUNTRY_KOREA;
case 'W': case 'W':
return IVolume::COUNTRY_TAIWAN; return Country::COUNTRY_TAIWAN;
default: default:
if (country_code > 'A') // Silently ignore IOS wads if (country_code > 'A') // Silently ignore IOS wads
WARN_LOG(DISCIO, "Unknown Country Code! %c", country_code); WARN_LOG(DISCIO, "Unknown Country Code! %c", country_code);
return IVolume::COUNTRY_UNKNOWN; return Country::COUNTRY_UNKNOWN;
} }
} }
u8 GetSysMenuRegion(u16 _TitleVersion) u8 GetSysMenuRegion(u16 title_version)
{ {
switch (_TitleVersion) switch (title_version)
{ {
case 128: case 128:
case 192: case 192:

View File

@ -0,0 +1,62 @@
// Copyright 2016 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonTypes.h"
namespace DiscIO
{
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if these enums are modified
enum class Platform
{
GAMECUBE_DISC = 0,
WII_DISC,
WII_WAD,
ELF_DOL,
NUMBER_OF_PLATFORMS
};
enum class Country
{
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 Nintendo's Wii language numbering.
// Languages 1 - 6 match Nintendo's PAL GameCube languages 0 - 5.
// NTSC GameCubes only support one language and thus don't number languages.
enum class Language
{
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
};
Country CountrySwitch(u8 country_code);
u8 GetSysMenuRegion(u16 title_version);
std::string GetCompanyFromID(const std::string& company_id);
}

View File

@ -18,6 +18,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DiscIO/Enums.h"
#include "DiscIO/FileMonitor.h" #include "DiscIO/FileMonitor.h"
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
@ -67,7 +68,7 @@ void ReadFileSystem(const std::string& filename)
if (!s_open_iso) if (!s_open_iso)
return; return;
if (s_open_iso->GetVolumeType() != DiscIO::IVolume::WII_WAD) if (s_open_iso->GetVolumeType() != DiscIO::Platform::WII_WAD)
{ {
s_filesystem = DiscIO::CreateFileSystem(s_open_iso.get()); s_filesystem = DiscIO::CreateFileSystem(s_open_iso.get());

View File

@ -23,8 +23,8 @@
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "DiscIO/Enums.h"
#include "DiscIO/NANDContentLoader.h" #include "DiscIO/NANDContentLoader.h"
#include "DiscIO/Volume.h"
#include "DiscIO/WiiWad.h" #include "DiscIO/WiiWad.h"
namespace DiscIO namespace DiscIO
@ -303,10 +303,10 @@ std::vector<u8> CNANDContentLoader::GetKeyFromTicket(const std::vector<u8>& tick
return AESDecode(common_key, iv, &ticket[0x01BF], 16); return AESDecode(common_key, iv, &ticket[0x01BF], 16);
} }
DiscIO::IVolume::ECountry CNANDContentLoader::GetCountry() const DiscIO::Country CNANDContentLoader::GetCountry() const
{ {
if (!IsValid()) if (!IsValid())
return DiscIO::IVolume::COUNTRY_UNKNOWN; return DiscIO::Country::COUNTRY_UNKNOWN;
return CountrySwitch(m_Country); return CountrySwitch(m_Country);
} }

View File

@ -5,13 +5,18 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <memory>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
enum class Country;
}
namespace DiscIO namespace DiscIO
{ {
@ -86,7 +91,7 @@ public:
const std::vector<SNANDContent>& GetContent() const { return m_Content; } const std::vector<SNANDContent>& GetContent() const { return m_Content; }
u16 GetTitleVersion() const { return m_TitleVersion; } u16 GetTitleVersion() const { return m_TitleVersion; }
u16 GetNumEntries() const { return m_NumEntries; } u16 GetNumEntries() const { return m_NumEntries; }
DiscIO::IVolume::ECountry GetCountry() const; DiscIO::Country GetCountry() const;
u8 GetCountryChar() const { return m_Country; } u8 GetCountryChar() const { return m_Country; }
enum enum
{ {

View File

@ -0,0 +1,77 @@
// Copyright 2009 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include <algorithm>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include "Common/ColorUtil.h"
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/StringUtil.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
static const unsigned int WII_BANNER_WIDTH = 192;
static const unsigned int WII_BANNER_HEIGHT = 64;
static const unsigned int WII_BANNER_SIZE = WII_BANNER_WIDTH * WII_BANNER_HEIGHT * 2;
static const unsigned int WII_BANNER_OFFSET = 0xA0;
std::vector<u32> IVolume::GetWiiBanner(int* width, int* height, u64 title_id)
{
*width = 0;
*height = 0;
std::string file_name = StringFromFormat("%s/title/%08x/%08x/data/banner.bin",
File::GetUserPath(D_WIIROOT_IDX).c_str(),
(u32)(title_id >> 32), (u32)title_id);
if (!File::Exists(file_name))
return std::vector<u32>();
if (File::GetSize(file_name) < WII_BANNER_OFFSET + WII_BANNER_SIZE)
return std::vector<u32>();
File::IOFile file(file_name, "rb");
if (!file.Seek(WII_BANNER_OFFSET, SEEK_SET))
return std::vector<u32>();
std::vector<u8> banner_file(WII_BANNER_SIZE);
if (!file.ReadBytes(banner_file.data(), banner_file.size()))
return std::vector<u32>();
std::vector<u32> image_buffer(WII_BANNER_WIDTH * WII_BANNER_HEIGHT);
ColorUtil::decode5A3image(image_buffer.data(), (u16*)banner_file.data(), WII_BANNER_WIDTH,
WII_BANNER_HEIGHT);
*width = WII_BANNER_WIDTH;
*height = WII_BANNER_HEIGHT;
return image_buffer;
}
std::map<Language, std::string> IVolume::ReadWiiNames(const std::vector<u8>& data)
{
std::map<Language, std::string> names;
for (size_t i = 0; i < NUMBER_OF_LANGUAGES; ++i)
{
size_t name_start = NAME_BYTES_LENGTH * i;
size_t name_end = name_start + NAME_BYTES_LENGTH;
if (data.size() >= name_end)
{
u16* temp = (u16*)(data.data() + name_start);
std::wstring out_temp(NAME_STRING_LENGTH, '\0');
std::transform(temp, temp + out_temp.size(), out_temp.begin(), (u16(&)(u16))Common::swap16);
out_temp.erase(std::find(out_temp.begin(), out_temp.end(), 0x00), out_temp.end());
std::string name = UTF16ToUTF8(out_temp);
if (!name.empty())
names[static_cast<Language>(i)] = name;
}
}
return names;
}
}

View File

@ -12,59 +12,15 @@
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "DiscIO/Blob.h" #include "DiscIO/Enums.h"
namespace DiscIO namespace DiscIO
{ {
enum class BlobType;
class IVolume class IVolume
{ {
public: 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() {} IVolume() {}
virtual ~IVolume() {} virtual ~IVolume() {}
// decrypt parameter must be false if not reading a Wii disc // decrypt parameter must be false if not reading a Wii disc
@ -85,36 +41,21 @@ public:
virtual std::string GetMakerID() const = 0; virtual std::string GetMakerID() const = 0;
virtual u16 GetRevision() const = 0; virtual u16 GetRevision() const = 0;
virtual std::string GetInternalName() const = 0; virtual std::string GetInternalName() const = 0;
virtual std::map<ELanguage, std::string> GetShortNames() const virtual std::map<Language, std::string> GetShortNames() const { return {{}}; }
{ virtual std::map<Language, std::string> GetLongNames() const { return {{}}; }
return std::map<ELanguage, std::string>(); virtual std::map<Language, std::string> GetShortMakers() const { return {{}}; }
} virtual std::map<Language, std::string> GetLongMakers() const { return {{}}; }
virtual std::map<ELanguage, std::string> GetLongNames() const virtual std::map<Language, std::string> GetDescriptions() const { return {{}}; }
{
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::vector<u32> GetBanner(int* width, int* height) const = 0; virtual std::vector<u32> GetBanner(int* width, int* height) const = 0;
virtual u64 GetFSTSize() const = 0; virtual u64 GetFSTSize() const = 0;
virtual std::string GetApploaderDate() const = 0; virtual std::string GetApploaderDate() const = 0;
// 0 is the first disc, 1 is the second disc // 0 is the first disc, 1 is the second disc
virtual u8 GetDiscNumber() const { return 0; } virtual u8 GetDiscNumber() const { return 0; }
virtual EPlatform GetVolumeType() const = 0; virtual Platform GetVolumeType() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; } virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckIntegrity() const { return false; } virtual bool CheckIntegrity() const { return false; }
virtual bool ChangePartition(u64 offset) { return false; } virtual bool ChangePartition(u64 offset) { return false; }
virtual ECountry GetCountry() const = 0; virtual Country GetCountry() const = 0;
virtual BlobType GetBlobType() const = 0; virtual BlobType GetBlobType() const = 0;
// Size of virtual disc (not always accurate) // Size of virtual disc (not always accurate)
virtual u64 GetSize() const = 0; 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... // 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 // 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) if (use_shift_jis)
return SHIFTJISToUTF8(string); return SHIFTJISToUTF8(string);
@ -140,7 +82,7 @@ protected:
return CP1252ToUTF8(string); 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 NUMBER_OF_LANGUAGES = 10;
static const size_t NAME_STRING_LENGTH = 42; 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; 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 } // namespace

View File

@ -17,6 +17,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/FileMonitor.h" #include "DiscIO/FileMonitor.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeDirectory.h" #include "DiscIO/VolumeDirectory.h"
@ -163,7 +164,7 @@ void CVolumeDirectory::SetUniqueID(const std::string& id)
memcpy(m_diskHeader.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH)); memcpy(m_diskHeader.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH));
} }
IVolume::ECountry CVolumeDirectory::GetCountry() const Country CVolumeDirectory::GetCountry() const
{ {
return CountrySwitch(m_diskHeader[3]); return CountrySwitch(m_diskHeader[3]);
} }
@ -183,12 +184,12 @@ std::string CVolumeDirectory::GetInternalName() const
return ""; return "";
} }
std::map<IVolume::ELanguage, std::string> CVolumeDirectory::GetLongNames() const std::map<Language, std::string> CVolumeDirectory::GetLongNames() const
{ {
std::string name = GetInternalName(); std::string name = GetInternalName();
if (name.empty()) if (name.empty())
return {{}}; return {{}};
return {{IVolume::LANGUAGE_UNKNOWN, name}}; return {{Language::LANGUAGE_UNKNOWN, name}};
} }
std::vector<u32> CVolumeDirectory::GetBanner(int* width, int* height) const std::vector<u32> CVolumeDirectory::GetBanner(int* width, int* height) const
@ -218,9 +219,9 @@ std::string CVolumeDirectory::GetApploaderDate() const
return "VOID"; return "VOID";
} }
IVolume::EPlatform CVolumeDirectory::GetVolumeType() const Platform CVolumeDirectory::GetVolumeType() const
{ {
return m_is_wii ? WII_DISC : GAMECUBE_DISC; return m_is_wii ? Platform::WII_DISC : Platform::GAMECUBE_DISC;
} }
BlobType CVolumeDirectory::GetBlobType() const BlobType CVolumeDirectory::GetBlobType() const

View File

@ -10,7 +10,6 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
namespace File namespace File
@ -24,6 +23,11 @@ struct FSTEntry;
namespace DiscIO namespace DiscIO
{ {
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
class CVolumeDirectory : public IVolume class CVolumeDirectory : public IVolume
{ {
public: public:
@ -43,16 +47,16 @@ public:
u16 GetRevision() const override { return 0; } u16 GetRevision() const override { return 0; }
std::string GetInternalName() const override; std::string GetInternalName() const override;
std::map<IVolume::ELanguage, std::string> GetLongNames() const override; std::map<Language, std::string> GetLongNames() const override;
std::vector<u32> GetBanner(int* width, int* height) const override; std::vector<u32> GetBanner(int* width, int* height) const override;
void SetName(const std::string&); void SetName(const std::string&);
u64 GetFSTSize() const override; u64 GetFSTSize() const override;
std::string GetApploaderDate() const override; std::string GetApploaderDate() const override;
EPlatform GetVolumeType() const override; Platform GetVolumeType() const override;
ECountry GetCountry() const override; Country GetCountry() const override;
BlobType GetBlobType() const override; BlobType GetBlobType() const override;
u64 GetSize() const override; u64 GetSize() const override;

View File

@ -15,6 +15,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/FileMonitor.h" #include "DiscIO/FileMonitor.h"
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
@ -60,10 +61,10 @@ std::string CVolumeGC::GetUniqueID() const
return DecodeString(ID); return DecodeString(ID);
} }
IVolume::ECountry CVolumeGC::GetCountry() const Country CVolumeGC::GetCountry() const
{ {
if (!m_pReader) if (!m_pReader)
return COUNTRY_UNKNOWN; return Country::COUNTRY_UNKNOWN;
u8 country_code; u8 country_code;
m_pReader->Read(3, 1, &country_code); m_pReader->Read(3, 1, &country_code);
@ -104,31 +105,31 @@ std::string CVolumeGC::GetInternalName() const
return ""; return "";
} }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetShortNames() const std::map<Language, std::string> CVolumeGC::GetShortNames() const
{ {
LoadBannerFile(); LoadBannerFile();
return m_short_names; return m_short_names;
} }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetLongNames() const std::map<Language, std::string> CVolumeGC::GetLongNames() const
{ {
LoadBannerFile(); LoadBannerFile();
return m_long_names; return m_long_names;
} }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetShortMakers() const std::map<Language, std::string> CVolumeGC::GetShortMakers() const
{ {
LoadBannerFile(); LoadBannerFile();
return m_short_makers; return m_short_makers;
} }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetLongMakers() const std::map<Language, std::string> CVolumeGC::GetLongMakers() const
{ {
LoadBannerFile(); LoadBannerFile();
return m_long_makers; return m_long_makers;
} }
std::map<IVolume::ELanguage, std::string> CVolumeGC::GetDescriptions() const std::map<Language, std::string> CVolumeGC::GetDescriptions() const
{ {
LoadBannerFile(); LoadBannerFile();
return m_descriptions; return m_descriptions;
@ -194,9 +195,9 @@ u8 CVolumeGC::GetDiscNumber() const
return disc_number; return disc_number;
} }
IVolume::EPlatform CVolumeGC::GetVolumeType() const Platform CVolumeGC::GetVolumeType() const
{ {
return GAMECUBE_DISC; return Platform::GAMECUBE_DISC;
} }
void CVolumeGC::LoadBannerFile() const void CVolumeGC::LoadBannerFile() const
@ -241,18 +242,18 @@ void CVolumeGC::LoadBannerFile() const
void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bnr1) const
{ {
u32 number_of_languages = 0; u32 number_of_languages = 0;
ELanguage start_language = LANGUAGE_UNKNOWN; Language start_language = Language::LANGUAGE_UNKNOWN;
bool is_japanese = GetCountry() == ECountry::COUNTRY_JAPAN;
if (is_bnr1) // NTSC if (is_bnr1) // NTSC
{ {
bool is_japanese = GetCountry() == Country::COUNTRY_JAPAN;
number_of_languages = 1; number_of_languages = 1;
start_language = is_japanese ? ELanguage::LANGUAGE_JAPANESE : ELanguage::LANGUAGE_ENGLISH; start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH;
} }
else // PAL else // PAL
{ {
number_of_languages = 6; number_of_languages = 6;
start_language = ELanguage::LANGUAGE_ENGLISH; start_language = Language::LANGUAGE_ENGLISH;
} }
m_image_width = GC_BANNER_WIDTH; m_image_width = GC_BANNER_WIDTH;
@ -264,7 +265,7 @@ void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bn
for (u32 i = 0; i < number_of_languages; ++i) for (u32 i = 0; i < number_of_languages; ++i)
{ {
const GCBannerInformation& info = banner_file.information[i]; const GCBannerInformation& info = banner_file.information[i];
ELanguage language = static_cast<ELanguage>(start_language + i); Language language = static_cast<Language>(static_cast<int>(start_language) + i);
std::string description = DecodeString(info.description); std::string description = DecodeString(info.description);
if (!description.empty()) if (!description.empty())

View File

@ -10,13 +10,17 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
// --- this volume type is used for GC disc images --- // --- this volume type is used for GC disc images ---
namespace DiscIO namespace DiscIO
{ {
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
class CVolumeGC : public IVolume class CVolumeGC : public IVolume
{ {
public: public:
@ -27,18 +31,18 @@ public:
std::string GetMakerID() const override; std::string GetMakerID() const override;
u16 GetRevision() const override; u16 GetRevision() const override;
std::string GetInternalName() const override; std::string GetInternalName() const override;
std::map<ELanguage, std::string> GetShortNames() const override; std::map<Language, std::string> GetShortNames() const override;
std::map<ELanguage, std::string> GetLongNames() const override; std::map<Language, std::string> GetLongNames() const override;
std::map<ELanguage, std::string> GetShortMakers() const override; std::map<Language, std::string> GetShortMakers() const override;
std::map<ELanguage, std::string> GetLongMakers() const override; std::map<Language, std::string> GetLongMakers() const override;
std::map<ELanguage, std::string> GetDescriptions() const override; std::map<Language, std::string> GetDescriptions() const override;
std::vector<u32> GetBanner(int* width, int* height) const override; std::vector<u32> GetBanner(int* width, int* height) const override;
u64 GetFSTSize() const override; u64 GetFSTSize() const override;
std::string GetApploaderDate() const override; std::string GetApploaderDate() const override;
u8 GetDiscNumber() const override; u8 GetDiscNumber() const override;
EPlatform GetVolumeType() const override; Platform GetVolumeType() const override;
ECountry GetCountry() const override; Country GetCountry() const override;
BlobType GetBlobType() const override; BlobType GetBlobType() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;
@ -73,12 +77,12 @@ private:
static const size_t BNR1_SIZE = sizeof(GCBanner) - sizeof(GCBannerInformation) * 5; static const size_t BNR1_SIZE = sizeof(GCBanner) - sizeof(GCBannerInformation) * 5;
static const size_t BNR2_SIZE = sizeof(GCBanner); static const size_t BNR2_SIZE = sizeof(GCBanner);
mutable std::map<ELanguage, std::string> m_short_names; mutable std::map<Language, std::string> m_short_names;
mutable std::map<ELanguage, std::string> m_long_names; mutable std::map<Language, std::string> m_long_names;
mutable std::map<ELanguage, std::string> m_short_makers; mutable std::map<Language, std::string> m_short_makers;
mutable std::map<ELanguage, std::string> m_long_makers; mutable std::map<Language, std::string> m_long_makers;
mutable std::map<ELanguage, std::string> m_descriptions; mutable std::map<Language, std::string> m_descriptions;
mutable bool m_banner_loaded = false; mutable bool m_banner_loaded = false;
mutable std::vector<u32> m_image_buffer; mutable std::vector<u32> m_image_buffer;

View File

@ -16,6 +16,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeWad.h" #include "DiscIO/VolumeWad.h"
@ -54,10 +55,10 @@ bool CVolumeWAD::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt) cons
return m_pReader->Read(_Offset, _Length, _pBuffer); return m_pReader->Read(_Offset, _Length, _pBuffer);
} }
IVolume::ECountry CVolumeWAD::GetCountry() const Country CVolumeWAD::GetCountry() const
{ {
if (!m_pReader) if (!m_pReader)
return COUNTRY_UNKNOWN; return Country::COUNTRY_UNKNOWN;
// read the last digit of the titleID in the ticket // read the last digit of the titleID in the ticket
u8 country_code; u8 country_code;
@ -114,16 +115,16 @@ u16 CVolumeWAD::GetRevision() const
return Common::swap16(revision); return Common::swap16(revision);
} }
IVolume::EPlatform CVolumeWAD::GetVolumeType() const Platform CVolumeWAD::GetVolumeType() const
{ {
return WII_WAD; return Platform::WII_WAD;
} }
std::map<IVolume::ELanguage, std::string> CVolumeWAD::GetLongNames() const std::map<Language, std::string> CVolumeWAD::GetLongNames() const
{ {
std::vector<u8> name_data(NAMES_TOTAL_BYTES); std::vector<u8> name_data(NAMES_TOTAL_BYTES);
if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data())) if (!Read(m_opening_bnr_offset + 0x9C, NAMES_TOTAL_BYTES, name_data.data()))
return std::map<IVolume::ELanguage, std::string>(); return std::map<Language, std::string>();
return ReadWiiNames(name_data); return ReadWiiNames(name_data);
} }

View File

@ -10,7 +10,6 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
// --- this volume type is used for Wad files --- // --- this volume type is used for Wad files ---
@ -19,6 +18,11 @@
namespace DiscIO namespace DiscIO
{ {
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
class CVolumeWAD : public IVolume class CVolumeWAD : public IVolume
{ {
public: public:
@ -30,12 +34,12 @@ public:
std::string GetMakerID() const override; std::string GetMakerID() const override;
u16 GetRevision() const override; u16 GetRevision() const override;
std::string GetInternalName() const override { return ""; } std::string GetInternalName() const override { return ""; }
std::map<IVolume::ELanguage, std::string> GetLongNames() const override; std::map<Language, std::string> GetLongNames() const override;
std::vector<u32> GetBanner(int* width, int* height) const override; std::vector<u32> GetBanner(int* width, int* height) const override;
u64 GetFSTSize() const override { return 0; } u64 GetFSTSize() const override { return 0; }
std::string GetApploaderDate() const override { return ""; } std::string GetApploaderDate() const override { return ""; }
EPlatform GetVolumeType() const override; Platform GetVolumeType() const override;
ECountry GetCountry() const override; Country GetCountry() const override;
BlobType GetBlobType() const override; BlobType GetBlobType() const override;
u64 GetSize() const override; u64 GetSize() const override;

View File

@ -17,6 +17,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/FileMonitor.h" #include "DiscIO/FileMonitor.h"
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
@ -152,53 +153,49 @@ std::string CVolumeWiiCrypted::GetUniqueID() const
return DecodeString(ID); return DecodeString(ID);
} }
IVolume::ECountry CVolumeWiiCrypted::GetCountry() const Country CVolumeWiiCrypted::GetCountry() const
{ {
if (!m_pReader) if (!m_pReader)
return COUNTRY_UNKNOWN; return Country::COUNTRY_UNKNOWN;
u8 country_byte; u8 country_byte;
if (!m_pReader->Read(3, 1, &country_byte)) if (!m_pReader->Read(3, 1, &country_byte))
{ return Country::COUNTRY_UNKNOWN;
return COUNTRY_UNKNOWN;
}
IVolume::ECountry country_value = CountrySwitch(country_byte); Country country_value = CountrySwitch(country_byte);
u32 region_code; u32 region_code;
if (!ReadSwapped(0x4E000, &region_code, false)) if (!ReadSwapped(0x4E000, &region_code, false))
{
return country_value; return country_value;
}
switch (region_code) switch (region_code)
{ {
case 0: case 0:
switch (country_value) switch (country_value)
{ {
case IVolume::COUNTRY_TAIWAN: case Country::COUNTRY_TAIWAN:
return IVolume::COUNTRY_TAIWAN; return Country::COUNTRY_TAIWAN;
default: default:
return IVolume::COUNTRY_JAPAN; return Country::COUNTRY_JAPAN;
} }
case 1: case 1:
return IVolume::COUNTRY_USA; return Country::COUNTRY_USA;
case 2: case 2:
switch (country_value) switch (country_value)
{ {
case IVolume::COUNTRY_FRANCE: case Country::COUNTRY_FRANCE:
case IVolume::COUNTRY_GERMANY: case Country::COUNTRY_GERMANY:
case IVolume::COUNTRY_ITALY: case Country::COUNTRY_ITALY:
case IVolume::COUNTRY_NETHERLANDS: case Country::COUNTRY_NETHERLANDS:
case IVolume::COUNTRY_RUSSIA: case Country::COUNTRY_RUSSIA:
case IVolume::COUNTRY_SPAIN: case Country::COUNTRY_SPAIN:
case IVolume::COUNTRY_AUSTRALIA: case Country::COUNTRY_AUSTRALIA:
return country_value; return country_value;
default: default:
return IVolume::COUNTRY_EUROPE; return Country::COUNTRY_EUROPE;
} }
case 4: case 4:
return IVolume::COUNTRY_KOREA; return Country::COUNTRY_KOREA;
default: default:
return country_value; return country_value;
} }
@ -238,12 +235,12 @@ std::string CVolumeWiiCrypted::GetInternalName() const
return ""; return "";
} }
std::map<IVolume::ELanguage, std::string> CVolumeWiiCrypted::GetLongNames() const std::map<Language, std::string> CVolumeWiiCrypted::GetLongNames() const
{ {
std::unique_ptr<IFileSystem> file_system(CreateFileSystem(this)); std::unique_ptr<IFileSystem> file_system(CreateFileSystem(this));
std::vector<u8> opening_bnr(NAMES_TOTAL_BYTES); std::vector<u8> opening_bnr(NAMES_TOTAL_BYTES);
opening_bnr.resize( size_t size = file_system->ReadFile("opening.bnr", opening_bnr.data(), opening_bnr.size(), 0x5C);
file_system->ReadFile("opening.bnr", opening_bnr.data(), opening_bnr.size(), 0x5C)); opening_bnr.resize(size);
return ReadWiiNames(opening_bnr); return ReadWiiNames(opening_bnr);
} }
@ -285,9 +282,9 @@ std::string CVolumeWiiCrypted::GetApploaderDate() const
return DecodeString(date); return DecodeString(date);
} }
IVolume::EPlatform CVolumeWiiCrypted::GetVolumeType() const Platform CVolumeWiiCrypted::GetVolumeType() const
{ {
return WII_DISC; return Platform::WII_DISC;
} }
u8 CVolumeWiiCrypted::GetDiscNumber() const u8 CVolumeWiiCrypted::GetDiscNumber() const

View File

@ -11,13 +11,17 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
// --- this volume type is used for encrypted Wii images --- // --- this volume type is used for encrypted Wii images ---
namespace DiscIO namespace DiscIO
{ {
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
class CVolumeWiiCrypted : public IVolume class CVolumeWiiCrypted : public IVolume
{ {
public: public:
@ -31,18 +35,18 @@ public:
std::string GetMakerID() const override; std::string GetMakerID() const override;
u16 GetRevision() const override; u16 GetRevision() const override;
std::string GetInternalName() const override; std::string GetInternalName() const override;
std::map<IVolume::ELanguage, std::string> GetLongNames() const override; std::map<Language, std::string> GetLongNames() const override;
std::vector<u32> GetBanner(int* width, int* height) const override; std::vector<u32> GetBanner(int* width, int* height) const override;
u64 GetFSTSize() const override; u64 GetFSTSize() const override;
std::string GetApploaderDate() const override; std::string GetApploaderDate() const override;
u8 GetDiscNumber() const override; u8 GetDiscNumber() const override;
EPlatform GetVolumeType() const override; Platform GetVolumeType() const override;
bool SupportsIntegrityCheck() const override { return true; } bool SupportsIntegrityCheck() const override { return true; }
bool CheckIntegrity() const override; bool CheckIntegrity() const override;
bool ChangePartition(u64 offset) override; bool ChangePartition(u64 offset) override;
ECountry GetCountry() const override; Country GetCountry() const override;
BlobType GetBlobType() const override; BlobType GetBlobType() const override;
u64 GetSize() const override; u64 GetSize() const override;
u64 GetRawSize() const override; u64 GetRawSize() const override;

View File

@ -13,6 +13,8 @@
#include <QPushButton> #include <QPushButton>
#include <QTextEdit> #include <QTextEdit>
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DolphinQt2/Config/InfoWidget.h" #include "DolphinQt2/Config/InfoWidget.h"
InfoWidget::InfoWidget(const GameFile& game) : m_game(game) InfoWidget::InfoWidget(const GameFile& game) : m_game(game)
@ -71,7 +73,7 @@ QGroupBox* InfoWidget::CreateBannerDetails()
CreateLanguageSelector(); CreateLanguageSelector();
layout->addRow(tr("Show Language:"), m_language_selector); layout->addRow(tr("Show Language:"), m_language_selector);
if (m_game.GetPlatformID() == DiscIO::IVolume::GAMECUBE_DISC) if (m_game.GetPlatformID() == DiscIO::Platform::GAMECUBE_DISC)
{ {
layout->addRow(tr("Short Name:"), m_short_name); layout->addRow(tr("Short Name:"), m_short_name);
layout->addRow(tr("Short Maker:"), m_short_maker); layout->addRow(tr("Short Maker:"), m_short_maker);
@ -79,7 +81,7 @@ QGroupBox* InfoWidget::CreateBannerDetails()
layout->addRow(tr("Long Maker:"), m_long_maker); layout->addRow(tr("Long Maker:"), m_long_maker);
layout->addRow(tr("Description:"), m_description); layout->addRow(tr("Description:"), m_description);
} }
else if (m_game.GetPlatformID() == DiscIO::IVolume::WII_DISC) else if (m_game.GetPlatformID() == DiscIO::Platform::WII_DISC)
{ {
layout->addRow(tr("Name:"), m_long_name); layout->addRow(tr("Name:"), m_long_name);
} }
@ -123,11 +125,11 @@ QLineEdit* InfoWidget::CreateValueDisplay(const QString& value)
void InfoWidget::CreateLanguageSelector() void InfoWidget::CreateLanguageSelector()
{ {
m_language_selector = new QComboBox(); m_language_selector = new QComboBox();
QList<DiscIO::IVolume::ELanguage> languages = m_game.GetAvailableLanguages(); QList<DiscIO::Language> languages = m_game.GetAvailableLanguages();
for (int i = 0; i < languages.count(); i++) for (int i = 0; i < languages.count(); i++)
{ {
DiscIO::IVolume::ELanguage language = languages.at(i); DiscIO::Language language = languages.at(i);
m_language_selector->addItem(m_game.GetLanguage(language), language); m_language_selector->addItem(m_game.GetLanguage(language), static_cast<int>(language));
} }
if (m_language_selector->count() == 1) if (m_language_selector->count() == 1)
m_language_selector->setDisabled(true); m_language_selector->setDisabled(true);
@ -137,8 +139,8 @@ void InfoWidget::CreateLanguageSelector()
void InfoWidget::ChangeLanguage() void InfoWidget::ChangeLanguage()
{ {
DiscIO::IVolume::ELanguage language = DiscIO::Language language =
static_cast<DiscIO::IVolume::ELanguage>(m_language_selector->currentData().toInt()); static_cast<DiscIO::Language>(m_language_selector->currentData().toInt());
m_short_name->setText(m_game.GetShortName(language)); m_short_name->setText(m_game.GetShortName(language));
m_short_maker->setText(m_game.GetShortMaker(language)); m_short_maker->setText(m_game.GetShortMaker(language));
m_long_name->setText(m_game.GetLongName(language)); m_long_name->setText(m_game.GetLongName(language));

View File

@ -10,6 +10,9 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
#include "DolphinQt2/GameList/GameFile.h" #include "DolphinQt2/GameList/GameFile.h"
#include "DolphinQt2/Resources.h" #include "DolphinQt2/Resources.h"
@ -18,15 +21,15 @@
static const int CACHE_VERSION = 13; // Last changed in PR #3261 static const int CACHE_VERSION = 13; // Last changed in PR #3261
static const int DATASTREAM_VERSION = QDataStream::Qt_5_5; static const int DATASTREAM_VERSION = QDataStream::Qt_5_5;
QList<DiscIO::IVolume::ELanguage> GameFile::GetAvailableLanguages() const QList<DiscIO::Language> GameFile::GetAvailableLanguages() const
{ {
return m_long_names.keys(); return m_long_names.keys();
} }
static QMap<DiscIO::IVolume::ELanguage, QString> static QMap<DiscIO::Language, QString>
ConvertLanguageMap(const std::map<DiscIO::IVolume::ELanguage, std::string>& map) ConvertLanguageMap(const std::map<DiscIO::Language, std::string>& map)
{ {
QMap<DiscIO::IVolume::ELanguage, QString> result; QMap<DiscIO::Language, QString> result;
for (auto entry : map) for (auto entry : map)
result.insert(entry.first, QString::fromStdString(entry.second).trimmed()); result.insert(entry.first, QString::fromStdString(entry.second).trimmed());
return result; return result;
@ -169,9 +172,9 @@ bool GameFile::TryLoadElfDol()
return false; return false;
m_revision = 0; m_revision = 0;
m_long_names[DiscIO::IVolume::LANGUAGE_ENGLISH] = m_file_name; m_long_names[DiscIO::Language::LANGUAGE_ENGLISH] = m_file_name;
m_platform = DiscIO::IVolume::ELF_DOL; m_platform = DiscIO::Platform::ELF_DOL;
m_country = DiscIO::IVolume::COUNTRY_UNKNOWN; m_country = DiscIO::Country::COUNTRY_UNKNOWN;
m_blob_type = DiscIO::BlobType::DIRECTORY; m_blob_type = DiscIO::BlobType::DIRECTORY;
m_raw_size = m_size; m_raw_size = m_size;
m_banner = Resources::GetMisc(Resources::BANNER_MISSING); m_banner = Resources::GetMisc(Resources::BANNER_MISSING);
@ -185,14 +188,14 @@ void GameFile::SaveCache()
// TODO // TODO
} }
QString GameFile::GetBannerString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const QString GameFile::GetBannerString(const QMap<DiscIO::Language, QString>& m) const
{ {
// Try the settings language, then English, then just pick one. // Try the settings language, then English, then just pick one.
if (m.isEmpty()) if (m.isEmpty())
return QString(); return QString();
bool wii = m_platform != DiscIO::IVolume::GAMECUBE_DISC; bool wii = m_platform != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage current_lang; DiscIO::Language current_lang;
if (wii) if (wii)
current_lang = Settings().GetWiiSystemLanguage(); current_lang = Settings().GetWiiSystemLanguage();
else else
@ -200,8 +203,8 @@ QString GameFile::GetBannerString(const QMap<DiscIO::IVolume::ELanguage, QString
if (m.contains(current_lang)) if (m.contains(current_lang))
return m[current_lang]; return m[current_lang];
if (m.contains(DiscIO::IVolume::LANGUAGE_ENGLISH)) if (m.contains(DiscIO::Language::LANGUAGE_ENGLISH))
return m[DiscIO::IVolume::LANGUAGE_ENGLISH]; return m[DiscIO::Language::LANGUAGE_ENGLISH];
return m.first(); return m.first();
} }
@ -209,13 +212,13 @@ QString GameFile::GetPlatform() const
{ {
switch (m_platform) switch (m_platform)
{ {
case DiscIO::IVolume::GAMECUBE_DISC: case DiscIO::Platform::GAMECUBE_DISC:
return QObject::tr("GameCube"); return QObject::tr("GameCube");
case DiscIO::IVolume::WII_DISC: case DiscIO::Platform::WII_DISC:
return QObject::tr("Wii"); return QObject::tr("Wii");
case DiscIO::IVolume::WII_WAD: case DiscIO::Platform::WII_WAD:
return QObject::tr("Wii Channel"); return QObject::tr("Wii Channel");
case DiscIO::IVolume::ELF_DOL: case DiscIO::Platform::ELF_DOL:
return QObject::tr("ELF/DOL"); return QObject::tr("ELF/DOL");
default: default:
return QObject::tr("Unknown"); return QObject::tr("Unknown");
@ -226,60 +229,60 @@ QString GameFile::GetCountry() const
{ {
switch (m_country) switch (m_country)
{ {
case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::Country::COUNTRY_EUROPE:
return QObject::tr("Europe"); return QObject::tr("Europe");
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::Country::COUNTRY_JAPAN:
return QObject::tr("Japan"); return QObject::tr("Japan");
case DiscIO::IVolume::COUNTRY_USA: case DiscIO::Country::COUNTRY_USA:
return QObject::tr("USA"); return QObject::tr("USA");
case DiscIO::IVolume::COUNTRY_AUSTRALIA: case DiscIO::Country::COUNTRY_AUSTRALIA:
return QObject::tr("Australia"); return QObject::tr("Australia");
case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::Country::COUNTRY_FRANCE:
return QObject::tr("France"); return QObject::tr("France");
case DiscIO::IVolume::COUNTRY_GERMANY: case DiscIO::Country::COUNTRY_GERMANY:
return QObject::tr("Germany"); return QObject::tr("Germany");
case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::Country::COUNTRY_ITALY:
return QObject::tr("Italy"); return QObject::tr("Italy");
case DiscIO::IVolume::COUNTRY_KOREA: case DiscIO::Country::COUNTRY_KOREA:
return QObject::tr("Korea"); return QObject::tr("Korea");
case DiscIO::IVolume::COUNTRY_NETHERLANDS: case DiscIO::Country::COUNTRY_NETHERLANDS:
return QObject::tr("Netherlands"); return QObject::tr("Netherlands");
case DiscIO::IVolume::COUNTRY_RUSSIA: case DiscIO::Country::COUNTRY_RUSSIA:
return QObject::tr("Russia"); return QObject::tr("Russia");
case DiscIO::IVolume::COUNTRY_SPAIN: case DiscIO::Country::COUNTRY_SPAIN:
return QObject::tr("Spain"); return QObject::tr("Spain");
case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::Country::COUNTRY_TAIWAN:
return QObject::tr("Taiwan"); return QObject::tr("Taiwan");
case DiscIO::IVolume::COUNTRY_WORLD: case DiscIO::Country::COUNTRY_WORLD:
return QObject::tr("World"); return QObject::tr("World");
default: default:
return QObject::tr("Unknown"); return QObject::tr("Unknown");
} }
} }
QString GameFile::GetLanguage(DiscIO::IVolume::ELanguage lang) const QString GameFile::GetLanguage(DiscIO::Language lang) const
{ {
switch (lang) switch (lang)
{ {
case DiscIO::IVolume::LANGUAGE_JAPANESE: case DiscIO::Language::LANGUAGE_JAPANESE:
return QObject::tr("Japanese"); return QObject::tr("Japanese");
case DiscIO::IVolume::LANGUAGE_ENGLISH: case DiscIO::Language::LANGUAGE_ENGLISH:
return QObject::tr("English"); return QObject::tr("English");
case DiscIO::IVolume::LANGUAGE_GERMAN: case DiscIO::Language::LANGUAGE_GERMAN:
return QObject::tr("German"); return QObject::tr("German");
case DiscIO::IVolume::LANGUAGE_FRENCH: case DiscIO::Language::LANGUAGE_FRENCH:
return QObject::tr("French"); return QObject::tr("French");
case DiscIO::IVolume::LANGUAGE_SPANISH: case DiscIO::Language::LANGUAGE_SPANISH:
return QObject::tr("Spanish"); return QObject::tr("Spanish");
case DiscIO::IVolume::LANGUAGE_ITALIAN: case DiscIO::Language::LANGUAGE_ITALIAN:
return QObject::tr("Italian"); return QObject::tr("Italian");
case DiscIO::IVolume::LANGUAGE_DUTCH: case DiscIO::Language::LANGUAGE_DUTCH:
return QObject::tr("Dutch"); return QObject::tr("Dutch");
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE: case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
return QObject::tr("Simplified Chinese"); return QObject::tr("Simplified Chinese");
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE: case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
return QObject::tr("Traditional Chinese"); return QObject::tr("Traditional Chinese");
case DiscIO::IVolume::LANGUAGE_KOREAN: case DiscIO::Language::LANGUAGE_KOREAN:
return QObject::tr("Korean"); return QObject::tr("Korean");
default: default:
return QObject::tr("Unknown"); return QObject::tr("Unknown");

View File

@ -9,7 +9,16 @@
#include <QPixmap> #include <QPixmap>
#include <QString> #include <QString>
#include "DiscIO/Volume.h" #include "Common/CommonTypes.h"
namespace DiscIO
{
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
class IVolume;
}
// TODO cache // TODO cache
class GameFile final class GameFile final
@ -36,26 +45,26 @@ public:
QString GetIssues() const { return m_issues; } QString GetIssues() const { return m_issues; }
int GetRating() const { return m_rating; } int GetRating() const { return m_rating; }
QString GetApploaderDate() const { return m_apploader_date; } QString GetApploaderDate() const { return m_apploader_date; }
DiscIO::IVolume::EPlatform GetPlatformID() const { return m_platform; } DiscIO::Platform GetPlatformID() const { return m_platform; }
QString GetPlatform() const; QString GetPlatform() const;
DiscIO::IVolume::ECountry GetCountryID() const { return m_country; } DiscIO::Country GetCountryID() const { return m_country; }
QString GetCountry() const; QString GetCountry() const;
DiscIO::BlobType GetBlobType() const { return m_blob_type; } DiscIO::BlobType GetBlobType() const { return m_blob_type; }
// Banner details // Banner details
QString GetLanguage(DiscIO::IVolume::ELanguage lang) const; QString GetLanguage(DiscIO::Language lang) const;
QList<DiscIO::IVolume::ELanguage> GetAvailableLanguages() const; QList<DiscIO::Language> GetAvailableLanguages() const;
QString GetShortName() const { return GetBannerString(m_short_names); } QString GetShortName() const { return GetBannerString(m_short_names); }
QString GetShortMaker() const { return GetBannerString(m_short_makers); } QString GetShortMaker() const { return GetBannerString(m_short_makers); }
QString GetLongName() const { return GetBannerString(m_long_names); } QString GetLongName() const { return GetBannerString(m_long_names); }
QString GetLongMaker() const { return GetBannerString(m_long_makers); } QString GetLongMaker() const { return GetBannerString(m_long_makers); }
QString GetDescription() const { return GetBannerString(m_descriptions); } QString GetDescription() const { return GetBannerString(m_descriptions); }
QString GetShortName(DiscIO::IVolume::ELanguage lang) const { return m_short_names[lang]; } QString GetShortName(DiscIO::Language lang) const { return m_short_names[lang]; }
QString GetShortMaker(DiscIO::IVolume::ELanguage lang) const { return m_short_makers[lang]; } QString GetShortMaker(DiscIO::Language lang) const { return m_short_makers[lang]; }
QString GetLongName(DiscIO::IVolume::ELanguage lang) const { return m_long_names[lang]; } QString GetLongName(DiscIO::Language lang) const { return m_long_names[lang]; }
QString GetLongMaker(DiscIO::IVolume::ELanguage lang) const { return m_long_makers[lang]; } QString GetLongMaker(DiscIO::Language lang) const { return m_long_makers[lang]; }
QString GetDescription(DiscIO::IVolume::ELanguage lang) const { return m_descriptions[lang]; } QString GetDescription(DiscIO::Language lang) const { return m_descriptions[lang]; }
private: private:
QString GetBannerString(const QMap<DiscIO::IVolume::ELanguage, QString>& m) const; QString GetBannerString(const QMap<DiscIO::Language, QString>& m) const;
QString GetCacheFileName() const; QString GetCacheFileName() const;
void ReadBanner(const DiscIO::IVolume& volume); void ReadBanner(const DiscIO::IVolume& volume);
@ -80,15 +89,15 @@ private:
QString m_maker_id; QString m_maker_id;
u16 m_revision = 0; u16 m_revision = 0;
QString m_internal_name; QString m_internal_name;
QMap<DiscIO::IVolume::ELanguage, QString> m_short_names; QMap<DiscIO::Language, QString> m_short_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_long_names; QMap<DiscIO::Language, QString> m_long_names;
QMap<DiscIO::IVolume::ELanguage, QString> m_short_makers; QMap<DiscIO::Language, QString> m_short_makers;
QMap<DiscIO::IVolume::ELanguage, QString> m_long_makers; QMap<DiscIO::Language, QString> m_long_makers;
QMap<DiscIO::IVolume::ELanguage, QString> m_descriptions; QMap<DiscIO::Language, QString> m_descriptions;
QString m_company; QString m_company;
u8 m_disc_number = 0; u8 m_disc_number = 0;
DiscIO::IVolume::EPlatform m_platform; DiscIO::Platform m_platform;
DiscIO::IVolume::ECountry m_country; DiscIO::Country m_country;
DiscIO::BlobType m_blob_type; DiscIO::BlobType m_blob_type;
u64 m_raw_size = 0; u64 m_raw_size = 0;
QPixmap m_banner; QPixmap m_banner;

View File

@ -8,6 +8,8 @@
#include <QMenu> #include <QMenu>
#include <QUrl> #include <QUrl>
#include "DiscIO/Enums.h"
#include "DolphinQt2/Config/PropertiesDialog.h" #include "DolphinQt2/Config/PropertiesDialog.h"
#include "DolphinQt2/GameList/GameList.h" #include "DolphinQt2/GameList/GameList.h"
#include "DolphinQt2/GameList/ListProxyModel.h" #include "DolphinQt2/GameList/ListProxyModel.h"
@ -104,8 +106,8 @@ void GameList::MakeListView()
void GameList::ShowContextMenu(const QPoint&) void GameList::ShowContextMenu(const QPoint&)
{ {
QMenu* menu = new QMenu(this); QMenu* menu = new QMenu(this);
DiscIO::IVolume::EPlatform platform = GameFile(GetSelectedGame()).GetPlatformID(); DiscIO::Platform platform = GameFile(GetSelectedGame()).GetPlatformID();
if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC) if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
{ {
menu->addAction(tr("Properties"), this, SLOT(OpenProperties())); menu->addAction(tr("Properties"), this, SLOT(OpenProperties()));
menu->addAction(tr("Open Wiki Page"), this, SLOT(OpenWiki())); menu->addAction(tr("Open Wiki Page"), this, SLOT(OpenWiki()));

View File

@ -38,7 +38,7 @@ QVariant GameListModel::data(const QModelIndex& index, int role) const
case COL_SIZE: case COL_SIZE:
return game->GetFileSize(); return game->GetFileSize();
case COL_COUNTRY: case COL_COUNTRY:
return game->GetCountryID(); return static_cast<int>(game->GetCountryID());
case COL_RATING: case COL_RATING:
return game->GetRating(); return game->GetRating();
} }

View File

@ -101,12 +101,12 @@ void Settings::SetWiiNAND(const QString& path)
SConfig::GetInstance().SaveSettings(); SConfig::GetInstance().SaveSettings();
} }
DiscIO::IVolume::ELanguage Settings::GetWiiSystemLanguage() const DiscIO::Language Settings::GetWiiSystemLanguage() const
{ {
return SConfig::GetInstance().GetCurrentLanguage(true); return SConfig::GetInstance().GetCurrentLanguage(true);
} }
DiscIO::IVolume::ELanguage Settings::GetGCSystemLanguage() const DiscIO::Language Settings::GetGCSystemLanguage() const
{ {
return SConfig::GetInstance().GetCurrentLanguage(false); return SConfig::GetInstance().GetCurrentLanguage(false);
} }

View File

@ -6,7 +6,10 @@
#include <QSettings> #include <QSettings>
#include "DiscIO/Volume.h" namespace DiscIO
{
enum class Language;
}
// UI settings to be stored in the config directory. // UI settings to be stored in the config directory.
class Settings final : public QSettings class Settings final : public QSettings
@ -34,8 +37,8 @@ public:
void SetApploader(const QString& path); void SetApploader(const QString& path);
QString GetWiiNAND() const; QString GetWiiNAND() const;
void SetWiiNAND(const QString& path); void SetWiiNAND(const QString& path);
DiscIO::IVolume::ELanguage GetWiiSystemLanguage() const; DiscIO::Language GetWiiSystemLanguage() const;
DiscIO::IVolume::ELanguage GetGCSystemLanguage() const; DiscIO::Language GetGCSystemLanguage() const;
bool GetPreferredView() const; bool GetPreferredView() const;
void SetPreferredView(bool table); void SetPreferredView(bool table);

View File

@ -11,7 +11,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/IPC_HLE/WII_IPC_HLE.h" #include "Core/IPC_HLE/WII_IPC_HLE.h"
#include "DiscIO/Volume.h" #include "DiscIO/Enums.h"
#include "DolphinWX/Config/WiiConfigPane.h" #include "DolphinWX/Config/WiiConfigPane.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
@ -139,8 +139,8 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event) void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{ {
DiscIO::IVolume::ELanguage wii_system_lang = DiscIO::Language wii_system_lang =
(DiscIO::IVolume::ELanguage)m_system_language_choice->GetSelection(); static_cast<DiscIO::Language>(m_system_language_choice->GetSelection());
SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang); SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", wii_system_lang);
u8 country_code = GetSADRCountryCode(wii_system_lang); u8 country_code = GetSADRCountryCode(wii_system_lang);
@ -155,30 +155,30 @@ void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
// Change from IPL.LNG value to IPL.SADR country code. // Change from IPL.LNG value to IPL.SADR country code.
// http://wiibrew.org/wiki/Country_Codes // http://wiibrew.org/wiki/Country_Codes
u8 WiiConfigPane::GetSADRCountryCode(DiscIO::IVolume::ELanguage language) u8 WiiConfigPane::GetSADRCountryCode(DiscIO::Language language)
{ {
switch (language) switch (language)
{ {
case DiscIO::IVolume::LANGUAGE_JAPANESE: case DiscIO::Language::LANGUAGE_JAPANESE:
return 1; // Japan return 1; // Japan
case DiscIO::IVolume::LANGUAGE_ENGLISH: case DiscIO::Language::LANGUAGE_ENGLISH:
return 49; // USA return 49; // USA
case DiscIO::IVolume::LANGUAGE_GERMAN: case DiscIO::Language::LANGUAGE_GERMAN:
return 78; // Germany return 78; // Germany
case DiscIO::IVolume::LANGUAGE_FRENCH: case DiscIO::Language::LANGUAGE_FRENCH:
return 77; // France return 77; // France
case DiscIO::IVolume::LANGUAGE_SPANISH: case DiscIO::Language::LANGUAGE_SPANISH:
return 105; // Spain return 105; // Spain
case DiscIO::IVolume::LANGUAGE_ITALIAN: case DiscIO::Language::LANGUAGE_ITALIAN:
return 83; // Italy return 83; // Italy
case DiscIO::IVolume::LANGUAGE_DUTCH: case DiscIO::Language::LANGUAGE_DUTCH:
return 94; // Netherlands return 94; // Netherlands
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE: case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE: case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
return 157; // China return 157; // China
case DiscIO::IVolume::LANGUAGE_KOREAN: case DiscIO::Language::LANGUAGE_KOREAN:
return 136; // Korea return 136; // Korea
case DiscIO::IVolume::LANGUAGE_UNKNOWN: case DiscIO::Language::LANGUAGE_UNKNOWN:
break; break;
} }

View File

@ -7,7 +7,11 @@
#include <wx/arrstr.h> #include <wx/arrstr.h>
#include <wx/panel.h> #include <wx/panel.h>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "DiscIO/Volume.h"
namespace DiscIO
{
enum class Language;
}
class wxCheckBox; class wxCheckBox;
class wxChoice; class wxChoice;
@ -29,7 +33,7 @@ private:
void OnSystemLanguageChoiceChanged(wxCommandEvent&); void OnSystemLanguageChoiceChanged(wxCommandEvent&);
void OnAspectRatioChoiceChanged(wxCommandEvent&); void OnAspectRatioChoiceChanged(wxCommandEvent&);
static u8 GetSADRCountryCode(DiscIO::IVolume::ELanguage language); static u8 GetSADRCountryCode(DiscIO::Language language);
wxArrayString m_system_language_strings; wxArrayString m_system_language_strings;
wxArrayString m_aspect_ratio_strings; wxArrayString m_aspect_ratio_strings;

View File

@ -45,6 +45,7 @@
#include "Core/HW/WiiSaveCrypted.h" #include "Core/HW/WiiSaveCrypted.h"
#include "Core/Movie.h" #include "Core/Movie.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
#include "DolphinWX/Frame.h" #include "DolphinWX/Frame.h"
@ -179,59 +180,48 @@ CGameListCtrl::~CGameListCtrl()
ClearIsoFiles(); ClearIsoFiles();
} }
void CGameListCtrl::InitBitmaps() template <typename T>
static void InitBitmap(wxImageList* img_list, std::vector<int>* vector, T index,
const std::string& name)
{ {
wxSize size(96, 32); wxSize size(96, 32);
(*vector)[static_cast<size_t>(index)] = img_list->Add(WxUtils::LoadResourceBitmap(name, size));
}
void CGameListCtrl::InitBitmaps()
{
wxImageList* img_list = new wxImageList(96, 32); wxImageList* img_list = new wxImageList(96, 32);
AssignImageList(img_list, wxIMAGE_LIST_SMALL); AssignImageList(img_list, wxIMAGE_LIST_SMALL);
m_FlagImageIndex.resize(DiscIO::IVolume::NUMBER_OF_COUNTRIES); m_FlagImageIndex.resize(static_cast<size_t>(DiscIO::Country::NUMBER_OF_COUNTRIES));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_JAPAN] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_JAPAN, "Flag_Japan");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Japan", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_EUROPE, "Flag_Europe");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_EUROPE] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_USA, "Flag_USA");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Europe", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_AUSTRALIA, "Flag_Australia");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_USA] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_FRANCE, "Flag_France");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_USA", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_GERMANY, "Flag_Germany");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_AUSTRALIA] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_ITALY, "Flag_Italy");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Australia", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_KOREA, "Flag_Korea");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_FRANCE] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_NETHERLANDS, "Flag_Netherlands");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_France", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_RUSSIA, "Flag_Russia");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_GERMANY] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_SPAIN, "Flag_Spain");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Germany", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_TAIWAN, "Flag_Taiwan");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_ITALY] = InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_WORLD, "Flag_International");
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Italy", size)); InitBitmap(img_list, &m_FlagImageIndex, DiscIO::Country::COUNTRY_UNKNOWN, "Flag_Unknown");
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_KOREA] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Korea", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_NETHERLANDS] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Netherlands", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_RUSSIA] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Russia", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_SPAIN] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Spain", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_TAIWAN] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Taiwan", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_WORLD] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_International", size));
m_FlagImageIndex[DiscIO::IVolume::COUNTRY_UNKNOWN] =
img_list->Add(WxUtils::LoadResourceBitmap("Flag_Unknown", size));
m_PlatformImageIndex.resize(4); m_PlatformImageIndex.resize(static_cast<size_t>(DiscIO::Platform::NUMBER_OF_PLATFORMS));
m_PlatformImageIndex[DiscIO::IVolume::GAMECUBE_DISC] = InitBitmap(img_list, &m_PlatformImageIndex, DiscIO::Platform::GAMECUBE_DISC, "Platform_Gamecube");
img_list->Add(WxUtils::LoadResourceBitmap("Platform_Gamecube", size)); InitBitmap(img_list, &m_PlatformImageIndex, DiscIO::Platform::WII_DISC, "Platform_Wii");
m_PlatformImageIndex[DiscIO::IVolume::WII_DISC] = InitBitmap(img_list, &m_PlatformImageIndex, DiscIO::Platform::WII_WAD, "Platform_Wad");
img_list->Add(WxUtils::LoadResourceBitmap("Platform_Wii", size)); InitBitmap(img_list, &m_PlatformImageIndex, DiscIO::Platform::ELF_DOL, "Platform_File");
m_PlatformImageIndex[DiscIO::IVolume::WII_WAD] =
img_list->Add(WxUtils::LoadResourceBitmap("Platform_Wad", size));
m_PlatformImageIndex[DiscIO::IVolume::ELF_DOL] =
img_list->Add(WxUtils::LoadResourceBitmap("Platform_File", size));
m_EmuStateImageIndex.resize(6); m_EmuStateImageIndex.resize(6);
m_EmuStateImageIndex[0] = img_list->Add(WxUtils::LoadResourceBitmap("rating0", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 0, "rating0");
m_EmuStateImageIndex[1] = img_list->Add(WxUtils::LoadResourceBitmap("rating1", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 1, "rating1");
m_EmuStateImageIndex[2] = img_list->Add(WxUtils::LoadResourceBitmap("rating2", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 2, "rating2");
m_EmuStateImageIndex[3] = img_list->Add(WxUtils::LoadResourceBitmap("rating3", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 3, "rating3");
m_EmuStateImageIndex[4] = img_list->Add(WxUtils::LoadResourceBitmap("rating4", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 4, "rating4");
m_EmuStateImageIndex[5] = img_list->Add(WxUtils::LoadResourceBitmap("rating5", size)); InitBitmap(img_list, &m_EmuStateImageIndex, 5, "rating5");
} }
void CGameListCtrl::BrowseForDirectory() void CGameListCtrl::BrowseForDirectory()
@ -403,7 +393,8 @@ void CGameListCtrl::UpdateItemAtColumn(long _Index, int column)
{ {
case COLUMN_PLATFORM: case COLUMN_PLATFORM:
{ {
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]); SetItemColumnImage(_Index, COLUMN_PLATFORM,
m_PlatformImageIndex[static_cast<size_t>(rISOFile.GetPlatform())]);
break; break;
} }
case COLUMN_BANNER: case COLUMN_BANNER:
@ -442,7 +433,8 @@ void CGameListCtrl::UpdateItemAtColumn(long _Index, int column)
m_EmuStateImageIndex[rISOFile.GetEmuState()]); m_EmuStateImageIndex[rISOFile.GetEmuState()]);
break; break;
case COLUMN_COUNTRY: case COLUMN_COUNTRY:
SetItemColumnImage(_Index, COLUMN_COUNTRY, m_FlagImageIndex[rISOFile.GetCountry()]); SetItemColumnImage(_Index, COLUMN_COUNTRY,
m_FlagImageIndex[static_cast<size_t>(rISOFile.GetCountry())]);
break; break;
case COLUMN_SIZE: case COLUMN_SIZE:
SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1); SetItem(_Index, COLUMN_SIZE, NiceSizeFormat(rISOFile.GetFileSize()), -1);
@ -576,15 +568,15 @@ void CGameListCtrl::ScanForISOs()
switch (iso_file->GetPlatform()) switch (iso_file->GetPlatform())
{ {
case DiscIO::IVolume::WII_DISC: case DiscIO::Platform::WII_DISC:
if (!SConfig::GetInstance().m_ListWii) if (!SConfig::GetInstance().m_ListWii)
list = false; list = false;
break; break;
case DiscIO::IVolume::WII_WAD: case DiscIO::Platform::WII_WAD:
if (!SConfig::GetInstance().m_ListWad) if (!SConfig::GetInstance().m_ListWad)
list = false; list = false;
break; break;
case DiscIO::IVolume::ELF_DOL: case DiscIO::Platform::ELF_DOL:
if (!SConfig::GetInstance().m_ListElfDol) if (!SConfig::GetInstance().m_ListElfDol)
list = false; list = false;
break; break;
@ -596,59 +588,59 @@ void CGameListCtrl::ScanForISOs()
switch (iso_file->GetCountry()) switch (iso_file->GetCountry())
{ {
case DiscIO::IVolume::COUNTRY_AUSTRALIA: case DiscIO::Country::COUNTRY_AUSTRALIA:
if (!SConfig::GetInstance().m_ListAustralia) if (!SConfig::GetInstance().m_ListAustralia)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::Country::COUNTRY_EUROPE:
if (!SConfig::GetInstance().m_ListPal) if (!SConfig::GetInstance().m_ListPal)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::Country::COUNTRY_FRANCE:
if (!SConfig::GetInstance().m_ListFrance) if (!SConfig::GetInstance().m_ListFrance)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_GERMANY: case DiscIO::Country::COUNTRY_GERMANY:
if (!SConfig::GetInstance().m_ListGermany) if (!SConfig::GetInstance().m_ListGermany)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::Country::COUNTRY_ITALY:
if (!SConfig::GetInstance().m_ListItaly) if (!SConfig::GetInstance().m_ListItaly)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::Country::COUNTRY_JAPAN:
if (!SConfig::GetInstance().m_ListJap) if (!SConfig::GetInstance().m_ListJap)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_KOREA: case DiscIO::Country::COUNTRY_KOREA:
if (!SConfig::GetInstance().m_ListKorea) if (!SConfig::GetInstance().m_ListKorea)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_NETHERLANDS: case DiscIO::Country::COUNTRY_NETHERLANDS:
if (!SConfig::GetInstance().m_ListNetherlands) if (!SConfig::GetInstance().m_ListNetherlands)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_RUSSIA: case DiscIO::Country::COUNTRY_RUSSIA:
if (!SConfig::GetInstance().m_ListRussia) if (!SConfig::GetInstance().m_ListRussia)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_SPAIN: case DiscIO::Country::COUNTRY_SPAIN:
if (!SConfig::GetInstance().m_ListSpain) if (!SConfig::GetInstance().m_ListSpain)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::Country::COUNTRY_TAIWAN:
if (!SConfig::GetInstance().m_ListTaiwan) if (!SConfig::GetInstance().m_ListTaiwan)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_USA: case DiscIO::Country::COUNTRY_USA:
if (!SConfig::GetInstance().m_ListUsa) if (!SConfig::GetInstance().m_ListUsa)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_WORLD: case DiscIO::Country::COUNTRY_WORLD:
if (!SConfig::GetInstance().m_ListWorld) if (!SConfig::GetInstance().m_ListWorld)
list = false; list = false;
break; break;
case DiscIO::IVolume::COUNTRY_UNKNOWN: case DiscIO::Country::COUNTRY_UNKNOWN:
default: default:
if (!SConfig::GetInstance().m_ListUnknown) if (!SConfig::GetInstance().m_ListUnknown)
list = false; list = false;
@ -937,22 +929,22 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
if (selected_iso) if (selected_iso)
{ {
wxMenu popupMenu; wxMenu popupMenu;
DiscIO::IVolume::EPlatform platform = selected_iso->GetPlatform(); DiscIO::Platform platform = selected_iso->GetPlatform();
if (platform != DiscIO::IVolume::ELF_DOL) if (platform != DiscIO::Platform::ELF_DOL)
{ {
popupMenu.Append(IDM_PROPERTIES, _("&Properties")); popupMenu.Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.Append(IDM_GAME_WIKI, _("&Wiki")); popupMenu.Append(IDM_GAME_WIKI, _("&Wiki"));
popupMenu.AppendSeparator(); popupMenu.AppendSeparator();
} }
if (platform == DiscIO::IVolume::WII_DISC || platform == DiscIO::IVolume::WII_WAD) if (platform == DiscIO::Platform::WII_DISC || platform == DiscIO::Platform::WII_WAD)
{ {
popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder")); popupMenu.Append(IDM_OPEN_SAVE_FOLDER, _("Open Wii &save folder"));
popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)")); popupMenu.Append(IDM_EXPORT_SAVE, _("Export Wii save (Experimental)"));
} }
popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder")); popupMenu.Append(IDM_OPEN_CONTAINING_FOLDER, _("Open &containing folder"));
if (platform != DiscIO::IVolume::ELF_DOL) if (platform != DiscIO::Platform::ELF_DOL)
popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO")); popupMenu.AppendCheckItem(IDM_SET_DEFAULT_ISO, _("Set as &default ISO"));
// First we have to decide a starting value when we append it // First we have to decide a starting value when we append it
@ -962,7 +954,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu.AppendSeparator(); popupMenu.AppendSeparator();
popupMenu.Append(IDM_DELETE_ISO, _("&Delete File...")); popupMenu.Append(IDM_DELETE_ISO, _("&Delete File..."));
if (platform == DiscIO::IVolume::GAMECUBE_DISC || platform == DiscIO::IVolume::WII_DISC) if (platform == DiscIO::Platform::GAMECUBE_DISC || platform == DiscIO::Platform::WII_DISC)
{ {
if (selected_iso->GetBlobType() == DiscIO::BlobType::GCZ) if (selected_iso->GetBlobType() == DiscIO::BlobType::GCZ)
popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO...")); popupMenu.Append(IDM_COMPRESS_ISO, _("Decompress ISO..."));
@ -973,7 +965,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
changeDiscItem->Enable(Core::IsRunning()); changeDiscItem->Enable(Core::IsRunning());
} }
if (platform == DiscIO::IVolume::WII_WAD) if (platform == DiscIO::Platform::WII_WAD)
popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu")); popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu"));
PopupMenu(&popupMenu); PopupMenu(&popupMenu);
@ -1156,8 +1148,8 @@ void CGameListCtrl::CompressSelection(bool _compress)
for (const GameListItem* iso : GetAllSelectedISOs()) for (const GameListItem* iso : GetAllSelectedISOs())
{ {
// Don't include items that we can't do anything with // Don't include items that we can't do anything with
if (iso->GetPlatform() != DiscIO::IVolume::GAMECUBE_DISC && if (iso->GetPlatform() != DiscIO::Platform::GAMECUBE_DISC &&
iso->GetPlatform() != DiscIO::IVolume::WII_DISC) iso->GetPlatform() != DiscIO::Platform::WII_DISC)
continue; continue;
if (iso->GetBlobType() != DiscIO::BlobType::PLAIN && if (iso->GetBlobType() != DiscIO::BlobType::PLAIN &&
iso->GetBlobType() != DiscIO::BlobType::GCZ) iso->GetBlobType() != DiscIO::BlobType::GCZ)
@ -1167,7 +1159,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
// Show the Wii compression warning if it's relevant and it hasn't been shown already // Show the Wii compression warning if it's relevant and it hasn't been shown already
if (!wii_compression_warning_accepted && _compress && !iso->IsCompressed() && if (!wii_compression_warning_accepted && _compress && !iso->IsCompressed() &&
iso->GetPlatform() == DiscIO::IVolume::WII_DISC) iso->GetPlatform() == DiscIO::Platform::WII_DISC)
{ {
if (WiiCompressWarning()) if (WiiCompressWarning())
wii_compression_warning_accepted = true; wii_compression_warning_accepted = true;
@ -1216,7 +1208,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
all_good &= all_good &=
DiscIO::CompressFileToBlob(iso->GetFileName(), OutputFileName, DiscIO::CompressFileToBlob(iso->GetFileName(), OutputFileName,
(iso->GetPlatform() == DiscIO::IVolume::WII_DISC) ? 1 : 0, (iso->GetPlatform() == DiscIO::Platform::WII_DISC) ? 1 : 0,
16384, &MultiCompressCB, &progress); 16384, &MultiCompressCB, &progress);
} }
else if (iso->IsCompressed() && !_compress) else if (iso->IsCompressed() && !_compress)
@ -1224,7 +1216,7 @@ void CGameListCtrl::CompressSelection(bool _compress)
std::string FileName; std::string FileName;
SplitPath(iso->GetFileName(), nullptr, &FileName, nullptr); SplitPath(iso->GetFileName(), nullptr, &FileName, nullptr);
progress.current_filename = FileName; progress.current_filename = FileName;
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC) if (iso->GetPlatform() == DiscIO::Platform::WII_DISC)
FileName.append(".iso"); FileName.append(".iso");
else else
FileName.append(".gcm"); FileName.append(".gcm");
@ -1275,7 +1267,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event))
if (is_compressed) if (is_compressed)
{ {
wxString FileType; wxString FileType;
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC) if (iso->GetPlatform() == DiscIO::Platform::WII_DISC)
FileType = _("All Wii ISO files (iso)") + "|*.iso"; FileType = _("All Wii ISO files (iso)") + "|*.iso";
else else
FileType = _("All GameCube GCM files (gcm)") + "|*.gcm"; FileType = _("All GameCube GCM files (gcm)") + "|*.gcm";
@ -1286,7 +1278,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event))
} }
else else
{ {
if (iso->GetPlatform() == DiscIO::IVolume::WII_DISC && !WiiCompressWarning()) if (iso->GetPlatform() == DiscIO::Platform::WII_DISC && !WiiCompressWarning())
return; return;
path = wxFileSelector(_("Save compressed GCM/ISO"), StrToWxStr(FilePath), path = wxFileSelector(_("Save compressed GCM/ISO"), StrToWxStr(FilePath),
@ -1317,7 +1309,7 @@ void CGameListCtrl::OnCompressISO(wxCommandEvent& WXUNUSED(event))
else else
all_good = DiscIO::CompressFileToBlob( all_good = DiscIO::CompressFileToBlob(
iso->GetFileName(), WxStrToStr(path), iso->GetFileName(), WxStrToStr(path),
(iso->GetPlatform() == DiscIO::IVolume::WII_DISC) ? 1 : 0, 16384, &CompressCB, &dialog); (iso->GetPlatform() == DiscIO::Platform::WII_DISC) ? 1 : 0, 16384, &CompressCB, &dialog);
} }
if (!all_good) if (!all_good)

View File

@ -28,6 +28,8 @@
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -39,8 +41,8 @@ static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309
#define DVD_BANNER_WIDTH 96 #define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32 #define DVD_BANNER_HEIGHT 32
static std::string GetLanguageString(DiscIO::IVolume::ELanguage language, static std::string GetLanguageString(DiscIO::Language language,
std::map<DiscIO::IVolume::ELanguage, std::string> strings) std::map<DiscIO::Language, std::string> strings)
{ {
auto end = strings.end(); auto end = strings.end();
auto it = strings.find(language); auto it = strings.find(language);
@ -48,9 +50,9 @@ static std::string GetLanguageString(DiscIO::IVolume::ELanguage language,
return it->second; return it->second;
// English tends to be a good fallback when the requested language isn't available // English tends to be a good fallback when the requested language isn't available
if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) if (language != DiscIO::Language::LANGUAGE_ENGLISH)
{ {
it = strings.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH); it = strings.find(DiscIO::Language::LANGUAGE_ENGLISH);
if (it != end) if (it != end)
return it->second; return it->second;
} }
@ -65,7 +67,7 @@ static std::string GetLanguageString(DiscIO::IVolume::ELanguage language,
GameListItem::GameListItem(const std::string& _rFileName, GameListItem::GameListItem(const std::string& _rFileName,
const std::unordered_map<std::string, std::string>& custom_titles) const std::unordered_map<std::string, std::string>& custom_titles)
: m_FileName(_rFileName), m_title_id(0), m_emu_state(0), m_FileSize(0), : m_FileName(_rFileName), m_title_id(0), m_emu_state(0), m_FileSize(0),
m_Country(DiscIO::IVolume::COUNTRY_UNKNOWN), m_Revision(0), m_Valid(false), m_ImageWidth(0), m_Country(DiscIO::Country::COUNTRY_UNKNOWN), m_Revision(0), m_Valid(false), m_ImageWidth(0),
m_ImageHeight(0), m_disc_number(0), m_has_custom_name(false) m_ImageHeight(0), m_disc_number(0), m_has_custom_name(false)
{ {
if (LoadFromCache()) if (LoadFromCache())
@ -96,9 +98,9 @@ GameListItem::GameListItem(const std::string& _rFileName,
m_names = volume->GetLongNames(); m_names = volume->GetLongNames();
if (m_names.empty()) if (m_names.empty())
m_names = volume->GetShortNames(); m_names = volume->GetShortNames();
m_company = GetLanguageString(DiscIO::IVolume::LANGUAGE_ENGLISH, volume->GetLongMakers()); m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetLongMakers());
if (m_company.empty()) if (m_company.empty())
m_company = GetLanguageString(DiscIO::IVolume::LANGUAGE_ENGLISH, volume->GetShortMakers()); m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetShortMakers());
m_Country = volume->GetCountry(); m_Country = volume->GetCountry();
m_blob_type = volume->GetBlobType(); m_blob_type = volume->GetBlobType();
@ -126,7 +128,7 @@ GameListItem::GameListItem(const std::string& _rFileName,
std::string game_id = m_UniqueID; std::string game_id = m_UniqueID;
// Ignore publisher ID for WAD files // Ignore publisher ID for WAD files
if (m_Platform == DiscIO::IVolume::WII_WAD && game_id.size() > 4) if (m_Platform == DiscIO::Platform::WII_WAD && game_id.size() > 4)
game_id.erase(4); game_id.erase(4);
auto it = custom_titles.find(game_id); auto it = custom_titles.find(game_id);
@ -142,7 +144,7 @@ GameListItem::GameListItem(const std::string& _rFileName,
{ {
m_Valid = true; m_Valid = true;
m_FileSize = File::GetSize(_rFileName); m_FileSize = File::GetSize(_rFileName);
m_Platform = DiscIO::IVolume::ELF_DOL; m_Platform = DiscIO::Platform::ELF_DOL;
m_blob_type = DiscIO::BlobType::DIRECTORY; m_blob_type = DiscIO::BlobType::DIRECTORY;
} }
@ -296,18 +298,18 @@ wxBitmap GameListItem::ScaleBanner(wxImage* image)
#endif #endif
} }
std::string GameListItem::GetDescription(DiscIO::IVolume::ELanguage language) const std::string GameListItem::GetDescription(DiscIO::Language language) const
{ {
return GetLanguageString(language, m_descriptions); return GetLanguageString(language, m_descriptions);
} }
std::string GameListItem::GetDescription() const std::string GameListItem::GetDescription() const
{ {
bool wii = m_Platform != DiscIO::IVolume::GAMECUBE_DISC; bool wii = m_Platform != DiscIO::Platform::GAMECUBE_DISC;
return GetDescription(SConfig::GetInstance().GetCurrentLanguage(wii)); return GetDescription(SConfig::GetInstance().GetCurrentLanguage(wii));
} }
std::string GameListItem::GetName(DiscIO::IVolume::ELanguage language) const std::string GameListItem::GetName(DiscIO::Language language) const
{ {
return GetLanguageString(language, m_names); return GetLanguageString(language, m_names);
} }
@ -317,7 +319,7 @@ std::string GameListItem::GetName() const
if (m_has_custom_name) if (m_has_custom_name)
return m_custom_name; return m_custom_name;
bool wii = m_Platform != DiscIO::IVolume::GAMECUBE_DISC; bool wii = m_Platform != DiscIO::Platform::GAMECUBE_DISC;
std::string name = GetName(SConfig::GetInstance().GetCurrentLanguage(wii)); std::string name = GetName(SConfig::GetInstance().GetCurrentLanguage(wii));
if (!name.empty()) if (!name.empty())
return name; return name;
@ -328,10 +330,10 @@ std::string GameListItem::GetName() const
return name + ext; return name + ext;
} }
std::vector<DiscIO::IVolume::ELanguage> GameListItem::GetLanguages() const std::vector<DiscIO::Language> GameListItem::GetLanguages() const
{ {
std::vector<DiscIO::IVolume::ELanguage> languages; std::vector<DiscIO::Language> languages;
for (std::pair<DiscIO::IVolume::ELanguage, std::string> name : m_names) for (std::pair<DiscIO::Language, std::string> name : m_names)
languages.push_back(name.first); languages.push_back(name.first);
return languages; return languages;
} }
@ -344,7 +346,7 @@ const std::string GameListItem::GetWiiFSPath() const
if (iso == nullptr) if (iso == nullptr)
return ret; return ret;
if (iso->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC) if (iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC)
{ {
u64 title_id = 0; u64 title_id = 0;
iso->GetTitleID(&title_id); iso->GetTitleID(&title_id);
@ -364,3 +366,9 @@ const std::string GameListItem::GetWiiFSPath() const
return ret; return ret;
} }
bool GameListItem::IsCompressed() const
{
return m_blob_type == DiscIO::BlobType::GCZ || m_blob_type == DiscIO::BlobType::CISO ||
m_blob_type == DiscIO::BlobType::WBFS;
}

View File

@ -10,15 +10,22 @@
#include <vector> #include <vector>
#include "Common/Common.h" #include "Common/Common.h"
#include "DiscIO/Blob.h"
#include "DiscIO/Volume.h"
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#endif #endif
namespace DiscIO
{
enum class BlobType;
enum class Country;
enum class Language;
enum class Platform;
}
class PointerWrap; class PointerWrap;
class GameListItem class GameListItem
{ {
public: public:
@ -31,25 +38,21 @@ public:
bool IsValid() const { return m_Valid; } bool IsValid() const { return m_Valid; }
const std::string& GetFileName() const { return m_FileName; } const std::string& GetFileName() const { return m_FileName; }
std::string GetName(DiscIO::IVolume::ELanguage language) const; std::string GetName(DiscIO::Language language) const;
std::string GetName() const; std::string GetName() const;
std::string GetDescription(DiscIO::IVolume::ELanguage language) const; std::string GetDescription(DiscIO::Language language) const;
std::string GetDescription() const; std::string GetDescription() const;
std::vector<DiscIO::IVolume::ELanguage> GetLanguages() const; std::vector<DiscIO::Language> GetLanguages() const;
std::string GetCompany() const { return m_company; } std::string GetCompany() const { return m_company; }
u16 GetRevision() const { return m_Revision; } u16 GetRevision() const { return m_Revision; }
const std::string& GetUniqueID() const { return m_UniqueID; } const std::string& GetUniqueID() const { return m_UniqueID; }
const std::string GetWiiFSPath() const; const std::string GetWiiFSPath() const;
DiscIO::IVolume::ECountry GetCountry() const { return m_Country; } DiscIO::Country GetCountry() const { return m_Country; }
DiscIO::IVolume::EPlatform GetPlatform() const { return m_Platform; } DiscIO::Platform GetPlatform() const { return m_Platform; }
DiscIO::BlobType GetBlobType() const { return m_blob_type; } DiscIO::BlobType GetBlobType() const { return m_blob_type; }
const std::string& GetIssues() const { return m_issues; } const std::string& GetIssues() const { return m_issues; }
int GetEmuState() const { return m_emu_state; } int GetEmuState() const { return m_emu_state; }
bool IsCompressed() const bool IsCompressed() const;
{
return m_blob_type == DiscIO::BlobType::GCZ || m_blob_type == DiscIO::BlobType::CISO ||
m_blob_type == DiscIO::BlobType::WBFS;
}
u64 GetFileSize() const { return m_FileSize; } u64 GetFileSize() const { return m_FileSize; }
u64 GetVolumeSize() const { return m_VolumeSize; } u64 GetVolumeSize() const { return m_VolumeSize; }
// 0 is the first disc, 1 is the second disc // 0 is the first disc, 1 is the second disc
@ -63,8 +66,8 @@ public:
private: private:
std::string m_FileName; std::string m_FileName;
std::map<DiscIO::IVolume::ELanguage, std::string> m_names; std::map<DiscIO::Language, std::string> m_names;
std::map<DiscIO::IVolume::ELanguage, std::string> m_descriptions; std::map<DiscIO::Language, std::string> m_descriptions;
std::string m_company; std::string m_company;
std::string m_UniqueID; std::string m_UniqueID;
@ -76,8 +79,8 @@ private:
u64 m_FileSize; u64 m_FileSize;
u64 m_VolumeSize; u64 m_VolumeSize;
DiscIO::IVolume::ECountry m_Country; DiscIO::Country m_Country;
DiscIO::IVolume::EPlatform m_Platform; DiscIO::Platform m_Platform;
DiscIO::BlobType m_blob_type; DiscIO::BlobType m_blob_type;
u16 m_Revision; u16 m_Revision;

View File

@ -59,6 +59,7 @@
#include "Core/GeckoCodeConfig.h" #include "Core/GeckoCodeConfig.h"
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/Enums.h"
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -123,46 +124,46 @@ CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* par
m_GameID->SetValue(StrToWxStr(m_open_iso->GetUniqueID())); m_GameID->SetValue(StrToWxStr(m_open_iso->GetUniqueID()));
switch (m_open_iso->GetCountry()) switch (m_open_iso->GetCountry())
{ {
case DiscIO::IVolume::COUNTRY_AUSTRALIA: case DiscIO::Country::COUNTRY_AUSTRALIA:
m_Country->SetValue(_("Australia")); m_Country->SetValue(_("Australia"));
break; break;
case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::Country::COUNTRY_EUROPE:
m_Country->SetValue(_("Europe")); m_Country->SetValue(_("Europe"));
break; break;
case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::Country::COUNTRY_FRANCE:
m_Country->SetValue(_("France")); m_Country->SetValue(_("France"));
break; break;
case DiscIO::IVolume::COUNTRY_ITALY: case DiscIO::Country::COUNTRY_ITALY:
m_Country->SetValue(_("Italy")); m_Country->SetValue(_("Italy"));
break; break;
case DiscIO::IVolume::COUNTRY_GERMANY: case DiscIO::Country::COUNTRY_GERMANY:
m_Country->SetValue(_("Germany")); m_Country->SetValue(_("Germany"));
break; break;
case DiscIO::IVolume::COUNTRY_NETHERLANDS: case DiscIO::Country::COUNTRY_NETHERLANDS:
m_Country->SetValue(_("Netherlands")); m_Country->SetValue(_("Netherlands"));
break; break;
case DiscIO::IVolume::COUNTRY_RUSSIA: case DiscIO::Country::COUNTRY_RUSSIA:
m_Country->SetValue(_("Russia")); m_Country->SetValue(_("Russia"));
break; break;
case DiscIO::IVolume::COUNTRY_SPAIN: case DiscIO::Country::COUNTRY_SPAIN:
m_Country->SetValue(_("Spain")); m_Country->SetValue(_("Spain"));
break; break;
case DiscIO::IVolume::COUNTRY_USA: case DiscIO::Country::COUNTRY_USA:
m_Country->SetValue(_("USA")); m_Country->SetValue(_("USA"));
break; break;
case DiscIO::IVolume::COUNTRY_JAPAN: case DiscIO::Country::COUNTRY_JAPAN:
m_Country->SetValue(_("Japan")); m_Country->SetValue(_("Japan"));
break; break;
case DiscIO::IVolume::COUNTRY_KOREA: case DiscIO::Country::COUNTRY_KOREA:
m_Country->SetValue(_("Korea")); m_Country->SetValue(_("Korea"));
break; break;
case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::Country::COUNTRY_TAIWAN:
m_Country->SetValue(_("Taiwan")); m_Country->SetValue(_("Taiwan"));
break; break;
case DiscIO::IVolume::COUNTRY_WORLD: case DiscIO::Country::COUNTRY_WORLD:
m_Country->SetValue(_("World")); m_Country->SetValue(_("World"));
break; break;
case DiscIO::IVolume::COUNTRY_UNKNOWN: case DiscIO::Country::COUNTRY_UNKNOWN:
default: default:
m_Country->SetValue(_("Unknown")); m_Country->SetValue(_("Unknown"));
break; break;
@ -175,7 +176,7 @@ CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* par
m_FST->SetValue(StrToWxStr(std::to_string(m_open_iso->GetFSTSize()))); m_FST->SetValue(StrToWxStr(std::to_string(m_open_iso->GetFSTSize())));
// Here we set all the info to be shown + we set the window title // Here we set all the info to be shown + we set the window title
bool wii = m_open_iso->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC; bool wii = m_open_iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
ChangeBannerDetails(SConfig::GetInstance().GetCurrentLanguage(wii)); ChangeBannerDetails(SConfig::GetInstance().GetCurrentLanguage(wii));
m_Banner->SetBitmap(OpenGameListItem.GetBitmap()); m_Banner->SetBitmap(OpenGameListItem.GetBitmap());
@ -183,9 +184,9 @@ CISOProperties::CISOProperties(const GameListItem& game_list_item, wxWindow* par
// Filesystem browser/dumper // Filesystem browser/dumper
// TODO : Should we add a way to browse the wad file ? // TODO : Should we add a way to browse the wad file ?
if (m_open_iso->GetVolumeType() != DiscIO::IVolume::WII_WAD) if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_WAD)
{ {
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
int partition_count = 0; int partition_count = 0;
for (int group = 0; group < 4; group++) for (int group = 0; group < 4; group++)
@ -426,7 +427,7 @@ void CISOProperties::CreateGUIControls()
wxStaticBoxSizer* const sbWiiOverrides = wxStaticBoxSizer* const sbWiiOverrides =
new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console")); new wxStaticBoxSizer(wxVERTICAL, m_GameConfig, _("Wii Console"));
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::GAMECUBE_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::GAMECUBE_DISC)
{ {
sbWiiOverrides->ShowItems(false); sbWiiOverrides->ShowItems(false);
EnableWideScreen->Hide(); EnableWideScreen->Hide();
@ -523,10 +524,10 @@ void CISOProperties::CreateGUIControls()
wxStaticText* const m_LangText = new wxStaticText(m_Information, wxID_ANY, _("Show Language:")); wxStaticText* const m_LangText = new wxStaticText(m_Information, wxID_ANY, _("Show Language:"));
bool wii = m_open_iso->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC; bool wii = m_open_iso->GetVolumeType() != DiscIO::Platform::GAMECUBE_DISC;
DiscIO::IVolume::ELanguage preferred_language = SConfig::GetInstance().GetCurrentLanguage(wii); DiscIO::Language preferred_language = SConfig::GetInstance().GetCurrentLanguage(wii);
std::vector<DiscIO::IVolume::ELanguage> languages = OpenGameListItem.GetLanguages(); std::vector<DiscIO::Language> languages = OpenGameListItem.GetLanguages();
int preferred_language_index = 0; int preferred_language_index = 0;
for (size_t i = 0; i < languages.size(); ++i) for (size_t i = 0; i < languages.size(); ++i)
{ {
@ -535,37 +536,37 @@ void CISOProperties::CreateGUIControls()
switch (languages[i]) switch (languages[i])
{ {
case DiscIO::IVolume::LANGUAGE_JAPANESE: case DiscIO::Language::LANGUAGE_JAPANESE:
arrayStringFor_Lang.Add(_("Japanese")); arrayStringFor_Lang.Add(_("Japanese"));
break; break;
case DiscIO::IVolume::LANGUAGE_ENGLISH: case DiscIO::Language::LANGUAGE_ENGLISH:
arrayStringFor_Lang.Add(_("English")); arrayStringFor_Lang.Add(_("English"));
break; break;
case DiscIO::IVolume::LANGUAGE_GERMAN: case DiscIO::Language::LANGUAGE_GERMAN:
arrayStringFor_Lang.Add(_("German")); arrayStringFor_Lang.Add(_("German"));
break; break;
case DiscIO::IVolume::LANGUAGE_FRENCH: case DiscIO::Language::LANGUAGE_FRENCH:
arrayStringFor_Lang.Add(_("French")); arrayStringFor_Lang.Add(_("French"));
break; break;
case DiscIO::IVolume::LANGUAGE_SPANISH: case DiscIO::Language::LANGUAGE_SPANISH:
arrayStringFor_Lang.Add(_("Spanish")); arrayStringFor_Lang.Add(_("Spanish"));
break; break;
case DiscIO::IVolume::LANGUAGE_ITALIAN: case DiscIO::Language::LANGUAGE_ITALIAN:
arrayStringFor_Lang.Add(_("Italian")); arrayStringFor_Lang.Add(_("Italian"));
break; break;
case DiscIO::IVolume::LANGUAGE_DUTCH: case DiscIO::Language::LANGUAGE_DUTCH:
arrayStringFor_Lang.Add(_("Dutch")); arrayStringFor_Lang.Add(_("Dutch"));
break; break;
case DiscIO::IVolume::LANGUAGE_SIMPLIFIED_CHINESE: case DiscIO::Language::LANGUAGE_SIMPLIFIED_CHINESE:
arrayStringFor_Lang.Add(_("Simplified Chinese")); arrayStringFor_Lang.Add(_("Simplified Chinese"));
break; break;
case DiscIO::IVolume::LANGUAGE_TRADITIONAL_CHINESE: case DiscIO::Language::LANGUAGE_TRADITIONAL_CHINESE:
arrayStringFor_Lang.Add(_("Traditional Chinese")); arrayStringFor_Lang.Add(_("Traditional Chinese"));
break; break;
case DiscIO::IVolume::LANGUAGE_KOREAN: case DiscIO::Language::LANGUAGE_KOREAN:
arrayStringFor_Lang.Add(_("Korean")); arrayStringFor_Lang.Add(_("Korean"));
break; break;
case DiscIO::IVolume::LANGUAGE_UNKNOWN: case DiscIO::Language::LANGUAGE_UNKNOWN:
default: default:
arrayStringFor_Lang.Add(_("Unknown")); arrayStringFor_Lang.Add(_("Unknown"));
break; break;
@ -650,7 +651,7 @@ void CISOProperties::CreateGUIControls()
sInfoPage->Add(sbBannerDetails, 0, wxEXPAND | wxALL, 5); sInfoPage->Add(sbBannerDetails, 0, wxEXPAND | wxALL, 5);
m_Information->SetSizer(sInfoPage); m_Information->SetSizer(sInfoPage);
if (m_open_iso->GetVolumeType() != DiscIO::IVolume::WII_WAD) if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_WAD)
{ {
wxPanel* const filesystem_panel = new wxPanel(m_Notebook, ID_FILESYSTEM); wxPanel* const filesystem_panel = new wxPanel(m_Notebook, ID_FILESYSTEM);
m_Notebook->AddPage(filesystem_panel, _("Filesystem")); m_Notebook->AddPage(filesystem_panel, _("Filesystem"));
@ -758,7 +759,7 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
popupMenu.Append(IDM_EXTRACTALL, _("Extract All Files...")); popupMenu.Append(IDM_EXTRACTALL, _("Extract All Files..."));
if (m_open_iso->GetVolumeType() != DiscIO::IVolume::WII_DISC || if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_DISC ||
(m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 && (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 &&
m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection())) m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()))
{ {
@ -797,7 +798,7 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED(event))
m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection())); m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
} }
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
const wxTreeItemId tree_selection = m_Treectrl->GetSelection(); const wxTreeItemId tree_selection = m_Treectrl->GetSelection();
WiiPartition* partition = WiiPartition* partition =
@ -815,9 +816,8 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED(event))
void CISOProperties::ExportDir(const std::string& _rFullPath, const std::string& _rExportFolder, void CISOProperties::ExportDir(const std::string& _rFullPath, const std::string& _rExportFolder,
const WiiPartition* partition) const WiiPartition* partition)
{ {
DiscIO::IFileSystem* const fs = m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC ? bool is_wii = m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC;
partition->FileSystem.get() : DiscIO::IFileSystem* const fs = is_wii ? partition->FileSystem.get() : m_filesystem.get();
m_filesystem.get();
const std::vector<DiscIO::SFileInfo>& fst = fs->GetFileList(); const std::vector<DiscIO::SFileInfo>& fst = fs->GetFileList();
@ -831,7 +831,7 @@ void CISOProperties::ExportDir(const std::string& _rFullPath, const std::string&
size = (u32)fst.size(); size = (u32)fst.size();
fs->ExportApploader(_rExportFolder); fs->ExportApploader(_rExportFolder);
if (m_open_iso->GetVolumeType() != DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_DISC)
fs->ExportDOL(_rExportFolder); fs->ExportDOL(_rExportFolder);
} }
else else
@ -913,7 +913,7 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
if (event.GetId() == IDM_EXTRACTALL) if (event.GetId() == IDM_EXTRACTALL)
{ {
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
wxTreeItemIdValue cookie; wxTreeItemIdValue cookie;
wxTreeItemId root = m_Treectrl->GetRootItem(); wxTreeItemId root = m_Treectrl->GetRootItem();
@ -943,7 +943,7 @@ void CISOProperties::OnExtractDir(wxCommandEvent& event)
Directory += DIR_SEP_CHR; Directory += DIR_SEP_CHR;
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
const wxTreeItemId tree_selection = m_Treectrl->GetSelection(); const wxTreeItemId tree_selection = m_Treectrl->GetSelection();
WiiPartition* partition = WiiPartition* partition =
@ -967,7 +967,7 @@ void CISOProperties::OnExtractDataFromHeader(wxCommandEvent& event)
if (Path.empty()) if (Path.empty())
return; return;
if (m_open_iso->GetVolumeType() == DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() == DiscIO::Platform::WII_DISC)
{ {
WiiPartition* partition = WiiPartition* partition =
reinterpret_cast<WiiPartition*>(m_Treectrl->GetItemData(m_Treectrl->GetSelection())); reinterpret_cast<WiiPartition*>(m_Treectrl->GetItemData(m_Treectrl->GetSelection()));
@ -1011,7 +1011,7 @@ void CISOProperties::CheckPartitionIntegrity(wxCommandEvent& event)
{ {
// Normally we can't enter this function if we aren't analyzing a Wii disc // Normally we can't enter this function if we aren't analyzing a Wii disc
// anyway, but let's still check to be sure. // anyway, but let's still check to be sure.
if (m_open_iso->GetVolumeType() != DiscIO::IVolume::WII_DISC) if (m_open_iso->GetVolumeType() != DiscIO::Platform::WII_DISC)
return; return;
wxProgressDialog dialog(_("Checking integrity..."), _("Working..."), 1000, this, wxProgressDialog dialog(_("Checking integrity..."), _("Working..."), 1000, this,
@ -1546,7 +1546,7 @@ void CISOProperties::OnChangeBannerLang(wxCommandEvent& event)
ChangeBannerDetails(OpenGameListItem.GetLanguages()[event.GetSelection()]); ChangeBannerDetails(OpenGameListItem.GetLanguages()[event.GetSelection()]);
} }
void CISOProperties::ChangeBannerDetails(DiscIO::IVolume::ELanguage language) void CISOProperties::ChangeBannerDetails(DiscIO::Language language)
{ {
wxString const name = StrToWxStr(OpenGameListItem.GetName(language)); wxString const name = StrToWxStr(OpenGameListItem.GetName(language));
wxString const comment = StrToWxStr(OpenGameListItem.GetDescription(language)); wxString const comment = StrToWxStr(OpenGameListItem.GetDescription(language));

View File

@ -17,7 +17,6 @@
#include "Core/ActionReplay.h" #include "Core/ActionReplay.h"
#include "DiscIO/Filesystem.h" #include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h"
#include "DolphinWX/ARCodeAddEdit.h" #include "DolphinWX/ARCodeAddEdit.h"
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
#include "DolphinWX/PatchAddEdit.h" #include "DolphinWX/PatchAddEdit.h"
@ -35,7 +34,7 @@ class wxTreeCtrl;
namespace DiscIO namespace DiscIO
{ {
struct SFileInfo; enum class Language;
} }
namespace Gecko namespace Gecko
{ {
@ -242,7 +241,7 @@ private:
void PatchList_Save(); void PatchList_Save();
void ActionReplayList_Load(); void ActionReplayList_Load();
void ActionReplayList_Save(); void ActionReplayList_Save();
void ChangeBannerDetails(DiscIO::IVolume::ELanguage language); void ChangeBannerDetails(DiscIO::Language language);
long GetElementStyle(const char* section, const char* key); long GetElementStyle(const char* section, const char* key);
void SetCheckboxValueFromGameini(const char* section, const char* key, wxCheckBox* checkbox); void SetCheckboxValueFromGameini(const char* section, const char* key, wxCheckBox* checkbox);

View File

@ -34,6 +34,8 @@
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
#include "Core/NetPlayServer.h" #include "Core/NetPlayServer.h"
#include "DiscIO/Enums.h"
#include "DolphinWX/Frame.h" #include "DolphinWX/Frame.h"
#include "DolphinWX/GameListCtrl.h" #include "DolphinWX/GameListCtrl.h"
#include "DolphinWX/ISOFile.h" #include "DolphinWX/ISOFile.h"
@ -69,7 +71,7 @@ static wxString FailureReasonStringForHostLabel(int reason)
static std::string BuildGameName(const GameListItem& game) static std::string BuildGameName(const GameListItem& game)
{ {
// Lang needs to be consistent // Lang needs to be consistent
DiscIO::IVolume::ELanguage const lang = DiscIO::IVolume::LANGUAGE_ENGLISH; const DiscIO::Language lang = DiscIO::Language::LANGUAGE_ENGLISH;
std::vector<std::string> info; std::vector<std::string> info;
if (!game.GetUniqueID().empty()) if (!game.GetUniqueID().empty())
info.push_back(game.GetUniqueID()); info.push_back(game.GetUniqueID());