summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hid/emulated_controller.cpp11
-rw-r--r--src/core/hid/emulated_controller.h2
-rw-r--r--src/core/hle/kernel/k_hardware_timer.cpp4
3 files changed, 11 insertions, 6 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 94bd656fe..2af3f06fc 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -542,6 +542,7 @@ void EmulatedController::UnloadInput() {
542} 542}
543 543
544void EmulatedController::EnableConfiguration() { 544void EmulatedController::EnableConfiguration() {
545 std::scoped_lock lock{connect_mutex, npad_mutex};
545 is_configuring = true; 546 is_configuring = true;
546 tmp_is_connected = is_connected; 547 tmp_is_connected = is_connected;
547 tmp_npad_type = npad_type; 548 tmp_npad_type = npad_type;
@@ -1556,7 +1557,7 @@ void EmulatedController::Connect(bool use_temporary_value) {
1556 1557
1557 auto trigger_guard = 1558 auto trigger_guard =
1558 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Connected, !is_configuring); }); 1559 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Connected, !is_configuring); });
1559 std::scoped_lock lock{mutex}; 1560 std::scoped_lock lock{connect_mutex, mutex};
1560 if (is_configuring) { 1561 if (is_configuring) {
1561 tmp_is_connected = true; 1562 tmp_is_connected = true;
1562 return; 1563 return;
@@ -1572,7 +1573,7 @@ void EmulatedController::Connect(bool use_temporary_value) {
1572void EmulatedController::Disconnect() { 1573void EmulatedController::Disconnect() {
1573 auto trigger_guard = 1574 auto trigger_guard =
1574 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Disconnected, !is_configuring); }); 1575 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Disconnected, !is_configuring); });
1575 std::scoped_lock lock{mutex}; 1576 std::scoped_lock lock{connect_mutex, mutex};
1576 if (is_configuring) { 1577 if (is_configuring) {
1577 tmp_is_connected = false; 1578 tmp_is_connected = false;
1578 return; 1579 return;
@@ -1586,7 +1587,7 @@ void EmulatedController::Disconnect() {
1586} 1587}
1587 1588
1588bool EmulatedController::IsConnected(bool get_temporary_value) const { 1589bool EmulatedController::IsConnected(bool get_temporary_value) const {
1589 std::scoped_lock lock{mutex}; 1590 std::scoped_lock lock{connect_mutex};
1590 if (get_temporary_value && is_configuring) { 1591 if (get_temporary_value && is_configuring) {
1591 return tmp_is_connected; 1592 return tmp_is_connected;
1592 } 1593 }
@@ -1599,7 +1600,7 @@ NpadIdType EmulatedController::GetNpadIdType() const {
1599} 1600}
1600 1601
1601NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const { 1602NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) const {
1602 std::scoped_lock lock{mutex}; 1603 std::scoped_lock lock{npad_mutex};
1603 if (get_temporary_value && is_configuring) { 1604 if (get_temporary_value && is_configuring) {
1604 return tmp_npad_type; 1605 return tmp_npad_type;
1605 } 1606 }
@@ -1609,7 +1610,7 @@ NpadStyleIndex EmulatedController::GetNpadStyleIndex(bool get_temporary_value) c
1609void EmulatedController::SetNpadStyleIndex(NpadStyleIndex npad_type_) { 1610void EmulatedController::SetNpadStyleIndex(NpadStyleIndex npad_type_) {
1610 auto trigger_guard = 1611 auto trigger_guard =
1611 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Type, !is_configuring); }); 1612 SCOPE_GUARD({ TriggerOnChange(ControllerTriggerType::Type, !is_configuring); });
1612 std::scoped_lock lock{mutex}; 1613 std::scoped_lock lock{mutex, npad_mutex};
1613 1614
1614 if (is_configuring) { 1615 if (is_configuring) {
1615 if (tmp_npad_type == npad_type_) { 1616 if (tmp_npad_type == npad_type_) {
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index 88d77db8d..d4500583e 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -603,6 +603,8 @@ private:
603 603
604 mutable std::mutex mutex; 604 mutable std::mutex mutex;
605 mutable std::mutex callback_mutex; 605 mutable std::mutex callback_mutex;
606 mutable std::mutex npad_mutex;
607 mutable std::mutex connect_mutex;
606 std::unordered_map<int, ControllerUpdateCallback> callback_list; 608 std::unordered_map<int, ControllerUpdateCallback> callback_list;
607 int last_callback_key = 0; 609 int last_callback_key = 0;
608 610
diff --git a/src/core/hle/kernel/k_hardware_timer.cpp b/src/core/hle/kernel/k_hardware_timer.cpp
index 4dcd53821..8e2e40307 100644
--- 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() {
35 } 35 }
36 36
37 // Disable the timer interrupt while we handle this. 37 // Disable the timer interrupt while we handle this.
38 this->DisableInterrupt(); 38 // Not necessary due to core timing already having popped this event to call it.
39 // this->DisableInterrupt();
40 m_wakeup_time = std::numeric_limits<s64>::max();
39 41
40 if (const s64 next_time = this->DoInterruptTaskImpl(GetTick()); 42 if (const s64 next_time = this->DoInterruptTaskImpl(GetTick());
41 0 < next_time && next_time <= m_wakeup_time) { 43 0 < next_time && next_time <= m_wakeup_time) {