2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-18 01:08:10 +02:00
|
|
|
// Licensed under GPLv2+
|
2013-04-17 22:43:11 -04:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-17 05:18:15 -05:00
|
|
|
#include <cinttypes>
|
2014-09-27 14:42:59 -04:00
|
|
|
#include <memory>
|
2008-12-09 14:57:55 +00:00
|
|
|
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Common/CDUtils.h"
|
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-07 20:06:58 -05:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Common/StringUtil.h"
|
2008-12-09 14:57:55 +00:00
|
|
|
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "Core/Core.h" // for bWii
|
|
|
|
#include "Core/CoreParameter.h"
|
|
|
|
#include "Core/Boot/Boot.h"
|
|
|
|
#include "Core/Boot/Boot_DOL.h"
|
|
|
|
#include "Core/FifoPlayer/FifoDataFile.h"
|
2015-02-19 10:29:21 -05:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2013-10-26 11:55:41 +02:00
|
|
|
|
2014-02-19 13:09:14 -05:00
|
|
|
#include "DiscIO/NANDContentLoader.h"
|
|
|
|
#include "DiscIO/VolumeCreator.h"
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
SCoreStartupParameter::SCoreStartupParameter()
|
2014-08-03 23:44:37 -04:00
|
|
|
: bEnableDebugging(false), bAutomaticStart(false), bBootToPause(false),
|
2014-10-09 12:00:40 -07:00
|
|
|
bJITNoBlockCache(false), bJITNoBlockLinking(false),
|
2010-02-21 12:56:18 +00:00
|
|
|
bJITOff(false),
|
|
|
|
bJITLoadStoreOff(false), bJITLoadStorelXzOff(false),
|
|
|
|
bJITLoadStorelwzOff(false), bJITLoadStorelbzxOff(false),
|
|
|
|
bJITLoadStoreFloatingOff(false), bJITLoadStorePairedOff(false),
|
|
|
|
bJITFloatingPointOff(false), bJITIntegerOff(false),
|
|
|
|
bJITPairedOff(false), bJITSystemRegistersOff(false),
|
2013-10-03 02:41:52 -04:00
|
|
|
bJITBranchOff(false),
|
2010-11-23 13:35:44 +00:00
|
|
|
bJITILTimeProfiling(false), bJITILOutputIR(false),
|
2015-06-07 14:38:09 +02:00
|
|
|
bFPRF(false), bAccurateNaNs(false),
|
2011-01-28 18:39:30 +00:00
|
|
|
bCPUThread(true), bDSPThread(false), bDSPHLE(true),
|
2014-12-21 11:54:53 +01:00
|
|
|
bSkipIdle(true), bSyncGPUOnSkipIdleHack(true), bNTSC(false), bForceNTSCJ(false),
|
2013-01-14 14:20:41 -06:00
|
|
|
bHLE_BS2(true), bEnableCheats(false),
|
2015-02-11 19:50:48 -08:00
|
|
|
bEnableMemcardSaving(true),
|
2013-01-15 22:29:26 +11:00
|
|
|
bDPL2Decoder(false), iLatency(14),
|
2010-02-21 12:56:18 +00:00
|
|
|
bRunCompareServer(false), bRunCompareClient(false),
|
2015-02-11 19:16:23 -08:00
|
|
|
bMMU(false), bDCBZOFF(false),
|
2015-02-09 23:10:30 +13:00
|
|
|
iBBDumpPort(0),
|
2015-06-09 11:35:53 -05:00
|
|
|
bFastDiscSpeed(false), bSyncGPU(false),
|
2013-02-01 21:36:16 -06:00
|
|
|
SelectedLanguage(0), bWii(false),
|
|
|
|
bConfirmStop(false), bHideCursor(false),
|
2012-11-16 15:16:50 -05:00
|
|
|
bAutoHideCursor(false), bUsePanicHandlers(true), bOnScreenDisplayMessages(true),
|
2011-01-11 04:09:11 +00:00
|
|
|
iRenderWindowXPos(-1), iRenderWindowYPos(-1),
|
2010-04-12 01:33:10 +00:00
|
|
|
iRenderWindowWidth(640), iRenderWindowHeight(480),
|
2012-04-08 10:29:49 +10:00
|
|
|
bRenderWindowAutoSize(false), bKeepWindowOnTop(false),
|
2010-06-05 03:03:01 +00:00
|
|
|
bFullscreen(false), bRenderToMain(false),
|
2011-08-25 14:44:13 -05:00
|
|
|
bProgressive(false), bDisableScreenSaver(false),
|
2013-08-18 21:25:16 +02:00
|
|
|
iPosX(100), iPosY(100), iWidth(800), iHeight(600),
|
|
|
|
bLoopFifoReplay(true)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
|
|
|
LoadDefaults();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SCoreStartupParameter::LoadDefaults()
|
|
|
|
{
|
|
|
|
bEnableDebugging = false;
|
2013-08-16 07:30:53 -05:00
|
|
|
bAutomaticStart = false;
|
|
|
|
bBootToPause = false;
|
2013-08-23 00:51:12 +12:00
|
|
|
|
2013-01-06 23:28:27 +13:00
|
|
|
#ifdef USE_GDBSTUB
|
|
|
|
iGDBPort = -1;
|
2015-05-05 01:15:16 +02:00
|
|
|
#ifndef _WIN32
|
|
|
|
gdb_socket = "";
|
|
|
|
#endif
|
2013-01-06 23:28:27 +13:00
|
|
|
#endif
|
2013-08-23 00:51:12 +12:00
|
|
|
|
2015-02-19 10:29:21 -05:00
|
|
|
iCPUCore = PowerPC::CORE_JIT64;
|
2009-10-23 15:26:35 +00:00
|
|
|
bCPUThread = false;
|
2008-12-08 05:30:24 +00:00
|
|
|
bSkipIdle = false;
|
2014-12-21 11:54:53 +01:00
|
|
|
bSyncGPUOnSkipIdleHack = true;
|
2008-12-08 05:30:24 +00:00
|
|
|
bRunCompareServer = false;
|
2011-01-28 18:39:30 +00:00
|
|
|
bDSPHLE = true;
|
2013-04-19 07:50:33 -05:00
|
|
|
bFastmem = true;
|
2014-10-21 04:56:35 -07:00
|
|
|
bFPRF = false;
|
2015-06-07 14:38:09 +02:00
|
|
|
bAccurateNaNs = false;
|
2010-07-29 12:17:47 +00:00
|
|
|
bMMU = false;
|
2013-01-20 13:09:38 +11:00
|
|
|
bDCBZOFF = false;
|
2013-07-03 23:01:52 +12:00
|
|
|
iBBDumpPort = -1;
|
2013-02-16 12:51:09 +11:00
|
|
|
bSyncGPU = false;
|
2010-10-15 21:46:51 +00:00
|
|
|
bFastDiscSpeed = false;
|
2013-04-07 12:18:07 -04:00
|
|
|
bEnableMemcardSaving = true;
|
2010-07-29 13:29:15 +00:00
|
|
|
SelectedLanguage = 0;
|
|
|
|
bWii = false;
|
2013-01-15 22:29:26 +11:00
|
|
|
bDPL2Decoder = false;
|
2013-01-13 00:05:30 +11:00
|
|
|
iLatency = 14;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2010-01-18 18:01:03 +00:00
|
|
|
iPosX = 100;
|
|
|
|
iPosY = 100;
|
|
|
|
iWidth = 800;
|
|
|
|
iHeight = 600;
|
|
|
|
|
2013-08-18 21:25:16 +02:00
|
|
|
bLoopFifoReplay = true;
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
bJITOff = false; // debugger only settings
|
|
|
|
bJITLoadStoreOff = false;
|
|
|
|
bJITLoadStoreFloatingOff = false;
|
2015-01-29 09:40:22 -06:00
|
|
|
bJITLoadStorePairedOff = false;
|
2008-12-08 05:30:24 +00:00
|
|
|
bJITFloatingPointOff = false;
|
|
|
|
bJITIntegerOff = false;
|
|
|
|
bJITPairedOff = false;
|
|
|
|
bJITSystemRegistersOff = false;
|
2009-06-08 12:58:09 +00:00
|
|
|
|
|
|
|
m_strName = "NONE";
|
|
|
|
m_strUniqueID = "00000000";
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2015-02-03 17:14:54 +01:00
|
|
|
static const char* GetRegionOfCountry(DiscIO::IVolume::ECountry country)
|
|
|
|
{
|
|
|
|
switch (country)
|
|
|
|
{
|
|
|
|
case DiscIO::IVolume::COUNTRY_USA:
|
|
|
|
return USA_DIR;
|
|
|
|
|
|
|
|
case DiscIO::IVolume::COUNTRY_TAIWAN:
|
|
|
|
case DiscIO::IVolume::COUNTRY_KOREA:
|
|
|
|
// TODO: Should these have their own Region Dir?
|
|
|
|
case DiscIO::IVolume::COUNTRY_JAPAN:
|
|
|
|
return JAP_DIR;
|
|
|
|
|
|
|
|
case DiscIO::IVolume::COUNTRY_AUSTRALIA:
|
|
|
|
case DiscIO::IVolume::COUNTRY_EUROPE:
|
|
|
|
case DiscIO::IVolume::COUNTRY_FRANCE:
|
|
|
|
case DiscIO::IVolume::COUNTRY_GERMANY:
|
|
|
|
case DiscIO::IVolume::COUNTRY_ITALY:
|
|
|
|
case DiscIO::IVolume::COUNTRY_NETHERLANDS:
|
|
|
|
case DiscIO::IVolume::COUNTRY_RUSSIA:
|
|
|
|
case DiscIO::IVolume::COUNTRY_SPAIN:
|
2015-04-08 18:55:16 -04:00
|
|
|
case DiscIO::IVolume::COUNTRY_WORLD:
|
2015-02-03 17:14:54 +01:00
|
|
|
return EUR_DIR;
|
|
|
|
|
|
|
|
case DiscIO::IVolume::COUNTRY_UNKNOWN:
|
|
|
|
default:
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-25 02:49:58 +02:00
|
|
|
bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2015-02-03 17:14:54 +01:00
|
|
|
std::string set_region_dir(EUR_DIR);
|
2013-08-25 02:49:58 +02:00
|
|
|
|
2009-10-11 16:16:18 +00:00
|
|
|
switch (_BootBS2)
|
2009-02-21 23:44:40 +00:00
|
|
|
{
|
|
|
|
case BOOT_DEFAULT:
|
|
|
|
{
|
2010-02-16 08:46:21 +00:00
|
|
|
bool bootDrive = cdio_is_cdrom(m_strFilename);
|
2009-02-21 23:44:40 +00:00
|
|
|
// Check if the file exist, we may have gotten it from a --elf command line
|
2013-08-25 02:49:58 +02:00
|
|
|
// that gave an incorrect file name
|
2011-03-01 03:06:14 +00:00
|
|
|
if (!bootDrive && !File::Exists(m_strFilename))
|
2009-02-21 23:44:40 +00:00
|
|
|
{
|
2011-01-13 02:05:58 +00:00
|
|
|
PanicAlertT("The specified file \"%s\" does not exist", m_strFilename.c_str());
|
2008-12-08 05:30:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2013-08-25 02:49:58 +02:00
|
|
|
|
2009-02-21 23:44:40 +00:00
|
|
|
std::string Extension;
|
2014-03-09 21:14:26 +01:00
|
|
|
SplitPath(m_strFilename, nullptr, nullptr, &Extension);
|
2013-08-25 02:49:58 +02:00
|
|
|
if (!strcasecmp(Extension.c_str(), ".gcm") ||
|
2008-12-08 05:30:24 +00:00
|
|
|
!strcasecmp(Extension.c_str(), ".iso") ||
|
2012-05-04 00:09:01 +10:00
|
|
|
!strcasecmp(Extension.c_str(), ".wbfs") ||
|
2010-12-29 14:42:20 +00:00
|
|
|
!strcasecmp(Extension.c_str(), ".ciso") ||
|
2009-02-21 23:44:40 +00:00
|
|
|
!strcasecmp(Extension.c_str(), ".gcz") ||
|
|
|
|
bootDrive)
|
|
|
|
{
|
|
|
|
m_BootType = BOOT_ISO;
|
2014-09-27 14:42:59 -04:00
|
|
|
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename));
|
2014-03-09 21:14:26 +01:00
|
|
|
if (pVolume == nullptr)
|
2009-02-21 23:44:40 +00:00
|
|
|
{
|
2011-01-13 02:05:58 +00:00
|
|
|
if (bootDrive)
|
|
|
|
PanicAlertT("Could not read \"%s\". "
|
|
|
|
"There is no disc in the drive, or it is not a GC/Wii backup. "
|
2014-06-07 11:30:39 +09:00
|
|
|
"Please note that original GameCube and Wii discs cannot be read "
|
2011-01-13 02:05:58 +00:00
|
|
|
"by most PC DVD drives.", m_strFilename.c_str());
|
|
|
|
else
|
|
|
|
PanicAlertT("\"%s\" is an invalid GCM/ISO file, or is not a GC/Wii ISO.",
|
|
|
|
m_strFilename.c_str());
|
2009-02-21 23:44:40 +00:00
|
|
|
return false;
|
|
|
|
}
|
2015-05-11 11:19:30 +02:00
|
|
|
m_strName = pVolume->GetInternalName();
|
2008-12-08 05:30:24 +00:00
|
|
|
m_strUniqueID = pVolume->GetUniqueID();
|
2015-02-07 09:49:26 +01:00
|
|
|
m_revision = pVolume->GetRevision();
|
2013-08-25 02:49:58 +02:00
|
|
|
|
2008-12-09 14:57:55 +00:00
|
|
|
// Check if we have a Wii disc
|
2015-06-04 16:26:36 +02:00
|
|
|
bWii = pVolume.get()->GetVolumeType() == DiscIO::IVolume::WII_DISC;
|
2015-02-03 17:14:54 +01:00
|
|
|
|
|
|
|
const char* retrieved_region_dir = GetRegionOfCountry(pVolume->GetCountry());
|
|
|
|
if (!retrieved_region_dir)
|
2009-02-21 23:44:40 +00:00
|
|
|
{
|
2015-02-03 17:14:54 +01:00
|
|
|
if (!PanicYesNoT("Your GCM/ISO file seems to be invalid (invalid country)."
|
|
|
|
"\nContinue with PAL region?"))
|
2014-09-27 14:42:59 -04:00
|
|
|
return false;
|
2015-02-03 17:14:54 +01:00
|
|
|
retrieved_region_dir = EUR_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
}
|
2015-02-03 17:14:54 +01:00
|
|
|
|
|
|
|
set_region_dir = retrieved_region_dir;
|
|
|
|
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
}
|
|
|
|
else if (!strcasecmp(Extension.c_str(), ".elf"))
|
|
|
|
{
|
2014-03-12 15:33:41 -04:00
|
|
|
bWii = CBoot::IsElfWii(m_strFilename);
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = USA_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
m_BootType = BOOT_ELF;
|
|
|
|
bNTSC = true;
|
|
|
|
}
|
|
|
|
else if (!strcasecmp(Extension.c_str(), ".dol"))
|
|
|
|
{
|
2014-03-12 15:33:41 -04:00
|
|
|
CDolLoader dolfile(m_strFilename);
|
2011-01-24 21:54:19 +00:00
|
|
|
bWii = dolfile.IsWii();
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = USA_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
m_BootType = BOOT_DOL;
|
|
|
|
bNTSC = true;
|
|
|
|
}
|
2011-03-27 02:55:08 +00:00
|
|
|
else if (!strcasecmp(Extension.c_str(), ".dff"))
|
|
|
|
{
|
|
|
|
bWii = true;
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = USA_DIR;
|
2011-03-27 02:55:08 +00:00
|
|
|
bNTSC = true;
|
|
|
|
m_BootType = BOOT_DFF;
|
|
|
|
|
2014-09-27 14:42:59 -04:00
|
|
|
std::unique_ptr<FifoDataFile> ddfFile(FifoDataFile::Load(m_strFilename, true));
|
2011-03-27 02:55:08 +00:00
|
|
|
|
|
|
|
if (ddfFile)
|
|
|
|
{
|
|
|
|
bWii = ddfFile->GetIsWii();
|
|
|
|
}
|
|
|
|
}
|
2010-06-05 01:38:22 +00:00
|
|
|
else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid())
|
2009-03-07 18:03:53 +00:00
|
|
|
{
|
2014-09-27 14:42:59 -04:00
|
|
|
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(m_strFilename));
|
2009-06-08 02:25:21 +00:00
|
|
|
const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename);
|
2013-08-25 02:49:58 +02:00
|
|
|
|
2014-03-09 21:14:26 +01:00
|
|
|
if (ContentLoader.GetContentByIndex(ContentLoader.GetBootIndex()) == nullptr)
|
2009-06-17 02:50:54 +00:00
|
|
|
{
|
|
|
|
//WAD is valid yet cannot be booted. Install instead.
|
2011-05-09 05:47:29 +00:00
|
|
|
u64 installed = DiscIO::CNANDContentManager::Access().Install_WiiWAD(m_strFilename);
|
2009-06-17 02:50:54 +00:00
|
|
|
if (installed)
|
2011-01-13 02:05:58 +00:00
|
|
|
SuccessAlertT("The WAD has been installed successfully");
|
2009-06-17 02:50:54 +00:00
|
|
|
return false; //do not boot
|
|
|
|
}
|
|
|
|
|
2015-02-03 17:14:54 +01:00
|
|
|
const char* retrieved_region_dir = GetRegionOfCountry(ContentLoader.GetCountry());
|
|
|
|
set_region_dir = retrieved_region_dir ? retrieved_region_dir : EUR_DIR;
|
|
|
|
bNTSC = set_region_dir == USA_DIR || set_region_dir == JAP_DIR;
|
2009-03-13 21:45:27 +00:00
|
|
|
|
2009-03-07 18:03:53 +00:00
|
|
|
bWii = true;
|
|
|
|
m_BootType = BOOT_WII_NAND;
|
2009-06-08 02:25:21 +00:00
|
|
|
|
2009-06-08 12:58:09 +00:00
|
|
|
if (pVolume)
|
|
|
|
{
|
2015-05-11 11:19:30 +02:00
|
|
|
m_strName = pVolume->GetInternalName();
|
2009-06-08 12:58:09 +00:00
|
|
|
m_strUniqueID = pVolume->GetUniqueID();
|
2010-12-15 23:18:08 +00:00
|
|
|
}
|
|
|
|
else
|
2014-02-16 23:51:41 -05:00
|
|
|
{
|
|
|
|
// null pVolume means that we are loading from nand folder (Most Likely Wii Menu)
|
2010-12-15 23:18:08 +00:00
|
|
|
// if this is the second boot we would be using the Name and id of the last title
|
|
|
|
m_strName.clear();
|
|
|
|
m_strUniqueID.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Use the TitleIDhex for name and/or unique ID if launching from nand folder
|
|
|
|
// or if it is not ascii characters (specifically sysmenu could potentially apply to other things)
|
2014-09-27 14:45:03 -04:00
|
|
|
std::string titleidstr = StringFromFormat("%016" PRIx64, ContentLoader.GetTitleID());
|
2013-08-25 02:49:58 +02:00
|
|
|
|
2014-09-27 14:45:03 -04:00
|
|
|
if (m_strName.empty())
|
2010-12-15 23:18:08 +00:00
|
|
|
{
|
|
|
|
m_strName = titleidstr;
|
|
|
|
}
|
2014-09-27 14:45:03 -04:00
|
|
|
if (m_strUniqueID.empty())
|
2010-12-15 23:18:08 +00:00
|
|
|
{
|
|
|
|
m_strUniqueID = titleidstr;
|
2009-06-08 12:58:09 +00:00
|
|
|
}
|
2009-03-07 18:03:53 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
else
|
|
|
|
{
|
2011-01-13 02:05:58 +00:00
|
|
|
PanicAlertT("Could not recognize ISO file %s", m_strFilename.c_str());
|
2008-12-08 05:30:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2009-02-21 23:44:40 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-10-11 16:16:18 +00:00
|
|
|
case BOOT_BS2_USA:
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = USA_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
m_strFilename.clear();
|
|
|
|
bNTSC = true;
|
|
|
|
break;
|
|
|
|
|
2009-10-11 16:16:18 +00:00
|
|
|
case BOOT_BS2_JAP:
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = JAP_DIR;
|
2009-02-21 23:44:40 +00:00
|
|
|
m_strFilename.clear();
|
|
|
|
bNTSC = true;
|
|
|
|
break;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2013-08-25 02:49:58 +02:00
|
|
|
case BOOT_BS2_EUR:
|
2015-02-03 17:14:54 +01:00
|
|
|
set_region_dir = EUR_DIR;
|
2008-12-08 05:30:24 +00:00
|
|
|
m_strFilename.clear();
|
2009-02-21 23:44:40 +00:00
|
|
|
bNTSC = false;
|
|
|
|
break;
|
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2008-12-09 14:57:55 +00:00
|
|
|
// Setup paths
|
2015-02-03 17:14:54 +01:00
|
|
|
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, set_region_dir, true);
|
|
|
|
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, set_region_dir, false);
|
2010-02-02 21:56:29 +00:00
|
|
|
m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
|
2009-05-01 08:23:25 +00:00
|
|
|
if (!bWii)
|
2009-04-27 16:57:12 +00:00
|
|
|
{
|
2009-10-11 16:16:18 +00:00
|
|
|
if (!bHLE_BS2)
|
2009-05-01 08:23:25 +00:00
|
|
|
{
|
2015-02-03 17:14:54 +01:00
|
|
|
m_strBootROM = File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + set_region_dir + DIR_SEP GC_IPL;
|
2014-10-17 23:18:59 -04:00
|
|
|
if (!File::Exists(m_strBootROM))
|
2015-02-03 17:14:54 +01:00
|
|
|
m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + set_region_dir + DIR_SEP GC_IPL;
|
2014-10-17 23:18:59 -04:00
|
|
|
|
2011-03-01 03:06:14 +00:00
|
|
|
if (!File::Exists(m_strBootROM))
|
2009-05-01 08:23:25 +00:00
|
|
|
{
|
2013-03-31 19:10:21 -04:00
|
|
|
WARN_LOG(BOOT, "Bootrom file %s not found - using HLE.", m_strBootROM.c_str());
|
2009-10-11 16:16:18 +00:00
|
|
|
bHLE_BS2 = true;
|
2009-05-01 08:23:25 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-27 16:57:12 +00:00
|
|
|
}
|
2009-10-11 16:16:18 +00:00
|
|
|
else if (bWii && !bHLE_BS2)
|
2009-05-15 07:50:23 +00:00
|
|
|
{
|
2009-10-11 16:16:18 +00:00
|
|
|
WARN_LOG(BOOT, "GC bootrom file will not be loaded for Wii mode.");
|
|
|
|
bHLE_BS2 = true;
|
2009-05-15 07:50:23 +00:00
|
|
|
}
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2009-02-02 22:29:33 +00:00
|
|
|
|
2015-05-28 20:28:48 -04:00
|
|
|
void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, const std::string& gameRegion, bool isSlotA)
|
2009-02-02 22:29:33 +00:00
|
|
|
{
|
|
|
|
std::string ext("." + gameRegion + ".raw");
|
|
|
|
if (memcardPath.empty())
|
|
|
|
{
|
|
|
|
// Use default memcard path if there is no user defined name
|
|
|
|
std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB;
|
2013-08-25 14:31:11 -04:00
|
|
|
memcardPath = File::GetUserPath(D_GCUSER_IDX) + defaultFilename + ext;
|
2009-02-02 22:29:33 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string filename = memcardPath;
|
|
|
|
std::string region = filename.substr(filename.size()-7, 3);
|
|
|
|
bool hasregion = false;
|
|
|
|
hasregion |= region.compare(USA_DIR) == 0;
|
|
|
|
hasregion |= region.compare(JAP_DIR) == 0;
|
|
|
|
hasregion |= region.compare(EUR_DIR) == 0;
|
|
|
|
if (!hasregion)
|
|
|
|
{
|
|
|
|
// filename doesn't have region in the extension
|
2011-03-01 03:06:14 +00:00
|
|
|
if (File::Exists(filename))
|
2009-02-02 22:29:33 +00:00
|
|
|
{
|
|
|
|
// If the old file exists we are polite and ask if we should copy it
|
|
|
|
std::string oldFilename = filename;
|
|
|
|
filename.replace(filename.size()-4, 4, ext);
|
2011-01-13 02:05:58 +00:00
|
|
|
if (PanicYesNoT("Memory Card filename in Slot %c is incorrect\n"
|
2009-02-02 22:29:33 +00:00
|
|
|
"Region not specified\n\n"
|
|
|
|
"Slot %c path was changed to\n"
|
|
|
|
"%s\n"
|
|
|
|
"Would you like to copy the old file to this new location?\n",
|
|
|
|
isSlotA ? 'A':'B', isSlotA ? 'A':'B', filename.c_str()))
|
|
|
|
{
|
2011-03-01 03:06:14 +00:00
|
|
|
if (!File::Copy(oldFilename, filename))
|
2011-01-13 02:05:58 +00:00
|
|
|
PanicAlertT("Copy failed");
|
2009-02-02 22:29:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
memcardPath = filename; // Always correct the path!
|
|
|
|
}
|
|
|
|
else if (region.compare(gameRegion) != 0)
|
|
|
|
{
|
|
|
|
// filename has region, but it's not == gameRegion
|
|
|
|
// Just set the correct filename, the EXI Device will create it if it doesn't exist
|
2014-09-10 12:17:38 -04:00
|
|
|
memcardPath = filename.replace(filename.size()-ext.size(), ext.size(), ext);
|
2009-02-02 22:29:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-23 02:39:14 -04:00
|
|
|
|
2015-05-08 17:28:03 -04:00
|
|
|
DiscIO::IVolume::ELanguage SCoreStartupParameter::GetCurrentLanguage(bool wii) const
|
2015-04-09 17:44:53 +02:00
|
|
|
{
|
2015-05-08 17:28:03 -04:00
|
|
|
DiscIO::IVolume::ELanguage language;
|
2015-04-09 17:44:53 +02:00
|
|
|
if (wii)
|
2015-05-08 17:28:03 -04:00
|
|
|
language = (DiscIO::IVolume::ELanguage)SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.LNG");
|
2015-04-09 17:44:53 +02:00
|
|
|
else
|
2015-05-08 17:28:03 -04:00
|
|
|
language = (DiscIO::IVolume::ELanguage)(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage + 1);
|
2015-04-09 17:44:53 +02:00
|
|
|
|
|
|
|
// Get rid of invalid values (probably doesn't matter, but might as well do it)
|
2015-05-08 17:28:03 -04:00
|
|
|
if (language > DiscIO::IVolume::ELanguage::LANGUAGE_UNKNOWN || language < 0)
|
|
|
|
language = DiscIO::IVolume::ELanguage::LANGUAGE_UNKNOWN;
|
2015-04-09 17:44:53 +02:00
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2015-02-06 19:28:43 +01:00
|
|
|
IniFile SCoreStartupParameter::LoadDefaultGameIni() const
|
2013-09-23 02:39:14 -04:00
|
|
|
{
|
2015-02-24 17:41:39 +01:00
|
|
|
return LoadDefaultGameIni(GetUniqueID(), m_revision);
|
2013-09-23 02:39:14 -04:00
|
|
|
}
|
|
|
|
|
2015-02-06 19:28:43 +01:00
|
|
|
IniFile SCoreStartupParameter::LoadLocalGameIni() const
|
2013-09-23 02:39:14 -04:00
|
|
|
{
|
2015-02-24 17:41:39 +01:00
|
|
|
return LoadLocalGameIni(GetUniqueID(), m_revision);
|
2013-09-23 02:39:14 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
IniFile SCoreStartupParameter::LoadGameIni() const
|
|
|
|
{
|
2015-02-24 17:41:39 +01:00
|
|
|
return LoadGameIni(GetUniqueID(), m_revision);
|
2013-09-23 02:39:14 -04:00
|
|
|
}
|
|
|
|
|
2015-05-29 21:14:02 +02:00
|
|
|
IniFile SCoreStartupParameter::LoadDefaultGameIni(const std::string& id, u16 revision)
|
2013-09-23 02:39:14 -04:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2015-02-24 17:41:39 +01:00
|
|
|
for (const std::string& filename : GetGameIniFilenames(id, revision))
|
|
|
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
2013-09-23 02:39:14 -04:00
|
|
|
return game_ini;
|
|
|
|
}
|
|
|
|
|
2015-05-29 21:14:02 +02:00
|
|
|
IniFile SCoreStartupParameter::LoadLocalGameIni(const std::string& id, u16 revision)
|
2015-02-07 21:27:26 +01:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2015-02-24 17:41:39 +01:00
|
|
|
for (const std::string& filename : GetGameIniFilenames(id, revision))
|
|
|
|
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
2015-02-07 21:27:26 +01:00
|
|
|
return game_ini;
|
|
|
|
}
|
|
|
|
|
2015-05-29 21:14:02 +02:00
|
|
|
IniFile SCoreStartupParameter::LoadGameIni(const std::string& id, u16 revision)
|
2013-09-23 02:39:14 -04:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2015-02-24 17:41:39 +01:00
|
|
|
for (const std::string& filename : GetGameIniFilenames(id, revision))
|
|
|
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
|
|
|
for (const std::string& filename : GetGameIniFilenames(id, revision))
|
|
|
|
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
2013-09-23 02:39:14 -04:00
|
|
|
return game_ini;
|
|
|
|
}
|
2015-02-07 21:27:26 +01:00
|
|
|
|
2015-02-24 17:41:39 +01:00
|
|
|
// Returns all possible filenames in ascending order of priority
|
2015-05-29 21:14:02 +02:00
|
|
|
std::vector<std::string> SCoreStartupParameter::GetGameIniFilenames(const std::string& id, u16 revision)
|
2015-02-06 19:28:43 +01:00
|
|
|
{
|
2015-02-24 17:41:39 +01:00
|
|
|
std::vector<std::string> filenames;
|
|
|
|
|
2015-02-06 22:34:00 +01:00
|
|
|
// INIs that match all regions
|
2015-02-07 21:27:26 +01:00
|
|
|
if (id.size() >= 4)
|
2015-02-24 17:41:39 +01:00
|
|
|
filenames.push_back(id.substr(0, 3) + ".ini");
|
2015-02-06 22:34:00 +01:00
|
|
|
|
|
|
|
// Regular INIs
|
2015-02-24 17:41:39 +01:00
|
|
|
filenames.push_back(id + ".ini");
|
2015-02-06 22:34:00 +01:00
|
|
|
|
|
|
|
// INIs with specific revisions
|
2015-02-24 17:41:39 +01:00
|
|
|
filenames.push_back(id + StringFromFormat("r%d", revision) + ".ini");
|
|
|
|
|
|
|
|
return filenames;
|
2015-02-06 19:28:43 +01:00
|
|
|
}
|