198 lines
3.5 KiB
C
198 lines
3.5 KiB
C
|
//
|
|||
|
// <20>G<EFBFBD>~<7E><><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>X<EFBFBD><58><EFBFBD>b<EFBFBD>h<EFBFBD>N<EFBFBD><4E><EFBFBD>X
|
|||
|
//
|
|||
|
#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();
|
|||
|
|
|||
|
// <20>C<EFBFBD>x<EFBFBD><78><EFBFBD>g
|
|||
|
enum EMUEVENT {
|
|||
|
EV_EXIT = -1,
|
|||
|
EV_NONE = 0,
|
|||
|
EV_INITIAL,
|
|||
|
EV_PAUSE,
|
|||
|
EV_RESUME,
|
|||
|
// <20>ȉ<EFBFBD><C889><EFBFBD>Event<6E>Ŏg<C58E>p<EFBFBD><70><EFBFBD><EFBFBD>
|
|||
|
EV_MESSAGE_OUT, // <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>o<EFBFBD>͂<EFBFBD><CD82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ɏg<C98E>p
|
|||
|
|
|||
|
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
|
|||
|
};
|
|||
|
|
|||
|
// <20><><EFBFBD>샂<EFBFBD>[<5B>h
|
|||
|
enum {
|
|||
|
STATUS_NONE = 0,
|
|||
|
STATUS_RUN,
|
|||
|
STATUS_PAUSE,
|
|||
|
};
|
|||
|
|
|||
|
// <20>f<EFBFBD>o<EFBFBD>b<EFBFBD>K<EFBFBD>R<EFBFBD>}<7D><><EFBFBD>h
|
|||
|
|
|||
|
//
|
|||
|
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 );
|
|||
|
// <20>T<EFBFBD>E<EFBFBD><45><EFBFBD>h<EFBFBD>X<EFBFBD>g<EFBFBD><67><EFBFBD>[<5B>~<7E><><EFBFBD>O<EFBFBD>p
|
|||
|
static void StreamProcess( BOOL bPause );
|
|||
|
|
|||
|
// <20>X<EFBFBD><58><EFBFBD>b<EFBFBD>h<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68><EFBFBD><EFBFBD>ID
|
|||
|
HANDLE m_hThread;
|
|||
|
DWORD m_dwThreadID;
|
|||
|
|
|||
|
// This<69>|<7C>C<EFBFBD><43><EFBFBD>^
|
|||
|
static CEmuThread* g_pThis;
|
|||
|
// <20>E<EFBFBD>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
static HWND g_hWnd;
|
|||
|
// <20>G<EFBFBD>~<7E><><EFBFBD><EFBFBD><EFBFBD>[<5B>^<5E>I<EFBFBD>u<EFBFBD>W<EFBFBD>F<EFBFBD>N<EFBFBD>g<EFBFBD>|<7C>C<EFBFBD><43><EFBFBD>^
|
|||
|
static NES* g_nes;
|
|||
|
|
|||
|
// Wave<76><65><EFBFBD>R<EFBFBD>[<5B>_
|
|||
|
static CWaveRec g_WaveRec;
|
|||
|
|
|||
|
// <20>|<7C>[<5B>Y<EFBFBD>J<EFBFBD>E<EFBFBD><45><EFBFBD>g
|
|||
|
INT m_nPauseCount;
|
|||
|
// <20>X<EFBFBD>e<EFBFBD>[<5B>^<5E>X
|
|||
|
static INT g_Status;
|
|||
|
|
|||
|
// <20>X<EFBFBD><58><EFBFBD>b<EFBFBD>h<EFBFBD>C<EFBFBD>x<EFBFBD><78><EFBFBD>g<EFBFBD>ƃC<C683>x<EFBFBD><78><EFBFBD>g<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
static INT g_Event;
|
|||
|
static LONG g_EventParam;
|
|||
|
static LONG g_EventParam2;
|
|||
|
static HANDLE g_hEvent;
|
|||
|
static HANDLE g_hEventAccept;
|
|||
|
|
|||
|
// <20>X<EFBFBD><58><EFBFBD>b<EFBFBD>h<EFBFBD>v<EFBFBD><76><EFBFBD>C<EFBFBD>I<EFBFBD><49><EFBFBD>e<EFBFBD>B
|
|||
|
INT m_nPriority;
|
|||
|
static INT g_PriorityTable[];
|
|||
|
|
|||
|
// <20>G<EFBFBD><47><EFBFBD>[<5B><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W
|
|||
|
static CHAR g_szErrorMessage[512];
|
|||
|
|
|||
|
// <20>X<EFBFBD>g<EFBFBD><67><EFBFBD><EFBFBD><EFBFBD>O<EFBFBD>e<EFBFBD>[<5B>u<EFBFBD><75>
|
|||
|
static LPCSTR g_lpSoundMuteStringTable[];
|
|||
|
|
|||
|
// NetPlay Event
|
|||
|
static deque<NETEV> NetEventQueue;
|
|||
|
static string strNetStateName;
|
|||
|
|
|||
|
private:
|
|||
|
};
|
|||
|
|
|||
|
extern CEmuThread Emu;
|
|||
|
|
|||
|
#endif // !__CEMUTHREAD_INCLUDED__
|
|||
|
|