Config: Include SYSCONF in base layer

Settings that come from the SYSCONF are now included in Dolphin's
config system as part of the base layer. They are handled in a
special way compared to other settings to make sure they are only
loaded from and saved to the SYSCONF (to avoid different, possibly
contradicting sources of truth).
This commit is contained in:
Léo Lam 2017-08-01 22:37:42 +08:00
parent c900e77ac5
commit b2c41cec0a
27 changed files with 272 additions and 172 deletions

View File

@ -101,8 +101,7 @@ void ClearCurrentRunLayer()
static const std::map<System, std::string> system_to_name = { static const std::map<System, std::string> system_to_name = {
{System::Main, "Dolphin"}, {System::GCPad, "GCPad"}, {System::WiiPad, "Wiimote"}, {System::Main, "Dolphin"}, {System::GCPad, "GCPad"}, {System::WiiPad, "Wiimote"},
{System::GCKeyboard, "GCKeyboard"}, {System::GFX, "Graphics"}, {System::Logger, "Logger"}, {System::GCKeyboard, "GCKeyboard"}, {System::GFX, "Graphics"}, {System::Logger, "Logger"},
{System::Debugger, "Debugger"}, {System::UI, "UI"}, {System::Debugger, "Debugger"}, {System::UI, "UI"}, {System::SYSCONF, "SYSCONF"}};
};
const std::string& GetSystemName(System system) const std::string& GetSystemName(System system)
{ {

View File

@ -23,6 +23,7 @@ enum class LayerType
enum class System enum class System
{ {
Main, Main,
SYSCONF,
GCPad, GCPad,
WiiPad, WiiPad,
GCKeyboard, GCKeyboard,

View File

@ -14,7 +14,6 @@
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Swap.h" #include "Common/Swap.h"
#include "Core/Movie.h"
constexpr size_t SYSCONF_SIZE = 0x4000; constexpr size_t SYSCONF_SIZE = 0x4000;
@ -61,8 +60,6 @@ void SysConf::Load()
WARN_LOG(CORE, "No valid SYSCONF detected. Creating a new one."); WARN_LOG(CORE, "No valid SYSCONF detected. Creating a new one.");
InsertDefaultEntries(); InsertDefaultEntries();
} }
ApplySettingsFromMovie();
} }
bool SysConf::LoadFromFile(const std::string& file_name) bool SysConf::LoadFromFile(const std::string& file_name)
@ -257,17 +254,6 @@ void SysConf::RemoveEntry(const std::string& key)
m_entries.end()); m_entries.end());
} }
// Apply Wii settings from normal SYSCONF on Movie recording/playback
void SysConf::ApplySettingsFromMovie()
{
if (!Movie::IsMovieActive())
return;
SetData<u8>("IPL.LNG", Entry::Type::Byte, Movie::GetLanguage());
SetData<u8>("IPL.E60", Entry::Type::Byte, Movie::IsPAL60());
SetData<u8>("IPL.PGS", Entry::Type::Byte, Movie::IsProgressive());
}
void SysConf::InsertDefaultEntries() void SysConf::InsertDefaultEntries()
{ {
AddEntry({Entry::Type::BigArray, "BT.DINF", std::vector<u8>(0x460 + 1)}); AddEntry({Entry::Type::BigArray, "BT.DINF", std::vector<u8>(0x460 + 1)});

View File

@ -84,7 +84,6 @@ public:
} }
private: private:
void ApplySettingsFromMovie();
void InsertDefaultEntries(); void InsertDefaultEntries();
bool LoadFromFile(const std::string& file_name); bool LoadFromFile(const std::string& file_name);

View File

@ -20,6 +20,7 @@
#include "Common/CDUtils.h" #include "Common/CDUtils.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/File.h" #include "Common/File.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
@ -29,6 +30,7 @@
#include "Core/Boot/DolReader.h" #include "Core/Boot/DolReader.h"
#include "Core/Boot/ElfReader.h" #include "Core/Boot/ElfReader.h"
#include "Core/CommonTitles.h" #include "Core/CommonTitles.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/FifoPlayer/FifoPlayer.h" #include "Core/FifoPlayer/FifoPlayer.h"
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
@ -289,7 +291,8 @@ bool CBoot::BootUp(std::unique_ptr<BootParameters> boot)
g_symbolDB.Clear(); g_symbolDB.Clear();
// PAL Wii uses NTSC framerate and linecount in 60Hz modes // PAL Wii uses NTSC framerate and linecount in 60Hz modes
VideoInterface::Preset(DiscIO::IsNTSC(config.m_region) || (config.bWii && config.bPAL60)); VideoInterface::Preset(DiscIO::IsNTSC(config.m_region) ||
(config.bWii && Config::Get(Config::SYSCONF_PAL60)));
struct BootTitle struct BootTitle
{ {

View File

@ -33,7 +33,10 @@
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/BaseConfigLoader.h"
#include "Core/ConfigLoaders/GameConfigLoader.h" #include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigLoaders/MovieConfigLoader.h"
#include "Core/ConfigLoaders/NetPlayConfigLoader.h" #include "Core/ConfigLoaders/NetPlayConfigLoader.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
@ -83,12 +86,9 @@ private:
bool bFastDiscSpeed; bool bFastDiscSpeed;
bool bDSPHLE; bool bDSPHLE;
bool bHLE_BS2; bool bHLE_BS2;
bool bProgressive;
bool bPAL60;
int iSelectedLanguage; int iSelectedLanguage;
int iCPUCore; int iCPUCore;
int Volume; int Volume;
int m_wii_language;
float m_EmulationSpeed; float m_EmulationSpeed;
float m_OCFactor; float m_OCFactor;
bool m_OCEnable; bool m_OCEnable;
@ -116,8 +116,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
bFastDiscSpeed = config.bFastDiscSpeed; bFastDiscSpeed = config.bFastDiscSpeed;
bDSPHLE = config.bDSPHLE; bDSPHLE = config.bDSPHLE;
bHLE_BS2 = config.bHLE_BS2; bHLE_BS2 = config.bHLE_BS2;
bProgressive = config.bProgressive;
bPAL60 = config.bPAL60;
iSelectedLanguage = config.SelectedLanguage; iSelectedLanguage = config.SelectedLanguage;
iCPUCore = config.iCPUCore; iCPUCore = config.iCPUCore;
Volume = config.m_Volume; Volume = config.m_Volume;
@ -125,7 +123,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
strBackend = config.m_strVideoBackend; strBackend = config.m_strVideoBackend;
sBackend = config.sBackend; sBackend = config.sBackend;
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode; m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
m_wii_language = config.m_wii_language;
m_OCFactor = config.m_OCFactor; m_OCFactor = config.m_OCFactor;
m_OCEnable = config.m_OCEnable; m_OCEnable = config.m_OCEnable;
@ -160,8 +157,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
config->bFastDiscSpeed = bFastDiscSpeed; config->bFastDiscSpeed = bFastDiscSpeed;
config->bDSPHLE = bDSPHLE; config->bDSPHLE = bDSPHLE;
config->bHLE_BS2 = bHLE_BS2; config->bHLE_BS2 = bHLE_BS2;
config->bProgressive = bProgressive;
config->bPAL60 = bPAL60;
config->SelectedLanguage = iSelectedLanguage; config->SelectedLanguage = iSelectedLanguage;
config->iCPUCore = iCPUCore; config->iCPUCore = iCPUCore;
@ -180,8 +175,6 @@ void ConfigCache::RestoreConfig(SConfig* config)
WiimoteReal::ChangeWiimoteSource(i, iWiimoteSource[i]); WiimoteReal::ChangeWiimoteSource(i, iWiimoteSource[i]);
} }
} }
config->m_wii_language = m_wii_language;
} }
for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i) for (unsigned int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
@ -263,8 +256,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
core_section->Get("GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend); core_section->Get("GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend);
core_section->Get("CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore); core_section->Get("CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore);
core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2); core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
core_section->Get("ProgressiveScan", &StartUp.bProgressive, StartUp.bProgressive);
core_section->Get("PAL60", &StartUp.bPAL60, StartUp.bPAL60);
core_section->Get("GameCubeLanguage", &StartUp.SelectedLanguage, StartUp.SelectedLanguage); 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;
@ -293,10 +284,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
// Wii settings // Wii settings
if (StartUp.bWii) if (StartUp.bWii)
{ {
IniFile::Section* wii_section = game_ini.GetOrCreateSection("Wii");
wii_section->Get("Widescreen", &StartUp.m_wii_aspect_ratio, !!StartUp.m_wii_aspect_ratio);
wii_section->Get("Language", &StartUp.m_wii_language, StartUp.m_wii_language);
int source; int source;
for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) for (unsigned int i = 0; i < MAX_WIIMOTES; ++i)
{ {
@ -325,11 +312,8 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
// Movie settings // Movie settings
if (Movie::IsPlayingInput() && Movie::IsConfigSaved()) if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{ {
Config::AddLayer(std::make_unique<Config::Layer>(Config::LayerType::Movie));
StartUp.bCPUThread = Movie::IsDualCore(); StartUp.bCPUThread = Movie::IsDualCore();
StartUp.bDSPHLE = Movie::IsDSPHLE(); StartUp.bDSPHLE = Movie::IsDSPHLE();
StartUp.bProgressive = Movie::IsProgressive();
StartUp.bPAL60 = Movie::IsPAL60();
StartUp.bFastDiscSpeed = Movie::IsFastDiscSpeed(); StartUp.bFastDiscSpeed = Movie::IsFastDiscSpeed();
StartUp.iCPUCore = Movie::GetCPUMode(); StartUp.iCPUCore = Movie::GetCPUMode();
StartUp.bSyncGPU = Movie::IsSyncGPU(); StartUp.bSyncGPU = Movie::IsSyncGPU();
@ -360,8 +344,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
StartUp.iCPUCore = g_NetPlaySettings.m_CPUcore; StartUp.iCPUCore = g_NetPlaySettings.m_CPUcore;
StartUp.SelectedLanguage = g_NetPlaySettings.m_SelectedLanguage; StartUp.SelectedLanguage = g_NetPlaySettings.m_SelectedLanguage;
StartUp.bOverrideGCLanguage = g_NetPlaySettings.m_OverrideGCLanguage; StartUp.bOverrideGCLanguage = g_NetPlaySettings.m_OverrideGCLanguage;
StartUp.bProgressive = g_NetPlaySettings.m_ProgressiveScan;
StartUp.bPAL60 = g_NetPlaySettings.m_PAL60;
StartUp.m_DSPEnableJIT = g_NetPlaySettings.m_DSPEnableJIT; StartUp.m_DSPEnableJIT = g_NetPlaySettings.m_DSPEnableJIT;
StartUp.m_OCEnable = g_NetPlaySettings.m_OCEnable; StartUp.m_OCEnable = g_NetPlaySettings.m_OCEnable;
StartUp.m_OCFactor = g_NetPlaySettings.m_OCFactor; StartUp.m_OCFactor = g_NetPlaySettings.m_OCFactor;
@ -388,12 +370,11 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
// Some NTSC Wii games such as Doc Louis's Punch-Out!! and // Some NTSC Wii games such as Doc Louis's Punch-Out!! and
// 1942 (Virtual Console) crash if the PAL60 option is enabled // 1942 (Virtual Console) crash if the PAL60 option is enabled
if (StartUp.bWii && ntsc) if (StartUp.bWii && ntsc)
{ Config::SetCurrent(Config::SYSCONF_PAL60, false);
StartUp.bPAL60 = false;
}
// Ensure any new settings are written to the SYSCONF
if (StartUp.bWii) if (StartUp.bWii)
StartUp.SaveSettingsToSysconf(); ConfigLoaders::SaveToSYSCONF(Config::GetLayer(Config::LayerType::Meta));
const bool load_ipl = !StartUp.bWii && !StartUp.bHLE_BS2 && const bool load_ipl = !StartUp.bWii && !StartUp.bHLE_BS2 &&
std::holds_alternative<BootParameters::Disc>(boot->parameters); std::holds_alternative<BootParameters::Disc>(boot->parameters);
@ -411,14 +392,41 @@ void Stop()
RestoreConfig(); RestoreConfig();
} }
// SYSCONF can be modified during emulation by the user and internally, which makes it
// a bad idea to just always overwrite it with the settings from the base layer.
//
// Conversely, we also shouldn't just ignore any changes to SYSCONF, as it may cause
// temporary settings (from Movie, Netplay, game INIs, etc.) to stick around.
//
// To avoid inconveniences in most cases, we always restore only the overridden settings.
static void RestoreSYSCONF()
{
// This layer contains the new SYSCONF settings (including any temporary settings).
auto layer = std::make_unique<Config::Layer>(ConfigLoaders::GenerateBaseConfigLoader());
for (const auto& setting : Config::SYSCONF_SETTINGS)
{
std::visit(
[&](auto& info) {
// If this setting was overridden, then we copy the base layer value back to the SYSCONF.
// Otherwise we leave the new value in the SYSCONF.
if (Config::GetActiveLayerForConfig(info) != Config::LayerType::Base)
layer->Set(info, Config::GetBase(info));
},
setting.config_info);
}
// Save the SYSCONF.
layer->Save();
Config::AddLayer(std::move(layer));
}
void RestoreConfig() void RestoreConfig()
{ {
RestoreSYSCONF();
Config::ClearCurrentRunLayer(); Config::ClearCurrentRunLayer();
Config::RemoveLayer(Config::LayerType::Movie); Config::RemoveLayer(Config::LayerType::Movie);
Config::RemoveLayer(Config::LayerType::Netplay); Config::RemoveLayer(Config::LayerType::Netplay);
Config::RemoveLayer(Config::LayerType::GlobalGame); Config::RemoveLayer(Config::LayerType::GlobalGame);
Config::RemoveLayer(Config::LayerType::LocalGame); Config::RemoveLayer(Config::LayerType::LocalGame);
SConfig::GetInstance().LoadSettingsFromSysconf();
SConfig::GetInstance().ResetRunningGameMetadata(); SConfig::GetInstance().ResetRunningGameMetadata();
config_cache.RestoreConfig(&SConfig::GetInstance()); config_cache.RestoreConfig(&SConfig::GetInstance());
} }

View File

@ -27,6 +27,7 @@ set(SRCS
Boot/ElfReader.cpp Boot/ElfReader.cpp
Config/GraphicsSettings.cpp Config/GraphicsSettings.cpp
Config/NetplaySettings.cpp Config/NetplaySettings.cpp
Config/SYSCONFSettings.cpp
ConfigLoaders/BaseConfigLoader.cpp ConfigLoaders/BaseConfigLoader.cpp
ConfigLoaders/GameConfigLoader.cpp ConfigLoaders/GameConfigLoader.cpp
ConfigLoaders/IsSettingSaveable.cpp ConfigLoaders/IsSettingSaveable.cpp

View File

@ -0,0 +1,34 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/Config/SYSCONFSettings.h"
namespace Config
{
// SYSCONF.IPL
const ConfigInfo<bool> SYSCONF_SCREENSAVER{{System::SYSCONF, "IPL", "SSV"}, false};
const ConfigInfo<u32> SYSCONF_LANGUAGE{{System::SYSCONF, "IPL", "LNG"}, 0x01};
const ConfigInfo<bool> SYSCONF_WIDESCREEN{{System::SYSCONF, "IPL", "AR"}, true};
const ConfigInfo<bool> SYSCONF_PROGRESSIVE_SCAN{{System::SYSCONF, "IPL", "PGS"}, true};
const ConfigInfo<bool> SYSCONF_PAL60{{System::SYSCONF, "IPL", "E60"}, 0x01};
// SYSCONF.BT
const ConfigInfo<u32> SYSCONF_SENSOR_BAR_POSITION{{System::SYSCONF, "BT", "BAR"}, 0x01};
const ConfigInfo<u32> SYSCONF_SENSOR_BAR_SENSITIVITY{{System::SYSCONF, "BT", "SENS"}, 0x03};
const ConfigInfo<u32> SYSCONF_SPEAKER_VOLUME{{System::SYSCONF, "BT", "SPKV"}, 0x58};
const ConfigInfo<bool> SYSCONF_WIIMOTE_MOTOR{{System::SYSCONF, "BT", "MOT"}, true};
const std::array<SYSCONFSetting, 9> SYSCONF_SETTINGS{
{{SYSCONF_SCREENSAVER, SysConf::Entry::Type::Byte},
{SYSCONF_LANGUAGE, SysConf::Entry::Type::Byte},
{SYSCONF_WIDESCREEN, SysConf::Entry::Type::Byte},
{SYSCONF_PROGRESSIVE_SCAN, SysConf::Entry::Type::Byte},
{SYSCONF_PAL60, SysConf::Entry::Type::Byte},
{SYSCONF_SENSOR_BAR_POSITION, SysConf::Entry::Type::Byte},
{SYSCONF_SENSOR_BAR_SENSITIVITY, SysConf::Entry::Type::Long},
{SYSCONF_SPEAKER_VOLUME, SysConf::Entry::Type::Byte},
{SYSCONF_WIIMOTE_MOTOR, SysConf::Entry::Type::Byte}}};
} // namespace Config

View File

@ -0,0 +1,40 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <array>
#include <variant>
#include "Common/Config/Config.h"
#include "Common/SysConf.h"
namespace Config
{
// Note: some settings are actually u8s, but stored as u32 in the layer because of limitations.
// SYSCONF.IPL
extern const ConfigInfo<bool> SYSCONF_SCREENSAVER;
extern const ConfigInfo<u32> SYSCONF_LANGUAGE;
extern const ConfigInfo<bool> SYSCONF_WIDESCREEN;
extern const ConfigInfo<bool> SYSCONF_PROGRESSIVE_SCAN;
extern const ConfigInfo<bool> SYSCONF_PAL60;
// SYSCONF.BT
extern const ConfigInfo<u32> SYSCONF_SENSOR_BAR_POSITION;
extern const ConfigInfo<u32> SYSCONF_SENSOR_BAR_SENSITIVITY;
extern const ConfigInfo<u32> SYSCONF_SPEAKER_VOLUME;
extern const ConfigInfo<bool> SYSCONF_WIIMOTE_MOTOR;
struct SYSCONFSetting
{
std::variant<ConfigInfo<u32>, ConfigInfo<bool>> config_info;
SysConf::Entry::Type type;
};
extern const std::array<SYSCONFSetting, 9> SYSCONF_SETTINGS;
} // namespace Config

View File

@ -9,19 +9,59 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <type_traits>
#include <variant>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/SysConf.h"
#include "Common/Config/Config.h"
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h" #include "Core/ConfigLoaders/IsSettingSaveable.h"
#include "Core/Core.h"
#include "Core/IOS/USB/Bluetooth/BTBase.h"
namespace ConfigLoaders namespace ConfigLoaders
{ {
void SaveToSYSCONF(Config::Layer* layer)
{
if (Core::IsRunning())
return;
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
{
std::visit(
[layer, &setting, &sysconf](auto& info) {
const std::string key = info.location.section + "." + info.location.key;
if (setting.type == SysConf::Entry::Type::Long)
sysconf.SetData<u32>(key, setting.type, layer->Get(info));
else if (setting.type == SysConf::Entry::Type::Byte)
sysconf.SetData<u8>(key, setting.type, static_cast<u8>(layer->Get(info)));
},
setting.config_info);
}
// Disable WiiConnect24's standby mode. If it is enabled, it prevents us from receiving
// shutdown commands in the State Transition Manager (STM).
// TODO: remove this if and once Dolphin supports WC24 standby mode.
SysConf::Entry* idle_entry = sysconf.GetOrAddEntry("IPL.IDL", SysConf::Entry::Type::SmallArray);
if (idle_entry->bytes.empty())
idle_entry->bytes = std::vector<u8>(2);
else
idle_entry->bytes[0] = 0;
NOTICE_LOG(CORE, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
IOS::HLE::RestoreBTInfoSection(&sysconf);
sysconf.Save();
}
const std::map<Config::System, int> system_to_ini = { const std::map<Config::System, int> system_to_ini = {
{Config::System::Main, F_DOLPHINCONFIG_IDX}, {Config::System::Main, F_DOLPHINCONFIG_IDX},
{Config::System::GCPad, F_GCPADCONFIG_IDX}, {Config::System::GCPad, F_GCPADCONFIG_IDX},
@ -34,12 +74,13 @@ const std::map<Config::System, int> system_to_ini = {
}; };
// INI layer configuration loader // INI layer configuration loader
class INIBaseConfigLayerLoader final : public Config::ConfigLayerLoader class BaseConfigLayerLoader final : public Config::ConfigLayerLoader
{ {
public: public:
INIBaseConfigLayerLoader() : ConfigLayerLoader(Config::LayerType::Base) {} BaseConfigLayerLoader() : ConfigLayerLoader(Config::LayerType::Base) {}
void Load(Config::Layer* config_layer) override void Load(Config::Layer* config_layer) override
{ {
LoadFromSYSCONF(config_layer);
for (const auto& system : system_to_ini) for (const auto& system : system_to_ini)
{ {
IniFile ini; IniFile ini;
@ -76,6 +117,12 @@ public:
const Config::LayerMap& sections = config_layer->GetLayerMap(); const Config::LayerMap& sections = config_layer->GetLayerMap();
for (const auto& system : sections) for (const auto& system : sections)
{ {
if (system.first == Config::System::SYSCONF)
{
SaveToSYSCONF(config_layer);
continue;
}
auto mapping = system_to_ini.find(system.first); auto mapping = system_to_ini.find(system.first);
if (mapping == system_to_ini.end()) if (mapping == system_to_ini.end())
{ {
@ -116,11 +163,35 @@ public:
ini.Save(File::GetUserPath(mapping->second)); ini.Save(File::GetUserPath(mapping->second));
} }
} }
private:
void LoadFromSYSCONF(Config::Layer* layer)
{
if (Core::IsRunning())
return;
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
for (const Config::SYSCONFSetting& setting : Config::SYSCONF_SETTINGS)
{
std::visit(
[&](auto& info) {
const std::string key = info.location.section + "." + info.location.key;
auto* section =
layer->GetOrCreateSection(Config::System::SYSCONF, info.location.section);
if (setting.type == SysConf::Entry::Type::Long)
section->Set(info.location.key, sysconf.GetData<u32>(key, info.default_value));
else if (setting.type == SysConf::Entry::Type::Byte)
section->Set(info.location.key, sysconf.GetData<u8>(key, info.default_value));
},
setting.config_info);
}
}
}; };
// Loader generation // Loader generation
std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader() std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader()
{ {
return std::make_unique<INIBaseConfigLayerLoader>(); return std::make_unique<BaseConfigLayerLoader>();
} }
} }

View File

@ -9,9 +9,11 @@
namespace Config namespace Config
{ {
class ConfigLayerLoader; class ConfigLayerLoader;
class Layer;
} }
namespace ConfigLoaders namespace ConfigLoaders
{ {
void SaveToSYSCONF(Config::Layer* layer);
std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader(); std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader();
} }

View File

@ -25,6 +25,7 @@
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h" #include "Core/ConfigLoaders/IsSettingSaveable.h"
namespace ConfigLoaders namespace ConfigLoaders
@ -118,6 +119,11 @@ static const INIToLocationMap& GetINIToLocationMap()
{{"Video", "PH_ZNear"}, {Config::GFX_PROJECTION_HACK_ZNEAR.location}}, {{"Video", "PH_ZNear"}, {Config::GFX_PROJECTION_HACK_ZNEAR.location}},
{{"Video", "PH_ZFar"}, {Config::GFX_PROJECTION_HACK_ZFAR.location}}, {{"Video", "PH_ZFar"}, {Config::GFX_PROJECTION_HACK_ZFAR.location}},
{{"Video", "PerfQueriesEnable"}, {Config::GFX_PERF_QUERIES_ENABLE.location}}, {{"Video", "PerfQueriesEnable"}, {Config::GFX_PERF_QUERIES_ENABLE.location}},
{{"Core", "ProgressiveScan"}, {Config::SYSCONF_PROGRESSIVE_SCAN.location}},
{{"Core", "PAL60"}, {Config::SYSCONF_PAL60.location}},
{{"Wii", "Widescreen"}, {Config::SYSCONF_WIDESCREEN.location}},
{{"Wii", "Language"}, {Config::SYSCONF_LANGUAGE.location}},
}; };
return ini_to_location; return ini_to_location;
} }

View File

@ -13,6 +13,7 @@
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/Movie.h" #include "Core/Movie.h"
namespace ConfigLoaders namespace ConfigLoaders
@ -22,7 +23,6 @@ namespace ConfigLoaders
void MovieConfigLayerLoader::Load(Config::Layer* config_layer) void MovieConfigLayerLoader::Load(Config::Layer* config_layer)
{ {
Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core"); Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core");
Config::Section* display = config_layer->GetOrCreateSection(Config::System::Main, "Display");
Config::Section* video_settings = Config::GetOrCreateSection(Config::System::GFX, "Settings"); Config::Section* video_settings = Config::GetOrCreateSection(Config::System::GFX, "Settings");
Config::Section* video_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks"); Config::Section* video_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks");
@ -33,8 +33,11 @@ void MovieConfigLayerLoader::Load(Config::Layer* config_layer)
core->Set("CPUCore", m_header->CPUCore); core->Set("CPUCore", m_header->CPUCore);
core->Set("SyncGPU", m_header->bSyncGPU); core->Set("SyncGPU", m_header->bSyncGPU);
core->Set("GFXBackend", std::string(reinterpret_cast<char*>(m_header->videoBackend))); core->Set("GFXBackend", std::string(reinterpret_cast<char*>(m_header->videoBackend)));
display->Set("ProgressiveScan", m_header->bProgressive);
display->Set("PAL60", m_header->bPAL60); config_layer->Set(Config::SYSCONF_PROGRESSIVE_SCAN, m_header->bProgressive);
config_layer->Set(Config::SYSCONF_PAL60, m_header->bPAL60);
if (m_header->bWii)
config_layer->Set(Config::SYSCONF_LANGUAGE, static_cast<u32>(m_header->language));
video_settings->Set("UseXFB", m_header->bUseXFB); video_settings->Set("UseXFB", m_header->bUseXFB);
video_settings->Set("UseRealXFB", m_header->bUseRealXFB); video_settings->Set("UseRealXFB", m_header->bUseRealXFB);
@ -46,7 +49,6 @@ void MovieConfigLayerLoader::Load(Config::Layer* config_layer)
void MovieConfigLayerLoader::Save(Config::Layer* config_layer) void MovieConfigLayerLoader::Save(Config::Layer* config_layer)
{ {
Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core"); Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core");
Config::Section* display = config_layer->GetOrCreateSection(Config::System::Main, "Display");
Config::Section* video_settings = Config::GetOrCreateSection(Config::System::GFX, "Settings"); Config::Section* video_settings = Config::GetOrCreateSection(Config::System::GFX, "Settings");
Config::Section* video_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks"); Config::Section* video_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks");
@ -60,8 +62,10 @@ void MovieConfigLayerLoader::Save(Config::Layer* config_layer)
core->Get("CPUCore", &cpu_core); core->Get("CPUCore", &cpu_core);
core->Get("SyncGPU", &m_header->bSyncGPU); core->Get("SyncGPU", &m_header->bSyncGPU);
core->Get("GFXBackend", &video_backend); core->Get("GFXBackend", &video_backend);
display->Get("ProgressiveScan", &m_header->bProgressive); m_header->bProgressive = config_layer->Get(Config::SYSCONF_PROGRESSIVE_SCAN);
display->Get("PAL60", &m_header->bPAL60); m_header->bPAL60 = config_layer->Get(Config::SYSCONF_PAL60);
if (m_header->bWii)
m_header->language = config_layer->Get(Config::SYSCONF_LANGUAGE);
video_settings->Get("UseXFB", &m_header->bUseXFB); video_settings->Get("UseXFB", &m_header->bUseXFB);
video_settings->Get("UseRealXFB", &m_header->bUseRealXFB); video_settings->Get("UseRealXFB", &m_header->bUseRealXFB);

View File

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
namespace ConfigLoaders namespace ConfigLoaders
@ -23,7 +24,6 @@ public:
{ {
Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core"); Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core");
Config::Section* dsp = config_layer->GetOrCreateSection(Config::System::Main, "DSP"); Config::Section* dsp = config_layer->GetOrCreateSection(Config::System::Main, "DSP");
Config::Section* display = config_layer->GetOrCreateSection(Config::System::Main, "Display");
core->Set("CPUThread", m_settings.m_CPUthread); core->Set("CPUThread", m_settings.m_CPUthread);
core->Set("CPUCore", m_settings.m_CPUcore); core->Set("CPUCore", m_settings.m_CPUcore);
@ -38,8 +38,8 @@ public:
dsp->Set("EnableJIT", m_settings.m_DSPEnableJIT); dsp->Set("EnableJIT", m_settings.m_DSPEnableJIT);
display->Set("ProgressiveScan", m_settings.m_ProgressiveScan); config_layer->Set(Config::SYSCONF_PROGRESSIVE_SCAN, m_settings.m_ProgressiveScan);
display->Set("PAL60", m_settings.m_PAL60); config_layer->Set(Config::SYSCONF_PAL60, m_settings.m_PAL60);
} }
void Save(Config::Layer* config_layer) override void Save(Config::Layer* config_layer) override

View File

@ -23,10 +23,10 @@
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/NandPaths.h" #include "Common/NandPaths.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/SysConf.h"
#include "Core/Analytics.h" #include "Core/Analytics.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.h" #include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoDataFile.h"
@ -34,7 +34,6 @@
#include "Core/HW/DVD/DVDInterface.h" #include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/SI/SI.h" #include "Core/HW/SI/SI.h"
#include "Core/IOS/ES/Formats.h" #include "Core/IOS/ES/Formats.h"
#include "Core/IOS/USB/Bluetooth/BTBase.h"
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
@ -52,7 +51,6 @@ SConfig::SConfig()
LoadDefaults(); LoadDefaults();
// Make sure we have log manager // Make sure we have log manager
LoadSettings(); LoadSettings();
LoadSettingsFromSysconf();
} }
void SConfig::Init() void SConfig::Init()
@ -69,7 +67,6 @@ void SConfig::Shutdown()
SConfig::~SConfig() SConfig::~SConfig()
{ {
SaveSettings(); SaveSettings();
SaveSettingsToSysconf();
} }
void SConfig::SaveSettings() void SConfig::SaveSettings()
@ -190,8 +187,6 @@ void SConfig::SaveDisplaySettings(IniFile& ini)
display->Set("RenderWindowHeight", iRenderWindowHeight); display->Set("RenderWindowHeight", iRenderWindowHeight);
display->Set("RenderWindowAutoSize", bRenderWindowAutoSize); display->Set("RenderWindowAutoSize", bRenderWindowAutoSize);
display->Set("KeepWindowOnTop", bKeepWindowOnTop); display->Set("KeepWindowOnTop", bKeepWindowOnTop);
display->Set("ProgressiveScan", bProgressive);
display->Set("PAL60", bPAL60);
display->Set("DisableScreenSaver", bDisableScreenSaver); display->Set("DisableScreenSaver", bDisableScreenSaver);
display->Set("ForceNTSCJ", bForceNTSCJ); display->Set("ForceNTSCJ", bForceNTSCJ);
} }
@ -374,36 +369,6 @@ void SConfig::SaveUSBPassthroughSettings(IniFile& ini)
section->Set("Devices", devices_string); section->Set("Devices", devices_string);
} }
void SConfig::SaveSettingsToSysconf()
{
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
sysconf.SetData<u8>("IPL.SSV", SysConf::Entry::Type::Byte, m_wii_screensaver);
sysconf.SetData<u8>("IPL.LNG", SysConf::Entry::Type::Byte, m_wii_language);
sysconf.SetData<u8>("IPL.AR", SysConf::Entry::Type::Byte, m_wii_aspect_ratio);
sysconf.SetData<u8>("BT.BAR", SysConf::Entry::Type::Byte, m_sensor_bar_position);
sysconf.SetData<u32>("BT.SENS", SysConf::Entry::Type::Long, m_sensor_bar_sensitivity);
sysconf.SetData<u8>("BT.SPKV", SysConf::Entry::Type::Byte, m_speaker_volume);
sysconf.SetData<u8>("BT.MOT", SysConf::Entry::Type::Byte, m_wiimote_motor);
sysconf.SetData<u8>("IPL.PGS", SysConf::Entry::Type::Byte, bProgressive);
sysconf.SetData<u8>("IPL.E60", SysConf::Entry::Type::Byte, bPAL60);
// Disable WiiConnect24's standby mode. If it is enabled, it prevents us from receiving
// shutdown commands in the State Transition Manager (STM).
// TODO: remove this if and once Dolphin supports WC24 standby mode.
SysConf::Entry* idle_entry = sysconf.GetOrAddEntry("IPL.IDL", SysConf::Entry::Type::SmallArray);
if (idle_entry->bytes.empty())
idle_entry->bytes = std::vector<u8>(2);
else
idle_entry->bytes[0] = 0;
NOTICE_LOG(COMMON, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");
IOS::HLE::RestoreBTInfoSection(&sysconf);
sysconf.Save();
}
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
Config::Load(); Config::Load();
@ -502,8 +467,6 @@ void SConfig::LoadDisplaySettings(IniFile& ini)
display->Get("RenderWindowHeight", &iRenderWindowHeight, 480); display->Get("RenderWindowHeight", &iRenderWindowHeight, 480);
display->Get("RenderWindowAutoSize", &bRenderWindowAutoSize, false); display->Get("RenderWindowAutoSize", &bRenderWindowAutoSize, false);
display->Get("KeepWindowOnTop", &bKeepWindowOnTop, false); display->Get("KeepWindowOnTop", &bKeepWindowOnTop, false);
display->Get("ProgressiveScan", &bProgressive, false);
display->Get("PAL60", &bPAL60, true);
display->Get("DisableScreenSaver", &bDisableScreenSaver, true); display->Get("DisableScreenSaver", &bDisableScreenSaver, true);
display->Get("ForceNTSCJ", &bForceNTSCJ, false); display->Get("ForceNTSCJ", &bForceNTSCJ, false);
} }
@ -708,21 +671,6 @@ void SConfig::LoadUSBPassthroughSettings(IniFile& ini)
} }
} }
void SConfig::LoadSettingsFromSysconf()
{
SysConf sysconf{Common::FromWhichRoot::FROM_CONFIGURED_ROOT};
m_wii_screensaver = sysconf.GetData<u8>("IPL.SSV", m_wii_screensaver);
m_wii_language = sysconf.GetData<u8>("IPL.LNG", m_wii_language);
m_wii_aspect_ratio = sysconf.GetData<u8>("IPL.AR", m_wii_aspect_ratio);
m_sensor_bar_position = sysconf.GetData<u8>("BT.BAR", m_sensor_bar_position);
m_sensor_bar_sensitivity = sysconf.GetData<u32>("BT.SENS", m_sensor_bar_sensitivity);
m_speaker_volume = sysconf.GetData<u8>("BT.SPKV", m_speaker_volume);
m_wiimote_motor = sysconf.GetData<u8>("BT.MOT", m_wiimote_motor) != 0;
bProgressive = sysconf.GetData<u8>("IPL.PGS", bProgressive) != 0;
bPAL60 = sysconf.GetData<u8>("IPL.E60", bPAL60) != 0;
}
void SConfig::ResetRunningGameMetadata() void SConfig::ResetRunningGameMetadata()
{ {
SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other); SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other);
@ -1060,7 +1008,7 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{ {
int language_value; int language_value;
if (wii) if (wii)
language_value = SConfig::GetInstance().m_wii_language; language_value = Config::Get(Config::SYSCONF_LANGUAGE);
else else
language_value = SConfig::GetInstance().SelectedLanguage + 1; language_value = SConfig::GetInstance().SelectedLanguage + 1;
DiscIO::Language language = static_cast<DiscIO::Language>(language_value); DiscIO::Language language = static_cast<DiscIO::Language>(language_value);

View File

@ -147,7 +147,6 @@ struct SConfig : NonCopyable
int iRenderWindowHeight = -1; int iRenderWindowHeight = -1;
bool bRenderWindowAutoSize = false, bKeepWindowOnTop = false; bool bRenderWindowAutoSize = false, bKeepWindowOnTop = false;
bool bFullscreen = false, bRenderToMain = false; bool bFullscreen = false, bRenderToMain = false;
bool bProgressive = false, bPAL60 = false;
bool bDisableScreenSaver = false; bool bDisableScreenSaver = false;
int iPosX, iPosY, iWidth, iHeight; int iPosX, iPosY, iWidth, iHeight;
@ -169,15 +168,6 @@ struct SConfig : NonCopyable
bool m_enable_signature_checks = true; bool m_enable_signature_checks = true;
// SYSCONF settings
int m_sensor_bar_position = 0x01;
int m_sensor_bar_sensitivity = 0x03;
int m_speaker_volume = 0x58;
bool m_wiimote_motor = true;
int m_wii_language = 0x01;
int m_wii_aspect_ratio = 0x01;
int m_wii_screensaver = 0x00;
// Fifo Player related settings // Fifo Player related settings
bool bLoopFifoReplay = true; bool bLoopFifoReplay = true;
@ -334,9 +324,6 @@ struct SConfig : NonCopyable
// Load settings // Load settings
void LoadSettings(); void LoadSettings();
void LoadSettingsFromSysconf();
void SaveSettingsToSysconf();
// Return the permanent and somewhat globally used instance of this struct // Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() { return (*m_Instance); } static SConfig& GetInstance() { return (*m_Instance); }
static void Init(); static void Init();

View File

@ -47,6 +47,7 @@
<ClCompile Include="Boot\ElfReader.cpp" /> <ClCompile Include="Boot\ElfReader.cpp" />
<ClCompile Include="Config\GraphicsSettings.cpp" /> <ClCompile Include="Config\GraphicsSettings.cpp" />
<ClCompile Include="Config\NetplaySettings.cpp" /> <ClCompile Include="Config\NetplaySettings.cpp" />
<ClCompile Include="Config\SYSCONFSettings.cpp" />
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" /> <ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" /> <ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\IsSettingSaveable.cpp" /> <ClCompile Include="ConfigLoaders\IsSettingSaveable.cpp" />
@ -303,6 +304,7 @@
<ClInclude Include="Boot\ElfTypes.h" /> <ClInclude Include="Boot\ElfTypes.h" />
<ClInclude Include="Config\GraphicsSettings.h" /> <ClInclude Include="Config\GraphicsSettings.h" />
<ClInclude Include="Config\NetplaySettings.h" /> <ClInclude Include="Config\NetplaySettings.h" />
<ClInclude Include="Config\SYSCONFSettings.h" />
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" /> <ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" /> <ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
<ClInclude Include="ConfigLoaders\IsSettingSaveable.h" /> <ClInclude Include="ConfigLoaders\IsSettingSaveable.h" />

View File

@ -877,6 +877,9 @@
<ClCompile Include="Config\NetplaySettings.cpp"> <ClCompile Include="Config\NetplaySettings.cpp">
<Filter>Config</Filter> <Filter>Config</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Config\SYSCONFSettings.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="IOS\Network\NCD\WiiNetConfig.cpp"> <ClCompile Include="IOS\Network\NCD\WiiNetConfig.cpp">
<Filter>IOS\Network\NCD</Filter> <Filter>IOS\Network\NCD</Filter>
</ClCompile> </ClCompile>
@ -1529,6 +1532,9 @@
<ClInclude Include="Config\NetplaySettings.h"> <ClInclude Include="Config\NetplaySettings.h">
<Filter>Config</Filter> <Filter>Config</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Config\SYSCONFSettings.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="IOS\Network\NCD\WiiNetConfig.h"> <ClInclude Include="IOS\Network\NCD\WiiNetConfig.h">
<Filter>IOS\Network\NCD</Filter> <Filter>IOS\Network\NCD</Filter>
</ClInclude> </ClInclude>

View File

@ -10,9 +10,11 @@
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Core/Config/SYSCONFSettings.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"
@ -179,7 +181,7 @@ void Preset(bool _bNTSC)
m_Clock = DiscIO::IsNTSC(region); m_Clock = DiscIO::IsNTSC(region);
// Say component cable is plugged // Say component cable is plugged
m_DTVStatus.component_plugged = SConfig::GetInstance().bProgressive; m_DTVStatus.component_plugged = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
m_DTVStatus.ntsc_j = SConfig::GetInstance().bForceNTSCJ || region == DiscIO::Region::NTSC_J; m_DTVStatus.ntsc_j = SConfig::GetInstance().bForceNTSCJ || region == DiscIO::Region::NTSC_J;
m_FBWidth.Hex = 0; m_FBWidth.Hex = 0;

View File

@ -12,9 +12,11 @@
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
@ -328,7 +330,7 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index), ir_sin(0), ir_cos(1
m_hotkeys->AddInput(_trans("Upright Hold"), false); m_hotkeys->AddInput(_trans("Upright Hold"), false);
// TODO: This value should probably be re-read if SYSCONF gets changed // TODO: This value should probably be re-read if SYSCONF gets changed
m_sensor_bar_on_top = SConfig::GetInstance().m_sensor_bar_position != 0; m_sensor_bar_on_top = Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION) != 0;
// --- reset eeprom/register/values to default --- // --- reset eeprom/register/values to default ---
Reset(); Reset();

View File

@ -21,6 +21,7 @@
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/File.h" #include "Common/File.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Hash.h" #include "Common/Hash.h"
@ -29,6 +30,8 @@
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/MovieConfigLoader.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"
@ -75,7 +78,6 @@ static u64 s_currentInputCount = 0, s_totalInputCount = 0; // just stats
static u64 s_totalTickCount = 0, s_tickCountAtLastInput = 0; // just stats static u64 s_totalTickCount = 0, s_tickCountAtLastInput = 0; // just stats
static u64 s_recordingStartTime; // seconds since 1970 that recording started static u64 s_recordingStartTime; // seconds since 1970 that recording started
static bool s_bSaveConfig = false, s_bDualCore = false; static bool s_bSaveConfig = false, s_bDualCore = false;
static bool s_bProgressive = false, s_bPAL60 = false;
static bool s_bDSPHLE = false, s_bFastDiscSpeed = false; static bool s_bDSPHLE = false, s_bFastDiscSpeed = false;
static bool s_bSyncGPU = false, s_bNetPlay = false; static bool s_bSyncGPU = false, s_bNetPlay = false;
static std::string s_videoBackend = "unknown"; static std::string s_videoBackend = "unknown";
@ -423,16 +425,6 @@ bool IsDualCore()
return s_bDualCore; return s_bDualCore;
} }
bool IsProgressive()
{
return s_bProgressive;
}
bool IsPAL60()
{
return s_bPAL60;
}
bool IsDSPHLE() bool IsDSPHLE()
{ {
return s_bDSPHLE; return s_bDSPHLE;
@ -900,9 +892,8 @@ void ReadHeader()
if (tmpHeader.bSaveConfig) if (tmpHeader.bSaveConfig)
{ {
s_bSaveConfig = true; s_bSaveConfig = true;
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader));
s_bDualCore = tmpHeader.bDualCore; s_bDualCore = tmpHeader.bDualCore;
s_bProgressive = tmpHeader.bProgressive;
s_bPAL60 = tmpHeader.bPAL60;
s_bDSPHLE = tmpHeader.bDSPHLE; s_bDSPHLE = tmpHeader.bDSPHLE;
s_bFastDiscSpeed = tmpHeader.bFastDiscSpeed; s_bFastDiscSpeed = tmpHeader.bFastDiscSpeed;
s_iCPUCore = tmpHeader.CPUCore; s_iCPUCore = tmpHeader.CPUCore;
@ -1378,10 +1369,12 @@ void SaveRecording(const std::string& filename)
header.recordingStartTime = s_recordingStartTime; header.recordingStartTime = s_recordingStartTime;
header.bSaveConfig = true; header.bSaveConfig = true;
auto* movie_layer = Config::GetLayer(Config::LayerType::Movie);
auto* loader = static_cast<ConfigLoaders::MovieConfigLayerLoader*>(movie_layer->GetLoader());
loader->ChangeDTMHeader(&header);
movie_layer->Save();
header.bSkipIdle = true; header.bSkipIdle = true;
header.bDualCore = s_bDualCore; header.bDualCore = s_bDualCore;
header.bProgressive = s_bProgressive;
header.bPAL60 = s_bPAL60;
header.bDSPHLE = s_bDSPHLE; header.bDSPHLE = s_bDSPHLE;
header.bFastDiscSpeed = s_bFastDiscSpeed; header.bFastDiscSpeed = s_bFastDiscSpeed;
strncpy((char*)header.videoBackend, s_videoBackend.c_str(), ArraySize(header.videoBackend)); strncpy((char*)header.videoBackend, s_videoBackend.c_str(), ArraySize(header.videoBackend));
@ -1465,8 +1458,6 @@ void GetSettings()
{ {
s_bSaveConfig = true; s_bSaveConfig = true;
s_bDualCore = SConfig::GetInstance().bCPUThread; s_bDualCore = SConfig::GetInstance().bCPUThread;
s_bProgressive = SConfig::GetInstance().bProgressive;
s_bPAL60 = SConfig::GetInstance().bPAL60;
s_bDSPHLE = SConfig::GetInstance().bDSPHLE; s_bDSPHLE = SConfig::GetInstance().bDSPHLE;
s_bFastDiscSpeed = SConfig::GetInstance().bFastDiscSpeed; s_bFastDiscSpeed = SConfig::GetInstance().bFastDiscSpeed;
s_videoBackend = g_video_backend->GetName(); s_videoBackend = g_video_backend->GetName();
@ -1478,7 +1469,7 @@ void GetSettings()
u64 title_id = SConfig::GetInstance().GetTitleID(); u64 title_id = SConfig::GetInstance().GetTitleID();
s_bClearSave = s_bClearSave =
!File::Exists(Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT) + "banner.bin"); !File::Exists(Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT) + "banner.bin");
s_language = SConfig::GetInstance().m_wii_language; s_language = Config::Get(Config::SYSCONF_LANGUAGE);
} }
else else
{ {

View File

@ -138,8 +138,6 @@ void SetReset(bool reset);
bool IsConfigSaved(); bool IsConfigSaved();
bool IsDualCore(); bool IsDualCore();
bool IsProgressive();
bool IsPAL60();
bool IsDSPHLE(); bool IsDSPHLE();
bool IsFastDiscSpeed(); bool IsFastDiscSpeed();
int GetCPUMode(); int GetCPUMode();

View File

@ -23,7 +23,9 @@
#include <sstream> #include <sstream>
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/TraversalClient.h" #include "Common/TraversalClient.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/NetPlayServer.h" #include "Core/NetPlayServer.h"
@ -224,8 +226,8 @@ void NetPlayDialog::OnStart()
settings.m_EnableCheats = instance.bEnableCheats; settings.m_EnableCheats = instance.bEnableCheats;
settings.m_SelectedLanguage = instance.SelectedLanguage; settings.m_SelectedLanguage = instance.SelectedLanguage;
settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage; settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage;
settings.m_ProgressiveScan = instance.bProgressive; settings.m_ProgressiveScan = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
settings.m_PAL60 = instance.bPAL60; settings.m_PAL60 = Config::Get(Config::SYSCONF_PAL60);
settings.m_DSPHLE = instance.bDSPHLE; settings.m_DSPHLE = instance.bDSPHLE;
settings.m_DSPEnableJIT = instance.m_DSPEnableJIT; settings.m_DSPEnableJIT = instance.m_DSPEnableJIT;
settings.m_WriteToMemcard = m_save_sd_box->isChecked(); settings.m_WriteToMemcard = m_save_sd_box->isChecked();

View File

@ -11,6 +11,8 @@
#include <wx/slider.h> #include <wx/slider.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include "Common/Config/Config.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/IOS/IOS.h" #include "Core/IOS/IOS.h"
@ -174,10 +176,10 @@ void WiiConfigPane::InitializeGUI()
void WiiConfigPane::LoadGUIValues() void WiiConfigPane::LoadGUIValues()
{ {
m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_wii_screensaver); m_screensaver_checkbox->SetValue(Config::Get(Config::SYSCONF_SCREENSAVER));
m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60); m_pal60_mode_checkbox->SetValue(Config::Get(Config::SYSCONF_PAL60));
m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_wii_aspect_ratio); m_aspect_ratio_choice->SetSelection(Config::Get(Config::SYSCONF_WIDESCREEN));
m_system_language_choice->SetSelection(SConfig::GetInstance().m_wii_language); m_system_language_choice->SetSelection(Config::Get(Config::SYSCONF_LANGUAGE));
m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard); m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard); m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);
@ -185,10 +187,10 @@ void WiiConfigPane::LoadGUIValues()
PopulateUSBPassthroughListbox(); PopulateUSBPassthroughListbox();
m_bt_sensor_bar_pos->SetSelection( m_bt_sensor_bar_pos->SetSelection(
TranslateSensorBarPosition(SConfig::GetInstance().m_sensor_bar_position)); TranslateSensorBarPosition(Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION)));
m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_sensor_bar_sensitivity); m_bt_sensor_bar_sens->SetValue(Config::Get(Config::SYSCONF_SENSOR_BAR_SENSITIVITY));
m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_speaker_volume); m_bt_speaker_volume->SetValue(Config::Get(Config::SYSCONF_SPEAKER_VOLUME));
m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_wiimote_motor); m_bt_wiimote_motor->SetValue(Config::Get(Config::SYSCONF_WIIMOTE_MOTOR));
} }
void WiiConfigPane::PopulateUSBPassthroughListbox() void WiiConfigPane::PopulateUSBPassthroughListbox()
@ -268,12 +270,12 @@ void WiiConfigPane::OnUSBWhitelistRemoveButtonUpdate(wxUpdateUIEvent& event)
void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnScreenSaverCheckBoxChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_wii_screensaver = m_screensaver_checkbox->IsChecked(); Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->IsChecked());
} }
void WiiConfigPane::OnPAL60CheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnPAL60CheckBoxChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked(); Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->IsChecked());
} }
void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event) void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event)
@ -291,30 +293,32 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(wxCommandEvent& event)
void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event) void WiiConfigPane::OnSystemLanguageChoiceChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_wii_language = m_system_language_choice->GetSelection(); Config::SetBase(Config::SYSCONF_LANGUAGE,
static_cast<u32>(m_system_language_choice->GetSelection()));
} }
void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event) void WiiConfigPane::OnAspectRatioChoiceChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_wii_aspect_ratio = m_aspect_ratio_choice->GetSelection(); Config::SetBase(Config::SYSCONF_WIDESCREEN, m_aspect_ratio_choice->GetSelection() == 1);
} }
void WiiConfigPane::OnSensorBarPosChanged(wxCommandEvent& event) void WiiConfigPane::OnSensorBarPosChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_sensor_bar_position = TranslateSensorBarPosition(event.GetInt()); Config::SetBase(Config::SYSCONF_SENSOR_BAR_POSITION,
static_cast<u32>(TranslateSensorBarPosition(event.GetInt())));
} }
void WiiConfigPane::OnSensorBarSensChanged(wxCommandEvent& event) void WiiConfigPane::OnSensorBarSensChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_sensor_bar_sensitivity = event.GetInt(); Config::SetBase(Config::SYSCONF_SENSOR_BAR_SENSITIVITY, static_cast<u32>(event.GetInt()));
} }
void WiiConfigPane::OnSpeakerVolumeChanged(wxCommandEvent& event) void WiiConfigPane::OnSpeakerVolumeChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_speaker_volume = event.GetInt(); Config::SetBase(Config::SYSCONF_SPEAKER_VOLUME, static_cast<u32>(event.GetInt()));
} }
void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event) void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event)
{ {
SConfig::GetInstance().m_wiimote_motor = event.IsChecked(); Config::SetBase(Config::SYSCONF_WIIMOTE_MOTOR, event.IsChecked());
} }

View File

@ -32,11 +32,13 @@
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/FifoQueue.h" #include "Common/FifoQueue.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/EXI/EXI_Device.h" #include "Core/HW/EXI/EXI_Device.h"
#include "Core/NetPlayClient.h" #include "Core/NetPlayClient.h"
@ -316,8 +318,8 @@ void NetPlayDialog::GetNetSettings(NetSettings& settings)
settings.m_EnableCheats = instance.bEnableCheats; settings.m_EnableCheats = instance.bEnableCheats;
settings.m_SelectedLanguage = instance.SelectedLanguage; settings.m_SelectedLanguage = instance.SelectedLanguage;
settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage; settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage;
settings.m_ProgressiveScan = instance.bProgressive; settings.m_ProgressiveScan = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
settings.m_PAL60 = instance.bPAL60; settings.m_PAL60 = Config::Get(Config::SYSCONF_PAL60);
settings.m_DSPHLE = instance.bDSPHLE; settings.m_DSPHLE = instance.bDSPHLE;
settings.m_DSPEnableJIT = instance.m_DSPEnableJIT; settings.m_DSPEnableJIT = instance.m_DSPEnableJIT;
settings.m_WriteToMemcard = m_memcard_write->GetValue(); settings.m_WriteToMemcard = m_memcard_write->GetValue();

View File

@ -25,6 +25,7 @@
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/SysConf.h" #include "Common/SysConf.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "DolphinWX/DolphinSlider.h" #include "DolphinWX/DolphinSlider.h"
@ -917,7 +918,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
progressive_scan_checkbox->Bind(wxEVT_CHECKBOX, &VideoConfigDiag::Event_ProgressiveScan, progressive_scan_checkbox->Bind(wxEVT_CHECKBOX, &VideoConfigDiag::Event_ProgressiveScan,
this); this);
progressive_scan_checkbox->SetValue(SConfig::GetInstance().bProgressive); // TODO: split this into two different settings, one for Wii and one for GC?
progressive_scan_checkbox->SetValue(Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN));
szr_misc->Add(progressive_scan_checkbox); szr_misc->Add(progressive_scan_checkbox);
} }
@ -1027,7 +1029,7 @@ void VideoConfigDiag::Event_DisplayResolution(wxCommandEvent& ev)
void VideoConfigDiag::Event_ProgressiveScan(wxCommandEvent& ev) void VideoConfigDiag::Event_ProgressiveScan(wxCommandEvent& ev)
{ {
SConfig::GetInstance().bProgressive = ev.IsChecked(); Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, ev.IsChecked());
ev.Skip(); ev.Skip();
} }

View File

@ -23,6 +23,7 @@
#include "Common/Assert.h" #include "Common/Assert.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Flag.h" #include "Common/Flag.h"
@ -33,6 +34,7 @@
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Common/Timer.h" #include "Common/Timer.h"
#include "Core/Config/SYSCONFSettings.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"
@ -93,9 +95,7 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height)
OSDTime = 0; OSDTime = 0;
if (SConfig::GetInstance().bWii) if (SConfig::GetInstance().bWii)
{ m_aspect_wide = Config::Get(Config::SYSCONF_WIDESCREEN);
m_aspect_wide = SConfig::GetInstance().m_wii_aspect_ratio != 0;
}
m_last_host_config_bits = ShaderHostConfig::GetCurrent().bits; m_last_host_config_bits = ShaderHostConfig::GetCurrent().bits;
} }