aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-06-09 22:14:38 +1000
committerPaul Gilbert2012-06-09 22:14:38 +1000
commit7758b1a432fcd31e5e608cb7720225f7a0cc633c (patch)
treea1525c0bf217b1108aeea471601d5d870b48340b /engines
parentda39f4d758f0952e207665244023d2f3f91c6c6e (diff)
downloadscummvm-rg350-7758b1a432fcd31e5e608cb7720225f7a0cc633c.tar.gz
scummvm-rg350-7758b1a432fcd31e5e608cb7720225f7a0cc633c.tar.bz2
scummvm-rg350-7758b1a432fcd31e5e608cb7720225f7a0cc633c.zip
TONY: Fix operation of TakeOwnership/ReleaseOwnership
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/custom.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/engines/tony/custom.cpp b/engines/tony/custom.cpp
index 858479ca7f..6db6d5f858 100644
--- a/engines/tony/custom.cpp
+++ b/engines/tony/custom.cpp
@@ -2043,12 +2043,25 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
*/
DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
- CoroScheduler.waitForSingleObject(coroParam, GLOBALS.mut[num], CORO_INFINITE);
+ CORO_BEGIN_CONTEXT;
+ bool expired;
+ CORO_END_CONTEXT(_ctx);
+
+ CORO_BEGIN_CODE(_ctx);
+
+ // The event is operating as a mutex, so if the event is already set, wait until it's reset
+ do {
+ CORO_INVOKE_3(CoroScheduler.waitForSingleObject, GLOBALS.mut[num], 0, &_ctx->expired);
+ } while (!_ctx->expired);
+
+ // Set the event to flag ownership
+ CoroScheduler.setEvent(GLOBALS.mut[num]);
+
+ CORO_END_CODE;
}
DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
- CoroScheduler.pulseEvent(GLOBALS.mut[num]);
- warning("TODO: Validate that the use of events in TakeOwnership/ReleaseOwnership match original");
+ CoroScheduler.resetEvent(GLOBALS.mut[num]);
}
/*