mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 07:35:41 +00:00
Controller: Make InAnalogMode() virtual
This commit is contained in:
parent
21da5036c0
commit
4feb5ad548
|
@ -23,6 +23,11 @@ ControllerType AnalogController::GetType() const
|
||||||
return ControllerType::AnalogController;
|
return ControllerType::AnalogController;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AnalogController::InAnalogMode() const
|
||||||
|
{
|
||||||
|
return m_analog_mode;
|
||||||
|
}
|
||||||
|
|
||||||
void AnalogController::Reset()
|
void AnalogController::Reset()
|
||||||
{
|
{
|
||||||
m_command = Command::Idle;
|
m_command = Command::Idle;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
static std::unique_ptr<AnalogController> Create(u32 index);
|
static std::unique_ptr<AnalogController> Create(u32 index);
|
||||||
|
|
||||||
ControllerType GetType() const override;
|
ControllerType GetType() const override;
|
||||||
bool InAnalogMode() const { return m_analog_mode; }
|
bool InAnalogMode() const override;
|
||||||
|
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
bool DoState(StateWrapper& sw, bool ignore_input_state) override;
|
bool DoState(StateWrapper& sw, bool ignore_input_state) override;
|
||||||
|
|
|
@ -20,6 +20,11 @@ ControllerType AnalogJoystick::GetType() const
|
||||||
return ControllerType::AnalogJoystick;
|
return ControllerType::AnalogJoystick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AnalogJoystick::InAnalogMode() const
|
||||||
|
{
|
||||||
|
return m_analog_mode;
|
||||||
|
}
|
||||||
|
|
||||||
void AnalogJoystick::Reset()
|
void AnalogJoystick::Reset()
|
||||||
{
|
{
|
||||||
m_transfer_state = TransferState::Idle;
|
m_transfer_state = TransferState::Idle;
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
static std::unique_ptr<AnalogJoystick> Create(u32 index);
|
static std::unique_ptr<AnalogJoystick> Create(u32 index);
|
||||||
|
|
||||||
ControllerType GetType() const override;
|
ControllerType GetType() const override;
|
||||||
|
bool InAnalogMode() const override;
|
||||||
|
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
bool DoState(StateWrapper& sw, bool apply_input_state) override;
|
bool DoState(StateWrapper& sw, bool apply_input_state) override;
|
||||||
|
|
|
@ -53,6 +53,11 @@ u32 Controller::GetButtonStateBits() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Controller::InAnalogMode() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::optional<u32> Controller::GetAnalogInputBytes() const
|
std::optional<u32> Controller::GetAnalogInputBytes() const
|
||||||
{
|
{
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
@ -86,6 +86,9 @@ public:
|
||||||
/// Returns a bitmask of the current button states, 1 = on.
|
/// Returns a bitmask of the current button states, 1 = on.
|
||||||
virtual u32 GetButtonStateBits() const;
|
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.
|
/// Returns analog input bytes packed as a u32. Values are specific to controller type.
|
||||||
virtual std::optional<u32> GetAnalogInputBytes() const;
|
virtual std::optional<u32> GetAnalogInputBytes() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue