AxibugEmuOnline/References/virtuanessrc097-master/EmuThread.h

198 lines
7.1 KiB
C
Raw Permalink Normal View History

<EFBFBD><EFBFBD>//
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//
#ifndef __CEMUTHREAD_INCLUDED__
#define __CEMUTHREAD_INCLUDED__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <string>
#include <deque>
#include <queue>
using namespace std;
#include "App.h"
#include "MMTimer.h"
#include "Config.h"
#include "WaveRec.h"
#include "typedef.h"
#include "macro.h"
#include "nes.h"
#include "mmu.h"
#include "cpu.h"
#include "ppu.h"
#include "apu.h"
#include "pad.h"
#include "rom.h"
#include "mapper.h"
// Prototypes
// NetPlay Event
class NETEV {
public:
INT Event;
DWORD Param;
};
//class NES;
class CEmuThread
{
public:
CEmuThread();
~CEmuThread();
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
enum EMUEVENT {
EV_EXIT = -1,
EV_NONE = 0,
EV_INITIAL,
EV_PAUSE,
EV_RESUME,
// <EFBFBD>N No0Eventg0O(uY0<EFBFBD>0
EV_MESSAGE_OUT, // <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0`0Q0<EFBFBD>Q<EFBFBD>RW0_0D0Bfk0O(u
EV_FULLSCREEN_GDI, // EventParam
EV_EMUPAUSE,
EV_ONEFRAME,
EV_THROTTLE,
EV_FRAMESKIP_AUTO,
EV_FRAMESKIP_UP,
EV_FRAMESKIP_DOWN,
EV_HWRESET,
EV_SWRESET,
EV_NETPLAY_START,
EV_STATE_LOAD, // EventParam2
EV_STATE_SAVE, // EventParam2
// For Disk system
EV_DISK_COMMAND, // EventParam
// For ExController
EV_EXCONTROLLER, // EventParam
// For Sound
EV_SOUND_MUTE, // EventParam
// For Snapshot
EV_SNAPSHOT,
// For Movie
EV_MOVIE_PLAY, // EventParam
EV_MOVIE_REC, // EventParam
EV_MOVIE_RECAPPEND, // EventParam
EV_MOVIE_STOP, // EventParam
// For Wave recording
EV_WAVEREC_START, // EventParam
EV_WAVEREC_STOP,
// For Tape recording
EV_TAPE_PLAY, // EventParam
EV_TAPE_REC, // EventParam
EV_TAPE_STOP,
// For Barcode
EV_BARCODE, // EventParam2
// For TurboFile
EV_TURBOFILE, // EventParam
// For Debugger
EV_DEBUG_RUN,
EV_DEBUG_BRAKE,
EV_DEBUG_STEP,
EV_DEBUG_COMMAND, // EventParam
};
// <EFBFBD>R\O<EFBFBD>0<EFBFBD>0<EFBFBD>0
enum {
STATUS_NONE = 0,
STATUS_RUN,
STATUS_PAUSE,
};
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
//
void SetPriority( INT nPriority );
BOOL Start( HWND hWnd, NES* nes );
void Stop();
void Pause();
void Resume();
void Event( EMUEVENT ev );
void EventParam( EMUEVENT ev, LONG Param );
void EventParam2( EMUEVENT ev, LONG Param, LONG Param2 );
BOOL IsRunning() { return (g_Status!=STATUS_NONE); }
BOOL IsPausing() { return (g_Status==STATUS_PAUSE); }
BOOL IsWaveRecord() { return g_WaveRec.IsWaveRecord(); }
INT GetDiskNo() { if( g_nes ) return g_nes->rom->GetDiskNo(); else return 0; }
INT GetExController() { if( g_nes ) return g_nes->pad->GetExController(); else return 0; }
//
NES* GetNES() { return g_nes; }
protected:
static void DiskCommand( BYTE cmd );
static BOOL FrameInput();
static DWORD WINAPI ThreadProc( LPVOID lpVoid );
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0(u
static void StreamProcess( BOOL bPause );
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h0ID
HANDLE m_hThread;
DWORD m_dwThreadID;
// This<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static CEmuThread* g_pThis;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static HWND g_hWnd;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static NES* g_nes;
// Wave<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static CWaveRec g_WaveRec;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
INT m_nPauseCount;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static INT g_Status;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0h0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static INT g_Event;
static LONG g_EventParam;
static LONG g_EventParam2;
static HANDLE g_hEvent;
static HANDLE g_hEventAccept;
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
INT m_nPriority;
static INT g_PriorityTable[];
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static CHAR g_szErrorMessage[512];
// <EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0<EFBFBD>0
static LPCSTR g_lpSoundMuteStringTable[];
// NetPlay Event
static deque<NETEV> NetEventQueue;
static string strNetStateName;
private:
};
extern CEmuThread Emu;
#endif // !__CEMUTHREAD_INCLUDED__