DiscIO: Add GetRegion function and Region enum
Instead of needing different switch cases for converting countries to regions in multiple places, we now only need a single country-to-region switch case (in DiscIO/Enums.cpp), and we get a nice Region type.
This commit is contained in:
parent
6aef0630f7
commit
66ea9f5cc1
|
@ -419,7 +419,7 @@ bool CBoot::BootUp()
|
||||||
|
|
||||||
// Poor man's bootup
|
// Poor man's bootup
|
||||||
if (_StartupPara.bWii)
|
if (_StartupPara.bWii)
|
||||||
SetupWiiMemory(DiscIO::Country::COUNTRY_UNKNOWN);
|
SetupWiiMemory(DiscIO::Region::UNKNOWN_REGION);
|
||||||
else
|
else
|
||||||
EmulatedBS2_GC(true);
|
EmulatedBS2_GC(true);
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
enum class Country;
|
enum class Region;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CountrySetting
|
struct RegionSetting
|
||||||
{
|
{
|
||||||
const std::string area;
|
const std::string area;
|
||||||
const std::string video;
|
const std::string video;
|
||||||
|
@ -57,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::Country country);
|
static bool SetupWiiMemory(DiscIO::Region region);
|
||||||
};
|
};
|
||||||
|
|
|
@ -181,28 +181,22 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::SetupWiiMemory(DiscIO::Country country)
|
bool CBoot::SetupWiiMemory(DiscIO::Region region)
|
||||||
{
|
{
|
||||||
static const CountrySetting SETTING_EUROPE = {"EUR", "PAL", "EU", "LE"};
|
static const RegionSetting SETTING_NTSC_J = {"JPN", "NTSC", "JP", "LJ"};
|
||||||
static const CountrySetting SETTING_USA = {"USA", "NTSC", "US", "LU"};
|
static const RegionSetting SETTING_NTSC_U = {"USA", "NTSC", "US", "LU"};
|
||||||
static const CountrySetting SETTING_JAPAN = {"JPN", "NTSC", "JP", "LJ"};
|
static const RegionSetting SETTING_PAL = {"EUR", "PAL", "EU", "LE"};
|
||||||
static const CountrySetting SETTING_KOREA = {"KOR", "NTSC", "KR", "LKH"};
|
static const RegionSetting SETTING_NTSC_K = {"KOR", "NTSC", "KR", "LKH"};
|
||||||
static const std::map<DiscIO::Country, const CountrySetting> country_settings = {
|
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
||||||
{DiscIO::Country::COUNTRY_EUROPE, SETTING_EUROPE},
|
{DiscIO::Region::NTSC_J, SETTING_NTSC_J},
|
||||||
{DiscIO::Country::COUNTRY_USA, SETTING_USA},
|
{DiscIO::Region::NTSC_U, SETTING_NTSC_U},
|
||||||
{DiscIO::Country::COUNTRY_JAPAN, SETTING_JAPAN},
|
{DiscIO::Region::PAL, SETTING_PAL},
|
||||||
{DiscIO::Country::COUNTRY_KOREA, SETTING_KOREA},
|
{DiscIO::Region::NTSC_K, SETTING_NTSC_K}};
|
||||||
// TODO: Determine if Taiwan have their own specific settings.
|
auto entryPos = region_settings.find(region);
|
||||||
// Also determine if there are other specific settings
|
const RegionSetting& region_setting =
|
||||||
// for other countries.
|
(entryPos != region_settings.end()) ?
|
||||||
{DiscIO::Country::COUNTRY_TAIWAN, SETTING_JAPAN}};
|
|
||||||
auto entryPos = country_settings.find(country);
|
|
||||||
const CountrySetting& country_setting =
|
|
||||||
(entryPos != country_settings.end()) ?
|
|
||||||
entryPos->second :
|
entryPos->second :
|
||||||
(SConfig::GetInstance().bNTSC ?
|
(SConfig::GetInstance().bNTSC ? SETTING_NTSC_U : SETTING_PAL);
|
||||||
SETTING_USA :
|
|
||||||
SETTING_EUROPE); // default to USA or EUR depending on game's video mode
|
|
||||||
|
|
||||||
SettingsHandler gen;
|
SettingsHandler gen;
|
||||||
std::string serno;
|
std::string serno;
|
||||||
|
@ -233,15 +227,15 @@ bool CBoot::SetupWiiMemory(DiscIO::Country country)
|
||||||
INFO_LOG(BOOT, "Using serial number: %s", serno.c_str());
|
INFO_LOG(BOOT, "Using serial number: %s", serno.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string model = "RVL-001(" + country_setting.area + ")";
|
std::string model = "RVL-001(" + region_setting.area + ")";
|
||||||
gen.AddSetting("AREA", country_setting.area);
|
gen.AddSetting("AREA", region_setting.area);
|
||||||
gen.AddSetting("MODEL", model);
|
gen.AddSetting("MODEL", model);
|
||||||
gen.AddSetting("DVD", "0");
|
gen.AddSetting("DVD", "0");
|
||||||
gen.AddSetting("MPCH", "0x7FFE");
|
gen.AddSetting("MPCH", "0x7FFE");
|
||||||
gen.AddSetting("CODE", country_setting.code);
|
gen.AddSetting("CODE", region_setting.code);
|
||||||
gen.AddSetting("SERNO", serno);
|
gen.AddSetting("SERNO", serno);
|
||||||
gen.AddSetting("VIDEO", country_setting.video);
|
gen.AddSetting("VIDEO", region_setting.video);
|
||||||
gen.AddSetting("GAME", country_setting.game);
|
gen.AddSetting("GAME", region_setting.game);
|
||||||
|
|
||||||
File::CreateFullPath(settings_Filename);
|
File::CreateFullPath(settings_Filename);
|
||||||
{
|
{
|
||||||
|
@ -336,10 +330,10 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
INFO_LOG(BOOT, "Faking Wii BS2...");
|
INFO_LOG(BOOT, "Faking Wii BS2...");
|
||||||
|
|
||||||
// Setup Wii memory
|
// Setup Wii memory
|
||||||
DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
|
DiscIO::Region region_code = DiscIO::Region::UNKNOWN_REGION;
|
||||||
if (DVDInterface::VolumeIsValid())
|
if (DVDInterface::VolumeIsValid())
|
||||||
country_code = DVDInterface::GetVolume().GetCountry();
|
region_code = DVDInterface::GetVolume().GetRegion();
|
||||||
if (SetupWiiMemory(country_code) == false)
|
if (SetupWiiMemory(region_code) == false)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Execute the apploader
|
// Execute the apploader
|
||||||
|
|
|
@ -89,10 +89,10 @@ bool CBoot::Boot_WiiWAD(const std::string& _pFilename)
|
||||||
if (titleID == TITLEID_SYSMENU)
|
if (titleID == TITLEID_SYSMENU)
|
||||||
HLE_IPC_CreateVirtualFATFilesystem();
|
HLE_IPC_CreateVirtualFATFilesystem();
|
||||||
// setup Wii memory
|
// setup Wii memory
|
||||||
if (!SetupWiiMemory(ContentLoader.GetCountry()))
|
if (!SetupWiiMemory(ContentLoader.GetRegion()))
|
||||||
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::Country::COUNTRY_JAPAN)
|
if (ContentLoader.GetRegion() == DiscIO::Region::NTSC_J)
|
||||||
{
|
{
|
||||||
VideoInterface::SetRegionReg('J');
|
VideoInterface::SetRegionReg('J');
|
||||||
}
|
}
|
||||||
|
|
|
@ -794,31 +794,28 @@ void SConfig::LoadDefaults()
|
||||||
m_revision = 0;
|
m_revision = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* GetRegionOfCountry(DiscIO::Country country)
|
static const char* GetDirectoryForRegion(DiscIO::Region region)
|
||||||
{
|
{
|
||||||
switch (country)
|
switch (region)
|
||||||
{
|
{
|
||||||
case DiscIO::Country::COUNTRY_USA:
|
case DiscIO::Region::NTSC_J:
|
||||||
return USA_DIR;
|
|
||||||
|
|
||||||
case DiscIO::Country::COUNTRY_TAIWAN:
|
|
||||||
case DiscIO::Country::COUNTRY_KOREA:
|
|
||||||
// TODO: Should these have their own Region Dir?
|
|
||||||
case DiscIO::Country::COUNTRY_JAPAN:
|
|
||||||
return JAP_DIR;
|
return JAP_DIR;
|
||||||
|
|
||||||
case DiscIO::Country::COUNTRY_AUSTRALIA:
|
case DiscIO::Region::NTSC_U:
|
||||||
case DiscIO::Country::COUNTRY_EUROPE:
|
return USA_DIR;
|
||||||
case DiscIO::Country::COUNTRY_FRANCE:
|
|
||||||
case DiscIO::Country::COUNTRY_GERMANY:
|
case DiscIO::Region::PAL:
|
||||||
case DiscIO::Country::COUNTRY_ITALY:
|
|
||||||
case DiscIO::Country::COUNTRY_NETHERLANDS:
|
|
||||||
case DiscIO::Country::COUNTRY_RUSSIA:
|
|
||||||
case DiscIO::Country::COUNTRY_SPAIN:
|
|
||||||
case DiscIO::Country::COUNTRY_WORLD:
|
|
||||||
return EUR_DIR;
|
return EUR_DIR;
|
||||||
|
|
||||||
case DiscIO::Country::COUNTRY_UNKNOWN:
|
case DiscIO::Region::NTSC_K:
|
||||||
|
// This function can't return a Korean directory name, because this
|
||||||
|
// function is only used for GameCube things (memory cards, IPL), and
|
||||||
|
// GameCube has no NTSC-K region. Since NTSC-K doesn't correspond to any
|
||||||
|
// GameCube region, let's return an arbitrary pick. Returning nullptr like
|
||||||
|
// with unknown regions would be inappropriate, because Dolphin expects
|
||||||
|
// to get valid memory card paths even when running an NTSC-K Wii game.
|
||||||
|
return JAP_DIR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -870,17 +867,19 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
// Check if we have a Wii disc
|
// Check if we have a Wii disc
|
||||||
bWii = pVolume->GetVolumeType() == DiscIO::Platform::WII_DISC;
|
bWii = pVolume->GetVolumeType() == DiscIO::Platform::WII_DISC;
|
||||||
|
|
||||||
const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry());
|
DiscIO::Region region = pVolume->GetRegion();
|
||||||
|
const char* retrieved_region_dir = GetDirectoryForRegion(region);
|
||||||
if (!retrieved_region_dir)
|
if (!retrieved_region_dir)
|
||||||
{
|
{
|
||||||
if (!PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)."
|
if (!PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)."
|
||||||
"\nContinue with PAL region?"))
|
"\nContinue with PAL region?"))
|
||||||
return false;
|
return false;
|
||||||
|
region = DiscIO::Region::PAL;
|
||||||
retrieved_region_dir = EUR_DIR;
|
retrieved_region_dir = EUR_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_region_dir = retrieved_region_dir;
|
set_region_dir = retrieved_region_dir;
|
||||||
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
bNTSC = region != DiscIO::Region::PAL;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
||||||
{
|
{
|
||||||
|
@ -932,7 +931,7 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
return false; // do not boot
|
return false; // do not boot
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* retrieved_region_dir = GetRegionOfCountry(ContentLoader.GetCountry());
|
const char* retrieved_region_dir = GetDirectoryForRegion(ContentLoader.GetRegion());
|
||||||
set_region_dir = retrieved_region_dir ? retrieved_region_dir : EUR_DIR;
|
set_region_dir = retrieved_region_dir ? retrieved_region_dir : EUR_DIR;
|
||||||
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder) : card_index(ind
|
||||||
|
|
||||||
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
{
|
{
|
||||||
DiscIO::Country country_code = DiscIO::Country::COUNTRY_UNKNOWN;
|
DiscIO::Region region = DiscIO::Region::UNKNOWN_REGION;
|
||||||
std::string game_id = SConfig::GetInstance().m_strGameID;
|
std::string game_id = SConfig::GetInstance().m_strGameID;
|
||||||
|
|
||||||
u32 CurrentGameId = 0;
|
u32 CurrentGameId = 0;
|
||||||
|
@ -163,26 +163,28 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
Common::FROM_SESSION_ROOT);
|
Common::FROM_SESSION_ROOT);
|
||||||
if (SysMenu_Loader.IsValid())
|
if (SysMenu_Loader.IsValid())
|
||||||
{
|
{
|
||||||
country_code = DiscIO::CountrySwitch(SysMenu_Loader.GetCountryChar());
|
region = DiscIO::RegionSwitchGC(SysMenu_Loader.GetCountryChar());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (game_id.length() >= 4)
|
else if (game_id.length() >= 4)
|
||||||
{
|
{
|
||||||
country_code = DiscIO::CountrySwitch(game_id.at(3));
|
region = DiscIO::RegionSwitchGC(game_id.at(3));
|
||||||
CurrentGameId = BE32((u8*)game_id.c_str());
|
CurrentGameId = BE32((u8*)game_id.c_str());
|
||||||
}
|
}
|
||||||
bool shift_jis = false;
|
bool shift_jis = false;
|
||||||
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
|
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
|
||||||
switch (country_code)
|
switch (region)
|
||||||
{
|
{
|
||||||
case DiscIO::Country::COUNTRY_JAPAN:
|
case DiscIO::Region::NTSC_J:
|
||||||
shift_jis = true;
|
shift_jis = true;
|
||||||
strDirectoryName += JAP_DIR DIR_SEP;
|
strDirectoryName += JAP_DIR DIR_SEP;
|
||||||
break;
|
break;
|
||||||
case DiscIO::Country::COUNTRY_USA:
|
case DiscIO::Region::NTSC_U:
|
||||||
strDirectoryName += USA_DIR DIR_SEP;
|
strDirectoryName += USA_DIR DIR_SEP;
|
||||||
break;
|
break;
|
||||||
case DiscIO::Country::COUNTRY_UNKNOWN:
|
case DiscIO::Region::PAL:
|
||||||
|
strDirectoryName += EUR_DIR DIR_SEP;
|
||||||
|
default:
|
||||||
{
|
{
|
||||||
// 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.
|
||||||
|
@ -199,24 +201,25 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
|
|
||||||
std::string memcardFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA :
|
std::string memcardFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA :
|
||||||
SConfig::GetInstance().m_strMemoryCardB;
|
SConfig::GetInstance().m_strMemoryCardB;
|
||||||
std::string region = memcardFilename.substr(memcardFilename.size() - 7, 3);
|
std::string region_string = memcardFilename.substr(memcardFilename.size() - 7, 3);
|
||||||
if (region == JAP_DIR)
|
if (region_string == JAP_DIR)
|
||||||
{
|
{
|
||||||
country_code = DiscIO::Country::COUNTRY_JAPAN;
|
region = DiscIO::Region::NTSC_J;
|
||||||
shift_jis = true;
|
shift_jis = true;
|
||||||
strDirectoryName += JAP_DIR DIR_SEP;
|
strDirectoryName += JAP_DIR DIR_SEP;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else if (region == USA_DIR)
|
else if (region_string == USA_DIR)
|
||||||
{
|
{
|
||||||
country_code = DiscIO::Country::COUNTRY_USA;
|
region = DiscIO::Region::NTSC_U;
|
||||||
strDirectoryName += USA_DIR DIR_SEP;
|
strDirectoryName += USA_DIR DIR_SEP;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region = DiscIO::Region::PAL;
|
||||||
|
strDirectoryName += EUR_DIR DIR_SEP;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
country_code = DiscIO::Country::COUNTRY_EUROPE;
|
|
||||||
strDirectoryName += EUR_DIR DIR_SEP;
|
|
||||||
}
|
}
|
||||||
strDirectoryName += StringFromFormat("Card %c", 'A' + card_index);
|
strDirectoryName += StringFromFormat("Card %c", 'A' + card_index);
|
||||||
|
|
||||||
|
@ -243,7 +246,7 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
}
|
}
|
||||||
|
|
||||||
memorycard = std::make_unique<GCMemcardDirectory>(strDirectoryName + DIR_SEP, card_index, sizeMb,
|
memorycard = std::make_unique<GCMemcardDirectory>(strDirectoryName + DIR_SEP, card_index, sizeMb,
|
||||||
shift_jis, country_code, CurrentGameId);
|
shift_jis, region, CurrentGameId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEXIMemoryCard::SetupRawMemcard(u16 sizeMb)
|
void CEXIMemoryCard::SetupRawMemcard(u16 sizeMb)
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct Header // Offset Size Description
|
||||||
// end Serial in libogc
|
// end Serial in libogc
|
||||||
u8 deviceID[2]; // 0x0020 2 0 if formated in slot A 1 if formated in slot B
|
u8 deviceID[2]; // 0x0020 2 0 if formated in slot A 1 if formated in slot B
|
||||||
u8 SizeMb[2]; // 0x0022 2 Size of memcard in Mbits
|
u8 SizeMb[2]; // 0x0022 2 Size of memcard in Mbits
|
||||||
u16 Encoding; // 0x0024 2 Encoding (ASCII or Japanese)
|
u16 Encoding; // 0x0024 2 Encoding (Windows-1252 or Shift JIS)
|
||||||
u8 Unused1[468]; // 0x0026 468 Unused (0xff)
|
u8 Unused1[468]; // 0x0026 468 Unused (0xff)
|
||||||
u16 UpdateCounter; // 0x01fa 2 Update Counter (?, probably unused)
|
u16 UpdateCounter; // 0x01fa 2 Update Counter (?, probably unused)
|
||||||
u16 Checksum; // 0x01fc 2 Additive Checksum
|
u16 Checksum; // 0x01fc 2 Additive Checksum
|
||||||
|
|
|
@ -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::Country card_region,
|
int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Region card_region,
|
||||||
bool currentGameOnly)
|
bool currentGameOnly)
|
||||||
{
|
{
|
||||||
File::IOFile gcifile(fileName, "rb");
|
File::IOFile gcifile(fileName, "rb");
|
||||||
|
@ -39,27 +39,12 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Country car
|
||||||
return NO_INDEX;
|
return NO_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiscIO::Country gci_region;
|
DiscIO::Region gci_region = DiscIO::RegionSwitchGC(gci.m_gci_header.Gamecode[3]);
|
||||||
// check region
|
// Some special save files have game IDs that we parse as UNKNOWN_REGION. For instance:
|
||||||
switch (gci.m_gci_header.Gamecode[3])
|
// - Datel Action Replay uses C as the fourth character. (Can be on any region's card.)
|
||||||
{
|
// - Homeland's network config file only uses null bytes. (Homeland is exclusive to Japan,
|
||||||
case 'J':
|
// but maybe the network config file ID was intended to be used in other regions too.)
|
||||||
gci_region = DiscIO::Country::COUNTRY_JAPAN;
|
if (card_region != gci_region && gci_region != DiscIO::Region::UNKNOWN_REGION)
|
||||||
break;
|
|
||||||
case 'E':
|
|
||||||
gci_region = DiscIO::Country::COUNTRY_USA;
|
|
||||||
break;
|
|
||||||
case 'C':
|
|
||||||
// Used by Datel Action Replay Save
|
|
||||||
// can be on any regions card
|
|
||||||
gci_region = card_region;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
gci_region = DiscIO::Country::COUNTRY_EUROPE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gci_region != card_region)
|
|
||||||
{
|
{
|
||||||
PanicAlertT(
|
PanicAlertT(
|
||||||
"GCI save file was not loaded because it is the wrong region for this memory card:\n%s",
|
"GCI save file was not loaded because it is the wrong region for this memory card:\n%s",
|
||||||
|
@ -146,7 +131,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& fileName, DiscIO::Country car
|
||||||
}
|
}
|
||||||
|
|
||||||
GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb,
|
GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, int slot, u16 sizeMb,
|
||||||
bool shift_jis, DiscIO::Country card_region, int gameId)
|
bool shift_jis, DiscIO::Region card_region, int gameId)
|
||||||
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1),
|
: MemoryCardBase(slot, sizeMb), m_GameId(gameId), m_LastBlock(-1),
|
||||||
m_hdr(slot, sizeMb, shift_jis), m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory),
|
m_hdr(slot, sizeMb, shift_jis), m_bat1(sizeMb), m_saves(0), m_SaveDirectory(directory),
|
||||||
m_exiting(false)
|
m_exiting(false)
|
||||||
|
|
|
@ -22,9 +22,8 @@ void MigrateFromMemcardFile(const std::string& strDirectoryName, int card_index)
|
||||||
class GCMemcardDirectory : public MemoryCardBase, NonCopyable
|
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, u16 sizeMb, bool shift_jis,
|
||||||
bool shift_jis = false,
|
DiscIO::Region card_region, int gameId);
|
||||||
DiscIO::Country card_region = DiscIO::Country::COUNTRY_EUROPE, int gameId = 0);
|
|
||||||
~GCMemcardDirectory();
|
~GCMemcardDirectory();
|
||||||
void FlushToFile();
|
void FlushToFile();
|
||||||
void FlushThread();
|
void FlushThread();
|
||||||
|
@ -35,7 +34,7 @@ public:
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int LoadGCI(const std::string& fileName, DiscIO::Country card_region, bool currentGameOnly);
|
int LoadGCI(const std::string& fileName, DiscIO::Region card_region, 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);
|
||||||
|
|
|
@ -13,6 +13,50 @@ namespace DiscIO
|
||||||
{
|
{
|
||||||
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
|
// Increment CACHE_REVISION (ISOFile.cpp & GameFile.cpp) if the code below is modified
|
||||||
|
|
||||||
|
Region RegionSwitchGC(u8 country_code)
|
||||||
|
{
|
||||||
|
Region region = RegionSwitchWii(country_code);
|
||||||
|
return region == Region::NTSC_K ? Region::UNKNOWN_REGION : region;
|
||||||
|
}
|
||||||
|
|
||||||
|
Region RegionSwitchWii(u8 country_code)
|
||||||
|
{
|
||||||
|
switch (country_code)
|
||||||
|
{
|
||||||
|
case 'J':
|
||||||
|
case 'W':
|
||||||
|
return Region::NTSC_J;
|
||||||
|
|
||||||
|
case 'B':
|
||||||
|
case 'E':
|
||||||
|
case 'N':
|
||||||
|
case 'Z':
|
||||||
|
return Region::NTSC_U;
|
||||||
|
|
||||||
|
case 'D':
|
||||||
|
case 'F':
|
||||||
|
case 'H':
|
||||||
|
case 'I':
|
||||||
|
case 'L':
|
||||||
|
case 'M':
|
||||||
|
case 'P':
|
||||||
|
case 'R':
|
||||||
|
case 'S':
|
||||||
|
case 'U':
|
||||||
|
case 'X':
|
||||||
|
case 'Y':
|
||||||
|
return Region::PAL;
|
||||||
|
|
||||||
|
case 'K':
|
||||||
|
case 'Q':
|
||||||
|
case 'T':
|
||||||
|
return Region::NTSC_K;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return Region::UNKNOWN_REGION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Country CountrySwitch(u8 country_code)
|
Country CountrySwitch(u8 country_code)
|
||||||
{
|
{
|
||||||
switch (country_code)
|
switch (country_code)
|
||||||
|
|
|
@ -38,6 +38,16 @@ enum class Country
|
||||||
NUMBER_OF_COUNTRIES
|
NUMBER_OF_COUNTRIES
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Regions 0 - 2 and 4 match Nintendo's Wii region numbering.
|
||||||
|
enum class Region
|
||||||
|
{
|
||||||
|
NTSC_J = 0, // Japan and Taiwan
|
||||||
|
NTSC_U = 1, // Mainly North America
|
||||||
|
PAL = 2, // Mainly Europe and Oceania
|
||||||
|
UNKNOWN_REGION = 3, // 3 seems to be unused? Anyway, we need an UNKNOWN_REGION. Let's put it here
|
||||||
|
NTSC_K = 4 // South Korea (Wii only)
|
||||||
|
};
|
||||||
|
|
||||||
// Languages 0 - 9 match Nintendo's Wii language numbering.
|
// Languages 0 - 9 match Nintendo's Wii language numbering.
|
||||||
// Languages 1 - 6 match Nintendo's PAL GameCube languages 0 - 5.
|
// Languages 1 - 6 match Nintendo's PAL GameCube languages 0 - 5.
|
||||||
// NTSC GameCubes only support one language and thus don't number languages.
|
// NTSC GameCubes only support one language and thus don't number languages.
|
||||||
|
@ -56,6 +66,8 @@ enum class Language
|
||||||
LANGUAGE_UNKNOWN
|
LANGUAGE_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Region RegionSwitchGC(u8 country_code);
|
||||||
|
Region RegionSwitchWii(u8 country_code);
|
||||||
Country CountrySwitch(u8 country_code);
|
Country CountrySwitch(u8 country_code);
|
||||||
u8 GetSysMenuRegion(u16 title_version);
|
u8 GetSysMenuRegion(u16 title_version);
|
||||||
std::string GetCompanyFromID(const std::string& company_id);
|
std::string GetCompanyFromID(const std::string& company_id);
|
||||||
|
|
|
@ -311,12 +311,12 @@ 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::Country CNANDContentLoader::GetCountry() const
|
DiscIO::Region CNANDContentLoader::GetRegion() const
|
||||||
{
|
{
|
||||||
if (!IsValid())
|
if (!IsValid())
|
||||||
return DiscIO::Country::COUNTRY_UNKNOWN;
|
return DiscIO::Region::UNKNOWN_REGION;
|
||||||
|
|
||||||
return CountrySwitch(m_Country);
|
return RegionSwitchWii(m_Country);
|
||||||
}
|
}
|
||||||
|
|
||||||
CNANDContentManager::~CNANDContentManager()
|
CNANDContentManager::~CNANDContentManager()
|
||||||
|
|
|
@ -20,7 +20,7 @@ class IOFile;
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
enum class Country;
|
enum class Region;
|
||||||
|
|
||||||
bool AddTicket(u64 title_id, const std::vector<u8>& ticket);
|
bool AddTicket(u64 title_id, const std::vector<u8>& ticket);
|
||||||
|
|
||||||
|
@ -94,7 +94,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::Country GetCountry() const;
|
DiscIO::Region GetRegion() const;
|
||||||
u8 GetCountryChar() const { return m_Country; }
|
u8 GetCountryChar() const { return m_Country; }
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
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 Region GetRegion() const = 0;
|
||||||
virtual Country 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)
|
||||||
|
@ -71,12 +72,7 @@ protected:
|
||||||
// strnlen to trim NULLs
|
// strnlen to trim NULLs
|
||||||
std::string string(data, strnlen(data, sizeof(data)));
|
std::string string(data, strnlen(data, sizeof(data)));
|
||||||
|
|
||||||
// There doesn't seem to be any GC discs with the country set to Taiwan...
|
if (GetRegion() == Region::NTSC_J)
|
||||||
// But maybe they would use Shift_JIS if they existed? Not sure
|
|
||||||
bool use_shift_jis =
|
|
||||||
(Country::COUNTRY_JAPAN == GetCountry() || Country::COUNTRY_TAIWAN == GetCountry());
|
|
||||||
|
|
||||||
if (use_shift_jis)
|
|
||||||
return SHIFTJISToUTF8(string);
|
return SHIFTJISToUTF8(string);
|
||||||
else
|
else
|
||||||
return CP1252ToUTF8(string);
|
return CP1252ToUTF8(string);
|
||||||
|
|
|
@ -166,6 +166,14 @@ void CVolumeDirectory::SetGameID(const std::string& id)
|
||||||
memcpy(m_disk_header.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH));
|
memcpy(m_disk_header.data(), id.c_str(), std::min(id.length(), MAX_ID_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region CVolumeDirectory::GetRegion() const
|
||||||
|
{
|
||||||
|
if (m_is_wii)
|
||||||
|
return RegionSwitchWii(m_disk_header[3]);
|
||||||
|
|
||||||
|
return RegionSwitchGC(m_disk_header[3]);
|
||||||
|
}
|
||||||
|
|
||||||
Country CVolumeDirectory::GetCountry() const
|
Country CVolumeDirectory::GetCountry() const
|
||||||
{
|
{
|
||||||
return CountrySwitch(m_disk_header[3]);
|
return CountrySwitch(m_disk_header[3]);
|
||||||
|
|
|
@ -26,6 +26,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeDirectory : public IVolume
|
class CVolumeDirectory : public IVolume
|
||||||
|
@ -56,6 +57,7 @@ public:
|
||||||
std::string GetApploaderDate() const override;
|
std::string GetApploaderDate() const override;
|
||||||
Platform GetVolumeType() const override;
|
Platform GetVolumeType() const override;
|
||||||
|
|
||||||
|
Region GetRegion() const override;
|
||||||
Country GetCountry() const override;
|
Country GetCountry() const override;
|
||||||
|
|
||||||
BlobType GetBlobType() const override;
|
BlobType GetBlobType() const override;
|
||||||
|
|
|
@ -61,13 +61,20 @@ std::string CVolumeGC::GetGameID() const
|
||||||
return DecodeString(ID);
|
return DecodeString(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region CVolumeGC::GetRegion() const
|
||||||
|
{
|
||||||
|
u8 country_code;
|
||||||
|
if (!m_pReader->Read(3, 1, &country_code))
|
||||||
|
return Region::UNKNOWN_REGION;
|
||||||
|
|
||||||
|
return RegionSwitchGC(country_code);
|
||||||
|
}
|
||||||
|
|
||||||
Country CVolumeGC::GetCountry() const
|
Country CVolumeGC::GetCountry() const
|
||||||
{
|
{
|
||||||
if (!m_pReader)
|
|
||||||
return Country::COUNTRY_UNKNOWN;
|
|
||||||
|
|
||||||
u8 country_code;
|
u8 country_code;
|
||||||
m_pReader->Read(3, 1, &country_code);
|
if (!m_pReader->Read(3, 1, &country_code))
|
||||||
|
return Country::COUNTRY_UNKNOWN;
|
||||||
|
|
||||||
return CountrySwitch(country_code);
|
return CountrySwitch(country_code);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +254,7 @@ void CVolumeGC::ExtractBannerInformation(const GCBanner& banner_file, bool is_bn
|
||||||
|
|
||||||
if (is_bnr1) // NTSC
|
if (is_bnr1) // NTSC
|
||||||
{
|
{
|
||||||
bool is_japanese = GetCountry() == Country::COUNTRY_JAPAN;
|
bool is_japanese = GetRegion() == Region::NTSC_J;
|
||||||
number_of_languages = 1;
|
number_of_languages = 1;
|
||||||
start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH;
|
start_language = is_japanese ? Language::LANGUAGE_JAPANESE : Language::LANGUAGE_ENGLISH;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeGC : public IVolume
|
class CVolumeGC : public IVolume
|
||||||
|
@ -42,6 +43,7 @@ public:
|
||||||
u8 GetDiscNumber() const override;
|
u8 GetDiscNumber() const override;
|
||||||
|
|
||||||
Platform GetVolumeType() const override;
|
Platform GetVolumeType() const override;
|
||||||
|
Region GetRegion() const override;
|
||||||
Country GetCountry() const override;
|
Country GetCountry() const override;
|
||||||
BlobType GetBlobType() const override;
|
BlobType GetBlobType() const override;
|
||||||
u64 GetSize() const override;
|
u64 GetSize() const override;
|
||||||
|
|
|
@ -57,14 +57,21 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region CVolumeWAD::GetRegion() const
|
||||||
|
{
|
||||||
|
u8 country_code;
|
||||||
|
if (!Read(m_tmd_offset + 0x0193, 1, &country_code))
|
||||||
|
return Region::UNKNOWN_REGION;
|
||||||
|
|
||||||
|
return RegionSwitchWii(country_code);
|
||||||
|
}
|
||||||
|
|
||||||
Country CVolumeWAD::GetCountry() const
|
Country CVolumeWAD::GetCountry() const
|
||||||
{
|
{
|
||||||
if (!m_pReader)
|
|
||||||
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;
|
||||||
Read(m_tmd_offset + 0x0193, 1, &country_code);
|
if (!Read(m_tmd_offset + 0x0193, 1, &country_code))
|
||||||
|
return Country::COUNTRY_UNKNOWN;
|
||||||
|
|
||||||
if (country_code == 2) // SYSMENU
|
if (country_code == 2) // SYSMENU
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeWAD : public IVolume
|
class CVolumeWAD : public IVolume
|
||||||
|
@ -39,6 +40,7 @@ public:
|
||||||
u64 GetFSTSize() const override { return 0; }
|
u64 GetFSTSize() const override { return 0; }
|
||||||
std::string GetApploaderDate() const override { return ""; }
|
std::string GetApploaderDate() const override { return ""; }
|
||||||
Platform GetVolumeType() const override;
|
Platform GetVolumeType() const override;
|
||||||
|
Region GetRegion() const override;
|
||||||
Country GetCountry() const override;
|
Country GetCountry() const override;
|
||||||
|
|
||||||
BlobType GetBlobType() const override;
|
BlobType GetBlobType() const override;
|
||||||
|
|
|
@ -153,51 +153,38 @@ std::string CVolumeWiiCrypted::GetGameID() const
|
||||||
return DecodeString(ID);
|
return DecodeString(ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Region CVolumeWiiCrypted::GetRegion() const
|
||||||
|
{
|
||||||
|
u32 region_code;
|
||||||
|
if (!ReadSwapped(0x4E000, ®ion_code, false))
|
||||||
|
return Region::UNKNOWN_REGION;
|
||||||
|
|
||||||
|
return static_cast<Region>(region_code);
|
||||||
|
}
|
||||||
|
|
||||||
Country CVolumeWiiCrypted::GetCountry() const
|
Country CVolumeWiiCrypted::GetCountry() const
|
||||||
{
|
{
|
||||||
if (!m_pReader)
|
|
||||||
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::COUNTRY_UNKNOWN;
|
||||||
|
|
||||||
Country country_value = CountrySwitch(country_byte);
|
const Region region = GetRegion();
|
||||||
|
|
||||||
u32 region_code;
|
if (RegionSwitchWii(country_byte) == region)
|
||||||
if (!ReadSwapped(0x4E000, ®ion_code, false))
|
return CountrySwitch(country_byte);
|
||||||
return country_value;
|
|
||||||
|
|
||||||
switch (region_code)
|
switch (region)
|
||||||
{
|
{
|
||||||
case 0:
|
case Region::NTSC_J:
|
||||||
switch (country_value)
|
return Country::COUNTRY_JAPAN;
|
||||||
{
|
case Region::NTSC_U:
|
||||||
case Country::COUNTRY_TAIWAN:
|
|
||||||
return Country::COUNTRY_TAIWAN;
|
|
||||||
default:
|
|
||||||
return Country::COUNTRY_JAPAN;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
return Country::COUNTRY_USA;
|
return Country::COUNTRY_USA;
|
||||||
case 2:
|
case Region::PAL:
|
||||||
switch (country_value)
|
return Country::COUNTRY_EUROPE;
|
||||||
{
|
case Region::NTSC_K:
|
||||||
case Country::COUNTRY_FRANCE:
|
|
||||||
case Country::COUNTRY_GERMANY:
|
|
||||||
case Country::COUNTRY_ITALY:
|
|
||||||
case Country::COUNTRY_NETHERLANDS:
|
|
||||||
case Country::COUNTRY_RUSSIA:
|
|
||||||
case Country::COUNTRY_SPAIN:
|
|
||||||
case Country::COUNTRY_AUSTRALIA:
|
|
||||||
return country_value;
|
|
||||||
default:
|
|
||||||
return Country::COUNTRY_EUROPE;
|
|
||||||
}
|
|
||||||
case 4:
|
|
||||||
return Country::COUNTRY_KOREA;
|
return Country::COUNTRY_KOREA;
|
||||||
default:
|
default:
|
||||||
return country_value;
|
return Country::COUNTRY_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
|
|
||||||
class CVolumeWiiCrypted : public IVolume
|
class CVolumeWiiCrypted : public IVolume
|
||||||
|
@ -46,6 +47,7 @@ public:
|
||||||
bool CheckIntegrity() const override;
|
bool CheckIntegrity() const override;
|
||||||
bool ChangePartition(u64 offset) override;
|
bool ChangePartition(u64 offset) override;
|
||||||
|
|
||||||
|
Region GetRegion() const override;
|
||||||
Country GetCountry() const override;
|
Country GetCountry() const override;
|
||||||
BlobType GetBlobType() const override;
|
BlobType GetBlobType() const override;
|
||||||
u64 GetSize() const override;
|
u64 GetSize() const override;
|
||||||
|
|
|
@ -155,6 +155,7 @@ bool GameFile::TryLoadVolume()
|
||||||
m_descriptions = ConvertLanguageMap(volume->GetDescriptions());
|
m_descriptions = ConvertLanguageMap(volume->GetDescriptions());
|
||||||
m_disc_number = volume->GetDiscNumber();
|
m_disc_number = volume->GetDiscNumber();
|
||||||
m_platform = volume->GetVolumeType();
|
m_platform = volume->GetVolumeType();
|
||||||
|
m_region = volume->GetRegion();
|
||||||
m_country = volume->GetCountry();
|
m_country = volume->GetCountry();
|
||||||
m_blob_type = volume->GetBlobType();
|
m_blob_type = volume->GetBlobType();
|
||||||
m_raw_size = volume->GetRawSize();
|
m_raw_size = volume->GetRawSize();
|
||||||
|
@ -174,6 +175,7 @@ bool GameFile::TryLoadElfDol()
|
||||||
m_revision = 0;
|
m_revision = 0;
|
||||||
m_long_names[DiscIO::Language::LANGUAGE_ENGLISH] = m_file_name;
|
m_long_names[DiscIO::Language::LANGUAGE_ENGLISH] = m_file_name;
|
||||||
m_platform = DiscIO::Platform::ELF_DOL;
|
m_platform = DiscIO::Platform::ELF_DOL;
|
||||||
|
m_region = DiscIO::Region::UNKNOWN_REGION;
|
||||||
m_country = DiscIO::Country::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;
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
class IVolume;
|
class IVolume;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@ public:
|
||||||
QString GetApploaderDate() const { return m_apploader_date; }
|
QString GetApploaderDate() const { return m_apploader_date; }
|
||||||
DiscIO::Platform GetPlatformID() const { return m_platform; }
|
DiscIO::Platform GetPlatformID() const { return m_platform; }
|
||||||
QString GetPlatform() const;
|
QString GetPlatform() const;
|
||||||
|
DiscIO::Region GetRegion() const { return m_region; }
|
||||||
DiscIO::Country 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; }
|
||||||
|
@ -96,6 +98,7 @@ private:
|
||||||
QMap<DiscIO::Language, 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::Region m_region;
|
||||||
DiscIO::Platform m_platform;
|
DiscIO::Platform m_platform;
|
||||||
DiscIO::Country m_country;
|
DiscIO::Country m_country;
|
||||||
DiscIO::BlobType m_blob_type;
|
DiscIO::BlobType m_blob_type;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "DolphinWX/ISOFile.h"
|
#include "DolphinWX/ISOFile.h"
|
||||||
#include "DolphinWX/WxUtils.h"
|
#include "DolphinWX/WxUtils.h"
|
||||||
|
|
||||||
static const u32 CACHE_REVISION = 0x127; // Last changed in PR 3309
|
static const u32 CACHE_REVISION = 0x128; // Last changed in PR 4542
|
||||||
|
|
||||||
static std::string GetLanguageString(DiscIO::Language language,
|
static std::string GetLanguageString(DiscIO::Language language,
|
||||||
std::map<DiscIO::Language, std::string> strings)
|
std::map<DiscIO::Language, std::string> strings)
|
||||||
|
@ -64,8 +64,9 @@ static std::string GetLanguageString(DiscIO::Language 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::Country::COUNTRY_UNKNOWN), m_Revision(0), m_Valid(false), m_ImageWidth(0),
|
m_region(DiscIO::Region::UNKNOWN_REGION), m_Country(DiscIO::Country::COUNTRY_UNKNOWN),
|
||||||
m_ImageHeight(0), m_disc_number(0), m_has_custom_name(false)
|
m_Revision(0), m_Valid(false), m_ImageWidth(0), m_ImageHeight(0), m_disc_number(0),
|
||||||
|
m_has_custom_name(false)
|
||||||
{
|
{
|
||||||
if (LoadFromCache())
|
if (LoadFromCache())
|
||||||
{
|
{
|
||||||
|
@ -99,6 +100,7 @@ GameListItem::GameListItem(const std::string& _rFileName,
|
||||||
if (m_company.empty())
|
if (m_company.empty())
|
||||||
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetShortMakers());
|
m_company = GetLanguageString(DiscIO::Language::LANGUAGE_ENGLISH, volume->GetShortMakers());
|
||||||
|
|
||||||
|
m_region = volume->GetRegion();
|
||||||
m_Country = volume->GetCountry();
|
m_Country = volume->GetCountry();
|
||||||
m_blob_type = volume->GetBlobType();
|
m_blob_type = volume->GetBlobType();
|
||||||
m_FileSize = volume->GetRawSize();
|
m_FileSize = volume->GetRawSize();
|
||||||
|
@ -214,6 +216,7 @@ void GameListItem::DoState(PointerWrap& p)
|
||||||
p.Do(m_title_id);
|
p.Do(m_title_id);
|
||||||
p.Do(m_FileSize);
|
p.Do(m_FileSize);
|
||||||
p.Do(m_VolumeSize);
|
p.Do(m_VolumeSize);
|
||||||
|
p.Do(m_region);
|
||||||
p.Do(m_Country);
|
p.Do(m_Country);
|
||||||
p.Do(m_blob_type);
|
p.Do(m_blob_type);
|
||||||
p.Do(m_pImage);
|
p.Do(m_pImage);
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace DiscIO
|
||||||
enum class BlobType;
|
enum class BlobType;
|
||||||
enum class Country;
|
enum class Country;
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
enum class Platform;
|
enum class Platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +49,7 @@ public:
|
||||||
u16 GetRevision() const { return m_Revision; }
|
u16 GetRevision() const { return m_Revision; }
|
||||||
const std::string& GetGameID() const { return m_game_id; }
|
const std::string& GetGameID() const { return m_game_id; }
|
||||||
const std::string GetWiiFSPath() const;
|
const std::string GetWiiFSPath() const;
|
||||||
|
DiscIO::Region GetRegion() const { return m_region; }
|
||||||
DiscIO::Country GetCountry() const { return m_Country; }
|
DiscIO::Country GetCountry() const { return m_Country; }
|
||||||
DiscIO::Platform 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; }
|
||||||
|
@ -82,6 +84,7 @@ private:
|
||||||
u64 m_FileSize;
|
u64 m_FileSize;
|
||||||
u64 m_VolumeSize;
|
u64 m_VolumeSize;
|
||||||
|
|
||||||
|
DiscIO::Region m_region;
|
||||||
DiscIO::Country m_Country;
|
DiscIO::Country m_Country;
|
||||||
DiscIO::Platform m_Platform;
|
DiscIO::Platform m_Platform;
|
||||||
DiscIO::BlobType m_blob_type;
|
DiscIO::BlobType m_blob_type;
|
||||||
|
|
Loading…
Reference in New Issue