diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-08-12 05:01:38 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-08-12 05:01:42 +0200 |
commit | 6b76b774007020befdaa8d7475a9a4edd6d0a0a4 (patch) | |
tree | 2df8544c20f22914520ea397524d3a91159131a5 /src/core/file_sys/registered_cache.h | |
parent | game_list: Split game list scans to multiple functions (diff) | |
download | yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar.gz yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar.bz2 yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar.lz yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar.xz yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.tar.zst yuzu-6b76b774007020befdaa8d7475a9a4edd6d0a0a4.zip |
Diffstat (limited to 'src/core/file_sys/registered_cache.h')
-rw-r--r-- | src/core/file_sys/registered_cache.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index f2b07eec8..a7c51a59c 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h @@ -25,6 +25,13 @@ using NcaID = std::array<u8, 0x10>; using RegisteredCacheParsingFunction = std::function<VirtualFile(const VirtualFile&, const NcaID&)>; using VfsCopyFunction = std::function<bool(VirtualFile, VirtualFile)>; +enum class InstallResult { + Success, + ErrorAlreadyExists, + ErrorCopyFailed, + ErrorMetaFailed, +}; + struct RegisteredCacheEntry { u64 title_id; ContentRecordType type; @@ -77,14 +84,16 @@ public: // Raw copies all the ncas from the xci to the csache. Does some quick checks to make sure there // is a meta NCA and all of them are accessible. - bool InstallEntry(std::shared_ptr<XCI> xci, const VfsCopyFunction& copy = &VfsRawCopy); + InstallResult InstallEntry(std::shared_ptr<XCI> xci, bool overwrite_if_exists = false, + const VfsCopyFunction& copy = &VfsRawCopy); // Due to the fact that we must use Meta-type NCAs to determine the existance of files, this // poses quite a challenge. Instead of creating a new meta NCA for this file, yuzu will create a // dir inside the NAND called 'yuzu_meta' and store the raw CNMT there. // TODO(DarkLordZach): Author real meta-type NCAs and install those. - bool InstallEntry(std::shared_ptr<NCA> nca, TitleType type, - const VfsCopyFunction& copy = &VfsRawCopy); + InstallResult InstallEntry(std::shared_ptr<NCA> nca, TitleType type, + bool overwrite_if_exists = false, + const VfsCopyFunction& copy = &VfsRawCopy); private: template <typename T> @@ -97,8 +106,9 @@ private: boost::optional<NcaID> GetNcaIDFromMetadata(u64 title_id, ContentRecordType type) const; VirtualFile GetFileAtID(NcaID id) const; VirtualFile OpenFileOrDirectoryConcat(const VirtualDir& dir, std::string_view path) const; - bool RawInstallNCA(std::shared_ptr<NCA> nca, const VfsCopyFunction& copy, - boost::optional<NcaID> override_id = boost::none); + InstallResult RawInstallNCA(std::shared_ptr<NCA> nca, const VfsCopyFunction& copy, + bool overwrite_if_exists, + boost::optional<NcaID> override_id = boost::none); bool RawInstallYuzuMeta(const CNMT& cnmt); VirtualDir dir; |