diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/hid/hid.cpp | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 1e9ff8132..de06e1735 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -3,7 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include <algorithm> | 4 | #include <algorithm> |
| 5 | #include <array> | 5 | #include <array> |
| 6 | #include <chrono> | ||
| 6 | #include <cstring> | 7 | #include <cstring> |
| 8 | |||
| 7 | #include "common/assert.h" | 9 | #include "common/assert.h" |
| 8 | #include "common/bit_field.h" | 10 | #include "common/bit_field.h" |
| 9 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| @@ -547,7 +549,9 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 547 | 549 | ||
| 548 | const auto set_motion_state = [&](SixAxisSensorState& state, | 550 | const auto set_motion_state = [&](SixAxisSensorState& state, |
| 549 | const Core::HID::ControllerMotion& hid_state) { | 551 | const Core::HID::ControllerMotion& hid_state) { |
| 552 | using namespace std::literals::chrono_literals; | ||
| 550 | static constexpr SixAxisSensorState default_motion_state = { | 553 | static constexpr SixAxisSensorState default_motion_state = { |
| 554 | .delta_time = std::chrono::nanoseconds(5ms).count(), | ||
| 551 | .accel = {0, 0, -1.0f}, | 555 | .accel = {0, 0, -1.0f}, |
| 552 | .orientation = | 556 | .orientation = |
| 553 | { | 557 | { |
| @@ -566,6 +570,7 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing | |||
| 566 | return; | 570 | return; |
| 567 | } | 571 | } |
| 568 | state.attribute.is_connected.Assign(1); | 572 | state.attribute.is_connected.Assign(1); |
| 573 | state.delta_time = std::chrono::nanoseconds(5ms).count(); | ||
| 569 | state.accel = hid_state.accel; | 574 | state.accel = hid_state.accel; |
| 570 | state.gyro = hid_state.gyro; | 575 | state.gyro = hid_state.gyro; |
| 571 | state.rotation = hid_state.rotation; | 576 | state.rotation = hid_state.rotation; |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index eba44eda8..44f892da9 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -37,8 +37,7 @@ namespace Service::HID { | |||
| 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew | 37 | // Period time is obtained by measuring the number of samples in a second on HW using a homebrew |
| 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) | 38 | constexpr auto pad_update_ns = std::chrono::nanoseconds{4 * 1000 * 1000}; // (4ms, 250Hz) |
| 39 | constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) | 39 | constexpr auto mouse_keyboard_update_ns = std::chrono::nanoseconds{8 * 1000 * 1000}; // (8ms, 125Hz) |
| 40 | // TODO: Correct update rate for motion is 5ms. Check why some games don't behave at that speed | 40 | constexpr auto motion_update_ns = std::chrono::nanoseconds{5 * 1000 * 1000}; // (5ms, 200Hz) |
| 41 | constexpr auto motion_update_ns = std::chrono::nanoseconds{10 * 1000 * 1000}; // (10ms, 100Hz) | ||
| 42 | 41 | ||
| 43 | IAppletResource::IAppletResource(Core::System& system_, | 42 | IAppletResource::IAppletResource(Core::System& system_, |
| 44 | KernelHelpers::ServiceContext& service_context_) | 43 | KernelHelpers::ServiceContext& service_context_) |