cue/bin finally implemented
[picodrive.git] / platform / uiq2 / SimpleServer.h
CommitLineData
cc68a136 1// SimpleServer.h\r
2\r
3#ifndef __SIMPLESERVER_H\r
4#define __SIMPLESERVER_H\r
5\r
6#include <e32base.h>\r
7\r
8\r
9TInt StartThread();\r
10\r
11\r
12// engine states\r
13enum TPicoGameState {\r
14 PGS_Running,\r
15 PGS_Paused,\r
16 PGS_Quit,\r
17 PGS_KeyConfig,\r
18 PGS_DebugHeap,\r
19};\r
20\r
21// needed for creating server thread.\r
22const TUint KPicoMaxHeapSize=0x00800000;\r
23\r
24// reasons for server panic\r
25enum TPicoServPanic\r
26{\r
27 EBadRequest,\r
28 EBadDescriptor,\r
29 EMainSchedulerError,\r
30 ESvrCreateServer,\r
31 ESvrStartServer,\r
32 ECreateTrapCleanup,\r
33 ENotImplementedYet,\r
34};\r
35\r
36\r
37// key config entry (touchpad areas)\r
38struct TPicoAreaConfigEntry {\r
39 TRect rect;\r
40 //unsigned long actions;\r
41};\r
42\r
43struct TPicoKeyConfigEntry\r
44{\r
45 unsigned short keyCode;\r
46 unsigned char scanCode;\r
47 unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled\r
48 TInt32 handle1; // for CancelCaptureKeyUpAndDowns()\r
49 TInt32 handle2; // for CancelCaptureKey()\r
50 char *name;\r
51};\r
52\r
53\r
54//**********************************\r
55//CPicoServServer\r
56//**********************************\r
57//The server class; an active object.\r
58//Contains an instance of RServer; a handle to the kernel server representation which is used \r
59//to receive messages. \r
60\r
61class CPicoServServer : public CServer\r
62{\r
63public:\r
64 enum {EPriority=950};\r
65public:\r
66 static void New();\r
67 virtual CSharableSession *NewSessionL(const TVersion &aVersion) const;\r
68 static TInt ThreadFunction(TAny* aStarted);\r
69protected:\r
70 CPicoServServer(TInt aPriority);\r
71private:\r
72 TInt iActive;\r
73};\r
74\r
75\r
76//**********************************\r
77//CPicoServSession\r
78//**********************************\r
79//This class represents a session in the server.\r
80//CSession::Client() returns the client thread.\r
81//Functions are provided to respond appropriately to client messages.\r
82\r
83\r
84class CPicoServSession : public CSession\r
85{\r
86public:\r
87 // construct/destruct\r
88 CPicoServSession(RThread &aClient, CPicoServServer * aServer);\r
89 static CPicoServSession* NewL(RThread &aClient, CPicoServServer * aServer);\r
90 //service request\r
91 virtual void ServiceL(const RMessage &aMessage);\r
92 void DispatchMessageL(const RMessage &aMessage);\r
93\r
94 // services available\r
95 void loadROM();\r
96 void changeConfig();\r
97 void sendConfig();\r
98 void sendDebug();\r
99\r
100protected:\r
101 // panic the client\r
102 void PanicClient(TInt aPanic) const;\r
103 // safewrite between client and server\r
104 void Write(const TAny* aPtr,const TDesC8& aDes,TInt anOffset=0);\r
105private:\r
106 //CPicoServServer *iPicoSvr;\r
107\r
108 unsigned char *rom_data;\r
109};\r
110\r
111\r
112\r
113//**********************************\r
114//global functions\r
115//**********************************\r
116\r
117// function to panic the server\r
118GLREF_C void PanicServer(TPicoServPanic aPanic);\r
119int saveLoadGame(int load, int sram=0);\r
120\r
121#endif // __SIMPLESERVER_H\r