am: record library applet termination result

This commit is contained in:
Liam 2024-02-19 20:25:54 -05:00
parent 59c5a86b8a
commit ab3b3b691a
5 changed files with 10 additions and 5 deletions

View File

@ -9,6 +9,7 @@ namespace Service::AM {
constexpr Result ResultNoDataInChannel{ErrorModule::AM, 2};
constexpr Result ResultNoMessages{ErrorModule::AM, 3};
constexpr Result ResultLibraryAppletTerminated{ErrorModule::AM, 22};
constexpr Result ResultInvalidOffset{ErrorModule::AM, 503};
constexpr Result ResultInvalidStorageType{ErrorModule::AM, 511};
constexpr Result ResultFatalSectionCountImbalance{ErrorModule::AM, 512};

View File

@ -83,7 +83,8 @@ Result IApplicationAccessor::Terminate() {
Result IApplicationAccessor::GetResult() {
LOG_INFO(Service_AM, "called");
R_SUCCEED();
std::scoped_lock lk{m_applet->lock};
R_RETURN(m_applet->terminate_result);
}
Result IApplicationAccessor::GetAppletStateChangedEvent(

View File

@ -58,10 +58,10 @@ Result ILibraryAppletAccessor::IsCompleted(Out<bool> out_is_completed) {
R_SUCCEED();
}
Result ILibraryAppletAccessor::GetResult(Out<Result> out_result) {
Result ILibraryAppletAccessor::GetResult() {
LOG_DEBUG(Service_AM, "called");
*out_result = m_applet->terminate_result;
R_SUCCEED();
std::scoped_lock lk{m_applet->lock};
R_RETURN(m_applet->terminate_result);
}
Result ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero() {

View File

@ -21,7 +21,7 @@ public:
private:
Result GetAppletStateChangedEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);
Result IsCompleted(Out<bool> out_is_completed);
Result GetResult(Out<Result> out_result);
Result GetResult();
Result PresetLibraryAppletGpuTimeSliceZero();
Result Start();
Result RequestExit();

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/core.h"
#include "core/hle/service/am/am_results.h"
#include "core/hle/service/am/applet.h"
#include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/event_observer.h"
@ -250,7 +251,9 @@ void WindowSystem::TerminateChildAppletsLocked(Applet* applet) {
applet->lock.unlock();
for (const auto& child_applet : child_applets) {
std::scoped_lock lk{child_applet->lock};
child_applet->process->Terminate();
child_applet->terminate_result = AM::ResultLibraryAppletTerminated;
}
applet->lock.lock();
}