diff options
| author | 2020-05-16 12:39:58 -0400 | |
|---|---|---|
| committer | 2020-05-16 12:39:58 -0400 | |
| commit | 65010607b7a474e677360a5a465a3169fec41ba0 (patch) | |
| tree | 1e101dc9ecbfcfdf1da6f848e002dc21df0b3a96 /src/core | |
| parent | Merge pull request #3945 from ogniK5377/nvflinger-pixformat (diff) | |
| parent | service: fsp_srv: Stub implementation of OpenMultiCommitManager. (diff) | |
| download | yuzu-65010607b7a474e677360a5a465a3169fec41ba0.tar.gz yuzu-65010607b7a474e677360a5a465a3169fec41ba0.tar.xz yuzu-65010607b7a474e677360a5a465a3169fec41ba0.zip | |
Merge pull request #3665 from bunnei/device-save
FS: Improve emulation of device saves
Diffstat (limited to 'src/core')
| -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 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 38 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.h | 1 |
5 files changed, 49 insertions, 4 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 { | |||
| 95 | return raw.supported_languages; | 95 | return raw.supported_languages; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | u64 NACP::GetDeviceSaveDataSize() const { | ||
| 99 | return raw.device_save_data_size; | ||
| 100 | } | ||
| 101 | |||
| 98 | std::vector<u8> NACP::GetRawBytes() const { | 102 | std::vector<u8> NACP::GetRawBytes() const { |
| 99 | std::vector<u8> out(sizeof(RawNACP)); | 103 | std::vector<u8> out(sizeof(RawNACP)); |
| 100 | std::memcpy(out.data(), &raw, sizeof(RawNACP)); | 104 | 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: | |||
| 113 | u32 GetSupportedLanguages() const; | 113 | u32 GetSupportedLanguages() const; |
| 114 | std::vector<u8> GetRawBytes() const; | 114 | std::vector<u8> GetRawBytes() const; |
| 115 | bool GetUserAccountSwitchLock() const; | 115 | bool GetUserAccountSwitchLock() const; |
| 116 | u64 GetDeviceSaveDataSize() const; | ||
| 116 | 117 | ||
| 117 | private: | 118 | private: |
| 118 | RawNACP raw{}; | 119 | 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) { | |||
| 57 | bool ShouldSaveDataBeAutomaticallyCreated(SaveDataSpaceId space, const SaveDataDescriptor& desc) { | 57 | bool ShouldSaveDataBeAutomaticallyCreated(SaveDataSpaceId space, const SaveDataDescriptor& desc) { |
| 58 | return desc.type == SaveDataType::CacheStorage || desc.type == SaveDataType::TemporaryStorage || | 58 | return desc.type == SaveDataType::CacheStorage || desc.type == SaveDataType::TemporaryStorage || |
| 59 | (space == SaveDataSpaceId::NandUser && ///< Normal Save Data -- Current Title & User | 59 | (space == SaveDataSpaceId::NandUser && ///< Normal Save Data -- Current Title & User |
| 60 | desc.type == SaveDataType::SaveData && desc.title_id == 0 && desc.save_id == 0); | 60 | (desc.type == SaveDataType::SaveData || desc.type == SaveDataType::DeviceSaveData) && |
| 61 | desc.title_id == 0 && desc.save_id == 0); | ||
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | } // Anonymous namespace | 64 | } // Anonymous namespace |
| @@ -139,8 +140,10 @@ std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType typ | |||
| 139 | u128 user_id, u64 save_id) { | 140 | u128 user_id, u64 save_id) { |
| 140 | // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should | 141 | // According to switchbrew, if a save is of type SaveData and the title id field is 0, it should |
| 141 | // be interpreted as the title id of the current process. | 142 | // be interpreted as the title id of the current process. |
| 142 | if (type == SaveDataType::SaveData && title_id == 0) { | 143 | if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) { |
| 143 | title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | 144 | if (title_id == 0) { |
| 145 | title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); | ||
| 146 | } | ||
| 144 | } | 147 | } |
| 145 | 148 | ||
| 146 | std::string out = GetSaveDataSpaceIdPath(space); | 149 | std::string out = GetSaveDataSpaceIdPath(space); |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index f6503fe2f..20c331b77 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -767,7 +767,7 @@ FSP_SRV::FSP_SRV(FileSystemController& fsc, const Core::Reporter& reporter) | |||
| 767 | {1014, nullptr, "OutputMultiProgramTagAccessLog"}, | 767 | {1014, nullptr, "OutputMultiProgramTagAccessLog"}, |
| 768 | {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, | 768 | {1100, nullptr, "OverrideSaveDataTransferTokenSignVerificationKey"}, |
| 769 | {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, | 769 | {1110, nullptr, "CorruptSaveDataFileSystemBySaveDataSpaceId2"}, |
| 770 | {1200, nullptr, "OpenMultiCommitManager"}, | 770 | {1200, &FSP_SRV::OpenMultiCommitManager, "OpenMultiCommitManager"}, |
| 771 | {1300, nullptr, "OpenBisWiper"}, | 771 | {1300, nullptr, "OpenBisWiper"}, |
| 772 | }; | 772 | }; |
| 773 | // clang-format on | 773 | // clang-format on |
| @@ -988,4 +988,40 @@ void FSP_SRV::GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx) { | |||
| 988 | rb.Push(access_log_program_index); | 988 | rb.Push(access_log_program_index); |
| 989 | } | 989 | } |
| 990 | 990 | ||
| 991 | class IMultiCommitManager final : public ServiceFramework<IMultiCommitManager> { | ||
| 992 | public: | ||
| 993 | explicit IMultiCommitManager() : ServiceFramework("IMultiCommitManager") { | ||
| 994 | static const FunctionInfo functions[] = { | ||
| 995 | {1, &IMultiCommitManager::Add, "Add"}, | ||
| 996 | {2, &IMultiCommitManager::Commit, "Commit"}, | ||
| 997 | }; | ||
| 998 | RegisterHandlers(functions); | ||
| 999 | } | ||
| 1000 | |||
| 1001 | private: | ||
| 1002 | FileSys::VirtualFile backend; | ||
| 1003 | |||
| 1004 | void Add(Kernel::HLERequestContext& ctx) { | ||
| 1005 | LOG_WARNING(Service_FS, "(STUBBED) called"); | ||
| 1006 | |||
| 1007 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1008 | rb.Push(RESULT_SUCCESS); | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | void Commit(Kernel::HLERequestContext& ctx) { | ||
| 1012 | LOG_WARNING(Service_FS, "(STUBBED) called"); | ||
| 1013 | |||
| 1014 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 1015 | rb.Push(RESULT_SUCCESS); | ||
| 1016 | } | ||
| 1017 | }; | ||
| 1018 | |||
| 1019 | void FSP_SRV::OpenMultiCommitManager(Kernel::HLERequestContext& ctx) { | ||
| 1020 | LOG_DEBUG(Service_FS, "called"); | ||
| 1021 | |||
| 1022 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 1023 | rb.Push(RESULT_SUCCESS); | ||
| 1024 | rb.PushIpcInterface<IMultiCommitManager>(std::make_shared<IMultiCommitManager>()); | ||
| 1025 | } | ||
| 1026 | |||
| 991 | } // namespace Service::FileSystem | 1027 | } // namespace Service::FileSystem |
diff --git a/src/core/hle/service/filesystem/fsp_srv.h b/src/core/hle/service/filesystem/fsp_srv.h index d52b55999..dfb3e395b 100644 --- a/src/core/hle/service/filesystem/fsp_srv.h +++ b/src/core/hle/service/filesystem/fsp_srv.h | |||
| @@ -50,6 +50,7 @@ private: | |||
| 50 | void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); | 50 | void OpenPatchDataStorageByCurrentProcess(Kernel::HLERequestContext& ctx); |
| 51 | void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); | 51 | void OutputAccessLogToSdCard(Kernel::HLERequestContext& ctx); |
| 52 | void GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx); | 52 | void GetAccessLogVersionInfo(Kernel::HLERequestContext& ctx); |
| 53 | void OpenMultiCommitManager(Kernel::HLERequestContext& ctx); | ||
| 53 | 54 | ||
| 54 | FileSystemController& fsc; | 55 | FileSystemController& fsc; |
| 55 | 56 | ||