Merge pull request #10340 from AdmiralCurtiss/config-port-core-1

Config: Port remaining Core settings to new config system (partial).
This commit is contained in:
JMC47 2022-01-05 04:53:04 -05:00 committed by GitHub
commit bc14485489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 188 additions and 218 deletions

View File

@ -16,6 +16,7 @@
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/CommonTitles.h" #include "Core/CommonTitles.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
@ -301,7 +302,7 @@ bool CBoot::SetupWiiMemory(IOS::HLE::IOSC::ConsoleType console_type)
model = gen.GetValue("MODEL"); model = gen.GetValue("MODEL");
bool region_matches = false; bool region_matches = false;
if (SConfig::GetInstance().bOverrideRegionSettings) if (Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS))
{ {
region_matches = true; region_matches = true;
} }

View File

@ -73,23 +73,14 @@ public:
private: private:
bool valid = false; bool valid = false;
bool bCPUThread = false; bool bCPUThread = false;
bool bJITFollowBranch = false;
bool bSyncGPUOnSkipIdleHack = false; bool bSyncGPUOnSkipIdleHack = false;
bool bFloatExceptions = false;
bool bDivideByZeroExceptions = false;
bool bFPRF = false;
bool bAccurateNaNs = false;
bool bMMU = false; bool bMMU = false;
bool bLowDCBZHack = false;
bool bDisableICache = false; bool bDisableICache = false;
bool bSyncGPU = false; bool bSyncGPU = false;
int iSyncGpuMaxDistance = 0; int iSyncGpuMaxDistance = 0;
int iSyncGpuMinDistance = 0; int iSyncGpuMinDistance = 0;
float fSyncGpuOverclock = 0; float fSyncGpuOverclock = 0;
bool bFastDiscSpeed = false; bool bFastDiscSpeed = false;
bool bHLE_BS2 = false;
int iSelectedLanguage = 0;
PowerPC::CPUCore cpu_core = PowerPC::CPUCore::Interpreter;
float m_EmulationSpeed = 0; float m_EmulationSpeed = 0;
std::string m_strGPUDeterminismMode; std::string m_strGPUDeterminismMode;
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{}; std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource{};
@ -102,12 +93,7 @@ void ConfigCache::SaveConfig(const SConfig& config)
valid = true; valid = true;
bCPUThread = config.bCPUThread; bCPUThread = config.bCPUThread;
bJITFollowBranch = config.bJITFollowBranch;
bSyncGPUOnSkipIdleHack = config.bSyncGPUOnSkipIdleHack; bSyncGPUOnSkipIdleHack = config.bSyncGPUOnSkipIdleHack;
bFloatExceptions = config.bFloatExceptions;
bDivideByZeroExceptions = config.bDivideByZeroExceptions;
bFPRF = config.bFPRF;
bAccurateNaNs = config.bAccurateNaNs;
bDisableICache = config.bDisableICache; bDisableICache = config.bDisableICache;
bMMU = config.bMMU; bMMU = config.bMMU;
bSyncGPU = config.bSyncGPU; bSyncGPU = config.bSyncGPU;
@ -115,9 +101,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
iSyncGpuMinDistance = config.iSyncGpuMinDistance; iSyncGpuMinDistance = config.iSyncGpuMinDistance;
fSyncGpuOverclock = config.fSyncGpuOverclock; fSyncGpuOverclock = config.fSyncGpuOverclock;
bFastDiscSpeed = config.bFastDiscSpeed; bFastDiscSpeed = config.bFastDiscSpeed;
bHLE_BS2 = config.bHLE_BS2;
iSelectedLanguage = config.SelectedLanguage;
cpu_core = config.cpu_core;
m_EmulationSpeed = config.m_EmulationSpeed; m_EmulationSpeed = config.m_EmulationSpeed;
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode; m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
@ -142,23 +125,14 @@ void ConfigCache::RestoreConfig(SConfig* config)
valid = false; valid = false;
config->bCPUThread = bCPUThread; config->bCPUThread = bCPUThread;
config->bJITFollowBranch = bJITFollowBranch;
config->bSyncGPUOnSkipIdleHack = bSyncGPUOnSkipIdleHack; config->bSyncGPUOnSkipIdleHack = bSyncGPUOnSkipIdleHack;
config->bFloatExceptions = bFloatExceptions;
config->bDivideByZeroExceptions = bDivideByZeroExceptions;
config->bFPRF = bFPRF;
config->bAccurateNaNs = bAccurateNaNs;
config->bDisableICache = bDisableICache; config->bDisableICache = bDisableICache;
config->bMMU = bMMU; config->bMMU = bMMU;
config->bLowDCBZHack = bLowDCBZHack;
config->bSyncGPU = bSyncGPU; config->bSyncGPU = bSyncGPU;
config->iSyncGpuMaxDistance = iSyncGpuMaxDistance; config->iSyncGpuMaxDistance = iSyncGpuMaxDistance;
config->iSyncGpuMinDistance = iSyncGpuMinDistance; config->iSyncGpuMinDistance = iSyncGpuMinDistance;
config->fSyncGpuOverclock = fSyncGpuOverclock; config->fSyncGpuOverclock = fSyncGpuOverclock;
config->bFastDiscSpeed = bFastDiscSpeed; config->bFastDiscSpeed = bFastDiscSpeed;
config->bHLE_BS2 = bHLE_BS2;
config->SelectedLanguage = iSelectedLanguage;
config->cpu_core = cpu_core;
// Only change these back if they were actually set by game ini, since they can be changed while a // Only change these back if they were actually set by game ini, since they can be changed while a
// game is running. // game is running.
@ -235,22 +209,12 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls"); IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
core_section->Get("JITFollowBranch", &StartUp.bJITFollowBranch, StartUp.bJITFollowBranch);
core_section->Get("SyncOnSkipIdle", &StartUp.bSyncGPUOnSkipIdleHack, core_section->Get("SyncOnSkipIdle", &StartUp.bSyncGPUOnSkipIdleHack,
StartUp.bSyncGPUOnSkipIdleHack); StartUp.bSyncGPUOnSkipIdleHack);
core_section->Get("FloatExceptions", &StartUp.bFloatExceptions, StartUp.bFloatExceptions);
core_section->Get("DivByZeroExceptions", &StartUp.bDivideByZeroExceptions,
StartUp.bDivideByZeroExceptions);
core_section->Get("FPRF", &StartUp.bFPRF, StartUp.bFPRF);
core_section->Get("AccurateNaNs", &StartUp.bAccurateNaNs, StartUp.bAccurateNaNs);
core_section->Get("DisableICache", &StartUp.bDisableICache, StartUp.bDisableICache); core_section->Get("DisableICache", &StartUp.bDisableICache, StartUp.bDisableICache);
core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU); core_section->Get("MMU", &StartUp.bMMU, StartUp.bMMU);
core_section->Get("LowDCBZHack", &StartUp.bLowDCBZHack, StartUp.bLowDCBZHack);
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU); core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
core_section->Get("CPUCore", &StartUp.cpu_core, StartUp.cpu_core);
core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
core_section->Get("GameCubeLanguage", &StartUp.SelectedLanguage, StartUp.SelectedLanguage);
if (core_section->Get("EmulationSpeed", &StartUp.m_EmulationSpeed, StartUp.m_EmulationSpeed)) if (core_section->Get("EmulationSpeed", &StartUp.m_EmulationSpeed, StartUp.m_EmulationSpeed))
config_cache.bSetEmulationSpeed = true; config_cache.bSetEmulationSpeed = true;
@ -302,12 +266,8 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
{ {
// TODO: remove this once ConfigManager starts using OnionConfig. // TODO: remove this once ConfigManager starts using OnionConfig.
StartUp.bCPUThread = Config::Get(Config::MAIN_CPU_THREAD); StartUp.bCPUThread = Config::Get(Config::MAIN_CPU_THREAD);
StartUp.bJITFollowBranch = Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH);
StartUp.bFastDiscSpeed = Config::Get(Config::MAIN_FAST_DISC_SPEED); StartUp.bFastDiscSpeed = Config::Get(Config::MAIN_FAST_DISC_SPEED);
StartUp.cpu_core = Config::Get(Config::MAIN_CPU_CORE);
StartUp.bSyncGPU = Config::Get(Config::MAIN_SYNC_GPU); StartUp.bSyncGPU = Config::Get(Config::MAIN_SYNC_GPU);
if (!StartUp.bWii)
StartUp.SelectedLanguage = Config::Get(Config::MAIN_GC_LANGUAGE);
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ {
if (Movie::IsUsingMemcard(i) && Movie::IsStartingFromClearSave() && !StartUp.bWii) if (Movie::IsUsingMemcard(i) && Movie::IsStartingFromClearSave() && !StartUp.bWii)
@ -330,30 +290,21 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(netplay_settings)); Config::AddLayer(ConfigLoaders::GenerateNetPlayConfigLoader(netplay_settings));
StartUp.bCPUThread = netplay_settings.m_CPUthread; StartUp.bCPUThread = netplay_settings.m_CPUthread;
StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave; StartUp.bCopyWiiSaveNetplay = netplay_settings.m_CopyWiiSave;
StartUp.cpu_core = netplay_settings.m_CPUcore;
StartUp.SelectedLanguage = netplay_settings.m_SelectedLanguage;
StartUp.bOverrideRegionSettings = netplay_settings.m_OverrideRegionSettings;
StartUp.m_EXIDevice[0] = netplay_settings.m_EXIDevice[0]; StartUp.m_EXIDevice[0] = netplay_settings.m_EXIDevice[0];
StartUp.m_EXIDevice[1] = netplay_settings.m_EXIDevice[1]; StartUp.m_EXIDevice[1] = netplay_settings.m_EXIDevice[1];
StartUp.m_EXIDevice[2] = netplay_settings.m_EXIDevice[2]; StartUp.m_EXIDevice[2] = netplay_settings.m_EXIDevice[2];
config_cache.bSetEXIDevice[0] = true; config_cache.bSetEXIDevice[0] = true;
config_cache.bSetEXIDevice[1] = true; config_cache.bSetEXIDevice[1] = true;
config_cache.bSetEXIDevice[2] = true; config_cache.bSetEXIDevice[2] = true;
StartUp.bFPRF = netplay_settings.m_FPRF;
StartUp.bAccurateNaNs = netplay_settings.m_AccurateNaNs;
StartUp.bDisableICache = netplay_settings.m_DisableICache; StartUp.bDisableICache = netplay_settings.m_DisableICache;
StartUp.bSyncGPUOnSkipIdleHack = netplay_settings.m_SyncOnSkipIdle; StartUp.bSyncGPUOnSkipIdleHack = netplay_settings.m_SyncOnSkipIdle;
StartUp.bFloatExceptions = netplay_settings.m_FloatExceptions;
StartUp.bDivideByZeroExceptions = netplay_settings.m_DivideByZeroExceptions;
StartUp.bSyncGPU = netplay_settings.m_SyncGPU; StartUp.bSyncGPU = netplay_settings.m_SyncGPU;
StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance; StartUp.iSyncGpuMaxDistance = netplay_settings.m_SyncGpuMaxDistance;
StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance; StartUp.iSyncGpuMinDistance = netplay_settings.m_SyncGpuMinDistance;
StartUp.fSyncGpuOverclock = netplay_settings.m_SyncGpuOverclock; StartUp.fSyncGpuOverclock = netplay_settings.m_SyncGpuOverclock;
StartUp.bJITFollowBranch = netplay_settings.m_JITFollowBranch;
StartUp.bFastDiscSpeed = netplay_settings.m_FastDiscSpeed; StartUp.bFastDiscSpeed = netplay_settings.m_FastDiscSpeed;
StartUp.bMMU = netplay_settings.m_MMU; StartUp.bMMU = netplay_settings.m_MMU;
StartUp.bFastmem = netplay_settings.m_Fastmem; StartUp.bFastmem = netplay_settings.m_Fastmem;
StartUp.bHLE_BS2 = netplay_settings.m_SkipIPL;
if (netplay_settings.m_HostInputAuthority && !netplay_settings.m_IsHosting) if (netplay_settings.m_HostInputAuthority && !netplay_settings.m_IsHosting)
config_cache.bSetEmulationSpeed = true; config_cache.bSetEmulationSpeed = true;
} }
@ -363,10 +314,11 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
} }
// Override out-of-region languages/countries to prevent games from crashing or behaving oddly // Override out-of-region languages/countries to prevent games from crashing or behaving oddly
if (!StartUp.bOverrideRegionSettings) if (!Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS))
{ {
StartUp.SelectedLanguage = Config::SetCurrent(
DiscIO::ToGameCubeLanguage(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region)); Config::MAIN_GC_LANGUAGE,
DiscIO::ToGameCubeLanguage(StartUp.GetLanguageAdjustedForRegion(false, StartUp.m_region)));
if (StartUp.bWii) if (StartUp.bWii)
{ {
@ -428,7 +380,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
} }
} }
const bool load_ipl = !StartUp.bWii && !StartUp.bHLE_BS2 && const bool load_ipl = !StartUp.bWii && !Config::Get(Config::MAIN_SKIP_IPL) &&
std::holds_alternative<BootParameters::Disc>(boot->parameters); std::holds_alternative<BootParameters::Disc>(boot->parameters);
if (load_ipl) if (load_ipl)
{ {

View File

@ -59,6 +59,8 @@ const Info<int> MAIN_SLOT_B{{System::Main, "Core", "SlotB"}, ExpansionInterface:
const Info<int> MAIN_SERIAL_PORT_1{{System::Main, "Core", "SerialPort1"}, const Info<int> MAIN_SERIAL_PORT_1{{System::Main, "Core", "SerialPort1"},
ExpansionInterface::EXIDEVICE_NONE}; ExpansionInterface::EXIDEVICE_NONE};
const Info<std::string> MAIN_BBA_MAC{{System::Main, "Core", "BBA_MAC"}, ""}; const Info<std::string> MAIN_BBA_MAC{{System::Main, "Core", "BBA_MAC"}, ""};
const Info<std::string> MAIN_BBA_XLINK_IP{{System::Main, "Core", "BBA_XLINK_IP"}, "127.0.0.1"};
const Info<bool> MAIN_BBA_XLINK_CHAT_OSD{{System::Main, "Core", "BBA_XLINK_CHAT_OSD"}, true};
Info<u32> GetInfoForSIDevice(u32 channel) Info<u32> GetInfoForSIDevice(u32 channel)
{ {
@ -67,14 +69,26 @@ Info<u32> GetInfoForSIDevice(u32 channel)
SerialInterface::SIDEVICE_NONE)}; SerialInterface::SIDEVICE_NONE)};
} }
Info<bool> GetInfoForAdapterRumble(u32 channel) const Info<bool>& GetInfoForAdapterRumble(int channel)
{ {
return {{System::Main, "Core", fmt::format("AdapterRumble{}", channel)}, true}; static const std::array<const Info<bool>, 4> infos{
Info<bool>{{System::Main, "Core", "AdapterRumble0"}, true},
Info<bool>{{System::Main, "Core", "AdapterRumble1"}, true},
Info<bool>{{System::Main, "Core", "AdapterRumble2"}, true},
Info<bool>{{System::Main, "Core", "AdapterRumble3"}, true},
};
return infos[channel];
} }
Info<bool> GetInfoForSimulateKonga(u32 channel) const Info<bool>& GetInfoForSimulateKonga(int channel)
{ {
return {{System::Main, "Core", fmt::format("SimulateKonga{}", channel)}, false}; static const std::array<const Info<bool>, 4> infos{
Info<bool>{{System::Main, "Core", "SimulateKonga0"}, false},
Info<bool>{{System::Main, "Core", "SimulateKonga1"}, false},
Info<bool>{{System::Main, "Core", "SimulateKonga2"}, false},
Info<bool>{{System::Main, "Core", "SimulateKonga3"}, false},
};
return infos[channel];
} }
const Info<bool> MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, true}; const Info<bool> MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, true};

View File

@ -63,9 +63,11 @@ extern const Info<int> MAIN_SLOT_A;
extern const Info<int> MAIN_SLOT_B; extern const Info<int> MAIN_SLOT_B;
extern const Info<int> MAIN_SERIAL_PORT_1; extern const Info<int> MAIN_SERIAL_PORT_1;
extern const Info<std::string> MAIN_BBA_MAC; extern const Info<std::string> MAIN_BBA_MAC;
extern const Info<std::string> MAIN_BBA_XLINK_IP;
extern const Info<bool> MAIN_BBA_XLINK_CHAT_OSD;
Info<u32> GetInfoForSIDevice(u32 channel); Info<u32> GetInfoForSIDevice(u32 channel);
Info<bool> GetInfoForAdapterRumble(u32 channel); const Info<bool>& GetInfoForAdapterRumble(int channel);
Info<bool> GetInfoForSimulateKonga(u32 channel); const Info<bool>& GetInfoForSimulateKonga(int channel);
extern const Info<bool> MAIN_WII_SD_CARD; extern const Info<bool> MAIN_WII_SD_CARD;
extern const Info<bool> MAIN_WII_KEYBOARD; extern const Info<bool> MAIN_WII_KEYBOARD;
extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING; extern const Info<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;

View File

@ -24,6 +24,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h" #include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h" #include "Core/ConfigLoaders/IsSettingSaveable.h"
@ -72,6 +73,8 @@ static const INIToLocationMap& GetINIToLocationMap()
{{"Core", "PAL60"}, {Config::SYSCONF_PAL60.GetLocation()}}, {{"Core", "PAL60"}, {Config::SYSCONF_PAL60.GetLocation()}},
{{"Wii", "Widescreen"}, {Config::SYSCONF_WIDESCREEN.GetLocation()}}, {{"Wii", "Widescreen"}, {Config::SYSCONF_WIDESCREEN.GetLocation()}},
{{"Wii", "Language"}, {Config::SYSCONF_LANGUAGE.GetLocation()}}, {{"Wii", "Language"}, {Config::SYSCONF_LANGUAGE.GetLocation()}},
{{"Core", "HLE_BS2"}, {Config::MAIN_SKIP_IPL.GetLocation()}},
{{"Core", "GameCubeLanguage"}, {Config::MAIN_GC_LANGUAGE.GetLocation()}},
}; };
return ini_to_location; return ini_to_location;
} }

View File

@ -48,7 +48,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
} }
} }
static constexpr auto s_setting_saveable = { static const auto s_setting_saveable = {
// Main.Core // Main.Core
&Config::MAIN_DEFAULT_ISO.GetLocation(), &Config::MAIN_DEFAULT_ISO.GetLocation(),
@ -72,6 +72,31 @@ bool IsSettingSaveable(const Config::Location& config_location)
&Config::MAIN_FALLBACK_REGION.GetLocation(), &Config::MAIN_FALLBACK_REGION.GetLocation(),
&Config::MAIN_REAL_WII_REMOTE_REPEAT_REPORTS.GetLocation(), &Config::MAIN_REAL_WII_REMOTE_REPEAT_REPORTS.GetLocation(),
&Config::MAIN_DSP_HLE.GetLocation(), &Config::MAIN_DSP_HLE.GetLocation(),
&Config::MAIN_CPU_CORE.GetLocation(),
&Config::MAIN_SKIP_IPL.GetLocation(),
&Config::MAIN_GC_LANGUAGE.GetLocation(),
&Config::MAIN_AGP_CART_A_PATH.GetLocation(),
&Config::MAIN_AGP_CART_B_PATH.GetLocation(),
&Config::MAIN_BBA_MAC.GetLocation(),
&Config::MAIN_BBA_XLINK_IP.GetLocation(),
&Config::MAIN_BBA_XLINK_CHAT_OSD.GetLocation(),
&Config::MAIN_OVERRIDE_REGION_SETTINGS.GetLocation(),
&Config::MAIN_CUSTOM_RTC_ENABLE.GetLocation(),
&Config::MAIN_CUSTOM_RTC_VALUE.GetLocation(),
&Config::MAIN_JIT_FOLLOW_BRANCH.GetLocation(),
&Config::MAIN_FLOAT_EXCEPTIONS.GetLocation(),
&Config::MAIN_DIVIDE_BY_ZERO_EXCEPTIONS.GetLocation(),
&Config::MAIN_LOW_DCBZ_HACK.GetLocation(),
&Config::MAIN_FPRF.GetLocation(),
&Config::MAIN_ACCURATE_NANS.GetLocation(),
&Config::GetInfoForAdapterRumble(0).GetLocation(),
&Config::GetInfoForAdapterRumble(1).GetLocation(),
&Config::GetInfoForAdapterRumble(2).GetLocation(),
&Config::GetInfoForAdapterRumble(3).GetLocation(),
&Config::GetInfoForSimulateKonga(0).GetLocation(),
&Config::GetInfoForSimulateKonga(1).GetLocation(),
&Config::GetInfoForSimulateKonga(2).GetLocation(),
&Config::GetInfoForSimulateKonga(3).GetLocation(),
// UI.General // UI.General

View File

@ -48,6 +48,8 @@ static void LoadFromDTM(Config::Layer* config_layer, Movie::DTMHeader* dtm)
config_layer->Set(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM, dtm->bSkipXFBCopyToRam); config_layer->Set(Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM, dtm->bSkipXFBCopyToRam);
config_layer->Set(Config::SESSION_USE_FMA, dtm->bUseFMA); config_layer->Set(Config::SESSION_USE_FMA, dtm->bUseFMA);
config_layer->Set(Config::MAIN_JIT_FOLLOW_BRANCH, dtm->bFollowBranch);
} }
void SaveToDTM(Movie::DTMHeader* dtm) void SaveToDTM(Movie::DTMHeader* dtm)
@ -74,6 +76,8 @@ void SaveToDTM(Movie::DTMHeader* dtm)
dtm->bUseFMA = Config::Get(Config::SESSION_USE_FMA); dtm->bUseFMA = Config::Get(Config::SESSION_USE_FMA);
dtm->bFollowBranch = Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH);
// Settings which only existed in old Dolphin versions // Settings which only existed in old Dolphin versions
dtm->bSkipIdle = true; dtm->bSkipIdle = true;
dtm->bEFBCopyEnable = true; dtm->bEFBCopyEnable = true;

View File

@ -99,9 +99,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
{ {
IniFile::Section* core = ini.GetOrCreateSection("Core"); IniFile::Section* core = ini.GetOrCreateSection("Core");
core->Set("SkipIPL", bHLE_BS2);
core->Set("TimingVariance", iTimingVariance); core->Set("TimingVariance", iTimingVariance);
core->Set("CPUCore", cpu_core);
core->Set("Fastmem", bFastmem); core->Set("Fastmem", bFastmem);
core->Set("CPUThread", bCPUThread); core->Set("CPUThread", bCPUThread);
core->Set("SyncOnSkipIdle", bSyncGPUOnSkipIdleHack); core->Set("SyncOnSkipIdle", bSyncGPUOnSkipIdleHack);
@ -109,25 +107,12 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance); core->Set("SyncGpuMaxDistance", iSyncGpuMaxDistance);
core->Set("SyncGpuMinDistance", iSyncGpuMinDistance); core->Set("SyncGpuMinDistance", iSyncGpuMinDistance);
core->Set("SyncGpuOverclock", fSyncGpuOverclock); core->Set("SyncGpuOverclock", fSyncGpuOverclock);
core->Set("FloatExceptions", bFloatExceptions);
core->Set("DivByZeroExceptions", bDivideByZeroExceptions);
core->Set("FPRF", bFPRF);
core->Set("AccurateNaNs", bAccurateNaNs);
core->Set("SelectedLanguage", SelectedLanguage);
core->Set("OverrideRegionSettings", bOverrideRegionSettings);
core->Set("AgpCartAPath", m_strGbaCartA);
core->Set("AgpCartBPath", m_strGbaCartB);
core->Set("SlotA", m_EXIDevice[0]); core->Set("SlotA", m_EXIDevice[0]);
core->Set("SlotB", m_EXIDevice[1]); core->Set("SlotB", m_EXIDevice[1]);
core->Set("SerialPort1", m_EXIDevice[2]); core->Set("SerialPort1", m_EXIDevice[2]);
core->Set("BBA_MAC", m_bba_mac);
core->Set("BBA_XLINK_IP", m_bba_xlink_ip);
core->Set("BBA_XLINK_CHAT_OSD", m_bba_xlink_chat_osd);
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i) for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
{ {
core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]); core->Set(fmt::format("SIDevice{}", i), m_SIDevice[i]);
core->Set(fmt::format("AdapterRumble{}", i), m_AdapterRumble[i]);
core->Set(fmt::format("SimulateKonga{}", i), m_AdapterKonga[i]);
} }
core->Set("WiiSDCard", m_WiiSDCard); core->Set("WiiSDCard", m_WiiSDCard);
core->Set("WiiKeyboard", m_WiiKeyboard); core->Set("WiiKeyboard", m_WiiKeyboard);
@ -140,8 +125,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("EmulationSpeed", m_EmulationSpeed); core->Set("EmulationSpeed", m_EmulationSpeed);
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode); core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
core->Set("PerfMapDir", m_perfDir); core->Set("PerfMapDir", m_perfDir);
core->Set("EnableCustomRTC", bEnableCustomRTC);
core->Set("CustomRTCValue", m_customRTCValue);
} }
void SConfig::LoadSettings() void SConfig::LoadSettings()
@ -159,36 +142,17 @@ void SConfig::LoadCoreSettings(IniFile& ini)
{ {
IniFile::Section* core = ini.GetOrCreateSection("Core"); IniFile::Section* core = ini.GetOrCreateSection("Core");
core->Get("SkipIPL", &bHLE_BS2, true);
#ifdef _M_X86
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JIT64);
#elif _M_ARM_64
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::JITARM64);
#else
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::Interpreter);
#endif
core->Get("JITFollowBranch", &bJITFollowBranch, true);
core->Get("Fastmem", &bFastmem, true); core->Get("Fastmem", &bFastmem, true);
core->Get("TimingVariance", &iTimingVariance, 40); core->Get("TimingVariance", &iTimingVariance, 40);
core->Get("CPUThread", &bCPUThread, true); core->Get("CPUThread", &bCPUThread, true);
core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true); core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
core->Get("SelectedLanguage", &SelectedLanguage,
DiscIO::ToGameCubeLanguage(Config::GetDefaultLanguage()));
core->Get("OverrideRegionSettings", &bOverrideRegionSettings, false);
core->Get("AgpCartAPath", &m_strGbaCartA);
core->Get("AgpCartBPath", &m_strGbaCartB);
core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER); core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE); core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE); core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
core->Get("BBA_MAC", &m_bba_mac);
core->Get("BBA_XLINK_IP", &m_bba_xlink_ip, "127.0.0.1");
core->Get("BBA_XLINK_CHAT_OSD", &m_bba_xlink_chat_osd, true);
for (size_t i = 0; i < std::size(m_SIDevice); ++i) for (size_t i = 0; i < std::size(m_SIDevice); ++i)
{ {
core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i], core->Get(fmt::format("SIDevice{}", i), &m_SIDevice[i],
(i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE); (i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
core->Get(fmt::format("AdapterRumble{}", i), &m_AdapterRumble[i], true);
core->Get(fmt::format("SimulateKonga{}", i), &m_AdapterKonga[i], false);
} }
core->Get("WiiSDCard", &m_WiiSDCard, true); core->Get("WiiSDCard", &m_WiiSDCard, true);
core->Get("WiiKeyboard", &m_WiiKeyboard, false); core->Get("WiiKeyboard", &m_WiiKeyboard, false);
@ -204,18 +168,10 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000); core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000);
core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f); core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
core->Get("FastDiscSpeed", &bFastDiscSpeed, false); core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
core->Get("LowDCBZHack", &bLowDCBZHack, false);
core->Get("FloatExceptions", &bFloatExceptions, false);
core->Get("DivByZeroExceptions", &bDivideByZeroExceptions, false);
core->Get("FPRF", &bFPRF, false);
core->Get("AccurateNaNs", &bAccurateNaNs, false);
core->Get("DisableICache", &bDisableICache, false); core->Get("DisableICache", &bDisableICache, false);
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f); core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto"); core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
core->Get("PerfMapDir", &m_perfDir, ""); core->Get("PerfMapDir", &m_perfDir, "");
core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
// Default to seconds between 1.1.1970 and 1.1.2000
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
} }
void SConfig::ResetRunningGameMetadata() void SConfig::ResetRunningGameMetadata()
@ -331,24 +287,16 @@ void SConfig::LoadDefaults()
bAutomaticStart = false; bAutomaticStart = false;
bBootToPause = false; bBootToPause = false;
cpu_core = PowerPC::DefaultCPUCore();
iTimingVariance = 40; iTimingVariance = 40;
bCPUThread = false; bCPUThread = false;
bSyncGPUOnSkipIdleHack = true; bSyncGPUOnSkipIdleHack = true;
bRunCompareServer = false; bRunCompareServer = false;
bFastmem = true; bFastmem = true;
bFloatExceptions = false;
bDivideByZeroExceptions = false;
bFPRF = false;
bAccurateNaNs = false;
bDisableICache = false; bDisableICache = false;
bMMU = false; bMMU = false;
bLowDCBZHack = false;
iBBDumpPort = -1; iBBDumpPort = -1;
bSyncGPU = false; bSyncGPU = false;
bFastDiscSpeed = false; bFastDiscSpeed = false;
SelectedLanguage = 0;
bOverrideRegionSettings = false;
bWii = false; bWii = false;
ResetRunningGameMetadata(); ResetRunningGameMetadata();
@ -539,7 +487,7 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
if (wii) if (wii)
language = static_cast<DiscIO::Language>(Config::Get(Config::SYSCONF_LANGUAGE)); language = static_cast<DiscIO::Language>(Config::Get(Config::SYSCONF_LANGUAGE));
else else
language = DiscIO::FromGameCubeLanguage(SConfig::GetInstance().SelectedLanguage); language = DiscIO::FromGameCubeLanguage(Config::Get(Config::MAIN_GC_LANGUAGE));
// Get rid of invalid values (probably doesn't matter, but might as well do it) // Get rid of invalid values (probably doesn't matter, but might as well do it)
if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese) if (language > DiscIO::Language::Unknown || language < DiscIO::Language::Japanese)
@ -557,7 +505,7 @@ DiscIO::Language SConfig::GetLanguageAdjustedForRegion(bool wii, DiscIO::Region
if (!wii && region == DiscIO::Region::NTSC_J && language == DiscIO::Language::English) 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 return DiscIO::Language::Japanese; // English and Japanese both use the value 0 in GC SRAM
if (!bOverrideRegionSettings) if (!Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS))
{ {
if (region == DiscIO::Region::NTSC_J) if (region == DiscIO::Region::NTSC_J)
return DiscIO::Language::Japanese; return DiscIO::Language::Japanese;

View File

@ -69,30 +69,21 @@ struct SConfig
bool bAutomaticStart = false; bool bAutomaticStart = false;
bool bBootToPause = false; bool bBootToPause = false;
PowerPC::CPUCore cpu_core;
bool bJITFollowBranch;
bool bJITNoBlockCache = false; bool bJITNoBlockCache = false;
bool bJITNoBlockLinking = false; bool bJITNoBlockLinking = false;
bool bFastmem; bool bFastmem;
bool bFloatExceptions = false;
bool bDivideByZeroExceptions = false;
bool bFPRF = false;
bool bAccurateNaNs = false;
bool bDisableICache = false; bool bDisableICache = false;
int iTimingVariance = 40; // in milli secounds int iTimingVariance = 40; // in milli secounds
bool bCPUThread = true; bool bCPUThread = true;
bool bSyncGPUOnSkipIdleHack = true; bool bSyncGPUOnSkipIdleHack = true;
bool bHLE_BS2 = true;
bool bCopyWiiSaveNetplay = true; bool bCopyWiiSaveNetplay = true;
bool bRunCompareServer = false; bool bRunCompareServer = false;
bool bRunCompareClient = false; bool bRunCompareClient = false;
bool bMMU = false; bool bMMU = false;
bool bLowDCBZHack = false;
int iBBDumpPort = 0; int iBBDumpPort = 0;
bool bFastDiscSpeed = false; bool bFastDiscSpeed = false;
@ -101,16 +92,9 @@ struct SConfig
int iSyncGpuMinDistance; int iSyncGpuMinDistance;
float fSyncGpuOverclock; float fSyncGpuOverclock;
int SelectedLanguage = 0;
bool bOverrideRegionSettings = false;
bool bWii = false; bool bWii = false;
bool m_is_mios = false; bool m_is_mios = false;
// Custom RTC
bool bEnableCustomRTC;
u32 m_customRTCValue;
DiscIO::Region m_region; DiscIO::Region m_region;
std::string m_strGPUDeterminismMode; std::string m_strGPUDeterminismMode;
@ -162,21 +146,11 @@ struct SConfig
static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision); static IniFile LoadLocalGameIni(const std::string& id, std::optional<u16> revision);
static IniFile LoadGameIni(const std::string& id, std::optional<u16> revision); static IniFile LoadGameIni(const std::string& id, std::optional<u16> revision);
std::string m_strGbaCartA;
std::string m_strGbaCartB;
ExpansionInterface::TEXIDevices m_EXIDevice[3]; ExpansionInterface::TEXIDevices m_EXIDevice[3];
SerialInterface::SIDevices m_SIDevice[4]; SerialInterface::SIDevices m_SIDevice[4];
std::string m_bba_mac;
std::string m_bba_xlink_ip;
bool m_bba_xlink_chat_osd = true;
float m_EmulationSpeed; float m_EmulationSpeed;
// Input settings
bool m_AdapterRumble[4];
bool m_AdapterKonga[4];
SConfig(const SConfig&) = delete; SConfig(const SConfig&) = delete;
SConfig& operator=(const SConfig&) = delete; SConfig& operator=(const SConfig&) = delete;
SConfig(SConfig&&) = delete; SConfig(SConfig&&) = delete;

View File

@ -636,7 +636,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
Fifo::Prepare(); Fifo::Prepare();
// Setup our core, but can't use dynarec if we are compare server // Setup our core, but can't use dynarec if we are compare server
if (core_parameter.cpu_core != PowerPC::CPUCore::Interpreter && if (Config::Get(Config::MAIN_CPU_CORE) != PowerPC::CPUCore::Interpreter &&
(!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient)) (!core_parameter.bRunCompareServer || core_parameter.bRunCompareClient))
{ {
PowerPC::SetMode(PowerPC::CoreMode::JIT); PowerPC::SetMode(PowerPC::CoreMode::JIT);

View File

@ -13,7 +13,7 @@
#include "Common/IOFile.h" #include "Common/IOFile.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
namespace ExpansionInterface namespace ExpansionInterface
{ {
@ -35,8 +35,8 @@ CEXIAgp::~CEXIAgp()
std::string filename; std::string filename;
std::string ext; std::string ext;
std::string gbapath; std::string gbapath;
SplitPath(m_slot == 0 ? SConfig::GetInstance().m_strGbaCartA : SplitPath(m_slot == 0 ? Config::Get(Config::MAIN_AGP_CART_A_PATH) :
SConfig::GetInstance().m_strGbaCartB, Config::Get(Config::MAIN_AGP_CART_B_PATH),
&path, &filename, &ext); &path, &filename, &ext);
gbapath = path + filename; gbapath = path + filename;
@ -75,8 +75,8 @@ void CEXIAgp::LoadRom()
std::string path; std::string path;
std::string filename; std::string filename;
std::string ext; std::string ext;
SplitPath(m_slot == 0 ? SConfig::GetInstance().m_strGbaCartA : SplitPath(m_slot == 0 ? Config::Get(Config::MAIN_AGP_CART_A_PATH) :
SConfig::GetInstance().m_strGbaCartB, Config::Get(Config::MAIN_AGP_CART_B_PATH),
&path, &filename, &ext); &path, &filename, &ext);
const std::string gbapath = path + filename; const std::string gbapath = path + filename;
LoadFileToROM(gbapath + ext); LoadFileToROM(gbapath + ext);

View File

@ -13,7 +13,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Network.h" #include "Common/Network.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/HW/EXI/EXI.h" #include "Core/HW/EXI/EXI.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
@ -28,7 +28,7 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
{ {
// Parse MAC address from config, and generate a new one if it doesn't // Parse MAC address from config, and generate a new one if it doesn't
// exist or can't be parsed. // exist or can't be parsed.
std::string& mac_addr_setting = SConfig::GetInstance().m_bba_mac; std::string mac_addr_setting = Config::Get(Config::MAIN_BBA_MAC);
std::optional<Common::MACAddress> mac_addr = Common::StringToMacAddress(mac_addr_setting); std::optional<Common::MACAddress> mac_addr = Common::StringToMacAddress(mac_addr_setting);
std::transform(mac_addr_setting.begin(), mac_addr_setting.end(), mac_addr_setting.begin(), std::transform(mac_addr_setting.begin(), mac_addr_setting.end(), mac_addr_setting.begin(),
@ -38,7 +38,8 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
{ {
mac_addr = Common::GenerateMacAddress(Common::MACConsumer::BBA); mac_addr = Common::GenerateMacAddress(Common::MACConsumer::BBA);
mac_addr_setting = Common::MacAddressToString(mac_addr.value()); mac_addr_setting = Common::MacAddressToString(mac_addr.value());
SConfig::GetInstance().SaveSettings(); Config::SetBaseOrCurrent(Config::MAIN_BBA_MAC, mac_addr_setting);
Config::Save();
} }
switch (type) switch (type)
@ -70,11 +71,12 @@ CEXIETHERNET::CEXIETHERNET(BBADeviceType type)
// m_client_mdentifier should be unique per connected emulator from the XLink kai client's // m_client_mdentifier should be unique per connected emulator from the XLink kai client's
// perspective so lets use "dolphin<bba mac>" // perspective so lets use "dolphin<bba mac>"
m_network_interface = std::make_unique<XLinkNetworkInterface>( m_network_interface =
this, SConfig::GetInstance().m_bba_xlink_ip, 34523, std::make_unique<XLinkNetworkInterface>(this, Config::Get(Config::MAIN_BBA_XLINK_IP), 34523,
"dolphin" + SConfig::GetInstance().m_bba_mac, SConfig::GetInstance().m_bba_xlink_chat_osd); "dolphin" + Config::Get(Config::MAIN_BBA_MAC),
Config::Get(Config::MAIN_BBA_XLINK_CHAT_OSD));
INFO_LOG_FMT(SP1, "Created XLink Kai BBA network interface connection to {}:34523", INFO_LOG_FMT(SP1, "Created XLink Kai BBA network interface connection to {}:34523",
SConfig::GetInstance().m_bba_xlink_ip); Config::Get(Config::MAIN_BBA_XLINK_IP));
break; break;
} }

View File

@ -19,6 +19,7 @@
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SessionSettings.h" #include "Core/Config/SessionSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
@ -133,7 +134,7 @@ CEXIIPL::CEXIIPL()
// We Overwrite language selection here since it's possible on the GC to change the language as // We Overwrite language selection here since it's possible on the GC to change the language as
// you please // you please
g_SRAM.settings.language = SConfig::GetInstance().SelectedLanguage; g_SRAM.settings.language = Config::Get(Config::MAIN_GC_LANGUAGE);
g_SRAM.settings.rtc_bias = 0; g_SRAM.settings.rtc_bias = 0;
FixSRAMChecksums(); FixSRAMChecksums();
} }

View File

@ -46,7 +46,7 @@ void Init()
DSP::Init(Config::Get(Config::MAIN_DSP_HLE)); DSP::Init(Config::Get(Config::MAIN_DSP_HLE));
DVDInterface::Init(); DVDInterface::Init();
GPFifo::Init(); GPFifo::Init();
CPU::Init(SConfig::GetInstance().cpu_core); CPU::Init(Config::Get(Config::MAIN_CPU_CORE));
SystemTimers::Init(); SystemTimers::Init();
if (SConfig::GetInstance().bWii) if (SConfig::GetInstance().bWii)

View File

@ -7,6 +7,7 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/GCPad.h" #include "Core/HW/GCPad.h"
@ -24,7 +25,7 @@ CSIDevice_GCAdapter::CSIDevice_GCAdapter(SIDevices device, int device_number)
// get the correct pad number that should rumble locally when using netplay // get the correct pad number that should rumble locally when using netplay
const int pad_num = NetPlay_InGamePadToLocalPad(m_device_number); const int pad_num = NetPlay_InGamePadToLocalPad(m_device_number);
if (pad_num < 4) if (pad_num < 4)
m_simulate_konga = SConfig::GetInstance().m_AdapterKonga[pad_num]; m_simulate_konga = Config::Get(Config::GetInfoForSimulateKonga(pad_num));
} }
GCPadStatus CSIDevice_GCAdapter::GetPadStatus() GCPadStatus CSIDevice_GCAdapter::GetPadStatus()

View File

@ -52,6 +52,7 @@ IPC_HLE_PERIOD: For the Wii Remote this is the call schedule:
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Config/MainSettings.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"
@ -304,10 +305,10 @@ void Init()
Common::Timer::IncreaseResolution(); Common::Timer::IncreaseResolution();
// store and convert localtime at boot to timebase ticks // store and convert localtime at boot to timebase ticks
if (SConfig::GetInstance().bEnableCustomRTC) if (Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE))
{ {
s_localtime_rtc_offset = s_localtime_rtc_offset =
Common::Timer::GetLocalTimeSinceJan1970() - SConfig::GetInstance().m_customRTCValue; Common::Timer::GetLocalTimeSinceJan1970() - Config::Get(Config::MAIN_CUSTOM_RTC_VALUE);
} }
CoreTiming::SetFakeTBStartValue(static_cast<u64>(s_cpu_core_clock / TIMER_RATIO) * CoreTiming::SetFakeTBStartValue(static_cast<u64>(s_cpu_core_clock / TIMER_RATIO) *

View File

@ -535,9 +535,9 @@ bool BeginRecordingInput(const ControllerTypeArray& controllers,
s_bNetPlay = true; s_bNetPlay = true;
s_recordingStartTime = ExpansionInterface::CEXIIPL::NetPlay_GetEmulatedTime(); s_recordingStartTime = ExpansionInterface::CEXIIPL::NetPlay_GetEmulatedTime();
} }
else if (SConfig::GetInstance().bEnableCustomRTC) else if (Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE))
{ {
s_recordingStartTime = SConfig::GetInstance().m_customRTCValue; s_recordingStartTime = Config::Get(Config::MAIN_CUSTOM_RTC_VALUE);
} }
else else
{ {
@ -904,7 +904,6 @@ void ReadHeader()
{ {
s_bSaveConfig = true; s_bSaveConfig = true;
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader)); Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader));
SConfig::GetInstance().bJITFollowBranch = tmpHeader.bFollowBranch;
s_bClearSave = tmpHeader.bClearSave; s_bClearSave = tmpHeader.bClearSave;
s_memcards = tmpHeader.memcards; s_memcards = tmpHeader.memcards;
s_bongos = tmpHeader.bongos; s_bongos = tmpHeader.bongos;
@ -1348,7 +1347,6 @@ void SaveRecording(const std::string& filename)
header.filetype[3] = 0x1A; header.filetype[3] = 0x1A;
strncpy(header.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6); strncpy(header.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6);
header.bWii = SConfig::GetInstance().bWii; header.bWii = SConfig::GetInstance().bWii;
header.bFollowBranch = SConfig::GetInstance().bJITFollowBranch;
header.controllers = 0; header.controllers = 0;
header.GBAControllers = 0; header.GBAControllers = 0;
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)

View File

@ -2028,10 +2028,8 @@ void NetPlayServer::CheckSyncAndStartGame()
u64 NetPlayServer::GetInitialNetPlayRTC() const u64 NetPlayServer::GetInitialNetPlayRTC() const
{ {
const auto& config = SConfig::GetInstance(); if (Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE))
return Config::Get(Config::MAIN_CUSTOM_RTC_VALUE);
if (config.bEnableCustomRTC)
return config.m_customRTCValue;
return Common::Timer::GetLocalTimeSinceJan1970(); return Common::Timer::GetLocalTimeSinceJan1970();
} }

View File

@ -9,6 +9,7 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/PowerPC/Interpreter/ExceptionUtils.h" #include "Core/PowerPC/Interpreter/ExceptionUtils.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h" #include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"
@ -504,8 +505,11 @@ void Interpreter::dcbz(UGeckoInstruction inst)
} }
// Hack to stop dcbz/dcbi over low MEM1 trashing memory. // Hack to stop dcbz/dcbi over low MEM1 trashing memory.
if (SConfig::GetInstance().bLowDCBZHack && (dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000)) if ((dcbz_addr < 0x80008000) && (dcbz_addr >= 0x80000000) &&
Config::Get(Config::MAIN_LOW_DCBZ_HACK))
{
return; return;
}
// TODO: Implement some sort of L2 emulation. // TODO: Implement some sort of L2 emulation.
PowerPC::ClearCacheLine(dcbz_addr & (~31)); PowerPC::ClearCacheLine(dcbz_addr & (~31));

View File

@ -38,7 +38,7 @@ void Jit64::SetFPRFIfNeeded(const OpArg& input, bool single)
// As far as we know, the games that use this flag only need FPRF for fmul and fmadd, but // As far as we know, the games that use this flag only need FPRF for fmul and fmadd, but
// FPRF is fast enough in JIT that we might as well just enable it for every float instruction // FPRF is fast enough in JIT that we might as well just enable it for every float instruction
// if the FPRF flag is set. // if the FPRF flag is set.
if (!SConfig::GetInstance().bFPRF || !js.op->wantsFPRF) if (!m_fprf || !js.op->wantsFPRF)
return; return;
X64Reg xmm = XMM0; X64Reg xmm = XMM0;
@ -102,7 +102,7 @@ void Jit64::HandleNaNs(UGeckoInstruction inst, X64Reg xmm_out, X64Reg xmm, X64Re
// Dragon Ball: Revenge of King Piccolo requires generated NaNs // Dragon Ball: Revenge of King Piccolo requires generated NaNs
// to be positive, so we'll have to handle them manually. // to be positive, so we'll have to handle them manually.
if (!SConfig::GetInstance().bAccurateNaNs) if (!m_accurate_nans)
{ {
if (xmm_out != xmm) if (xmm_out != xmm)
MOVAPD(xmm_out, R(xmm)); MOVAPD(xmm_out, R(xmm));
@ -230,7 +230,7 @@ void Jit64::fp_arith(UGeckoInstruction inst)
packed = false; packed = false;
bool round_input = single && !js.op->fprIsSingle[inst.FC]; bool round_input = single && !js.op->fprIsSingle[inst.FC];
bool preserve_inputs = SConfig::GetInstance().bAccurateNaNs; bool preserve_inputs = m_accurate_nans;
const auto fp_tri_op = [&](int op1, int op2, bool reversible, const auto fp_tri_op = [&](int op1, int op2, bool reversible,
void (XEmitter::*avxOp)(X64Reg, X64Reg, const OpArg&), void (XEmitter::*avxOp)(X64Reg, X64Reg, const OpArg&),
@ -475,7 +475,7 @@ void Jit64::fmaddXX(UGeckoInstruction inst)
if (negate) if (negate)
XORPD(result_xmm, MConst(packed ? psSignBits2 : psSignBits)); XORPD(result_xmm, MConst(packed ? psSignBits2 : psSignBits));
if (SConfig::GetInstance().bAccurateNaNs && result_xmm == XMM0) if (m_accurate_nans && result_xmm == XMM0)
{ {
// HandleNaNs needs to clobber XMM0 // HandleNaNs needs to clobber XMM0
MOVAPD(Rd, R(result_xmm)); MOVAPD(Rd, R(result_xmm));
@ -632,7 +632,7 @@ void Jit64::fmrx(UGeckoInstruction inst)
void Jit64::FloatCompare(UGeckoInstruction inst, bool upper) void Jit64::FloatCompare(UGeckoInstruction inst, bool upper)
{ {
bool fprf = SConfig::GetInstance().bFPRF && js.op->wantsFPRF; bool fprf = m_fprf && js.op->wantsFPRF;
// bool ordered = !!(inst.SUBOP10 & 32); // bool ordered = !!(inst.SUBOP10 & 32);
int a = inst.FA; int a = inst.FA;
int b = inst.FB; int b = inst.FB;

View File

@ -413,7 +413,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
} }
FixupBranch end_dcbz_hack; FixupBranch end_dcbz_hack;
if (SConfig::GetInstance().bLowDCBZHack) if (m_low_dcbz_hack)
{ {
// HACK: Don't clear any memory in the [0x8000'0000, 0x8000'8000) region. // HACK: Don't clear any memory in the [0x8000'0000, 0x8000'8000) region.
CMP(32, R(RSCRATCH), Imm32(0x8000'8000)); CMP(32, R(RSCRATCH), Imm32(0x8000'8000));
@ -454,7 +454,7 @@ void Jit64::dcbz(UGeckoInstruction inst)
SetJumpTarget(end_far_code); SetJumpTarget(end_far_code);
} }
if (SConfig::GetInstance().bLowDCBZHack) if (m_low_dcbz_hack)
SetJumpTarget(end_dcbz_hack); SetJumpTarget(end_dcbz_hack);
} }

View File

@ -20,7 +20,7 @@ using namespace Arm64Gen;
void JitArm64::SetFPRFIfNeeded(bool single, ARM64Reg reg) void JitArm64::SetFPRFIfNeeded(bool single, ARM64Reg reg)
{ {
if (!SConfig::GetInstance().bFPRF || !js.op->wantsFPRF) if (!m_fprf || !js.op->wantsFPRF)
return; return;
gpr.Lock(ARM64Reg::W0, ARM64Reg::W1, ARM64Reg::W2, ARM64Reg::W3, ARM64Reg::W4, ARM64Reg::W30); gpr.Lock(ARM64Reg::W0, ARM64Reg::W1, ARM64Reg::W2, ARM64Reg::W3, ARM64Reg::W4, ARM64Reg::W30);
@ -374,7 +374,7 @@ void JitArm64::frspx(UGeckoInstruction inst)
void JitArm64::FloatCompare(UGeckoInstruction inst, bool upper) void JitArm64::FloatCompare(UGeckoInstruction inst, bool upper)
{ {
const bool fprf = SConfig::GetInstance().bFPRF && js.op->wantsFPRF; const bool fprf = m_fprf && js.op->wantsFPRF;
const u32 a = inst.FA; const u32 a = inst.FA;
const u32 b = inst.FB; const u32 b = inst.FB;

View File

@ -764,7 +764,7 @@ void JitArm64::dcbz(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(bJITLoadStoreOff); JITDISABLE(bJITLoadStoreOff);
FALLBACK_IF(SConfig::GetInstance().bLowDCBZHack); FALLBACK_IF(m_low_dcbz_hack);
int a = inst.RA, b = inst.RB; int a = inst.RA, b = inst.RB;

View File

@ -49,7 +49,15 @@ void JitBase::RefreshConfig()
bJITBranchOff = Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF); bJITBranchOff = Config::Get(Config::MAIN_DEBUG_JIT_BRANCH_OFF);
bJITRegisterCacheOff = Config::Get(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_OFF); bJITRegisterCacheOff = Config::Get(Config::MAIN_DEBUG_JIT_REGISTER_CACHE_OFF);
m_enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING); m_enable_debugging = Config::Get(Config::MAIN_ENABLE_DEBUGGING);
m_enable_float_exceptions = Config::Get(Config::MAIN_FLOAT_EXCEPTIONS);
m_enable_div_by_zero_exceptions = Config::Get(Config::MAIN_DIVIDE_BY_ZERO_EXCEPTIONS);
m_low_dcbz_hack = Config::Get(Config::MAIN_LOW_DCBZ_HACK);
m_fprf = Config::Get(Config::MAIN_FPRF);
m_accurate_nans = Config::Get(Config::MAIN_ACCURATE_NANS);
analyzer.SetDebuggingEnabled(m_enable_debugging); analyzer.SetDebuggingEnabled(m_enable_debugging);
analyzer.SetBranchFollowingEnabled(Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH));
analyzer.SetFloatExceptionsEnabled(m_enable_float_exceptions);
analyzer.SetDivByZeroExceptionsEnabled(m_enable_div_by_zero_exceptions);
} }
bool JitBase::CanMergeNextInstructions(int count) const bool JitBase::CanMergeNextInstructions(int count) const
@ -72,8 +80,8 @@ void JitBase::UpdateMemoryAndExceptionOptions()
bool any_watchpoints = PowerPC::memchecks.HasAny(); bool any_watchpoints = PowerPC::memchecks.HasAny();
jo.fastmem = SConfig::GetInstance().bFastmem && jo.fastmem_arena && (MSR.DR || !any_watchpoints); jo.fastmem = SConfig::GetInstance().bFastmem && jo.fastmem_arena && (MSR.DR || !any_watchpoints);
jo.memcheck = SConfig::GetInstance().bMMU || any_watchpoints; jo.memcheck = SConfig::GetInstance().bMMU || any_watchpoints;
jo.fp_exceptions = SConfig::GetInstance().bFloatExceptions; jo.fp_exceptions = m_enable_float_exceptions;
jo.div_by_zero_exceptions = SConfig::GetInstance().bDivideByZeroExceptions; jo.div_by_zero_exceptions = m_enable_div_by_zero_exceptions;
} }
bool JitBase::ShouldHandleFPExceptionForInstruction(const PPCAnalyst::CodeOp* op) bool JitBase::ShouldHandleFPExceptionForInstruction(const PPCAnalyst::CodeOp* op)

View File

@ -127,6 +127,11 @@ protected:
bool bJITBranchOff = false; bool bJITBranchOff = false;
bool bJITRegisterCacheOff = false; bool bJITRegisterCacheOff = false;
bool m_enable_debugging = false; bool m_enable_debugging = false;
bool m_enable_float_exceptions = false;
bool m_enable_div_by_zero_exceptions = false;
bool m_low_dcbz_hack = false;
bool m_fprf = false;
bool m_accurate_nans = false;
void RefreshConfig(); void RefreshConfig();

View File

@ -556,10 +556,10 @@ void PPCAnalyzer::SetInstructionStats(CodeBlock* block, CodeOp* code, const Gekk
code->outputFPRF = (opinfo->flags & FL_SET_FPRF) != 0; code->outputFPRF = (opinfo->flags & FL_SET_FPRF) != 0;
code->canEndBlock = (opinfo->flags & FL_ENDBLOCK) != 0; code->canEndBlock = (opinfo->flags & FL_ENDBLOCK) != 0;
code->canCauseException = code->canCauseException = first_fpu_instruction ||
first_fpu_instruction || (opinfo->flags & (FL_LOADSTORE | FL_PROGRAMEXCEPTION)) != 0 || (opinfo->flags & (FL_LOADSTORE | FL_PROGRAMEXCEPTION)) != 0 ||
(SConfig::GetInstance().bFloatExceptions && (opinfo->flags & FL_FLOAT_EXCEPTION)) || (m_enable_float_exceptions && (opinfo->flags & FL_FLOAT_EXCEPTION)) ||
(SConfig::GetInstance().bDivideByZeroExceptions && (opinfo->flags & FL_FLOAT_DIV)); (m_enable_div_by_zero_exceptions && (opinfo->flags & FL_FLOAT_DIV));
code->wantsCA = (opinfo->flags & FL_READ_CA) != 0; code->wantsCA = (opinfo->flags & FL_READ_CA) != 0;
code->outputCA = (opinfo->flags & FL_SET_CA) != 0; code->outputCA = (opinfo->flags & FL_SET_CA) != 0;
@ -761,7 +761,7 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer,
u32 numFollows = 0; u32 numFollows = 0;
u32 num_inst = 0; u32 num_inst = 0;
const bool enable_follow = SConfig::GetInstance().bJITFollowBranch; const bool enable_follow = m_enable_branch_following;
for (std::size_t i = 0; i < block_size; ++i) for (std::size_t i = 0; i < block_size; ++i)
{ {

View File

@ -216,6 +216,9 @@ public:
void ClearOption(AnalystOption option) { m_options &= ~(option); } void ClearOption(AnalystOption option) { m_options &= ~(option); }
bool HasOption(AnalystOption option) const { return !!(m_options & option); } bool HasOption(AnalystOption option) const { return !!(m_options & option); }
void SetDebuggingEnabled(bool enabled) { m_is_debugging_enabled = enabled; } void SetDebuggingEnabled(bool enabled) { m_is_debugging_enabled = enabled; }
void SetBranchFollowingEnabled(bool enabled) { m_enable_branch_following = enabled; }
void SetFloatExceptionsEnabled(bool enabled) { m_enable_float_exceptions = enabled; }
void SetDivByZeroExceptionsEnabled(bool enabled) { m_enable_div_by_zero_exceptions = enabled; }
u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size) const; u32 Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std::size_t block_size) const;
private: private:
@ -238,6 +241,9 @@ private:
u32 m_options = 0; u32 m_options = 0;
bool m_is_debugging_enabled = false; bool m_is_debugging_enabled = false;
bool m_enable_branch_following = false;
bool m_enable_float_exceptions = false;
bool m_enable_div_by_zero_exceptions = false;
}; };
void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db); void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB* func_db);

View File

@ -8,6 +8,7 @@
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/QtUtils/QueueOnObject.h"
@ -86,12 +87,12 @@ void GCPadWiiUConfigDialog::UpdateAdapterStatus()
void GCPadWiiUConfigDialog::LoadSettings() void GCPadWiiUConfigDialog::LoadSettings()
{ {
m_rumble->setChecked(SConfig::GetInstance().m_AdapterRumble[m_port]); m_rumble->setChecked(Config::Get(Config::GetInfoForAdapterRumble(m_port)));
m_simulate_bongos->setChecked(SConfig::GetInstance().m_AdapterKonga[m_port]); m_simulate_bongos->setChecked(Config::Get(Config::GetInfoForSimulateKonga(m_port)));
} }
void GCPadWiiUConfigDialog::SaveSettings() void GCPadWiiUConfigDialog::SaveSettings()
{ {
SConfig::GetInstance().m_AdapterRumble[m_port] = m_rumble->isChecked(); Config::SetBaseOrCurrent(Config::GetInfoForAdapterRumble(m_port), m_rumble->isChecked());
SConfig::GetInstance().m_AdapterKonga[m_port] = m_simulate_bongos->isChecked(); Config::SetBaseOrCurrent(Config::GetInfoForSimulateKonga(m_port), m_simulate_bongos->isChecked());
} }

View File

@ -157,6 +157,9 @@ void JITWidget::Update()
PPCAnalyst::CodeBlock code_block; PPCAnalyst::CodeBlock code_block;
PPCAnalyst::PPCAnalyzer analyzer; PPCAnalyst::PPCAnalyzer analyzer;
analyzer.SetDebuggingEnabled(Config::Get(Config::MAIN_ENABLE_DEBUGGING)); analyzer.SetDebuggingEnabled(Config::Get(Config::MAIN_ENABLE_DEBUGGING));
analyzer.SetBranchFollowingEnabled(Config::Get(Config::MAIN_JIT_FOLLOW_BRANCH));
analyzer.SetFloatExceptionsEnabled(Config::Get(Config::MAIN_FLOAT_EXCEPTIONS));
analyzer.SetDivByZeroExceptionsEnabled(Config::Get(Config::MAIN_DIVIDE_BY_ZERO_EXCEPTIONS));
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_CONDITIONAL_CONTINUE);
analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW); analyzer.SetOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_FOLLOW);

View File

@ -802,7 +802,7 @@ void MenuBar::AddJITMenu()
m_jit_interpreter_core = m_jit->addAction(tr("Interpreter Core")); m_jit_interpreter_core = m_jit->addAction(tr("Interpreter Core"));
m_jit_interpreter_core->setCheckable(true); m_jit_interpreter_core->setCheckable(true);
m_jit_interpreter_core->setChecked(SConfig::GetInstance().cpu_core == m_jit_interpreter_core->setChecked(Config::Get(Config::MAIN_CPU_CORE) ==
PowerPC::CPUCore::Interpreter); PowerPC::CPUCore::Interpreter);
connect(m_jit_interpreter_core, &QAction::toggled, [](bool enabled) { connect(m_jit_interpreter_core, &QAction::toggled, [](bool enabled) {

View File

@ -174,7 +174,6 @@ void AdvancedPane::ConnectLayout()
{ {
connect(m_cpu_emulation_engine_combobox, connect(m_cpu_emulation_engine_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [](int index) { static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [](int index) {
SConfig::GetInstance().cpu_core = PowerPC::AvailableCPUCores()[index];
Config::SetBaseOrCurrent(Config::MAIN_CPU_CORE, PowerPC::AvailableCPUCores()[index]); Config::SetBaseOrCurrent(Config::MAIN_CPU_CORE, PowerPC::AvailableCPUCores()[index]);
}); });
@ -212,17 +211,18 @@ void AdvancedPane::ConnectLayout()
Update(); Update();
}); });
m_custom_rtc_checkbox->setChecked(SConfig::GetInstance().bEnableCustomRTC); m_custom_rtc_checkbox->setChecked(Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE));
connect(m_custom_rtc_checkbox, &QCheckBox::toggled, [this](bool enable_custom_rtc) { connect(m_custom_rtc_checkbox, &QCheckBox::toggled, [this](bool enable_custom_rtc) {
SConfig::GetInstance().bEnableCustomRTC = enable_custom_rtc; Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_ENABLE, enable_custom_rtc);
Update(); Update();
}); });
QDateTime initial_date_time; QDateTime initial_date_time;
initial_date_time.setSecsSinceEpoch(SConfig::GetInstance().m_customRTCValue); initial_date_time.setSecsSinceEpoch(Config::Get(Config::MAIN_CUSTOM_RTC_VALUE));
m_custom_rtc_datetime->setDateTime(initial_date_time); m_custom_rtc_datetime->setDateTime(initial_date_time);
connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) { connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) {
SConfig::GetInstance().m_customRTCValue = static_cast<u32>(date_time.toSecsSinceEpoch()); Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_VALUE,
static_cast<u32>(date_time.toSecsSinceEpoch()));
Update(); Update();
}); });
} }
@ -232,12 +232,13 @@ void AdvancedPane::Update()
const bool running = Core::GetState() != Core::State::Uninitialized; const bool running = Core::GetState() != Core::State::Uninitialized;
const bool enable_cpu_clock_override_widgets = Config::Get(Config::MAIN_OVERCLOCK_ENABLE); const bool enable_cpu_clock_override_widgets = Config::Get(Config::MAIN_OVERCLOCK_ENABLE);
const bool enable_ram_override_widgets = Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE); const bool enable_ram_override_widgets = Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE);
const bool enable_custom_rtc_widgets = SConfig::GetInstance().bEnableCustomRTC && !running; const bool enable_custom_rtc_widgets = Config::Get(Config::MAIN_CUSTOM_RTC_ENABLE) && !running;
const std::vector<PowerPC::CPUCore>& available_cpu_cores = PowerPC::AvailableCPUCores(); const std::vector<PowerPC::CPUCore>& available_cpu_cores = PowerPC::AvailableCPUCores();
const auto cpu_core = Config::Get(Config::MAIN_CPU_CORE);
for (size_t i = 0; i < available_cpu_cores.size(); ++i) for (size_t i = 0; i < available_cpu_cores.size(); ++i)
{ {
if (available_cpu_cores[i] == SConfig::GetInstance().cpu_core) if (available_cpu_cores[i] == cpu_core)
m_cpu_emulation_engine_combobox->setCurrentIndex(int(i)); m_cpu_emulation_engine_combobox->setCurrentIndex(int(i));
} }
m_cpu_emulation_engine_combobox->setEnabled(!running); m_cpu_emulation_engine_combobox->setEnabled(!running);

View File

@ -13,7 +13,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/ConfigManager.h" #include "Core/Config/MainSettings.h"
#include "DolphinQt/QtUtils/ModalMessageBox.h" #include "DolphinQt/QtUtils/ModalMessageBox.h"
BroadbandAdapterSettingsDialog::BroadbandAdapterSettingsDialog(QWidget* parent, Type bba_type) BroadbandAdapterSettingsDialog::BroadbandAdapterSettingsDialog(QWidget* parent, Type bba_type)
@ -38,7 +38,7 @@ void BroadbandAdapterSettingsDialog::InitControls()
// interface (physical) like a serial number. "MAC" should be kept in translations. // interface (physical) like a serial number. "MAC" should be kept in translations.
address_label = new QLabel(tr("Enter new Broadband Adapter MAC address:")); address_label = new QLabel(tr("Enter new Broadband Adapter MAC address:"));
address_placeholder = QString::fromStdString("aa:bb:cc:dd:ee:ff"); address_placeholder = QString::fromStdString("aa:bb:cc:dd:ee:ff");
current_address = QString::fromStdString(SConfig::GetInstance().m_bba_mac); current_address = QString::fromStdString(Config::Get(Config::MAIN_BBA_MAC));
description = new QLabel(tr("For setup instructions, <a " description = new QLabel(tr("For setup instructions, <a "
"href=\"https://wiki.dolphin-emu.org/" "href=\"https://wiki.dolphin-emu.org/"
"index.php?title=Broadband_Adapter\">refer to this page</a>.")); "index.php?title=Broadband_Adapter\">refer to this page</a>."));
@ -51,7 +51,7 @@ void BroadbandAdapterSettingsDialog::InitControls()
case Type::XLinkKai: case Type::XLinkKai:
address_label = new QLabel(tr("Enter IP address of device running the XLink Kai Client:")); address_label = new QLabel(tr("Enter IP address of device running the XLink Kai Client:"));
address_placeholder = QString::fromStdString("127.0.0.1"); address_placeholder = QString::fromStdString("127.0.0.1");
current_address = QString::fromStdString(SConfig::GetInstance().m_bba_xlink_ip); current_address = QString::fromStdString(Config::Get(Config::MAIN_BBA_XLINK_IP));
description = description =
new QLabel(tr("For setup instructions, <a " new QLabel(tr("For setup instructions, <a "
"href=\"https://www.teamxlink.co.uk/wiki/Dolphin\">refer to this page</a>.")); "href=\"https://www.teamxlink.co.uk/wiki/Dolphin\">refer to this page</a>."));
@ -100,11 +100,11 @@ void BroadbandAdapterSettingsDialog::SaveAddress()
tr("The entered MAC address is invalid.")); tr("The entered MAC address is invalid."));
return; return;
} }
SConfig::GetInstance().m_bba_mac = bba_new_address; Config::SetBaseOrCurrent(Config::MAIN_BBA_MAC, bba_new_address);
break; break;
case Type::XLinkKai: case Type::XLinkKai:
SConfig::GetInstance().m_bba_xlink_ip = bba_new_address; Config::SetBaseOrCurrent(Config::MAIN_BBA_XLINK_IP, bba_new_address);
break; break;
} }

View File

@ -349,8 +349,9 @@ void GameCubePane::OnConfigPressed(int slot)
} }
else else
{ {
path_old = QFileInfo(QString::fromStdString(slot == 0 ? SConfig::GetInstance().m_strGbaCartA : path_old =
SConfig::GetInstance().m_strGbaCartB)) QFileInfo(QString::fromStdString(slot == 0 ? Config::Get(Config::MAIN_AGP_CART_A_PATH) :
Config::Get(Config::MAIN_AGP_CART_B_PATH)))
.absoluteFilePath(); .absoluteFilePath();
} }
@ -369,11 +370,11 @@ void GameCubePane::OnConfigPressed(int slot)
{ {
if (slot == SLOT_A_INDEX) if (slot == SLOT_A_INDEX)
{ {
SConfig::GetInstance().m_strGbaCartA = path_abs.toStdString(); Config::SetBase(Config::MAIN_AGP_CART_A_PATH, path_abs.toStdString());
} }
else else
{ {
SConfig::GetInstance().m_strGbaCartB = path_abs.toStdString(); Config::SetBase(Config::MAIN_AGP_CART_B_PATH, path_abs.toStdString());
} }
} }
@ -432,11 +433,10 @@ void GameCubePane::BrowseGBASaves()
void GameCubePane::LoadSettings() void GameCubePane::LoadSettings()
{ {
const SConfig& params = SConfig::GetInstance();
// IPL Settings // IPL Settings
m_skip_main_menu->setChecked(params.bHLE_BS2); m_skip_main_menu->setChecked(Config::Get(Config::MAIN_SKIP_IPL));
m_language_combo->setCurrentIndex(m_language_combo->findData(params.SelectedLanguage)); m_language_combo->setCurrentIndex(
m_language_combo->findData(Config::Get(Config::MAIN_GC_LANGUAGE)));
bool have_menu = false; bool have_menu = false;
@ -478,12 +478,8 @@ void GameCubePane::SaveSettings()
{ {
Config::ConfigChangeCallbackGuard config_guard; Config::ConfigChangeCallbackGuard config_guard;
SConfig& params = SConfig::GetInstance();
// IPL Settings // IPL Settings
params.bHLE_BS2 = m_skip_main_menu->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_SKIP_IPL, m_skip_main_menu->isChecked()); Config::SetBaseOrCurrent(Config::MAIN_SKIP_IPL, m_skip_main_menu->isChecked());
params.SelectedLanguage = m_language_combo->currentData().toInt();
Config::SetBaseOrCurrent(Config::MAIN_GC_LANGUAGE, m_language_combo->currentData().toInt()); Config::SetBaseOrCurrent(Config::MAIN_GC_LANGUAGE, m_language_combo->currentData().toInt());
// Device Settings // Device Settings

View File

@ -254,7 +254,8 @@ void GeneralPane::LoadConfig()
#endif #endif
m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread); m_checkbox_dualcore->setChecked(SConfig::GetInstance().bCPUThread);
m_checkbox_cheats->setChecked(Settings::Instance().GetCheatsEnabled()); m_checkbox_cheats->setChecked(Settings::Instance().GetCheatsEnabled());
m_checkbox_override_region_settings->setChecked(SConfig::GetInstance().bOverrideRegionSettings); m_checkbox_override_region_settings->setChecked(
Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
m_checkbox_auto_disc_change->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE)); m_checkbox_auto_disc_change->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
#ifdef USE_DISCORD_PRESENCE #ifdef USE_DISCORD_PRESENCE
m_checkbox_discord_presence->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE)); m_checkbox_discord_presence->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
@ -348,7 +349,6 @@ void GeneralPane::OnSaveConfig()
settings.bCPUThread = m_checkbox_dualcore->isChecked(); settings.bCPUThread = m_checkbox_dualcore->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked()); Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked()); Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
settings.bOverrideRegionSettings = m_checkbox_override_region_settings->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS, Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS,
m_checkbox_override_region_settings->isChecked()); m_checkbox_override_region_settings->isChecked());
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked()); Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());

View File

@ -2,14 +2,17 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm> #include <algorithm>
#include <array>
#include <libusb.h> #include <libusb.h>
#include <mutex> #include <mutex>
#include <optional>
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/Flag.h" #include "Common/Flag.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/ScopeGuard.h" #include "Common/ScopeGuard.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/Config/MainSettings.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"
@ -79,6 +82,9 @@ static u8 s_endpoint_out = 0;
static u64 s_last_init = 0; static u64 s_last_init = 0;
static std::optional<size_t> s_config_callback_id = std::nullopt;
static std::array<bool, SerialInterface::MAX_SI_CHANNELS> s_config_rumble_enabled{};
static void Read() static void Read()
{ {
int payload_size = 0; int payload_size = 0;
@ -196,6 +202,12 @@ void SetAdapterCallback(std::function<void()> func)
s_detect_callback = func; s_detect_callback = func;
} }
static void RefreshConfig()
{
for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
s_config_rumble_enabled[i] = Config::Get(Config::GetInfoForAdapterRumble(i));
}
void Init() void Init()
{ {
if (s_handle != nullptr) if (s_handle != nullptr)
@ -211,6 +223,10 @@ void Init()
s_status = NO_ADAPTER_DETECTED; s_status = NO_ADAPTER_DETECTED;
if (!s_config_callback_id)
s_config_callback_id = Config::AddConfigChangedCallback(RefreshConfig);
RefreshConfig();
if (UseAdapter()) if (UseAdapter())
StartScanThread(); StartScanThread();
} }
@ -382,6 +398,12 @@ void Shutdown()
Reset(); Reset();
s_status = NO_ADAPTER_DETECTED; s_status = NO_ADAPTER_DETECTED;
if (s_config_callback_id)
{
Config::RemoveConfigChangedCallback(*s_config_callback_id);
s_config_callback_id = std::nullopt;
}
} }
static void Reset() static void Reset()
@ -557,7 +579,7 @@ static void ResetRumbleLockNeeded()
void Output(int chan, u8 rumble_command) void Output(int chan, u8 rumble_command)
{ {
if (s_handle == nullptr || !UseAdapter() || !SConfig::GetInstance().m_AdapterRumble[chan]) if (s_handle == nullptr || !UseAdapter() || !s_config_rumble_enabled[chan])
return; return;
// Skip over rumble commands if it has not changed or the controller is wireless // Skip over rumble commands if it has not changed or the controller is wireless