From 3e2ec256ab4608c81303229c45650c2925c5f7a1 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 31 Dec 2019 01:57:26 -0800 Subject: [PATCH] fs.mitm: mitm sdb (allows common sysarchive redir) --- .../source/fs_mitm/fs_mitm_service.hpp | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.hpp b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.hpp index bf109e7c6..9960228d4 100644 --- a/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.hpp +++ b/stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.hpp @@ -43,6 +43,25 @@ namespace ams::mitm::fs { OpenDataStorageByDataId = 202, }; public: + NX_CONSTEXPR bool ShouldMitmProgramId(const ncm::ProgramId program_id) { + /* We want to mitm everything that isn't a system-module. */ + if (!ncm::IsSystemProgramId(program_id)) { + return true; + } + + /* We want to mitm ns, to intercept SD card requests. */ + if (program_id == ncm::ProgramId::Ns) { + return true; + } + + /* We want to mitm sdb, to support sd-romfs redirection of common system archives (like system font, etc). */ + if (program_id == ncm::ProgramId::Sdb) { + return true; + } + + return false; + } + static bool ShouldMitm(const sm::MitmProcessInfo &client_info) { static std::atomic_bool has_launched_qlaunch = false; @@ -54,7 +73,7 @@ namespace ams::mitm::fs { has_launched_qlaunch = true; } - return has_launched_qlaunch || client_info.program_id == ncm::ProgramId::Ns || !ncm::IsSystemProgramId(client_info.program_id); + return has_launched_qlaunch || ShouldMitmProgramId(client_info.program_id); } public: SF_MITM_SERVICE_OBJECT_CTOR(FsMitmService) { /* ... */ }