1
1
Fork 0
forked from suyu/suyu

file_sys/bis_factory: Eliminate usage of the global system accessor

This commit is contained in:
Lioncash 2020-09-16 18:14:43 -04:00
parent aa8d6fc041
commit 0e80567bef
5 changed files with 11 additions and 11 deletions

View file

@ -629,11 +629,11 @@ Loader::AppLoader& System::GetAppLoader() const {
return *impl->app_loader; return *impl->app_loader;
} }
void System::SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs) { void System::SetFilesystem(FileSys::VirtualFilesystem vfs) {
impl->virtual_filesystem = std::move(vfs); impl->virtual_filesystem = std::move(vfs);
} }
std::shared_ptr<FileSys::VfsFilesystem> System::GetFilesystem() const { FileSys::VirtualFilesystem System::GetFilesystem() const {
return impl->virtual_filesystem; return impl->virtual_filesystem;
} }

View file

@ -316,9 +316,9 @@ public:
Service::SM::ServiceManager& ServiceManager(); Service::SM::ServiceManager& ServiceManager();
const Service::SM::ServiceManager& ServiceManager() const; const Service::SM::ServiceManager& ServiceManager() const;
void SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs); void SetFilesystem(FileSys::VirtualFilesystem vfs);
std::shared_ptr<FileSys::VfsFilesystem> GetFilesystem() const; FileSys::VirtualFilesystem GetFilesystem() const;
void RegisterCheatList(const std::vector<Memory::CheatEntry>& list, void RegisterCheatList(const std::vector<Memory::CheatEntry>& list,
const std::array<u8, 0x20>& build_id, VAddr main_region_begin, const std::array<u8, 0x20>& build_id, VAddr main_region_begin,

View file

@ -4,10 +4,10 @@
#include <fmt/format.h> #include <fmt/format.h>
#include "common/file_util.h" #include "common/file_util.h"
#include "core/core.h"
#include "core/file_sys/bis_factory.h" #include "core/file_sys/bis_factory.h"
#include "core/file_sys/mode.h" #include "core/file_sys/mode.h"
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/file_sys/vfs.h"
namespace FileSys { namespace FileSys {
@ -81,11 +81,11 @@ VirtualDir BISFactory::OpenPartition(BisPartitionId id) const {
} }
} }
VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id) const { VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id,
VirtualFilesystem file_system) const {
auto& keys = Core::Crypto::KeyManager::Instance(); auto& keys = Core::Crypto::KeyManager::Instance();
Core::Crypto::PartitionDataManager pdm{ Core::Crypto::PartitionDataManager pdm{file_system->OpenDirectory(
Core::System::GetInstance().GetFilesystem()->OpenDirectory( Common::FS::GetUserPath(Common::FS::UserPath::SysDataDir), Mode::Read)};
Common::FS::GetUserPath(Common::FS::UserPath::SysDataDir), Mode::Read)};
keys.PopulateFromPartitionData(pdm); keys.PopulateFromPartitionData(pdm);
switch (id) { switch (id) {

View file

@ -52,7 +52,7 @@ public:
VirtualDir GetModificationDumpRoot(u64 title_id) const; VirtualDir GetModificationDumpRoot(u64 title_id) const;
VirtualDir OpenPartition(BisPartitionId id) const; VirtualDir OpenPartition(BisPartitionId id) const;
VirtualFile OpenPartitionStorage(BisPartitionId id) const; VirtualFile OpenPartitionStorage(BisPartitionId id, VirtualFilesystem file_system) const;
VirtualDir GetImageDirectory() const; VirtualDir GetImageDirectory() const;

View file

@ -379,7 +379,7 @@ ResultVal<FileSys::VirtualFile> FileSystemController::OpenBISPartitionStorage(
return FileSys::ERROR_ENTITY_NOT_FOUND; return FileSys::ERROR_ENTITY_NOT_FOUND;
} }
auto part = bis_factory->OpenPartitionStorage(id); auto part = bis_factory->OpenPartitionStorage(id, system.GetFilesystem());
if (part == nullptr) { if (part == nullptr) {
return FileSys::ERROR_INVALID_ARGUMENT; return FileSys::ERROR_INVALID_ARGUMENT;
} }