Config: Port Input setting to new config system.

This commit is contained in:
Admiral H. Curtiss 2021-12-27 19:53:20 +01:00
parent 533116093e
commit 9c4b2b65b4
No known key found for this signature in database
GPG key ID: F051B4C4044F33FB
8 changed files with 15 additions and 26 deletions

View file

@ -270,4 +270,8 @@ const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY{{System::Main, "Movie", "ShowInpu
const Info<bool> MAIN_MOVIE_SHOW_RTC{{System::Main, "Movie", "ShowRTC"}, false};
const Info<bool> MAIN_MOVIE_SHOW_RERECORD{{System::Main, "Movie", "ShowRerecord"}, false};
// Main.Input
const Info<bool> MAIN_INPUT_BACKGROUND_INPUT{{System::Main, "Input", "BackgroundInput"}, false};
} // namespace Config

View file

@ -230,4 +230,8 @@ extern const Info<bool> MAIN_MOVIE_SHOW_INPUT_DISPLAY;
extern const Info<bool> MAIN_MOVIE_SHOW_RTC;
extern const Info<bool> MAIN_MOVIE_SHOW_RERECORD;
// Main.Input
extern const Info<bool> MAIN_INPUT_BACKGROUND_INPUT;
} // namespace Config

View file

@ -27,7 +27,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
{
for (const std::string_view section :
{"NetPlay", "General", "GBA", "Display", "Network", "Analytics", "AndroidOverlayButtons",
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie"})
"DSP", "GameList", "FifoPlayer", "AutoUpdate", "Movie", "Input"})
{
if (config_location.section == section)
return true;

View file

@ -91,7 +91,6 @@ void SConfig::SaveSettings()
SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
SaveCoreSettings(ini);
SaveInputSettings(ini);
SaveBluetoothPassthroughSettings(ini);
SaveUSBPassthroughSettings(ini);
SaveJitDebugSettings(ini);
@ -198,13 +197,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
core->Set("CustomRTCValue", m_customRTCValue);
}
void SConfig::SaveInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Set("BackgroundInput", m_BackgroundInput);
}
void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");
@ -256,7 +248,6 @@ void SConfig::LoadSettings()
LoadGeneralSettings(ini);
LoadInterfaceSettings(ini);
LoadCoreSettings(ini);
LoadInputSettings(ini);
LoadBluetoothPassthroughSettings(ini);
LoadUSBPassthroughSettings(ini);
LoadJitDebugSettings(ini);
@ -368,13 +359,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
}
void SConfig::LoadInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Get("BackgroundInput", &m_BackgroundInput, false);
}
void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");

View file

@ -230,7 +230,6 @@ struct SConfig
bool m_PauseOnFocusLost;
// Input settings
bool m_BackgroundInput;
bool m_AdapterRumble[4];
bool m_AdapterKonga[4];
@ -257,7 +256,6 @@ private:
void SaveGeneralSettings(IniFile& ini);
void SaveInterfaceSettings(IniFile& ini);
void SaveCoreSettings(IniFile& ini);
void SaveInputSettings(IniFile& ini);
void SaveBluetoothPassthroughSettings(IniFile& ini);
void SaveUSBPassthroughSettings(IniFile& ini);
void SaveJitDebugSettings(IniFile& ini);
@ -265,7 +263,6 @@ private:
void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
void LoadCoreSettings(IniFile& ini);
void LoadInputSettings(IniFile& ini);
void LoadBluetoothPassthroughSettings(IniFile& ini);
void LoadUSBPassthroughSettings(IniFile& ini);
void LoadJitDebugSettings(IniFile& ini);

View file

@ -881,7 +881,7 @@ void Update(u64 ticks)
if (s_half_line_of_next_si_poll == s_half_line_count)
{
Core::UpdateInputGate(!SConfig::GetInstance().m_BackgroundInput,
Core::UpdateInputGate(!Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT),
SConfig::GetInstance().bLockCursor);
SerialInterface::UpdateDevices();
s_half_line_of_next_si_poll += 2 * SerialInterface::GetPollXLines();

View file

@ -8,7 +8,7 @@
#include <QPushButton>
#include <QVBoxLayout>
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
#include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h"
@ -57,11 +57,11 @@ void CommonControllersWidget::OnControllerInterfaceConfigure()
void CommonControllersWidget::LoadSettings()
{
m_common_bg_input->setChecked(SConfig::GetInstance().m_BackgroundInput);
m_common_bg_input->setChecked(Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT));
}
void CommonControllersWidget::SaveSettings()
{
SConfig::GetInstance().m_BackgroundInput = m_common_bg_input->isChecked();
SConfig::GetInstance().SaveSettings();
Config::SetBaseOrCurrent(Config::MAIN_INPUT_BACKGROUND_INPUT, m_common_bg_input->isChecked());
Config::Save();
}

View file

@ -157,7 +157,7 @@ void RenderWidget::UpdateCursor()
const bool keep_on_top = (windowFlags() & Qt::WindowStaysOnTopHint) != 0;
const bool should_hide =
(Settings::Instance().GetCursorVisibility() == SConfig::ShowCursor::Never) &&
(keep_on_top || SConfig::GetInstance().m_BackgroundInput || isActiveWindow());
(keep_on_top || Config::Get(Config::MAIN_INPUT_BACKGROUND_INPUT) || isActiveWindow());
setCursor(should_hide ? Qt::BlankCursor : Qt::ArrowCursor);
}
else