Merge pull request #1835 from lioncash/cache-global

filesystem: De-globalize registered_cache_union
This commit is contained in:
bunnei
2018-12-03 17:11:26 -05:00
committed by GitHub
8 changed files with 26 additions and 40 deletions

View File

@ -341,20 +341,9 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() {
return sdmc_factory->Open();
}
std::shared_ptr<FileSys::RegisteredCacheUnion> registered_cache_union;
std::shared_ptr<FileSys::RegisteredCacheUnion> GetUnionContents() {
if (registered_cache_union == nullptr) {
registered_cache_union =
std::make_shared<FileSys::RegisteredCacheUnion>(std::vector<FileSys::RegisteredCache*>{
GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()});
}
return registered_cache_union;
}
void ClearUnionContents() {
registered_cache_union = nullptr;
FileSys::RegisteredCacheUnion GetUnionContents() {
return FileSys::RegisteredCacheUnion{
{GetSystemNANDContents(), GetUserNANDContents(), GetSDMCContents()}};
}
FileSys::RegisteredCache* GetSystemNANDContents() {
@ -407,7 +396,6 @@ void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
bis_factory = nullptr;
save_data_factory = nullptr;
sdmc_factory = nullptr;
ClearUnionContents();
}
auto nand_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir),