From e5c5101e8aa7cbc17e2ea860b70b21228cedf336 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Thu, 27 Jun 2019 20:51:57 -0700 Subject: [PATCH] Add missing extension cleanup. --- stratosphere/libstratosphere | 2 +- .../loader/source/ldr_process_creation.cpp | 21 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/stratosphere/libstratosphere b/stratosphere/libstratosphere index e37089d16..403f1c7a0 160000 --- a/stratosphere/libstratosphere +++ b/stratosphere/libstratosphere @@ -1 +1 @@ -Subproject commit e37089d167ff2cd8009924bfa32ab179db918376 +Subproject commit 403f1c7a014c47bf7e907da04df9f9b591b9f89f diff --git a/stratosphere/loader/source/ldr_process_creation.cpp b/stratosphere/loader/source/ldr_process_creation.cpp index ad81b9615..d3238a051 100644 --- a/stratosphere/loader/source/ldr_process_creation.cpp +++ b/stratosphere/loader/source/ldr_process_creation.cpp @@ -21,6 +21,7 @@ #include "ldr_capabilities.hpp" #include "ldr_content_management.hpp" +#include "ldr_ecs.hpp" #include "ldr_launch_record.hpp" #include "ldr_meta.hpp" #include "ldr_patcher.hpp" @@ -669,9 +670,9 @@ namespace sts::ldr { R_TRY(LoadNsosIntoProcessMemory(&info, loc.title_id, nso_headers, has_nso, arg_info)); /* Register NSOs with ro manager. */ + u64 process_id; { /* Nintendo doesn't validate this result, but we will. */ - u64 process_id; R_ASSERT(svcGetProcessId(&process_id, info.process_handle.Get())); /* Register new process. */ @@ -685,13 +686,25 @@ namespace sts::ldr { } } + /* Inform SM about the title for association purposes. */ + R_ASSERT(sm::mitm::AssociateProcessIdAndTitleId(process_id, static_cast(loc.title_id))); + + /* If we're overriding for HBL, perform HTML document redirection. */ + if (mount.IsHblMounted()) { + /* Don't validate result, failure is okay. */ + RedirectHtmlDocumentPathForHbl(loc); + } + + /* Clear the ECS entry for the title. */ + R_ASSERT(ecs::Clear(loc.title_id)); + + /* Note that we've created the title. */ + SetLaunchedTitle(loc.title_id); + /* Move the process handle to output. */ *out = info.process_handle.Move(); } - /* Note that we've created the title. */ - SetLaunchedTitle(loc.title_id); - return ResultSuccess; }