32x: drc: bugfix
[picodrive.git] / platform / uiq3 / Engine.h
CommitLineData
cc68a136 1/*******************************************************************\r
2 *\r
3 * File: Engine.h\r
4 *\r
5 * Author: Peter van Sebille (peter@yipton.net)\r
6 *\r
7 * Modified/adapted for picodriveN by notaz, 2006\r
8 *\r
9 * (c) Copyright 2006, notaz\r
10 * (c) Copyright 2002, Peter van Sebille\r
11 * All Rights Reserved\r
12 *\r
13 *******************************************************************/\r
14\r
15#ifndef __ENGINE_H\r
16#define __ENGINE_H\r
17\r
18#include <e32base.h>\r
19\r
20class RReadStream;\r
21class RWriteStream;\r
22\r
23\r
24// engine states\r
25enum TPicoGameState {\r
26 PGS_Running = 1,\r
27 PGS_Paused,\r
28 PGS_Quit,\r
29 PGS_KeyConfig,\r
ca482e5d 30 PGS_ReloadRom,\r
f8af9634 31 PGS_Reset,\r
cc68a136 32};\r
33\r
34enum TPicoServRqst {\r
35 PicoMsgLoadState,\r
36 PicoMsgSaveState,\r
37 PicoMsgLoadROM,\r
38 PicoMsgResume,\r
39 PicoMsgReset,\r
40 PicoMsgKeys,\r
41 PicoMsgPause,\r
42 PicoMsgQuit,\r
43 PicoMsgConfigChange,\r
44 PicoMsgSetAppView,\r
45 kDefaultMessageSlots // this is how many messages we need :)\r
46};\r
47\r
48enum TPicoGenErrors { // generic errors\r
49 PicoErrNoErr = 0, // OK\r
50 PicoErrRomOpenFailed,\r
51 PicoErrOutOfMem,\r
cc68a136 52 PicoErrOutOfMemSnd,\r
f8af9634 53 PicoErrGenSnd, // generic sound system error\r
cc68a136 54 PicoErrEmuThread\r
55};\r
56\r
57\r
58// needed for creating server thread.\r
59const TUint KPicoMaxHeapSize=0x00800000;\r
60\r
61// key config entry (touchpad areas)\r
62struct TPicoAreaConfigEntry {\r
63 TRect rect;\r
64 //unsigned long actions;\r
65};\r
66\r
67struct TPicoKeyConfigEntry\r
68{\r
69 unsigned short keyCode;\r
70 unsigned char scanCode;\r
71 unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled\r
72 TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
73 TInt32 handle2; // for CancelCaptureKey()\r
74 char *name;\r
75};\r
76\r
77\r
78// configuration data\r
79class TPicoConfig\r
80{\r
81public:\r
ca482e5d 82// void SetDefaults();\r
83// void InternalizeL(RReadStream &aStream);\r
84// void ExternalizeL(RWriteStream &aStream) const;\r
cc68a136 85\r
86 enum TPicoScreenRotation {\r
87 PRot0,\r
88 PRot90,\r
89 PRot180,\r
90 PRot270\r
91 };\r
92 enum TPicoScreenMode {\r
93 PMCenter,\r
94 PMFit,\r
95 PMFit2\r
96 };\r
97 enum TPicoFrameSkip {\r
98 PFSkipAuto = -1,\r
99 PFSkip0\r
100 };\r
101\r
102public:\r
ca482e5d 103 TFileName iLastROMFile; // used as tmp only\r
cc68a136 104};\r
105\r
106\r
107class CThreadWatcher : public CActive\r
108{\r
109public:\r
110 static CThreadWatcher* NewL(const TThreadId& aTid);\r
111 ~CThreadWatcher();\r
112\r
113 TThreadId iTid; // thread id\r
114\r
115protected:\r
116 CThreadWatcher(const TThreadId& aTid);\r
117 void ConstructL();\r
118\r
119 virtual void RunL();\r
120 virtual void DoCancel();\r
121};\r
122\r
123\r
124class CPicoGameSession\r
125{\r
126public:\r
127 static TInt Do(const TPicoServRqst what, TAny *param=0);\r
128 static void freeResources();\r
129\r
130 static TBool iEmuRunning;\r
ca482e5d 131 static TBuf<150> iRomInternalName;\r
cc68a136 132\r
133private:\r
134 // services available\r
135 static TInt StartEmuThread();\r
136 static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0);\r
137 static TInt loadROM(TPtrC16 *pptr);\r
138 static TInt changeConfig(TPicoConfig *aConfig);\r
139\r
140 static CThreadWatcher *iThreadWatcher;\r
141};\r
142\r
cc68a136 143#endif\r