@@ -0,0 +1,108 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#include "Core/Config/MainSettings.h"

#include "AudioCommon/AudioCommon.h"
#include "Common/Config/Config.h"
#include "Common/StringUtil.h"
#include "Core/HW/EXI/EXI_Device.h"
#include "Core/HW/SI/SI_Device.h"
#include "Core/PowerPC/PowerPC.h"

namespace Config
{
// Main.Core

const ConfigInfo<bool> MAIN_SKIP_IPL{{System::Main, "Core", "SkipIPL"}, true};
const ConfigInfo<int> MAIN_CPU_CORE{{System::Main, "Core", "CPUCore"}, PowerPC::DefaultCPUCore()};
const ConfigInfo<bool> MAIN_FASTMEM{{System::Main, "Core", "Fastmem"}, true};
const ConfigInfo<bool> MAIN_DSP_HLE{{System::Main, "Core", "DSPHLE"}, true};
const ConfigInfo<int> MAIN_TIMING_VARIANCE{{System::Main, "Core", "TimingVariance"}, 40};
const ConfigInfo<bool> MAIN_CPU_THREAD{{System::Main, "Core", "CPUThread"}, true};
const ConfigInfo<bool> MAIN_SYNC_ON_SKIP_IDLE{{System::Main, "Core", "SyncOnSkipIdle"}, true};
const ConfigInfo<std::string> MAIN_DEFAULT_ISO{{System::Main, "Core", "DefaultISO"}, ""};
const ConfigInfo<bool> MAIN_ENABLE_CHEATS{{System::Main, "Core", "EnableCheats"}, false};
const ConfigInfo<int> MAIN_GC_LANGUAGE{{System::Main, "Core", "SelectedLanguage"}, 0};
const ConfigInfo<bool> MAIN_OVERRIDE_GC_LANGUAGE{{System::Main, "Core", "OverrideGCLang"}, false};
const ConfigInfo<bool> MAIN_DPL2_DECODER{{System::Main, "Core", "DPL2Decoder"}, false};
const ConfigInfo<int> MAIN_AUDIO_LATENCY{{System::Main, "Core", "AudioLatency"}, 20};
const ConfigInfo<bool> MAIN_AUDIO_STRETCH{{System::Main, "Core", "AudioStretch"}, false};
const ConfigInfo<int> MAIN_AUDIO_STRETCH_LATENCY{{System::Main, "Core", "AudioStretchMaxLatency"},
80};
const ConfigInfo<std::string> MAIN_MEMCARD_A_PATH{{System::Main, "Core", "MemcardAPath"}, ""};
const ConfigInfo<std::string> MAIN_MEMCARD_B_PATH{{System::Main, "Core", "MemcardBPath"}, ""};
const ConfigInfo<std::string> MAIN_AGP_CART_A_PATH{{System::Main, "Core", "AgpCartAPath"}, ""};
const ConfigInfo<std::string> MAIN_AGP_CART_B_PATH{{System::Main, "Core", "AgpCartBPath"}, ""};
const ConfigInfo<int> MAIN_SLOT_A{{System::Main, "Core", "SlotA"},
ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER};
const ConfigInfo<int> MAIN_SLOT_B{{System::Main, "Core", "SlotB"},
ExpansionInterface::EXIDEVICE_NONE};
const ConfigInfo<int> MAIN_SERIAL_PORT_1{{System::Main, "Core", "SerialPort1"},
ExpansionInterface::EXIDEVICE_NONE};
const ConfigInfo<std::string> MAIN_BBA_MAC{{System::Main, "Core", "BBA_MAC"}, ""};

ConfigInfo<u32> GetInfoForSIDevice(u32 channel)
{
return {{System::Main, "Core", StringFromFormat("SIDevice%u", channel)},
static_cast<u32>(channel == 0 ? SerialInterface::SIDEVICE_GC_CONTROLLER :
SerialInterface::SIDEVICE_NONE)};
}

ConfigInfo<bool> GetInfoForAdapterRumble(u32 channel)
{
return {{System::Main, "Core", StringFromFormat("AdapterRumble%u", channel)}, true};
}

ConfigInfo<bool> GetInfoForSimulateKonga(u32 channel)
{
return {{System::Main, "Core", StringFromFormat("SimulateKonga%u", channel)}, false};
}

const ConfigInfo<bool> MAIN_WII_SD_CARD{{System::Main, "Core", "WiiSDCard"}, false};
const ConfigInfo<bool> MAIN_WII_KEYBOARD{{System::Main, "Core", "WiiKeyboard"}, false};
const ConfigInfo<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING{
{System::Main, "Core", "WiimoteContinuousScanning"}, false};
const ConfigInfo<bool> MAIN_WIIMOTE_ENABLE_SPEAKER{{System::Main, "Core", "WiimoteEnableSpeaker"},
false};
const ConfigInfo<bool> MAIN_RUN_COMPARE_SERVER{{System::Main, "Core", "RunCompareServer"}, false};
const ConfigInfo<bool> MAIN_RUN_COMPARE_CLIENT{{System::Main, "Core", "RunCompareClient"}, false};
const ConfigInfo<bool> MAIN_MMU{{System::Main, "Core", "MMU"}, false};
const ConfigInfo<int> MAIN_BB_DUMP_PORT{{System::Main, "Core", "BBDumpPort"}, -1};
const ConfigInfo<bool> MAIN_SYNC_GPU{{System::Main, "Core", "SyncGPU"}, false};
const ConfigInfo<int> MAIN_SYNC_GPU_MAX_DISTANCE{{System::Main, "Core", "SyncGpuMaxDistance"},
200000};
const ConfigInfo<int> MAIN_SYNC_GPU_MIN_DISTANCE{{System::Main, "Core", "SyncGpuMinDistance"},
-200000};
const ConfigInfo<float> MAIN_SYNC_GPU_OVERCLOCK{{System::Main, "Core", "SyncGpuOverclock"}, 1.0f};
const ConfigInfo<bool> MAIN_FAST_DISC_SPEED{{System::Main, "Core", "FastDiscSpeed"}, false};
const ConfigInfo<bool> MAIN_DCBZ{{System::Main, "Core", "DCBZ"}, false};
const ConfigInfo<bool> MAIN_LOW_DCBZ_HACK{{System::Main, "Core", "LowDCBZHack"}, false};
const ConfigInfo<bool> MAIN_FPRF{{System::Main, "Core", "FPRF"}, false};
const ConfigInfo<bool> MAIN_ACCURATE_NANS{{System::Main, "Core", "AccurateNaNs"}, false};
const ConfigInfo<float> MAIN_EMULATION_SPEED{{System::Main, "Core", "EmulationSpeed"}, 1.0f};
const ConfigInfo<float> MAIN_OVERCLOCK{{System::Main, "Core", "Overclock"}, 1.0f};
const ConfigInfo<bool> MAIN_OVERCLOCK_ENABLE{{System::Main, "Core", "OverclockEnable"}, false};
const ConfigInfo<std::string> MAIN_GFX_BACKEND{{System::Main, "Core", "GFXBackend"}, ""};
const ConfigInfo<std::string> MAIN_GPU_DETERMINISM_MODE{
{System::Main, "Core", "GPUDeterminismMode"}, "auto"};
const ConfigInfo<std::string> MAIN_PERF_MAP_DIR{{System::Main, "Core", "PerfMapDir"}, ""};
const ConfigInfo<bool> MAIN_CUSTOM_RTC_ENABLE{{System::Main, "Core", "EnableCustomRTC"}, false};
// Default to seconds between 1.1.1970 and 1.1.2000
const ConfigInfo<u32> MAIN_CUSTOM_RTC_VALUE{{System::Main, "Core", "CustomRTCValue"}, 946684800};
const ConfigInfo<bool> MAIN_ENABLE_SIGNATURE_CHECKS{{System::Main, "Core", "EnableSignatureChecks"},
true};

// Main.DSP

const ConfigInfo<bool> MAIN_DSP_CAPTURE_LOG{{System::Main, "DSP", "CaptureLog"}, false};
const ConfigInfo<bool> MAIN_DSP_JIT{{System::Main, "DSP", "EnableJIT"}, true};
const ConfigInfo<bool> MAIN_DUMP_AUDIO{{System::Main, "DSP", "DumpAudio"}, false};
const ConfigInfo<bool> MAIN_DUMP_AUDIO_SILENT{{System::Main, "DSP", "DumpAudioSilent"}, false};
const ConfigInfo<bool> MAIN_DUMP_UCODE{{System::Main, "DSP", "DumpUCode"}, false};
const ConfigInfo<std::string> MAIN_AUDIO_BACKEND{{System::Main, "DSP", "Backend"},
AudioCommon::GetDefaultSoundBackend()};
const ConfigInfo<int> MAIN_AUDIO_VOLUME{{System::Main, "DSP", "Volume"}, 100};

} // namespace Config
@@ -0,0 +1,80 @@
// Copyright 2017 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.

#pragma once

#include <string>

#include "Common/Config/Config.h"

namespace Config
{
// Main.Core

extern const ConfigInfo<bool> MAIN_SKIP_IPL;
extern const ConfigInfo<int> MAIN_CPU_CORE;
extern const ConfigInfo<bool> MAIN_FASTMEM;
// Should really be in the DSP section, but we're kind of stuck with bad decisions made in the past.
extern const ConfigInfo<bool> MAIN_DSP_HLE;
extern const ConfigInfo<int> MAIN_TIMING_VARIANCE;
extern const ConfigInfo<bool> MAIN_CPU_THREAD;
extern const ConfigInfo<bool> MAIN_SYNC_ON_SKIP_IDLE;
extern const ConfigInfo<std::string> MAIN_DEFAULT_ISO;
extern const ConfigInfo<bool> MAIN_ENABLE_CHEATS;
extern const ConfigInfo<int> MAIN_GC_LANGUAGE;
extern const ConfigInfo<bool> MAIN_OVERRIDE_GC_LANGUAGE;
extern const ConfigInfo<bool> MAIN_DPL2_DECODER;
extern const ConfigInfo<int> MAIN_AUDIO_LATENCY;
extern const ConfigInfo<bool> MAIN_AUDIO_STRETCH;
extern const ConfigInfo<int> MAIN_AUDIO_STRETCH_LATENCY;
extern const ConfigInfo<std::string> MAIN_MEMCARD_A_PATH;
extern const ConfigInfo<std::string> MAIN_MEMCARD_B_PATH;
extern const ConfigInfo<std::string> MAIN_AGP_CART_A_PATH;
extern const ConfigInfo<std::string> MAIN_AGP_CART_B_PATH;
extern const ConfigInfo<int> MAIN_SLOT_A;
extern const ConfigInfo<int> MAIN_SLOT_B;
extern const ConfigInfo<int> MAIN_SERIAL_PORT_1;
extern const ConfigInfo<std::string> MAIN_BBA_MAC;
ConfigInfo<u32> GetInfoForSIDevice(u32 channel);
ConfigInfo<bool> GetInfoForAdapterRumble(u32 channel);
ConfigInfo<bool> GetInfoForSimulateKonga(u32 channel);
extern const ConfigInfo<bool> MAIN_WII_SD_CARD;
extern const ConfigInfo<bool> MAIN_WII_KEYBOARD;
extern const ConfigInfo<bool> MAIN_WIIMOTE_CONTINUOUS_SCANNING;
extern const ConfigInfo<bool> MAIN_WIIMOTE_ENABLE_SPEAKER;
extern const ConfigInfo<bool> MAIN_RUN_COMPARE_SERVER;
extern const ConfigInfo<bool> MAIN_RUN_COMPARE_CLIENT;
extern const ConfigInfo<bool> MAIN_MMU;
extern const ConfigInfo<int> MAIN_BB_DUMP_PORT;
extern const ConfigInfo<bool> MAIN_SYNC_GPU;
extern const ConfigInfo<int> MAIN_SYNC_GPU_MAX_DISTANCE;
extern const ConfigInfo<int> MAIN_SYNC_GPU_MIN_DISTANCE;
extern const ConfigInfo<float> MAIN_SYNC_GPU_OVERCLOCK;
extern const ConfigInfo<bool> MAIN_FAST_DISC_SPEED;
extern const ConfigInfo<bool> MAIN_DCBZ;
extern const ConfigInfo<bool> MAIN_LOW_DCBZ_HACK;
extern const ConfigInfo<bool> MAIN_FPRF;
extern const ConfigInfo<bool> MAIN_ACCURATE_NANS;
extern const ConfigInfo<float> MAIN_EMULATION_SPEED;
extern const ConfigInfo<float> MAIN_OVERCLOCK;
extern const ConfigInfo<bool> MAIN_OVERCLOCK_ENABLE;
// Should really be part of System::GFX, but again, we're stuck with past mistakes.
extern const ConfigInfo<std::string> MAIN_GFX_BACKEND;
extern const ConfigInfo<std::string> MAIN_GPU_DETERMINISM_MODE;
extern const ConfigInfo<std::string> MAIN_PERF_MAP_DIR;
extern const ConfigInfo<bool> MAIN_CUSTOM_RTC_ENABLE;
extern const ConfigInfo<u32> MAIN_CUSTOM_RTC_VALUE;
extern const ConfigInfo<bool> MAIN_ENABLE_SIGNATURE_CHECKS;

// Main.DSP

extern const ConfigInfo<bool> MAIN_DSP_CAPTURE_LOG;
extern const ConfigInfo<bool> MAIN_DSP_JIT;
extern const ConfigInfo<bool> MAIN_DUMP_AUDIO;
extern const ConfigInfo<bool> MAIN_DUMP_AUDIO_SILENT;
extern const ConfigInfo<bool> MAIN_DUMP_UCODE;
extern const ConfigInfo<std::string> MAIN_AUDIO_BACKEND;
extern const ConfigInfo<int> MAIN_AUDIO_VOLUME;

} // namespace Config
@@ -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
@@ -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
@@ -9,19 +9,59 @@
#include <map>
#include <memory>
#include <string>
#include <type_traits>
#include <variant>

#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/FileUtil.h"
#include "Common/IniFile.h"
#include "Common/Logging/Log.h"
#include "Common/SysConf.h"

#include "Common/Config/Config.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h"
#include "Core/Core.h"
#include "Core/IOS/USB/Bluetooth/BTBase.h"

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 = {
{Config::System::Main, F_DOLPHINCONFIG_IDX},
{Config::System::GCPad, F_GCPADCONFIG_IDX},
@@ -34,12 +74,13 @@ const std::map<Config::System, int> system_to_ini = {
};

// INI layer configuration loader
class INIBaseConfigLayerLoader final : public Config::ConfigLayerLoader
class BaseConfigLayerLoader final : public Config::ConfigLayerLoader
{
public:
INIBaseConfigLayerLoader() : ConfigLayerLoader(Config::LayerType::Base) {}
BaseConfigLayerLoader() : ConfigLayerLoader(Config::LayerType::Base) {}
void Load(Config::Layer* config_layer) override
{
LoadFromSYSCONF(config_layer);
for (const auto& system : system_to_ini)
{
IniFile ini;
@@ -76,6 +117,12 @@ class INIBaseConfigLayerLoader final : public Config::ConfigLayerLoader
const Config::LayerMap& sections = config_layer->GetLayerMap();
for (const auto& system : sections)
{
if (system.first == Config::System::SYSCONF)
{
SaveToSYSCONF(config_layer);
continue;
}

auto mapping = system_to_ini.find(system.first);
if (mapping == system_to_ini.end())
{
@@ -116,11 +163,35 @@ class INIBaseConfigLayerLoader final : public Config::ConfigLayerLoader
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
std::unique_ptr<Config::ConfigLayerLoader> GenerateBaseConfigLoader()
{
return std::make_unique<INIBaseConfigLayerLoader>();
return std::make_unique<BaseConfigLayerLoader>();
}
}
@@ -9,9 +9,11 @@
namespace Config
{
class ConfigLayerLoader;
class Layer;
}

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

#include "Common/Config/Config.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h"

namespace ConfigLoaders
@@ -118,6 +119,11 @@ static const INIToLocationMap& GetINIToLocationMap()
{{"Video", "PH_ZNear"}, {Config::GFX_PROJECTION_HACK_ZNEAR.location}},
{{"Video", "PH_ZFar"}, {Config::GFX_PROJECTION_HACK_ZFAR.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;
}
@@ -13,69 +13,79 @@
#include "Common/Config/Config.h"
#include "Common/FileUtil.h"

#include "Core/Config/GraphicsSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Movie.h"
#include "VideoCommon/VideoConfig.h"

namespace ConfigLoaders
{
// TODO: Future project, let this support all the configuration options.
// This will require a large break to the DTM format
void MovieConfigLayerLoader::Load(Config::Layer* config_layer)
static void LoadFromDTM(Config::Layer* config_layer, Movie::DTMHeader* dtm)
{
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_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks");
config_layer->Set(Config::MAIN_CPU_THREAD, dtm->bDualCore);
config_layer->Set(Config::MAIN_DSP_HLE, dtm->bDSPHLE);
config_layer->Set(Config::MAIN_FAST_DISC_SPEED, dtm->bFastDiscSpeed);
config_layer->Set(Config::MAIN_CPU_CORE, static_cast<int>(dtm->CPUCore));
config_layer->Set(Config::MAIN_SYNC_GPU, dtm->bSyncGPU);
config_layer->Set(Config::MAIN_GFX_BACKEND,
std::string(reinterpret_cast<char*>(dtm->videoBackend)));

core->Set("SkipIdle", m_header->bSkipIdle);
core->Set("CPUThread", m_header->bDualCore);
core->Set("DSPHLE", m_header->bDSPHLE);
core->Set("FastDiscSpeed", m_header->bFastDiscSpeed);
core->Set("CPUCore", m_header->CPUCore);
core->Set("SyncGPU", m_header->bSyncGPU);
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, dtm->bProgressive);
config_layer->Set(Config::SYSCONF_PAL60, dtm->bPAL60);
if (dtm->bWii)
config_layer->Set(Config::SYSCONF_LANGUAGE, static_cast<u32>(dtm->language));
else
config_layer->Set(Config::MAIN_GC_LANGUAGE, static_cast<int>(dtm->language));

video_settings->Set("UseXFB", m_header->bUseXFB);
video_settings->Set("UseRealXFB", m_header->bUseRealXFB);
video_hacks->Set("EFBAccessEnable", m_header->bEFBAccessEnable);
video_hacks->Set("EFBToTextureEnable", m_header->bSkipEFBCopyToRam);
video_hacks->Set("EFBEmulateFormatChanges", m_header->bEFBEmulateFormatChanges);
config_layer->Set(Config::GFX_USE_XFB, dtm->bUseXFB);
config_layer->Set(Config::GFX_USE_REAL_XFB, dtm->bUseRealXFB);
config_layer->Set(Config::GFX_HACK_EFB_ACCESS_ENABLE, dtm->bEFBAccessEnable);
config_layer->Set(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM, dtm->bSkipEFBCopyToRam);
config_layer->Set(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES, dtm->bEFBEmulateFormatChanges);
}

void MovieConfigLayerLoader::Save(Config::Layer* config_layer)
void SaveToDTM(Config::Layer* config_layer, Movie::DTMHeader* dtm)
{
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_hacks = Config::GetOrCreateSection(Config::System::GFX, "Hacks");
dtm->bDualCore = config_layer->Get(Config::MAIN_CPU_THREAD);
dtm->bDSPHLE = config_layer->Get(Config::MAIN_DSP_HLE);
dtm->bFastDiscSpeed = config_layer->Get(Config::MAIN_FAST_DISC_SPEED);
dtm->CPUCore = config_layer->Get(Config::MAIN_CPU_CORE);
dtm->bSyncGPU = config_layer->Get(Config::MAIN_SYNC_GPU);
const std::string video_backend = config_layer->Get(Config::MAIN_GFX_BACKEND);

std::string video_backend;
u32 cpu_core;
dtm->bProgressive = config_layer->Get(Config::SYSCONF_PROGRESSIVE_SCAN);
dtm->bPAL60 = config_layer->Get(Config::SYSCONF_PAL60);
if (dtm->bWii)
dtm->language = config_layer->Get(Config::SYSCONF_LANGUAGE);
else
dtm->language = config_layer->Get(Config::MAIN_GC_LANGUAGE);

core->Get("SkipIdle", &m_header->bSkipIdle);
core->Get("CPUThread", &m_header->bDualCore);
core->Get("DSPHLE", &m_header->bDSPHLE);
core->Get("FastDiscSpeed", &m_header->bFastDiscSpeed);
core->Get("CPUCore", &cpu_core);
core->Get("SyncGPU", &m_header->bSyncGPU);
core->Get("GFXBackend", &video_backend);
display->Get("ProgressiveScan", &m_header->bProgressive);
display->Get("PAL60", &m_header->bPAL60);

video_settings->Get("UseXFB", &m_header->bUseXFB);
video_settings->Get("UseRealXFB", &m_header->bUseRealXFB);
video_hacks->Get("EFBAccessEnable", &m_header->bEFBAccessEnable);
video_hacks->Get("EFBToTextureEnable", &m_header->bSkipEFBCopyToRam);
video_hacks->Get("EFBEmulateFormatChanges", &m_header->bEFBEmulateFormatChanges);
dtm->bUseXFB = config_layer->Get(Config::GFX_USE_XFB);
dtm->bUseRealXFB = config_layer->Get(Config::GFX_USE_REAL_XFB);
dtm->bEFBAccessEnable = config_layer->Get(Config::GFX_HACK_EFB_ACCESS_ENABLE);
dtm->bSkipEFBCopyToRam = config_layer->Get(Config::GFX_HACK_SKIP_EFB_COPY_TO_RAM);
dtm->bEFBEmulateFormatChanges = config_layer->Get(Config::GFX_HACK_EFB_EMULATE_FORMAT_CHANGES);

// This never used the regular config
m_header->bEFBCopyEnable = true;
m_header->bEFBCopyCacheEnable = false;
dtm->bSkipIdle = true;
dtm->bEFBCopyEnable = true;
dtm->bEFBCopyCacheEnable = false;

strncpy(reinterpret_cast<char*>(dtm->videoBackend), video_backend.c_str(),
ArraySize(dtm->videoBackend));
}

m_header->CPUCore = cpu_core;
strncpy(reinterpret_cast<char*>(m_header->videoBackend), video_backend.c_str(),
ArraySize(m_header->videoBackend));
// TODO: Future project, let this support all the configuration options.
// This will require a large break to the DTM format
void MovieConfigLayerLoader::Load(Config::Layer* config_layer)
{
LoadFromDTM(config_layer, m_header);
}

void MovieConfigLayerLoader::Save(Config::Layer* config_layer)
{
}

// Loader generation
@@ -26,10 +26,10 @@ class MovieConfigLayerLoader final : public Config::ConfigLayerLoader
void Load(Config::Layer* config_layer) override;
void Save(Config::Layer* config_layer) override;

void ChangeDTMHeader(Movie::DTMHeader* header) { m_header = header; }
private:
Movie::DTMHeader* m_header;
};

void SaveToDTM(Config::Layer* layer, Movie::DTMHeader* header);
std::unique_ptr<Config::ConfigLayerLoader> GenerateMovieConfigLoader(Movie::DTMHeader* header);
}
@@ -7,6 +7,7 @@
#include <memory>

#include "Common/Config/Config.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/NetPlayProto.h"

namespace ConfigLoaders
@@ -23,7 +24,6 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader
{
Config::Section* core = config_layer->GetOrCreateSection(Config::System::Main, "Core");
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("CPUCore", m_settings.m_CPUcore);
@@ -38,8 +38,8 @@ class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader

dsp->Set("EnableJIT", m_settings.m_DSPEnableJIT);

display->Set("ProgressiveScan", m_settings.m_ProgressiveScan);
display->Set("PAL60", m_settings.m_PAL60);
config_layer->Set(Config::SYSCONF_PROGRESSIVE_SCAN, m_settings.m_ProgressiveScan);
config_layer->Set(Config::SYSCONF_PAL60, m_settings.m_PAL60);
}

void Save(Config::Layer* config_layer) override
@@ -23,18 +23,17 @@
#include "Common/MsgHandler.h"
#include "Common/NandPaths.h"
#include "Common/StringUtil.h"
#include "Common/SysConf.h"

#include "Core/Analytics.h"
#include "Core/Boot/Boot.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/GameConfigLoader.h"
#include "Core/Core.h"
#include "Core/FifoPlayer/FifoDataFile.h"
#include "Core/HLE/HLE.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/SI/SI.h"
#include "Core/IOS/ES/Formats.h"
#include "Core/IOS/USB/Bluetooth/BTBase.h"
#include "Core/PatchEngine.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
@@ -52,7 +51,6 @@ SConfig::SConfig()
LoadDefaults();
// Make sure we have log manager
LoadSettings();
LoadSettingsFromSysconf();
}

void SConfig::Init()
@@ -69,7 +67,6 @@ void SConfig::Shutdown()
SConfig::~SConfig()
{
SaveSettings();
SaveSettingsToSysconf();
}

void SConfig::SaveSettings()
@@ -190,8 +187,6 @@ void SConfig::SaveDisplaySettings(IniFile& ini)
display->Set("RenderWindowHeight", iRenderWindowHeight);
display->Set("RenderWindowAutoSize", bRenderWindowAutoSize);
display->Set("KeepWindowOnTop", bKeepWindowOnTop);
display->Set("ProgressiveScan", bProgressive);
display->Set("PAL60", bPAL60);
display->Set("DisableScreenSaver", bDisableScreenSaver);
display->Set("ForceNTSCJ", bForceNTSCJ);
}
@@ -374,36 +369,6 @@ void SConfig::SaveUSBPassthroughSettings(IniFile& ini)
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()
{
Config::Load();
@@ -502,8 +467,6 @@ void SConfig::LoadDisplaySettings(IniFile& ini)
display->Get("RenderWindowHeight", &iRenderWindowHeight, 480);
display->Get("RenderWindowAutoSize", &bRenderWindowAutoSize, false);
display->Get("KeepWindowOnTop", &bKeepWindowOnTop, false);
display->Get("ProgressiveScan", &bProgressive, false);
display->Get("PAL60", &bPAL60, true);
display->Get("DisableScreenSaver", &bDisableScreenSaver, true);
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()
{
SetRunningGameMetadata("00000000", 0, 0, Core::TitleDatabase::TitleType::Other);
@@ -1060,7 +1008,7 @@ DiscIO::Language SConfig::GetCurrentLanguage(bool wii) const
{
int language_value;
if (wii)
language_value = SConfig::GetInstance().m_wii_language;
language_value = Config::Get(Config::SYSCONF_LANGUAGE);
else
language_value = SConfig::GetInstance().SelectedLanguage + 1;
DiscIO::Language language = static_cast<DiscIO::Language>(language_value);
@@ -147,7 +147,6 @@ struct SConfig : NonCopyable
int iRenderWindowHeight = -1;
bool bRenderWindowAutoSize = false, bKeepWindowOnTop = false;
bool bFullscreen = false, bRenderToMain = false;
bool bProgressive = false, bPAL60 = false;
bool bDisableScreenSaver = false;

int iPosX, iPosY, iWidth, iHeight;
@@ -169,15 +168,6 @@ struct SConfig : NonCopyable

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
bool bLoopFifoReplay = true;

@@ -334,9 +324,6 @@ struct SConfig : NonCopyable
// Load settings
void LoadSettings();

void LoadSettingsFromSysconf();
void SaveSettingsToSysconf();

// Return the permanent and somewhat globally used instance of this struct
static SConfig& GetInstance() { return (*m_Instance); }
static void Init();
@@ -46,7 +46,9 @@
<ClCompile Include="Boot\DolReader.cpp" />
<ClCompile Include="Boot\ElfReader.cpp" />
<ClCompile Include="Config\GraphicsSettings.cpp" />
<ClCompile Include="Config\MainSettings.cpp" />
<ClCompile Include="Config\NetplaySettings.cpp" />
<ClCompile Include="Config\SYSCONFSettings.cpp" />
<ClCompile Include="ConfigLoaders\BaseConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\GameConfigLoader.cpp" />
<ClCompile Include="ConfigLoaders\IsSettingSaveable.cpp" />
@@ -302,7 +304,9 @@
<ClInclude Include="Boot\ElfReader.h" />
<ClInclude Include="Boot\ElfTypes.h" />
<ClInclude Include="Config\GraphicsSettings.h" />
<ClInclude Include="Config\MainSettings.h" />
<ClInclude Include="Config\NetplaySettings.h" />
<ClInclude Include="Config\SYSCONFSettings.h" />
<ClInclude Include="ConfigLoaders\BaseConfigLoader.h" />
<ClInclude Include="ConfigLoaders\GameConfigLoader.h" />
<ClInclude Include="ConfigLoaders\IsSettingSaveable.h" />
@@ -580,4 +584,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
@@ -874,9 +874,15 @@
<ClCompile Include="Config\GraphicsSettings.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="Config\MainSettings.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="Config\NetplaySettings.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="Config\SYSCONFSettings.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="IOS\Network\NCD\WiiNetConfig.cpp">
<Filter>IOS\Network\NCD</Filter>
</ClCompile>
@@ -1526,9 +1532,15 @@
<ClInclude Include="Config\GraphicsSettings.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="Config\MainSettings.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="Config\NetplaySettings.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="Config\SYSCONFSettings.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="IOS\Network\NCD\WiiNetConfig.h">
<Filter>IOS\Network\NCD</Filter>
</ClInclude>
@@ -10,9 +10,11 @@

#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/Logging/Log.h"
#include "Common/MathUtil.h"

#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
@@ -179,7 +181,7 @@ void Preset(bool _bNTSC)
m_Clock = DiscIO::IsNTSC(region);

// 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_FBWidth.Hex = 0;
@@ -12,9 +12,11 @@

#include "Common/ChunkFile.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/MathUtil.h"
#include "Common/MsgHandler.h"

#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.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);

// 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();
@@ -21,6 +21,7 @@
#include "Common/Assert.h"
#include "Common/ChunkFile.h"
#include "Common/CommonPaths.h"
#include "Common/Config/Config.h"
#include "Common/File.h"
#include "Common/FileUtil.h"
#include "Common/Hash.h"
@@ -29,6 +30,9 @@
#include "Common/Timer.h"

#include "Core/Boot/Boot.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigLoaders/MovieConfigLoader.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
@@ -74,12 +78,7 @@ static u64 s_totalLagCount = 0; // just stats
static u64 s_currentInputCount = 0, s_totalInputCount = 0; // just stats
static u64 s_totalTickCount = 0, s_tickCountAtLastInput = 0; // just stats
static u64 s_recordingStartTime; // seconds since 1970 that recording started
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_bSyncGPU = false, s_bNetPlay = false;
static std::string s_videoBackend = "unknown";
static int s_iCPUCore = 1;
static bool s_bSaveConfig = false, s_bNetPlay = false;
static bool s_bClearSave = false;
static bool s_bDiscChange = false;
static bool s_bReset = false;
@@ -90,7 +89,6 @@ static u8 s_bongos, s_memcards;
static u8 s_revision[20];
static u32 s_DSPiromHash = 0;
static u32 s_DSPcoefHash = 0;
static u8 s_language = static_cast<u8>(DiscIO::Language::LANGUAGE_UNKNOWN);

static bool s_bRecordingFromSaveState = false;
static bool s_bPolled = false;
@@ -104,6 +102,7 @@ static WiiManipFunction s_wii_manip_func;

static std::string s_current_file_name;

static void GetSettings();
static bool IsMovieHeader(u8 magic[4])
{
return magic[0] == 'D' && magic[1] == 'T' && magic[2] == 'M' && magic[3] == 0x1A;
@@ -217,7 +216,6 @@ void Init(const BootParameters& boot)
s_bPolled = false;
s_bFrameStep = false;
s_bSaveConfig = false;
s_iCPUCore = SConfig::GetInstance().iCPUCore;
if (IsPlayingInput())
{
ReadHeader();
@@ -418,40 +416,6 @@ bool IsConfigSaved()
{
return s_bSaveConfig;
}
bool IsDualCore()
{
return s_bDualCore;
}

bool IsProgressive()
{
return s_bProgressive;
}

bool IsPAL60()
{
return s_bPAL60;
}

bool IsDSPHLE()
{
return s_bDSPHLE;
}

bool IsFastDiscSpeed()
{
return s_bFastDiscSpeed;
}

int GetCPUMode()
{
return s_iCPUCore;
}

u8 GetLanguage()
{
return s_language;
}

bool IsStartingFromClearSave()
{
@@ -463,11 +427,6 @@ bool IsUsingMemcard(int memcard)
return (s_memcards & (1 << memcard)) != 0;
}

bool IsSyncGPU()
{
return s_bSyncGPU;
}

bool IsNetPlayRecording()
{
return s_bNetPlay;
@@ -900,26 +859,18 @@ void ReadHeader()
if (tmpHeader.bSaveConfig)
{
s_bSaveConfig = true;
s_bDualCore = tmpHeader.bDualCore;
s_bProgressive = tmpHeader.bProgressive;
s_bPAL60 = tmpHeader.bPAL60;
s_bDSPHLE = tmpHeader.bDSPHLE;
s_bFastDiscSpeed = tmpHeader.bFastDiscSpeed;
s_iCPUCore = tmpHeader.CPUCore;
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader));
s_bClearSave = tmpHeader.bClearSave;
s_memcards = tmpHeader.memcards;
s_bongos = tmpHeader.bongos;
s_bSyncGPU = tmpHeader.bSyncGPU;
s_bNetPlay = tmpHeader.bNetPlay;
s_language = tmpHeader.language;
memcpy(s_revision, tmpHeader.revision, ArraySize(s_revision));
}
else
{
GetSettings();
}

s_videoBackend = (char*)tmpHeader.videoBackend;
s_discChange = (char*)tmpHeader.discChange;
s_author = (char*)tmpHeader.author;
memcpy(s_MD5, tmpHeader.md5, 16);
@@ -1378,24 +1329,9 @@ void SaveRecording(const std::string& filename)
header.recordingStartTime = s_recordingStartTime;

header.bSaveConfig = true;
header.bSkipIdle = true;
header.bDualCore = s_bDualCore;
header.bProgressive = s_bProgressive;
header.bPAL60 = s_bPAL60;
header.bDSPHLE = s_bDSPHLE;
header.bFastDiscSpeed = s_bFastDiscSpeed;
strncpy((char*)header.videoBackend, s_videoBackend.c_str(), ArraySize(header.videoBackend));
header.CPUCore = s_iCPUCore;
header.bEFBAccessEnable = g_ActiveConfig.bEFBAccessEnable;
header.bEFBCopyEnable = true;
header.bSkipEFBCopyToRam = g_ActiveConfig.bSkipEFBCopyToRam;
header.bEFBCopyCacheEnable = false;
header.bEFBEmulateFormatChanges = g_ActiveConfig.bEFBEmulateFormatChanges;
header.bUseXFB = g_ActiveConfig.bUseXFB;
header.bUseRealXFB = g_ActiveConfig.bUseRealXFB;
ConfigLoaders::SaveToDTM(Config::GetLayer(Config::LayerType::Meta), &header);
header.memcards = s_memcards;
header.bClearSave = s_bClearSave;
header.bSyncGPU = s_bSyncGPU;
header.bNetPlay = s_bNetPlay;
strncpy((char*)header.discChange, s_discChange.c_str(), ArraySize(header.discChange));
strncpy((char*)header.author, s_author.c_str(), ArraySize(header.author));
@@ -1405,7 +1341,6 @@ void SaveRecording(const std::string& filename)
header.DSPiromHash = s_DSPiromHash;
header.DSPcoefHash = s_DSPcoefHash;
header.tickCount = s_totalTickCount;
header.language = s_language;

// TODO
header.uniqueID = 0;
@@ -1464,26 +1399,16 @@ void SetGraphicsConfig()
void GetSettings()
{
s_bSaveConfig = true;
s_bDualCore = SConfig::GetInstance().bCPUThread;
s_bProgressive = SConfig::GetInstance().bProgressive;
s_bPAL60 = SConfig::GetInstance().bPAL60;
s_bDSPHLE = SConfig::GetInstance().bDSPHLE;
s_bFastDiscSpeed = SConfig::GetInstance().bFastDiscSpeed;
s_videoBackend = g_video_backend->GetName();
s_bSyncGPU = SConfig::GetInstance().bSyncGPU;
s_iCPUCore = SConfig::GetInstance().iCPUCore;
s_bNetPlay = NetPlay::IsNetPlayRunning();
if (SConfig::GetInstance().bWii)
{
u64 title_id = SConfig::GetInstance().GetTitleID();
s_bClearSave =
!File::Exists(Common::GetTitleDataPath(title_id, Common::FROM_SESSION_ROOT) + "banner.bin");
s_language = SConfig::GetInstance().m_wii_language;
}
else
{
s_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
s_language = SConfig::GetInstance().SelectedLanguage;
}
s_memcards |=
(SConfig::GetInstance().m_EXIDevice[0] == ExpansionInterface::EXIDEVICE_MEMORYCARD ||
@@ -1497,7 +1422,7 @@ void GetSettings()
std::array<u8, 20> revision = ConvertGitRevisionToBytes(scm_rev_git_str);
std::copy(std::begin(revision), std::end(revision), std::begin(s_revision));

if (!s_bDSPHLE)
if (!Config::Get(Config::MAIN_DSP_HLE))
{
std::string irom_file = File::GetUserPath(D_GCUSER_IDX) + DSP_IROM;
std::string coef_file = File::GetUserPath(D_GCUSER_IDX) + DSP_COEF;
@@ -137,18 +137,9 @@ void SignalDiscChange(const std::string& new_path);
void SetReset(bool reset);

bool IsConfigSaved();
bool IsDualCore();
bool IsProgressive();
bool IsPAL60();
bool IsDSPHLE();
bool IsFastDiscSpeed();
int GetCPUMode();
u8 GetLanguage();
bool IsStartingFromClearSave();
bool IsUsingMemcard(int memcard);
bool IsSyncGPU();
void SetGraphicsConfig();
void GetSettings();
bool IsNetPlayRecording();

bool IsUsingPad(int controller);
@@ -23,7 +23,9 @@
#include <sstream>

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

#include "Common/Config/Config.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/IOS/IOS.h"
@@ -40,6 +42,9 @@ WiiConfigPane::WiiConfigPane(wxWindow* parent, wxWindowID id) : wxPanel(parent,
InitializeGUI();
LoadGUIValues();
BindEvents();
// This is only safe because WiiConfigPane is owned by CConfigMain, which exists
// as long as the DolphinWX app exists.
Config::AddConfigChangedCallback([&] { Core::QueueHostJob([&] { LoadGUIValues(); }, true); });
}

void WiiConfigPane::InitializeGUI()
@@ -174,21 +179,21 @@ void WiiConfigPane::InitializeGUI()

void WiiConfigPane::LoadGUIValues()
{
m_screensaver_checkbox->SetValue(!!SConfig::GetInstance().m_wii_screensaver);
m_pal60_mode_checkbox->SetValue(SConfig::GetInstance().bPAL60);
m_aspect_ratio_choice->SetSelection(SConfig::GetInstance().m_wii_aspect_ratio);
m_system_language_choice->SetSelection(SConfig::GetInstance().m_wii_language);
m_screensaver_checkbox->SetValue(Config::Get(Config::SYSCONF_SCREENSAVER));
m_pal60_mode_checkbox->SetValue(Config::Get(Config::SYSCONF_PAL60));
m_aspect_ratio_choice->SetSelection(Config::Get(Config::SYSCONF_WIDESCREEN));
m_system_language_choice->SetSelection(Config::Get(Config::SYSCONF_LANGUAGE));

m_sd_card_checkbox->SetValue(SConfig::GetInstance().m_WiiSDCard);
m_connect_keyboard_checkbox->SetValue(SConfig::GetInstance().m_WiiKeyboard);

PopulateUSBPassthroughListbox();

m_bt_sensor_bar_pos->SetSelection(
TranslateSensorBarPosition(SConfig::GetInstance().m_sensor_bar_position));
m_bt_sensor_bar_sens->SetValue(SConfig::GetInstance().m_sensor_bar_sensitivity);
m_bt_speaker_volume->SetValue(SConfig::GetInstance().m_speaker_volume);
m_bt_wiimote_motor->SetValue(SConfig::GetInstance().m_wiimote_motor);
TranslateSensorBarPosition(Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION)));
m_bt_sensor_bar_sens->SetValue(Config::Get(Config::SYSCONF_SENSOR_BAR_SENSITIVITY));
m_bt_speaker_volume->SetValue(Config::Get(Config::SYSCONF_SPEAKER_VOLUME));
m_bt_wiimote_motor->SetValue(Config::Get(Config::SYSCONF_WIIMOTE_MOTOR));
}

void WiiConfigPane::PopulateUSBPassthroughListbox()
@@ -268,12 +273,12 @@ void WiiConfigPane::OnUSBWhitelistRemoveButtonUpdate(wxUpdateUIEvent& 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)
{
SConfig::GetInstance().bPAL60 = m_pal60_mode_checkbox->IsChecked();
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->IsChecked());
}

void WiiConfigPane::OnSDCardCheckBoxChanged(wxCommandEvent& event)
@@ -291,30 +296,32 @@ void WiiConfigPane::OnConnectKeyboardCheckBoxChanged(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)
{
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)
{
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)
{
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)
{
SConfig::GetInstance().m_speaker_volume = event.GetInt();
Config::SetBase(Config::SYSCONF_SPEAKER_VOLUME, static_cast<u32>(event.GetInt()));
}

void WiiConfigPane::OnWiimoteMotorChanged(wxCommandEvent& event)
{
SConfig::GetInstance().m_wiimote_motor = event.IsChecked();
Config::SetBase(Config::SYSCONF_WIIMOTE_MOTOR, event.IsChecked());
}
@@ -32,11 +32,13 @@

#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/FifoQueue.h"
#include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"

#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/HW/EXI/EXI_Device.h"
#include "Core/NetPlayClient.h"
@@ -316,8 +318,8 @@ void NetPlayDialog::GetNetSettings(NetSettings& settings)
settings.m_EnableCheats = instance.bEnableCheats;
settings.m_SelectedLanguage = instance.SelectedLanguage;
settings.m_OverrideGCLanguage = instance.bOverrideGCLanguage;
settings.m_ProgressiveScan = instance.bProgressive;
settings.m_PAL60 = instance.bPAL60;
settings.m_ProgressiveScan = Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN);
settings.m_PAL60 = Config::Get(Config::SYSCONF_PAL60);
settings.m_DSPHLE = instance.bDSPHLE;
settings.m_DSPEnableJIT = instance.m_DSPEnableJIT;
settings.m_WriteToMemcard = m_memcard_write->GetValue();
@@ -25,6 +25,7 @@
#include "Common/Assert.h"
#include "Common/FileUtil.h"
#include "Common/SysConf.h"
#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.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,
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);
}

@@ -1027,7 +1029,7 @@ void VideoConfigDiag::Event_DisplayResolution(wxCommandEvent& ev)

void VideoConfigDiag::Event_ProgressiveScan(wxCommandEvent& ev)
{
SConfig::GetInstance().bProgressive = ev.IsChecked();
Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, ev.IsChecked());
ev.Skip();
}

@@ -23,6 +23,7 @@

#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/Event.h"
#include "Common/FileUtil.h"
#include "Common/Flag.h"
@@ -33,6 +34,7 @@
#include "Common/Thread.h"
#include "Common/Timer.h"

#include "Core/Config/SYSCONFSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/CoreTiming.h"
@@ -93,9 +95,7 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height)
OSDTime = 0;

if (SConfig::GetInstance().bWii)
{
m_aspect_wide = SConfig::GetInstance().m_wii_aspect_ratio != 0;
}
m_aspect_wide = Config::Get(Config::SYSCONF_WIDESCREEN);

m_last_host_config_bits = ShaderHostConfig::GetCurrent().bits;
}