UIQ3 update, some makefile unification, rm old configs, stuff
[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
30 PGS_DebugHeap,\r
ca482e5d 31 PGS_ReloadRom,\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
52 PicoErrNotRom,\r
53 PicoErrNoRomsInArchive,\r
54 PicoErrUncomp, // 5\r
55 PicoErrOutOfMemSnd,\r
56 PicoErrGenSnd, // 7 generic sound system error\r
57 PicoErrEmuThread\r
58};\r
59\r
60\r
61// needed for creating server thread.\r
62const TUint KPicoMaxHeapSize=0x00800000;\r
63\r
64// key config entry (touchpad areas)\r
65struct TPicoAreaConfigEntry {\r
66 TRect rect;\r
67 //unsigned long actions;\r
68};\r
69\r
70struct TPicoKeyConfigEntry\r
71{\r
72 unsigned short keyCode;\r
73 unsigned char scanCode;\r
74 unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled\r
75 TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
76 TInt32 handle2; // for CancelCaptureKey()\r
77 char *name;\r
78};\r
79\r
80\r
81// configuration data\r
82class TPicoConfig\r
83{\r
84public:\r
ca482e5d 85// void SetDefaults();\r
86// void InternalizeL(RReadStream &aStream);\r
87// void ExternalizeL(RWriteStream &aStream) const;\r
cc68a136 88\r
89 enum TPicoScreenRotation {\r
90 PRot0,\r
91 PRot90,\r
92 PRot180,\r
93 PRot270\r
94 };\r
95 enum TPicoScreenMode {\r
96 PMCenter,\r
97 PMFit,\r
98 PMFit2\r
99 };\r
100 enum TPicoFrameSkip {\r
101 PFSkipAuto = -1,\r
102 PFSkip0\r
103 };\r
104\r
105public:\r
ca482e5d 106 TFileName iLastROMFile; // used as tmp only\r
cc68a136 107};\r
108\r
109\r
110class CThreadWatcher : public CActive\r
111{\r
112public:\r
113 static CThreadWatcher* NewL(const TThreadId& aTid);\r
114 ~CThreadWatcher();\r
115\r
116 TThreadId iTid; // thread id\r
117\r
118protected:\r
119 CThreadWatcher(const TThreadId& aTid);\r
120 void ConstructL();\r
121\r
122 virtual void RunL();\r
123 virtual void DoCancel();\r
124};\r
125\r
126\r
127class CPicoGameSession\r
128{\r
129public:\r
130 static TInt Do(const TPicoServRqst what, TAny *param=0);\r
131 static void freeResources();\r
132\r
133 static TBool iEmuRunning;\r
ca482e5d 134 static TBuf<150> iRomInternalName;\r
cc68a136 135\r
136private:\r
137 // services available\r
138 static TInt StartEmuThread();\r
139 static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0);\r
140 static TInt loadROM(TPtrC16 *pptr);\r
141 static TInt changeConfig(TPicoConfig *aConfig);\r
142\r
143 static CThreadWatcher *iThreadWatcher;\r
144};\r
145\r
cc68a136 146#endif\r