diff options
Diffstat (limited to 'src/core')
| -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 { | |||
| 16 | constexpr char SAVE_DATA_SIZE_FILENAME[] = ".yuzu_save_size"; | 16 | constexpr char SAVE_DATA_SIZE_FILENAME[] = ".yuzu_save_size"; |
| 17 | 17 | ||
| 18 | namespace { | 18 | namespace { |
| 19 | |||
| 19 | void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { | 20 | void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { |
| 20 | if (meta.type == SaveDataType::SystemSaveData || meta.type == SaveDataType::SaveData) { | 21 | if (meta.type == SaveDataType::SystemSaveData || meta.type == SaveDataType::SaveData) { |
| 21 | if (meta.zero_1 != 0) { | 22 | if (meta.zero_1 != 0) { |
| @@ -52,6 +53,13 @@ void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { | |||
| 52 | meta.user_id[1], meta.user_id[0]); | 53 | meta.user_id[1], meta.user_id[0]); |
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| 56 | |||
| 57 | bool ShouldSaveDataBeAutomaticallyCreated(SaveDataSpaceId space, const SaveDataDescriptor& desc) { | ||
| 58 | return desc.type == SaveDataType::CacheStorage || desc.type == SaveDataType::TemporaryStorage || | ||
| 59 | (space == SaveDataSpaceId::NandUser && ///< Normal Save Data -- Current Title & User | ||
| 60 | desc.type == SaveDataType::SaveData && desc.title_id == 0 && desc.save_id == 0); | ||
| 61 | } | ||
| 62 | |||
| 55 | } // Anonymous namespace | 63 | } // Anonymous namespace |
| 56 | 64 | ||
| 57 | std::string SaveDataDescriptor::DebugInfo() const { | 65 | std::string SaveDataDescriptor::DebugInfo() const { |
| @@ -96,6 +104,10 @@ ResultVal<VirtualDir> SaveDataFactory::Open(SaveDataSpaceId space, | |||
| 96 | 104 | ||
| 97 | auto out = dir->GetDirectoryRelative(save_directory); | 105 | auto out = dir->GetDirectoryRelative(save_directory); |
| 98 | 106 | ||
| 107 | if (out == nullptr && ShouldSaveDataBeAutomaticallyCreated(space, meta)) { | ||
| 108 | return Create(space, meta); | ||
| 109 | } | ||
| 110 | |||
| 99 | // Return an error if the save data doesn't actually exist. | 111 | // Return an error if the save data doesn't actually exist. |
| 100 | if (out == nullptr) { | 112 | if (out == nullptr) { |
| 101 | // TODO(Subv): Find out correct error code. | 113 | // TODO(Subv): Find out correct error code. |