1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 22:02:15 +00:00

loader: separate override_any_app (deprecate =app)

This commit is contained in:
Michael Scire 2019-03-22 06:59:28 -07:00
parent 761c383958
commit 9e1e9ff8c0
3 changed files with 24 additions and 4 deletions

View file

@ -1,5 +1,6 @@
[hbl_config] [hbl_config]
title_id=010000000000100D title_id=010000000000100D
override_any_app=false
path=atmosphere/hbl.nsp path=atmosphere/hbl.nsp
override_key=!R override_key=!R

View file

@ -380,7 +380,7 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
} }
bool Utils::IsHblTid(u64 tid) { bool Utils::IsHblTid(u64 tid) {
return (g_hbl_override_config.override_any_app && IsApplicationTid(tid)) || (!g_hbl_override_config.override_any_app && tid == g_hbl_override_config.title_id); return (g_hbl_override_config.override_any_app && IsApplicationTid(tid)) || (tid == g_hbl_override_config.title_id);
} }
bool Utils::HasTitleFlag(u64 tid, const char *flag) { bool Utils::HasTitleFlag(u64 tid, const char *flag) {
@ -541,7 +541,9 @@ static int FsMitmIniHandler(void *user, const char *section, const char *name, c
if (strcasecmp(section, "hbl_config") == 0) { if (strcasecmp(section, "hbl_config") == 0) {
if (strcasecmp(name, "title_id") == 0) { if (strcasecmp(name, "title_id") == 0) {
if (strcasecmp(value, "app") == 0) { if (strcasecmp(value, "app") == 0) {
/* DEPRECATED */
g_hbl_override_config.override_any_app = true; g_hbl_override_config.override_any_app = true;
g_hbl_override_config.title_id = 0;
} }
else { else {
u64 override_tid = strtoul(value, NULL, 16); u64 override_tid = strtoul(value, NULL, 16);
@ -551,6 +553,14 @@ static int FsMitmIniHandler(void *user, const char *section, const char *name, c
} }
} else if (strcasecmp(name, "override_key") == 0) { } else if (strcasecmp(name, "override_key") == 0) {
g_hbl_override_config.override_key = ParseOverrideKey(value); g_hbl_override_config.override_key = ParseOverrideKey(value);
} else if (strcasecmp(name, "override_any_app") == 0) {
if (strcasecmp(value, "true") == 0 || strcasecmp(value, "1") == 0) {
g_hbl_override_config.override_any_app = true;
} else if (strcasecmp(value, "false") == 0 || strcasecmp(value, "0") == 0) {
g_hbl_override_config.override_any_app = false;
} else {
/* I guess we default to not changing the value? */
}
} }
} else if (strcasecmp(section, "default_config") == 0) { } else if (strcasecmp(section, "default_config") == 0) {
if (strcasecmp(name, "override_key") == 0) { if (strcasecmp(name, "override_key") == 0) {

View file

@ -306,9 +306,10 @@ static int LoaderIniHandler(void *user, const char *section, const char *name, c
if (strcasecmp(section, "hbl_config") == 0) { if (strcasecmp(section, "hbl_config") == 0) {
if (strcasecmp(name, "title_id") == 0) { if (strcasecmp(name, "title_id") == 0) {
if (strcasecmp(value, "app") == 0) { if (strcasecmp(value, "app") == 0) {
/* DEPRECATED */
g_hbl_override_config.override_any_app = true; g_hbl_override_config.override_any_app = true;
} g_hbl_override_config.title_id = 0;
else { } else {
u64 override_tid = strtoul(value, NULL, 16); u64 override_tid = strtoul(value, NULL, 16);
if (override_tid != 0) { if (override_tid != 0) {
g_hbl_override_config.title_id = override_tid; g_hbl_override_config.title_id = override_tid;
@ -322,6 +323,14 @@ static int LoaderIniHandler(void *user, const char *section, const char *name, c
g_hbl_sd_path[FS_MAX_PATH] = 0; g_hbl_sd_path[FS_MAX_PATH] = 0;
} else if (strcasecmp(name, "override_key") == 0) { } else if (strcasecmp(name, "override_key") == 0) {
g_hbl_override_config.override_key = ParseOverrideKey(value); g_hbl_override_config.override_key = ParseOverrideKey(value);
} else if (strcasecmp(name, "override_any_app") == 0) {
if (strcasecmp(value, "true") == 0 || strcasecmp(value, "1") == 0) {
g_hbl_override_config.override_any_app = true;
} else if (strcasecmp(value, "false") == 0 || strcasecmp(value, "0") == 0) {
g_hbl_override_config.override_any_app = false;
} else {
/* I guess we default to not changing the value? */
}
} }
} else if (strcasecmp(section, "default_config") == 0) { } else if (strcasecmp(section, "default_config") == 0) {
if (strcasecmp(name, "override_key") == 0) { if (strcasecmp(name, "override_key") == 0) {
@ -380,7 +389,7 @@ void ContentManagement::TryMountSdCard() {
} }
static bool IsHBLTitleId(u64 tid) { static bool IsHBLTitleId(u64 tid) {
return ((g_hbl_override_config.override_any_app && IsApplicationTid(tid)) || (!g_hbl_override_config.override_any_app && tid == g_hbl_override_config.title_id)); return ((g_hbl_override_config.override_any_app && IsApplicationTid(tid)) || (tid == g_hbl_override_config.title_id));
} }
OverrideKey ContentManagement::GetTitleOverrideKey(u64 tid) { OverrideKey ContentManagement::GetTitleOverrideKey(u64 tid) {