diff options
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/bcat/backend/backend.cpp | 22 | ||||
-rw-r--r-- | src/core/hle/service/bcat/backend/backend.h | 10 | ||||
-rw-r--r-- | src/core/hle/service/bcat/bcat_module.cpp | 4 |
3 files changed, 21 insertions, 15 deletions
diff --git a/src/core/hle/service/bcat/backend/backend.cpp b/src/core/hle/service/bcat/backend/backend.cpp index a78544c88..4c7d3bb6e 100644 --- a/src/core/hle/service/bcat/backend/backend.cpp +++ b/src/core/hle/service/bcat/backend/backend.cpp @@ -5,22 +5,24 @@ #include "common/hex_util.h" #include "common/logging/log.h" #include "core/core.h" -#include "core/hle/kernel/k_readable_event.h" -#include "core/hle/kernel/k_writable_event.h" +#include "core/hle/kernel/k_event.h" #include "core/hle/lock.h" #include "core/hle/service/bcat/backend/backend.h" namespace Service::BCAT { -ProgressServiceBackend::ProgressServiceBackend(Kernel::KernelCore& kernel, - std::string_view event_name) - : update_event{kernel} { - Kernel::KAutoObject::Create(std::addressof(update_event)); - update_event.Initialize("ProgressServiceBackend:UpdateEvent:" + std::string(event_name)); +ProgressServiceBackend::ProgressServiceBackend(Core::System& system, std::string_view event_name) + : service_context{system, "ProgressServiceBackend"} { + update_event = service_context.CreateEvent("ProgressServiceBackend:UpdateEvent:" + + std::string(event_name)); +} + +ProgressServiceBackend::~ProgressServiceBackend() { + service_context.CloseEvent(update_event); } Kernel::KReadableEvent& ProgressServiceBackend::GetEvent() { - return update_event.GetReadableEvent(); + return update_event->GetReadableEvent(); } DeliveryCacheProgressImpl& ProgressServiceBackend::GetImpl() { @@ -88,9 +90,9 @@ void ProgressServiceBackend::FinishDownload(ResultCode result) { void ProgressServiceBackend::SignalUpdate() { if (need_hle_lock) { std::lock_guard lock(HLE::g_hle_lock); - update_event.GetWritableEvent().Signal(); + update_event->GetWritableEvent().Signal(); } else { - update_event.GetWritableEvent().Signal(); + update_event->GetWritableEvent().Signal(); } } diff --git a/src/core/hle/service/bcat/backend/backend.h b/src/core/hle/service/bcat/backend/backend.h index e79a9c2ad..749e046c7 100644 --- a/src/core/hle/service/bcat/backend/backend.h +++ b/src/core/hle/service/bcat/backend/backend.h @@ -11,8 +11,8 @@ #include "common/common_types.h" #include "core/file_sys/vfs_types.h" -#include "core/hle/kernel/k_event.h" #include "core/hle/result.h" +#include "core/hle/service/kernel_helpers.h" namespace Core { class System; @@ -70,6 +70,8 @@ class ProgressServiceBackend { friend class IBcatService; public: + ~ProgressServiceBackend(); + // 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) void SetNeedHLELock(bool need); @@ -97,15 +99,17 @@ public: void FinishDownload(ResultCode result); private: - explicit ProgressServiceBackend(Kernel::KernelCore& kernel, std::string_view event_name); + explicit ProgressServiceBackend(Core::System& system, std::string_view event_name); Kernel::KReadableEvent& GetEvent(); DeliveryCacheProgressImpl& GetImpl(); void SignalUpdate(); + KernelHelpers::ServiceContext service_context; + DeliveryCacheProgressImpl impl{}; - Kernel::KEvent update_event; + Kernel::KEvent* update_event; bool need_hle_lock = false; }; diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp index 701f634f8..27e9b8df8 100644 --- a/src/core/hle/service/bcat/bcat_module.cpp +++ b/src/core/hle/service/bcat/bcat_module.cpp @@ -127,8 +127,8 @@ public: explicit IBcatService(Core::System& system_, Backend& backend_) : ServiceFramework{system_, "IBcatService"}, backend{backend_}, progress{{ - ProgressServiceBackend{system_.Kernel(), "Normal"}, - ProgressServiceBackend{system_.Kernel(), "Directory"}, + ProgressServiceBackend{system_, "Normal"}, + ProgressServiceBackend{system_, "Directory"}, }} { // clang-format off static const FunctionInfo functions[] = { |