diff options
| -rw-r--r-- | src/core/hid/input_converter.cpp | 7 | ||||
| -rw-r--r-- | src/input_common/input_mapping.cpp | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hid/input_converter.cpp b/src/core/hid/input_converter.cpp index 7cee39a53..2772bc012 100644 --- a/src/core/hid/input_converter.cpp +++ b/src/core/hid/input_converter.cpp | |||
| @@ -61,6 +61,9 @@ Common::Input::ButtonStatus TransformToButton(const Common::Input::CallbackStatu | |||
| 61 | case Common::Input::InputType::Button: | 61 | case Common::Input::InputType::Button: |
| 62 | status = callback.button_status; | 62 | status = callback.button_status; |
| 63 | break; | 63 | break; |
| 64 | case Common::Input::InputType::Motion: | ||
| 65 | status.value = std::abs(callback.motion_status.gyro.x.raw_value) > 1.0f; | ||
| 66 | break; | ||
| 64 | default: | 67 | default: |
| 65 | LOG_ERROR(Input, "Conversion from type {} to button not implemented", callback.type); | 68 | LOG_ERROR(Input, "Conversion from type {} to button not implemented", callback.type); |
| 66 | break; | 69 | break; |
| @@ -226,6 +229,10 @@ Common::Input::TriggerStatus TransformToTrigger(const Common::Input::CallbackSta | |||
| 226 | status = callback.trigger_status; | 229 | status = callback.trigger_status; |
| 227 | calculate_button_value = false; | 230 | calculate_button_value = false; |
| 228 | break; | 231 | break; |
| 232 | case Common::Input::InputType::Motion: | ||
| 233 | status.analog.properties.range = 1.0f; | ||
| 234 | raw_value = callback.motion_status.accel.x.raw_value; | ||
| 235 | break; | ||
| 229 | default: | 236 | default: |
| 230 | LOG_ERROR(Input, "Conversion from type {} to trigger not implemented", callback.type); | 237 | LOG_ERROR(Input, "Conversion from type {} to trigger not implemented", callback.type); |
| 231 | break; | 238 | break; |
diff --git a/src/input_common/input_mapping.cpp b/src/input_common/input_mapping.cpp index 9361b00c5..8c2ee4eb3 100644 --- a/src/input_common/input_mapping.cpp +++ b/src/input_common/input_mapping.cpp | |||
| @@ -82,6 +82,9 @@ void MappingFactory::RegisterButton(const MappingData& data) { | |||
| 82 | new_input.Set("axis", data.index); | 82 | new_input.Set("axis", data.index); |
| 83 | new_input.Set("threshold", 0.5f); | 83 | new_input.Set("threshold", 0.5f); |
| 84 | break; | 84 | break; |
| 85 | case EngineInputType::Motion: | ||
| 86 | new_input.Set("motion", data.index); | ||
| 87 | break; | ||
| 85 | default: | 88 | default: |
| 86 | return; | 89 | return; |
| 87 | } | 90 | } |