diff options
| author | 2020-07-22 10:39:53 -0400 | |
|---|---|---|
| committer | 2020-08-26 02:32:32 -0400 | |
| commit | f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01 (patch) | |
| tree | 4438688a9b9b4bc015985f2df1a731de57fe50db /src/input_common/main.h | |
| parent | Merge pull request #4582 from lioncash/xbyak (diff) | |
| download | yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.gz yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.xz yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.zip | |
Project Mjölnir: Part 1
Co-authored-by: James Rowe <jroweboy@gmail.com>
Co-authored-by: Its-Rei <kupfel@gmail.com>
Diffstat (limited to 'src/input_common/main.h')
| -rw-r--r-- | src/input_common/main.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/input_common/main.h b/src/input_common/main.h index 0e32856f6..ebc7f9533 100644 --- a/src/input_common/main.h +++ b/src/input_common/main.h | |||
| @@ -6,8 +6,10 @@ | |||
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include <unordered_map> | ||
| 9 | #include <vector> | 10 | #include <vector> |
| 10 | #include "input_common/gcadapter/gc_poller.h" | 11 | #include "input_common/gcadapter/gc_poller.h" |
| 12 | #include "input_common/settings.h" | ||
| 11 | 13 | ||
| 12 | namespace Common { | 14 | namespace Common { |
| 13 | class ParamPackage; | 15 | class ParamPackage; |
| @@ -42,9 +44,27 @@ std::string GenerateKeyboardParam(int key_code); | |||
| 42 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, | 44 | std::string GenerateAnalogParamFromKeys(int key_up, int key_down, int key_left, int key_right, |
| 43 | int key_modifier, float modifier_scale); | 45 | int key_modifier, float modifier_scale); |
| 44 | 46 | ||
| 47 | /** | ||
| 48 | * Return a list of available input devices that this Factory can create a new device with. | ||
| 49 | * Each returned Parampackage should have a `display` field used for display, a class field for | ||
| 50 | * backends to determine if this backend is meant to service the request and any other information | ||
| 51 | * needed to identify this in the backend later. | ||
| 52 | */ | ||
| 53 | std::vector<Common::ParamPackage> GetInputDevices(); | ||
| 54 | |||
| 55 | /** | ||
| 56 | * Given a ParamPackage for a Device returned from `GetInputDevices`, attempt to get the default | ||
| 57 | * mapping for the device. This is currently only implemented for the sdl backend devices. | ||
| 58 | */ | ||
| 59 | using ButtonMapping = std::unordered_map<Settings::NativeButton::Values, Common::ParamPackage>; | ||
| 60 | using AnalogMapping = std::unordered_map<Settings::NativeAnalog::Values, Common::ParamPackage>; | ||
| 61 | |||
| 62 | ButtonMapping GetButtonMappingForDevice(const Common::ParamPackage&); | ||
| 63 | AnalogMapping GetAnalogMappingForDevice(const Common::ParamPackage&); | ||
| 64 | |||
| 45 | namespace Polling { | 65 | namespace Polling { |
| 46 | 66 | ||
| 47 | enum class DeviceType { Button, Analog }; | 67 | enum class DeviceType { Button, AnalogPreferred }; |
| 48 | 68 | ||
| 49 | /** | 69 | /** |
| 50 | * A class that can be used to get inputs from an input device like controllers without having to | 70 | * A class that can be used to get inputs from an input device like controllers without having to |
| @@ -54,7 +74,9 @@ class DevicePoller { | |||
| 54 | public: | 74 | public: |
| 55 | virtual ~DevicePoller() = default; | 75 | virtual ~DevicePoller() = default; |
| 56 | /// Setup and start polling for inputs, should be called before GetNextInput | 76 | /// Setup and start polling for inputs, should be called before GetNextInput |
| 57 | virtual void Start() = 0; | 77 | /// If a device_id is provided, events should be filtered to only include events from this |
| 78 | /// device id | ||
| 79 | virtual void Start(std::string device_id = "") = 0; | ||
| 58 | /// Stop polling | 80 | /// Stop polling |
| 59 | virtual void Stop() = 0; | 81 | virtual void Stop() = 0; |
| 60 | /** | 82 | /** |