diff options
| author | 2021-01-31 01:38:57 -0800 | |
|---|---|---|
| committer | 2021-02-05 14:03:32 -0800 | |
| commit | ff3c7c068b926399513bf7328c22e224ab0b53d6 (patch) | |
| tree | c2a5d9f80ecf551659daa410cc384b1792eff31d /src/core/hle/service/nim | |
| parent | hle: kernel: Implement KEvent. (diff) | |
| download | yuzu-ff3c7c068b926399513bf7328c22e224ab0b53d6.tar.gz yuzu-ff3c7c068b926399513bf7328c22e224ab0b53d6.tar.xz yuzu-ff3c7c068b926399513bf7328c22e224ab0b53d6.zip | |
hle: kernel: Reimplement KReadableEvent and KWritableEvent.
Diffstat (limited to 'src/core/hle/service/nim')
| -rw-r--r-- | src/core/hle/service/nim/nim.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index f180221fe..f3be0b878 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <ctime> | 6 | #include <ctime> |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hle/ipc_helpers.h" | 8 | #include "core/hle/ipc_helpers.h" |
| 9 | #include "core/hle/kernel/k_event.h" | ||
| 9 | #include "core/hle/kernel/k_readable_event.h" | 10 | #include "core/hle/kernel/k_readable_event.h" |
| 10 | #include "core/hle/kernel/k_writable_event.h" | 11 | #include "core/hle/kernel/k_writable_event.h" |
| 11 | #include "core/hle/kernel/kernel.h" | 12 | #include "core/hle/kernel/kernel.h" |
| @@ -301,17 +302,18 @@ public: | |||
| 301 | RegisterHandlers(functions); | 302 | RegisterHandlers(functions); |
| 302 | 303 | ||
| 303 | auto& kernel = system.Kernel(); | 304 | auto& kernel = system.Kernel(); |
| 304 | finished_event = Kernel::KWritableEvent::CreateEventPair( | 305 | finished_event = |
| 305 | kernel, "IEnsureNetworkClockAvailabilityService:FinishEvent"); | 306 | Kernel::KEvent::Create(kernel, "IEnsureNetworkClockAvailabilityService:FinishEvent"); |
| 307 | finished_event->Initialize(); | ||
| 306 | } | 308 | } |
| 307 | 309 | ||
| 308 | private: | 310 | private: |
| 309 | Kernel::EventPair finished_event; | 311 | std::shared_ptr<Kernel::KEvent> finished_event; |
| 310 | 312 | ||
| 311 | void StartTask(Kernel::HLERequestContext& ctx) { | 313 | void StartTask(Kernel::HLERequestContext& ctx) { |
| 312 | // No need to connect to the internet, just finish the task straight away. | 314 | // No need to connect to the internet, just finish the task straight away. |
| 313 | LOG_DEBUG(Service_NIM, "called"); | 315 | LOG_DEBUG(Service_NIM, "called"); |
| 314 | finished_event.writable->Signal(); | 316 | finished_event->GetWritableEvent()->Signal(); |
| 315 | IPC::ResponseBuilder rb{ctx, 2}; | 317 | IPC::ResponseBuilder rb{ctx, 2}; |
| 316 | rb.Push(RESULT_SUCCESS); | 318 | rb.Push(RESULT_SUCCESS); |
| 317 | } | 319 | } |
| @@ -321,7 +323,7 @@ private: | |||
| 321 | 323 | ||
| 322 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 324 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 323 | rb.Push(RESULT_SUCCESS); | 325 | rb.Push(RESULT_SUCCESS); |
| 324 | rb.PushCopyObjects(finished_event.readable); | 326 | rb.PushCopyObjects(finished_event->GetReadableEvent()); |
| 325 | } | 327 | } |
| 326 | 328 | ||
| 327 | void GetResult(Kernel::HLERequestContext& ctx) { | 329 | void GetResult(Kernel::HLERequestContext& ctx) { |
| @@ -333,7 +335,7 @@ private: | |||
| 333 | 335 | ||
| 334 | void Cancel(Kernel::HLERequestContext& ctx) { | 336 | void Cancel(Kernel::HLERequestContext& ctx) { |
| 335 | LOG_DEBUG(Service_NIM, "called"); | 337 | LOG_DEBUG(Service_NIM, "called"); |
| 336 | finished_event.writable->Clear(); | 338 | finished_event->GetWritableEvent()->Clear(); |
| 337 | IPC::ResponseBuilder rb{ctx, 2}; | 339 | IPC::ResponseBuilder rb{ctx, 2}; |
| 338 | rb.Push(RESULT_SUCCESS); | 340 | rb.Push(RESULT_SUCCESS); |
| 339 | } | 341 | } |