SConfig: Replace bNTSC with m_region
This lets us get rid of VideoInterface::SetRegionReg, a huge hack in CEXIMemoryCard, and some minor things.
This commit is contained in:
parent
66ea9f5cc1
commit
f85266df20
|
@ -188,32 +188,34 @@ bool CBoot::Load_BS2(const std::string& _rBootROMFilename)
|
||||||
// Use zlibs crc32 implementation to compute the hash
|
// Use zlibs crc32 implementation to compute the hash
|
||||||
u32 ipl_hash = crc32(0L, Z_NULL, 0);
|
u32 ipl_hash = crc32(0L, Z_NULL, 0);
|
||||||
ipl_hash = crc32(ipl_hash, (const Bytef*)data.data(), (u32)data.size());
|
ipl_hash = crc32(ipl_hash, (const Bytef*)data.data(), (u32)data.size());
|
||||||
std::string ipl_region;
|
DiscIO::Region ipl_region;
|
||||||
switch (ipl_hash)
|
switch (ipl_hash)
|
||||||
{
|
{
|
||||||
case USA_v1_0:
|
case USA_v1_0:
|
||||||
case USA_v1_1:
|
case USA_v1_1:
|
||||||
case USA_v1_2:
|
case USA_v1_2:
|
||||||
case BRA_v1_0:
|
case BRA_v1_0:
|
||||||
ipl_region = USA_DIR;
|
ipl_region = DiscIO::Region::NTSC_U;
|
||||||
break;
|
break;
|
||||||
case JAP_v1_0:
|
case JAP_v1_0:
|
||||||
case JAP_v1_1:
|
case JAP_v1_1:
|
||||||
ipl_region = JAP_DIR;
|
ipl_region = DiscIO::Region::NTSC_J;
|
||||||
break;
|
break;
|
||||||
case PAL_v1_0:
|
case PAL_v1_0:
|
||||||
case PAL_v1_2:
|
case PAL_v1_2:
|
||||||
ipl_region = EUR_DIR;
|
ipl_region = DiscIO::Region::PAL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicAlertT("IPL with unknown hash %x", ipl_hash);
|
PanicAlertT("IPL with unknown hash %x", ipl_hash);
|
||||||
|
ipl_region = DiscIO::Region::UNKNOWN_REGION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BootRegion = _rBootROMFilename.substr(_rBootROMFilename.find_last_of(DIR_SEP) - 3, 3);
|
const DiscIO::Region boot_region = SConfig::GetInstance().m_region;
|
||||||
if (BootRegion != ipl_region)
|
if (ipl_region != DiscIO::Region::UNKNOWN_REGION && boot_region != ipl_region)
|
||||||
PanicAlertT("%s IPL found in %s directory. The disc might not be recognized",
|
PanicAlertT("%s IPL found in %s directory. The disc might not be recognized",
|
||||||
ipl_region.c_str(), BootRegion.c_str());
|
SConfig::GetDirectoryForRegion(ipl_region),
|
||||||
|
SConfig::GetDirectoryForRegion(boot_region));
|
||||||
|
|
||||||
// Run the descrambler over the encrypted section containing BS1/BS2
|
// Run the descrambler over the encrypted section containing BS1/BS2
|
||||||
CEXIIPL::Descrambler((u8*)data.data() + 0x100, 0x1AFE00);
|
CEXIIPL::Descrambler((u8*)data.data() + 0x100, 0x1AFE00);
|
||||||
|
@ -255,7 +257,8 @@ bool CBoot::BootUp()
|
||||||
g_symbolDB.Clear();
|
g_symbolDB.Clear();
|
||||||
|
|
||||||
// PAL Wii uses NTSC framerate and linecount in 60Hz modes
|
// PAL Wii uses NTSC framerate and linecount in 60Hz modes
|
||||||
VideoInterface::Preset(_StartupPara.bNTSC || (_StartupPara.bWii && _StartupPara.bPAL60));
|
VideoInterface::Preset(DiscIO::IsNTSC(_StartupPara.m_region) ||
|
||||||
|
(_StartupPara.bWii && _StartupPara.bPAL60));
|
||||||
|
|
||||||
switch (_StartupPara.m_BootType)
|
switch (_StartupPara.m_BootType)
|
||||||
{
|
{
|
||||||
|
@ -275,8 +278,6 @@ bool CBoot::BootUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string game_id = DVDInterface::GetVolume().GetGameID();
|
std::string game_id = DVDInterface::GetVolume().GetGameID();
|
||||||
if (game_id.size() >= 4)
|
|
||||||
VideoInterface::SetRegionReg(game_id.at(3));
|
|
||||||
|
|
||||||
std::vector<u8> tmd_buffer = pVolume.GetTMD();
|
std::vector<u8> tmd_buffer = pVolume.GetTMD();
|
||||||
if (!tmd_buffer.empty())
|
if (!tmd_buffer.empty())
|
||||||
|
@ -419,7 +420,7 @@ bool CBoot::BootUp()
|
||||||
|
|
||||||
// Poor man's bootup
|
// Poor man's bootup
|
||||||
if (_StartupPara.bWii)
|
if (_StartupPara.bWii)
|
||||||
SetupWiiMemory(DiscIO::Region::UNKNOWN_REGION);
|
SetupWiiMemory();
|
||||||
else
|
else
|
||||||
EmulatedBS2_GC(true);
|
EmulatedBS2_GC(true);
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,6 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace DiscIO
|
|
||||||
{
|
|
||||||
enum class Region;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct RegionSetting
|
struct RegionSetting
|
||||||
{
|
{
|
||||||
const std::string area;
|
const std::string area;
|
||||||
|
@ -57,5 +52,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::Region region);
|
static bool SetupWiiMemory();
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,8 +74,8 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
|
||||||
0x10000006,
|
0x10000006,
|
||||||
0x8000002C); // Console type - DevKit (retail ID == 0x00000003) see YAGCD 4.2.1.1.2
|
0x8000002C); // Console type - DevKit (retail ID == 0x00000003) see YAGCD 4.2.1.1.2
|
||||||
|
|
||||||
PowerPC::HostWrite_U32(SConfig::GetInstance().bNTSC ? 0 : 1,
|
const bool ntsc = DiscIO::IsNTSC(SConfig::GetInstance().m_region);
|
||||||
0x800000CC); // Fake the VI Init of the IPL (YAGCD 4.2.1.4)
|
PowerPC::HostWrite_U32(ntsc ? 0 : 1, 0x800000CC); // Fake the VI Init of the IPL (YAGCD 4.2.1.4)
|
||||||
|
|
||||||
PowerPC::HostWrite_U32(0x01000000, 0x800000d0); // ARAM Size. 16MB main + 4/16/32MB external
|
PowerPC::HostWrite_U32(0x01000000, 0x800000d0); // ARAM Size. 16MB main + 4/16/32MB external
|
||||||
// (retail consoles have no external ARAM)
|
// (retail consoles have no external ARAM)
|
||||||
|
@ -113,13 +113,14 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
|
||||||
DVDRead(apploader_offset + 0x20, 0x01200000, apploader_size + apploader_trailer, false);
|
DVDRead(apploader_offset + 0x20, 0x01200000, apploader_size + apploader_trailer, false);
|
||||||
|
|
||||||
// Setup pointers like real BS2 does
|
// Setup pointers like real BS2 does
|
||||||
if (SConfig::GetInstance().bNTSC)
|
if (ntsc)
|
||||||
{
|
{
|
||||||
PowerPC::ppcState.gpr[1] = 0x81566550; // StackPointer, used to be set to 0x816ffff0
|
// StackPointer, used to be set to 0x816ffff0
|
||||||
PowerPC::ppcState.gpr[2] = 0x81465cc0; // Global pointer to Small Data Area 2 Base (haven't
|
PowerPC::ppcState.gpr[1] = 0x81566550;
|
||||||
// seen anything use it...meh)
|
// Global pointer to Small Data Area 2 Base (haven't seen anything use it...meh)
|
||||||
PowerPC::ppcState.gpr[13] =
|
PowerPC::ppcState.gpr[2] = 0x81465cc0;
|
||||||
0x81465320; // Global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
|
// Global pointer to Small Data Area Base (Luigi's Mansion's apploader uses it)
|
||||||
|
PowerPC::ppcState.gpr[13] = 0x81465320;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -181,22 +182,15 @@ bool CBoot::EmulatedBS2_GC(bool skipAppLoader)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBoot::SetupWiiMemory(DiscIO::Region region)
|
bool CBoot::SetupWiiMemory()
|
||||||
{
|
{
|
||||||
static const RegionSetting SETTING_NTSC_J = {"JPN", "NTSC", "JP", "LJ"};
|
|
||||||
static const RegionSetting SETTING_NTSC_U = {"USA", "NTSC", "US", "LU"};
|
|
||||||
static const RegionSetting SETTING_PAL = {"EUR", "PAL", "EU", "LE"};
|
|
||||||
static const RegionSetting SETTING_NTSC_K = {"KOR", "NTSC", "KR", "LKH"};
|
|
||||||
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
static const std::map<DiscIO::Region, const RegionSetting> region_settings = {
|
||||||
{DiscIO::Region::NTSC_J, SETTING_NTSC_J},
|
{DiscIO::Region::NTSC_J, {"JPN", "NTSC", "JP", "LJ"}},
|
||||||
{DiscIO::Region::NTSC_U, SETTING_NTSC_U},
|
{DiscIO::Region::NTSC_U, {"USA", "NTSC", "US", "LU"}},
|
||||||
{DiscIO::Region::PAL, SETTING_PAL},
|
{DiscIO::Region::PAL, {"EUR", "PAL", "EU", "LE"}},
|
||||||
{DiscIO::Region::NTSC_K, SETTING_NTSC_K}};
|
{DiscIO::Region::NTSC_K, {"KOR", "NTSC", "KR", "LKH"}}};
|
||||||
auto entryPos = region_settings.find(region);
|
auto entryPos = region_settings.find(SConfig::GetInstance().m_region);
|
||||||
const RegionSetting& region_setting =
|
const RegionSetting& region_setting = entryPos->second;
|
||||||
(entryPos != region_settings.end()) ?
|
|
||||||
entryPos->second :
|
|
||||||
(SConfig::GetInstance().bNTSC ? SETTING_NTSC_U : SETTING_PAL);
|
|
||||||
|
|
||||||
SettingsHandler gen;
|
SettingsHandler gen;
|
||||||
std::string serno;
|
std::string serno;
|
||||||
|
@ -311,7 +305,7 @@ bool CBoot::SetupWiiMemory(DiscIO::Region region)
|
||||||
Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
|
Memory::Write_U32(0x80000000, 0x00003184); // GameID Address
|
||||||
|
|
||||||
// Fake the VI Init of the IPL
|
// Fake the VI Init of the IPL
|
||||||
Memory::Write_U32(SConfig::GetInstance().bNTSC ? 0 : 1, 0x000000CC);
|
Memory::Write_U32(DiscIO::IsNTSC(SConfig::GetInstance().m_region) ? 0 : 1, 0x000000CC);
|
||||||
|
|
||||||
// Clear exception handler. Why? Don't we begin with only zeros?
|
// Clear exception handler. Why? Don't we begin with only zeros?
|
||||||
for (int i = 0x3000; i <= 0x3038; i += 4)
|
for (int i = 0x3000; i <= 0x3038; i += 4)
|
||||||
|
@ -330,10 +324,7 @@ bool CBoot::EmulatedBS2_Wii()
|
||||||
INFO_LOG(BOOT, "Faking Wii BS2...");
|
INFO_LOG(BOOT, "Faking Wii BS2...");
|
||||||
|
|
||||||
// Setup Wii memory
|
// Setup Wii memory
|
||||||
DiscIO::Region region_code = DiscIO::Region::UNKNOWN_REGION;
|
if (!SetupWiiMemory())
|
||||||
if (DVDInterface::VolumeIsValid())
|
|
||||||
region_code = DVDInterface::GetVolume().GetRegion();
|
|
||||||
if (SetupWiiMemory(region_code) == false)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Execute the apploader
|
// Execute the apploader
|
||||||
|
|
|
@ -89,13 +89,8 @@ 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.GetRegion()))
|
if (!SetupWiiMemory())
|
||||||
return false;
|
return false;
|
||||||
// this sets a bit that is used to detect NTSC-J
|
|
||||||
if (ContentLoader.GetRegion() == DiscIO::Region::NTSC_J)
|
|
||||||
{
|
|
||||||
VideoInterface::SetRegionReg('J');
|
|
||||||
}
|
|
||||||
// DOL
|
// DOL
|
||||||
const DiscIO::SNANDContent* pContent =
|
const DiscIO::SNANDContent* pContent =
|
||||||
ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex());
|
ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex());
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "Common/IniFile.h"
|
#include "Common/IniFile.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
|
||||||
#include "Core/BootManager.h"
|
#include "Core/BootManager.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
@ -38,6 +39,9 @@
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
|
|
||||||
|
#include "DiscIO/Enums.h"
|
||||||
|
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
|
||||||
namespace BootManager
|
namespace BootManager
|
||||||
|
@ -349,17 +353,19 @@ bool BootCore(const std::string& _rFilename)
|
||||||
g_SRAM_netplay_initialized = false;
|
g_SRAM_netplay_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool ntsc = DiscIO::IsNTSC(StartUp.m_region);
|
||||||
|
|
||||||
// Apply overrides
|
// Apply overrides
|
||||||
// Some NTSC GameCube games such as Baten Kaitos react strangely to language settings that would
|
// Some NTSC GameCube games such as Baten Kaitos react strangely to
|
||||||
// be invalid on an NTSC system
|
// language settings that would be invalid on an NTSC system
|
||||||
if (!StartUp.bOverrideGCLanguage && StartUp.bNTSC)
|
if (!StartUp.bOverrideGCLanguage && ntsc)
|
||||||
{
|
{
|
||||||
StartUp.SelectedLanguage = 0;
|
StartUp.SelectedLanguage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some NTSC Wii games such as Doc Louis's Punch-Out!! and 1942 (Virtual Console) crash if the
|
// Some NTSC Wii games such as Doc Louis's Punch-Out!! and
|
||||||
// PAL60 option is enabled
|
// 1942 (Virtual Console) crash if the PAL60 option is enabled
|
||||||
if (StartUp.bWii && StartUp.bNTSC)
|
if (StartUp.bWii && ntsc)
|
||||||
{
|
{
|
||||||
StartUp.bPAL60 = false;
|
StartUp.bPAL60 = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -794,7 +794,7 @@ void SConfig::LoadDefaults()
|
||||||
m_revision = 0;
|
m_revision = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* GetDirectoryForRegion(DiscIO::Region region)
|
const char* SConfig::GetDirectoryForRegion(DiscIO::Region region)
|
||||||
{
|
{
|
||||||
switch (region)
|
switch (region)
|
||||||
{
|
{
|
||||||
|
@ -867,19 +867,18 @@ 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;
|
||||||
|
|
||||||
DiscIO::Region region = pVolume->GetRegion();
|
m_region = pVolume->GetRegion();
|
||||||
const char* retrieved_region_dir = GetDirectoryForRegion(region);
|
const char* retrieved_region_dir = GetDirectoryForRegion(m_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;
|
m_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 = region != DiscIO::Region::PAL;
|
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
||||||
{
|
{
|
||||||
|
@ -889,8 +888,8 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
// all GC homebrew to 50Hz.
|
// all GC homebrew to 50Hz.
|
||||||
// In the future, it probably makes sense to add a Region setting for homebrew somewhere in
|
// In the future, it probably makes sense to add a Region setting for homebrew somewhere in
|
||||||
// the emulator config.
|
// the emulator config.
|
||||||
bNTSC = bWii ? false : true;
|
m_region = bWii ? DiscIO::Region::PAL : DiscIO::Region::NTSC_U;
|
||||||
set_region_dir = bNTSC ? USA_DIR : EUR_DIR;
|
set_region_dir = bWii ? EUR_DIR : USA_DIR;
|
||||||
m_BootType = BOOT_ELF;
|
m_BootType = BOOT_ELF;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".dol"))
|
else if (!strcasecmp(Extension.c_str(), ".dol"))
|
||||||
|
@ -898,15 +897,15 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
CDolLoader dolfile(m_strFilename);
|
CDolLoader dolfile(m_strFilename);
|
||||||
bWii = dolfile.IsWii();
|
bWii = dolfile.IsWii();
|
||||||
// TODO: See the ELF code above.
|
// TODO: See the ELF code above.
|
||||||
bNTSC = bWii ? false : true;
|
m_region = bWii ? DiscIO::Region::PAL : DiscIO::Region::NTSC_U;
|
||||||
set_region_dir = bNTSC ? USA_DIR : EUR_DIR;
|
set_region_dir = bWii ? EUR_DIR : USA_DIR;
|
||||||
m_BootType = BOOT_DOL;
|
m_BootType = BOOT_DOL;
|
||||||
}
|
}
|
||||||
else if (!strcasecmp(Extension.c_str(), ".dff"))
|
else if (!strcasecmp(Extension.c_str(), ".dff"))
|
||||||
{
|
{
|
||||||
bWii = true;
|
bWii = true;
|
||||||
|
m_region = DiscIO::Region::NTSC_U;
|
||||||
set_region_dir = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
bNTSC = true;
|
|
||||||
m_BootType = BOOT_DFF;
|
m_BootType = BOOT_DFF;
|
||||||
|
|
||||||
std::unique_ptr<FifoDataFile> ddfFile(FifoDataFile::Load(m_strFilename, true));
|
std::unique_ptr<FifoDataFile> ddfFile(FifoDataFile::Load(m_strFilename, true));
|
||||||
|
@ -931,9 +930,9 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
return false; // do not boot
|
return false; // do not boot
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* retrieved_region_dir = GetDirectoryForRegion(ContentLoader.GetRegion());
|
m_region = ContentLoader.GetRegion();
|
||||||
|
const char* retrieved_region_dir = GetDirectoryForRegion(m_region);
|
||||||
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;
|
|
||||||
|
|
||||||
bWii = true;
|
bWii = true;
|
||||||
m_BootType = BOOT_WII_NAND;
|
m_BootType = BOOT_WII_NAND;
|
||||||
|
@ -974,21 +973,21 @@ bool SConfig::AutoSetup(EBootBS2 _BootBS2)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_USA:
|
case BOOT_BS2_USA:
|
||||||
|
m_region = DiscIO::Region::NTSC_U;
|
||||||
set_region_dir = USA_DIR;
|
set_region_dir = USA_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_JAP:
|
case BOOT_BS2_JAP:
|
||||||
|
m_region = DiscIO::Region::NTSC_J;
|
||||||
set_region_dir = JAP_DIR;
|
set_region_dir = JAP_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_BS2_EUR:
|
case BOOT_BS2_EUR:
|
||||||
|
m_region = DiscIO::Region::PAL;
|
||||||
set_region_dir = EUR_DIR;
|
set_region_dir = EUR_DIR;
|
||||||
m_strFilename.clear();
|
m_strFilename.clear();
|
||||||
bNTSC = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
enum class Language;
|
enum class Language;
|
||||||
|
enum class Region;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DSP Backend Types
|
// DSP Backend Types
|
||||||
|
@ -92,7 +93,6 @@ struct SConfig : NonCopyable
|
||||||
bool bDSPThread = false;
|
bool bDSPThread = false;
|
||||||
bool bDSPHLE = true;
|
bool bDSPHLE = true;
|
||||||
bool bSyncGPUOnSkipIdleHack = true;
|
bool bSyncGPUOnSkipIdleHack = true;
|
||||||
bool bNTSC = false;
|
|
||||||
bool bForceNTSCJ = false;
|
bool bForceNTSCJ = false;
|
||||||
bool bHLE_BS2 = true;
|
bool bHLE_BS2 = true;
|
||||||
bool bEnableCheats = false;
|
bool bEnableCheats = false;
|
||||||
|
@ -183,7 +183,9 @@ struct SConfig : NonCopyable
|
||||||
BOOT_BS2,
|
BOOT_BS2,
|
||||||
BOOT_DFF
|
BOOT_DFF
|
||||||
};
|
};
|
||||||
|
|
||||||
EBootType m_BootType;
|
EBootType m_BootType;
|
||||||
|
DiscIO::Region m_region;
|
||||||
|
|
||||||
std::string m_strVideoBackend;
|
std::string m_strVideoBackend;
|
||||||
std::string m_strGPUDeterminismMode;
|
std::string m_strGPUDeterminismMode;
|
||||||
|
@ -206,6 +208,7 @@ struct SConfig : NonCopyable
|
||||||
std::string m_perfDir;
|
std::string m_perfDir;
|
||||||
|
|
||||||
void LoadDefaults();
|
void LoadDefaults();
|
||||||
|
static const char* GetDirectoryForRegion(DiscIO::Region region);
|
||||||
bool AutoSetup(EBootBS2 _BootBS2);
|
bool AutoSetup(EBootBS2 _BootBS2);
|
||||||
const std::string& GetGameID() const { return m_strGameID; }
|
const std::string& GetGameID() const { return m_strGameID; }
|
||||||
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
|
void CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "Common/MemoryUtil.h"
|
#include "Common/MemoryUtil.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
|
@ -22,6 +23,8 @@
|
||||||
#include "Core/Movie.h"
|
#include "Core/Movie.h"
|
||||||
#include "Core/NetPlayProto.h"
|
#include "Core/NetPlayProto.h"
|
||||||
|
|
||||||
|
#include "DiscIO/Enums.h"
|
||||||
|
|
||||||
// We should provide an option to choose from the above, or figure out the checksum (the algo in
|
// We should provide an option to choose from the above, or figure out the checksum (the algo in
|
||||||
// yagcd seems wrong)
|
// yagcd seems wrong)
|
||||||
// so that people can change default language.
|
// so that people can change default language.
|
||||||
|
@ -89,7 +92,7 @@ void CEXIIPL::Descrambler(u8* data, u32 size)
|
||||||
CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), m_FontsLoaded(false)
|
CEXIIPL::CEXIIPL() : m_uPosition(0), m_uAddress(0), m_uRWOffset(0), m_FontsLoaded(false)
|
||||||
{
|
{
|
||||||
// Determine region
|
// Determine region
|
||||||
m_bNTSC = SConfig::GetInstance().bNTSC;
|
m_bNTSC = DiscIO::IsNTSC(SConfig::GetInstance().m_region);
|
||||||
|
|
||||||
// Create the IPL
|
// Create the IPL
|
||||||
m_pIPL = static_cast<u8*>(Common::AllocateMemoryPages(ROM_SIZE));
|
m_pIPL = static_cast<u8*>(Common::AllocateMemoryPages(ROM_SIZE));
|
||||||
|
|
|
@ -152,76 +152,18 @@ CEXIMemoryCard::CEXIMemoryCard(const int index, bool gciFolder) : card_index(ind
|
||||||
|
|
||||||
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
{
|
{
|
||||||
DiscIO::Region region = DiscIO::Region::UNKNOWN_REGION;
|
DiscIO::Region region = SConfig::GetInstance().m_region;
|
||||||
|
|
||||||
std::string game_id = SConfig::GetInstance().m_strGameID;
|
std::string game_id = SConfig::GetInstance().m_strGameID;
|
||||||
|
|
||||||
u32 CurrentGameId = 0;
|
u32 CurrentGameId = 0;
|
||||||
if (game_id == TITLEID_SYSMENU_STRING)
|
if (game_id.length() >= 4 && game_id != "00000000" && game_id != TITLEID_SYSMENU_STRING)
|
||||||
{
|
|
||||||
const DiscIO::CNANDContentLoader& SysMenu_Loader =
|
|
||||||
DiscIO::CNANDContentManager::Access().GetNANDLoader(TITLEID_SYSMENU,
|
|
||||||
Common::FROM_SESSION_ROOT);
|
|
||||||
if (SysMenu_Loader.IsValid())
|
|
||||||
{
|
|
||||||
region = DiscIO::RegionSwitchGC(SysMenu_Loader.GetCountryChar());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (game_id.length() >= 4)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX);
|
|
||||||
switch (region)
|
|
||||||
{
|
|
||||||
case DiscIO::Region::NTSC_J:
|
|
||||||
shift_jis = true;
|
|
||||||
strDirectoryName += JAP_DIR DIR_SEP;
|
|
||||||
break;
|
|
||||||
case DiscIO::Region::NTSC_U:
|
|
||||||
strDirectoryName += USA_DIR DIR_SEP;
|
|
||||||
break;
|
|
||||||
case DiscIO::Region::PAL:
|
|
||||||
strDirectoryName += EUR_DIR DIR_SEP;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
// 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.
|
|
||||||
// The Wii System Menu requires a lookup based on the version number.
|
|
||||||
// This is not possible in some cases ( e.g. FIFO logs, homebrew elf/dol files).
|
|
||||||
// Instead, we then lookup the region from the memory card name
|
|
||||||
// Earlier in the boot process the region is added to the memory card name (This is done by the
|
|
||||||
// function checkMemcardPath)
|
|
||||||
// For now take advantage of this.
|
|
||||||
// Future options:
|
|
||||||
// Set memory card directory path in the checkMemcardPath function.
|
|
||||||
// or Add region to SConfig::GetInstance().
|
|
||||||
// or Pass region down to the EXI device creation.
|
|
||||||
|
|
||||||
std::string memcardFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA :
|
const bool shift_jis = region == DiscIO::Region::NTSC_J;
|
||||||
SConfig::GetInstance().m_strMemoryCardB;
|
|
||||||
std::string region_string = memcardFilename.substr(memcardFilename.size() - 7, 3);
|
std::string strDirectoryName = File::GetUserPath(D_GCUSER_IDX) +
|
||||||
if (region_string == JAP_DIR)
|
SConfig::GetDirectoryForRegion(region) + DIR_SEP +
|
||||||
{
|
StringFromFormat("Card %c", 'A' + card_index);
|
||||||
region = DiscIO::Region::NTSC_J;
|
|
||||||
shift_jis = true;
|
|
||||||
strDirectoryName += JAP_DIR DIR_SEP;
|
|
||||||
}
|
|
||||||
else if (region_string == USA_DIR)
|
|
||||||
{
|
|
||||||
region = DiscIO::Region::NTSC_U;
|
|
||||||
strDirectoryName += USA_DIR DIR_SEP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
region = DiscIO::Region::PAL;
|
|
||||||
strDirectoryName += EUR_DIR DIR_SEP;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strDirectoryName += StringFromFormat("Card %c", 'A' + card_index);
|
|
||||||
|
|
||||||
if (!File::Exists(strDirectoryName)) // first use of memcard folder, migrate automatically
|
if (!File::Exists(strDirectoryName)) // first use of memcard folder, migrate automatically
|
||||||
{
|
{
|
||||||
|
@ -237,9 +179,8 @@ void CEXIMemoryCard::SetupGciFolder(u16 sizeMb)
|
||||||
else // we tried but the user wants to crash
|
else // we tried but the user wants to crash
|
||||||
{
|
{
|
||||||
// TODO more user friendly abort
|
// TODO more user friendly abort
|
||||||
PanicAlertT("%s is not a directory, failed to move to *.original.\n Verify your write "
|
PanicAlertT("%s is not a directory, failed to move to *.original.\n Verify your "
|
||||||
"permissions or move "
|
"write permissions or move the file outside of Dolphin",
|
||||||
"the file outside of Dolphin",
|
|
||||||
strDirectoryName.c_str());
|
strDirectoryName.c_str());
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
|
@ -16,6 +17,9 @@
|
||||||
#include "Core/HW/SI.h"
|
#include "Core/HW/SI.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
|
|
||||||
|
#include "DiscIO/Enums.h"
|
||||||
|
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
|
@ -167,12 +171,14 @@ void Preset(bool _bNTSC)
|
||||||
m_FilterCoefTables = {};
|
m_FilterCoefTables = {};
|
||||||
m_UnkAARegister = 0;
|
m_UnkAARegister = 0;
|
||||||
|
|
||||||
|
DiscIO::Region region = SConfig::GetInstance().m_region;
|
||||||
|
|
||||||
// 54MHz, capable of progressive scan
|
// 54MHz, capable of progressive scan
|
||||||
m_Clock = SConfig::GetInstance().bNTSC;
|
m_Clock = DiscIO::IsNTSC(region);
|
||||||
|
|
||||||
// Say component cable is plugged
|
// Say component cable is plugged
|
||||||
m_DTVStatus.component_plugged = SConfig::GetInstance().bProgressive;
|
m_DTVStatus.component_plugged = SConfig::GetInstance().bProgressive;
|
||||||
m_DTVStatus.ntsc_j = SConfig::GetInstance().bForceNTSCJ;
|
m_DTVStatus.ntsc_j = SConfig::GetInstance().bForceNTSCJ || region == DiscIO::Region::NTSC_J;
|
||||||
|
|
||||||
m_FBWidth.Hex = 0;
|
m_FBWidth.Hex = 0;
|
||||||
m_BorderHBlank.Hex = 0;
|
m_BorderHBlank.Hex = 0;
|
||||||
|
@ -408,12 +414,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRegionReg(char region)
|
|
||||||
{
|
|
||||||
if (!SConfig::GetInstance().bForceNTSCJ)
|
|
||||||
m_DTVStatus.ntsc_j = region == 'J';
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateInterrupts()
|
void UpdateInterrupts()
|
||||||
{
|
{
|
||||||
if ((m_InterruptRegister[0].IR_INT && m_InterruptRegister[0].IR_MASK) ||
|
if ((m_InterruptRegister[0].IR_INT && m_InterruptRegister[0].IR_MASK) ||
|
||||||
|
|
|
@ -327,7 +327,6 @@ union UVIHorizontalStepping {
|
||||||
void Preset(bool _bNTSC);
|
void Preset(bool _bNTSC);
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void SetRegionReg(char region);
|
|
||||||
void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
|
|
||||||
namespace DiscIO
|
namespace DiscIO
|
||||||
{
|
{
|
||||||
|
bool IsNTSC(Region region)
|
||||||
|
{
|
||||||
|
return region == Region::NTSC_J || region == Region::NTSC_U || region == Region::NTSC_K;
|
||||||
|
}
|
||||||
|
|
||||||
// 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 RegionSwitchGC(u8 country_code)
|
||||||
|
|
|
@ -66,6 +66,7 @@ enum class Language
|
||||||
LANGUAGE_UNKNOWN
|
LANGUAGE_UNKNOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool IsNTSC(Region region);
|
||||||
Region RegionSwitchGC(u8 country_code);
|
Region RegionSwitchGC(u8 country_code);
|
||||||
Region RegionSwitchWii(u8 country_code);
|
Region RegionSwitchWii(u8 country_code);
|
||||||
Country CountrySwitch(u8 country_code);
|
Country CountrySwitch(u8 country_code);
|
||||||
|
|
Loading…
Reference in New Issue