summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2018-10-14 14:42:57 -0400
committerGravatar GitHub2018-10-14 14:42:57 -0400
commit0d2ba0a3208a2cdc432b325d2d190cfb6be32223 (patch)
treed3c0b0783e840228ed3da89faa8a7ddf525cdf37 /src
parentMerge pull request #1480 from FernandoS27/neue-swizzle (diff)
parentfilesystem: Make CreateFactories() and InstallInterface() take a VfsFilesyste... (diff)
downloadyuzu-0d2ba0a3208a2cdc432b325d2d190cfb6be32223.tar.gz
yuzu-0d2ba0a3208a2cdc432b325d2d190cfb6be32223.tar.xz
yuzu-0d2ba0a3208a2cdc432b325d2d190cfb6be32223.zip
Merge pull request #1491 from lioncash/reference
filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesystem by reference
Diffstat (limited to 'src')
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp16
-rw-r--r--src/core/hle/service/filesystem/filesystem.h4
-rw-r--r--src/core/hle/service/service.cpp4
-rw-r--r--src/core/hle/service/service.h3
-rw-r--r--src/yuzu/main.cpp8
-rw-r--r--src/yuzu_cmd/yuzu.cpp2
7 files changed, 19 insertions, 20 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index e2fb9e038..32baa40dc 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -148,7 +148,7 @@ struct System::Impl {
148 telemetry_session = std::make_unique<Core::TelemetrySession>(); 148 telemetry_session = std::make_unique<Core::TelemetrySession>();
149 service_manager = std::make_shared<Service::SM::ServiceManager>(); 149 service_manager = std::make_shared<Service::SM::ServiceManager>();
150 150
151 Service::Init(service_manager, virtual_filesystem); 151 Service::Init(service_manager, *virtual_filesystem);
152 GDBStub::Init(); 152 GDBStub::Init();
153 153
154 renderer = VideoCore::CreateRenderer(emu_window); 154 renderer = VideoCore::CreateRenderer(emu_window);
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index 439e62d27..e06712603 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -361,19 +361,19 @@ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id) {
361 return bis_factory->GetModificationLoadRoot(title_id); 361 return bis_factory->GetModificationLoadRoot(title_id);
362} 362}
363 363
364void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite) { 364void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite) {
365 if (overwrite) { 365 if (overwrite) {
366 bis_factory = nullptr; 366 bis_factory = nullptr;
367 save_data_factory = nullptr; 367 save_data_factory = nullptr;
368 sdmc_factory = nullptr; 368 sdmc_factory = nullptr;
369 } 369 }
370 370
371 auto nand_directory = vfs->OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), 371 auto nand_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir),
372 FileSys::Mode::ReadWrite); 372 FileSys::Mode::ReadWrite);
373 auto sd_directory = vfs->OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), 373 auto sd_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir),
374 FileSys::Mode::ReadWrite); 374 FileSys::Mode::ReadWrite);
375 auto load_directory = vfs->OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir), 375 auto load_directory = vfs.OpenDirectory(FileUtil::GetUserPath(FileUtil::UserPath::LoadDir),
376 FileSys::Mode::ReadWrite); 376 FileSys::Mode::ReadWrite);
377 377
378 if (bis_factory == nullptr) 378 if (bis_factory == nullptr)
379 bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory, load_directory); 379 bis_factory = std::make_unique<FileSys::BISFactory>(nand_directory, load_directory);
@@ -383,7 +383,7 @@ void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite) {
383 sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory)); 383 sdmc_factory = std::make_unique<FileSys::SDMCFactory>(std::move(sd_directory));
384} 384}
385 385
386void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs) { 386void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs) {
387 romfs_factory = nullptr; 387 romfs_factory = nullptr;
388 CreateFactories(vfs, false); 388 CreateFactories(vfs, false);
389 std::make_shared<FSP_LDR>()->InstallAsService(service_manager); 389 std::make_shared<FSP_LDR>()->InstallAsService(service_manager);
diff --git a/src/core/hle/service/filesystem/filesystem.h b/src/core/hle/service/filesystem/filesystem.h
index 53b01bb01..2df1faeb0 100644
--- a/src/core/hle/service/filesystem/filesystem.h
+++ b/src/core/hle/service/filesystem/filesystem.h
@@ -57,9 +57,9 @@ FileSys::VirtualDir GetModificationLoadRoot(u64 title_id);
57 57
58// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function 58// Creates the SaveData, SDMC, and BIS Factories. Should be called once and before any function
59// above is called. 59// above is called.
60void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite = true); 60void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true);
61 61
62void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs); 62void InstallInterfaces(SM::ServiceManager& service_manager, FileSys::VfsFilesystem& vfs);
63 63
64// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of 64// A class that wraps a VfsDirectory with methods that return ResultVal and ResultCode instead of
65// pointers and booleans. This makes using a VfsDirectory with switch services much easier and 65// pointers and booleans. This makes using a VfsDirectory with switch services much easier and
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 62f049660..a225cb4cb 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -197,7 +197,7 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::HLERequestContext& co
197// Module interface 197// Module interface
198 198
199/// Initialize ServiceManager 199/// Initialize ServiceManager
200void Init(std::shared_ptr<SM::ServiceManager>& sm, const FileSys::VirtualFilesystem& rfs) { 200void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs) {
201 // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it 201 // NVFlinger needs to be accessed by several services like Vi and AppletOE so we instantiate it
202 // here and pass it into the respective InstallInterfaces functions. 202 // here and pass it into the respective InstallInterfaces functions.
203 auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>(); 203 auto nv_flinger = std::make_shared<NVFlinger::NVFlinger>();
@@ -220,7 +220,7 @@ void Init(std::shared_ptr<SM::ServiceManager>& sm, const FileSys::VirtualFilesys
220 EUPLD::InstallInterfaces(*sm); 220 EUPLD::InstallInterfaces(*sm);
221 Fatal::InstallInterfaces(*sm); 221 Fatal::InstallInterfaces(*sm);
222 FGM::InstallInterfaces(*sm); 222 FGM::InstallInterfaces(*sm);
223 FileSystem::InstallInterfaces(*sm, rfs); 223 FileSystem::InstallInterfaces(*sm, vfs);
224 Friend::InstallInterfaces(*sm); 224 Friend::InstallInterfaces(*sm);
225 GRC::InstallInterfaces(*sm); 225 GRC::InstallInterfaces(*sm);
226 HID::InstallInterfaces(*sm); 226 HID::InstallInterfaces(*sm);
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 2fc57a82e..98483ecf1 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -180,8 +180,7 @@ private:
180}; 180};
181 181
182/// Initialize ServiceManager 182/// Initialize ServiceManager
183void Init(std::shared_ptr<SM::ServiceManager>& sm, 183void Init(std::shared_ptr<SM::ServiceManager>& sm, FileSys::VfsFilesystem& vfs);
184 const std::shared_ptr<FileSys::VfsFilesystem>& vfs);
185 184
186/// Shutdown ServiceManager 185/// Shutdown ServiceManager
187void Shutdown(); 186void Shutdown();
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index fc186dc2d..beb57ea5d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -176,7 +176,7 @@ GMainWindow::GMainWindow()
176 OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning); 176 OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning);
177 177
178 // Necessary to load titles from nand in gamelist. 178 // Necessary to load titles from nand in gamelist.
179 Service::FileSystem::CreateFactories(vfs); 179 Service::FileSystem::CreateFactories(*vfs);
180 game_list->LoadCompatibilityList(); 180 game_list->LoadCompatibilityList();
181 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); 181 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
182 182
@@ -1139,7 +1139,7 @@ void GMainWindow::OnMenuSelectEmulatedDirectory(EmulatedDirectoryTarget target)
1139 FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir 1139 FileUtil::GetUserPath(target == EmulatedDirectoryTarget::SDMC ? FileUtil::UserPath::SDMCDir
1140 : FileUtil::UserPath::NANDDir, 1140 : FileUtil::UserPath::NANDDir,
1141 dir_path.toStdString()); 1141 dir_path.toStdString());
1142 Service::FileSystem::CreateFactories(vfs); 1142 Service::FileSystem::CreateFactories(*vfs);
1143 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); 1143 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
1144 } 1144 }
1145} 1145}
@@ -1410,7 +1410,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
1410 1410
1411 const auto function = [this, &keys, &pdm] { 1411 const auto function = [this, &keys, &pdm] {
1412 keys.PopulateFromPartitionData(pdm); 1412 keys.PopulateFromPartitionData(pdm);
1413 Service::FileSystem::CreateFactories(vfs); 1413 Service::FileSystem::CreateFactories(*vfs);
1414 keys.DeriveETicket(pdm); 1414 keys.DeriveETicket(pdm);
1415 }; 1415 };
1416 1416
@@ -1450,7 +1450,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
1450 prog.close(); 1450 prog.close();
1451 } 1451 }
1452 1452
1453 Service::FileSystem::CreateFactories(vfs); 1453 Service::FileSystem::CreateFactories(*vfs);
1454 1454
1455 if (behavior == ReinitializeKeyBehavior::Warning) { 1455 if (behavior == ReinitializeKeyBehavior::Warning) {
1456 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan); 1456 game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index 27aba95f6..c8b93b85b 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -175,7 +175,7 @@ int main(int argc, char** argv) {
175 175
176 Core::System& system{Core::System::GetInstance()}; 176 Core::System& system{Core::System::GetInstance()};
177 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>()); 177 system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
178 Service::FileSystem::CreateFactories(system.GetFilesystem()); 178 Service::FileSystem::CreateFactories(*system.GetFilesystem());
179 179
180 SCOPE_EXIT({ system.Shutdown(); }); 180 SCOPE_EXIT({ system.Shutdown(); });
181 181