wip: when exiting applet, track the calling applet

This commit is contained in:
Exverge 2024-03-24 14:25:39 -04:00
parent 0a3143399a
commit b5fb367c2e
No known key found for this signature in database
GPG key ID: 19AAFC0AC6A9B35A
3 changed files with 15 additions and 2 deletions

View file

@ -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::RequestAppletVisibilityState(std::shared_ptr<Applet> applet, bool visible) {
m_window_system->RequestAppletVisibilityState(applet.operator*(), visible);
}
} // namespace Service::AM

View file

@ -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 RequestAppletVisibilityState(std::shared_ptr<Applet> applet, bool visible);
private:
Core::System& m_system;

View file

@ -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"
@ -17,6 +18,7 @@
#include "core/hle/service/ns/application_manager_interface.h"
#include "core/hle/service/ns/service_getter_interface.h"
#include "core/hle/service/sm/sm.h"
#include "core/hle/service/am/am_results.h"
namespace Service::AM {
@ -176,7 +178,12 @@ Result ILibraryAppletSelfAccessor::GetMainAppletStorageId(Out<FileSys::StorageId
Result ILibraryAppletSelfAccessor::ExitProcessAndReturn() {
LOG_INFO(Service_AM, "called");
std::shared_ptr<Applet> applet = m_applet->caller_applet.lock();
LOG_INFO(Service_AM, "unlocking caller applet");
system.GetAppletManager().RequestAppletVisibilityState(applet, true);
applet->SetInteractibleLocked(true);
m_applet->process->Terminate();
m_applet->terminate_result = AM::ResultLibraryAppletTerminated;
R_SUCCEED();
}
@ -278,8 +285,7 @@ Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(
Result ILibraryAppletSelfAccessor::GetCurrentApplicationId(Out<u64> out_application_id) {
LOG_WARNING(Service_AM, "(STUBBED) called");
// TODO: this should be the main applet, not the caller applet
const auto main_applet = GetCallerIdentity(*m_applet);
const AppletIdentityInfo main_applet = GetCallerIdentity(*m_applet->caller_applet);
*out_application_id = main_applet.application_id;
R_SUCCEED();