From dd5d36a796d1d074dbac8166c14bbe8d93328b88 Mon Sep 17 00:00:00 2001 From: Exverge Date: Sun, 24 Mar 2024 14:25:39 -0400 Subject: [PATCH] wip: when exiting applet, track the calling applet --- src/core/hle/service/am/applet_manager.cpp | 6 ++++++ src/core/hle/service/am/applet_manager.h | 2 ++ .../service/am/service/library_applet_self_accessor.cpp | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/src/core/hle/service/am/applet_manager.cpp b/src/core/hle/service/am/applet_manager.cpp index c6b7ec8bb5..28bf625b46 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,9 @@ void AppletManager::SetWindowSystem(WindowSystem* window_system) { applet->process->Run(); } + void AppletManager::TrackApplet(std::shared_ptr applet, bool is_application) { + m_window_system->TrackApplet(applet, true); + 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..d9836d0205 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 TrackApplet(std::shared_ptr applet, bool is_application); private: Core::System& m_system; diff --git a/src/core/hle/service/am/service/library_applet_self_accessor.cpp b/src/core/hle/service/am/service/library_applet_self_accessor.cpp index 3fe36b8997..9bc2374bb3 100644 --- a/src/core/hle/service/am/service/library_applet_self_accessor.cpp +++ b/src/core/hle/service/am/service/library_applet_self_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/core_timing.h" @@ -177,6 +178,13 @@ Result ILibraryAppletSelfAccessor::GetMainAppletStorageId(Outprocess->Terminate(); + if(!m_applet->caller_applet.expired()) { + std::shared_ptr applet = m_applet->caller_applet.lock(); + if(applet == nullptr) R_SUCCEED(); + LOG_INFO(Service_AM, "HAS CALLER"); + system.GetAppletManager().TrackApplet(applet, true); + applet->lifecycle_manager.SetFocusState(FocusState::InFocus); + } R_SUCCEED(); }