3
0
Fork 0
forked from suyu/suyu

sdmc_factory: Add SDMC RegisteredCache getter

This commit is contained in:
Zach Hilman 2018-08-16 17:06:56 -04:00
parent 4112dd6b4e
commit 13524578b6
2 changed files with 14 additions and 1 deletions

View file

@ -4,13 +4,23 @@
#include <memory> #include <memory>
#include "core/file_sys/sdmc_factory.h" #include "core/file_sys/sdmc_factory.h"
#include "core/file_sys/xts_archive.h"
namespace FileSys { 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();
})) {}
ResultVal<VirtualDir> SDMCFactory::Open() { ResultVal<VirtualDir> SDMCFactory::Open() {
return MakeResult<VirtualDir>(dir); return MakeResult<VirtualDir>(dir);
} }
std::shared_ptr<RegisteredCache> SDMCFactory::GetSDMCContents() const {
return contents;
}
} // namespace FileSys } // namespace FileSys

View file

@ -15,9 +15,12 @@ public:
explicit SDMCFactory(VirtualDir dir); explicit SDMCFactory(VirtualDir dir);
ResultVal<VirtualDir> Open(); ResultVal<VirtualDir> Open();
std::shared_ptr<RegisteredCache> GetSDMCContents() const;
private: private:
VirtualDir dir; VirtualDir dir;
std::shared_ptr<RegisteredCache> contents;
}; };
} // namespace FileSys } // namespace FileSys