diff options
author | bunnei <bunneidev@gmail.com> | 2021-05-03 00:12:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 00:12:07 +0200 |
commit | c17a59b58e4c78dfee976dabddd13c3c6fdf95b7 (patch) | |
tree | 7a935c140bd467ca9e5e3ca27547ee6fee14861f /src/core/file_sys/savedata_factory.cpp | |
parent | Merge pull request #6263 from Kewlan/folder-swap-expand-state (diff) | |
parent | file_sys: Resolve cases of variable shadowing (diff) | |
download | yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.gz yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.bz2 yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.lz yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.xz yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.tar.zst yuzu-c17a59b58e4c78dfee976dabddd13c3c6fdf95b7.zip |
Diffstat (limited to 'src/core/file_sys/savedata_factory.cpp')
-rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index b7bfe0928..fa68af3a8 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -170,26 +170,30 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, SaveDataSpaceId s SaveDataSize SaveDataFactory::ReadSaveDataSize(SaveDataType type, u64 title_id, u128 user_id) const { const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); - const auto dir = GetOrCreateDirectoryRelative(this->dir, path); + const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); - const auto size_file = dir->GetFile(SAVE_DATA_SIZE_FILENAME); - if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) + const auto size_file = relative_dir->GetFile(SAVE_DATA_SIZE_FILENAME); + if (size_file == nullptr || size_file->GetSize() < sizeof(SaveDataSize)) { return {0, 0}; + } SaveDataSize out; - if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) + if (size_file->ReadObject(&out) != sizeof(SaveDataSize)) { return {0, 0}; + } + return out; } void SaveDataFactory::WriteSaveDataSize(SaveDataType type, u64 title_id, u128 user_id, SaveDataSize new_value) const { const auto path = GetFullPath(system, SaveDataSpaceId::NandUser, type, title_id, user_id, 0); - const auto dir = GetOrCreateDirectoryRelative(this->dir, path); + const auto relative_dir = GetOrCreateDirectoryRelative(dir, path); - const auto size_file = dir->CreateFile(SAVE_DATA_SIZE_FILENAME); - if (size_file == nullptr) + const auto size_file = relative_dir->CreateFile(SAVE_DATA_SIZE_FILENAME); + if (size_file == nullptr) { return; + } size_file->Resize(sizeof(SaveDataSize)); size_file->WriteObject(new_value); |