mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-27 10:21:21 -08:00
filesystem: Add Open and Register functions for BISFactory
This commit is contained in:
parent
70a510bd8f
commit
c0257cf52f
@ -226,6 +226,7 @@ ResultVal<FileSys::EntryType> VfsDirectoryServiceWrapper::GetEntryType(
|
|||||||
static std::unique_ptr<FileSys::RomFSFactory> romfs_factory;
|
static std::unique_ptr<FileSys::RomFSFactory> romfs_factory;
|
||||||
static std::unique_ptr<FileSys::SaveDataFactory> save_data_factory;
|
static std::unique_ptr<FileSys::SaveDataFactory> save_data_factory;
|
||||||
static std::unique_ptr<FileSys::SDMCFactory> sdmc_factory;
|
static std::unique_ptr<FileSys::SDMCFactory> sdmc_factory;
|
||||||
|
static std::unique_ptr<FileSys::BISFactory> bis_factory;
|
||||||
|
|
||||||
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) {
|
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory) {
|
||||||
ASSERT_MSG(romfs_factory == nullptr, "Tried to register a second RomFS");
|
ASSERT_MSG(romfs_factory == nullptr, "Tried to register a second RomFS");
|
||||||
@ -248,6 +249,13 @@ ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory) {
|
|||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory) {
|
||||||
|
ASSERT_MSG(bis_factory == nullptr, "Tried to register a second BIS");
|
||||||
|
bis_factory = std::move(factory);
|
||||||
|
LOG_DEBUG(Service_FS, "Registred BIS");
|
||||||
|
return RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id) {
|
ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id) {
|
||||||
LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}", title_id);
|
LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}", title_id);
|
||||||
|
|
||||||
@ -281,6 +289,14 @@ ResultVal<FileSys::VirtualDir> OpenSDMC() {
|
|||||||
return sdmc_factory->Open();
|
return sdmc_factory->Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<FileSys::RegisteredCache> GetSystemNANDContents() {
|
||||||
|
return bis_factory->GetSystemNANDContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<FileSys::RegisteredCache> GetUserNANDContents() {
|
||||||
|
return bis_factory->GetUserNANDContents();
|
||||||
|
}
|
||||||
|
|
||||||
void RegisterFileSystems(const FileSys::VirtualFilesystem& vfs) {
|
void RegisterFileSystems(const FileSys::VirtualFilesystem& vfs) {
|
||||||
romfs_factory = nullptr;
|
romfs_factory = nullptr;
|
||||||
save_data_factory = nullptr;
|
save_data_factory = nullptr;
|
||||||
@ -291,6 +307,9 @@ void RegisterFileSystems(const FileSys::VirtualFilesystem& vfs) {
|
|||||||
auto sd_directory = vfs->OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir),
|
auto sd_directory = vfs->OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir),
|
||||||
FileSys::Mode::ReadWrite);
|
FileSys::Mode::ReadWrite);
|
||||||
|
|
||||||
|
if (bis_factory == nullptr)
|
||||||
|
bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory);
|
||||||
|
|
||||||
auto savedata = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
|
auto savedata = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
|
||||||
save_data_factory = std::move(savedata);
|
save_data_factory = std::move(savedata);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "core/file_sys/bis_factory.h"
|
||||||
#include "core/file_sys/directory.h"
|
#include "core/file_sys/directory.h"
|
||||||
#include "core/file_sys/mode.h"
|
#include "core/file_sys/mode.h"
|
||||||
#include "core/file_sys/romfs_factory.h"
|
#include "core/file_sys/romfs_factory.h"
|
||||||
@ -24,16 +25,15 @@ namespace FileSystem {
|
|||||||
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
|
ResultCode RegisterRomFS(std::unique_ptr<FileSys::RomFSFactory>&& factory);
|
||||||
ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory);
|
ResultCode RegisterSaveData(std::unique_ptr<FileSys::SaveDataFactory>&& factory);
|
||||||
ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
|
ResultCode RegisterSDMC(std::unique_ptr<FileSys::SDMCFactory>&& factory);
|
||||||
|
ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
|
||||||
|
|
||||||
// TODO(DarkLordZach): BIS Filesystem
|
|
||||||
// ResultCode RegisterBIS(std::unique_ptr<FileSys::BISFactory>&& factory);
|
|
||||||
ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id);
|
ResultVal<FileSys::VirtualFile> OpenRomFS(u64 title_id);
|
||||||
ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
|
ResultVal<FileSys::VirtualDir> OpenSaveData(FileSys::SaveDataSpaceId space,
|
||||||
FileSys::SaveDataDescriptor save_struct);
|
FileSys::SaveDataDescriptor save_struct);
|
||||||
ResultVal<FileSys::VirtualDir> OpenSDMC();
|
ResultVal<FileSys::VirtualDir> OpenSDMC();
|
||||||
|
|
||||||
// TODO(DarkLordZach): BIS Filesystem
|
std::shared_ptr<FileSys::RegisteredCache> GetSystemNANDContents();
|
||||||
// ResultVal<std::unique_ptr<FileSys::FileSystemBackend>> OpenBIS();
|
std::shared_ptr<FileSys::RegisteredCache> GetUserNANDContents();
|
||||||
|
|
||||||
/// Registers all Filesystem services with the specified service manager.
|
/// Registers all Filesystem services with the specified service manager.
|
||||||
void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs);
|
void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs);
|
||||||
|
Loading…
Reference in New Issue
Block a user