diff options
Diffstat (limited to 'src')
17 files changed, 45 insertions, 29 deletions
diff --git a/src/core/hle/service/hid/controllers/capture_button.cpp b/src/core/hle/service/hid/controllers/capture_button.cpp index 8b486fcb5..7847c080e 100644 --- a/src/core/hle/service/hid/controllers/capture_button.cpp +++ b/src/core/hle/service/hid/controllers/capture_button.cpp | |||
| @@ -21,10 +21,11 @@ void CaptureButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 21 | return; | 21 | return; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/console_six_axis.cpp b/src/core/hle/service/hid/controllers/console_six_axis.cpp index 8eba2c292..4b574c2e5 100644 --- a/src/core/hle/service/hid/controllers/console_six_axis.cpp +++ b/src/core/hle/service/hid/controllers/console_six_axis.cpp | |||
| @@ -20,10 +20,11 @@ void ConsoleSixAxis::OnInit() {} | |||
| 20 | void ConsoleSixAxis::OnRelease() {} | 20 | void ConsoleSixAxis::OnRelease() {} |
| 21 | 21 | ||
| 22 | void ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 22 | void ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 23 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 23 | const u64 aruid = applet_resource->GetActiveAruid(); | 24 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 24 | auto* data = applet_resource->GetAruidData(aruid); | 25 | auto* data = applet_resource->GetAruidData(aruid); |
| 25 | 26 | ||
| 26 | if (data == nullptr) { | 27 | if (data == nullptr || !data->flag.is_assigned) { |
| 27 | return; | 28 | return; |
| 28 | } | 29 | } |
| 29 | 30 | ||
diff --git a/src/core/hle/service/hid/controllers/controller_base.cpp b/src/core/hle/service/hid/controllers/controller_base.cpp index 2083ccfad..afca7154c 100644 --- a/src/core/hle/service/hid/controllers/controller_base.cpp +++ b/src/core/hle/service/hid/controllers/controller_base.cpp | |||
| @@ -32,8 +32,10 @@ bool ControllerBase::IsControllerActivated() const { | |||
| 32 | return is_activated; | 32 | return is_activated; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void ControllerBase::SetAppletResource(std::shared_ptr<AppletResource> resource) { | 35 | void ControllerBase::SetAppletResource(std::shared_ptr<AppletResource> resource, |
| 36 | std::recursive_mutex* resource_mutex) { | ||
| 36 | applet_resource = resource; | 37 | applet_resource = resource; |
| 38 | shared_mutex = resource_mutex; | ||
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | } // namespace Service::HID | 41 | } // namespace Service::HID |
diff --git a/src/core/hle/service/hid/controllers/controller_base.h b/src/core/hle/service/hid/controllers/controller_base.h index 759ae0053..b34b85ece 100644 --- a/src/core/hle/service/hid/controllers/controller_base.h +++ b/src/core/hle/service/hid/controllers/controller_base.h | |||
| @@ -42,11 +42,13 @@ public: | |||
| 42 | 42 | ||
| 43 | bool IsControllerActivated() const; | 43 | bool IsControllerActivated() const; |
| 44 | 44 | ||
| 45 | void SetAppletResource(std::shared_ptr<AppletResource> resource); | 45 | void SetAppletResource(std::shared_ptr<AppletResource> resource, |
| 46 | std::recursive_mutex* resource_mutex); | ||
| 46 | 47 | ||
| 47 | protected: | 48 | protected: |
| 48 | bool is_activated{false}; | 49 | bool is_activated{false}; |
| 49 | std::shared_ptr<AppletResource> applet_resource{nullptr}; | 50 | std::shared_ptr<AppletResource> applet_resource{nullptr}; |
| 51 | std::recursive_mutex* shared_mutex{nullptr}; | ||
| 50 | 52 | ||
| 51 | Core::HID::HIDCore& hid_core; | 53 | Core::HID::HIDCore& hid_core; |
| 52 | }; | 54 | }; |
diff --git a/src/core/hle/service/hid/controllers/debug_mouse.cpp b/src/core/hle/service/hid/controllers/debug_mouse.cpp index f2f1a27f8..ceeb78d36 100644 --- a/src/core/hle/service/hid/controllers/debug_mouse.cpp +++ b/src/core/hle/service/hid/controllers/debug_mouse.cpp | |||
| @@ -21,10 +21,11 @@ void DebugMouse::OnInit() {} | |||
| 21 | void DebugMouse::OnRelease() {} | 21 | void DebugMouse::OnRelease() {} |
| 22 | 22 | ||
| 23 | void DebugMouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 23 | void DebugMouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index 1811cf620..dc83f90f3 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp | |||
| @@ -23,10 +23,11 @@ void DebugPad::OnInit() {} | |||
| 23 | void DebugPad::OnRelease() {} | 23 | void DebugPad::OnRelease() {} |
| 24 | 24 | ||
| 25 | void DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 25 | void DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 26 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 26 | const u64 aruid = applet_resource->GetActiveAruid(); | 27 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 27 | auto* data = applet_resource->GetAruidData(aruid); | 28 | auto* data = applet_resource->GetAruidData(aruid); |
| 28 | 29 | ||
| 29 | if (data == nullptr) { | 30 | if (data == nullptr || !data->flag.is_assigned) { |
| 30 | return; | 31 | return; |
| 31 | } | 32 | } |
| 32 | 33 | ||
diff --git a/src/core/hle/service/hid/controllers/digitizer.cpp b/src/core/hle/service/hid/controllers/digitizer.cpp index c01580fd6..d5514c965 100644 --- a/src/core/hle/service/hid/controllers/digitizer.cpp +++ b/src/core/hle/service/hid/controllers/digitizer.cpp | |||
| @@ -21,10 +21,11 @@ void Digitizer::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 21 | return; | 21 | return; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index 6e686fe65..c73da13ee 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp | |||
| @@ -28,10 +28,11 @@ Gesture::Gesture(Core::HID::HIDCore& hid_core_) : ControllerBase(hid_core_) { | |||
| 28 | Gesture::~Gesture() = default; | 28 | Gesture::~Gesture() = default; |
| 29 | 29 | ||
| 30 | void Gesture::OnInit() { | 30 | void Gesture::OnInit() { |
| 31 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 31 | const u64 aruid = applet_resource->GetActiveAruid(); | 32 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 32 | auto* data = applet_resource->GetAruidData(aruid); | 33 | auto* data = applet_resource->GetAruidData(aruid); |
| 33 | 34 | ||
| 34 | if (data == nullptr) { | 35 | if (data == nullptr || !data->flag.is_assigned) { |
| 35 | return; | 36 | return; |
| 36 | } | 37 | } |
| 37 | 38 | ||
| @@ -44,10 +45,11 @@ void Gesture::OnInit() { | |||
| 44 | void Gesture::OnRelease() {} | 45 | void Gesture::OnRelease() {} |
| 45 | 46 | ||
| 46 | void Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 47 | void Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 48 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 47 | const u64 aruid = applet_resource->GetActiveAruid(); | 49 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 48 | auto* data = applet_resource->GetAruidData(aruid); | 50 | auto* data = applet_resource->GetAruidData(aruid); |
| 49 | 51 | ||
| 50 | if (data == nullptr) { | 52 | if (data == nullptr || !data->flag.is_assigned) { |
| 51 | return; | 53 | return; |
| 52 | } | 54 | } |
| 53 | 55 | ||
diff --git a/src/core/hle/service/hid/controllers/home_button.cpp b/src/core/hle/service/hid/controllers/home_button.cpp index 71dd9bc08..1397379f3 100644 --- a/src/core/hle/service/hid/controllers/home_button.cpp +++ b/src/core/hle/service/hid/controllers/home_button.cpp | |||
| @@ -21,10 +21,11 @@ void HomeButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 21 | return; | 21 | return; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index c72b3e5ce..c069bcbb2 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp | |||
| @@ -22,10 +22,11 @@ void Keyboard::OnInit() {} | |||
| 22 | void Keyboard::OnRelease() {} | 22 | void Keyboard::OnRelease() {} |
| 23 | 23 | ||
| 24 | void Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 24 | void Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 25 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 25 | const u64 aruid = applet_resource->GetActiveAruid(); | 26 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 26 | auto* data = applet_resource->GetAruidData(aruid); | 27 | auto* data = applet_resource->GetAruidData(aruid); |
| 27 | 28 | ||
| 28 | if (data == nullptr) { | 29 | if (data == nullptr || !data->flag.is_assigned) { |
| 29 | return; | 30 | return; |
| 30 | } | 31 | } |
| 31 | 32 | ||
diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index 58deafbc5..3a8d1751b 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp | |||
| @@ -21,10 +21,11 @@ void Mouse::OnInit() {} | |||
| 21 | void Mouse::OnRelease() {} | 21 | void Mouse::OnRelease() {} |
| 22 | 22 | ||
| 23 | void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 23 | void Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index bf387e22d..17cd0d7a0 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -128,7 +128,7 @@ void NPad::ControllerUpdate(Core::HID::ControllerTriggerType type, std::size_t c | |||
| 128 | 128 | ||
| 129 | auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index); | 129 | auto* data = applet_resource_holder.applet_resource->GetAruidDataByIndex(aruid_index); |
| 130 | 130 | ||
| 131 | if (data->flag.is_assigned) { | 131 | if (!data->flag.is_assigned) { |
| 132 | continue; | 132 | continue; |
| 133 | } | 133 | } |
| 134 | 134 | ||
diff --git a/src/core/hle/service/hid/controllers/six_axis.cpp b/src/core/hle/service/hid/controllers/six_axis.cpp index a5a67dea6..adab60911 100644 --- a/src/core/hle/service/hid/controllers/six_axis.cpp +++ b/src/core/hle/service/hid/controllers/six_axis.cpp | |||
| @@ -27,10 +27,11 @@ void SixAxis::OnInit() {} | |||
| 27 | void SixAxis::OnRelease() {} | 27 | void SixAxis::OnRelease() {} |
| 28 | 28 | ||
| 29 | void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | 29 | void SixAxis::OnUpdate(const Core::Timing::CoreTiming& core_timing) { |
| 30 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 30 | const u64 aruid = applet_resource->GetActiveAruid(); | 31 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 31 | auto* data = applet_resource->GetAruidData(aruid); | 32 | auto* data = applet_resource->GetAruidData(aruid); |
| 32 | 33 | ||
| 33 | if (data == nullptr) { | 34 | if (data == nullptr || !data->flag.is_assigned) { |
| 34 | return; | 35 | return; |
| 35 | } | 36 | } |
| 36 | 37 | ||
diff --git a/src/core/hle/service/hid/controllers/sleep_button.cpp b/src/core/hle/service/hid/controllers/sleep_button.cpp index 978dc4c1f..d44b1f4cc 100644 --- a/src/core/hle/service/hid/controllers/sleep_button.cpp +++ b/src/core/hle/service/hid/controllers/sleep_button.cpp | |||
| @@ -21,10 +21,11 @@ void SleepButton::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 21 | return; | 21 | return; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | std::scoped_lock shared_lock{*shared_mutex}; | ||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 25 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 26 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 27 | ||
| 27 | if (data == nullptr) { | 28 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 29 | return; |
| 29 | } | 30 | } |
| 30 | 31 | ||
diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 291dc707e..b585a5829 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp | |||
| @@ -30,7 +30,7 @@ void TouchScreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 30 | const u64 aruid = applet_resource->GetActiveAruid(); | 30 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 31 | auto* data = applet_resource->GetAruidData(aruid); | 31 | auto* data = applet_resource->GetAruidData(aruid); |
| 32 | 32 | ||
| 33 | if (data == nullptr) { | 33 | if (data == nullptr || !data->flag.is_assigned) { |
| 34 | return; | 34 | return; |
| 35 | } | 35 | } |
| 36 | 36 | ||
diff --git a/src/core/hle/service/hid/controllers/unique_pad.cpp b/src/core/hle/service/hid/controllers/unique_pad.cpp index 8230501a5..6c543031d 100644 --- a/src/core/hle/service/hid/controllers/unique_pad.cpp +++ b/src/core/hle/service/hid/controllers/unique_pad.cpp | |||
| @@ -24,7 +24,7 @@ void UniquePad::OnUpdate(const Core::Timing::CoreTiming& core_timing) { | |||
| 24 | const u64 aruid = applet_resource->GetActiveAruid(); | 24 | const u64 aruid = applet_resource->GetActiveAruid(); |
| 25 | auto* data = applet_resource->GetAruidData(aruid); | 25 | auto* data = applet_resource->GetAruidData(aruid); |
| 26 | 26 | ||
| 27 | if (data == nullptr) { | 27 | if (data == nullptr || !data->flag.is_assigned) { |
| 28 | return; | 28 | return; |
| 29 | } | 29 | } |
| 30 | 30 | ||
diff --git a/src/core/hle/service/hid/resource_manager.cpp b/src/core/hle/service/hid/resource_manager.cpp index ab49259ac..1f41e645d 100644 --- a/src/core/hle/service/hid/resource_manager.cpp +++ b/src/core/hle/service/hid/resource_manager.cpp | |||
| @@ -171,31 +171,31 @@ void ResourceManager::InitializeHidCommonSampler() { | |||
| 171 | palma = std::make_shared<Palma>(system.HIDCore(), service_context); | 171 | palma = std::make_shared<Palma>(system.HIDCore(), service_context); |
| 172 | six_axis = std::make_shared<SixAxis>(system.HIDCore(), npad); | 172 | six_axis = std::make_shared<SixAxis>(system.HIDCore(), npad); |
| 173 | 173 | ||
| 174 | debug_pad->SetAppletResource(applet_resource); | 174 | debug_pad->SetAppletResource(applet_resource, &shared_mutex); |
| 175 | digitizer->SetAppletResource(applet_resource); | 175 | digitizer->SetAppletResource(applet_resource, &shared_mutex); |
| 176 | keyboard->SetAppletResource(applet_resource); | 176 | keyboard->SetAppletResource(applet_resource, &shared_mutex); |
| 177 | npad->SetNpadExternals(applet_resource, &shared_mutex); | 177 | npad->SetNpadExternals(applet_resource, &shared_mutex); |
| 178 | six_axis->SetAppletResource(applet_resource); | 178 | six_axis->SetAppletResource(applet_resource, &shared_mutex); |
| 179 | mouse->SetAppletResource(applet_resource); | 179 | mouse->SetAppletResource(applet_resource, &shared_mutex); |
| 180 | debug_mouse->SetAppletResource(applet_resource); | 180 | debug_mouse->SetAppletResource(applet_resource, &shared_mutex); |
| 181 | home_button->SetAppletResource(applet_resource); | 181 | home_button->SetAppletResource(applet_resource, &shared_mutex); |
| 182 | sleep_button->SetAppletResource(applet_resource); | 182 | sleep_button->SetAppletResource(applet_resource, &shared_mutex); |
| 183 | capture_button->SetAppletResource(applet_resource); | 183 | capture_button->SetAppletResource(applet_resource, &shared_mutex); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void ResourceManager::InitializeTouchScreenSampler() { | 186 | void ResourceManager::InitializeTouchScreenSampler() { |
| 187 | gesture = std::make_shared<Gesture>(system.HIDCore()); | 187 | gesture = std::make_shared<Gesture>(system.HIDCore()); |
| 188 | touch_screen = std::make_shared<TouchScreen>(system.HIDCore()); | 188 | touch_screen = std::make_shared<TouchScreen>(system.HIDCore()); |
| 189 | 189 | ||
| 190 | touch_screen->SetAppletResource(applet_resource); | 190 | touch_screen->SetAppletResource(applet_resource, &shared_mutex); |
| 191 | gesture->SetAppletResource(applet_resource); | 191 | gesture->SetAppletResource(applet_resource, &shared_mutex); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void ResourceManager::InitializeConsoleSixAxisSampler() { | 194 | void ResourceManager::InitializeConsoleSixAxisSampler() { |
| 195 | console_six_axis = std::make_shared<ConsoleSixAxis>(system.HIDCore()); | 195 | console_six_axis = std::make_shared<ConsoleSixAxis>(system.HIDCore()); |
| 196 | seven_six_axis = std::make_shared<SevenSixAxis>(system); | 196 | seven_six_axis = std::make_shared<SevenSixAxis>(system); |
| 197 | 197 | ||
| 198 | console_six_axis->SetAppletResource(applet_resource); | 198 | console_six_axis->SetAppletResource(applet_resource, &shared_mutex); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | void ResourceManager::InitializeAHidSampler() { | 201 | void ResourceManager::InitializeAHidSampler() { |