mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-10 06:01:52 +00:00
fs.mitm: Allow for disabling mitm for a title via flag.
This commit is contained in:
parent
f10ae4d96f
commit
4944986814
3 changed files with 21 additions and 0 deletions
|
@ -38,6 +38,9 @@ class FsMitMService : public IMitMServiceObject {
|
|||
}
|
||||
|
||||
static bool should_mitm(u64 pid, u64 tid) {
|
||||
if (Utils::HasSdDisableMitMFlag(tid)) {
|
||||
return false;
|
||||
}
|
||||
return (tid >= 0x0100000000010000ULL || Utils::HasSdMitMFlag(tid)) && Utils::HasOverrideButton(tid);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
static FsFileSystem g_sd_filesystem = {0};
|
||||
static std::vector<u64> g_mitm_flagged_tids;
|
||||
static std::vector<u64> g_disable_mitm_flagged_tids;
|
||||
static std::atomic_bool g_has_initialized = false;
|
||||
static std::atomic_bool g_has_hid_session = false;
|
||||
|
||||
|
@ -78,6 +79,15 @@ void Utils::InitializeSdThreadFunc(void *args) {
|
|||
g_mitm_flagged_tids.push_back(title_id);
|
||||
fsFileClose(&f);
|
||||
}
|
||||
|
||||
memset(title_path, 0, sizeof(title_path));
|
||||
strcpy(title_path, "/atmosphere/titles/");
|
||||
strcat(title_path, dir_entry.name);
|
||||
strcat(title_path, "/fsmitm_disable.flag");
|
||||
if (R_SUCCEEDED(fsFsOpenFile(&g_sd_filesystem, title_path, FS_OPEN_READ, &f))) {
|
||||
g_disable_mitm_flagged_tids.push_back(title_id);
|
||||
fsFileClose(&f);
|
||||
}
|
||||
}
|
||||
}
|
||||
fsDirClose(&titles_dir);
|
||||
|
@ -217,6 +227,13 @@ bool Utils::HasSdMitMFlag(u64 tid) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Utils::HasSdDisableMitMFlag(u64 tid) {
|
||||
if (IsSdInitialized()) {
|
||||
return std::find(g_disable_mitm_flagged_tids.begin(), g_disable_mitm_flagged_tids.end(), tid) != g_disable_mitm_flagged_tids.end();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Result Utils::GetKeysDown(u64 *keys) {
|
||||
if (!Utils::IsHidInitialized()) {
|
||||
return MAKERESULT(Module_Libnx, LibnxError_InitFail_HID);
|
||||
|
|
|
@ -37,6 +37,7 @@ class Utils {
|
|||
/* SD card Initialization + MitM detection. */
|
||||
static void InitializeSdThreadFunc(void *args);
|
||||
static bool HasSdMitMFlag(u64 tid);
|
||||
static bool HasSdDisableMitMFlag(u64 tid);
|
||||
|
||||
|
||||
static bool IsHidInitialized();
|
||||
|
|
Loading…
Reference in a new issue