-/*******************************************************************\r
- *\r
- * File: Engine.h\r
- *\r
- * Author: Peter van Sebille (peter@yipton.net)\r
- *\r
- * Modified/adapted for picodriveN by notaz, 2006\r
- *\r
- * (c) Copyright 2006, notaz\r
- * (c) Copyright 2002, Peter van Sebille\r
- * All Rights Reserved\r
- *\r
- *******************************************************************/\r
-\r
-#ifndef __ENGINE_H\r
-#define __ENGINE_H\r
-\r
-#include <e32base.h>\r
-\r
-class RReadStream;\r
-class RWriteStream;\r
-\r
-\r
-// engine states\r
-enum TPicoGameState {\r
- PGS_Running = 1,\r
- PGS_Paused,\r
- PGS_Quit,\r
- PGS_KeyConfig,\r
- PGS_ReloadRom,\r
- PGS_Reset,\r
-};\r
-\r
-enum TPicoServRqst {\r
- PicoMsgLoadState,\r
- PicoMsgSaveState,\r
- PicoMsgLoadROM,\r
- PicoMsgResume,\r
- PicoMsgReset,\r
- PicoMsgKeys,\r
- PicoMsgPause,\r
- PicoMsgQuit,\r
- PicoMsgConfigChange,\r
- PicoMsgSetAppView,\r
- kDefaultMessageSlots // this is how many messages we need :)\r
-};\r
-\r
-enum TPicoGenErrors { // generic errors\r
- PicoErrNoErr = 0, // OK\r
- PicoErrRomOpenFailed,\r
- PicoErrOutOfMem,\r
- PicoErrOutOfMemSnd,\r
- PicoErrGenSnd, // generic sound system error\r
- PicoErrEmuThread\r
-};\r
-\r
-\r
-// needed for creating server thread.\r
-const TUint KPicoMaxHeapSize=0x00800000;\r
-\r
-// key config entry (touchpad areas)\r
-struct TPicoAreaConfigEntry {\r
- TRect rect;\r
- //unsigned long actions;\r
-};\r
-\r
-struct TPicoKeyConfigEntry\r
-{\r
- unsigned short keyCode;\r
- unsigned char scanCode;\r
- unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled\r
- TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
- TInt32 handle2; // for CancelCaptureKey()\r
- char *name;\r
-};\r
-\r
-\r
-// configuration data\r
-class TPicoConfig\r
-{\r
-public:\r
-// void SetDefaults();\r
-// void InternalizeL(RReadStream &aStream);\r
-// void ExternalizeL(RWriteStream &aStream) const;\r
-\r
- enum TPicoScreenRotation {\r
- PRot0,\r
- PRot90,\r
- PRot180,\r
- PRot270\r
- };\r
- enum TPicoScreenMode {\r
- PMCenter,\r
- PMFit,\r
- PMFit2\r
- };\r
- enum TPicoFrameSkip {\r
- PFSkipAuto = -1,\r
- PFSkip0\r
- };\r
-\r
-public:\r
- TFileName iLastROMFile; // used as tmp only\r
-};\r
-\r
-\r
-class CThreadWatcher : public CActive\r
-{\r
-public:\r
- static CThreadWatcher* NewL(const TThreadId& aTid);\r
- ~CThreadWatcher();\r
-\r
- TThreadId iTid; // thread id\r
-\r
-protected:\r
- CThreadWatcher(const TThreadId& aTid);\r
- void ConstructL();\r
-\r
- virtual void RunL();\r
- virtual void DoCancel();\r
-};\r
-\r
-\r
-class CPicoGameSession\r
-{\r
-public:\r
- static TInt Do(const TPicoServRqst what, TAny *param=0);\r
- static void freeResources();\r
-\r
- static TBool iEmuRunning;\r
- static TBuf<150> iRomInternalName;\r
-\r
-private:\r
- // services available\r
- static TInt StartEmuThread();\r
- static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0);\r
- static TInt loadROM(TPtrC16 *pptr);\r
- static TInt changeConfig(TPicoConfig *aConfig);\r
-\r
- static CThreadWatcher *iThreadWatcher;\r
-};\r
-\r
-#endif\r