diff --git a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp index b9e93553b3..9f088488b0 100644 --- a/Source/Core/DolphinWX/Input/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/InputConfigDiag.cpp @@ -52,10 +52,10 @@ #include "DolphinWX/Input/NunchukInputConfigDiag.h" #include "DolphinWX/Input/TurntableInputConfigDiag.h" #include "DolphinWX/WxUtils.h" +#include "InputCommon/ControlReference/ExpressionParser.h" #include "InputCommon/ControllerEmu/ControllerEmu.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/Device.h" -#include "InputCommon/ControllerInterface/ExpressionParser.h" #include "InputCommon/InputConfig.h" using namespace ciface::ExpressionParser; @@ -177,7 +177,7 @@ void PadSettingSpin::UpdateValue() } ControlDialog::ControlDialog(InputConfigDialog* const parent, InputConfig& config, - ControllerInterface::ControlReference* const ref) + ControlReference* const ref) : wxDialog(parent, wxID_ANY, _("Configure Control"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER), control_reference(ref), m_config(config), m_parent(parent) @@ -220,8 +220,7 @@ ExtensionButton::ExtensionButton(wxWindow* const parent, ControllerEmu::Extensio { } -ControlButton::ControlButton(wxWindow* const parent, - ControllerInterface::ControlReference* const _ref, +ControlButton::ControlButton(wxWindow* const parent, ControlReference* const _ref, const std::string& name, const unsigned int width, const std::string& label) : wxButton(parent, wxID_ANY), control_reference(_ref), m_name(name), @@ -387,8 +386,8 @@ bool ControlDialog::Validate() control_reference->expression = WxStrToStr(textctrl->GetValue()); auto lock = ControllerEmu::GetStateLock(); - g_controller_interface.UpdateReference(control_reference, - m_parent->GetController()->default_device); + control_reference->UpdateReference(g_controller_interface, + m_parent->GetController()->default_device); UpdateGUI(); @@ -426,8 +425,8 @@ void ControlDialog::ClearControl(wxCommandEvent&) control_reference->expression.clear(); auto lock = ControllerEmu::GetStateLock(); - g_controller_interface.UpdateReference(control_reference, - m_parent->GetController()->default_device); + control_reference->UpdateReference(g_controller_interface, + m_parent->GetController()->default_device); UpdateGUI(); } @@ -485,8 +484,8 @@ void ControlDialog::SetSelectedControl(wxCommandEvent&) control_reference->expression = textctrl->GetValue(); auto lock = ControllerEmu::GetStateLock(); - g_controller_interface.UpdateReference(control_reference, - m_parent->GetController()->default_device); + control_reference->UpdateReference(g_controller_interface, + m_parent->GetController()->default_device); UpdateGUI(); } @@ -521,8 +520,8 @@ void ControlDialog::AppendControl(wxCommandEvent& event) control_reference->expression = textctrl->GetValue(); auto lock = ControllerEmu::GetStateLock(); - g_controller_interface.UpdateReference(control_reference, - m_parent->GetController()->default_device); + control_reference->UpdateReference(g_controller_interface, + m_parent->GetController()->default_device); UpdateGUI(); } @@ -703,7 +702,8 @@ bool InputConfigDialog::DetectButton(ControlButton* button) GetExpressionForControl(expr, control_name); button->control_reference->expression = expr; auto lock = ControllerEmu::GetStateLock(); - g_controller_interface.UpdateReference(button->control_reference, controller->default_device); + button->control_reference->UpdateReference(g_controller_interface, + controller->default_device); success = true; } diff --git a/Source/Core/DolphinWX/Input/InputConfigDiag.h b/Source/Core/DolphinWX/Input/InputConfigDiag.h index 09c2a011d1..d89aae5481 100644 --- a/Source/Core/DolphinWX/Input/InputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/InputConfigDiag.h @@ -23,8 +23,8 @@ #include #include +#include "InputCommon/ControlReference/ControlReference.h" #include "InputCommon/ControllerEmu/ControllerEmu.h" -#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/Device.h" class DolphinSlider; @@ -100,14 +100,13 @@ class InputConfigDialog; class ControlDialog : public wxDialog { public: - ControlDialog(InputConfigDialog* const parent, InputConfig& config, - ControllerInterface::ControlReference* const ref); + ControlDialog(InputConfigDialog* const parent, InputConfig& config, ControlReference* const ref); bool Validate() override; int GetRangeSliderValue() const; - ControllerInterface::ControlReference* const control_reference; + ControlReference* const control_reference; InputConfig& m_config; private: @@ -151,10 +150,10 @@ public: class ControlButton : public wxButton { public: - ControlButton(wxWindow* const parent, ControllerInterface::ControlReference* const _ref, - const std::string& name, const unsigned int width, const std::string& label = {}); + ControlButton(wxWindow* const parent, ControlReference* const _ref, const std::string& name, + const unsigned int width, const std::string& label = {}); - ControllerInterface::ControlReference* const control_reference; + ControlReference* const control_reference; const std::string m_name; protected: diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index 658ce9f215..0c408a6567 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -2,7 +2,9 @@ set(SRCS InputConfig.cpp ControllerEmu/ControllerEmu.cpp ControllerInterface/ControllerInterface.cpp ControllerInterface/Device.cpp - ControllerInterface/ExpressionParser.cpp) + ControlReference/ControlReference.cpp + ControlReference/ExpressionParser.cpp +) set(LIBS common) if(WIN32) diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.cpp b/Source/Core/InputCommon/ControlReference/ControlReference.cpp new file mode 100644 index 0000000000..4268531668 --- /dev/null +++ b/Source/Core/InputCommon/ControlReference/ControlReference.cpp @@ -0,0 +1,148 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "Common/Thread.h" +// For InputGateOn() +// This is a bad layering violation, but it's the cleanest +// place I could find to put it. +#include "Core/ConfigManager.h" +#include "Core/Host.h" + +#include "InputCommon/ControlReference/ControlReference.h" + +using namespace ciface::ExpressionParser; + +constexpr ControlState INPUT_DETECT_THRESHOLD = 0.55; + +bool ControlReference::InputGateOn() +{ + return SConfig::GetInstance().m_BackgroundInput || Host_RendererHasFocus() || Host_UIHasFocus(); +} + +// +// UpdateReference +// +// Updates a controlreference's binded devices/controls +// need to call this to re-parse a control reference's expression after changing it +// +void ControlReference::UpdateReference(ciface::Core::DeviceContainer& devices, + const ciface::Core::DeviceQualifier& default_device) +{ + delete parsed_expression; + parsed_expression = nullptr; + + ControlFinder finder(devices, default_device, is_input); + parse_error = ParseExpression(expression, finder, &parsed_expression); +} + +// +// InputReference :: State +// +// Gets the state of an input reference +// override function for ControlReference::State ... +// +ControlState InputReference::State(const ControlState ignore) +{ + if (parsed_expression && InputGateOn()) + return parsed_expression->GetValue() * range; + return 0.0; +} + +// +// OutputReference :: State +// +// Set the state of all binded outputs +// overrides ControlReference::State .. combined them so I could make the GUI simple / inputs == +// same as outputs one list +// I was lazy and it works so watever +// +ControlState OutputReference::State(const ControlState state) +{ + if (parsed_expression && InputGateOn()) + parsed_expression->SetValue(state); + return 0.0; +} + +// +// InputReference :: Detect +// +// Wait for input on all binded devices +// supports not detecting inputs that were held down at the time of Detect start, +// which is useful for those crazy flightsticks that have certain buttons that are always held down +// or some crazy axes or something +// upon input, return pointer to detected Control +// else return nullptr +// +ciface::Core::Device::Control* InputReference::Detect(const unsigned int ms, + ciface::Core::Device* const device) +{ + unsigned int time = 0; + std::vector states(device->Inputs().size()); + + if (device->Inputs().size() == 0) + return nullptr; + + // get starting state of all inputs, + // so we can ignore those that were activated at time of Detect start + std::vector::const_iterator i = device->Inputs().begin(), + e = device->Inputs().end(); + for (std::vector::iterator state = states.begin(); i != e; ++i) + *state++ = ((*i)->GetState() > (1 - INPUT_DETECT_THRESHOLD)); + + while (time < ms) + { + device->UpdateInput(); + i = device->Inputs().begin(); + for (std::vector::iterator state = states.begin(); i != e; ++i, ++state) + { + // detected an input + if ((*i)->IsDetectable() && (*i)->GetState() > INPUT_DETECT_THRESHOLD) + { + // input was released at some point during Detect call + // return the detected input + if (false == *state) + return *i; + } + else if ((*i)->GetState() < (1 - INPUT_DETECT_THRESHOLD)) + { + *state = false; + } + } + Common::SleepCurrentThread(10); + time += 10; + } + + // no input was detected + return nullptr; +} + +// +// OutputReference :: Detect +// +// Totally different from the inputReference detect / I have them combined so it was simpler to make +// the GUI. +// The GUI doesn't know the difference between an input and an output / it's odd but I was lazy and +// it was easy +// +// set all binded outputs to power for x milliseconds return false +// +ciface::Core::Device::Control* OutputReference::Detect(const unsigned int ms, + ciface::Core::Device* const device) +{ + // ignore device + + // don't hang if we don't even have any controls mapped + if (BoundCount() > 0) + { + State(1); + unsigned int slept = 0; + + // this loop is to make stuff like flashing keyboard LEDs work + while (ms > (slept += 10)) + Common::SleepCurrentThread(10); + + State(0); + } + return nullptr; +} diff --git a/Source/Core/InputCommon/ControlReference/ControlReference.h b/Source/Core/InputCommon/ControlReference/ControlReference.h new file mode 100644 index 0000000000..335675e5eb --- /dev/null +++ b/Source/Core/InputCommon/ControlReference/ControlReference.h @@ -0,0 +1,79 @@ +// Copyright 2016 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include "InputCommon/ControlReference/ExpressionParser.h" +#include "InputCommon/ControllerInterface/Device.h" + +// ControlReference +// +// These are what you create to actually use the inputs, InputReference or OutputReference. +// +// After being bound to devices and controls with UpdateReference, +// each one can link to multiple devices and controls +// when you change a ControlReference's expression, +// you must use UpdateReference on it to rebind controls +// + +class ControlReference +{ +public: + static bool InputGateOn(); + + virtual ControlState State(const ControlState state = 0) = 0; + virtual ciface::Core::Device::Control* Detect(const unsigned int ms, + ciface::Core::Device* const device) = 0; + + void UpdateReference(ciface::Core::DeviceContainer& devices, + const ciface::Core::DeviceQualifier& default_device); + + ControlState range; + std::string expression; + const bool is_input; + ciface::ExpressionParser::ExpressionParseStatus parse_error; + + virtual ~ControlReference() { delete parsed_expression; } + int BoundCount() + { + if (parsed_expression) + return parsed_expression->num_controls; + else + return 0; + } + +protected: + ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(nullptr) + { + } + ciface::ExpressionParser::Expression* parsed_expression; +}; + +// +// InputReference +// +// Control reference for inputs +// +class InputReference : public ControlReference +{ +public: + InputReference() : ControlReference(true) {} + ControlState State(const ControlState state) override; + ciface::Core::Device::Control* Detect(const unsigned int ms, + ciface::Core::Device* const device) override; +}; + +// +// OutputReference +// +// Control reference for outputs +// +class OutputReference : public ControlReference +{ +public: + OutputReference() : ControlReference(false) {} + ControlState State(const ControlState state) override; + ciface::Core::Device::Control* Detect(const unsigned int ms, + ciface::Core::Device* const device) override; +}; diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp similarity index 99% rename from Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp rename to Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index 5e4c2375af..47fbd001a6 100644 --- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -10,7 +10,7 @@ #include #include -#include "InputCommon/ControllerInterface/ExpressionParser.h" +#include "InputCommon/ControlReference/ExpressionParser.h" using namespace ciface::Core; @@ -241,8 +241,8 @@ public: { } - ControlState GetValue() override { return control->ToInput()->GetGatedState(); } - void SetValue(ControlState value) override { control->ToOutput()->SetGatedState(value); } + ControlState GetValue() override { return control->ToInput()->GetState(); } + void SetValue(ControlState value) override { control->ToOutput()->SetState(value); } int CountNumControls() override { return 1; } operator std::string() override { return "`" + (std::string)qualifier + "`"; } private: diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/ControlReference/ExpressionParser.h similarity index 100% rename from Source/Core/InputCommon/ControllerInterface/ExpressionParser.h rename to Source/Core/InputCommon/ControlReference/ExpressionParser.h diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp index e66e682e48..4421353aa6 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.cpp @@ -23,7 +23,7 @@ void ControllerEmu::UpdateReferences(ControllerInterface& devi) for (auto& ctrlGroup : groups) { for (auto& control : ctrlGroup->controls) - devi.UpdateReference(control->control_ref.get(), default_device); + control->control_ref.get()->UpdateReference(devi, default_device); // extension if (ctrlGroup->type == GROUP_TYPE_EXTENSION) diff --git a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h index 3dc028da15..65332ac87f 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu/ControllerEmu.h @@ -14,6 +14,7 @@ #include "Common/IniFile.h" #include "Common/MathUtil.h" #include "Core/ConfigManager.h" +#include "InputCommon/ControlReference/ControlReference.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/GCPadStatus.h" @@ -50,27 +51,27 @@ public: class Control { protected: - Control(ControllerInterface::ControlReference* const _ref, const std::string& _name) + Control(ControlReference* const _ref, const std::string& _name) : control_ref(_ref), name(_name) { } public: virtual ~Control() {} - std::unique_ptr const control_ref; + std::unique_ptr const control_ref; const std::string name; }; class Input : public Control { public: - Input(const std::string& _name) : Control(new ControllerInterface::InputReference, _name) {} + Input(const std::string& _name) : Control(new InputReference, _name) {} }; class Output : public Control { public: - Output(const std::string& _name) : Control(new ControllerInterface::OutputReference, _name) {} + Output(const std::string& _name) : Control(new OutputReference, _name) {} }; enum class SettingType diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 635284d2c5..1a72fa172c 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -4,7 +4,6 @@ #include -#include "Common/Thread.h" #include "InputCommon/ControllerInterface/ControllerInterface.h" #ifdef CIFACE_USE_XINPUT @@ -33,13 +32,6 @@ #include "InputCommon/ControllerInterface/Pipes/Pipes.h" #endif -using namespace ciface::ExpressionParser; - -namespace -{ -const ControlState INPUT_DETECT_THRESHOLD = 0.55; -} - ControllerInterface g_controller_interface; // @@ -236,133 +228,3 @@ void ControllerInterface::InvokeHotplugCallbacks() const for (const auto& callback : m_hotplug_callbacks) callback(); } - -// -// InputReference :: State -// -// Gets the state of an input reference -// override function for ControlReference::State ... -// -ControlState ControllerInterface::InputReference::State(const ControlState ignore) -{ - if (parsed_expression) - return parsed_expression->GetValue() * range; - else - return 0.0; -} - -// -// OutputReference :: State -// -// Set the state of all binded outputs -// overrides ControlReference::State .. combined them so I could make the GUI simple / inputs == -// same as outputs one list -// I was lazy and it works so watever -// -ControlState ControllerInterface::OutputReference::State(const ControlState state) -{ - if (parsed_expression) - parsed_expression->SetValue(state); - return 0.0; -} - -// -// UpdateReference -// -// Updates a controlreference's binded devices/controls -// need to call this to re-parse a control reference's expression after changing it -// -void ControllerInterface::UpdateReference(ControllerInterface::ControlReference* ref, - const ciface::Core::DeviceQualifier& default_device) const -{ - delete ref->parsed_expression; - ref->parsed_expression = nullptr; - - ControlFinder finder(*this, default_device, ref->is_input); - ref->parse_error = ParseExpression(ref->expression, finder, &ref->parsed_expression); -} - -// -// InputReference :: Detect -// -// Wait for input on all binded devices -// supports not detecting inputs that were held down at the time of Detect start, -// which is useful for those crazy flightsticks that have certain buttons that are always held down -// or some crazy axes or something -// upon input, return pointer to detected Control -// else return nullptr -// -ciface::Core::Device::Control* -ControllerInterface::InputReference::Detect(const unsigned int ms, - ciface::Core::Device* const device) -{ - unsigned int time = 0; - std::vector states(device->Inputs().size()); - - if (device->Inputs().size() == 0) - return nullptr; - - // get starting state of all inputs, - // so we can ignore those that were activated at time of Detect start - std::vector::const_iterator i = device->Inputs().begin(), - e = device->Inputs().end(); - for (std::vector::iterator state = states.begin(); i != e; ++i) - *state++ = ((*i)->GetState() > (1 - INPUT_DETECT_THRESHOLD)); - - while (time < ms) - { - device->UpdateInput(); - i = device->Inputs().begin(); - for (std::vector::iterator state = states.begin(); i != e; ++i, ++state) - { - // detected an input - if ((*i)->IsDetectable() && (*i)->GetState() > INPUT_DETECT_THRESHOLD) - { - // input was released at some point during Detect call - // return the detected input - if (false == *state) - return *i; - } - else if ((*i)->GetState() < (1 - INPUT_DETECT_THRESHOLD)) - { - *state = false; - } - } - Common::SleepCurrentThread(10); - time += 10; - } - - // no input was detected - return nullptr; -} - -// -// OutputReference :: Detect -// -// Totally different from the inputReference detect / I have them combined so it was simpler to make -// the GUI. -// The GUI doesn't know the difference between an input and an output / it's odd but I was lazy and -// it was easy -// -// set all binded outputs to power for x milliseconds return false -// -ciface::Core::Device::Control* -ControllerInterface::OutputReference::Detect(const unsigned int ms, - ciface::Core::Device* const device) -{ - // ignore device - - // don't hang if we don't even have any controls mapped - if (BoundCount() > 0) - { - State(1); - unsigned int slept = 0; - - // this loop is to make stuff like flashing keyboard LEDs work - while (ms > (slept += 10)) - Common::SleepCurrentThread(10); - - State(0); - } - return nullptr; -} diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 845c6cbbf6..d9d85cdd77 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -11,9 +11,7 @@ #include #include "Common/CommonTypes.h" -#include "Common/Thread.h" #include "InputCommon/ControllerInterface/Device.h" -#include "InputCommon/ControllerInterface/ExpressionParser.h" // enable disable sources #ifdef _WIN32 @@ -45,75 +43,6 @@ class ControllerInterface : public ciface::Core::DeviceContainer { public: - // - // ControlReference - // - // These are what you create to actually use the inputs, InputReference or OutputReference. - // - // After being bound to devices and controls with ControllerInterface::UpdateReference, - // each one can link to multiple devices and controls - // when you change a ControlReference's expression, - // you must use ControllerInterface::UpdateReference on it to rebind controls - // - class ControlReference - { - friend class ControllerInterface; - - public: - virtual ControlState State(const ControlState state = 0) = 0; - virtual ciface::Core::Device::Control* Detect(const unsigned int ms, - ciface::Core::Device* const device) = 0; - - ControlState range; - std::string expression; - const bool is_input; - ciface::ExpressionParser::ExpressionParseStatus parse_error; - - virtual ~ControlReference() { delete parsed_expression; } - int BoundCount() - { - if (parsed_expression) - return parsed_expression->num_controls; - else - return 0; - } - - protected: - ControlReference(const bool _is_input) - : range(1), is_input(_is_input), parsed_expression(nullptr) - { - } - ciface::ExpressionParser::Expression* parsed_expression; - }; - - // - // InputReference - // - // Control reference for inputs - // - class InputReference : public ControlReference - { - public: - InputReference() : ControlReference(true) {} - ControlState State(const ControlState state) override; - ciface::Core::Device::Control* Detect(const unsigned int ms, - ciface::Core::Device* const device) override; - }; - - // - // OutputReference - // - // Control reference for outputs - // - class OutputReference : public ControlReference - { - public: - OutputReference() : ControlReference(false) {} - ControlState State(const ControlState state) override; - ciface::Core::Device::Control* Detect(const unsigned int ms, - ciface::Core::Device* const device) override; - }; - ControllerInterface() : m_is_init(false), m_hwnd(nullptr) {} void Initialize(void* const hwnd); void RefreshDevices(); @@ -121,8 +50,6 @@ public: void AddDevice(std::shared_ptr device); void RemoveDevice(std::function callback); bool IsInit() const { return m_is_init; } - void UpdateReference(ControlReference* control, - const ciface::Core::DeviceQualifier& default_device) const; void UpdateInput(); void RegisterHotplugCallback(std::function callback); diff --git a/Source/Core/InputCommon/ControllerInterface/Device.cpp b/Source/Core/InputCommon/ControllerInterface/Device.cpp index 401e5b035b..930352a908 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Device.cpp @@ -7,12 +7,6 @@ #include #include -// For InputGateOn() -// This is a really bad layering violation, but it's the cleanest -// place I could find to put it. -#include "Core/ConfigManager.h" -#include "Core/Host.h" - #include "InputCommon/ControllerInterface/Device.h" namespace ciface @@ -67,16 +61,6 @@ Device::Output* Device::FindOutput(const std::string& name) const return nullptr; } -bool Device::Control::InputGateOn() -{ - if (SConfig::GetInstance().m_BackgroundInput) - return true; - else if (Host_RendererHasFocus() || Host_UIHasFocus()) - return true; - else - return false; -} - // // DeviceQualifier :: ToString // diff --git a/Source/Core/InputCommon/ControllerInterface/Device.h b/Source/Core/InputCommon/ControllerInterface/Device.h index 657ece5016..bda6f1fb0a 100644 --- a/Source/Core/InputCommon/ControllerInterface/Device.h +++ b/Source/Core/InputCommon/ControllerInterface/Device.h @@ -42,8 +42,6 @@ public: public: virtual std::string GetName() const = 0; virtual ~Control() {} - bool InputGateOn(); - virtual Input* ToInput() { return nullptr; } virtual Output* ToOutput() { return nullptr; } }; @@ -59,15 +57,6 @@ public: // things like absolute axes/ absolute mouse position will override this virtual bool IsDetectable() { return true; } virtual ControlState GetState() const = 0; - - ControlState GetGatedState() - { - if (InputGateOn()) - return GetState(); - else - return 0.0; - } - Input* ToInput() override { return this; } }; @@ -81,13 +70,6 @@ public: public: virtual ~Output() {} virtual void SetState(ControlState state) = 0; - - void SetGatedState(ControlState state) - { - if (InputGateOn()) - SetState(state); - } - Output* ToOutput() override { return this; } }; diff --git a/Source/Core/InputCommon/InputCommon.vcxproj b/Source/Core/InputCommon/InputCommon.vcxproj index 96e0bad04e..0f961839d7 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj +++ b/Source/Core/InputCommon/InputCommon.vcxproj @@ -42,7 +42,8 @@ - + + @@ -63,7 +64,8 @@ - + + diff --git a/Source/Core/InputCommon/InputCommon.vcxproj.filters b/Source/Core/InputCommon/InputCommon.vcxproj.filters index 046e66f571..1287497f01 100644 --- a/Source/Core/InputCommon/InputCommon.vcxproj.filters +++ b/Source/Core/InputCommon/InputCommon.vcxproj.filters @@ -41,15 +41,18 @@ ControllerInterface - - ControllerInterface - ControllerInterface\ForceFeedback ControllerInterface\DInput + + ControllerInterface + + + ControllerInterface + @@ -76,9 +79,6 @@ ControllerInterface - - ControllerInterface - ControllerInterface\ForceFeedback @@ -88,6 +88,12 @@ ControllerInterface\DInput + + ControllerInterface + + + ControllerInterface +