Browse Source

Fix Mario Kart 8 Deluxe control applet freeze (#149)

Not limited to MK8D, this commit may fix games that commonly crash on the controller applet and possibly others as well.

This new approach prevents other games from breaking with this fix.

Co-authored-by: MaranBr <maranbr@outlook.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/149
pull/21/head
MaranBr 7 months ago
parent
commit
7eb5710f35
  1. 6
      src/core/hle/service/am/applet.cpp
  2. 6
      src/core/hle/service/am/service/library_applet_accessor.cpp

6
src/core/hle/service/am/applet.cpp

@ -26,7 +26,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
// Remove any forced resumption.
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;
@ -36,6 +36,7 @@ void Applet::UpdateSuspensionStateLocked(bool force_message) {
process->Suspend(false);
} else {
process->Suspend(true);
lifecycle_manager.RequestResumeNotification();
}
is_activity_runnable = curr_activity_runnable;
@ -47,8 +48,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) {
lifecycle_manager.RequestResumeNotification();
if (update_requested_focus_state || was_changed || force_message) {
lifecycle_manager.SignalSystemEventIfNeeded();
}
}

6
src/core/hle/service/am/service/library_applet_accessor.cpp

@ -101,6 +101,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()));
}

Loading…
Cancel
Save