diff options
| author | 2022-01-25 16:15:45 -0500 | |
|---|---|---|
| committer | 2022-01-25 16:15:45 -0500 | |
| commit | 432f4441b9420778970d9846750ff1458e6aaa03 (patch) | |
| tree | 3b500254540c0df824342b8f7dd737931ce446ab /src/input_common/input_mapping.cpp | |
| parent | Merge pull request #7773 from lioncash/udp-deprecated (diff) | |
| parent | input_common/input_engine: Ensure PadIdentifier UUIDs have a valid initial state (diff) | |
| download | yuzu-432f4441b9420778970d9846750ff1458e6aaa03.tar.gz yuzu-432f4441b9420778970d9846750ff1458e6aaa03.tar.xz yuzu-432f4441b9420778970d9846750ff1458e6aaa03.zip | |
Merge pull request #7774 from lioncash/mapping
input_common/main: Pass MappingData by const reference in callbacks
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/input_mapping.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp index 475257f42..a7a6ad8c2 100644 --- a/src/input_common/input_mapping.cpp +++ b/src/input_common/input_mapping.cpp | |||
| @@ -2,14 +2,13 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included | 3 | // Refer to the license.txt file included |
| 4 | 4 | ||
| 5 | #include "common/common_types.h" | ||
| 6 | #include "common/settings.h" | 5 | #include "common/settings.h" |
| 7 | #include "input_common/input_engine.h" | 6 | #include "input_common/input_engine.h" |
| 8 | #include "input_common/input_mapping.h" | 7 | #include "input_common/input_mapping.h" |
| 9 | 8 | ||
| 10 | namespace InputCommon { | 9 | namespace InputCommon { |
| 11 | 10 | ||
| 12 | MappingFactory::MappingFactory() {} | 11 | MappingFactory::MappingFactory() = default; |
| 13 | 12 | ||
| 14 | void MappingFactory::BeginMapping(Polling::InputType type) { | 13 | void MappingFactory::BeginMapping(Polling::InputType type) { |
| 15 | is_enabled = true; | 14 | is_enabled = true; |
| @@ -19,7 +18,7 @@ void MappingFactory::BeginMapping(Polling::InputType type) { | |||
| 19 | second_axis = -1; | 18 | second_axis = -1; |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | [[nodiscard]] const Common::ParamPackage MappingFactory::GetNextInput() { | 21 | Common::ParamPackage MappingFactory::GetNextInput() { |
| 23 | Common::ParamPackage input; | 22 | Common::ParamPackage input; |
| 24 | input_queue.Pop(input); | 23 | input_queue.Pop(input); |
| 25 | return input; | 24 | return input; |
| @@ -57,7 +56,7 @@ void MappingFactory::StopMapping() { | |||
| 57 | void MappingFactory::RegisterButton(const MappingData& data) { | 56 | void MappingFactory::RegisterButton(const MappingData& data) { |
| 58 | Common::ParamPackage new_input; | 57 | Common::ParamPackage new_input; |
| 59 | new_input.Set("engine", data.engine); | 58 | new_input.Set("engine", data.engine); |
| 60 | if (data.pad.guid != Common::UUID{}) { | 59 | if (data.pad.guid.IsValid()) { |
| 61 | new_input.Set("guid", data.pad.guid.Format()); | 60 | new_input.Set("guid", data.pad.guid.Format()); |
| 62 | } | 61 | } |
| 63 | new_input.Set("port", static_cast<int>(data.pad.port)); | 62 | new_input.Set("port", static_cast<int>(data.pad.port)); |
| @@ -93,7 +92,7 @@ void MappingFactory::RegisterButton(const MappingData& data) { | |||
| 93 | void MappingFactory::RegisterStick(const MappingData& data) { | 92 | void MappingFactory::RegisterStick(const MappingData& data) { |
| 94 | Common::ParamPackage new_input; | 93 | Common::ParamPackage new_input; |
| 95 | new_input.Set("engine", data.engine); | 94 | new_input.Set("engine", data.engine); |
| 96 | if (data.pad.guid != Common::UUID{}) { | 95 | if (data.pad.guid.IsValid()) { |
| 97 | new_input.Set("guid", data.pad.guid.Format()); | 96 | new_input.Set("guid", data.pad.guid.Format()); |
| 98 | } | 97 | } |
| 99 | new_input.Set("port", static_cast<int>(data.pad.port)); | 98 | new_input.Set("port", static_cast<int>(data.pad.port)); |
| @@ -138,7 +137,7 @@ void MappingFactory::RegisterStick(const MappingData& data) { | |||
| 138 | void MappingFactory::RegisterMotion(const MappingData& data) { | 137 | void MappingFactory::RegisterMotion(const MappingData& data) { |
| 139 | Common::ParamPackage new_input; | 138 | Common::ParamPackage new_input; |
| 140 | new_input.Set("engine", data.engine); | 139 | new_input.Set("engine", data.engine); |
| 141 | if (data.pad.guid != Common::UUID{}) { | 140 | if (data.pad.guid.IsValid()) { |
| 142 | new_input.Set("guid", data.pad.guid.Format()); | 141 | new_input.Set("guid", data.pad.guid.Format()); |
| 143 | } | 142 | } |
| 144 | new_input.Set("port", static_cast<int>(data.pad.port)); | 143 | new_input.Set("port", static_cast<int>(data.pad.port)); |