diff --git a/common/defaults/loader.ini b/common/defaults/loader.ini index 882004797..343924de5 100644 --- a/common/defaults/loader.ini +++ b/common/defaults/loader.ini @@ -2,7 +2,8 @@ title_id=010000000000100D override_any_app=true path=atmosphere/hbl.nsp -override_key=R +override_key=!R +override_any_app_key=R [default_config] override_key=!L diff --git a/stratosphere/libstratosphere/source/cfg/cfg_override.cpp b/stratosphere/libstratosphere/source/cfg/cfg_override.cpp index 5140ce814..525c960d1 100644 --- a/stratosphere/libstratosphere/source/cfg/cfg_override.cpp +++ b/stratosphere/libstratosphere/source/cfg/cfg_override.cpp @@ -28,6 +28,7 @@ namespace ams::cfg { struct HblOverrideConfig { OverrideKey override_key; + OverrideKey override_any_app_key; ncm::ProgramId program_id; bool override_any_app; }; @@ -50,6 +51,10 @@ namespace ams::cfg { HblOverrideConfig g_hbl_override_config = { .override_key = { + .key_combination = KEY_R, + .override_by_default = true, + }, + .override_any_app_key = { .key_combination = KEY_R, .override_by_default = false, }, @@ -136,6 +141,8 @@ namespace ams::cfg { } else { /* I guess we default to not changing the value? */ } + } else if (strcasecmp(name, "override_any_app_key") == 0) { + g_hbl_override_config.override_any_app_key = ParseOverrideKey(value); } } else if (strcasecmp(section, "default_config") == 0) { if (strcasecmp(name, "override_key") == 0) { @@ -169,6 +176,14 @@ namespace ams::cfg { return (cfg.override_by_default ^ keys_triggered); } + inline bool IsApplicationHblProgramId(ncm::ProgramId program_id) { + return g_hbl_override_config.override_any_app && ncm::IsApplicationProgramId(program_id); + } + + inline bool IsSpecificHblProgramId(ncm::ProgramId program_id) { + return program_id == g_hbl_override_config.program_id; + } + void ParseIniFile(util::ini::Handler handler, const char *path, void *user_ctx) { /* Mount the SD card. */ FsFileSystem sd_fs = {}; @@ -229,7 +244,9 @@ namespace ams::cfg { } /* Detect Hbl. */ - if (IsHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_key)) { + if ((IsApplicationHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_any_app_key)) || + (IsSpecificHblProgramId(program_id) && IsOverrideMatch(status, g_hbl_override_config.override_key))) + { status.SetHbl(); } @@ -249,7 +266,7 @@ namespace ams::cfg { /* HBL Configuration utilities. */ bool IsHblProgramId(ncm::ProgramId program_id) { - return (g_hbl_override_config.override_any_app && ncm::IsApplicationProgramId(program_id)) || (program_id == g_hbl_override_config.program_id); + return IsApplicationHblProgramId(program_id) || IsSpecificHblProgramId(program_id); } const char *GetHblPath() {