Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
4 changes: 4 additions & 0 deletions Source/Core/Core/Config/MainSettings.cpp
Expand Up @@ -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
4 changes: 4 additions & 0 deletions Source/Core/Core/Config/MainSettings.h
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Source/Core/Core/ConfigLoaders/IsSettingSaveable.cpp
Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions Source/Core/Core/ConfigManager.cpp
Expand Up @@ -91,7 +91,6 @@ void SConfig::SaveSettings()
SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
SaveCoreSettings(ini);
SaveInputSettings(ini);
SaveBluetoothPassthroughSettings(ini);
SaveUSBPassthroughSettings(ini);
SaveJitDebugSettings(ini);
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -256,7 +248,6 @@ void SConfig::LoadSettings()
LoadGeneralSettings(ini);
LoadInterfaceSettings(ini);
LoadCoreSettings(ini);
LoadInputSettings(ini);
LoadBluetoothPassthroughSettings(ini);
LoadUSBPassthroughSettings(ini);
LoadJitDebugSettings(ini);
Expand Down Expand Up @@ -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");
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/Core/ConfigManager.h
Expand Up @@ -230,7 +230,6 @@ struct SConfig
bool m_PauseOnFocusLost;

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

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/VideoInterface.cpp
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/DolphinQt/Config/CommonControllersWidget.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/RenderWidget.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 33d0442

Please sign in to comment.