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
|
|
|
|
2017-06-08 00:53:59 -04:00
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
#include <cinttypes>
|
2016-08-14 19:54:01 +00:00
|
|
|
#include <climits>
|
2015-06-12 13:56:53 +02:00
|
|
|
#include <memory>
|
2017-06-04 10:33:14 +02:00
|
|
|
#include <optional>
|
2017-06-06 23:36:16 -04:00
|
|
|
#include <sstream>
|
2017-05-27 15:43:40 +02:00
|
|
|
#include <variant>
|
2015-06-12 13:56:53 +02:00
|
|
|
|
2017-02-05 02:15:38 +01:00
|
|
|
#include "AudioCommon/AudioCommon.h"
|
|
|
|
|
2017-07-16 16:31:12 +02:00
|
|
|
#include "Common/Assert.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
#include "Common/CDUtils.h"
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Common/CommonPaths.h"
|
2014-09-07 20:06:58 -05:00
|
|
|
#include "Common/CommonTypes.h"
|
2017-05-13 22:29:55 +01:00
|
|
|
#include "Common/Config/Config.h"
|
2014-02-17 05:18:15 -05:00
|
|
|
#include "Common/FileUtil.h"
|
2019-06-07 18:25:32 -04:00
|
|
|
#include "Common/IniFile.h"
|
2016-10-07 21:57:07 +02:00
|
|
|
#include "Common/Logging/Log.h"
|
|
|
|
#include "Common/MsgHandler.h"
|
2017-01-06 21:59:02 +01:00
|
|
|
#include "Common/NandPaths.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
#include "Common/StringUtil.h"
|
2018-03-17 17:22:05 -07:00
|
|
|
#include "Common/scmrev.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
|
2017-05-21 18:53:07 +02:00
|
|
|
#include "Core/Analytics.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
#include "Core/Boot/Boot.h"
|
2017-07-05 10:27:13 +02:00
|
|
|
#include "Core/CommonTitles.h"
|
2017-08-01 22:37:42 +08:00
|
|
|
#include "Core/Config/SYSCONFSettings.h"
|
2017-07-11 13:10:11 +02:00
|
|
|
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
2017-03-09 09:47:43 +01:00
|
|
|
#include "Core/Core.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
#include "Core/FifoPlayer/FifoDataFile.h"
|
2017-03-09 09:47:43 +01:00
|
|
|
#include "Core/HLE/HLE.h"
|
2017-03-24 19:17:52 +01:00
|
|
|
#include "Core/HW/DVD/DVDInterface.h"
|
2019-06-07 18:25:32 -04:00
|
|
|
#include "Core/HW/EXI/EXI_Device.h"
|
2017-01-20 18:45:11 -05:00
|
|
|
#include "Core/HW/SI/SI.h"
|
2019-06-07 18:25:32 -04:00
|
|
|
#include "Core/HW/SI/SI_Device.h"
|
2019-05-01 17:32:45 +02:00
|
|
|
#include "Core/Host.h"
|
2017-07-05 10:27:13 +02:00
|
|
|
#include "Core/IOS/ES/ES.h"
|
2017-03-09 09:47:43 +01:00
|
|
|
#include "Core/IOS/ES/Formats.h"
|
|
|
|
#include "Core/PatchEngine.h"
|
|
|
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
2015-02-19 10:29:21 -05:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2017-05-15 11:17:51 +02:00
|
|
|
#include "Core/TitleDatabase.h"
|
2017-03-09 09:47:43 +01:00
|
|
|
#include "VideoCommon/HiresTextures.h"
|
2015-06-12 13:56:53 +02:00
|
|
|
|
2016-07-06 20:33:05 +02:00
|
|
|
#include "DiscIO/Enums.h"
|
|
|
|
#include "DiscIO/Volume.h"
|
2019-07-14 18:00:14 +02:00
|
|
|
#include "DiscIO/VolumeWad.h"
|
2009-02-28 23:21:51 +00:00
|
|
|
|
2010-02-19 18:50:01 +00:00
|
|
|
SConfig* SConfig::m_Instance;
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
SConfig::SConfig()
|
2010-02-16 04:34:41 +00:00
|
|
|
{
|
2015-06-12 13:56:53 +02:00
|
|
|
LoadDefaults();
|
2010-02-19 18:50:01 +00:00
|
|
|
// Make sure we have log manager
|
|
|
|
LoadSettings();
|
2010-02-16 04:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::Init()
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2010-02-19 18:50:01 +00:00
|
|
|
m_Instance = new SConfig;
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2010-02-16 04:34:41 +00:00
|
|
|
void SConfig::Shutdown()
|
|
|
|
{
|
2010-02-19 18:50:01 +00:00
|
|
|
delete m_Instance;
|
2014-03-09 21:14:26 +01:00
|
|
|
m_Instance = nullptr;
|
2010-02-16 04:34:41 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
SConfig::~SConfig()
|
|
|
|
{
|
|
|
|
SaveSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::SaveSettings()
|
|
|
|
{
|
2011-02-28 20:40:15 +00:00
|
|
|
NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
|
2008-12-08 05:30:24 +00:00
|
|
|
IniFile ini;
|
2010-04-08 16:59:35 +00:00
|
|
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
SaveGeneralSettings(ini);
|
|
|
|
SaveInterfaceSettings(ini);
|
|
|
|
SaveGameListSettings(ini);
|
|
|
|
SaveCoreSettings(ini);
|
|
|
|
SaveMovieSettings(ini);
|
|
|
|
SaveDSPSettings(ini);
|
2014-07-11 10:42:44 -04:00
|
|
|
SaveInputSettings(ini);
|
2014-06-16 01:12:43 -04:00
|
|
|
SaveFifoPlayerSettings(ini);
|
2016-06-18 02:43:59 +02:00
|
|
|
SaveAnalyticsSettings(ini);
|
2015-06-16 21:48:09 +02:00
|
|
|
SaveNetworkSettings(ini);
|
2016-08-23 16:19:30 +02:00
|
|
|
SaveBluetoothPassthroughSettings(ini);
|
2016-11-11 01:33:52 +01:00
|
|
|
SaveUSBPassthroughSettings(ini);
|
2018-03-17 17:22:05 -07:00
|
|
|
SaveAutoUpdateSettings(ini);
|
2018-12-02 23:11:29 -05:00
|
|
|
SaveJitDebugSettings(ini);
|
2014-06-16 01:12:43 -04:00
|
|
|
|
|
|
|
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
2017-05-13 22:29:55 +01:00
|
|
|
|
|
|
|
Config::Save();
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::SaveGeneralSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* general = ini.GetOrCreateSection("General");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2009-01-14 16:36:43 +00:00
|
|
|
// General
|
2014-06-16 01:12:43 -04:00
|
|
|
general->Set("ShowLag", m_ShowLag);
|
2014-09-30 18:49:44 -04:00
|
|
|
general->Set("ShowFrameCount", m_ShowFrameCount);
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2010-04-08 16:59:35 +00:00
|
|
|
// ISO folders
|
2014-06-16 01:12:43 -04:00
|
|
|
// Clear removed folders
|
|
|
|
int oldPaths;
|
|
|
|
int numPaths = (int)m_ISOFolder.size();
|
2014-10-20 17:49:33 -04:00
|
|
|
general->Get("ISOPaths", &oldPaths, 0);
|
2011-05-24 19:12:18 +00:00
|
|
|
for (int i = numPaths; i < oldPaths; i++)
|
|
|
|
{
|
2014-10-20 17:49:33 -04:00
|
|
|
ini.DeleteKey("General", StringFromFormat("ISOPath%i", i));
|
2011-05-24 19:12:18 +00:00
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-10-20 17:49:33 -04:00
|
|
|
general->Set("ISOPaths", numPaths);
|
2011-05-24 19:12:18 +00:00
|
|
|
for (int i = 0; i < numPaths; i++)
|
2010-04-08 16:59:35 +00:00
|
|
|
{
|
2014-10-20 17:49:33 -04:00
|
|
|
general->Set(StringFromFormat("ISOPath%i", i), m_ISOFolder[i]);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-10-20 17:49:33 -04:00
|
|
|
general->Set("RecursiveISOPaths", m_RecursiveISOFolder);
|
2014-06-16 01:12:43 -04:00
|
|
|
general->Set("WirelessMac", m_WirelessMac);
|
|
|
|
|
|
|
|
#ifdef USE_GDBSTUB
|
2015-05-05 01:15:16 +02:00
|
|
|
#ifndef _WIN32
|
2015-06-12 13:56:53 +02:00
|
|
|
general->Set("GDBSocket", gdb_socket);
|
2015-05-05 01:15:16 +02:00
|
|
|
#endif
|
2015-06-12 13:56:53 +02:00
|
|
|
general->Set("GDBPort", iGDBPort);
|
2014-06-16 01:12:43 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::SaveInterfaceSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
interface->Set("ConfirmStop", bConfirmStop);
|
|
|
|
interface->Set("UsePanicHandlers", bUsePanicHandlers);
|
|
|
|
interface->Set("OnScreenDisplayMessages", bOnScreenDisplayMessages);
|
|
|
|
interface->Set("HideCursor", bHideCursor);
|
2016-08-12 14:01:09 +02:00
|
|
|
interface->Set("LanguageCode", m_InterfaceLanguage);
|
2014-06-16 01:12:43 -04:00
|
|
|
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
|
2017-05-15 11:17:51 +02:00
|
|
|
interface->Set("ShowActiveTitle", m_show_active_title);
|
2017-07-10 10:16:06 +02:00
|
|
|
interface->Set("UseBuiltinTitleDatabase", m_use_builtin_title_database);
|
2016-08-12 16:54:50 -04:00
|
|
|
interface->Set("ThemeName", theme_name);
|
2015-03-16 20:28:17 -07:00
|
|
|
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
|
2018-05-04 04:02:05 -04:00
|
|
|
interface->Set("DebugModeEnabled", bEnableDebugging);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::SaveGameListSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListDrives", m_ListDrives);
|
|
|
|
gamelist->Set("ListWad", m_ListWad);
|
2015-08-25 22:13:55 -07:00
|
|
|
gamelist->Set("ListElfDol", m_ListElfDol);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListWii", m_ListWii);
|
|
|
|
gamelist->Set("ListGC", m_ListGC);
|
|
|
|
gamelist->Set("ListJap", m_ListJap);
|
|
|
|
gamelist->Set("ListPal", m_ListPal);
|
|
|
|
gamelist->Set("ListUsa", m_ListUsa);
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Set("ListAustralia", m_ListAustralia);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListFrance", m_ListFrance);
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Set("ListGermany", m_ListGermany);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListItaly", m_ListItaly);
|
|
|
|
gamelist->Set("ListKorea", m_ListKorea);
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Set("ListNetherlands", m_ListNetherlands);
|
|
|
|
gamelist->Set("ListRussia", m_ListRussia);
|
|
|
|
gamelist->Set("ListSpain", m_ListSpain);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListTaiwan", m_ListTaiwan);
|
2015-04-08 18:55:16 -04:00
|
|
|
gamelist->Set("ListWorld", m_ListWorld);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ListUnknown", m_ListUnknown);
|
|
|
|
gamelist->Set("ListSort", m_ListSort);
|
|
|
|
gamelist->Set("ListSortSecondary", m_ListSort2);
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ColumnPlatform", m_showSystemColumn);
|
|
|
|
gamelist->Set("ColumnBanner", m_showBannerColumn);
|
2017-05-08 19:03:59 +02:00
|
|
|
gamelist->Set("ColumnDescription", m_showDescriptionColumn);
|
2017-04-17 19:34:14 +02:00
|
|
|
gamelist->Set("ColumnTitle", m_showTitleColumn);
|
2015-04-20 13:00:15 +02:00
|
|
|
gamelist->Set("ColumnNotes", m_showMakerColumn);
|
2015-10-11 04:44:53 +02:00
|
|
|
gamelist->Set("ColumnFileName", m_showFileNameColumn);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Set("ColumnID", m_showIDColumn);
|
|
|
|
gamelist->Set("ColumnRegion", m_showRegionColumn);
|
|
|
|
gamelist->Set("ColumnSize", m_showSizeColumn);
|
2018-10-01 09:10:40 +02:00
|
|
|
gamelist->Set("ColumnTags", m_showTagsColumn);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::SaveCoreSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-06-11 17:51:01 +02:00
|
|
|
core->Set("SkipIPL", bHLE_BS2);
|
2015-10-25 14:04:42 +01:00
|
|
|
core->Set("TimingVariance", iTimingVariance);
|
2018-06-15 08:11:18 -04:00
|
|
|
core->Set("CPUCore", cpu_core);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Set("Fastmem", bFastmem);
|
|
|
|
core->Set("CPUThread", bCPUThread);
|
|
|
|
core->Set("DSPHLE", bDSPHLE);
|
|
|
|
core->Set("SyncOnSkipIdle", bSyncGPUOnSkipIdleHack);
|
|
|
|
core->Set("SyncGPU", bSyncGPU);
|
|
|
|
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
|
|
|
|
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
|
|
|
|
core->Set("SyncGpuOverclock", fSyncGpuOverclock);
|
2015-12-12 09:52:57 +01:00
|
|
|
core->Set("FPRF", bFPRF);
|
|
|
|
core->Set("AccurateNaNs", bAccurateNaNs);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Set("EnableCheats", bEnableCheats);
|
|
|
|
core->Set("SelectedLanguage", SelectedLanguage);
|
2019-06-30 11:48:49 +02:00
|
|
|
core->Set("OverrideRegionSettings", bOverrideRegionSettings);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Set("DPL2Decoder", bDPL2Decoder);
|
2017-06-17 07:43:37 -03:00
|
|
|
core->Set("AudioLatency", iLatency);
|
2017-04-10 17:56:24 +01:00
|
|
|
core->Set("AudioStretch", m_audio_stretch);
|
|
|
|
core->Set("AudioStretchMaxLatency", m_audio_stretch_max_latency);
|
2015-01-20 23:41:46 +11:00
|
|
|
core->Set("AgpCartAPath", m_strGbaCartA);
|
|
|
|
core->Set("AgpCartBPath", m_strGbaCartB);
|
2014-06-16 01:12:43 -04:00
|
|
|
core->Set("SlotA", m_EXIDevice[0]);
|
|
|
|
core->Set("SlotB", m_EXIDevice[1]);
|
|
|
|
core->Set("SerialPort1", m_EXIDevice[2]);
|
|
|
|
core->Set("BBA_MAC", m_bba_mac);
|
2017-03-16 01:51:27 -04:00
|
|
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2014-06-16 01:12:43 -04:00
|
|
|
core->Set(StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
|
2015-12-31 11:09:47 -06:00
|
|
|
core->Set(StringFromFormat("AdapterRumble%i", i), m_AdapterRumble[i]);
|
Fix GCPad recalibration shortcut.
Dolphin has supported the recalibration shortcut (X+Y+Start) for quite a long while. So if someont's axises are terrible, you could easily
recalibrate.
Games even get the initial calibration upon boot(Most of the time).
While changing over the GCAdapter code, I was testing to make sure the reset and calibration shortcuts still worked, turns out they didn't work at
all.
Looking in to the problem, we capture the combination properly, and we wait three seconds until we actually fire that off recalibration.
The problem is for Nintendo's SDK to properly handle recalibrating, we need to send back data saying that it needs to recalibrate.
On hardware this is done as part of the 64bits of data the controller sends back to us.
On holding of the controller, bit 61 of the return value is set, which the Nintendo SDK catches, and then signals immediately afterwards a CMD_ORIGIN
command in order to recalibrate the controller.
We were outright ignoring this bit, so the library wasn't ever recalibrating. I suspect in the past the class itself used to use the calibration data
to to offset the data, but somewhere along the lines it got munged out of existence.
The Gamecube adapter does this shortcut in a bit of a unique way, instead of sending the command and having the library support it and what have you.
Once holding the shortcut for the amount of time, the adapter reports back that the controller has actually been disconnected. Then when you let go of
the combination, the adapter states that a new device has been connected to that port, and the recalibration happens because a new device is
"connected."
This fixes controller calibration for both emulated GC controllers and also the Wii Gamecube Adapter.
2015-12-31 11:23:04 -06:00
|
|
|
core->Set(StringFromFormat("SimulateKonga%i", i), m_AdapterKonga[i]);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2014-06-16 01:12:43 -04:00
|
|
|
core->Set("WiiSDCard", m_WiiSDCard);
|
|
|
|
core->Set("WiiKeyboard", m_WiiKeyboard);
|
|
|
|
core->Set("WiimoteContinuousScanning", m_WiimoteContinuousScanning);
|
|
|
|
core->Set("WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Set("RunCompareServer", bRunCompareServer);
|
|
|
|
core->Set("RunCompareClient", bRunCompareClient);
|
2015-12-16 00:10:47 +01:00
|
|
|
core->Set("EmulationSpeed", m_EmulationSpeed);
|
2014-12-31 10:24:14 -08:00
|
|
|
core->Set("Overclock", m_OCFactor);
|
|
|
|
core->Set("OverclockEnable", m_OCEnable);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Set("GFXBackend", m_strVideoBackend);
|
|
|
|
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
|
2015-08-07 01:59:29 -05:00
|
|
|
core->Set("PerfMapDir", m_perfDir);
|
2016-07-13 16:46:14 -04:00
|
|
|
core->Set("EnableCustomRTC", bEnableCustomRTC);
|
|
|
|
core->Set("CustomRTCValue", m_customRTCValue);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
2013-08-18 21:25:16 +02:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::SaveMovieSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
|
|
|
|
|
|
|
|
movie->Set("PauseMovie", m_PauseMovie);
|
|
|
|
movie->Set("Author", m_strMovieAuthor);
|
2014-10-12 23:53:10 -04:00
|
|
|
movie->Set("DumpFrames", m_DumpFrames);
|
2015-02-14 23:38:14 +01:00
|
|
|
movie->Set("DumpFramesSilent", m_DumpFramesSilent);
|
2014-10-17 21:08:34 -04:00
|
|
|
movie->Set("ShowInputDisplay", m_ShowInputDisplay);
|
2016-07-19 20:23:25 -04:00
|
|
|
movie->Set("ShowRTC", m_ShowRTC);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::SaveDSPSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* dsp = ini.GetOrCreateSection("DSP");
|
|
|
|
|
|
|
|
dsp->Set("EnableJIT", m_DSPEnableJIT);
|
|
|
|
dsp->Set("DumpAudio", m_DumpAudio);
|
2017-01-08 13:51:00 -05:00
|
|
|
dsp->Set("DumpAudioSilent", m_DumpAudioSilent);
|
2014-04-01 21:55:19 +02:00
|
|
|
dsp->Set("DumpUCode", m_DumpUCode);
|
2014-06-16 01:12:43 -04:00
|
|
|
dsp->Set("Backend", sBackend);
|
|
|
|
dsp->Set("Volume", m_Volume);
|
2014-04-26 00:51:38 +02:00
|
|
|
dsp->Set("CaptureLog", m_DSPCaptureLog);
|
2018-02-10 21:03:27 +01:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
dsp->Set("WASAPIDevice", sWASAPIDevice);
|
|
|
|
#endif
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
2014-07-11 10:42:44 -04:00
|
|
|
void SConfig::SaveInputSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* input = ini.GetOrCreateSection("Input");
|
|
|
|
|
|
|
|
input->Set("BackgroundInput", m_BackgroundInput);
|
|
|
|
}
|
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::SaveFifoPlayerSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
|
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
fifoplayer->Set("LoopReplay", bLoopFifoReplay);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2015-06-16 21:48:09 +02:00
|
|
|
void SConfig::SaveNetworkSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* network = ini.GetOrCreateSection("Network");
|
|
|
|
|
|
|
|
network->Set("SSLDumpRead", m_SSLDumpRead);
|
|
|
|
network->Set("SSLDumpWrite", m_SSLDumpWrite);
|
2017-03-13 22:30:32 +01:00
|
|
|
network->Set("SSLVerifyCertificates", m_SSLVerifyCert);
|
2015-07-11 10:31:03 +02:00
|
|
|
network->Set("SSLDumpRootCA", m_SSLDumpRootCA);
|
|
|
|
network->Set("SSLDumpPeerCert", m_SSLDumpPeerCert);
|
2015-06-16 21:48:09 +02:00
|
|
|
}
|
|
|
|
|
2016-06-18 02:43:59 +02:00
|
|
|
void SConfig::SaveAnalyticsSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* analytics = ini.GetOrCreateSection("Analytics");
|
|
|
|
|
|
|
|
analytics->Set("ID", m_analytics_id);
|
|
|
|
analytics->Set("Enabled", m_analytics_enabled);
|
|
|
|
analytics->Set("PermissionAsked", m_analytics_permission_asked);
|
|
|
|
}
|
|
|
|
|
2016-08-23 16:19:30 +02:00
|
|
|
void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
|
|
|
|
|
|
|
|
section->Set("Enabled", m_bt_passthrough_enabled);
|
|
|
|
section->Set("VID", m_bt_passthrough_vid);
|
|
|
|
section->Set("PID", m_bt_passthrough_pid);
|
2016-09-16 23:25:57 +02:00
|
|
|
section->Set("LinkKeys", m_bt_passthrough_link_keys);
|
2016-08-23 16:19:30 +02:00
|
|
|
}
|
|
|
|
|
2016-11-11 01:33:52 +01:00
|
|
|
void SConfig::SaveUSBPassthroughSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
|
|
|
|
|
|
|
|
std::ostringstream oss;
|
|
|
|
for (const auto& device : m_usb_passthrough_devices)
|
|
|
|
oss << StringFromFormat("%04x:%04x", device.first, device.second) << ',';
|
|
|
|
std::string devices_string = oss.str();
|
|
|
|
if (!devices_string.empty())
|
|
|
|
devices_string.pop_back();
|
|
|
|
|
|
|
|
section->Set("Devices", devices_string);
|
|
|
|
}
|
|
|
|
|
2018-03-17 17:22:05 -07:00
|
|
|
void SConfig::SaveAutoUpdateSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("AutoUpdate");
|
|
|
|
|
2018-05-02 17:23:41 +02:00
|
|
|
section->Set("UpdateTrack", m_auto_update_track);
|
2018-03-17 17:22:05 -07:00
|
|
|
section->Set("HashOverride", m_auto_update_hash_override);
|
|
|
|
}
|
|
|
|
|
2018-12-02 23:11:29 -05:00
|
|
|
void SConfig::SaveJitDebugSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("Debug");
|
|
|
|
|
|
|
|
section->Set("JitOff", bJITOff);
|
|
|
|
section->Set("JitLoadStoreOff", bJITLoadStoreOff);
|
|
|
|
section->Set("JitLoadStoreFloatingOff", bJITLoadStoreFloatingOff);
|
|
|
|
section->Set("JitLoadStorePairedOff", bJITLoadStorePairedOff);
|
|
|
|
section->Set("JitFloatingPointOff", bJITFloatingPointOff);
|
|
|
|
section->Set("JitIntegerOff", bJITIntegerOff);
|
|
|
|
section->Set("JitPairedOff", bJITPairedOff);
|
|
|
|
section->Set("JitSystemRegistersOff", bJITSystemRegistersOff);
|
|
|
|
section->Set("JitBranchOff", bJITBranchOff);
|
|
|
|
}
|
|
|
|
|
2008-12-08 05:30:24 +00:00
|
|
|
void SConfig::LoadSettings()
|
2009-09-14 06:26:49 +00:00
|
|
|
{
|
2017-05-13 22:29:55 +01:00
|
|
|
Config::Load();
|
|
|
|
|
2011-02-28 20:40:15 +00:00
|
|
|
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
|
2008-12-08 05:30:24 +00:00
|
|
|
IniFile ini;
|
2010-02-02 21:56:29 +00:00
|
|
|
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
LoadGeneralSettings(ini);
|
|
|
|
LoadInterfaceSettings(ini);
|
|
|
|
LoadGameListSettings(ini);
|
|
|
|
LoadCoreSettings(ini);
|
|
|
|
LoadMovieSettings(ini);
|
|
|
|
LoadDSPSettings(ini);
|
2014-07-11 10:42:44 -04:00
|
|
|
LoadInputSettings(ini);
|
2014-06-16 01:12:43 -04:00
|
|
|
LoadFifoPlayerSettings(ini);
|
2015-06-16 21:48:09 +02:00
|
|
|
LoadNetworkSettings(ini);
|
2016-06-18 02:43:59 +02:00
|
|
|
LoadAnalyticsSettings(ini);
|
2016-08-23 16:19:30 +02:00
|
|
|
LoadBluetoothPassthroughSettings(ini);
|
2016-11-11 01:33:52 +01:00
|
|
|
LoadUSBPassthroughSettings(ini);
|
2018-03-17 17:22:05 -07:00
|
|
|
LoadAutoUpdateSettings(ini);
|
2018-12-02 23:11:29 -05:00
|
|
|
LoadJitDebugSettings(ini);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::LoadGeneralSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* general = ini.GetOrCreateSection("General");
|
2009-04-05 06:46:18 +00:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
general->Get("ShowLag", &m_ShowLag, false);
|
2014-09-30 18:49:44 -04:00
|
|
|
general->Get("ShowFrameCount", &m_ShowFrameCount, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
#ifdef USE_GDBSTUB
|
2015-05-05 01:15:16 +02:00
|
|
|
#ifndef _WIN32
|
2015-06-12 13:56:53 +02:00
|
|
|
general->Get("GDBSocket", &gdb_socket, "");
|
2015-05-05 01:15:16 +02:00
|
|
|
#endif
|
2015-06-12 13:56:53 +02:00
|
|
|
general->Get("GDBPort", &(iGDBPort), -1);
|
2014-06-16 01:12:43 -04:00
|
|
|
#endif
|
2011-05-24 19:12:18 +00:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
m_ISOFolder.clear();
|
2014-10-20 17:49:33 -04:00
|
|
|
int numISOPaths;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-10-20 17:49:33 -04:00
|
|
|
if (general->Get("ISOPaths", &numISOPaths, 0))
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2014-10-20 17:49:33 -04:00
|
|
|
for (int i = 0; i < numISOPaths; i++)
|
2010-04-25 20:10:16 +00:00
|
|
|
{
|
2014-06-16 01:12:43 -04:00
|
|
|
std::string tmpPath;
|
2014-10-20 17:49:33 -04:00
|
|
|
general->Get(StringFromFormat("ISOPath%i", i), &tmpPath, "");
|
2014-06-16 01:12:43 -04:00
|
|
|
m_ISOFolder.push_back(std::move(tmpPath));
|
2010-04-25 20:10:16 +00:00
|
|
|
}
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-08-12 16:54:50 -04:00
|
|
|
general->Get("RecursiveISOPaths", &m_RecursiveISOFolder, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
general->Get("WirelessMac", &m_WirelessMac);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::LoadInterfaceSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* interface = ini.GetOrCreateSection("Interface");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
interface->Get("ConfirmStop", &bConfirmStop, true);
|
|
|
|
interface->Get("UsePanicHandlers", &bUsePanicHandlers, true);
|
|
|
|
interface->Get("OnScreenDisplayMessages", &bOnScreenDisplayMessages, true);
|
|
|
|
interface->Get("HideCursor", &bHideCursor, false);
|
2016-08-12 14:01:09 +02:00
|
|
|
interface->Get("LanguageCode", &m_InterfaceLanguage, "");
|
2014-06-16 01:12:43 -04:00
|
|
|
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
|
2017-05-15 11:17:51 +02:00
|
|
|
interface->Get("ShowActiveTitle", &m_show_active_title, true);
|
2017-07-10 10:16:06 +02:00
|
|
|
interface->Get("UseBuiltinTitleDatabase", &m_use_builtin_title_database, true);
|
2016-08-12 16:54:50 -04:00
|
|
|
interface->Get("ThemeName", &theme_name, DEFAULT_THEME_DIR);
|
2015-03-16 20:28:17 -07:00
|
|
|
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
|
2018-05-04 04:02:05 -04:00
|
|
|
interface->Get("DebugModeEnabled", &bEnableDebugging, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::LoadGameListSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* gamelist = ini.GetOrCreateSection("GameList");
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Get("ListDrives", &m_ListDrives, false);
|
|
|
|
gamelist->Get("ListWad", &m_ListWad, true);
|
2015-08-25 22:13:55 -07:00
|
|
|
gamelist->Get("ListElfDol", &m_ListElfDol, true);
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Get("ListWii", &m_ListWii, true);
|
|
|
|
gamelist->Get("ListGC", &m_ListGC, true);
|
|
|
|
gamelist->Get("ListJap", &m_ListJap, true);
|
|
|
|
gamelist->Get("ListPal", &m_ListPal, true);
|
|
|
|
gamelist->Get("ListUsa", &m_ListUsa, true);
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Get("ListAustralia", &m_ListAustralia, true);
|
|
|
|
gamelist->Get("ListFrance", &m_ListFrance, true);
|
|
|
|
gamelist->Get("ListGermany", &m_ListGermany, true);
|
|
|
|
gamelist->Get("ListItaly", &m_ListItaly, true);
|
|
|
|
gamelist->Get("ListKorea", &m_ListKorea, true);
|
|
|
|
gamelist->Get("ListNetherlands", &m_ListNetherlands, true);
|
|
|
|
gamelist->Get("ListRussia", &m_ListRussia, true);
|
|
|
|
gamelist->Get("ListSpain", &m_ListSpain, true);
|
|
|
|
gamelist->Get("ListTaiwan", &m_ListTaiwan, true);
|
2015-04-08 18:55:16 -04:00
|
|
|
gamelist->Get("ListWorld", &m_ListWorld, true);
|
2014-10-30 10:35:46 -04:00
|
|
|
gamelist->Get("ListUnknown", &m_ListUnknown, true);
|
|
|
|
gamelist->Get("ListSort", &m_ListSort, 3);
|
|
|
|
gamelist->Get("ListSortSecondary", &m_ListSort2, 0);
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
// Gamelist columns toggles
|
|
|
|
gamelist->Get("ColumnPlatform", &m_showSystemColumn, true);
|
2017-05-08 19:03:59 +02:00
|
|
|
gamelist->Get("ColumnDescription", &m_showDescriptionColumn, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Get("ColumnBanner", &m_showBannerColumn, true);
|
2017-04-17 19:34:14 +02:00
|
|
|
gamelist->Get("ColumnTitle", &m_showTitleColumn, true);
|
2015-04-20 13:00:15 +02:00
|
|
|
gamelist->Get("ColumnNotes", &m_showMakerColumn, true);
|
2015-10-11 04:44:53 +02:00
|
|
|
gamelist->Get("ColumnFileName", &m_showFileNameColumn, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
gamelist->Get("ColumnID", &m_showIDColumn, false);
|
|
|
|
gamelist->Get("ColumnRegion", &m_showRegionColumn, true);
|
|
|
|
gamelist->Get("ColumnSize", &m_showSizeColumn, true);
|
2018-10-01 09:10:40 +02:00
|
|
|
gamelist->Get("ColumnTags", &m_showTagsColumn, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::LoadCoreSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* core = ini.GetOrCreateSection("Core");
|
2010-04-12 01:33:10 +00:00
|
|
|
|
2017-06-11 17:51:01 +02:00
|
|
|
core->Get("SkipIPL", &bHLE_BS2, true);
|
2014-03-02 05:21:50 -06:00
|
|
|
#ifdef _M_X86
|
2018-06-15 08:11:18 -04:00
|
|
|
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JIT64);
|
2015-01-26 00:50:25 -06:00
|
|
|
#elif _M_ARM_64
|
2018-06-15 08:11:18 -04:00
|
|
|
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JITARM64);
|
2013-02-28 16:15:32 -06:00
|
|
|
#else
|
2018-06-15 08:11:18 -04:00
|
|
|
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::Interpreter);
|
2013-02-28 16:15:32 -06:00
|
|
|
#endif
|
2018-07-08 21:26:34 +02:00
|
|
|
core->Get("JITFollowBranch", &bJITFollowBranch, true);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("Fastmem", &bFastmem, true);
|
|
|
|
core->Get("DSPHLE", &bDSPHLE, true);
|
2015-10-25 14:04:42 +01:00
|
|
|
core->Get("TimingVariance", &iTimingVariance, 40);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("CPUThread", &bCPUThread, true);
|
|
|
|
core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
|
|
|
|
core->Get("EnableCheats", &bEnableCheats, false);
|
|
|
|
core->Get("SelectedLanguage", &SelectedLanguage, 0);
|
2019-06-30 11:48:49 +02:00
|
|
|
core->Get("OverrideRegionSettings", &bOverrideRegionSettings, false);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("DPL2Decoder", &bDPL2Decoder, false);
|
2017-06-17 07:43:37 -03:00
|
|
|
core->Get("AudioLatency", &iLatency, 20);
|
2017-04-10 17:56:24 +01:00
|
|
|
core->Get("AudioStretch", &m_audio_stretch, false);
|
|
|
|
core->Get("AudioStretchMaxLatency", &m_audio_stretch_max_latency, 80);
|
2015-01-20 23:41:46 +11:00
|
|
|
core->Get("AgpCartAPath", &m_strGbaCartA);
|
|
|
|
core->Get("AgpCartBPath", &m_strGbaCartB);
|
2017-04-03 00:41:51 -07:00
|
|
|
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
|
2017-03-18 17:46:05 -04:00
|
|
|
core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
|
|
|
|
core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
|
2014-06-16 01:12:43 -04:00
|
|
|
core->Get("BBA_MAC", &m_bba_mac);
|
2017-03-16 01:51:27 -04:00
|
|
|
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
|
2014-06-16 01:12:43 -04:00
|
|
|
{
|
|
|
|
core->Get(StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i],
|
2017-03-16 04:41:36 -04:00
|
|
|
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
|
2015-12-31 11:09:47 -06:00
|
|
|
core->Get(StringFromFormat("AdapterRumble%i", i), &m_AdapterRumble[i], true);
|
Fix GCPad recalibration shortcut.
Dolphin has supported the recalibration shortcut (X+Y+Start) for quite a long while. So if someont's axises are terrible, you could easily
recalibrate.
Games even get the initial calibration upon boot(Most of the time).
While changing over the GCAdapter code, I was testing to make sure the reset and calibration shortcuts still worked, turns out they didn't work at
all.
Looking in to the problem, we capture the combination properly, and we wait three seconds until we actually fire that off recalibration.
The problem is for Nintendo's SDK to properly handle recalibrating, we need to send back data saying that it needs to recalibrate.
On hardware this is done as part of the 64bits of data the controller sends back to us.
On holding of the controller, bit 61 of the return value is set, which the Nintendo SDK catches, and then signals immediately afterwards a CMD_ORIGIN
command in order to recalibrate the controller.
We were outright ignoring this bit, so the library wasn't ever recalibrating. I suspect in the past the class itself used to use the calibration data
to to offset the data, but somewhere along the lines it got munged out of existence.
The Gamecube adapter does this shortcut in a bit of a unique way, instead of sending the command and having the library support it and what have you.
Once holding the shortcut for the amount of time, the adapter reports back that the controller has actually been disconnected. Then when you let go of
the combination, the adapter states that a new device has been connected to that port, and the recalibration happens because a new device is
"connected."
This fixes controller calibration for both emulated GC controllers and also the Wii Gamecube Adapter.
2015-12-31 11:23:04 -06:00
|
|
|
core->Get(StringFromFormat("SimulateKonga%i", i), &m_AdapterKonga[i], false);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2014-06-16 01:12:43 -04:00
|
|
|
core->Get("WiiSDCard", &m_WiiSDCard, false);
|
|
|
|
core->Get("WiiKeyboard", &m_WiiKeyboard, false);
|
|
|
|
core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
|
2014-09-06 01:23:54 +10:00
|
|
|
core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("RunCompareServer", &bRunCompareServer, false);
|
|
|
|
core->Get("RunCompareClient", &bRunCompareClient, false);
|
2018-03-16 21:04:51 +01:00
|
|
|
core->Get("MMU", &bMMU, bMMU);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("BBDumpPort", &iBBDumpPort, -1);
|
|
|
|
core->Get("SyncGPU", &bSyncGPU, false);
|
|
|
|
core->Get("SyncGpuMaxDistance", &iSyncGpuMaxDistance, 200000);
|
|
|
|
core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000);
|
2016-08-10 22:07:09 +02:00
|
|
|
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
|
2017-01-26 04:57:03 -05:00
|
|
|
core->Get("LowDCBZHack", &bLowDCBZHack, false);
|
2015-12-12 09:52:57 +01:00
|
|
|
core->Get("FPRF", &bFPRF, false);
|
|
|
|
core->Get("AccurateNaNs", &bAccurateNaNs, false);
|
2015-12-16 00:10:47 +01:00
|
|
|
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
|
2014-12-31 10:24:14 -08:00
|
|
|
core->Get("Overclock", &m_OCFactor, 1.0f);
|
|
|
|
core->Get("OverclockEnable", &m_OCEnable, false);
|
2015-06-12 13:56:53 +02:00
|
|
|
core->Get("GFXBackend", &m_strVideoBackend, "");
|
|
|
|
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
|
2015-08-07 01:59:29 -05:00
|
|
|
core->Get("PerfMapDir", &m_perfDir, "");
|
2016-07-13 16:46:14 -04:00
|
|
|
core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
|
|
|
|
// Default to seconds between 1.1.1970 and 1.1.2000
|
|
|
|
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
2009-09-14 06:26:49 +00:00
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::LoadMovieSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* movie = ini.GetOrCreateSection("Movie");
|
|
|
|
|
|
|
|
movie->Get("PauseMovie", &m_PauseMovie, false);
|
|
|
|
movie->Get("Author", &m_strMovieAuthor, "");
|
2014-10-12 23:53:10 -04:00
|
|
|
movie->Get("DumpFrames", &m_DumpFrames, false);
|
2015-02-14 23:38:14 +01:00
|
|
|
movie->Get("DumpFramesSilent", &m_DumpFramesSilent, false);
|
2014-10-17 21:08:34 -04:00
|
|
|
movie->Get("ShowInputDisplay", &m_ShowInputDisplay, false);
|
2016-07-19 20:23:25 -04:00
|
|
|
movie->Get("ShowRTC", &m_ShowRTC, false);
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SConfig::LoadDSPSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* dsp = ini.GetOrCreateSection("DSP");
|
|
|
|
|
|
|
|
dsp->Get("EnableJIT", &m_DSPEnableJIT, true);
|
|
|
|
dsp->Get("DumpAudio", &m_DumpAudio, false);
|
2017-01-08 13:51:00 -05:00
|
|
|
dsp->Get("DumpAudioSilent", &m_DumpAudioSilent, false);
|
2014-04-01 21:55:19 +02:00
|
|
|
dsp->Get("DumpUCode", &m_DumpUCode, false);
|
2017-02-05 02:15:38 +01:00
|
|
|
dsp->Get("Backend", &sBackend, AudioCommon::GetDefaultSoundBackend());
|
2014-06-16 01:12:43 -04:00
|
|
|
dsp->Get("Volume", &m_Volume, 100);
|
2014-07-06 11:05:16 +02:00
|
|
|
dsp->Get("CaptureLog", &m_DSPCaptureLog, false);
|
2014-12-28 22:03:21 +01:00
|
|
|
|
2018-02-10 21:03:27 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
dsp->Get("WASAPIDevice", &sWASAPIDevice, "default");
|
|
|
|
#endif
|
|
|
|
|
2014-12-28 22:03:21 +01:00
|
|
|
m_IsMuted = false;
|
2014-06-16 01:12:43 -04:00
|
|
|
}
|
|
|
|
|
2014-07-11 10:42:44 -04:00
|
|
|
void SConfig::LoadInputSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* input = ini.GetOrCreateSection("Input");
|
|
|
|
|
|
|
|
input->Get("BackgroundInput", &m_BackgroundInput, false);
|
|
|
|
}
|
|
|
|
|
2014-06-16 01:12:43 -04:00
|
|
|
void SConfig::LoadFifoPlayerSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
|
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
fifoplayer->Get("LoopReplay", &bLoopFifoReplay, true);
|
|
|
|
}
|
|
|
|
|
2015-06-16 21:48:09 +02:00
|
|
|
void SConfig::LoadNetworkSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* network = ini.GetOrCreateSection("Network");
|
|
|
|
|
|
|
|
network->Get("SSLDumpRead", &m_SSLDumpRead, false);
|
|
|
|
network->Get("SSLDumpWrite", &m_SSLDumpWrite, false);
|
2017-03-13 22:30:32 +01:00
|
|
|
network->Get("SSLVerifyCertificates", &m_SSLVerifyCert, true);
|
2015-07-11 10:31:03 +02:00
|
|
|
network->Get("SSLDumpRootCA", &m_SSLDumpRootCA, false);
|
|
|
|
network->Get("SSLDumpPeerCert", &m_SSLDumpPeerCert, false);
|
2015-06-16 21:48:09 +02:00
|
|
|
}
|
|
|
|
|
2016-06-18 02:43:59 +02:00
|
|
|
void SConfig::LoadAnalyticsSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* analytics = ini.GetOrCreateSection("Analytics");
|
|
|
|
|
|
|
|
analytics->Get("ID", &m_analytics_id, "");
|
|
|
|
analytics->Get("Enabled", &m_analytics_enabled, false);
|
|
|
|
analytics->Get("PermissionAsked", &m_analytics_permission_asked, false);
|
|
|
|
}
|
|
|
|
|
2016-08-23 16:19:30 +02:00
|
|
|
void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
|
|
|
|
|
|
|
|
section->Get("Enabled", &m_bt_passthrough_enabled, false);
|
|
|
|
section->Get("VID", &m_bt_passthrough_vid, -1);
|
|
|
|
section->Get("PID", &m_bt_passthrough_pid, -1);
|
2016-09-16 23:25:57 +02:00
|
|
|
section->Get("LinkKeys", &m_bt_passthrough_link_keys, "");
|
2016-08-23 16:19:30 +02:00
|
|
|
}
|
|
|
|
|
2016-11-11 01:33:52 +01:00
|
|
|
void SConfig::LoadUSBPassthroughSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("USBPassthrough");
|
|
|
|
m_usb_passthrough_devices.clear();
|
|
|
|
std::string devices_string;
|
|
|
|
section->Get("Devices", &devices_string, "");
|
2017-06-11 16:33:10 +02:00
|
|
|
for (const auto& pair : SplitString(devices_string, ','))
|
2016-11-11 01:33:52 +01:00
|
|
|
{
|
|
|
|
const auto index = pair.find(':');
|
|
|
|
if (index == std::string::npos)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
const u16 vid = static_cast<u16>(strtol(pair.substr(0, index).c_str(), nullptr, 16));
|
|
|
|
const u16 pid = static_cast<u16>(strtol(pair.substr(index + 1).c_str(), nullptr, 16));
|
|
|
|
if (vid && pid)
|
|
|
|
m_usb_passthrough_devices.emplace(vid, pid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-17 17:22:05 -07:00
|
|
|
void SConfig::LoadAutoUpdateSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("AutoUpdate");
|
|
|
|
|
2018-05-02 17:23:41 +02:00
|
|
|
section->Get("UpdateTrack", &m_auto_update_track, SCM_UPDATE_TRACK_STR);
|
2018-03-17 17:22:05 -07:00
|
|
|
section->Get("HashOverride", &m_auto_update_hash_override, "");
|
|
|
|
}
|
|
|
|
|
2018-12-02 23:11:29 -05:00
|
|
|
void SConfig::LoadJitDebugSettings(IniFile& ini)
|
|
|
|
{
|
|
|
|
IniFile::Section* section = ini.GetOrCreateSection("Debug");
|
|
|
|
section->Get("JitOff", &bJITOff, false);
|
|
|
|
section->Get("JitLoadStoreOff", &bJITLoadStoreOff, false);
|
|
|
|
section->Get("JitLoadStoreFloatingOff", &bJITLoadStoreFloatingOff, false);
|
|
|
|
section->Get("JitLoadStorePairedOff", &bJITLoadStorePairedOff, false);
|
|
|
|
section->Get("JitFloatingPointOff", &bJITFloatingPointOff, false);
|
|
|
|
section->Get("JitIntegerOff", &bJITIntegerOff, false);
|
|
|
|
section->Get("JitPairedOff", &bJITPairedOff, false);
|
|
|
|
section->Get("JitSystemRegistersOff", &bJITSystemRegistersOff, false);
|
|
|
|
section->Get("JitBranchOff", &bJITBranchOff, false);
|
|
|
|
}
|
|
|
|
|
2017-03-09 09:47:43 +01:00
|
|
|
void SConfig::ResetRunningGameMetadata()
|
|
|
|
{
|
2019-06-30 11:48:49 +02:00
|
|
|
SetRunningGameMetadata("00000000", "", 0, 0, DiscIO::Region::Unknown);
|
2017-03-09 09:47:43 +01:00
|
|
|
}
|
|
|
|
|
2017-06-06 11:49:01 +02:00
|
|
|
void SConfig::SetRunningGameMetadata(const DiscIO::Volume& volume,
|
2015-06-13 12:51:24 +02:00
|
|
|
const DiscIO::Partition& partition)
|
2017-03-09 09:47:43 +01:00
|
|
|
{
|
2018-10-16 21:37:49 +02:00
|
|
|
if (partition == volume.GetGamePartition())
|
|
|
|
{
|
2019-02-23 17:49:06 +01:00
|
|
|
SetRunningGameMetadata(volume.GetGameID(), volume.GetGameTDBID(),
|
2019-04-20 12:11:21 +02:00
|
|
|
volume.GetTitleID().value_or(0), volume.GetRevision().value_or(0),
|
2019-06-30 11:48:49 +02:00
|
|
|
volume.GetRegion());
|
2018-10-16 21:37:49 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-02-23 17:49:06 +01:00
|
|
|
SetRunningGameMetadata(volume.GetGameID(partition), volume.GetGameTDBID(),
|
|
|
|
volume.GetTitleID(partition).value_or(0),
|
2019-06-30 11:48:49 +02:00
|
|
|
volume.GetRevision(partition).value_or(0), volume.GetRegion());
|
2018-10-16 21:37:49 +02:00
|
|
|
}
|
2017-03-09 09:47:43 +01:00
|
|
|
}
|
|
|
|
|
2019-07-20 08:37:14 +02:00
|
|
|
void SConfig::SetRunningGameMetadata(const IOS::ES::TMDReader& tmd, DiscIO::Platform platform)
|
2017-03-09 09:47:43 +01:00
|
|
|
{
|
2017-03-09 18:07:20 +01:00
|
|
|
const u64 tmd_title_id = tmd.GetTitleId();
|
2017-03-09 09:47:43 +01:00
|
|
|
|
2017-03-09 18:07:20 +01:00
|
|
|
// If we're launching a disc game, we want to read the revision from
|
|
|
|
// the disc header instead of the TMD. They can differ.
|
|
|
|
// (IOS HLE ES calls us with a TMDReader rather than a volume when launching
|
|
|
|
// a disc game, because ES has no reason to be accessing the disc directly.)
|
2019-07-20 08:37:14 +02:00
|
|
|
if (platform == DiscIO::Platform::WiiWAD ||
|
|
|
|
!DVDInterface::UpdateRunningGameMetadata(tmd_title_id))
|
2017-03-09 09:47:43 +01:00
|
|
|
{
|
2016-09-24 14:43:03 +02:00
|
|
|
// If not launching a disc game, just read everything from the TMD.
|
2019-04-20 12:11:21 +02:00
|
|
|
SetRunningGameMetadata(tmd.GetGameID(), tmd.GetGameTDBID(), tmd_title_id, tmd.GetTitleVersion(),
|
2019-06-30 11:48:49 +02:00
|
|
|
tmd.GetRegion());
|
2017-03-09 09:47:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-23 17:49:06 +01:00
|
|
|
void SConfig::SetRunningGameMetadata(const std::string& game_id, const std::string& gametdb_id,
|
2019-06-30 11:48:49 +02:00
|
|
|
u64 title_id, u16 revision, DiscIO::Region region)
|
2017-03-09 09:47:43 +01:00
|
|
|
{
|
2019-02-23 17:49:06 +01:00
|
|
|
const bool was_changed = m_game_id != game_id || m_gametdb_id != gametdb_id ||
|
|
|
|
m_title_id != title_id || m_revision != revision;
|
2017-03-09 09:47:43 +01:00
|
|
|
m_game_id = game_id;
|
2019-02-23 17:49:06 +01:00
|
|
|
m_gametdb_id = gametdb_id;
|
2017-03-09 09:47:43 +01:00
|
|
|
m_title_id = title_id;
|
|
|
|
m_revision = revision;
|
|
|
|
|
2017-06-05 13:55:54 +02:00
|
|
|
if (game_id.length() == 6)
|
|
|
|
{
|
|
|
|
m_debugger_game_id = game_id;
|
|
|
|
}
|
|
|
|
else if (title_id != 0)
|
|
|
|
{
|
|
|
|
m_debugger_game_id =
|
|
|
|
StringFromFormat("%08X_%08X", static_cast<u32>(title_id >> 32), static_cast<u32>(title_id));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_debugger_game_id.clear();
|
|
|
|
}
|
|
|
|
|
2017-05-15 11:17:51 +02:00
|
|
|
if (!was_changed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (game_id == "00000000")
|
2017-03-09 09:47:43 +01:00
|
|
|
{
|
2017-05-15 11:17:51 +02:00
|
|
|
m_title_description.clear();
|
|
|
|
return;
|
|
|
|
}
|
2017-03-09 09:47:43 +01:00
|
|
|
|
2017-05-15 11:17:51 +02:00
|
|
|
const Core::TitleDatabase title_database;
|
2019-06-30 11:48:49 +02:00
|
|
|
const DiscIO::Language language = GetLanguageAdjustedForRegion(bWii, region);
|
2019-04-20 12:11:21 +02:00
|
|
|
m_title_description = title_database.Describe(m_gametdb_id, language);
|
2017-05-15 11:17:51 +02:00
|
|
|
NOTICE_LOG(CORE, "Active title: %s", m_title_description.c_str());
|
2019-02-13 21:31:31 -05:00
|
|
|
Host_TitleChanged();
|
2017-05-15 11:17:51 +02:00
|
|
|
|
2017-07-31 13:39:35 +08:00
|
|
|
Config::AddLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
|
|
|
|
Config::AddLayer(ConfigLoaders::GenerateLocalGameConfigLoader(game_id, revision));
|
|
|
|
|
2017-05-15 11:17:51 +02:00
|
|
|
if (Core::IsRunning())
|
|
|
|
{
|
|
|
|
// TODO: have a callback mechanism for title changes?
|
2019-05-01 17:32:45 +02:00
|
|
|
if (!g_symbolDB.IsEmpty())
|
|
|
|
{
|
|
|
|
g_symbolDB.Clear();
|
|
|
|
Host_NotifyMapLoaded();
|
|
|
|
}
|
2017-05-15 11:17:51 +02:00
|
|
|
CBoot::LoadMapFromFilename();
|
|
|
|
HLE::Reload();
|
|
|
|
PatchEngine::Reload();
|
|
|
|
HiresTexture::Update();
|
2019-06-23 19:26:07 +02:00
|
|
|
DolphinAnalytics::Instance().ReportGameStart();
|
2017-03-09 09:47:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
void SConfig::LoadDefaults()
|
|
|
|
{
|
|
|
|
bEnableDebugging = false;
|
|
|
|
bAutomaticStart = false;
|
|
|
|
bBootToPause = false;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
#ifdef USE_GDBSTUB
|
|
|
|
iGDBPort = -1;
|
|
|
|
#ifndef _WIN32
|
|
|
|
gdb_socket = "";
|
|
|
|
#endif
|
|
|
|
#endif
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2018-06-15 08:11:18 -04:00
|
|
|
cpu_core = PowerPC::DefaultCPUCore();
|
2015-10-25 14:04:42 +01:00
|
|
|
iTimingVariance = 40;
|
2015-06-12 13:56:53 +02:00
|
|
|
bCPUThread = false;
|
|
|
|
bSyncGPUOnSkipIdleHack = true;
|
|
|
|
bRunCompareServer = false;
|
|
|
|
bDSPHLE = true;
|
|
|
|
bFastmem = true;
|
|
|
|
bFPRF = false;
|
|
|
|
bAccurateNaNs = false;
|
2018-03-16 21:04:51 +01:00
|
|
|
#ifdef _M_X86_64
|
|
|
|
bMMU = true;
|
|
|
|
#else
|
2015-06-12 13:56:53 +02:00
|
|
|
bMMU = false;
|
2018-03-16 21:04:51 +01:00
|
|
|
#endif
|
2017-01-26 04:57:03 -05:00
|
|
|
bLowDCBZHack = false;
|
2015-06-12 13:56:53 +02:00
|
|
|
iBBDumpPort = -1;
|
|
|
|
bSyncGPU = false;
|
|
|
|
bFastDiscSpeed = false;
|
2015-08-28 16:00:12 -07:00
|
|
|
bEnableMemcardSdWriting = true;
|
2015-06-12 13:56:53 +02:00
|
|
|
SelectedLanguage = 0;
|
2019-06-30 11:48:49 +02:00
|
|
|
bOverrideRegionSettings = false;
|
2015-06-12 13:56:53 +02:00
|
|
|
bWii = false;
|
|
|
|
bDPL2Decoder = false;
|
2017-06-17 07:43:37 -03:00
|
|
|
iLatency = 20;
|
2017-04-10 17:56:24 +01:00
|
|
|
m_audio_stretch = false;
|
|
|
|
m_audio_stretch_max_latency = 80;
|
2018-03-23 03:41:14 -04:00
|
|
|
bUsePanicHandlers = true;
|
2018-03-23 11:36:11 -04:00
|
|
|
bOnScreenDisplayMessages = true;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-06-18 02:43:59 +02:00
|
|
|
m_analytics_id = "";
|
|
|
|
m_analytics_enabled = false;
|
|
|
|
m_analytics_permission_asked = false;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
bLoopFifoReplay = true;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
bJITOff = false; // debugger only settings
|
|
|
|
bJITLoadStoreOff = false;
|
|
|
|
bJITLoadStoreFloatingOff = false;
|
|
|
|
bJITLoadStorePairedOff = false;
|
|
|
|
bJITFloatingPointOff = false;
|
|
|
|
bJITIntegerOff = false;
|
|
|
|
bJITPairedOff = false;
|
|
|
|
bJITSystemRegistersOff = false;
|
2015-06-28 11:06:16 +02:00
|
|
|
bJITBranchOff = false;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-03-09 09:47:43 +01:00
|
|
|
ResetRunningGameMetadata();
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
2016-06-25 11:24:43 -04:00
|
|
|
|
2016-11-11 01:33:52 +01:00
|
|
|
bool SConfig::IsUSBDeviceWhitelisted(const std::pair<u16, u16> vid_pid) const
|
|
|
|
{
|
|
|
|
return m_usb_passthrough_devices.find(vid_pid) != m_usb_passthrough_devices.end();
|
|
|
|
}
|
|
|
|
|
2017-07-16 16:31:12 +02:00
|
|
|
// The reason we need this function is because some memory card code
|
|
|
|
// expects to get a non-NTSC-K region even if we're emulating an NTSC-K Wii.
|
|
|
|
DiscIO::Region SConfig::ToGameCubeRegion(DiscIO::Region region)
|
|
|
|
{
|
|
|
|
if (region != DiscIO::Region::NTSC_K)
|
|
|
|
return region;
|
|
|
|
|
|
|
|
// GameCube has no NTSC-K region. No choice of replacement value is completely
|
|
|
|
// non-arbitrary, but let's go with NTSC-J since Korean GameCubes are NTSC-J.
|
|
|
|
return DiscIO::Region::NTSC_J;
|
|
|
|
}
|
|
|
|
|
2016-12-23 21:53:36 +01:00
|
|
|
const char* SConfig::GetDirectoryForRegion(DiscIO::Region region)
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
2018-07-21 02:37:56 -04:00
|
|
|
if (region == DiscIO::Region::Unknown)
|
|
|
|
region = ToGameCubeRegion(GetFallbackRegion());
|
|
|
|
|
2016-12-23 18:41:21 +01:00
|
|
|
switch (region)
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
2016-12-23 18:41:21 +01:00
|
|
|
case DiscIO::Region::NTSC_J:
|
2015-06-12 13:56:53 +02:00
|
|
|
return JAP_DIR;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-12-23 18:41:21 +01:00
|
|
|
case DiscIO::Region::NTSC_U:
|
|
|
|
return USA_DIR;
|
|
|
|
|
|
|
|
case DiscIO::Region::PAL:
|
2015-06-12 13:56:53 +02:00
|
|
|
return EUR_DIR;
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2016-12-23 18:41:21 +01:00
|
|
|
case DiscIO::Region::NTSC_K:
|
2018-03-14 20:34:35 -04:00
|
|
|
ASSERT_MSG(BOOT, false, "NTSC-K is not a valid GameCube region");
|
2018-07-21 02:37:56 -04:00
|
|
|
return JAP_DIR; // See ToGameCubeRegion
|
2016-12-23 18:41:21 +01:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
default:
|
2018-07-21 02:37:56 -04:00
|
|
|
ASSERT_MSG(BOOT, false, "Default case should not be reached");
|
|
|
|
return EUR_DIR;
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-21 22:21:34 +01:00
|
|
|
std::string SConfig::GetBootROMPath(const std::string& region_directory) const
|
|
|
|
{
|
|
|
|
const std::string path =
|
|
|
|
File::GetUserPath(D_GCUSER_IDX) + DIR_SEP + region_directory + DIR_SEP GC_IPL;
|
|
|
|
if (!File::Exists(path))
|
|
|
|
return File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + region_directory + DIR_SEP GC_IPL;
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
struct SetGameMetadata
|
2017-01-25 14:42:11 +01:00
|
|
|
{
|
2017-05-27 15:43:40 +02:00
|
|
|
SetGameMetadata(SConfig* config_, DiscIO::Region* region_) : config(config_), region(region_) {}
|
|
|
|
bool operator()(const BootParameters::Disc& disc) const
|
|
|
|
{
|
|
|
|
config->SetRunningGameMetadata(*disc.volume, disc.volume->GetGamePartition());
|
2018-03-31 14:04:13 +02:00
|
|
|
config->bWii = disc.volume->GetVolumeType() == DiscIO::Platform::WiiDisc;
|
2017-05-27 15:43:40 +02:00
|
|
|
config->m_disc_booted_from_game_list = true;
|
|
|
|
*region = disc.volume->GetRegion();
|
|
|
|
return true;
|
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
bool operator()(const BootParameters::Executable& executable) const
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
2017-05-28 17:12:38 +02:00
|
|
|
if (!executable.reader->IsValid())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
config->bWii = executable.reader->IsWii();
|
2017-05-27 15:43:40 +02:00
|
|
|
|
2018-03-31 14:04:13 +02:00
|
|
|
*region = DiscIO::Region::Unknown;
|
2017-06-05 13:55:54 +02:00
|
|
|
|
|
|
|
// Strip the .elf/.dol file extension and directories before the name
|
|
|
|
SplitPath(executable.path, nullptr, &config->m_debugger_game_id, nullptr);
|
2017-05-27 15:43:40 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-07-14 18:00:14 +02:00
|
|
|
bool operator()(const DiscIO::VolumeWAD& wad) const
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
2019-07-14 18:00:14 +02:00
|
|
|
if (!wad.GetTMD().IsValid())
|
2017-10-01 15:14:53 +02:00
|
|
|
{
|
|
|
|
PanicAlertT("This WAD is not valid.");
|
2015-06-12 13:56:53 +02:00
|
|
|
return false;
|
2017-10-01 15:14:53 +02:00
|
|
|
}
|
|
|
|
if (!IOS::ES::IsChannel(wad.GetTMD().GetTitleId()))
|
|
|
|
{
|
|
|
|
PanicAlertT("This WAD is not bootable.");
|
|
|
|
return false;
|
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-10-01 15:14:53 +02:00
|
|
|
const IOS::ES::TMDReader& tmd = wad.GetTMD();
|
2019-07-20 08:37:14 +02:00
|
|
|
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
2017-05-27 15:43:40 +02:00
|
|
|
config->bWii = true;
|
|
|
|
*region = tmd.GetRegion();
|
|
|
|
return true;
|
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-10-01 15:41:54 +02:00
|
|
|
bool operator()(const BootParameters::NANDTitle& nand_title) const
|
|
|
|
{
|
|
|
|
IOS::HLE::Kernel ios;
|
|
|
|
const IOS::ES::TMDReader tmd = ios.GetES()->FindInstalledTMD(nand_title.id);
|
|
|
|
if (!tmd.IsValid() || !IOS::ES::IsChannel(nand_title.id))
|
|
|
|
{
|
|
|
|
PanicAlertT("This title cannot be booted.");
|
|
|
|
return false;
|
|
|
|
}
|
2019-07-20 08:37:14 +02:00
|
|
|
config->SetRunningGameMetadata(tmd, DiscIO::Platform::WiiWAD);
|
2017-10-01 15:41:54 +02:00
|
|
|
config->bWii = true;
|
|
|
|
*region = tmd.GetRegion();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
bool operator()(const BootParameters::IPL& ipl) const
|
|
|
|
{
|
|
|
|
config->bWii = false;
|
|
|
|
*region = ipl.region;
|
|
|
|
return true;
|
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
bool operator()(const BootParameters::DFF& dff) const
|
|
|
|
{
|
|
|
|
std::unique_ptr<FifoDataFile> dff_file(FifoDataFile::Load(dff.dff_path, true));
|
|
|
|
if (!dff_file)
|
2015-06-12 13:56:53 +02:00
|
|
|
return false;
|
2017-05-27 15:43:40 +02:00
|
|
|
|
|
|
|
config->bWii = dff_file->GetIsWii();
|
|
|
|
*region = DiscIO::Region::NTSC_U;
|
|
|
|
return true;
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
2017-05-27 15:43:40 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
SConfig* config;
|
|
|
|
DiscIO::Region* region;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool SConfig::SetPathsAndGameMetadata(const BootParameters& boot)
|
|
|
|
{
|
|
|
|
m_is_mios = false;
|
|
|
|
m_disc_booted_from_game_list = false;
|
2017-07-05 10:27:13 +02:00
|
|
|
if (!std::visit(SetGameMetadata(this, &m_region), boot.parameters))
|
2017-05-27 15:43:40 +02:00
|
|
|
return false;
|
|
|
|
|
2018-03-31 14:04:13 +02:00
|
|
|
if (m_region == DiscIO::Region::Unknown)
|
2018-07-21 02:37:56 -04:00
|
|
|
m_region = GetFallbackRegion();
|
2017-07-05 10:27:13 +02:00
|
|
|
|
2017-05-27 15:43:40 +02:00
|
|
|
// Set up paths
|
2017-07-05 10:27:13 +02:00
|
|
|
const std::string region_dir = GetDirectoryForRegion(ToGameCubeRegion(m_region));
|
2015-06-12 13:56:53 +02:00
|
|
|
m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
|
2017-07-05 10:27:13 +02:00
|
|
|
m_strBootROM = GetBootROMPath(region_dir);
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
return true;
|
|
|
|
}
|
2016-06-24 10:43:46 +02:00
|
|
|
|
2018-07-21 02:37:56 -04:00
|
|
|
DiscIO::Region SConfig::GetFallbackRegion()
|
|
|
|
{
|
|
|
|
// Fall back to the system menu region, if possible.
|
|
|
|
IOS::HLE::Kernel ios;
|
|
|
|
const IOS::ES::TMDReader system_menu_tmd = ios.GetES()->FindInstalledTMD(Titles::SYSTEM_MENU);
|
|
|
|
if (system_menu_tmd.IsValid())
|
2018-09-30 11:22:43 +02:00
|
|
|
{
|
|
|
|
const DiscIO::Region region = system_menu_tmd.GetRegion();
|
|
|
|
if (region != DiscIO::Region::Unknown)
|
|
|
|
return region;
|
|
|
|
}
|
2018-07-21 02:37:56 -04:00
|
|
|
|
|
|
|
// Fall back to PAL.
|
|
|
|
return DiscIO::Region::PAL;
|
|
|
|
}
|
|
|
|
|
2016-07-06 20:33:05 +02:00
|
|
|
DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
2016-07-06 20:33:05 +02:00
|
|
|
int language_value;
|
2015-06-12 13:56:53 +02:00
|
|
|
if (wii)
|
2017-08-01 22:37:42 +08:00
|
|
|
language_value = Config::Get(Config::SYSCONF_LANGUAGE);
|
2015-06-12 13:56:53 +02:00
|
|
|
else
|
2016-07-06 20:33:05 +02:00
|
|
|
language_value = SConfig::GetInstance().SelectedLanguage + 1;
|
|
|
|
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);
|
2015-06-12 13:56:53 +02:00
|
|
|
|
|
|
|
// Get rid of invalid values (probably doesn't matter, but might as well do it)
|
2018-03-31 14:04:13 +02:00
|
|
|
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
|
|
|
|
language = DiscIO::Language::Unknown;
|
2015-06-12 13:56:53 +02:00
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2019-06-30 11:48:49 +02:00
|
|
|
DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region region) const
|
|
|
|
{
|
|
|
|
const DiscIO::Language language = GetCurrentLanguage(wii);
|
|
|
|
|
|
|
|
if (!wii && region == DiscIO::Region::NTSC_K)
|
|
|
|
region = DiscIO::Region::NTSC_J; // NTSC-K only exists on Wii, so use a fallback
|
|
|
|
|
|
|
|
if (!wii && region == DiscIO::Region::NTSC_J && language == DiscIO::Language::English)
|
|
|
|
return DiscIO::Language::Japanese; // English and Japanese both use the value 0 in GC SRAM
|
|
|
|
|
|
|
|
if (!bOverrideRegionSettings)
|
|
|
|
{
|
|
|
|
if (region == DiscIO::Region::NTSC_J)
|
|
|
|
return DiscIO::Language::Japanese;
|
|
|
|
|
|
|
|
if (region == DiscIO::Region::NTSC_U && language != DiscIO::Language::English &&
|
|
|
|
(!wii || (language != DiscIO::Language::French && language != DiscIO::Language::Spanish)))
|
|
|
|
{
|
|
|
|
return DiscIO::Language::English;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (region == DiscIO::Region::PAL &&
|
|
|
|
(language < DiscIO::Language::English || language > DiscIO::Language::Dutch))
|
|
|
|
{
|
|
|
|
return DiscIO::Language::English;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (region == DiscIO::Region::NTSC_K)
|
|
|
|
return DiscIO::Language::Korean;
|
|
|
|
}
|
|
|
|
|
|
|
|
return language;
|
|
|
|
}
|
|
|
|
|
2015-06-12 13:56:53 +02:00
|
|
|
IniFile SConfig::LoadDefaultGameIni() const
|
|
|
|
{
|
2016-10-29 14:42:43 +02:00
|
|
|
return LoadDefaultGameIni(GetGameID(), m_revision);
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IniFile SConfig::LoadLocalGameIni() const
|
|
|
|
{
|
2016-10-29 14:42:43 +02:00
|
|
|
return LoadLocalGameIni(GetGameID(), m_revision);
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
IniFile SConfig::LoadGameIni() const
|
|
|
|
{
|
2016-10-29 14:42:43 +02:00
|
|
|
return LoadGameIni(GetGameID(), m_revision);
|
2015-06-12 13:56:53 +02:00
|
|
|
}
|
|
|
|
|
2017-06-04 10:33:14 +02:00
|
|
|
IniFile SConfig::LoadDefaultGameIni(const std::string& id, std::optional<u16> revision)
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2017-07-11 13:10:11 +02:00
|
|
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
2015-06-12 13:56:53 +02:00
|
|
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
|
|
|
return game_ini;
|
|
|
|
}
|
|
|
|
|
2017-06-04 10:33:14 +02:00
|
|
|
IniFile SConfig::LoadLocalGameIni(const std::string& id, std::optional<u16> revision)
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2017-07-11 13:10:11 +02:00
|
|
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
2015-06-12 13:56:53 +02:00
|
|
|
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
|
|
|
return game_ini;
|
|
|
|
}
|
|
|
|
|
2017-06-04 10:33:14 +02:00
|
|
|
IniFile SConfig::LoadGameIni(const std::string& id, std::optional<u16> revision)
|
2015-06-12 13:56:53 +02:00
|
|
|
{
|
|
|
|
IniFile game_ini;
|
2017-07-11 13:10:11 +02:00
|
|
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
2015-06-12 13:56:53 +02:00
|
|
|
game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + filename, true);
|
2017-07-11 13:10:11 +02:00
|
|
|
for (const std::string& filename : ConfigLoaders::GetGameIniFilenames(id, revision))
|
2015-06-12 13:56:53 +02:00
|
|
|
game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + filename, true);
|
|
|
|
return game_ini;
|
|
|
|
}
|