diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-10 07:42:23 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-05-06 01:40:51 +0200 |
commit | 89edbe8aa20d278d6f2c5ab735163f0d96ff88d2 (patch) | |
tree | 568023bd7dbb880730c2cbbcbafe025045fe2f7b /src/core/hle/service/hid | |
parent | hle: kernel: Move slab heap management to KernelCore. (diff) | |
download | yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar.gz yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar.bz2 yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar.lz yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar.xz yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.tar.zst yuzu-89edbe8aa20d278d6f2c5ab735163f0d96ff88d2.zip |
Diffstat (limited to 'src/core/hle/service/hid')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 753875d6e..77768ca7d 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -253,8 +253,7 @@ void Controller_NPad::InitNewlyAddedController(std::size_t controller_idx) { void Controller_NPad::OnInit() { auto& kernel = system.Kernel(); for (std::size_t i = 0; i < styleset_changed_events.size(); ++i) { - styleset_changed_events[i] = std::make_unique<Kernel::KEvent>(kernel); - Kernel::KAutoObject::Create(styleset_changed_events[i].get()); + styleset_changed_events[i] = Kernel::KEvent::Create(kernel); styleset_changed_events[i]->Initialize(fmt::format("npad:NpadStyleSetChanged_{}", i)); } @@ -341,6 +340,11 @@ void Controller_NPad::OnRelease() { VibrateControllerAtIndex(npad_idx, device_idx, {}); } } + + for (std::size_t i = 0; i < styleset_changed_events.size(); ++i) { + styleset_changed_events[i]->Close(); + styleset_changed_events[i] = nullptr; + } } void Controller_NPad::RequestPadStateUpdate(u32 npad_id) { diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 515cf7c37..b3de272b6 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -573,8 +573,9 @@ private: NpadHandheldActivationMode handheld_activation_mode{NpadHandheldActivationMode::Dual}; NpadCommunicationMode communication_mode{NpadCommunicationMode::Default}; // Each controller should have their own styleset changed event - std::array<std::unique_ptr<Kernel::KEvent>, 10> styleset_changed_events; - std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> last_vibration_timepoints; + std::array<Kernel::KEvent*, 10> styleset_changed_events{}; + std::array<std::array<std::chrono::steady_clock::time_point, 2>, 10> + last_vibration_timepoints{}; std::array<std::array<VibrationValue, 2>, 10> latest_vibration_values{}; bool permit_vibration_session_enabled{false}; std::array<std::array<bool, 2>, 10> vibration_devices_mounted{}; |