From da0d22f05ae4758e54b70cfe4c289a6263e60ba0 Mon Sep 17 00:00:00 2001 From: natinusala Date: Sun, 6 Jan 2019 21:56:36 +0100 Subject: [PATCH] loader: add 'override any app' feature --- = | 0 .../loader/source/ldr_content_management.cpp | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 = diff --git a/= b/= new file mode 100644 index 000000000..e69de29bb diff --git a/stratosphere/loader/source/ldr_content_management.cpp b/stratosphere/loader/source/ldr_content_management.cpp index d63b242d7..77a17bb5d 100644 --- a/stratosphere/loader/source/ldr_content_management.cpp +++ b/stratosphere/loader/source/ldr_content_management.cpp @@ -40,6 +40,7 @@ static char g_hbl_sd_path[FS_MAX_PATH+1] = "@Sdcard:/atmosphere/hbl.nsp\x00"; static u64 g_override_key_combination = KEY_R; static bool g_override_by_default = true; static u64 g_override_hbl_tid = 0x010000000000100D; +static bool g_override_any_app = false; /* Static buffer for loader.ini contents at runtime. */ static char g_config_ini_data[0x800]; @@ -206,9 +207,14 @@ static int LoaderIniHandler(void *user, const char *section, const char *name, c /* Taken and modified, with love, from Rajkosto's implementation. */ if (strcasecmp(section, "config") == 0) { if (strcasecmp(name, "hbl_tid") == 0) { - u64 override_tid = strtoul(value, NULL, 16); - if (override_tid != 0) { - g_override_hbl_tid = override_tid; + if (strcasecmp(value, "app") == 0) { + g_override_any_app = true; + } + else { + u64 override_tid = strtoul(value, NULL, 16); + if (override_tid != 0) { + g_override_hbl_tid = override_tid; + } } } else if (strcasecmp(name, "hbl_path") == 0) { while (*value == '/' || *value == '\\') { @@ -303,7 +309,7 @@ void ContentManagement::TryMountSdCard() { } bool ContentManagement::ShouldReplaceWithHBL(u64 tid) { - return g_mounted_hbl_nsp && tid == g_override_hbl_tid; + return g_mounted_hbl_nsp && ((g_override_any_app && tid >= 0x0100000000010000) || (!g_override_any_app && tid == g_override_hbl_tid)); } bool ContentManagement::ShouldOverrideContents(u64 tid) {