mirror of
https://git.citron-emu.org/citron/emulator
synced 2026-02-03 08:03:36 +00:00
fix(am): Fix library applet controller freeze
- Cache focus state result to prevent race condition from double-call - Signal caller applet resume notification on PopOutData Fixes freezes in games using controller applet (e.g. Mario Kart 8 Deluxe). Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 ReSwitched Team
|
||||
// SPDX-FileCopyrightText: Copyright 2026 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/core.h"
|
||||
@@ -27,6 +29,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
|
||||
lifecycle_manager.RemoveForceResumeIfPossible();
|
||||
|
||||
// Check if we're runnable.
|
||||
const bool update_requested_focus_state = lifecycle_manager.UpdateRequestedFocusState();
|
||||
const bool curr_activity_runnable = lifecycle_manager.IsRunnable();
|
||||
const bool prev_activity_runnable = is_activity_runnable;
|
||||
const bool was_changed = curr_activity_runnable != prev_activity_runnable;
|
||||
@@ -48,7 +51,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
|
||||
}
|
||||
|
||||
// Signal if the focus state was changed or the process state was changed.
|
||||
if (lifecycle_manager.UpdateRequestedFocusState() || was_changed || force_message) {
|
||||
if (update_requested_focus_state || was_changed || force_message) {
|
||||
lifecycle_manager.SignalSystemEventIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2026 ReSwitched Team
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "core/hle/service/am/applet_data_broker.h"
|
||||
@@ -103,6 +104,12 @@ Result ILibraryAppletAccessor::PushInData(SharedPointer<IStorage> storage) {
|
||||
|
||||
Result ILibraryAppletAccessor::PopOutData(Out<SharedPointer<IStorage>> out_storage) {
|
||||
LOG_DEBUG(Service_AM, "called");
|
||||
if (auto caller_applet = m_applet->caller_applet.lock(); caller_applet) {
|
||||
Event m_system_event = caller_applet->lifecycle_manager.GetSystemEvent();
|
||||
m_system_event.Signal();
|
||||
caller_applet->lifecycle_manager.RequestResumeNotification();
|
||||
m_system_event.Clear();
|
||||
}
|
||||
R_RETURN(m_broker->GetOutData().Pop(out_storage.Get()));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user