diff options
-rw-r--r-- | src/core/hle/kernel/event.cpp | 28 | ||||
-rw-r--r-- | src/core/hle/kernel/event.h | 8 |
2 files changed, 32 insertions, 4 deletions
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 7cb8c5142..e84d0b49e 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -23,6 +23,7 @@ public: ResetType reset_type; ///< Current ResetType bool locked; ///< Current locked state + bool permanent_locked; ///< Hack - to set event permanent state (for easy passthrough) /** * Synchronize kernel object @@ -31,7 +32,7 @@ public: */ Result SyncRequest(bool* wait) { // TODO(bunnei): ImplementMe - ERROR_LOG(KERNEL, "Unimplemented function Event::SyncRequest"); + ERROR_LOG(KERNEL, "(UMIMPLEMENTED) call"); return 0; } @@ -43,7 +44,7 @@ public: Result WaitSynchronization(bool* wait) { // TODO(bunnei): ImplementMe *wait = locked; - if (reset_type != RESETTYPE_STICKY) { + if (reset_type != RESETTYPE_STICKY && !permanent_locked) { locked = true; } return 0; @@ -59,10 +60,28 @@ public: Result SetEventLocked(const Handle handle, const bool locked) { Event* evt = g_object_pool.GetFast<Event>(handle); if (!evt) { - ERROR_LOG(KERNEL, "SetEventLocked called with unknown handle=0x%08X", handle); + ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); return -1; } - evt->locked = locked; + if (!evt->permanent_locked) { + evt->locked = locked; + } + return 0; +} + +/** + * Hackish function to set an events permanent lock state, used to pass through synch blocks + * @param handle Handle to event to change + * @param permanent_locked Boolean permanent locked value to set event + * @return Result of operation, 0 on success, otherwise error code + */ +Result SetPermanentLock(Handle handle, const bool permanent_locked) { + Event* evt = g_object_pool.GetFast<Event>(handle); + if (!evt) { + ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); + return -1; + } + evt->permanent_locked = permanent_locked; return 0; } @@ -87,6 +106,7 @@ Event* CreateEvent(Handle& handle, const ResetType reset_type) { handle = Kernel::g_object_pool.Create(evt); evt->locked = true; + evt->permanent_locked = false; evt->reset_type = evt->intitial_reset_type = reset_type; return evt; diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index b1d2c6ad1..f91a72c1c 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h @@ -20,6 +20,14 @@ namespace Kernel { Result SetEventLocked(const Handle handle, const bool locked); /** + * Hackish function to set an events permanent lock state, used to pass through synch blocks + * @param handle Handle to event to change + * @param permanent_locked Boolean permanent locked value to set event + * @return Result of operation, 0 on success, otherwise error code + */ +Result SetPermanentLock(Handle handle, const bool permanent_locked); + +/** * Clears an event * @param handle Handle to event to clear * @return Result of operation, 0 on success, otherwise error code |