diff options
| author | bunnei <bunneidev@gmail.com> | 2020-05-16 12:39:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-16 12:39:58 -0400 |
| commit | 65010607b7a474e677360a5a465a3169fec41ba0 (patch) | |
| tree | 1e101dc9ecbfcfdf1da6f848e002dc21df0b3a96 /src/core/file_sys | |
| parent | 3c378a31b5ed9b6e8c8b5dd1861a81c8e55e75ae (diff) | |
| parent | 47b97b95773e1cf1c4acd387ce4011b34cb67180 (diff) | |
Merge pull request #3665 from bunnei/device-save
FS: Improve emulation of device saves
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/control_metadata.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/control_metadata.h | 1 | ||||
| -rw-r--r-- | src/core/file_sys/savedata_factory.cpp | 9 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/core/file_sys/control_metadata.cpp b/src/core/file_sys/control_metadata.cpp index f155a1341..63cd2eead 100644 --- a/src/core/file_sys/control_metadata.cpp +++ b/src/core/file_sys/control_metadata.cpp @@ -95,6 +95,10 @@ u32 NACP::GetSupportedLanguages() const { return raw.supported_languages; } +u64 NACP::GetDeviceSaveDataSize() const { + return raw.device_save_data_size; +} + std::vector<u8> NACP::GetRawBytes() const { std::vector<u8> out(sizeof(RawNACP)); std::memcpy(out.data(), &raw, sizeof(RawNACP)); diff --git a/src/core/file_sys/control_metadata.h b/src/core/file_sys/control_metadata.h index 2d8c251ac..e37b2fadf 100644 --- a/src/core/file_sys/control_metadata.h +++ b/src/core/file_sys/control_metadata.h @@ -113,6 +113,7 @@ public: u32 GetSupportedLanguages() const; std::vector<u8> GetRawBytes() const; bool GetUserAccountSwitchLock() const; + u64 GetDeviceSaveDataSize() const; private: RawNACP raw{}; diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index f3def93ab..adfd2c1a4 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -57,7 +57,8 @@ void PrintSaveDataDescriptorWarnings(SaveDataDescriptor meta) { 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); + (desc.type == SaveDataType::SaveData || desc.type == SaveDataType::DeviceSaveData) && + desc.title_id == 0 && desc.save_id == 0); } } // Anonymous namespace @@ -139,8 +140,10 @@ std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType typ u128 user_id, u64 save_id) { // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should // be interpreted as the title id of the current process. - if (type == SaveDataType::SaveData && title_id == 0) { - title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); + if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) { + if (title_id == 0) { + title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); + } } std::string out = GetSaveDataSpaceIdPath(space); |
