Config: Integrate

This commit is contained in:
MerryMage 2017-05-13 22:29:55 +01:00
parent 1548a15c68
commit 41afe78a44
5 changed files with 33 additions and 0 deletions

View File

@ -24,12 +24,16 @@
#include <vector> #include <vector>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.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/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Config/Config.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/ConfigLoaders/NetPlayConfigLoader.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/EXI/EXI.h" #include "Core/HW/EXI/EXI.h"
@ -238,6 +242,12 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
// Load game specific settings // Load game specific settings
if (type == SConfig::BOOT_DEFAULT) if (type == SConfig::BOOT_DEFAULT)
{ {
std::string game_id = SConfig::GetInstance().GetGameID();
u16 revision = SConfig::GetInstance().GetRevision();
Config::AddLoadLayer(ConfigLoaders::GenerateGlobalGameConfigLoader(game_id, revision));
Config::AddLoadLayer(ConfigLoaders::GenerateLocalGameConfigLoader(game_id, revision));
IniFile game_ini = StartUp.LoadGameIni(); IniFile game_ini = StartUp.LoadGameIni();
// General settings // General settings
@ -322,6 +332,7 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
// 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.bProgressive = Movie::IsProgressive();
@ -347,6 +358,7 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
if (NetPlay::IsNetPlayRunning()) if (NetPlay::IsNetPlayRunning())
{ {
Config::AddLoadLayer(ConfigLoaders::GenerateNetPlayConfigLoader(g_NetPlaySettings));
StartUp.bCPUThread = g_NetPlaySettings.m_CPUthread; StartUp.bCPUThread = g_NetPlaySettings.m_CPUthread;
StartUp.bEnableCheats = g_NetPlaySettings.m_EnableCheats; StartUp.bEnableCheats = g_NetPlaySettings.m_EnableCheats;
StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE; StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE;
@ -409,6 +421,10 @@ void Stop()
void RestoreConfig() void RestoreConfig()
{ {
Config::RemoveLayer(Config::LayerType::Movie);
Config::RemoveLayer(Config::LayerType::Netplay);
Config::RemoveLayer(Config::LayerType::GlobalGame);
Config::RemoveLayer(Config::LayerType::LocalGame);
SConfig::GetInstance().LoadSettingsFromSysconf(); SConfig::GetInstance().LoadSettingsFromSysconf();
SConfig::GetInstance().ResetRunningGameMetadata(); SConfig::GetInstance().ResetRunningGameMetadata();
config_cache.RestoreConfig(&SConfig::GetInstance()); config_cache.RestoreConfig(&SConfig::GetInstance());

View File

@ -11,6 +11,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/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
@ -21,6 +22,7 @@
#include "Core/Analytics.h" #include "Core/Analytics.h"
#include "Core/Boot/Boot.h" #include "Core/Boot/Boot.h"
#include "Core/Boot/Boot_DOL.h" #include "Core/Boot/Boot_DOL.h"
#include "Core/Config/Config.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/FifoPlayer/FifoDataFile.h" #include "Core/FifoPlayer/FifoDataFile.h"
@ -87,6 +89,8 @@ void SConfig::SaveSettings()
SaveUSBPassthroughSettings(ini); SaveUSBPassthroughSettings(ini);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
Config::Save();
} }
namespace namespace
@ -395,6 +399,8 @@ void SConfig::SaveSettingsToSysconf()
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
Config::Load();
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str()); INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
IniFile ini; IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));

View File

@ -7,10 +7,12 @@
#endif #endif
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/Logging/LogManager.h" #include "Common/Logging/LogManager.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Core/ConfigLoaders/BaseConfigLoader.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
@ -26,6 +28,8 @@ namespace UICommon
void Init() void Init()
{ {
LogManager::Init(); LogManager::Init();
Config::Init();
Config::AddLoadLayer(ConfigLoaders::GenerateBaseConfigLoader());
SConfig::Init(); SConfig::Init();
VideoBackendBase::PopulateList(); VideoBackendBase::PopulateList();
WiimoteReal::LoadSettings(); WiimoteReal::LoadSettings();
@ -41,6 +45,7 @@ void Shutdown()
WiimoteReal::Shutdown(); WiimoteReal::Shutdown();
VideoBackendBase::ClearList(); VideoBackendBase::ClearList();
SConfig::Shutdown(); SConfig::Shutdown();
Config::Shutdown();
LogManager::Shutdown(); LogManager::Shutdown();
} }

View File

@ -7,6 +7,7 @@
#include <array> #include <array>
#include <bitset> #include <bitset>
#include "Core/Config/Config.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"
@ -36,6 +37,7 @@ public:
ScopeInit() ScopeInit()
{ {
Core::DeclareAsCPUThread(); Core::DeclareAsCPUThread();
Config::Init();
SConfig::Init(); SConfig::Init();
PowerPC::Init(PowerPC::CORE_INTERPRETER); PowerPC::Init(PowerPC::CORE_INTERPRETER);
CoreTiming::Init(); CoreTiming::Init();
@ -45,6 +47,7 @@ public:
CoreTiming::Shutdown(); CoreTiming::Shutdown();
PowerPC::Shutdown(); PowerPC::Shutdown();
SConfig::Shutdown(); SConfig::Shutdown();
Config::Shutdown();
Core::UndeclareAsCPUThread(); Core::UndeclareAsCPUThread();
} }
}; };

View File

@ -6,6 +6,7 @@
#include <unordered_set> #include <unordered_set>
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/Config/Config.h"
#include "Core/HW/MMIO.h" #include "Core/HW/MMIO.h"
// Tests that the UniqueID function returns a "unique enough" identifier // Tests that the UniqueID function returns a "unique enough" identifier
@ -29,6 +30,7 @@ TEST(UniqueID, UniqueEnough)
TEST(IsMMIOAddress, SpecialAddresses) TEST(IsMMIOAddress, SpecialAddresses)
{ {
Config::Init();
SConfig::Init(); SConfig::Init();
SConfig::GetInstance().bWii = true; SConfig::GetInstance().bWii = true;
@ -51,6 +53,7 @@ TEST(IsMMIOAddress, SpecialAddresses)
EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10)); // Mirror of Wii MMIOs EXPECT_TRUE(MMIO::IsMMIOAddress(0x0D800F10)); // Mirror of Wii MMIOs
SConfig::Shutdown(); SConfig::Shutdown();
Config::Shutdown();
} }
class MappingTest : public testing::Test class MappingTest : public testing::Test