From 41ebc0b06a547b1951e384f206b8d6c25ac81eaf Mon Sep 17 00:00:00 2001 From: Exverge Date: Sun, 24 Mar 2024 19:51:18 -0400 Subject: [PATCH] fix: retrack application when guest applet is closed --- src/core/hle/service/am/applet_manager.cpp | 5 +++++ src/core/hle/service/am/applet_manager.h | 2 ++ .../hle/service/am/service/library_applet_accessor.cpp | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp index c6b7ec8bb5..4cb727411d 100644 --- a/src/core/hle/service/am/applet_manager.cpp +++ b/src/core/hle/service/am/applet_manager.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "common/settings.h" @@ -335,4 +336,8 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) { applet->process->Run(); } +void AppletManager::ReTrackApplication(std::shared_ptr applet) { + m_window_system->RequestApplicationToGetForeground(); +} + } // namespace Service::AM diff --git a/src/core/hle/service/am/applet_manager.h b/src/core/hle/service/am/applet_manager.h index fbdc771400..1debb1a46d 100644 --- a/src/core/hle/service/am/applet_manager.h +++ b/src/core/hle/service/am/applet_manager.h @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -46,6 +47,7 @@ public: public: void SetWindowSystem(WindowSystem* window_system); + void ReTrackApplication(std::shared_ptr applet); private: Core::System& m_system; diff --git a/src/core/hle/service/am/service/library_applet_accessor.cpp b/src/core/hle/service/am/service/library_applet_accessor.cpp index cda8c3eb87..f36da793c3 100644 --- a/src/core/hle/service/am/service/library_applet_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_accessor.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-FileCopyrightText: Copyright 2024 suyu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #include "core/hle/service/am/applet_data_broker.h" @@ -101,6 +102,12 @@ Result ILibraryAppletAccessor::PushInData(SharedPointer storage) { Result ILibraryAppletAccessor::PopOutData(Out> out_storage) { LOG_DEBUG(Service_AM, "called"); + if(!m_applet->caller_applet.expired()) { + LOG_DEBUG(Service_AM, "resuming caller"); + system.GetAppletManager().ReTrackApplication(m_applet->caller_applet.lock()); + } else { + LOG_CRITICAL(Service_AM, "Failed to track application. The emulator will freeze!"); + } R_RETURN(m_broker->GetOutData().Pop(out_storage.Get())); }