1 /*******************************************************************
\r
5 * Author: Peter van Sebille (peter@yipton.net)
\r
7 * Modified/adapted for picodriveN by notaz, 2006
\r
9 * (c) Copyright 2006, notaz
\r
10 * (c) Copyright 2002, Peter van Sebille
\r
11 * All Rights Reserved
\r
13 *******************************************************************/
\r
18 #include <e32base.h>
\r
25 enum TPicoGameState {
\r
33 enum TPicoServRqst {
\r
42 PicoMsgConfigChange,
\r
44 kDefaultMessageSlots // this is how many messages we need :)
\r
47 enum TPicoGenErrors { // generic errors
\r
48 PicoErrNoErr = 0, // OK
\r
49 PicoErrRomOpenFailed,
\r
52 PicoErrNoRomsInArchive,
\r
55 PicoErrGenSnd, // 7 generic sound system error
\r
60 // needed for creating server thread.
\r
61 const TUint KPicoMaxHeapSize=0x00800000;
\r
63 // key config entry (touchpad areas)
\r
64 struct TPicoAreaConfigEntry {
\r
66 //unsigned long actions;
\r
69 struct TPicoKeyConfigEntry
\r
71 unsigned short keyCode;
\r
72 unsigned char scanCode;
\r
73 unsigned char flags; // lsb->msb: key_down, pulse_only, ?, ?, ?, ?, not_configurable, disabled
\r
74 TInt32 handle1; // for CancelCaptureKeyUpAndDowns()
\r
75 TInt32 handle2; // for CancelCaptureKey()
\r
80 // configuration data
\r
85 void InternalizeL(RReadStream &aStream);
\r
86 void ExternalizeL(RWriteStream &aStream) const;
\r
88 enum TPicoScreenRotation {
\r
94 enum TPicoScreenMode {
\r
99 enum TPicoFrameSkip {
\r
105 TFileName iLastROMFile;
\r
107 TInt32 iScreenRotation;
\r
108 TInt32 iScreenMode;
\r
109 TUint32 iFlags; // LSb->MSb: use_sram, show_fps, enable_sound, sound_rate(3bits), gzip_saves{=0x40}, dont_use_mot_vol
\r
110 // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound;
\r
111 // alt_renderer, 6button_gamepad, accurate_timing
\r
114 TUint32 iKeyBinds[256]; // a binding for every keycode
\r
115 TUint32 iAreaBinds[19];
\r
120 class CThreadWatcher : public CActive
\r
123 static CThreadWatcher* NewL(const TThreadId& aTid);
\r
126 TThreadId iTid; // thread id
\r
129 CThreadWatcher(const TThreadId& aTid);
\r
132 virtual void RunL();
\r
133 virtual void DoCancel();
\r
137 class CPicoGameSession
\r
140 static TInt Do(const TPicoServRqst what, TAny *param=0);
\r
141 static void freeResources();
\r
143 static TBool iEmuRunning;
\r
144 static TBuf<0x30> iRomInternalName;
\r
147 // services available
\r
148 static TInt StartEmuThread();
\r
149 static TInt ChangeRunState(TPicoGameState newstate, TPicoGameState newstate_next=(TPicoGameState)0);
\r
150 static TInt loadROM(TPtrC16 *pptr);
\r
151 static TInt changeConfig(TPicoConfig *aConfig);
\r
153 static CThreadWatcher *iThreadWatcher;
\r
157 int saveLoadGame(int load, int sram=0);
\r