Fix emummc nintendo dir redirection
This commit is contained in:
@@ -163,11 +163,11 @@ Result FsMitmService::OpenFileSystemWithId(Out<std::shared_ptr<IFileSystemInterf
|
||||
}
|
||||
|
||||
Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterface>> out_fs) {
|
||||
/* We only care about redirecting this for NS/Emunand. */
|
||||
if (!IsEmunand()) {
|
||||
/* We only care about redirecting this for NS/Emummc. */
|
||||
if (this->title_id != TitleId_Ns) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
if (this->title_id != TitleId_Ns) {
|
||||
if (!IsEmummc()) {
|
||||
return ResultAtmosphereMitmShouldForwardToSession;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ Result FsMitmService::OpenSdCardFileSystem(Out<std::shared_ptr<IFileSystemInterf
|
||||
return rc;
|
||||
}
|
||||
|
||||
std::shared_ptr<IFileSystem> redir_fs = std::make_shared<DirectoryRedirectionFileSystem>(new ProxyFileSystem(sd_fs), "/Nintendo", "/Emu/0000" /* TODO: Real Path */);
|
||||
std::shared_ptr<IFileSystem> redir_fs = std::make_shared<DirectoryRedirectionFileSystem>(new ProxyFileSystem(sd_fs), "/Nintendo", GetEmummcNintendoDirPath());
|
||||
fs = std::make_shared<IFileSystemInterface>(redir_fs);
|
||||
if (out_fs.IsDomain()) {
|
||||
out_domain_id = sd_fs.s.object_id;
|
||||
|
||||
@@ -65,6 +65,9 @@ static FsFile g_cal0_file = {0};
|
||||
static u8 g_cal0_storage_backup[ProdinfoSize];
|
||||
static u8 g_cal0_backup[ProdinfoSize];
|
||||
|
||||
/* Emummc-related file. */
|
||||
static FsFile g_emummc_file = {0};
|
||||
|
||||
static bool IsHexadecimal(const char *str) {
|
||||
while (*str) {
|
||||
if (isxdigit(*str)) {
|
||||
@@ -196,6 +199,14 @@ void Utils::InitializeThreadFunc(void *args) {
|
||||
}
|
||||
|
||||
Utils::RefreshConfiguration();
|
||||
|
||||
/* If we're emummc, persist a write handle to prevent other processes from touching the image. */
|
||||
if (IsEmummc()) {
|
||||
const char *emummc_file_path = GetEmummcFilePath();
|
||||
if (emummc_file_path != nullptr) {
|
||||
fsFsOpenFile(&g_sd_filesystem, emummc_file_path, FS_OPEN_READ | FS_OPEN_WRITE, &g_emummc_file);
|
||||
}
|
||||
}
|
||||
|
||||
/* Initialize set:sys. */
|
||||
DoWithSmSession([&]() {
|
||||
|
||||
Submodule stratosphere/libstratosphere updated: 05c58ef002...afcd075354
Reference in New Issue
Block a user