diff options
author | Lioncash <mathew1800@gmail.com> | 2019-10-06 19:02:23 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-10-06 19:42:23 +0200 |
commit | 69f16ba50e3c52a17405670b976ac4ba63f58021 (patch) | |
tree | e64b63528a155da323ea02039ede638fb6994ecd /src/core/hle/service/bcat/module.cpp | |
parent | Merge pull request #2942 from ReinUsesLisp/clang-warnings (diff) | |
download | yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar.gz yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar.bz2 yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar.lz yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar.xz yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.tar.zst yuzu-69f16ba50e3c52a17405670b976ac4ba63f58021.zip |
Diffstat (limited to 'src/core/hle/service/bcat/module.cpp')
-rw-r--r-- | src/core/hle/service/bcat/module.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 4c01bcd99..8931fb385 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -35,8 +35,7 @@ using BCATDigest = std::array<u8, 0x10>; namespace { -u64 GetCurrentBuildID() { - const auto& id = Core::System::GetInstance().GetCurrentProcessBuildID(); +u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { u64 out{}; std::memcpy(&out, id.data(), sizeof(u64)); return out; @@ -125,7 +124,8 @@ private: class IBcatService final : public ServiceFramework<IBcatService> { public: - IBcatService(Backend& backend) : ServiceFramework("IBcatService"), backend(backend) { + explicit IBcatService(Core::System& system_, Backend& backend_) + : ServiceFramework("IBcatService"), system{system_}, backend{backend_} { // clang-format off static const FunctionInfo functions[] = { {10100, &IBcatService::RequestSyncDeliveryCache, "RequestSyncDeliveryCache"}, @@ -163,7 +163,8 @@ private: void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_BCAT, "called"); - backend.Synchronize({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()}, + backend.Synchronize({system.CurrentProcess()->GetTitleID(), + GetCurrentBuildID(system.GetCurrentProcessBuildID())}, progress.at(static_cast<std::size_t>(SyncType::Normal))); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -179,7 +180,8 @@ private: LOG_DEBUG(Service_BCAT, "called, name={}", name); - backend.SynchronizeDirectory({Core::CurrentProcess()->GetTitleID(), GetCurrentBuildID()}, + backend.SynchronizeDirectory({system.CurrentProcess()->GetTitleID(), + GetCurrentBuildID(system.GetCurrentProcessBuildID())}, name, progress.at(static_cast<std::size_t>(SyncType::Directory))); @@ -244,6 +246,7 @@ private: rb.Push(RESULT_SUCCESS); } + Core::System& system; Backend& backend; std::array<ProgressServiceBackend, static_cast<std::size_t>(SyncType::Count)> progress{ @@ -257,7 +260,7 @@ void Module::Interface::CreateBcatService(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<IBcatService>(*backend); + rb.PushIpcInterface<IBcatService>(system, *backend); } class IDeliveryCacheFileService final : public ServiceFramework<IDeliveryCacheFileService> { @@ -539,7 +542,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDeliveryCacheStorageService>( - fsc.GetBCATDirectory(Core::CurrentProcess()->GetTitleID())); + fsc.GetBCATDirectory(system.CurrentProcess()->GetTitleID())); } void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( @@ -565,22 +568,23 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { return std::make_unique<NullBackend>(std::move(getter)); } -Module::Interface::Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, - const char* name) - : ServiceFramework(name), fsc(fsc), module(std::move(module)), - backend(CreateBackendFromSettings([&fsc](u64 tid) { return fsc.GetBCATDirectory(tid); })) {} +Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> module_, + FileSystem::FileSystemController& fsc_, const char* name) + : ServiceFramework(name), fsc{fsc_}, module{std::move(module_)}, + backend{CreateBackendFromSettings([&fsc_](u64 tid) { return fsc_.GetBCATDirectory(tid); })}, + system{system_} {} Module::Interface::~Interface() = default; void InstallInterfaces(Core::System& system) { auto module = std::make_shared<Module>(); - std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:a") + std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:a") ->InstallAsService(system.ServiceManager()); - std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:m") + std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:m") ->InstallAsService(system.ServiceManager()); - std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:u") + std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:u") ->InstallAsService(system.ServiceManager()); - std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:s") + std::make_shared<BCAT>(system, module, system.GetFileSystemController(), "bcat:s") ->InstallAsService(system.ServiceManager()); } |