diff options
| author | 2020-11-26 15:19:08 -0500 | |
|---|---|---|
| committer | 2020-11-26 20:03:11 -0500 | |
| commit | 1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f (patch) | |
| tree | 3593cd42e0ba676c3919561983f7e9766fcb641c /src/core/hle/service/bcat | |
| parent | Merge pull request #4975 from comex/invalid-syncpoint-id (diff) | |
| download | yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.gz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.tar.xz yuzu-1a954b2a596fdfd4fc4b5feb9b43c8147de4cc7f.zip | |
service: Eliminate usages of the global system instance
Completely removes all usages of the global system instance within the
services code by passing in the using system instance to the services.
Diffstat (limited to 'src/core/hle/service/bcat')
| -rw-r--r-- | src/core/hle/service/bcat/module.cpp | 40 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/module.h | 3 |
2 files changed, 20 insertions, 23 deletions
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 68deb0600..b8696a395 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp | |||
| @@ -88,9 +88,11 @@ struct DeliveryCacheDirectoryEntry { | |||
| 88 | 88 | ||
| 89 | class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> { | 89 | class IDeliveryCacheProgressService final : public ServiceFramework<IDeliveryCacheProgressService> { |
| 90 | public: | 90 | public: |
| 91 | IDeliveryCacheProgressService(std::shared_ptr<Kernel::ReadableEvent> event, | 91 | explicit IDeliveryCacheProgressService(Core::System& system_, |
| 92 | const DeliveryCacheProgressImpl& impl) | 92 | std::shared_ptr<Kernel::ReadableEvent> event_, |
| 93 | : ServiceFramework{"IDeliveryCacheProgressService"}, event(std::move(event)), impl(impl) { | 93 | const DeliveryCacheProgressImpl& impl_) |
| 94 | : ServiceFramework{system_, "IDeliveryCacheProgressService"}, event{std::move(event_)}, | ||
| 95 | impl{impl_} { | ||
| 94 | // clang-format off | 96 | // clang-format off |
| 95 | static const FunctionInfo functions[] = { | 97 | static const FunctionInfo functions[] = { |
| 96 | {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"}, | 98 | {0, &IDeliveryCacheProgressService::GetEvent, "GetEvent"}, |
| @@ -126,7 +128,7 @@ private: | |||
| 126 | class IBcatService final : public ServiceFramework<IBcatService> { | 128 | class IBcatService final : public ServiceFramework<IBcatService> { |
| 127 | public: | 129 | public: |
| 128 | explicit IBcatService(Core::System& system_, Backend& backend_) | 130 | explicit IBcatService(Core::System& system_, Backend& backend_) |
| 129 | : ServiceFramework("IBcatService"), system{system_}, backend{backend_}, | 131 | : ServiceFramework{system_, "IBcatService"}, backend{backend_}, |
| 130 | progress{{ | 132 | progress{{ |
| 131 | ProgressServiceBackend{system_.Kernel(), "Normal"}, | 133 | ProgressServiceBackend{system_.Kernel(), "Normal"}, |
| 132 | ProgressServiceBackend{system_.Kernel(), "Directory"}, | 134 | ProgressServiceBackend{system_.Kernel(), "Directory"}, |
| @@ -171,7 +173,7 @@ private: | |||
| 171 | 173 | ||
| 172 | std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) { | 174 | std::shared_ptr<IDeliveryCacheProgressService> CreateProgressService(SyncType type) { |
| 173 | auto& backend{progress.at(static_cast<std::size_t>(type))}; | 175 | auto& backend{progress.at(static_cast<std::size_t>(type))}; |
| 174 | return std::make_shared<IDeliveryCacheProgressService>(backend.GetEvent(), | 176 | return std::make_shared<IDeliveryCacheProgressService>(system, backend.GetEvent(), |
| 175 | backend.GetImpl()); | 177 | backend.GetImpl()); |
| 176 | } | 178 | } |
| 177 | 179 | ||
| @@ -261,7 +263,6 @@ private: | |||
| 261 | rb.Push(RESULT_SUCCESS); | 263 | rb.Push(RESULT_SUCCESS); |
| 262 | } | 264 | } |
| 263 | 265 | ||
| 264 | Core::System& system; | ||
| 265 | Backend& backend; | 266 | Backend& backend; |
| 266 | 267 | ||
| 267 | std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress; | 268 | std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress; |
| @@ -277,8 +278,8 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { | |||
| 277 | 278 | ||
| 278 | class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { | 279 | class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { |
| 279 | public: | 280 | public: |
| 280 | IDeliveryCacheFileService(FileSys::VirtualDir root_) | 281 | explicit IDeliveryCacheFileService(Core::System& system_, FileSys::VirtualDir root_) |
| 281 | : ServiceFramework{"IDeliveryCacheFileService"}, root(std::move(root_)) { | 282 | : ServiceFramework{system_, "IDeliveryCacheFileService"}, root(std::move(root_)) { |
| 282 | // clang-format off | 283 | // clang-format off |
| 283 | static const FunctionInfo functions[] = { | 284 | static const FunctionInfo functions[] = { |
| 284 | {0, &IDeliveryCacheFileService::Open, "Open"}, | 285 | {0, &IDeliveryCacheFileService::Open, "Open"}, |
| @@ -394,8 +395,8 @@ private: | |||
| 394 | class IDeliveryCacheDirectoryService final | 395 | class IDeliveryCacheDirectoryService final |
| 395 | : public ServiceFramework<IDeliveryCacheDirectoryService> { | 396 | : public ServiceFramework<IDeliveryCacheDirectoryService> { |
| 396 | public: | 397 | public: |
| 397 | IDeliveryCacheDirectoryService(FileSys::VirtualDir root_) | 398 | explicit IDeliveryCacheDirectoryService(Core::System& system_, FileSys::VirtualDir root_) |
| 398 | : ServiceFramework{"IDeliveryCacheDirectoryService"}, root(std::move(root_)) { | 399 | : ServiceFramework{system_, "IDeliveryCacheDirectoryService"}, root(std::move(root_)) { |
| 399 | // clang-format off | 400 | // clang-format off |
| 400 | static const FunctionInfo functions[] = { | 401 | static const FunctionInfo functions[] = { |
| 401 | {0, &IDeliveryCacheDirectoryService::Open, "Open"}, | 402 | {0, &IDeliveryCacheDirectoryService::Open, "Open"}, |
| @@ -492,8 +493,8 @@ private: | |||
| 492 | 493 | ||
| 493 | class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> { | 494 | class IDeliveryCacheStorageService final : public ServiceFramework<IDeliveryCacheStorageService> { |
| 494 | public: | 495 | public: |
| 495 | IDeliveryCacheStorageService(FileSys::VirtualDir root_) | 496 | explicit IDeliveryCacheStorageService(Core::System& system_, FileSys::VirtualDir root_) |
| 496 | : ServiceFramework{"IDeliveryCacheStorageService"}, root(std::move(root_)) { | 497 | : ServiceFramework{system_, "IDeliveryCacheStorageService"}, root(std::move(root_)) { |
| 497 | // clang-format off | 498 | // clang-format off |
| 498 | static const FunctionInfo functions[] = { | 499 | static const FunctionInfo functions[] = { |
| 499 | {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"}, | 500 | {0, &IDeliveryCacheStorageService::CreateFileService, "CreateFileService"}, |
| @@ -518,7 +519,7 @@ private: | |||
| 518 | 519 | ||
| 519 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 520 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 520 | rb.Push(RESULT_SUCCESS); | 521 | rb.Push(RESULT_SUCCESS); |
| 521 | rb.PushIpcInterface<IDeliveryCacheFileService>(root); | 522 | rb.PushIpcInterface<IDeliveryCacheFileService>(system, root); |
| 522 | } | 523 | } |
| 523 | 524 | ||
| 524 | void CreateDirectoryService(Kernel::HLERequestContext& ctx) { | 525 | void CreateDirectoryService(Kernel::HLERequestContext& ctx) { |
| @@ -526,7 +527,7 @@ private: | |||
| 526 | 527 | ||
| 527 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 528 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 528 | rb.Push(RESULT_SUCCESS); | 529 | rb.Push(RESULT_SUCCESS); |
| 529 | rb.PushIpcInterface<IDeliveryCacheDirectoryService>(root); | 530 | rb.PushIpcInterface<IDeliveryCacheDirectoryService>(system, root); |
| 530 | } | 531 | } |
| 531 | 532 | ||
| 532 | void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { | 533 | void EnumerateDeliveryCacheDirectory(Kernel::HLERequestContext& ctx) { |
| @@ -551,10 +552,10 @@ private: | |||
| 551 | void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { | 552 | void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { |
| 552 | LOG_DEBUG(Service_BCAT, "called"); | 553 | LOG_DEBUG(Service_BCAT, "called"); |
| 553 | 554 | ||
| 555 | const auto title_id = system.CurrentProcess()->GetTitleID(); | ||
| 554 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 556 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 555 | rb.Push(RESULT_SUCCESS); | 557 | rb.Push(RESULT_SUCCESS); |
| 556 | rb.PushIpcInterface<IDeliveryCacheStorageService>( | 558 | rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); |
| 557 | fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID())); | ||
| 558 | } | 559 | } |
| 559 | 560 | ||
| 560 | void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( | 561 | void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( |
| @@ -566,7 +567,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( | |||
| 566 | 567 | ||
| 567 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 568 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 568 | rb.Push(RESULT_SUCCESS); | 569 | rb.Push(RESULT_SUCCESS); |
| 569 | rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id)); | 570 | rb.PushIpcInterface<IDeliveryCacheStorageService>(system, fsc.GetBCATDirectory(title_id)); |
| 570 | } | 571 | } |
| 571 | 572 | ||
| 572 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, | 573 | std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System& system, |
| @@ -582,10 +583,9 @@ std::unique_ptr<Backend> CreateBackendFromSettings([[maybe_unused]] Core::System | |||
| 582 | 583 | ||
| 583 | Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, | 584 | Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, |
| 584 | FileSystem::FileSystemController& fsc_, const char* name) | 585 | FileSystem::FileSystemController& fsc_, const char* name) |
| 585 | : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)}, | 586 | : ServiceFramework{system_, name}, fsc{fsc_}, module{std::move(module_)}, |
| 586 | backend{CreateBackendFromSettings(system_, | 587 | backend{CreateBackendFromSettings(system_, |
| 587 | [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, | 588 | [&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })} {} |
| 588 | system{system_} {} | ||
| 589 | 589 | ||
| 590 | Module::Interface::~Interface() = default; | 590 | Module::Interface::~Interface() = default; |
| 591 | 591 | ||
diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h index e4ba23ba0..738731c06 100644 --- a/src/core/hle/service/bcat/module.h +++ b/src/core/hle/service/bcat/module.h | |||
| @@ -37,9 +37,6 @@ public: | |||
| 37 | 37 | ||
| 38 | std::shared_ptr<Module> module; | 38 | std::shared_ptr<Module> module; |
| 39 | std::unique_ptr<Backend> backend; | 39 | std::unique_ptr<Backend> backend; |
| 40 | |||
| 41 | private: | ||
| 42 | Core::System& system; | ||
| 43 | }; | 40 | }; |
| 44 | }; | 41 | }; |
| 45 | 42 | ||