diff options
| author | 2021-09-28 23:42:50 -0400 | |
|---|---|---|
| committer | 2021-10-01 23:38:59 -0400 | |
| commit | fadcee14f8fca1b76b4ea48b1cfd136ccae8d182 (patch) | |
| tree | a5787938bc73ff1b0b539e0945d3544d06a7d6d2 /src/core/hle/service/btdrv | |
| parent | Merge pull request #7102 from Morph1984/remove-boxcat (diff) | |
| download | yuzu-fadcee14f8fca1b76b4ea48b1cfd136ccae8d182.tar.gz yuzu-fadcee14f8fca1b76b4ea48b1cfd136ccae8d182.tar.xz yuzu-fadcee14f8fca1b76b4ea48b1cfd136ccae8d182.zip | |
service: Replace service event creation with ServiceContext::CreateEvent
The service context helps to manage all created events and allows us to close them upon destruction.
Diffstat (limited to 'src/core/hle/service/btdrv')
| -rw-r--r-- | src/core/hle/service/btdrv/btdrv.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index acf791de2..ecd3bd22a 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp | |||
| @@ -7,9 +7,9 @@ | |||
| 7 | #include "core/hle/ipc_helpers.h" | 7 | #include "core/hle/ipc_helpers.h" |
| 8 | #include "core/hle/kernel/hle_ipc.h" | 8 | #include "core/hle/kernel/hle_ipc.h" |
| 9 | #include "core/hle/kernel/k_event.h" | 9 | #include "core/hle/kernel/k_event.h" |
| 10 | #include "core/hle/kernel/k_readable_event.h" | ||
| 11 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 12 | #include "core/hle/service/btdrv/btdrv.h" | 11 | #include "core/hle/service/btdrv/btdrv.h" |
| 12 | #include "core/hle/service/kernel_helpers.h" | ||
| 13 | #include "core/hle/service/service.h" | 13 | #include "core/hle/service/service.h" |
| 14 | #include "core/hle/service/sm/sm.h" | 14 | #include "core/hle/service/sm/sm.h" |
| 15 | 15 | ||
| @@ -18,7 +18,7 @@ namespace Service::BtDrv { | |||
| 18 | class Bt final : public ServiceFramework<Bt> { | 18 | class Bt final : public ServiceFramework<Bt> { |
| 19 | public: | 19 | public: |
| 20 | explicit Bt(Core::System& system_) | 20 | explicit Bt(Core::System& system_) |
| 21 | : ServiceFramework{system_, "bt"}, register_event{system.Kernel()} { | 21 | : ServiceFramework{system_, "bt"}, service_context{system_, "bt"} { |
| 22 | // clang-format off | 22 | // clang-format off |
| 23 | static const FunctionInfo functions[] = { | 23 | static const FunctionInfo functions[] = { |
| 24 | {0, nullptr, "LeClientReadCharacteristic"}, | 24 | {0, nullptr, "LeClientReadCharacteristic"}, |
| @@ -35,8 +35,11 @@ public: | |||
| 35 | // clang-format on | 35 | // clang-format on |
| 36 | RegisterHandlers(functions); | 36 | RegisterHandlers(functions); |
| 37 | 37 | ||
| 38 | Kernel::KAutoObject::Create(std::addressof(register_event)); | 38 | register_event = service_context.CreateEvent("BT:RegisterEvent"); |
| 39 | register_event.Initialize("BT:RegisterEvent"); | 39 | } |
| 40 | |||
| 41 | ~Bt() override { | ||
| 42 | service_context.CloseEvent(register_event); | ||
| 40 | } | 43 | } |
| 41 | 44 | ||
| 42 | private: | 45 | private: |
| @@ -45,10 +48,12 @@ private: | |||
| 45 | 48 | ||
| 46 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 49 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 47 | rb.Push(ResultSuccess); | 50 | rb.Push(ResultSuccess); |
| 48 | rb.PushCopyObjects(register_event.GetReadableEvent()); | 51 | rb.PushCopyObjects(register_event->GetReadableEvent()); |
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | Kernel::KEvent register_event; | 54 | KernelHelpers::ServiceContext service_context; |
| 55 | |||
| 56 | Kernel::KEvent* register_event; | ||
| 52 | }; | 57 | }; |
| 53 | 58 | ||
| 54 | class BtDrv final : public ServiceFramework<BtDrv> { | 59 | class BtDrv final : public ServiceFramework<BtDrv> { |