Skip to content

Commit

Permalink
fs.mitm: mitm sdb (allows common sysarchive redir)
Browse files Browse the repository at this point in the history
  • Loading branch information
SciresM committed Dec 31, 2019
1 parent bf5bbfb commit 3e2ec25
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion stratosphere/ams_mitm/source/fs_mitm/fs_mitm_service.hpp
Expand Up @@ -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;

Expand All @@ -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) { /* ... */ }
Expand Down

0 comments on commit 3e2ec25

Please sign in to comment.