diff options
| author | 2018-09-19 22:03:36 -0400 | |
|---|---|---|
| committer | 2018-09-21 19:53:33 -0400 | |
| commit | 50a470eab8a409901250d2d3cca5399e9c243f59 (patch) | |
| tree | ee949077f3794f702e2a9f4e0b148b43c8bd79bd | |
| parent | patch_manager: Add LayeredFS mods support (diff) | |
| download | yuzu-50a470eab8a409901250d2d3cca5399e9c243f59.tar.gz yuzu-50a470eab8a409901250d2d3cca5399e9c243f59.tar.xz yuzu-50a470eab8a409901250d2d3cca5399e9c243f59.zip | |
bis_factory: Add mod directory VFS getter
| -rw-r--r-- | src/core/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/core/file_sys/bis_factory.cpp | 12 | ||||
| -rw-r--r-- | src/core/file_sys/bis_factory.h | 5 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 67d1f9615..ead86fd85 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -32,6 +32,8 @@ add_library(core STATIC | |||
| 32 | file_sys/control_metadata.h | 32 | file_sys/control_metadata.h |
| 33 | file_sys/directory.h | 33 | file_sys/directory.h |
| 34 | file_sys/errors.h | 34 | file_sys/errors.h |
| 35 | file_sys/fsmitm_romfsbuild.cpp | ||
| 36 | file_sys/fsmitm_romfsbuild.hpp | ||
| 35 | file_sys/mode.h | 37 | file_sys/mode.h |
| 36 | file_sys/nca_metadata.cpp | 38 | file_sys/nca_metadata.cpp |
| 37 | file_sys/nca_metadata.h | 39 | file_sys/nca_metadata.h |
| @@ -59,6 +61,8 @@ add_library(core STATIC | |||
| 59 | file_sys/vfs.h | 61 | file_sys/vfs.h |
| 60 | file_sys/vfs_concat.cpp | 62 | file_sys/vfs_concat.cpp |
| 61 | file_sys/vfs_concat.h | 63 | file_sys/vfs_concat.h |
| 64 | file_sys/vfs_layered.cpp | ||
| 65 | file_sys/vfs_layered.h | ||
| 62 | file_sys/vfs_offset.cpp | 66 | file_sys/vfs_offset.cpp |
| 63 | file_sys/vfs_offset.h | 67 | file_sys/vfs_offset.h |
| 64 | file_sys/vfs_real.cpp | 68 | file_sys/vfs_real.cpp |
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 205492897..012e08e7d 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -4,11 +4,12 @@ | |||
| 4 | 4 | ||
| 5 | #include "core/file_sys/bis_factory.h" | 5 | #include "core/file_sys/bis_factory.h" |
| 6 | #include "core/file_sys/registered_cache.h" | 6 | #include "core/file_sys/registered_cache.h" |
| 7 | #include "fmt/format.h" | ||
| 7 | 8 | ||
| 8 | namespace FileSys { | 9 | namespace FileSys { |
| 9 | 10 | ||
| 10 | BISFactory::BISFactory(VirtualDir nand_root_) | 11 | BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_) |
| 11 | : nand_root(std::move(nand_root_)), | 12 | : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), |
| 12 | sysnand_cache(std::make_shared<RegisteredCache>( | 13 | sysnand_cache(std::make_shared<RegisteredCache>( |
| 13 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), | 14 | GetOrCreateDirectoryRelative(nand_root, "/system/Contents/registered"))), |
| 14 | usrnand_cache(std::make_shared<RegisteredCache>( | 15 | usrnand_cache(std::make_shared<RegisteredCache>( |
| @@ -24,4 +25,11 @@ std::shared_ptr<RegisteredCache> BISFactory::GetUserNANDContents() const { | |||
| 24 | return usrnand_cache; | 25 | return usrnand_cache; |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 28 | VirtualDir BISFactory::GetModificationLoadRoot(u64 title_id) const { | ||
| 29 | // LayeredFS doesn't work on updates and title id-less homebrew | ||
| 30 | if (title_id == 0 || (title_id & 0x800) > 0) | ||
| 31 | return nullptr; | ||
| 32 | return GetOrCreateDirectoryRelative(load_root, fmt::format("/{:016X}", title_id)); | ||
| 33 | } | ||
| 34 | |||
| 27 | } // namespace FileSys | 35 | } // namespace FileSys |
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h index 9523dd864..0d81967cc 100644 --- a/src/core/file_sys/bis_factory.h +++ b/src/core/file_sys/bis_factory.h | |||
| @@ -17,14 +17,17 @@ class RegisteredCache; | |||
| 17 | /// registered caches. | 17 | /// registered caches. |
| 18 | class BISFactory { | 18 | class BISFactory { |
| 19 | public: | 19 | public: |
| 20 | explicit BISFactory(VirtualDir nand_root); | 20 | BISFactory(VirtualDir nand_root, VirtualDir load_root); |
| 21 | ~BISFactory(); | 21 | ~BISFactory(); |
| 22 | 22 | ||
| 23 | std::shared_ptr<RegisteredCache> GetSystemNANDContents() const; | 23 | std::shared_ptr<RegisteredCache> GetSystemNANDContents() const; |
| 24 | std::shared_ptr<RegisteredCache> GetUserNANDContents() const; | 24 | std::shared_ptr<RegisteredCache> GetUserNANDContents() const; |
| 25 | 25 | ||
| 26 | VirtualDir GetModificationLoadRoot(u64 title_id) const; | ||
| 27 | |||
| 26 | private: | 28 | private: |
| 27 | VirtualDir nand_root; | 29 | VirtualDir nand_root; |
| 30 | VirtualDir load_root; | ||
| 28 | 31 | ||
| 29 | std::shared_ptr<RegisteredCache> sysnand_cache; | 32 | std::shared_ptr<RegisteredCache> sysnand_cache; |
| 30 | std::shared_ptr<RegisteredCache> usrnand_cache; | 33 | std::shared_ptr<RegisteredCache> usrnand_cache; |