diff --git a/src/core/analog_controller.cpp b/src/core/analog_controller.cpp index f2240e95f..fa939f92c 100644 --- a/src/core/analog_controller.cpp +++ b/src/core/analog_controller.cpp @@ -23,6 +23,11 @@ ControllerType AnalogController::GetType() const return ControllerType::AnalogController; } +bool AnalogController::InAnalogMode() const +{ + return m_analog_mode; +} + void AnalogController::Reset() { m_command = Command::Idle; diff --git a/src/core/analog_controller.h b/src/core/analog_controller.h index 01d4d716e..404cc6194 100644 --- a/src/core/analog_controller.h +++ b/src/core/analog_controller.h @@ -62,7 +62,7 @@ public: static std::unique_ptr Create(u32 index); ControllerType GetType() const override; - bool InAnalogMode() const { return m_analog_mode; } + bool InAnalogMode() const override; void Reset() override; bool DoState(StateWrapper& sw, bool ignore_input_state) override; diff --git a/src/core/analog_joystick.cpp b/src/core/analog_joystick.cpp index 353a40eda..a0714cf17 100644 --- a/src/core/analog_joystick.cpp +++ b/src/core/analog_joystick.cpp @@ -20,6 +20,11 @@ ControllerType AnalogJoystick::GetType() const return ControllerType::AnalogJoystick; } +bool AnalogJoystick::InAnalogMode() const +{ + return m_analog_mode; +} + void AnalogJoystick::Reset() { m_transfer_state = TransferState::Idle; diff --git a/src/core/analog_joystick.h b/src/core/analog_joystick.h index 96b5f84c6..6b1769cf9 100644 --- a/src/core/analog_joystick.h +++ b/src/core/analog_joystick.h @@ -60,6 +60,7 @@ public: static std::unique_ptr Create(u32 index); ControllerType GetType() const override; + bool InAnalogMode() const override; void Reset() override; bool DoState(StateWrapper& sw, bool apply_input_state) override; diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 5cccc27c4..af83d582b 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -53,6 +53,11 @@ u32 Controller::GetButtonStateBits() const return 0; } +bool Controller::InAnalogMode() const +{ + return false; +} + std::optional Controller::GetAnalogInputBytes() const { return std::nullopt; diff --git a/src/core/controller.h b/src/core/controller.h index 4cc12866d..a06de77a7 100644 --- a/src/core/controller.h +++ b/src/core/controller.h @@ -86,6 +86,9 @@ public: /// Returns a bitmask of the current button states, 1 = on. virtual u32 GetButtonStateBits() const; + /// Returns true if the controller supports analog mode, and it is active. + virtual bool InAnalogMode() const; + /// Returns analog input bytes packed as a u32. Values are specific to controller type. virtual std::optional GetAnalogInputBytes() const;