diff options
author | Filippos Karapetis | 2008-12-01 20:35:36 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-12-01 20:35:36 +0000 |
commit | af945ac7881ae7e414f004bd0e99e8c3b5d76be9 (patch) | |
tree | 72e9c6fd43406e2021973b4f163ab4faa10143fb /engines/tinsel/sched.h | |
parent | f10f151ff742801e12534bb052bd89419bf906cb (diff) | |
download | scummvm-rg350-af945ac7881ae7e414f004bd0e99e8c3b5d76be9.tar.gz scummvm-rg350-af945ac7881ae7e414f004bd0e99e8c3b5d76be9.tar.bz2 scummvm-rg350-af945ac7881ae7e414f004bd0e99e8c3b5d76be9.zip |
Merged the tinsel 2 engine with tinsel 1. Both Discworld 1 and Discworld 2 should be completable
svn-id: r35196
Diffstat (limited to 'engines/tinsel/sched.h')
-rw-r--r-- | engines/tinsel/sched.h | 48 |
1 files changed, 43 insertions, 5 deletions
diff --git a/engines/tinsel/sched.h b/engines/tinsel/sched.h index 0d90b3bb9f..1e2d3f796e 100644 --- a/engines/tinsel/sched.h +++ b/engines/tinsel/sched.h @@ -29,6 +29,8 @@ #include "tinsel/dw.h" // new data types #include "tinsel/coroutine.h" +#include "tinsel/events.h" +#include "tinsel/tinsel.h" namespace Tinsel { @@ -36,12 +38,26 @@ namespace Tinsel { #define PARAM_SIZE 32 // the maximum number of processes -#define NUM_PROCESS 64 +#define NUM_PROCESS (TinselV2 ? 70 : 64) +#define MAX_PROCESSES 70 typedef void (*CORO_ADDR)(CoroContext &, const void *); +/** process structure */ +struct PROCESS { + PROCESS *pNext; //!< pointer to next process in active or free list + PROCESS *pPrevious; //!< pointer to previous process in active or free list -struct PROCESS; + CoroContext state; //!< the state of the coroutine + CORO_ADDR coroAddr; //!< the entry point of the coroutine + + int sleepTime; //!< number of scheduler cycles to sleep + int pid; //!< process ID + char param[PARAM_SIZE]; //!< process specific info +}; +typedef PROCESS *PPROCESS; + +struct INT_CONTEXT; /** * Create and manage "processes" (really coroutines). @@ -64,11 +80,13 @@ private: /** the currently active process */ PROCESS *pCurrent; - + #ifdef DEBUG // diagnostic process counters int numProcs; int maxProcs; + + void CheckStack(); #endif /** @@ -90,13 +108,16 @@ public: #endif void schedule(); - + void rescheduleAll(); + void reschedule(PPROCESS pReSchedProc = NULL); + void giveWay(PPROCESS pReSchedProc = NULL); + PROCESS *createProcess(int pid, CORO_ADDR coroAddr, const void *pParam, int sizeParam); void killProcess(PROCESS *pKillProc); PROCESS *getCurrentProcess(); int getCurrentPID() const; - int killMatchingProcess(int pidKill, int pidMask); + int killMatchingProcess(int pidKill, int pidMask = -1); void setResourceCallback(VFPTRPP pFunc); @@ -105,6 +126,23 @@ public: extern Scheduler *g_scheduler; // FIXME: Temporary global var, to be used until everything has been OOifyied +//----------------- FUNCTION PROTOTYPES -------------------- + +void SceneProcesses(uint32 numProcess, SCNHANDLE hProcess); +void CallSceneProcess(uint32 procID); +void KillSceneProcess(uint32 procID); +void SceneProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, + int myEscape, bool *result = NULL); +void RestoreSceneProcess(INT_CONTEXT *pic); + +void GlobalProcesses(uint32 numProcess, byte *pProcess); +void xCallGlobalProcess(uint32 procID); +void xKillGlobalProcess(uint32 procID); +bool GlobalProcessEvent(CORO_PARAM, uint32 procID, TINSEL_EVENT event, bool bWait, int myEscape); +void RestoreGlobalProcess(INT_CONTEXT *pic); +void KillGlobalProcesses(void); +void FreeGlobalProcesses(); + } // end of namespace Tinsel #endif // TINSEL_SCHED_H |