NoGUI: Set default settings if missing

This commit is contained in:
Connor McLaughlin 2021-02-02 01:46:16 +10:00
parent c54842830f
commit 1e8752759d
3 changed files with 14 additions and 5 deletions

View File

@ -109,6 +109,10 @@ float NoGUIHostInterface::GetFloatSettingValue(const char* section, const char*
void NoGUIHostInterface::LoadSettings() void NoGUIHostInterface::LoadSettings()
{ {
m_settings_interface = std::make_unique<INISettingsInterface>(GetSettingsFileName()); m_settings_interface = std::make_unique<INISettingsInterface>(GetSettingsFileName());
if (!CommonHostInterface::CheckSettings(*m_settings_interface.get()))
AddOSDMessage("Settings version mismatch, settings have been reset to defaults.", 30.0f);
CommonHostInterface::LoadSettings(*m_settings_interface.get()); CommonHostInterface::LoadSettings(*m_settings_interface.get());
CommonHostInterface::FixIncompatibleSettings(false); CommonHostInterface::FixIncompatibleSettings(false);
} }

View File

@ -742,6 +742,12 @@ void QtHostInterface::SetDefaultSettings(SettingsInterface& si)
{ {
CommonHostInterface::SetDefaultSettings(si); CommonHostInterface::SetDefaultSettings(si);
si.SetStringValue("Hotkeys", "PowerOff", "Keyboard/Escape");
si.SetStringValue("Hotkeys", "LoadSelectedSaveState", "Keyboard/F1");
si.SetStringValue("Hotkeys", "SaveSelectedSaveState", "Keyboard/F2");
si.SetStringValue("Hotkeys", "SelectPreviousSaveStateSlot", "Keyboard/F3");
si.SetStringValue("Hotkeys", "SelectNextSaveStateSlot", "Keyboard/F4");
si.SetBoolValue("Main", "RenderToMainWindow", true); si.SetBoolValue("Main", "RenderToMainWindow", true);
} }

View File

@ -2311,6 +2311,10 @@ void CommonHostInterface::SetDefaultSettings(SettingsInterface& si)
{ {
HostInterface::SetDefaultSettings(si); HostInterface::SetDefaultSettings(si);
// TODO: Maybe we should bind this to F1 in the future.
if (m_fullscreen_ui_enabled)
si.SetStringValue("Hotkeys", "OpenQuickMenu", "Keyboard/Escape");
si.SetStringValue("Controller1", "ButtonUp", "Keyboard/W"); si.SetStringValue("Controller1", "ButtonUp", "Keyboard/W");
si.SetStringValue("Controller1", "ButtonDown", "Keyboard/S"); si.SetStringValue("Controller1", "ButtonDown", "Keyboard/S");
si.SetStringValue("Controller1", "ButtonLeft", "Keyboard/A"); si.SetStringValue("Controller1", "ButtonLeft", "Keyboard/A");
@ -2328,11 +2332,6 @@ void CommonHostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetStringValue("Hotkeys", "FastForward", "Keyboard/Tab"); si.SetStringValue("Hotkeys", "FastForward", "Keyboard/Tab");
si.SetStringValue("Hotkeys", "TogglePause", "Keyboard/Pause"); si.SetStringValue("Hotkeys", "TogglePause", "Keyboard/Pause");
si.SetStringValue("Hotkeys", "ToggleFullscreen", "Keyboard/Alt+Return"); si.SetStringValue("Hotkeys", "ToggleFullscreen", "Keyboard/Alt+Return");
si.SetStringValue("Hotkeys", "PowerOff", "Keyboard/Escape");
si.SetStringValue("Hotkeys", "LoadSelectedSaveState", "Keyboard/F1");
si.SetStringValue("Hotkeys", "SaveSelectedSaveState", "Keyboard/F2");
si.SetStringValue("Hotkeys", "SelectPreviousSaveStateSlot", "Keyboard/F3");
si.SetStringValue("Hotkeys", "SelectNextSaveStateSlot", "Keyboard/F4");
si.SetStringValue("Hotkeys", "Screenshot", "Keyboard/F10"); si.SetStringValue("Hotkeys", "Screenshot", "Keyboard/F10");
si.SetStringValue("Hotkeys", "IncreaseResolutionScale", "Keyboard/PageUp"); si.SetStringValue("Hotkeys", "IncreaseResolutionScale", "Keyboard/PageUp");
si.SetStringValue("Hotkeys", "DecreaseResolutionScale", "Keyboard/PageDown"); si.SetStringValue("Hotkeys", "DecreaseResolutionScale", "Keyboard/PageDown");