diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-10-01 15:13:09 +0200 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-10-01 15:13:09 +0200 |
commit | 19c466dfb1f997eaa16fc9d9b832aaf3321adc40 (patch) | |
tree | f5aa993c55239c4d5bb8af83496895fe9f98b7b0 /src/core/hle/service/bcat | |
parent | boxcat: Implement events global field (diff) | |
download | yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.gz yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.bz2 yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.lz yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.xz yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.tar.zst yuzu-19c466dfb1f997eaa16fc9d9b832aaf3321adc40.zip |
Diffstat (limited to 'src/core/hle/service/bcat')
-rw-r--r-- | src/core/hle/service/bcat/backend/backend.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/bcat/backend/boxcat.cpp | 11 | ||||
-rw-r--r-- | src/core/hle/service/bcat/bcat.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/service/bcat/bcat.h | 3 | ||||
-rw-r--r-- | src/core/hle/service/bcat/module.cpp | 26 | ||||
-rw-r--r-- | src/core/hle/service/bcat/module.h | 19 |
6 files changed, 45 insertions, 28 deletions
diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h index 50973a13a..3f5d8b5dd 100644 --- a/src/core/hle/service/bcat/backend/backend.h +++ b/src/core/hle/service/bcat/backend/backend.h @@ -57,11 +57,6 @@ static_assert(sizeof(DeliveryCacheProgressImpl) == 0x200, class ProgressServiceBackend { friend class IBcatService; - ProgressServiceBackend(std::string event_name); - - Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent(); - DeliveryCacheProgressImpl& GetImpl(); - public: // Clients should call this with true if any of the functions are going to be called from a // non-HLE thread and this class need to lock the hle mutex. (default is false) @@ -90,6 +85,11 @@ public: void FinishDownload(ResultCode result); private: + explicit ProgressServiceBackend(std::string event_name); + + Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent(); + DeliveryCacheProgressImpl& GetImpl(); + void SignalUpdate() const; DeliveryCacheProgressImpl impl; diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 5bc2e22d7..2c3309268 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -364,17 +364,18 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title, bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { is_syncing.exchange(true); - std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); }) - .detach(); + std::thread([this, title, &progress] { + SynchronizeInternal(dir_getter, title, progress); + }).detach(); return true; } bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name, ProgressServiceBackend& progress) { is_syncing.exchange(true); - std::thread( - [this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); }) - .detach(); + std::thread([this, title, name, &progress] { + SynchronizeInternal(dir_getter, title, progress, name); + }).detach(); return true; } diff --git a/src/core/hle/service/bcat/bcat.cpp b/src/core/hle/service/bcat/bcat.cpp index 391f599ee..c2f946424 100644 --- a/src/core/hle/service/bcat/bcat.cpp +++ b/src/core/hle/service/bcat/bcat.cpp @@ -6,8 +6,8 @@ namespace Service::BCAT { -BCAT::BCAT(std::shared_ptr<Module> module, const char* name) - : Module::Interface(std::move(module), name) { +BCAT::BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, const char* name) + : Module::Interface(std::move(module), fsc, name) { // clang-format off static const FunctionInfo functions[] = { {0, &BCAT::CreateBcatService, "CreateBcatService"}, diff --git a/src/core/hle/service/bcat/bcat.h b/src/core/hle/service/bcat/bcat.h index 802bd689a..813073658 100644 --- a/src/core/hle/service/bcat/bcat.h +++ b/src/core/hle/service/bcat/bcat.h @@ -10,7 +10,8 @@ namespace Service::BCAT { class BCAT final : public Module::Interface { public: - explicit BCAT(std::shared_ptr<Module> module, const char* name); + explicit BCAT(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, + const char* name); ~BCAT() override; }; diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 1b9a75a1c..b3fed56c7 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp @@ -539,7 +539,7 @@ void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestCont IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); rb.PushIpcInterface<IDeliveryCacheStorageService>( - Service::FileSystem::GetBCATDirectory(Core::CurrentProcess()->GetTitleID())); + fsc.GetBCATDirectory(Core::CurrentProcess()->GetTitleID())); } void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( @@ -551,8 +551,7 @@ void Module::Interface::CreateDeliveryCacheStorageServiceWithApplicationId( IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(RESULT_SUCCESS); - rb.PushIpcInterface<IDeliveryCacheStorageService>( - Service::FileSystem::GetBCATDirectory(title_id)); + rb.PushIpcInterface<IDeliveryCacheStorageService>(fsc.GetBCATDirectory(title_id)); } std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { @@ -566,18 +565,23 @@ std::unique_ptr<Backend> CreateBackendFromSettings(DirectoryGetter getter) { return std::make_unique<NullBackend>(std::move(getter)); } -Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) - : ServiceFramework(name), module(std::move(module)), - backend(CreateBackendFromSettings(&Service::FileSystem::GetBCATDirectory)) {} +Module::Interface::Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, + const char* name) + : ServiceFramework(name), module(std::move(module)), fsc(fsc), + backend(CreateBackendFromSettings([&fsc](u64 tid) { return fsc.GetBCATDirectory(tid); })) {} Module::Interface::~Interface() = default; -void InstallInterfaces(SM::ServiceManager& service_manager) { +void InstallInterfaces(Core::System& system) { auto module = std::make_shared<Module>(); - std::make_shared<BCAT>(module, "bcat:a")->InstallAsService(service_manager); - std::make_shared<BCAT>(module, "bcat:m")->InstallAsService(service_manager); - std::make_shared<BCAT>(module, "bcat:u")->InstallAsService(service_manager); - std::make_shared<BCAT>(module, "bcat:s")->InstallAsService(service_manager); + std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:a") + ->InstallAsService(system.ServiceManager()); + std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:m") + ->InstallAsService(system.ServiceManager()); + std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:u") + ->InstallAsService(system.ServiceManager()); + std::make_shared<BCAT>(module, system.GetFileSystemController(), "bcat:s") + ->InstallAsService(system.ServiceManager()); } } // namespace Service::BCAT diff --git a/src/core/hle/service/bcat/module.h b/src/core/hle/service/bcat/module.h index fc52574c2..27469926a 100644 --- a/src/core/hle/service/bcat/module.h +++ b/src/core/hle/service/bcat/module.h @@ -6,7 +6,13 @@ #include "core/hle/service/service.h" -namespace Service::BCAT { +namespace Service { + +namespace FileSystem { +class FileSystemController; +} // namespace FileSystem + +namespace BCAT { class Backend; @@ -14,7 +20,8 @@ class Module final { public: class Interface : public ServiceFramework<Interface> { public: - explicit Interface(std::shared_ptr<Module> module, const char* name); + explicit Interface(std::shared_ptr<Module> module, FileSystem::FileSystemController& fsc, + const char* name); ~Interface() override; void CreateBcatService(Kernel::HLERequestContext& ctx); @@ -22,12 +29,16 @@ public: void CreateDeliveryCacheStorageServiceWithApplicationId(Kernel::HLERequestContext& ctx); protected: + FileSystem::FileSystemController& fsc; + std::shared_ptr<Module> module; std::unique_ptr<Backend> backend; }; }; /// Registers all BCAT services with the specified service manager. -void InstallInterfaces(SM::ServiceManager& service_manager); +void InstallInterfaces(Core::System& system); + +} // namespace BCAT -} // namespace Service::BCAT +} // namespace Service |