fs.mitm: Add HANS-style redirection for System Data Archives.
This commit is contained in:
1 parent
ceb93867b4
commit
5c80016c81
13 files changed
+698
-26
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#include <switch.h>
|
||||
#include <stratosphere.hpp>
|
||||
#include <atomic>
|
||||
|
||||
#include "fsmitm_utils.hpp"
|
||||
|
||||
static FsFileSystem g_sd_filesystem;
|
||||
static bool g_has_initialized = false;
|
||||
|
||||
static Result EnsureInitialized() {
|
||||
if (g_has_initialized) {
|
||||
return 0x0;
|
||||
}
|
||||
Result rc = fsMountSdcard(&g_sd_filesystem);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
g_has_initialized = true;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result Utils::OpenSdFile(const char *fn, int flags, FsFile *out) {
|
||||
Result rc;
|
||||
if (R_FAILED((rc = EnsureInitialized()))) {
|
||||
return rc;
|
||||
}
|
||||
char path[FS_MAX_PATH];
|
||||
strcpy(path, fn);
|
||||
return fsFsOpenFile(&g_sd_filesystem, path, flags, out);
|
||||
}
|
||||
Reference in new issue
Block a user