diff options
| author | 2018-10-14 14:42:57 -0400 | |
|---|---|---|
| committer | 2018-10-14 14:42:57 -0400 | |
| commit | 0d2ba0a3208a2cdc432b325d2d190cfb6be32223 (patch) | |
| tree | d3c0b0783e840228ed3da89faa8a7ddf525cdf37 /src/core | |
| parent | Merge pull request #1480 from FernandoS27/neue-swizzle (diff) | |
| parent | filesystem: Make CreateFactories() and InstallInterface() take a VfsFilesyste... (diff) | |
| download | yuzu-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/core')
| -rw-r--r-- | src/core/core.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.h | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 3 |
5 files changed, 14 insertions, 15 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 | ||
| 364 | void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite) { | 364 | void 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 | ||
| 386 | void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs) { | 386 | void 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. |
| 60 | void CreateFactories(const FileSys::VirtualFilesystem& vfs, bool overwrite = true); | 60 | void CreateFactories(FileSys::VfsFilesystem& vfs, bool overwrite = true); |
| 61 | 61 | ||
| 62 | void InstallInterfaces(SM::ServiceManager& service_manager, const FileSys::VirtualFilesystem& vfs); | 62 | void 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 |
| 200 | void Init(std::shared_ptr<SM::ServiceManager>& sm, const FileSys::VirtualFilesystem& rfs) { | 200 | void 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 |
| 183 | void Init(std::shared_ptr<SM::ServiceManager>& sm, | 183 | void 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 |
| 187 | void Shutdown(); | 186 | void Shutdown(); |