From 54dfe357540fa208de443a416a82479f94f0afd2 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 28 Sep 2023 20:04:39 +0200 Subject: [PATCH] early-access version 3902 --- README.md | 2 +- src/core/hid/emulated_controller.cpp | 11 ++++++----- src/core/hid/emulated_controller.h | 2 ++ src/core/hle/kernel/k_hardware_timer.cpp | 4 +++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bd8a75a6b..c7c4c1f2c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3901. +This is the source code for early-access 3902. ## Legal Notice diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index e9da2c793..31a2fe617 100755 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -542,6 +542,7 @@ void EmulatedController::UnloadInput() { } void EmulatedController::EnableConfiguration() { + std::scoped_lock lock{connect_mutex, npad_mutex}; is_configuring = true; tmp_is_connected = is_connected; tmp_npad_type = npad_type; @@ -1556,7 +1557,7 @@ void EmulatedController::Connect(bool use_temporary_value) { auto trigger_guard = SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Connected, !is_configuring); }); - std::scoped_lock lock{mutex}; + std::scoped_lock lock{connect_mutex, mutex}; if (is_configuring) { tmp_is_connected = true; return; @@ -1572,7 +1573,7 @@ void EmulatedController::Connect(bool use_temporary_value) { void EmulatedController::Disconnect() { auto trigger_guard = SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Disconnected, !is_configuring); }); - std::scoped_lock lock{mutex}; + std::scoped_lock lock{connect_mutex, mutex}; if (is_configuring) { tmp_is_connected = false; return; @@ -1586,7 +1587,7 @@ void EmulatedController::Disconnect() { } bool EmulatedController::IsConnected(bool get_temporary_value) const { - std::scoped_lock lock{mutex}; + std::scoped_lock lock{connect_mutex}; if (get_temporary_value && is_configuring) { return tmp_is_connected; } @@ -1599,7 +1600,7 @@ NpadIdType EmulatedController::GetNpadIdType() const { } NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const { - std::scoped_lock lock{mutex}; + std::scoped_lock lock{npad_mutex}; if (get_temporary_value && is_configuring) { return tmp_npad_type; } @@ -1609,7 +1610,7 @@ NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) c void EmulatedController::SetNpadStyleIndex(NpadStyleIndex npad_type_) { auto trigger_guard = SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Type, !is_configuring); }); - std::scoped_lock lock{mutex}; + std::scoped_lock lock{mutex, npad_mutex}; if (is_configuring) { if (tmp_npad_type == npad_type_) { diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 14ff03b34..66ca39a40 100755 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -603,6 +603,8 @@ private: mutable std::mutex mutex; mutable std::mutex callback_mutex; + mutable std::mutex npad_mutex; + mutable std::mutex connect_mutex; std::unordered_map callback_list; int last_callback_key = 0; diff --git a/src/core/hle/kernel/k_hardware_timer.cpp b/src/core/hle/kernel/k_hardware_timer.cpp index 4dcd53821..8e2e40307 100755 --- a/src/core/hle/kernel/k_hardware_timer.cpp +++ b/src/core/hle/kernel/k_hardware_timer.cpp @@ -35,7 +35,9 @@ void KHardwareTimer::DoTask() { } // Disable the timer interrupt while we handle this. - this->DisableInterrupt(); + // Not necessary due to core timing already having popped this event to call it. + // this->DisableInterrupt(); + m_wakeup_time = std::numeric_limits::max(); if (const s64 next_time = this->DoInterruptTaskImpl(GetTick()); 0 < next_time && next_time <= m_wakeup_time) {