summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/hid/hid.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2020-07-22 16:39:53 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2020-08-26 08:32:32 +0200
commitf0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01 (patch)
tree4438688a9b9b4bc015985f2df1a731de57fe50db /src/core/hle/service/hid/hid.cpp
parentMerge pull request #4582 from lioncash/xbyak (diff)
downloadyuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.gz
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.bz2
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.lz
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.xz
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.tar.zst
yuzu-f0fac0c7fb6f7dd9fe81747b3369767c8c9e7d01.zip
Diffstat (limited to 'src/core/hle/service/hid/hid.cpp')
-rw-r--r--src/core/hle/service/hid/hid.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 1e95b7580..33416b5dd 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -38,11 +38,9 @@
namespace Service::HID {
// Updating period for each HID device.
-// TODO(ogniK): Find actual polling rate of hid
-constexpr auto pad_update_ns = std::chrono::nanoseconds{1000000000 / 66};
-[[maybe_unused]] constexpr auto accelerometer_update_ns =
- std::chrono::nanoseconds{1000000000 / 100};
-[[maybe_unused]] constexpr auto gyroscope_update_ticks = std::chrono::nanoseconds{1000000000 / 100};
+// HID is polled every 15ms, this value was derived from
+// https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering#joy-con-status-data-packet
+constexpr auto pad_update_ns = std::chrono::nanoseconds{15 * 1000 * 1000}; // (15ms, 66.6Hz)
constexpr std::size_t SHARED_MEMORY_SIZE = 0x40000;
IAppletResource::IAppletResource(Core::System& system)
@@ -845,8 +843,7 @@ void Hid::CreateActiveVibrationDeviceList(Kernel::HLERequestContext& ctx) {
void Hid::PermitVibration(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto can_vibrate{rp.Pop<bool>()};
- applet_resource->GetController<Controller_NPad>(HidController::NPad)
- .SetVibrationEnabled(can_vibrate);
+ Settings::values.vibration_enabled = can_vibrate;
LOG_DEBUG(Service_HID, "called, can_vibrate={}", can_vibrate);
@@ -859,8 +856,7 @@ void Hid::IsVibrationPermitted(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS);
- rb.Push(
- applet_resource->GetController<Controller_NPad>(HidController::NPad).IsVibrationEnabled());
+ rb.Push(Settings::values.vibration_enabled);
}
void Hid::ActivateConsoleSixAxisSensor(Kernel::HLERequestContext& ctx) {