summaryrefslogtreecommitdiff
path: root/src/core/hid/emulated_controller.h
diff options
context:
space:
mode:
authorGravatar bunnei2021-12-04 23:08:43 -0800
committerGravatar GitHub2021-12-04 23:08:43 -0800
commit60e923046e07657f7bbae4b0342efad6c3641252 (patch)
tree0527ae35ff85e56adc4201d3e3204ec53bfeddb6 /src/core/hid/emulated_controller.h
parentMerge pull request #7467 from liushuyu/fix-linux-decoding (diff)
parentcore/hid: Ensure only valid npad are connected (diff)
downloadyuzu-60e923046e07657f7bbae4b0342efad6c3641252.tar.gz
yuzu-60e923046e07657f7bbae4b0342efad6c3641252.tar.xz
yuzu-60e923046e07657f7bbae4b0342efad6c3641252.zip
Merge pull request #7503 from german77/is_npad_valid
core/hid: Ensure only valid npad are connected
Diffstat (limited to 'src/core/hid/emulated_controller.h')
-rw-r--r--src/core/hid/emulated_controller.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index 5887e3e38..425b3e7c4 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -160,6 +160,13 @@ public:
160 */ 160 */
161 NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const; 161 NpadStyleIndex GetNpadStyleIndex(bool get_temporary_value = false) const;
162 162
163 /**
164 * Sets the supported controller types. Disconnects the controller if current type is not
165 * supported
166 * @param supported_styles bitflag with supported types
167 */
168 void SetSupportedNpadStyleTag(NpadStyleTag supported_styles);
169
163 /// Sets the connected status to true 170 /// Sets the connected status to true
164 void Connect(); 171 void Connect();
165 172
@@ -311,6 +318,12 @@ private:
311 void LoadTASParams(); 318 void LoadTASParams();
312 319
313 /** 320 /**
321 * Checks the current controller type against the supported_style_tag
322 * @return true if the controller is supported
323 */
324 bool IsControllerSupported() const;
325
326 /**
314 * Updates the button status of the controller 327 * Updates the button status of the controller
315 * @param callback A CallbackStatus containing the button status 328 * @param callback A CallbackStatus containing the button status
316 * @param index Button ID of the to be updated 329 * @param index Button ID of the to be updated
@@ -354,6 +367,7 @@ private:
354 367
355 NpadIdType npad_id_type; 368 NpadIdType npad_id_type;
356 NpadStyleIndex npad_type{NpadStyleIndex::None}; 369 NpadStyleIndex npad_type{NpadStyleIndex::None};
370 NpadStyleTag supported_style_tag{NpadStyleSet::All};
357 bool is_connected{false}; 371 bool is_connected{false};
358 bool is_configuring{false}; 372 bool is_configuring{false};
359 f32 motion_sensitivity{0.01f}; 373 f32 motion_sensitivity{0.01f};