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(); }