summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/romfs_factory.cpp6
-rw-r--r--src/core/file_sys/savedata_factory.cpp10
-rw-r--r--src/core/file_sys/savedata_factory.h3
3 files changed, 13 insertions, 6 deletions
diff --git a/src/core/file_sys/romfs_factory.cpp b/src/core/file_sys/romfs_factory.cpp
index aa7f3072f..638c6cea8 100644
--- a/src/core/file_sys/romfs_factory.cpp
+++ b/src/core/file_sys/romfs_factory.cpp
@@ -53,7 +53,7 @@ ResultVal<VirtualFile> RomFSFactory::OpenPatchedRomFS(u64 title_id, ContentRecor
if (nca == nullptr) {
// TODO: Find the right error code to use here
- return RESULT_UNKNOWN;
+ return ResultUnknown;
}
const PatchManager patch_manager{title_id, filesystem_controller, content_provider};
@@ -74,13 +74,13 @@ ResultVal<VirtualFile> RomFSFactory::Open(u64 title_id, StorageId storage,
const std::shared_ptr<NCA> res = GetEntry(title_id, storage, type);
if (res == nullptr) {
// TODO(DarkLordZach): Find the right error code to use here
- return RESULT_UNKNOWN;
+ return ResultUnknown;
}
const auto romfs = res->GetRomFS();
if (romfs == nullptr) {
// TODO(DarkLordZach): Find the right error code to use here
- return RESULT_UNKNOWN;
+ return ResultUnknown;
}
return MakeResult<VirtualFile>(romfs);
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp
index f973d1d21..b5254dd75 100644
--- a/src/core/file_sys/savedata_factory.cpp
+++ b/src/core/file_sys/savedata_factory.cpp
@@ -91,7 +91,7 @@ ResultVal<VirtualDir> SaveDataFactory::Create(SaveDataSpaceId space,
// Return an error if the save data doesn't actually exist.
if (out == nullptr) {
// TODO(DarkLordZach): Find out correct error code.
- return RESULT_UNKNOWN;
+ return ResultUnknown;
}
return MakeResult<VirtualDir>(std::move(out));
@@ -105,14 +105,14 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space,
auto out = dir->GetDirectoryRelative(save_directory);
- if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) {
+ if (out == nullptr && (ShouldSaveDataBeAutomaticallyCreated(space, meta) && auto_create)) {
return Create(space, meta);
}
// Return an error if the save data doesn't actually exist.
if (out == nullptr) {
// TODO(Subv): Find out correct error code.
- return RESULT_UNKNOWN;
+ return ResultUnknown;
}
return MakeResult<VirtualDir>(std::move(out));
@@ -199,4 +199,8 @@ void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 us
size_file->WriteObject(new_value);
}
+void SaveDataFactory::SetAutoCreate(bool state) {
+ auto_create = state;
+}
+
} // namespace FileSys
diff --git a/src/core/file_sys/savedata_factory.h b/src/core/file_sys/savedata_factory.h
index 86c9f5350..1d8dc981f 100644
--- a/src/core/file_sys/savedata_factory.h
+++ b/src/core/file_sys/savedata_factory.h
@@ -104,9 +104,12 @@ public:
void WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id,
SaveDataSize new_value) const;
+ void SetAutoCreate(bool state);
+
private:
VirtualDir dir;
Core::System& system;
+ bool auto_create{true};
};
} // namespace FileSys