summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-08-16 17:04:38 -0400
committerGravatar Zach Hilman2018-08-23 11:52:44 -0400
commitef3768f323fc06eb41c603fe797a26412424acd4 (patch)
tree9949bb6b334d3ab0f0991e981e3991225d1d9cb3 /src
parentfilesystem: Add logging to registration getters (diff)
downloadyuzu-ef3768f323fc06eb41c603fe797a26412424acd4.tar.gz
yuzu-ef3768f323fc06eb41c603fe797a26412424acd4.tar.xz
yuzu-ef3768f323fc06eb41c603fe797a26412424acd4.zip
filesystem: Add CreateFactories methods to fs
Allows frontend to create registration caches for use before a game has booted.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp13
-rw-r--r--src/core/hle/service/filesystem/filesystem.h6
-rw-r--r--src/yuzu/main.cpp3
3 files changed, 12 insertions, 10 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 1a318b233..914315d20 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -345,16 +345,15 @@ void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite) {
345 345
346 if (bis_factory == nullptr) 346 if (bis_factory == nullptr)
347 bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory); 347 bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory);
348 348 if (save_data_factory == nullptr)
349 auto savedata = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory)); 349 save_data_factory = std::make_unique<FileSys::SaveDataFactory>(std::move(nand_directory));
350 save_data_factory = std::move(savedata); 350 if (sdmc_factory == nullptr)
351 351 sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
352 auto sdcard = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
353 sdmc_factory = std::move(sdcard);
354} 352}
355 353
356void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs) { 354void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs) {
357 RegisterFileSystems(vfs); 355 romfs_factory = nullptr;
356 CreateFactories(vfs, false);
358 std::make_shared<FSP_LDR>()->InstallAsService(service_manager); 357 std::make_shared<FSP_LDR>()->InstallAsService(service_manager);
359 std::make_shared<FSP_PR>()->InstallAsService(service_manager); 358 std::make_shared<FSP_PR>()->InstallAsService(service_manager);
360 std::make_shared<FSP_SRV>()->InstallAsService(service_manager); 359 std::make_shared<FSP_SRV>()->InstallAsService(service_manager);
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index df78be44a..d88a66825 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -46,8 +46,12 @@ ResultVal<FileSys::VirtualDir> OpenSDMC();
46 46
47std::shared_ptr<FileSys::RegisteredCache> GetSystemNANDContents(); 47std::shared_ptr<FileSys::RegisteredCache> GetSystemNANDContents();
48std::shared_ptr<FileSys::RegisteredCache> GetUserNANDContents(); 48std::shared_ptr<FileSys::RegisteredCache> GetUserNANDContents();
49std::shared_ptr<FileSys::RegisteredCache> GetSDMCContents();
50
51// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
52// above is called.
53void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite = true);
49 54
50/// Registers all Filesystem services with the specified service manager.
51void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs); 55void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs);
52 56
53// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of 57// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index c62360bd4..bbd1feb85 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -122,8 +122,7 @@ GMainWindow::GMainWindow()
122 show(); 122 show();
123 123
124 // Necessary to load titles from nand in gamelist. 124 // Necessary to load titles from nand in gamelist.
125 Service::FileSystem::RegisterBIS(std::make_unique<FileSys::BISFactory>(vfs->OpenDirectory( 125 Service::FileSystem::CreateFactories(vfs);
126 FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), FileSys::Mode::ReadWrite)));
127 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); 126 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
128 127
129 // Show one-time "callout" messages to the user 128 // Show one-time "callout" messages to the user