Skip to content
Permalink
Browse files
Merge pull request #10324 from AdmiralCurtiss/config-port-input
Config: Port BackgroundInput setting to new config system.
  • Loading branch information
JMC47 committed Dec 30, 2021
2 parents 5331160 + 9c4b2b6 commit 33d0442
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 26 deletions.
@@ -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
@@ -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
@@ -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;
@@ -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");
@@ -230,7 +230,6 @@ struct SConfig
bool m_PauseOnFocusLost;

// Input settings
bool m_BackgroundInput;
bool m_AdapterRumble[4];
bool m_AdapterKonga[4];

@@ -257,15 +256,13 @@ struct SConfig
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);

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);
@@ -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();
@@ -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();
}
@@ -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

0 comments on commit 33d0442

Please sign in to comment.