diff options
| author | 2018-08-09 20:49:45 -0400 | |
|---|---|---|
| committer | 2018-08-11 22:50:48 -0400 | |
| commit | 70a510bd8f2f8d150abe632c94dc9a3eb247e43f (patch) | |
| tree | 349c3b175f2b1dfed827587a117b2720cb93ff55 /src | |
| parent | loader: Join 0* files in directory if filename is 00 (diff) | |
| download | yuzu-70a510bd8f2f8d150abe632c94dc9a3eb247e43f.tar.gz yuzu-70a510bd8f2f8d150abe632c94dc9a3eb247e43f.tar.xz yuzu-70a510bd8f2f8d150abe632c94dc9a3eb247e43f.zip | |
bis_factory: Add partial implementation of BISFactory
Creates and stores RegisteredCaches for user and system NAND, as creation of a RegisteredCache is expensive.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/file_sys/bis_factory.cpp | 24 | ||||
| -rw-r--r-- | src/core/file_sys/bis_factory.h | 30 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp new file mode 100644 index 000000000..7d0de733b --- /dev/null +++ b/src/core/file_sys/bis_factory.cpp | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/file_sys/bis_factory.h" | ||
| 6 | |||
| 7 | namespace FileSys { | ||
| 8 | |||
| 9 | BISFactory::BISFactory(VirtualDir nand_root_) | ||
| 10 | : nand_root(std::move(nand_root_)), | ||
| 11 | sysnand_cache(std::make_shared<RegisteredCache>( | ||
| 12 | nand_root->GetDirectoryRelative("/system/Contents/registered"))), | ||
| 13 | usrnand_cache(std::make_shared<RegisteredCache>( | ||
| 14 | nand_root->GetDirectoryRelative("/user/Contents/registered"))) {} | ||
| 15 | |||
| 16 | std::shared_ptr<RegisteredCache> BISFactory::GetSystemNANDContents() const { | ||
| 17 | return sysnand_cache; | ||
| 18 | } | ||
| 19 | |||
| 20 | std::shared_ptr<RegisteredCache> BISFactory::GetUserNANDContents() const { | ||
| 21 | return usrnand_cache; | ||
| 22 | } | ||
| 23 | |||
| 24 | } // namespace FileSys | ||
diff --git a/src/core/file_sys/bis_factory.h b/src/core/file_sys/bis_factory.h new file mode 100644 index 000000000..a970a5e2e --- /dev/null +++ b/src/core/file_sys/bis_factory.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include "core/loader/loader.h" | ||
| 9 | #include "registered_cache.h" | ||
| 10 | |||
| 11 | namespace FileSys { | ||
| 12 | |||
| 13 | /// File system interface to the Built-In Storage | ||
| 14 | /// This is currently missing accessors to BIS partitions, but seemed like a good place for the NAND | ||
| 15 | /// registered caches. | ||
| 16 | class BISFactory { | ||
| 17 | public: | ||
| 18 | explicit BISFactory(VirtualDir nand_root); | ||
| 19 | |||
| 20 | std::shared_ptr<RegisteredCache> GetSystemNANDContents() const; | ||
| 21 | std::shared_ptr<RegisteredCache> GetUserNANDContents() const; | ||
| 22 | |||
| 23 | private: | ||
| 24 | VirtualDir nand_root; | ||
| 25 | |||
| 26 | std::shared_ptr<RegisteredCache> sysnand_cache; | ||
| 27 | std::shared_ptr<RegisteredCache> usrnand_cache; | ||
| 28 | }; | ||
| 29 | |||
| 30 | } // namespace FileSys | ||