mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-23 10:52:13 +00:00
fs.mitm: match any_app override semantics
This commit is contained in:
parent
da0d22f05a
commit
a899a61f80
2 changed files with 17 additions and 5 deletions
|
@ -33,6 +33,7 @@ static std::atomic_bool g_has_hid_session = false;
|
||||||
|
|
||||||
static u64 g_override_key_combination = KEY_R;
|
static u64 g_override_key_combination = KEY_R;
|
||||||
static u64 g_override_hbl_tid = 0x010000000000100DULL;
|
static u64 g_override_hbl_tid = 0x010000000000100DULL;
|
||||||
|
static bool g_override_any_app = false;
|
||||||
static bool g_override_by_default = true;
|
static bool g_override_by_default = true;
|
||||||
|
|
||||||
/* Static buffer for loader.ini contents at runtime. */
|
/* Static buffer for loader.ini contents at runtime. */
|
||||||
|
@ -348,6 +349,10 @@ Result Utils::SaveSdFileForAtmosphere(u64 title_id, const char *fn, void *data,
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Utils::IsHblTid(u64 tid) {
|
||||||
|
return (g_override_any_app && tid >= 0x0100000000010000ULL) || (!g_override_any_app && tid == g_override_hbl_tid);
|
||||||
|
}
|
||||||
|
|
||||||
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
bool Utils::HasTitleFlag(u64 tid, const char *flag) {
|
||||||
if (IsSdInitialized()) {
|
if (IsSdInitialized()) {
|
||||||
FsFile f;
|
FsFile f;
|
||||||
|
@ -390,11 +395,11 @@ bool Utils::HasHblFlag(const char *flag) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::HasFlag(u64 tid, const char *flag) {
|
bool Utils::HasFlag(u64 tid, const char *flag) {
|
||||||
return HasTitleFlag(tid, flag) || (tid == g_override_hbl_tid && HasHblFlag(flag));
|
return HasTitleFlag(tid, flag) || (IsHblTid(tid) && HasHblFlag(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utils::HasSdMitMFlag(u64 tid) {
|
bool Utils::HasSdMitMFlag(u64 tid) {
|
||||||
if (tid == g_override_hbl_tid) {
|
if (IsHblTid(tid)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,10 +446,15 @@ static int FsMitMIniHandler(void *user, const char *section, const char *name, c
|
||||||
/* Taken and modified, with love, from Rajkosto's implementation. */
|
/* Taken and modified, with love, from Rajkosto's implementation. */
|
||||||
if (strcasecmp(section, "config") == 0) {
|
if (strcasecmp(section, "config") == 0) {
|
||||||
if (strcasecmp(name, "hbl_tid") == 0) {
|
if (strcasecmp(name, "hbl_tid") == 0) {
|
||||||
|
if (strcasecmp(value, "app") == 0) {
|
||||||
|
g_override_any_app = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
u64 override_tid = strtoul(value, NULL, 16);
|
u64 override_tid = strtoul(value, NULL, 16);
|
||||||
if (override_tid != 0) {
|
if (override_tid != 0) {
|
||||||
g_override_hbl_tid = override_tid;
|
g_override_hbl_tid = override_tid;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (strcasecmp(name, "override_key") == 0) {
|
} else if (strcasecmp(name, "override_key") == 0) {
|
||||||
if (value[0] == '!') {
|
if (value[0] == '!') {
|
||||||
g_override_by_default = true;
|
g_override_by_default = true;
|
||||||
|
|
|
@ -58,6 +58,8 @@ class Utils {
|
||||||
/* SD card Initialization + MitM detection. */
|
/* SD card Initialization + MitM detection. */
|
||||||
static void InitializeSdThreadFunc(void *args);
|
static void InitializeSdThreadFunc(void *args);
|
||||||
|
|
||||||
|
static bool IsHblTid(u64 tid);
|
||||||
|
|
||||||
static bool HasTitleFlag(u64 tid, const char *flag);
|
static bool HasTitleFlag(u64 tid, const char *flag);
|
||||||
static bool HasHblFlag(const char *flag);
|
static bool HasHblFlag(const char *flag);
|
||||||
static bool HasGlobalFlag(const char *flag);
|
static bool HasGlobalFlag(const char *flag);
|
||||||
|
|
Loading…
Reference in a new issue