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