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 "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/Logging/Log.h"
#include "Common/MsgHandler.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/Core.h"
#include "Core/HW/EXI/EXI.h"
@ -238,6 +242,12 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
// Load game specific settings
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();
// General settings
@ -322,6 +332,7 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
// Movie settings
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{
Config::AddLayer(std::make_unique<Config::Layer>(Config::LayerType::Movie));
StartUp.bCPUThread = Movie::IsDualCore();
StartUp.bDSPHLE = Movie::IsDSPHLE();
StartUp.bProgressive = Movie::IsProgressive();
@ -347,6 +358,7 @@ bool BootCore(const std::string& filename, SConfig::EBootBS2 type)
if (NetPlay::IsNetPlayRunning())
{
Config::AddLoadLayer(ConfigLoaders::GenerateNetPlayConfigLoader(g_NetPlaySettings));
StartUp.bCPUThread = g_NetPlaySettings.m_CPUthread;
StartUp.bEnableCheats = g_NetPlaySettings.m_EnableCheats;
StartUp.bDSPHLE = g_NetPlaySettings.m_DSPHLE;
@ -409,6 +421,10 @@ void Stop()
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().ResetRunningGameMetadata();
config_cache.RestoreConfig(&SConfig::GetInstance());

View File

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

View File

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

View File

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

View File

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