From 272d6db436dbd24a9789252b592563656e0052ff Mon Sep 17 00:00:00 2001 From: Sandla Honerla Date: Tue, 4 Jun 2019 12:43:43 +0530 Subject: [PATCH] Revert cm stuff --- .../loader/source/ldr_content_management.cpp | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index 0f6e96da7..f5f660ab2 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -34,9 +34,11 @@ static FsFileSystem g_HblFileSystem = {}; static std::vector g_created_titles; static bool g_has_initialized_fs_dev = false; + /* Default to Key R, hold disables override, HBL at atmosphere/hbl.nsp. */ static bool g_mounted_hbl_nsp = false; static char g_hbl_sd_path[FS_MAX_PATH+1] = "@Sdcard:/atmosphere/hbl.nsp\x00"; + static OverrideKey g_default_override_key = { .key_combination = KEY_L, .override_by_default = true @@ -103,6 +105,7 @@ Result ContentManagement::MountCode(u64 tid, FsStorageId sid) { if (R_FAILED(rc = fsldrOpenCodeFileSystem(tid, path, &g_CodeFileSystem))) { return rc; } + fsdevMountDevice("code", g_CodeFileSystem); TryMountHblNspOnSd(); return rc; @@ -416,6 +419,7 @@ static bool ShouldOverrideContents(OverrideKey *cfg) { bool keys_triggered = (R_SUCCEEDED(HidManagement::GetKeysHeld(&kDown)) && ((kDown & cfg->key_combination) != 0)); return g_has_initialized_fs_dev && (cfg->override_by_default ^ keys_triggered); } + bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) { if (g_mounted_hbl_nsp && tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) { /* Return whether we should override contents with HBL. */ @@ -425,11 +429,23 @@ bool ContentManagement::ShouldOverrideContentsWithHBL(u64 tid) { return false; } } -bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid){ - // Aliases - Result rc = ContentManagement::ShouldOverrideContentsWithHBL(tid); - return rc; + +bool ContentManagement::ShouldOverrideContentsWithSD(u64 tid) { + if (g_has_initialized_fs_dev) { + if (tid >= TitleId_AppletStart && HasCreatedTitle(TitleId_AppletQlaunch)) { + /* Check whether we should override with non-HBL. */ + OverrideKey title_cfg = GetTitleOverrideKey(tid); + return ShouldOverrideContents(&title_cfg); + } else { + /* Always redirect before qlaunch. */ + return true; + } + } else { + /* Never redirect before we can do so. */ + return false; + } } + /* SetExternalContentSource extension */ ContentManagement::ExternalContentSource *ContentManagement::GetExternalContentSource(u64 tid) { auto i = g_external_content_sources.find(tid);