diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 5e416cde2..da658cbe6 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -226,6 +226,7 @@ ResultVal VfsDirectoryServiceWrapper::GetEntryType( static std::unique_ptr romfs_factory; static std::unique_ptr save_data_factory; static std::unique_ptr sdmc_factory; +static std::unique_ptr bis_factory; ResultCode RegisterRomFS(std::unique_ptr&& factory) { ASSERT_MSG(romfs_factory == nullptr, "Tried to register a second RomFS"); @@ -248,6 +249,13 @@ ResultCode RegisterSDMC(std::unique_ptr&& factory) { return RESULT_SUCCESS; } +ResultCode RegisterBIS(std::unique_ptr&& 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 OpenRomFS(u64 title_id) { LOG_TRACE(Service_FS, "Opening RomFS for title_id={:016X}", title_id); @@ -281,6 +289,14 @@ ResultVal OpenSDMC() { return sdmc_factory->Open(); } +std::shared_ptr GetSystemNANDContents() { + return bis_factory->GetSystemNANDContents(); +} + +std::shared_ptr GetUserNANDContents() { + return bis_factory->GetUserNANDContents(); +} + void RegisterFileSystems(const FileSys::VirtualFilesystem& vfs) { romfs_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), FileSys::Mode::ReadWrite); + if (bis_factory == nullptr) + bis_factory = std::make_unique(nand_directory); + auto savedata = std::make_unique(std::move(nand_directory)); save_data_factory = std::move(savedata); diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h index 462c13f20..1d6f922dd 100644 --- a/src/core/hle/service/filesystem/filesystem.h +++ b/src/core/hle/service/filesystem/filesystem.h @@ -6,6 +6,7 @@ #include #include "common/common_types.h" +#include "core/file_sys/bis_factory.h" #include "core/file_sys/directory.h" #include "core/file_sys/mode.h" #include "core/file_sys/romfs_factory.h" @@ -24,16 +25,15 @@ namespace FileSystem { ResultCode RegisterRomFS(std::unique_ptr&& factory); ResultCode RegisterSaveData(std::unique_ptr&& factory); ResultCode RegisterSDMC(std::unique_ptr&& factory); +ResultCode RegisterBIS(std::unique_ptr&& factory); -// TODO(DarkLordZach): BIS Filesystem -// ResultCode RegisterBIS(std::unique_ptr&& factory); ResultVal OpenRomFS(u64 title_id); ResultVal OpenSaveData(FileSys::SaveDataSpaceId space, FileSys::SaveDataDescriptor save_struct); ResultVal OpenSDMC(); -// TODO(DarkLordZach): BIS Filesystem -// ResultVal> OpenBIS(); +std::shared_ptr GetSystemNANDContents(); +std::shared_ptr GetUserNANDContents(); /// Registers all Filesystem services with the specified service manager. void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs);