mirror of
				https://github.com/RaySollium99/picodrive.git
				synced 2025-10-27 21:48:50 +01:00 
			
		
		
		
	 f8af96349e
			
		
	
	
		f8af96349e
		
	
	
	
	
		
			
			git-svn-id: file:///home/notaz/opt/svn/PicoDrive@572 be3aeb3a-fb24-0410-a615-afba39da0efa
		
			
				
	
	
		
			143 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			143 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*******************************************************************
 | |
|  *
 | |
|  *	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_ReloadRom,
 | |
| 	PGS_Reset,
 | |
| };
 | |
| 
 | |
| 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,
 | |
| 	PicoErrOutOfMemSnd,
 | |
| 	PicoErrGenSnd, // 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
 |