diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-10-22 21:47:31 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-10-22 21:47:38 +0200 |
commit | bb207fe27adcaa0d4c00b1962a519195ff4fc200 (patch) | |
tree | 1c1c24752586b2ad54b471b1220cef420f383558 /src/core/file_sys | |
parent | Merge pull request #3001 from bunnei/fix-clang-error (diff) | |
download | yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar.gz yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar.bz2 yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar.lz yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar.xz yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.tar.zst yuzu-bb207fe27adcaa0d4c00b1962a519195ff4fc200.zip |
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index fc8755c78..e2a7eaf7b 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -16,6 +16,7 @@ namespace FileSys { constexpr char SAVE_DATA_SIZE_FILENAME[] = ".yuzu_save_size"; namespace { + void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { if (meta.type == SaveDataType::SystemSaveData || meta.type == SaveDataType::SaveData) { if (meta.zero_1 != 0) { @@ -52,6 +53,13 @@ void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { meta.user_id[1], meta.user_id[0]); } } + +bool ShouldSaveDataBeAutomaticallyCreated(SaveDataSpaceId space, const SaveDataDescriptor& desc) { + return desc.type == SaveDataType::CacheStorage || desc.type == SaveDataType::TemporaryStorage || + (space == SaveDataSpaceId::NandUser && ///< Normal Save Data -- Current Title & User + desc.type == SaveDataType::SaveData && desc.title_id == 0 && desc.save_id == 0); +} + } // Anonymous namespace std::string SaveDataDescriptor::DebugInfo() const { @@ -96,6 +104,10 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, auto out = dir->GetDirectoryRelative(save_directory); + if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) { + 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. |