Skip to content

Commit

Permalink
TONY: Replace stubs for TakeOwnership/ReleaseOwnership with actual im…
Browse files Browse the repository at this point in the history
…plementation
  • Loading branch information
dreammaster committed May 14, 2012
1 parent 9eb66a2 commit 47ddb2f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
15 changes: 5 additions & 10 deletions engines/tony/custom.cpp
Expand Up @@ -2134,15 +2134,12 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
*/

DECLARE_CUSTOM_FUNCTION(TakeOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
// EnterCriticalSection(&cs[num]);
// WaitForSingleObject(mut[num],CORO_INFINITE);
warning("TODO: TakeOwnership");
CoroScheduler.waitForSingleObject(coroParam, GLOBALS.mut[num], CORO_INFINITE);
}

DECLARE_CUSTOM_FUNCTION(ReleaseOwnership)(CORO_PARAM, uint32 num, uint32, uint32, uint32) {
// LeaveCriticalSection(&cs[num]);
// g_system->unlockMutex(mut[num]);
warning("TODO: ReleaseOwnership");
CoroScheduler.pulseEvent(GLOBALS.mut[num]);
warning("TODO: Validate that the use of events in TakeOwnership/ReleaseOwnership match original");
}


Expand Down Expand Up @@ -2646,11 +2643,9 @@ void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation
GLOBALS.bAlwaysDisplay = false;
int i;

/* for (i = 0;i < 10; i++)
cs[i] = g_system->createMutex();
for (i = 0;i < 10; i++)
mut[i] = CreateMutex(NULL, false, NULL);
*/
GLOBALS.mut[i] = CoroScheduler.createEvent(false, false);

for (i = 0; i < 200; i++)
GLOBALS.tappeti[i] = 0;

Expand Down
3 changes: 1 addition & 2 deletions engines/tony/globals.cpp
Expand Up @@ -83,9 +83,8 @@ Globals::Globals() {
curSonoriz = 0;
bFadeOutStop = false;

// OSystem::MutexRef cs[10];
// OSystem::MutexRef vdb;
Common::fill(&mut[0], &mut[10], (HANDLE)NULL);
Common::fill(&mut[0], &mut[10], 0);
bSkipIdle = false;
hSkipIdle = 0;
lastMusic = 0;
Expand Down
2 changes: 1 addition & 1 deletion engines/tony/globals.h
Expand Up @@ -241,7 +241,7 @@ class Globals {
RMPoint StartLocPos[256];
OSystem::MutexRef cs[10];
OSystem::MutexRef vdb;
HANDLE mut[10];
uint32 mut[10];

bool bSkipIdle;
uint32 hSkipIdle;
Expand Down

0 comments on commit 47ddb2f

Please sign in to comment.