diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-04-10 18:21:51 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-09-21 22:43:10 +0200 |
commit | 8500ca797f430226c86edf694db6a96ee14a8333 (patch) | |
tree | 01679e386bd3c3343c9c154e42c9f420fe514de1 /src/core/file_sys/registered_cache.h | |
parent | bis_factory: Fix mod loader edge-case with homebrew title IDs (diff) | |
download | yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar.gz yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar.bz2 yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar.lz yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar.xz yuzu-8500ca797f430226c86edf694db6a96ee14a8333.tar.zst yuzu-8500ca797f430226c86edf694db6a96ee14a8333.zip |
Diffstat (limited to 'src/core/file_sys/registered_cache.h')
-rw-r--r-- | src/core/file_sys/registered_cache.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 4398d63e1..d1eec240e 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h @@ -25,6 +25,8 @@ enum class NCAContentType : u8; enum class TitleType : u8; struct ContentRecord; +struct MetaRecord; +class RegisteredCache; using NcaID = std::array<u8, 0x10>; using ContentProviderParsingFunction = std::function<VirtualFile(const VirtualFile&, const NcaID&)>; @@ -89,6 +91,27 @@ protected: Core::Crypto::KeyManager keys; }; +class PlaceholderCache { +public: + explicit PlaceholderCache(VirtualDir dir); + + bool Create(const NcaID& id, u64 size) const; + bool Delete(const NcaID& id) const; + bool Exists(const NcaID& id) const; + bool Write(const NcaID& id, u64 offset, const std::vector<u8>& data) const; + bool Register(RegisteredCache* cache, const NcaID& placeholder, const NcaID& install) const; + bool CleanAll() const; + std::optional<std::array<u8, 0x10>> GetRightsID(const NcaID& id) const; + u64 Size(const NcaID& id) const; + bool SetSize(const NcaID& id, u64 new_size) const; + std::vector<NcaID> List() const; + + static NcaID Generate(); + +private: + VirtualDir dir; +}; + /* * A class that catalogues NCAs in the registered directory structure. * Nintendo's registered format follows this structure: @@ -103,6 +126,8 @@ protected: * when 4GB splitting can be ignored.) */ class RegisteredCache : public ContentProvider { + friend class PlaceholderCache; + public: // Parsing function defines the conversion from raw file to NCA. If there are other steps // besides creating the NCA from the file (e.g. NAX0 on SD Card), that should go in a custom |