core/hid: Ensure only valid npad are connected

This commit is contained in:
german77 2021-12-04 19:37:03 -06:00
parent e482dd82b9
commit 7fe455e42e
8 changed files with 156 additions and 97 deletions

View file

@ -160,6 +160,13 @@ public:
*/
NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const;
/**
* Sets the supported controller types. Disconnects the controller if current type is not
* supported
* @param supported_styles bitflag with supported types
*/
void SetSupportedNpadStyleTag(NpadStyleTag supported_styles);
/// Sets the connected status to true
void Connect();
@ -310,6 +317,12 @@ private:
/// Set the params for TAS devices
void LoadTASParams();
/**
* Checks the current controller type against the supported_style_tag
* @return true if the controller is supported
*/
bool IsControllerSupported() const;
/**
* Updates the button status of the controller
* @param callback A CallbackStatus containing the button status
@ -354,6 +367,7 @@ private:
NpadIdType npad_id_type;
NpadStyleIndex npad_type{NpadStyleIndex::None};
NpadStyleTag supported_style_tag{NpadStyleSet::All};
bool is_connected{false};
bool is_configuring{false};
f32 motion_sensitivity{0.01f};