diff --git a/Source/Core/Core/HW/GCKeyboardEmu.cpp b/Source/Core/Core/HW/GCKeyboardEmu.cpp index 53da135fb5..6072d4322b 100644 --- a/Source/Core/Core/HW/GCKeyboardEmu.cpp +++ b/Source/Core/Core/HW/GCKeyboardEmu.cpp @@ -10,7 +10,6 @@ #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h" #include "InputCommon/ControllerEmu/ControllerEmu.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/KeyboardStatus.h" @@ -81,8 +80,6 @@ GCKeyboard::GCKeyboard(const unsigned int index) : m_index(index) // options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); - m_options->boolean_settings.emplace_back( - std::make_unique(_trans("Background Input"))); m_options->boolean_settings.emplace_back(std::make_unique( _trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL)); } diff --git a/Source/Core/Core/HW/GCPadEmu.cpp b/Source/Core/Core/HW/GCPadEmu.cpp index 53a27cdba8..3ba85c36ba 100644 --- a/Source/Core/Core/HW/GCPadEmu.cpp +++ b/Source/Core/Core/HW/GCPadEmu.cpp @@ -13,7 +13,6 @@ #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h" #include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/GCPadStatus.h" @@ -79,8 +78,6 @@ GCPad::GCPad(const unsigned int index) : m_index(index) // options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); - m_options->boolean_settings.emplace_back( - std::make_unique(_trans("Background Input"))); m_options->boolean_settings.emplace_back(std::make_unique( _trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL)); } diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index b05b1869e3..26f1ca5cfe 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -36,7 +36,6 @@ #include "InputCommon/ControllerEmu/ControlGroup/Force.h" #include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h" #include "InputCommon/ControllerEmu/ControlGroup/Tilt.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/ControllerEmu/Setting/NumericSetting.h" @@ -296,8 +295,6 @@ Wiimote::Wiimote(const unsigned int index) // options groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); - m_options->boolean_settings.emplace_back( - std::make_unique(_trans("Background Input"))); m_options->boolean_settings.emplace_back(std::make_unique( "Sideways Wiimote", _trans("Sideways Wii Remote"), false)); m_options->boolean_settings.emplace_back(std::make_unique( diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index 41d914bb06..425f504bc3 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -14,7 +14,6 @@ #include "InputCommon/ControllerEmu/Control/Input.h" #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/GCPadStatus.h" @@ -228,11 +227,6 @@ ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) return static_cast(s_config.GetController(0))->GetHotkeyGroup(group); } -ControllerEmu::ControlGroup* GetOptionsGroup() -{ - return static_cast(s_config.GetController(0))->GetOptionsGroup(); -} - void Shutdown() { s_config.ClearControllers(); @@ -272,12 +266,6 @@ HotkeyManager::HotkeyManager() m_keys[group]->controls.emplace_back(new ControllerEmu::Input(hotkey_labels[key])); } } - - groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options"))); - m_options->boolean_settings.emplace_back( - std::make_unique(_trans("Background Input"))); - m_options->boolean_settings.emplace_back(std::make_unique( - _trans("Iterative Input"), false, ControllerEmu::SettingType::VIRTUAL)); } HotkeyManager::~HotkeyManager() @@ -309,11 +297,6 @@ ControllerEmu::ControlGroup* HotkeyManager::GetHotkeyGroup(HotkeyGroup group) co return m_hotkey_groups[group]; } -ControllerEmu::ControlGroup* HotkeyManager::GetOptionsGroup() const -{ - return m_options; -} - int HotkeyManager::FindGroupByID(int id) const { const auto i = std::find_if(groups_info.begin(), groups_info.end(), diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index 443a3c0406..10dbb9ccf4 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -199,7 +199,6 @@ public: void GetInput(HotkeyStatus* const hk); std::string GetName() const override; ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) const; - ControllerEmu::ControlGroup* GetOptionsGroup() const; int FindGroupByID(int id) const; int GetIndexForGroup(int group, int id) const; void LoadDefaults(const ControllerInterface& ciface) override; @@ -207,7 +206,6 @@ public: private: ControllerEmu::Buttons* m_keys[NUM_HOTKEY_GROUPS]; std::array m_hotkey_groups; - ControllerEmu::ControlGroup* m_options; }; namespace HotkeyManagerEmu @@ -218,7 +216,6 @@ void LoadConfig(); InputConfig* GetConfig(); ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group); -ControllerEmu::ControlGroup* GetOptionsGroup(); void GetStatus(); bool IsEnabled(); void Enable(bool enable_toggle); diff --git a/Source/Core/DolphinWX/ControllerConfigDiag.cpp b/Source/Core/DolphinWX/ControllerConfigDiag.cpp index 50661833c5..529b8802c7 100644 --- a/Source/Core/DolphinWX/ControllerConfigDiag.cpp +++ b/Source/Core/DolphinWX/ControllerConfigDiag.cpp @@ -60,6 +60,8 @@ ControllerConfigDiag::ControllerConfigDiag(wxWindow* const parent) main_sizer->AddSpacer(space5); main_sizer->Add(CreateWiimoteConfigSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT, space5); main_sizer->AddSpacer(space5); + main_sizer->Add(CreateAdvancedSettingsSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT, space5); + main_sizer->AddSpacer(space5); main_sizer->Add(CreateButtonSizer(wxCLOSE | wxNO_DEFAULT), 0, wxEXPAND | wxLEFT | wxRIGHT, space5); main_sizer->AddSpacer(space5); @@ -220,6 +222,25 @@ wxSizer* ControllerConfigDiag::CreateGamecubeSizer() return gamecube_static_sizer; } +void ControllerConfigDiag::OnBackgroundInputChanged(wxCommandEvent& event) +{ + SConfig::GetInstance().m_BackgroundInput = event.IsChecked(); +} + +wxSizer* ControllerConfigDiag::CreateAdvancedSettingsSizer() +{ + const int space5 = FromDIP(5); + + m_background_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Background Input")); + m_background_input_checkbox->SetValue(SConfig::GetInstance().m_BackgroundInput); + m_background_input_checkbox->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnBackgroundInputChanged, + this); + + auto* const box = new wxStaticBoxSizer(wxVERTICAL, this, _("Advanced Settings")); + box->Add(m_background_input_checkbox, 0, wxEXPAND | wxLEFT | wxRIGHT, space5); + return box; +} + wxSizer* ControllerConfigDiag::CreateWiimoteConfigSizer() { const int space5 = FromDIP(5); diff --git a/Source/Core/DolphinWX/ControllerConfigDiag.h b/Source/Core/DolphinWX/ControllerConfigDiag.h index 0aa1dcfca2..4655ce3d1a 100644 --- a/Source/Core/DolphinWX/ControllerConfigDiag.h +++ b/Source/Core/DolphinWX/ControllerConfigDiag.h @@ -30,6 +30,7 @@ private: wxSizer* CreateWiimoteConfigSizer(); wxSizer* CreatePassthroughBTConfigSizer(); wxSizer* CreateEmulatedBTConfigSizer(); + wxSizer* CreateAdvancedSettingsSizer(); void OnClose(wxCloseEvent& event); void OnCloseButton(wxCommandEvent& event); @@ -50,6 +51,8 @@ private: void OnContinuousScanning(wxCommandEvent& event); void OnEnableSpeaker(wxCommandEvent& event); + void OnBackgroundInputChanged(wxCommandEvent& event); + std::map m_gc_port_from_choice_id; std::map m_gc_port_from_config_id; std::array m_gc_port_configure_button; @@ -74,4 +77,6 @@ private: wxButton* m_refresh_wm_button; wxStaticText* m_unsupported_bt_text; wxCheckBox* m_enable_speaker_data; + + wxCheckBox* m_background_input_checkbox; }; diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp index 50bfe3364f..4f0643672b 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp @@ -2,10 +2,12 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include #include #include #include +#include "Core/ConfigManager.h" #include "Core/HotkeyManager.h" #include "DolphinWX/Input/HotkeyInputConfigDiag.h" @@ -24,13 +26,13 @@ HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* parent, InputConfig& UpdateGUI(); } -wxBoxSizer* HotkeyInputConfigDialog::CreateMainSizer() +wxSizer* HotkeyInputConfigDialog::CreateMainSizer() { const int space5 = FromDIP(5); auto* const main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->AddSpacer(space5); - main_sizer->Add(CreateDeviceRelatedSizer()); + main_sizer->Add(CreateDeviceRelatedSizer(), 0, wxEXPAND | wxLEFT | wxRIGHT); main_sizer->AddSpacer(space5); main_sizer->Add(m_notebook, 1, wxEXPAND | wxLEFT | wxRIGHT, space5); main_sizer->AddSpacer(space5); @@ -41,24 +43,54 @@ wxBoxSizer* HotkeyInputConfigDialog::CreateMainSizer() return main_sizer; } -wxBoxSizer* HotkeyInputConfigDialog::CreateDeviceRelatedSizer() +void HotkeyInputConfigDialog::OnBackgroundInputChanged(wxCommandEvent& event) +{ + SConfig::GetInstance().m_BackgroundInput = event.IsChecked(); +} + +void HotkeyInputConfigDialog::OnIterativeInputChanged(wxCommandEvent& event) +{ + m_iterate = event.IsChecked(); +} + +wxSizer* HotkeyInputConfigDialog::CreateOptionsSizer() +{ + const int space3 = FromDIP(3); + + auto background_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Background Input")); + background_input_checkbox->SetValue(SConfig::GetInstance().m_BackgroundInput); + background_input_checkbox->Bind(wxEVT_CHECKBOX, + &HotkeyInputConfigDialog::OnBackgroundInputChanged, this); + + auto iterative_input_checkbox = new wxCheckBox(this, wxID_ANY, _("Iterative Input")); + iterative_input_checkbox->SetValue(m_iterate); + iterative_input_checkbox->Bind(wxEVT_CHECKBOX, &HotkeyInputConfigDialog::OnIterativeInputChanged, + this); + + auto sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Options")); + sizer->AddSpacer(space3); + sizer->Add(background_input_checkbox, 0, wxLEFT | wxRIGHT, space3); + sizer->AddSpacer(space3); + sizer->Add(iterative_input_checkbox, 0, wxLEFT | wxRIGHT, space3); + sizer->AddSpacer(space3); + return sizer; +} + +wxSizer* HotkeyInputConfigDialog::CreateDeviceRelatedSizer() { const int space5 = FromDIP(5); auto* const enclosing_sizer = new wxBoxSizer(wxHORIZONTAL); - auto* const reset_sizer = CreaterResetGroupBox(wxVERTICAL); - auto* const options_group_box = - new ControlGroupBox(HotkeyManagerEmu::GetOptionsGroup(), this, this); enclosing_sizer->AddSpacer(space5); enclosing_sizer->Add(CreateDeviceProfileSizer(), 3, wxEXPAND); - enclosing_sizer->Add(reset_sizer, 0, wxEXPAND); - enclosing_sizer->Add(options_group_box, 1, wxEXPAND); + enclosing_sizer->Add(CreaterResetGroupBox(wxVERTICAL), 0, wxEXPAND); + enclosing_sizer->Add(CreateOptionsSizer(), 1, wxEXPAND); enclosing_sizer->AddSpacer(space5); return enclosing_sizer; } -wxBoxSizer* HotkeyInputConfigDialog::CreateDeviceProfileSizer() +wxSizer* HotkeyInputConfigDialog::CreateDeviceProfileSizer() { auto* const device_chooser = CreateDeviceChooserGroupBox(); auto* const profile_chooser = CreateProfileChooserGroupBox(); diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h index d078f2a5c4..fa62a4f166 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h @@ -17,9 +17,10 @@ public: bool using_debugger, int port_num = 0); private: - wxBoxSizer* CreateMainSizer(); - wxBoxSizer* CreateDeviceRelatedSizer(); - wxBoxSizer* CreateDeviceProfileSizer(); + wxSizer* CreateMainSizer(); + wxSizer* CreateDeviceRelatedSizer(); + wxSizer* CreateDeviceProfileSizer(); + wxSizer* CreateOptionsSizer(); void InitializeNotebook(); wxPanel* CreateGeneralPanel(); @@ -31,6 +32,9 @@ private: wxPanel* CreateSaveAndLoadStatePanel(); wxPanel* CreateOtherStateManagementPanel(); + void OnBackgroundInputChanged(wxCommandEvent& event); + void OnIterativeInputChanged(wxCommandEvent& event); + wxNotebook* m_notebook; bool m_using_debugger; }; diff --git a/Source/Core/DolphinWX/Input/InputConfigDiag.h b/Source/Core/DolphinWX/Input/InputConfigDiag.h index 260cea24c7..bef22c6cee 100644 --- a/Source/Core/DolphinWX/Input/InputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/InputConfigDiag.h @@ -240,6 +240,7 @@ protected: ControllerEmu::EmulatedController* const controller; + bool m_iterate = false; wxTimer m_update_timer; private: @@ -249,5 +250,4 @@ private: InputEventFilter m_event_filter; bool DetectButton(ControlButton* button); - bool m_iterate = false; }; diff --git a/Source/Core/DolphinWX/Input/WiimoteInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/WiimoteInputConfigDiag.cpp index fc7fe5364b..15ff00c607 100644 --- a/Source/Core/DolphinWX/Input/WiimoteInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/WiimoteInputConfigDiag.cpp @@ -10,7 +10,6 @@ #include "Core/HW/Wiimote.h" #include "Core/HW/WiimoteEmu/WiimoteEmu.h" -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" #include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" #include "InputCommon/ControllerEmu/Setting/NumericSetting.h" diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index f8ee22f565..768d717874 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -14,7 +14,6 @@ set(SRCS InputConfig.cpp ControllerEmu/ControlGroup/Slider.cpp ControllerEmu/ControlGroup/Tilt.cpp ControllerEmu/ControlGroup/Triggers.cpp - ControllerEmu/Setting/BackgroundInputSetting.cpp ControllerEmu/Setting/BooleanSetting.cpp ControllerEmu/Setting/NumericSetting.cpp ControllerInterface/ControllerInterface.cpp diff --git a/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.cpp b/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.cpp deleted file mode 100644 index 0e7b3d785e..0000000000 --- a/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include "InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h" -#include "Core/ConfigManager.h" -#include "InputCommon/ControllerEmu/Setting/Setting.h" - -namespace ControllerEmu -{ -BackgroundInputSetting::BackgroundInputSetting(const std::string& setting_name) - : BooleanSetting(setting_name, false, SettingType::VIRTUAL) -{ -} - -bool BackgroundInputSetting::GetValue() const -{ - return SConfig::GetInstance().m_BackgroundInput; -} -void BackgroundInputSetting::SetValue(bool value) -{ - m_value = value; - SConfig::GetInstance().m_BackgroundInput = value; -} - -} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h b/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h deleted file mode 100644 index fc1f8c1de3..0000000000 --- a/Source/Core/InputCommon/ControllerEmu/Setting/BackgroundInputSetting.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h" - -namespace ControllerEmu -{ -class BackgroundInputSetting : public BooleanSetting -{ -public: - BackgroundInputSetting(const std::string& setting_name); - - bool GetValue() const override; - void SetValue(bool value) override; -}; - -} // namespace ControllerEmu diff --git a/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.cpp b/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.cpp index b6e820b031..3f7c4e0752 100644 --- a/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.cpp +++ b/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.cpp @@ -19,8 +19,6 @@ BooleanSetting::BooleanSetting(const std::string& setting_name, const bool defau { } -BooleanSetting::~BooleanSetting() = default; - bool BooleanSetting::GetValue() const { return m_value; diff --git a/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.h b/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.h index 754d697d2b..98c1614a6a 100644 --- a/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.h +++ b/Source/Core/InputCommon/ControllerEmu/Setting/BooleanSetting.h @@ -18,10 +18,9 @@ public: const bool default_value, const SettingType setting_type = SettingType::NORMAL); BooleanSetting(const std::string& setting_name, const bool default_value, const SettingType setting_type = SettingType::NORMAL); - virtual ~BooleanSetting(); - virtual bool GetValue() const; - virtual void SetValue(bool value); + bool GetValue() const; + void SetValue(bool value); const SettingType m_type; const std::string m_name; const std::string m_ui_name; diff --git a/Source/Core/InputCommon/InputCommon.vcxproj b/Source/Core/InputCommon/InputCommon.vcxproj index 0552bfe052..6355d41a24 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj +++ b/Source/Core/InputCommon/InputCommon.vcxproj @@ -50,7 +50,6 @@ - @@ -88,7 +87,6 @@ - diff --git a/Source/Core/InputCommon/InputCommon.vcxproj.filters b/Source/Core/InputCommon/InputCommon.vcxproj.filters index 07d4a161a8..3b1c4025e0 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj.filters +++ b/Source/Core/InputCommon/InputCommon.vcxproj.filters @@ -74,9 +74,6 @@ ControllerEmu\ControlGroup - - ControllerEmu\Setting - ControllerEmu\Setting @@ -163,9 +160,6 @@ ControllerEmu\ControlGroup - - ControllerEmu\Setting - ControllerEmu\Setting