mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
fs.mitm: Add HANS-style redirection for System Data Archives.
This commit is contained in:
parent
ceb93867b4
commit
5c80016c81
13 changed files with 698 additions and 26 deletions
29
stratosphere/fs_mitm/source/fsmitm_utils.cpp
Normal file
29
stratosphere/fs_mitm/source/fsmitm_utils.cpp
Normal file
|
@ -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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue