mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-05 19:51:45 +00:00
fs.mitm: Try to MitM titles that have override RomFS content on the SD card
This commit is contained in:
parent
2a6348cd73
commit
5993614c2e
3 changed files with 25 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
#include <stratosphere/iserviceobject.hpp>
|
#include <stratosphere/iserviceobject.hpp>
|
||||||
#include "imitmserviceobject.hpp"
|
#include "imitmserviceobject.hpp"
|
||||||
#include "fs_istorage.hpp"
|
#include "fs_istorage.hpp"
|
||||||
|
#include "fsmitm_utils.hpp"
|
||||||
|
|
||||||
enum class FspSrvCmd {
|
enum class FspSrvCmd {
|
||||||
SetCurrentProcess = 1,
|
SetCurrentProcess = 1,
|
||||||
|
@ -21,7 +22,12 @@ class FsMitMService : public IMitMServiceObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool should_mitm(u64 pid, u64 tid) {
|
static bool should_mitm(u64 pid, u64 tid) {
|
||||||
return tid >= 0x0100000000010000ULL;
|
if (tid >= 0x0100000000010000ULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool has_romfs_content;
|
||||||
|
Result rc = Utils::HasSdRomfsContent(tid, &has_romfs_content);
|
||||||
|
return R_SUCCEEDED(rc) && has_romfs_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
FsMitMService *clone() override {
|
FsMitMService *clone() override {
|
||||||
|
|
|
@ -121,3 +121,19 @@ Result Utils::OpenRomFSDir(FsFileSystem *fs, u64 title_id, const char *path, FsD
|
||||||
}
|
}
|
||||||
return fsFsOpenDirectory(fs, safe_path, FS_DIROPEN_DIRECTORY | FS_DIROPEN_FILE, out);
|
return fsFsOpenDirectory(fs, safe_path, FS_DIROPEN_DIRECTORY | FS_DIROPEN_FILE, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result Utils::HasSdRomfsContent(u64 title_id, bool *out) {
|
||||||
|
Result rc;
|
||||||
|
FsDir dir;
|
||||||
|
if (R_FAILED((rc = Utils::OpenRomFSSdDir(title_id, "", &dir)))) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
FsDirectoryEntry dir_entry;
|
||||||
|
u64 read_entries;
|
||||||
|
if (R_SUCCEEDED((rc = fsDirRead(&dir, 0, &read_entries, 1, &dir_entry)))) {
|
||||||
|
*out = (read_entries == 1);
|
||||||
|
}
|
||||||
|
fsDirClose(&dir);
|
||||||
|
return rc;
|
||||||
|
}
|
|
@ -15,4 +15,6 @@ class Utils {
|
||||||
|
|
||||||
static Result OpenRomFSFile(FsFileSystem *fs, u64 title_id, const char *fn, int flags, FsFile *out);
|
static Result OpenRomFSFile(FsFileSystem *fs, u64 title_id, const char *fn, int flags, FsFile *out);
|
||||||
static Result OpenRomFSDir(FsFileSystem *fs, u64 title_id, const char *path, FsDir *out);
|
static Result OpenRomFSDir(FsFileSystem *fs, u64 title_id, const char *path, FsDir *out);
|
||||||
|
|
||||||
|
static Result HasSdRomfsContent(u64 title_id, bool *out);
|
||||||
};
|
};
|
Loading…
Reference in a new issue