diff options
Diffstat (limited to '')
-rw-r--r-- | src/hid_core/resources/digitizer/digitizer.cpp | 4 | ||||
-rw-r--r-- | src/hid_core/resources/digitizer/digitizer.h | 3 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 18 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.h | 1 | ||||
-rw-r--r-- | src/hid_core/resources/unique_pad/unique_pad.cpp | 4 | ||||
-rw-r--r-- | src/hid_core/resources/unique_pad/unique_pad.h | 3 |
6 files changed, 18 insertions, 15 deletions
diff --git a/src/hid_core/resources/digitizer/digitizer.cpp b/src/hid_core/resources/digitizer/digitizer.cpp index cd72fd6e5..5d7dcadfe 100644 --- a/src/hid_core/resources/digitizer/digitizer.cpp +++ b/src/hid_core/resources/digitizer/digitizer.cpp @@ -17,10 +17,6 @@ void Digitizer::OnInit() {} void Digitizer::OnRelease() {} void Digitizer::OnUpdate(const Core::Timing::CoreTiming& core_timing) { - if (!smart_update) { - return; - } - std::scoped_lock shared_lock{*shared_mutex}; const u64 aruid = applet_resource->GetActiveAruid(); auto* data = applet_resource->GetAruidData(aruid); diff --git a/src/hid_core/resources/digitizer/digitizer.h b/src/hid_core/resources/digitizer/digitizer.h index e031a16b0..68b03111c 100644 --- a/src/hid_core/resources/digitizer/digitizer.h +++ b/src/hid_core/resources/digitizer/digitizer.h @@ -20,8 +20,5 @@ public: // When the controller is requesting an update for the shared memory void OnUpdate(const Core::Timing::CoreTiming& core_timing) override; - -private: - bool smart_update{}; }; } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 1a58eff4a..fe3fdc5cd 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -102,6 +102,8 @@ Result NPad::Activate(u64 aruid) { for (std::size_t i = 0; i < 19; ++i) { WriteEmptyEntry(npad); } + + controller.is_active = true; } return ResultSuccess; @@ -467,6 +469,13 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { continue; } + bool is_set{}; + npad_resource.IsSupportedNpadStyleSet(is_set, aruid); + // Wait until style is defined + if (!is_set) { + continue; + } + for (std::size_t i = 0; i < controller_data[aruid_index].size(); ++i) { auto& controller = controller_data[aruid_index][i]; controller.shared_memory = @@ -484,6 +493,10 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { continue; } + if (!controller.is_active) { + continue; + } + RequestPadStateUpdate(aruid, controller.device->GetNpadIdType()); auto& pad_state = controller.npad_pad_state; auto& libnx_state = controller.npad_libnx_state; @@ -592,7 +605,9 @@ void NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { libnx_state.npad_buttons.raw = pad_state.npad_buttons.raw; libnx_state.l_stick = pad_state.l_stick; libnx_state.r_stick = pad_state.r_stick; - npad->system_ext_lifo.WriteNextEntry(pad_state); + libnx_state.sampling_number = + npad->system_ext_lifo.ReadCurrentEntry().state.sampling_number + 1; + npad->system_ext_lifo.WriteNextEntry(libnx_state); press_state |= static_cast<u64>(pad_state.npad_buttons.raw); } @@ -1060,6 +1075,7 @@ void NPad::UnregisterAppletResourceUserId(u64 aruid) { // TODO: Remove this once abstract pad is emulated properly const auto aruid_index = npad_resource.GetIndexFromAruid(aruid); for (auto& controller : controller_data[aruid_index]) { + controller.is_active = false; controller.is_connected = false; controller.shared_memory = nullptr; } diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 4e26ed2e8..c63488346 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -164,6 +164,7 @@ private: NpadInternalState* shared_memory = nullptr; Core::HID::EmulatedController* device = nullptr; + bool is_active{}; bool is_connected{}; // Dual joycons can have only one side connected diff --git a/src/hid_core/resources/unique_pad/unique_pad.cpp b/src/hid_core/resources/unique_pad/unique_pad.cpp index 89fc57269..b2db55c5a 100644 --- a/src/hid_core/resources/unique_pad/unique_pad.cpp +++ b/src/hid_core/resources/unique_pad/unique_pad.cpp @@ -17,10 +17,6 @@ void UniquePad::OnInit() {} void UniquePad::OnRelease() {} void UniquePad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { - if (!smart_update) { - return; - } - const u64 aruid = applet_resource->GetActiveAruid(); auto* data = applet_resource->GetAruidData(aruid); diff --git a/src/hid_core/resources/unique_pad/unique_pad.h b/src/hid_core/resources/unique_pad/unique_pad.h index 674ad1691..4873b7f7e 100644 --- a/src/hid_core/resources/unique_pad/unique_pad.h +++ b/src/hid_core/resources/unique_pad/unique_pad.h @@ -20,8 +20,5 @@ public: // When the controller is requesting an update for the shared memory void OnUpdate(const Core::Timing::CoreTiming& core_timing) override; - -private: - bool smart_update{}; }; } // namespace Service::HID |