New SaveState folder for states. Removed some outdated code. Removed an unnecessary level of indirection for plugin calls. Assorted cleanup.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@389 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-08-30 19:19:40 +00:00
parent 6b6003c563
commit 85565688d7
34 changed files with 329 additions and 672 deletions

View File

@ -131,7 +131,8 @@ bool Init(const SCoreStartupParameter _CoreParameter)
}
#ifdef _WIN32
PluginDSP::DllDebugger((HWND)_CoreParameter.hMainWindow);
if (PluginDSP::DllDebugger)
PluginDSP::DllDebugger((HWND)_CoreParameter.hMainWindow);
#endif
emuThreadGoing.Init();
@ -425,14 +426,14 @@ const SCoreStartupParameter& GetStartupParameter()
return g_CoreStartupParameter;
}
bool MakeScreenshot(const std::string& _rFilename)
bool MakeScreenshot(const std::string &filename)
{
bool bResult = false;
if (PluginVideo::IsLoaded())
{
TCHAR szTmpFilename[MAX_PATH];
strcpy(szTmpFilename, _rFilename.c_str());
bResult = PluginVideo::Video_Screenshot(szTmpFilename);
strcpy(szTmpFilename, filename.c_str());
bResult = PluginVideo::Video_Screenshot(szTmpFilename) ? true : false;
}
return bResult;
}

View File

@ -20,96 +20,86 @@
namespace PluginDSP
{
//! Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TDllDebugger)(HWND);
typedef void (__cdecl* TDSP_Initialize)(DSPInitialize);
typedef void (__cdecl* TDSP_Shutdown)();
typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl* TDSP_Update)(int cycles);
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
TDllAbout g_DllAbout = 0;
TDllConfig g_DllConfig = 0;
TDllDebugger g_DllDebugger = 0;
TDSP_Initialize g_DSP_Initialize = 0;
TDSP_Shutdown g_DSP_Shutdown = 0;
TDSP_ReadMailBox g_DSP_ReadMailboxHigh = 0;
TDSP_ReadMailBox g_DSP_ReadMailboxLow = 0;
TDSP_WriteMailBox g_DSP_WriteMailboxHigh = 0;
TDSP_WriteMailBox g_DSP_WriteMailboxLow = 0;
TDSP_ReadControlRegister g_DSP_ReadControlRegister = 0;
TDSP_WriteControlRegister g_DSP_WriteControlRegister = 0;
TDSP_Update g_DSP_Update = 0;
TDSP_SendAIBuffer g_DSP_SendAIBuffer = 0;
// Function Pointer
TGetDllInfo GetDllInfo = 0;
TDllAbout DllAbout = 0;
TDllConfig DllConfig = 0;
TDllDebugger DllDebugger = 0;
TDSP_Initialize DSP_Initialize = 0;
TDSP_Shutdown DSP_Shutdown = 0;
TDSP_ReadMailBox DSP_ReadMailboxHigh = 0;
TDSP_ReadMailBox DSP_ReadMailboxLow = 0;
TDSP_WriteMailBox DSP_WriteMailboxHigh = 0;
TDSP_WriteMailBox DSP_WriteMailboxLow = 0;
TDSP_ReadControlRegister DSP_ReadControlRegister = 0;
TDSP_WriteControlRegister DSP_WriteControlRegister = 0;
TDSP_Update DSP_Update = 0;
TDSP_SendAIBuffer DSP_SendAIBuffer = 0;
TDSP_DoState DSP_DoState = 0;
//! Library Instance
DynamicLibrary plugin;
bool IsLoaded()
{
return plugin.IsLoaded();
return plugin.IsLoaded();
}
void UnloadPlugin()
{
plugin.Unload();
plugin.Unload();
// Set Functions to NULL
g_GetDllInfo = 0;
g_DllAbout = 0;
g_DllConfig = 0;
g_DllDebugger = 0;
g_DSP_Initialize = 0;
g_DSP_Shutdown = 0;
g_DSP_ReadMailboxHigh = 0;
g_DSP_ReadMailboxLow = 0;
g_DSP_WriteMailboxHigh = 0;
g_DSP_WriteMailboxLow = 0;
g_DSP_ReadControlRegister = 0;
g_DSP_WriteControlRegister = 0;
g_DSP_Update = 0;
g_DSP_SendAIBuffer = 0;
GetDllInfo = 0;
DllAbout = 0;
DllConfig = 0;
DllDebugger = 0;
DSP_Initialize = 0;
DSP_Shutdown = 0;
DSP_ReadMailboxHigh = 0;
DSP_ReadMailboxLow = 0;
DSP_WriteMailboxHigh = 0;
DSP_WriteMailboxLow = 0;
DSP_ReadControlRegister = 0;
DSP_WriteControlRegister = 0;
DSP_Update = 0;
DSP_SendAIBuffer = 0;
DSP_DoState = 0;
}
bool LoadPlugin(const char *_Filename)
{
if (plugin.Load(_Filename))
{
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger"));
g_DSP_Initialize = reinterpret_cast<TDSP_Initialize> (plugin.Get("DSP_Initialize"));
g_DSP_Shutdown = reinterpret_cast<TDSP_Shutdown> (plugin.Get("DSP_Shutdown"));
g_DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxHigh"));
g_DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxLow"));
g_DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxHigh"));
g_DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxLow"));
g_DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister> (plugin.Get("DSP_ReadControlRegister"));
g_DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister> (plugin.Get("DSP_WriteControlRegister"));
g_DSP_Update = reinterpret_cast<TDSP_Update> (plugin.Get("DSP_Update"));
g_DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer> (plugin.Get("DSP_SendAIBuffer"));
if (plugin.Load(_Filename))
{
GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger"));
DSP_Initialize = reinterpret_cast<TDSP_Initialize> (plugin.Get("DSP_Initialize"));
DSP_Shutdown = reinterpret_cast<TDSP_Shutdown> (plugin.Get("DSP_Shutdown"));
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxHigh"));
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxLow"));
DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxHigh"));
DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxLow"));
DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister> (plugin.Get("DSP_ReadControlRegister"));
DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister> (plugin.Get("DSP_WriteControlRegister"));
DSP_Update = reinterpret_cast<TDSP_Update> (plugin.Get("DSP_Update"));
DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer> (plugin.Get("DSP_SendAIBuffer"));
DSP_DoState = reinterpret_cast<TDSP_DoState> (plugin.Get("DSP_DoState"));
if ((g_GetDllInfo != 0) &&
(g_DSP_Initialize != 0) &&
(g_DSP_Shutdown != 0) &&
(g_DSP_ReadMailboxHigh != 0) &&
(g_DSP_ReadMailboxLow != 0) &&
(g_DSP_WriteMailboxHigh != 0) &&
(g_DSP_WriteMailboxLow != 0) &&
(g_DSP_ReadControlRegister != 0) &&
(g_DSP_WriteControlRegister != 0) &&
(g_DSP_Update != 0) &&
(g_DSP_SendAIBuffer != 0)
)
if ((GetDllInfo != 0) &&
(DSP_Initialize != 0) &&
(DSP_Shutdown != 0) &&
(DSP_ReadMailboxHigh != 0) &&
(DSP_ReadMailboxLow != 0) &&
(DSP_WriteMailboxHigh != 0) &&
(DSP_WriteMailboxLow != 0) &&
(DSP_ReadControlRegister != 0) &&
(DSP_WriteControlRegister != 0) &&
(DSP_Update != 0) &&
(DSP_SendAIBuffer != 0) &&
(DSP_DoState != 0))
{
return true;
}
@ -118,115 +108,9 @@ bool LoadPlugin(const char *_Filename)
UnloadPlugin();
return false;
}
}
}
return false;
return false;
}
//
// --- Plugin Functions ---
//
// __________________________________________________________________________________________________
//
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
g_GetDllInfo(_PluginInfo);
}
// __________________________________________________________________________________________________
//
void DllAbout(HWND _hParent)
{
if (g_DllAbout)
g_DllAbout(_hParent);
}
// __________________________________________________________________________________________________
//
void DllConfig(HWND _hParent)
{
if (g_DllConfig)
g_DllConfig(_hParent);
}
// __________________________________________________________________________________________________
//
//
void DllDebugger(HWND _hParent)
{
if (g_DllDebugger)
g_DllDebugger(_hParent);
}
// __________________________________________________________________________________________________
//
void DSP_Initialize(DSPInitialize _dspInitialize)
{
g_DSP_Initialize(_dspInitialize);
}
// __________________________________________________________________________________________________
//
void DSP_Shutdown()
{
g_DSP_Shutdown();
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox)
{
return g_DSP_ReadMailboxHigh(_CPUMailbox ? TRUE : FALSE);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox)
{
return g_DSP_ReadMailboxLow(_CPUMailbox ? TRUE : FALSE);
}
// __________________________________________________________________________________________________
//
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _uHighMail)
{
return g_DSP_WriteMailboxHigh(_CPUMailbox ? TRUE : FALSE, _uHighMail);
}
// __________________________________________________________________________________________________
//
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _uLowMail)
{
return g_DSP_WriteMailboxLow(_CPUMailbox ? TRUE : FALSE, _uLowMail);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_WriteControlRegister(unsigned short _Value)
{
return g_DSP_WriteControlRegister(_Value);
}
// __________________________________________________________________________________________________
//
unsigned short DSP_ReadControlRegister()
{
return g_DSP_ReadControlRegister();
}
// __________________________________________________________________________________________________
//
void DSP_Update(int cycles)
{
g_DSP_Update(cycles);
}
// __________________________________________________________________________________________________
//
void DSP_SendAIBuffer(unsigned int address, int sample_rate)
{
g_DSP_SendAIBuffer(address, sample_rate);
}
}
} // namespace

View File

@ -26,24 +26,37 @@ bool IsLoaded();
bool LoadPlugin(const char *_Filename);
void UnloadPlugin();
//
// --- Plugin Functions ---
//
// Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TDllDebugger)(HWND);
typedef void (__cdecl* TDSP_Initialize)(DSPInitialize);
typedef void (__cdecl* TDSP_Shutdown)();
typedef void (__cdecl* TDSP_WriteMailBox)(BOOL _CPUMailbox, unsigned short);
typedef unsigned short (__cdecl* TDSP_ReadMailBox)(BOOL _CPUMailbox);
typedef unsigned short (__cdecl* TDSP_ReadControlRegister)();
typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short);
typedef void (__cdecl* TDSP_Update)(int cycles);
typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate);
typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode);
void GetDllInfo (PLUGIN_INFO* _PluginInfo) ;
void DllAbout (HWND _hParent);
void DllConfig (HWND _hParent);
void DllDebugger(HWND _hParent);
void DSP_Initialize(DSPInitialize _dspInitialize);
void DSP_Shutdown();
unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox);
unsigned short DSP_ReadMailboxLow(bool _CPUMailbox);
void DSP_WriteMailboxHigh(bool _CPUMailbox, unsigned short _Value);
void DSP_WriteMailboxLow(bool _CPUMailbox, unsigned short _Value);
unsigned short DSP_WriteControlRegister(unsigned short _Flags);
unsigned short DSP_ReadControlRegister();
void DSP_Update(int cycles);
void DSP_SendAIBuffer(unsigned int address, int sample_rate);
// Function Pointers
extern TGetDllInfo GetDllInfo;
extern TDllAbout DllAbout;
extern TDllConfig DllConfig;
extern TDllDebugger DllDebugger;
extern TDSP_Initialize DSP_Initialize;
extern TDSP_Shutdown DSP_Shutdown;
extern TDSP_ReadMailBox DSP_ReadMailboxHigh;
extern TDSP_ReadMailBox DSP_ReadMailboxLow;
extern TDSP_WriteMailBox DSP_WriteMailboxHigh;
extern TDSP_WriteMailBox DSP_WriteMailboxLow;
extern TDSP_ReadControlRegister DSP_ReadControlRegister;
extern TDSP_WriteControlRegister DSP_WriteControlRegister;
extern TDSP_Update DSP_Update;
extern TDSP_SendAIBuffer DSP_SendAIBuffer;
extern TDSP_DoState DSP_DoState;
} // end of namespace PluginDSP

View File

@ -21,28 +21,17 @@
namespace PluginPAD
{
//! Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TPAD_Initialize)(SPADInitialize);
typedef void (__cdecl* TPAD_Shutdown)();
typedef void (__cdecl* TPAD_GetStatus)(BYTE, SPADStatus*);
typedef void (__cdecl* TPAD_Rumble)(BYTE, unsigned int, unsigned int);
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
// Function Pointers
TGetDllInfo GetDllInfo = 0;
TPAD_Shutdown PAD_Shutdown = 0;
TDllAbout DllAbout = 0;
TDllConfig DllConfig = 0;
TPAD_Initialize PAD_Initialize = 0;
TPAD_GetStatus PAD_GetStatus = 0;
TPAD_Rumble PAD_Rumble = 0;
TPAD_GetAttachedPads PAD_GetAttachedPads = 0;
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
TPAD_Shutdown g_PAD_Shutdown = 0;
TDllAbout g_DllAbout = 0;
TDllConfig g_DllConfig = 0;
TPAD_Initialize g_PAD_Initialize = 0;
TPAD_GetStatus g_PAD_GetStatus = 0;
TPAD_Rumble g_PAD_Rumble = 0;
TPAD_GetAttachedPads g_PAD_GetAttachedPads = 0;
//! Library Instance
// Library Instance
DynamicLibrary plugin;
bool IsLoaded()
@ -54,35 +43,35 @@ void UnloadPlugin()
{
plugin.Unload();
// Set Functions to 0
g_GetDllInfo = 0;
g_PAD_Shutdown = 0;
g_DllAbout = 0;
g_DllConfig = 0;
g_PAD_Initialize = 0;
g_PAD_GetStatus = 0;
g_PAD_Rumble = 0;
GetDllInfo = 0;
PAD_Shutdown = 0;
DllAbout = 0;
DllConfig = 0;
PAD_Initialize = 0;
PAD_GetStatus = 0;
PAD_Rumble = 0;
}
bool LoadPlugin(const char *_Filename)
{
if (plugin.Load(_Filename))
{
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_PAD_Initialize= reinterpret_cast<TPAD_Initialize> (plugin.Get("PAD_Initialize"));
g_PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown"));
g_PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus"));
g_PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble"));
g_PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>(plugin.Get("PAD_GetAttachedPads"));
GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
PAD_Initialize = reinterpret_cast<TPAD_Initialize> (plugin.Get("PAD_Initialize"));
PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown"));
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble"));
PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>(plugin.Get("PAD_GetAttachedPads"));
if ((g_GetDllInfo != 0) &&
(g_DllAbout != 0) &&
(g_DllConfig != 0) &&
(g_PAD_Initialize != 0) &&
(g_PAD_Shutdown != 0) &&
(g_PAD_GetStatus != 0))
//(g_PAD_Rumble != 0))
if ((GetDllInfo != 0) &&
(DllAbout != 0) &&
(DllConfig != 0) &&
(PAD_Initialize != 0) &&
(PAD_Shutdown != 0) &&
(PAD_GetStatus != 0))
//(PAD_Rumble != 0))
{
return true;
}
@ -96,52 +85,4 @@ bool LoadPlugin(const char *_Filename)
return false;
}
//
// --- Plugin Functions ---
//
void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{
g_GetDllInfo(_PluginInfo);
}
void PAD_Shutdown()
{
g_PAD_Shutdown();
}
void DllAbout(HWND _hParent)
{
g_DllAbout(_hParent);
}
void DllConfig(HWND _hParent)
{
g_DllConfig(_hParent);
}
void PAD_Initialize(SPADInitialize _PADInitialize)
{
g_PAD_Initialize(_PADInitialize);
}
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus)
{
g_PAD_GetStatus(_numPAD, _pPADStatus);
}
void PAD_Rumble(BYTE _numPAD, unsigned int _iType, unsigned int _iStrength)
{
if (g_PAD_Rumble)
g_PAD_Rumble(_numPAD, _iType, _iStrength);
}
unsigned int PAD_GetAttachedPads()
{
if (g_PAD_GetAttachedPads)
return g_PAD_GetAttachedPads();
return 1;
}
} // end of namespace PluginPAD
} // end of namespace PluginPAD

View File

@ -27,19 +27,25 @@ bool IsLoaded();
bool LoadPlugin(const char * _Filename);
void UnloadPlugin();
//
// --- Plugin Functions ---
//
// Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TPAD_Initialize)(SPADInitialize);
typedef void (__cdecl* TPAD_Shutdown)();
typedef void (__cdecl* TPAD_GetStatus)(BYTE, SPADStatus*);
typedef void (__cdecl* TPAD_Rumble)(BYTE, unsigned int, unsigned int);
typedef unsigned int (__cdecl* TPAD_GetAttachedPads)();
void GetDllInfo(PLUGIN_INFO* _pPluginInfo) ;
void DllAbout(HWND _hParent);
void DllConfig(HWND _hParent);
void PAD_Initialize(SPADInitialize _PADInitialize);
void PAD_Shutdown();
void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus);
void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength);
unsigned int PAD_GetAttachedPads();
unsigned int SaveLoadState(char* _ptr, BOOL save);
// Function Pointers
extern TGetDllInfo GetDllInfo;
extern TPAD_Shutdown PAD_Shutdown;
extern TDllAbout DllAbout;
extern TDllConfig DllConfig;
extern TPAD_Initialize PAD_Initialize;
extern TPAD_GetStatus PAD_GetStatus;
extern TPAD_Rumble PAD_Rumble;
extern TPAD_GetAttachedPads PAD_GetAttachedPads;
} // end of namespace PluginPAD

View File

@ -21,35 +21,21 @@
namespace PluginVideo
{
//! Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*);
typedef void (__cdecl* TVideo_Prepare)();
typedef void (__cdecl* TVideo_Shutdown)();
typedef void (__cdecl* TVideo_SendFifoData)(BYTE*);
typedef void (__cdecl* TVideo_UpdateXFB)(BYTE*, DWORD, DWORD);
typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*);
typedef void (__cdecl* TVideo_EnterLoop)();
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode);
// Function Pointer
TGetDllInfo GetDllInfo = 0;
TDllAbout DllAbout = 0;
TDllConfig DllConfig = 0;
TVideo_Initialize Video_Initialize = 0;
TVideo_Prepare Video_Prepare = 0;
TVideo_Shutdown Video_Shutdown = 0;
TVideo_SendFifoData Video_SendFifoData = 0;
TVideo_UpdateXFB Video_UpdateXFB = 0;
TVideo_Screenshot Video_Screenshot = 0;
TVideo_EnterLoop Video_EnterLoop = 0;
TVideo_AddMessage Video_AddMessage = 0;
TVideo_DoState Video_DoState = 0;
//! Function Pointer
TGetDllInfo g_GetDllInfo = 0;
TDllAbout g_DllAbout = 0;
TDllConfig g_DllConfig = 0;
TVideo_Initialize g_Video_Initialize = 0;
TVideo_Prepare g_Video_Prepare = 0;
TVideo_Shutdown g_Video_Shutdown = 0;
TVideo_SendFifoData g_Video_SendFifoData = 0;
TVideo_UpdateXFB g_Video_UpdateXFB = 0;
TVideo_Screenshot g_Video_Screenshot = 0;
TVideo_EnterLoop g_Video_EnterLoop = 0;
TVideo_AddMessage g_Video_AddMessage = 0;
TVideo_DoState g_Video_DoState = 0;
//! Library Instance
// Library Instance
DynamicLibrary plugin;
bool IsLoaded()
@ -60,16 +46,16 @@ bool IsLoaded()
void UnloadPlugin()
{
// set Functions to 0
g_GetDllInfo = 0;
g_DllAbout = 0;
g_DllConfig = 0;
g_Video_Initialize = 0;
g_Video_Prepare = 0;
g_Video_Shutdown = 0;
g_Video_SendFifoData = 0;
g_Video_UpdateXFB = 0;
g_Video_AddMessage = 0;
g_Video_DoState = 0;
GetDllInfo = 0;
DllAbout = 0;
DllConfig = 0;
Video_Initialize = 0;
Video_Prepare = 0;
Video_Shutdown = 0;
Video_SendFifoData = 0;
Video_UpdateXFB = 0;
Video_AddMessage = 0;
Video_DoState = 0;
plugin.Unload();
}
@ -78,31 +64,30 @@ bool LoadPlugin(const char *_Filename)
{
if (plugin.Load(_Filename))
{
g_GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
g_DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
g_DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
g_Video_Initialize = reinterpret_cast<TVideo_Initialize> (plugin.Get("Video_Initialize"));
g_Video_Prepare = reinterpret_cast<TVideo_Prepare> (plugin.Get("Video_Prepare"));
g_Video_Shutdown = reinterpret_cast<TVideo_Shutdown> (plugin.Get("Video_Shutdown"));
g_Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData> (plugin.Get("Video_SendFifoData"));
g_Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB> (plugin.Get("Video_UpdateXFB"));
g_Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot"));
g_Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop"));
g_Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage"));
g_Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState"));
if ((g_GetDllInfo != 0) &&
(g_DllAbout != 0) &&
(g_DllConfig != 0) &&
(g_Video_Initialize != 0) &&
(g_Video_Prepare != 0) &&
(g_Video_Shutdown != 0) &&
(g_Video_SendFifoData != 0) &&
(g_Video_UpdateXFB != 0) &&
(g_Video_EnterLoop != 0) &&
(g_Video_Screenshot != 0) &&
(g_Video_AddMessage != 0) &&
(g_Video_DoState != 0) )
GetDllInfo = reinterpret_cast<TGetDllInfo> (plugin.Get("GetDllInfo"));
DllAbout = reinterpret_cast<TDllAbout> (plugin.Get("DllAbout"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
Video_Initialize = reinterpret_cast<TVideo_Initialize> (plugin.Get("Video_Initialize"));
Video_Prepare = reinterpret_cast<TVideo_Prepare> (plugin.Get("Video_Prepare"));
Video_Shutdown = reinterpret_cast<TVideo_Shutdown> (plugin.Get("Video_Shutdown"));
Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData> (plugin.Get("Video_SendFifoData"));
Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB> (plugin.Get("Video_UpdateXFB"));
Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot"));
Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop"));
Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage"));
Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState"));
if ((GetDllInfo != 0) &&
(DllAbout != 0) &&
(DllConfig != 0) &&
(Video_Initialize != 0) &&
(Video_Prepare != 0) &&
(Video_Shutdown != 0) &&
(Video_SendFifoData != 0) &&
(Video_UpdateXFB != 0) &&
(Video_EnterLoop != 0) &&
(Video_Screenshot != 0) &&
(Video_AddMessage != 0) &&
(Video_DoState != 0) )
{
return true;
}
@ -115,67 +100,5 @@ bool LoadPlugin(const char *_Filename)
return false;
}
//
// --- Plugin Functions ---
//
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{
g_GetDllInfo(_PluginInfo);
}
void DllAbout (HWND _hParent)
{
g_DllAbout(_hParent);
}
void DllConfig (HWND _hParent)
{
g_DllConfig(_hParent);
}
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
{
g_Video_Initialize(_pVideoInitialize);
}
void Video_Prepare()
{
g_Video_Prepare();
}
void Video_Shutdown()
{
g_Video_Shutdown();
}
void Video_SendFifoData(BYTE *_uData)
{
g_Video_SendFifoData(_uData);
}
void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwHeight, DWORD _dwWidth)
{
g_Video_UpdateXFB(_pXFB, _dwHeight, _dwWidth);
}
bool Video_Screenshot(TCHAR* _szFilename)
{
return ((g_Video_Screenshot(_szFilename) == TRUE) ? true : false);
}
void Video_EnterLoop()
{
g_Video_EnterLoop();
}
void Video_AddMessage(const char* pstr, unsigned int milliseconds)
{
g_Video_AddMessage(pstr,milliseconds);
}
void Video_DoState(unsigned char **ptr, int mode) {
g_Video_DoState(ptr, mode);
}
} // end of namespace PluginVideo
} // namespace

View File

@ -28,23 +28,33 @@ bool IsLoaded();
bool LoadPlugin(const char *_Filename);
void UnloadPlugin();
//
// --- Plugin Functions ---
//
// Function Types
typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*);
typedef void (__cdecl* TDllAbout)(HWND);
typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*);
typedef void (__cdecl* TVideo_Prepare)();
typedef void (__cdecl* TVideo_Shutdown)();
typedef void (__cdecl* TVideo_SendFifoData)(BYTE*);
typedef void (__cdecl* TVideo_UpdateXFB)(BYTE*, DWORD, DWORD);
typedef BOOL (__cdecl* TVideo_Screenshot)(TCHAR*);
typedef void (__cdecl* TVideo_EnterLoop)();
typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds);
typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode);
void GetDllInfo(PLUGIN_INFO* _pluginInfo);
void DllAbout(HWND _hParent);
void DllConfig(HWND _hParent);
void Video_Initialize(SVideoInitialize* _pvideoInitialize);
void Video_Prepare();
void Video_Shutdown();
void Video_EnterLoop();
void Video_SendFifoData(BYTE *_uData);
void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwHeight, DWORD _dwWidth);
bool Video_Screenshot(TCHAR* _szFilename);
void Video_AddMessage(const char* pstr, unsigned int milliseconds);
void Video_DoState(unsigned char **ptr, int mode);
// Function Pointers
extern TGetDllInfo GetDllInfo;
extern TDllAbout DllAbout;
extern TDllConfig DllConfig;
extern TVideo_Initialize Video_Initialize;
extern TVideo_Prepare Video_Prepare;
extern TVideo_Shutdown Video_Shutdown;
extern TVideo_SendFifoData Video_SendFifoData;
extern TVideo_UpdateXFB Video_UpdateXFB;
extern TVideo_Screenshot Video_Screenshot;
extern TVideo_EnterLoop Video_EnterLoop;
extern TVideo_AddMessage Video_AddMessage;
extern TVideo_DoState Video_DoState;
} // end of namespace PluginVideo

View File

@ -19,6 +19,7 @@
#include "State.h"
#include "Core.h"
#include "StringUtil.h"
#include "CoreTiming.h"
#include "HW/HW.h"
#include "PowerPC/PowerPC.h"
@ -40,6 +41,7 @@ void DoState(PointerWrap &p)
{
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM
PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode());
PluginDSP::DSP_DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p);
HW::DoState(p);
CoreTiming::DoState(p);
@ -99,14 +101,18 @@ void State_Shutdown()
// nothing to do, here for consistency.
}
std::string GetStateFilename(int state_number) {
return StringFromFormat("StateSaves/%s.s%02i", Core::GetStartupParameter().GetUniqueID().c_str(), state_number);
}
void State_Save(const char *filename)
{
cur_filename = filename;
cur_filename = GetStateFilename(0);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Save);
}
void State_Load(const char *filename)
{
cur_filename = filename;
cur_filename = GetStateFilename(0);
CoreTiming::ScheduleEvent_Threadsafe(0, ev_Load);
}