diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-23 06:11:25 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-30 14:49:43 +0100 |
commit | d52d85993683a6948285801ab54d51c79c98afba (patch) | |
tree | 98b4d084c26198ad4bb8a0d8fd84f1a411a32ff6 /src/core/hle/svc.cpp | |
parent | Kernel: Convert Timer to (mostly) not use Handles (diff) | |
download | yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar.gz yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar.bz2 yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar.lz yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar.xz yuzu-d52d85993683a6948285801ab54d51c79c98afba.tar.zst yuzu-d52d85993683a6948285801ab54d51c79c98afba.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/svc.cpp | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 95403644b..0c50f0d5b 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -447,11 +447,17 @@ static Result QueryMemory(void* info, void* out, u32 addr) { } /// Create an event -static Result CreateEvent(Handle* evt, u32 reset_type) { - *evt = Kernel::CreateEvent((ResetType)reset_type); - LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", - reset_type, *evt); - return 0; +static Result CreateEvent(Handle* handle, u32 reset_type) { + auto evt_res = Kernel::Event::Create(static_cast<ResetType>(reset_type)); + if (evt_res.Failed()) + return evt_res.Code().raw; + auto handle_res = Kernel::g_handle_table.Create(evt_res.MoveFrom()); + if (handle_res.Failed()) + return handle_res.Code().raw; + *handle = handle_res.MoveFrom(); + + LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", reset_type, *handle); + return RESULT_SUCCESS.raw; } /// Duplicates a kernel handle @@ -465,16 +471,28 @@ static Result DuplicateHandle(Handle* out, Handle handle) { } /// Signals an event -static Result SignalEvent(Handle evt) { - LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt); +static Result SignalEvent(Handle handle) { + LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); + + auto evt = Kernel::g_handle_table.Get<Kernel::Event>(handle); + if (evt == nullptr) + return InvalidHandle(ErrorModule::Kernel).raw; + + evt->Signal(); HLE::Reschedule(__func__); - return Kernel::SignalEvent(evt).raw; + return RESULT_SUCCESS.raw; } /// Clears an event -static Result ClearEvent(Handle evt) { - LOG_TRACE(Kernel_SVC, "called event=0x%08X", evt); - return Kernel::ClearEvent(evt).raw; +static Result ClearEvent(Handle handle) { + LOG_TRACE(Kernel_SVC, "called event=0x%08X", handle); + + auto evt = Kernel::g_handle_table.Get<Kernel::Event>(handle); + if (evt == nullptr) + return InvalidHandle(ErrorModule::Kernel).raw; + + evt->Clear(); + return RESULT_SUCCESS.raw; } /// Creates a timer |