diff options
| author | Mat M <mathew1800@gmail.com> | 2018-08-24 23:47:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-24 23:47:46 -0400 |
| commit | 6426b0f5514d6a7c5cc369368947eceb380bfc85 (patch) | |
| tree | b7acdc39a4344570a6f2c098c30ad20114bf84db /src/core/file_sys/sdmc_factory.cpp | |
| parent | f09da5d1c97d83b7e0654785ae49179ca6cd82be (diff) | |
| parent | 6314a799aa7e20789562d2e877949dfebb6194ce (diff) | |
Merge pull request #1094 from DarkLordZach/nax0
file_sys: Add support for NAX archives
Diffstat (limited to 'src/core/file_sys/sdmc_factory.cpp')
| -rw-r--r-- | src/core/file_sys/sdmc_factory.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp index d1acf379f..d66a9c9a4 100644 --- a/src/core/file_sys/sdmc_factory.cpp +++ b/src/core/file_sys/sdmc_factory.cpp @@ -3,14 +3,27 @@ // Refer to the license.txt file included. #include <memory> +#include "core/file_sys/registered_cache.h" #include "core/file_sys/sdmc_factory.h" +#include "core/file_sys/xts_archive.h" namespace FileSys { -SDMCFactory::SDMCFactory(VirtualDir dir) : dir(std::move(dir)) {} +SDMCFactory::SDMCFactory(VirtualDir dir_) + : dir(std::move(dir_)), contents(std::make_shared<RegisteredCache>( + GetOrCreateDirectoryRelative(dir, "/Nintendo/Contents/registered"), + [](const VirtualFile& file, const NcaID& id) { + return std::make_shared<NAX>(file, id)->GetDecrypted(); + })) {} + +SDMCFactory::~SDMCFactory() = default; ResultVal<VirtualDir> SDMCFactory::Open() { return MakeResult<VirtualDir>(dir); } +std::shared_ptr<RegisteredCache> SDMCFactory::GetSDMCContents() const { + return contents; +} + } // namespace FileSys |
