Qt/Input: implement blacklist to Filter Noise in pad dialog

This commit is contained in:
Unknown 2017-11-30 00:43:52 +01:00 committed by Ivan
parent c04c23f33d
commit 853c3f9e39
12 changed files with 263 additions and 158 deletions

View file

@ -107,7 +107,7 @@ public:
std::vector<std::string> ListDevices() override;
bool bindPadToDevice(std::shared_ptr<Pad> pad, const std::string& device) override;
void ThreadProc() override;
void GetNextButtonPress(const std::string& padId, const std::function<void(u16, std::string, int[])>& callback) override;
void GetNextButtonPress(const std::string& padId, const std::function<void(u16, std::string, int[])>& callback, bool get_blacklist = false) override;
void TestVibration(const std::string& padId, u32 largeMotor, u32 smallMotor) override;
private:
@ -117,6 +117,7 @@ private:
typedef DWORD (WINAPI * PFN_XINPUTGETBATTERYINFORMATION)(DWORD, BYTE, XINPUT_BATTERY_INFORMATION *);
private:
int GetDeviceNumber(const std::string& padId);
std::array<u16, XInputKeyCodes::KeyCodeCount> GetButtonValues(const XINPUT_STATE& state);
void TranslateButtonPress(u64 keyCode, bool& pressed, u16& val, bool ignore_threshold = false) override;
@ -127,6 +128,7 @@ private:
PFN_XINPUTENABLE xinputEnable;
PFN_XINPUTGETBATTERYINFORMATION xinputGetBatteryInformation;
std::vector<u32> blacklist;
std::vector<std::pair<std::shared_ptr<XInputDevice>, std::shared_ptr<Pad>>> bindings;
std::array<bool, 7> last_connection_status = {};