From 85565688d7391d9e583dbb073ae7220bd5b1b911 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sat, 30 Aug 2008 19:19:40 +0000 Subject: [PATCH] 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 --- Source/Core/Core/Src/Core.cpp | 9 +- Source/Core/Core/Src/Plugins/Plugin_DSP.cpp | 246 +++++------------- Source/Core/Core/Src/Plugins/Plugin_DSP.h | 47 ++-- Source/Core/Core/Src/Plugins/Plugin_PAD.cpp | 125 +++------ Source/Core/Core/Src/Plugins/Plugin_PAD.h | 30 ++- Source/Core/Core/Src/Plugins/Plugin_Video.cpp | 175 ++++--------- Source/Core/Core/Src/Plugins/Plugin_Video.h | 42 +-- Source/Core/Core/Src/State.cpp | 10 +- Source/Core/DiscIO/Src/Blob.cpp | 9 +- .../Core/VideoCommon/Src/TextureDecoder.cpp | 5 +- Source/PluginSpecs/pluginspecs_dsp.h | 2 +- Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 47 ++-- Source/Plugins/Plugin_DSP_LLE/Src/Globals.h | 1 + Source/Plugins/Plugin_DSP_LLE/Src/main.cpp | 2 + Source/Plugins/Plugin_PadDX9/Src/main.cpp | 8 - Source/Plugins/Plugin_PadSimple/Src/main.cpp | 7 - .../Plugins/Plugin_VideoDX9/Src/BPStructs.cpp | 25 +- .../Plugins/Plugin_VideoDX9/Src/BPStructs.h | 1 - .../Plugins/Plugin_VideoDX9/Src/CPStructs.cpp | 20 -- .../Plugins/Plugin_VideoDX9/Src/CPStructs.h | 1 - Source/Plugins/Plugin_VideoDX9/Src/Globals.h | 64 ++--- .../Plugin_VideoDX9/Src/OpcodeDecoding.cpp | 19 +- .../Plugin_VideoDX9/Src/TransformEngine.cpp | 11 +- .../Plugin_VideoDX9/Src/TransformEngine.h | 1 - .../Plugins/Plugin_VideoDX9/Src/XFStructs.cpp | 29 +-- .../Plugins/Plugin_VideoDX9/Src/XFStructs.h | 1 - .../Plugins/Plugin_VideoOGL/Src/BPStructs.cpp | 13 - .../Plugins/Plugin_VideoOGL/Src/BPStructs.h | 1 - Source/Plugins/Plugin_VideoOGL/Src/Globals.h | 4 - .../Plugin_VideoOGL/Src/OpcodeDecoding.cpp | 16 +- .../Plugin_VideoOGL/Src/VertexLoader.cpp | 9 - .../Plugin_VideoOGL/Src/VertexLoader.h | 1 - .../Src/VertexShaderManager.cpp | 19 -- .../Plugin_VideoOGL/Src/VertexShaderManager.h | 1 - 34 files changed, 329 insertions(+), 672 deletions(-) diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 516ad809c3..63983dac52 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -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; } diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp b/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp index a264374166..7fbee7cc95 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp @@ -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 (plugin.Get("GetDllInfo")); - g_DllAbout = reinterpret_cast (plugin.Get("DllAbout")); - g_DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - g_DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); - g_DSP_Initialize = reinterpret_cast (plugin.Get("DSP_Initialize")); - g_DSP_Shutdown = reinterpret_cast (plugin.Get("DSP_Shutdown")); - g_DSP_ReadMailboxHigh = reinterpret_cast (plugin.Get("DSP_ReadMailboxHigh")); - g_DSP_ReadMailboxLow = reinterpret_cast (plugin.Get("DSP_ReadMailboxLow")); - g_DSP_WriteMailboxHigh = reinterpret_cast (plugin.Get("DSP_WriteMailboxHigh")); - g_DSP_WriteMailboxLow = reinterpret_cast (plugin.Get("DSP_WriteMailboxLow")); - g_DSP_ReadControlRegister = reinterpret_cast (plugin.Get("DSP_ReadControlRegister")); - g_DSP_WriteControlRegister = reinterpret_cast (plugin.Get("DSP_WriteControlRegister")); - g_DSP_Update = reinterpret_cast (plugin.Get("DSP_Update")); - g_DSP_SendAIBuffer = reinterpret_cast (plugin.Get("DSP_SendAIBuffer")); + if (plugin.Load(_Filename)) + { + GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + DllAbout = reinterpret_cast (plugin.Get("DllAbout")); + DllConfig = reinterpret_cast (plugin.Get("DllConfig")); + DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); + DSP_Initialize = reinterpret_cast (plugin.Get("DSP_Initialize")); + DSP_Shutdown = reinterpret_cast (plugin.Get("DSP_Shutdown")); + DSP_ReadMailboxHigh = reinterpret_cast (plugin.Get("DSP_ReadMailboxHigh")); + DSP_ReadMailboxLow = reinterpret_cast (plugin.Get("DSP_ReadMailboxLow")); + DSP_WriteMailboxHigh = reinterpret_cast (plugin.Get("DSP_WriteMailboxHigh")); + DSP_WriteMailboxLow = reinterpret_cast (plugin.Get("DSP_WriteMailboxLow")); + DSP_ReadControlRegister = reinterpret_cast (plugin.Get("DSP_ReadControlRegister")); + DSP_WriteControlRegister = reinterpret_cast (plugin.Get("DSP_WriteControlRegister")); + DSP_Update = reinterpret_cast (plugin.Get("DSP_Update")); + DSP_SendAIBuffer = reinterpret_cast (plugin.Get("DSP_SendAIBuffer")); + DSP_DoState = reinterpret_cast (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 diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.h b/Source/Core/Core/Src/Plugins/Plugin_DSP.h index 21427e984e..9d8d9c1ffc 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.h +++ b/Source/Core/Core/Src/Plugins/Plugin_DSP.h @@ -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 diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp index e1265291df..e187c23631 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp @@ -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 (plugin.Get("GetDllInfo")); - g_DllAbout = reinterpret_cast (plugin.Get("DllAbout")); - g_DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - g_PAD_Initialize= reinterpret_cast (plugin.Get("PAD_Initialize")); - g_PAD_Shutdown = reinterpret_cast (plugin.Get("PAD_Shutdown")); - g_PAD_GetStatus = reinterpret_cast (plugin.Get("PAD_GetStatus")); - g_PAD_Rumble = reinterpret_cast (plugin.Get("PAD_Rumble")); - g_PAD_GetAttachedPads = reinterpret_cast(plugin.Get("PAD_GetAttachedPads")); + GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + DllAbout = reinterpret_cast (plugin.Get("DllAbout")); + DllConfig = reinterpret_cast (plugin.Get("DllConfig")); + PAD_Initialize = reinterpret_cast (plugin.Get("PAD_Initialize")); + PAD_Shutdown = reinterpret_cast (plugin.Get("PAD_Shutdown")); + PAD_GetStatus = reinterpret_cast (plugin.Get("PAD_GetStatus")); + PAD_Rumble = reinterpret_cast (plugin.Get("PAD_Rumble")); + PAD_GetAttachedPads = reinterpret_cast(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 diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.h b/Source/Core/Core/Src/Plugins/Plugin_PAD.h index ee6c1340b1..cb55a79b73 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.h +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.h @@ -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 diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp b/Source/Core/Core/Src/Plugins/Plugin_Video.cpp index 0d265f693b..d701e31b86 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_Video.cpp @@ -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 (plugin.Get("GetDllInfo")); - g_DllAbout = reinterpret_cast (plugin.Get("DllAbout")); - g_DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - g_Video_Initialize = reinterpret_cast (plugin.Get("Video_Initialize")); - g_Video_Prepare = reinterpret_cast (plugin.Get("Video_Prepare")); - g_Video_Shutdown = reinterpret_cast (plugin.Get("Video_Shutdown")); - g_Video_SendFifoData = reinterpret_cast (plugin.Get("Video_SendFifoData")); - g_Video_UpdateXFB = reinterpret_cast (plugin.Get("Video_UpdateXFB")); - g_Video_Screenshot = reinterpret_cast (plugin.Get("Video_Screenshot")); - g_Video_EnterLoop = reinterpret_cast (plugin.Get("Video_EnterLoop")); - g_Video_AddMessage = reinterpret_cast (plugin.Get("Video_AddMessage")); - g_Video_DoState = reinterpret_cast (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 (plugin.Get("GetDllInfo")); + DllAbout = reinterpret_cast (plugin.Get("DllAbout")); + DllConfig = reinterpret_cast (plugin.Get("DllConfig")); + Video_Initialize = reinterpret_cast (plugin.Get("Video_Initialize")); + Video_Prepare = reinterpret_cast (plugin.Get("Video_Prepare")); + Video_Shutdown = reinterpret_cast (plugin.Get("Video_Shutdown")); + Video_SendFifoData = reinterpret_cast (plugin.Get("Video_SendFifoData")); + Video_UpdateXFB = reinterpret_cast (plugin.Get("Video_UpdateXFB")); + Video_Screenshot = reinterpret_cast (plugin.Get("Video_Screenshot")); + Video_EnterLoop = reinterpret_cast (plugin.Get("Video_EnterLoop")); + Video_AddMessage = reinterpret_cast (plugin.Get("Video_AddMessage")); + Video_DoState = reinterpret_cast (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 diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.h b/Source/Core/Core/Src/Plugins/Plugin_Video.h index d904a194e6..b74daf8237 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.h +++ b/Source/Core/Core/Src/Plugins/Plugin_Video.h @@ -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 diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 2e26c4a5a9..ef811bac8f 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -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); } diff --git a/Source/Core/DiscIO/Src/Blob.cpp b/Source/Core/DiscIO/Src/Blob.cpp index 3f895557dc..ef198f43d6 100644 --- a/Source/Core/DiscIO/Src/Blob.cpp +++ b/Source/Core/DiscIO/Src/Blob.cpp @@ -67,13 +67,9 @@ class PlainFileReader CloseHandle(hFile); } - u64 GetDataSize() const {return(size);} - - u64 GetRawSize() const {return(size);} - bool Read(u64 offset, u64 size, u8* out_ptr) { LONG offset_high = (LONG)(offset >> 32); @@ -99,8 +95,7 @@ class PlainFileReader #else // linux, 64-bit. We do not yet care about linux32 // Not optimal - will keep recreating mappings. -class PlainFileReader - : public IBlobReader +class PlainFileReader : public IBlobReader { FILE* file_; s64 size; @@ -157,8 +152,6 @@ class PlainFileReader }; #endif - - class CompressedBlobReader : public IBlobReader { diff --git a/Source/Core/VideoCommon/Src/TextureDecoder.cpp b/Source/Core/VideoCommon/Src/TextureDecoder.cpp index 2652b6f3b3..1dd2c371fc 100644 --- a/Source/Core/VideoCommon/Src/TextureDecoder.cpp +++ b/Source/Core/VideoCommon/Src/TextureDecoder.cpp @@ -135,7 +135,7 @@ struct DXTBlock inline int expand8888(const int j) { int i = j | (j<<8); - return i|(i<<16); + return i | (i<<16); } inline void decodebytesI4(u32 *dst, const u8 *src, int numbytes) @@ -150,7 +150,8 @@ inline void decodebytesI4(u32 *dst, const u8 *src, int numbytes) inline void decodebytesI8(u32 *dst, const u8 *src, int numbytes) { - for (int x = 0; x < numbytes; x++) + // TODO: SSSE3 variant (pshufb), possibly SSE2 variant (packuswb). THP videos use this format. + for (int x = 0; x < numbytes; x++) *dst++ = expand8888(src[x]); } diff --git a/Source/PluginSpecs/pluginspecs_dsp.h b/Source/PluginSpecs/pluginspecs_dsp.h index 1644ba868c..b0b8ee8c57 100644 --- a/Source/PluginSpecs/pluginspecs_dsp.h +++ b/Source/PluginSpecs/pluginspecs_dsp.h @@ -160,7 +160,7 @@ EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate); // input/output: ptr // input: mode // -EXPORT void CALL PAD_DoState(void *ptr, int mode); +EXPORT void CALL DSP_DoState(unsigned char **ptr, int mode); #include "ExportEpilog.h" #endif diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 00a2d8d7cd..e637cc2136 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -17,6 +17,7 @@ #include "Common.h" #include "Globals.h" +#include "ChunkFile.h" #include "resource.h" #ifdef _WIN32 @@ -35,6 +36,29 @@ DSPInitialize g_dspInitialize; u8* g_pMemory; +struct DSPState +{ + u32 CPUMailbox; + bool CPUMailbox_Written[2]; + + u32 DSPMailbox; + bool DSPMailbox_Read[2]; + + DSPState() + { + CPUMailbox = 0x00000000; + CPUMailbox_Written[0] = false; + CPUMailbox_Written[1] = false; + + DSPMailbox = 0x00000000; + DSPMailbox_Read[0] = true; + DSPMailbox_Read[1] = true; + } +}; + +DSPState g_dspState; + + #ifdef _WIN32 HINSTANCE g_hInstance = NULL; @@ -116,26 +140,9 @@ void DSP_Shutdown() CDSPHandler::Destroy(); } -struct DSPState -{ - u32 CPUMailbox; - bool CPUMailbox_Written[2]; - - u32 DSPMailbox; - bool DSPMailbox_Read[2]; - - DSPState() - { - CPUMailbox = 0x00000000; - CPUMailbox_Written[0] = false; - CPUMailbox_Written[1] = false; - - DSPMailbox = 0x00000000; - DSPMailbox_Read[0] = true; - DSPMailbox_Read[1] = true; - } -}; -DSPState g_dspState; +void DSP_DoState(unsigned char **ptr, int mode) { + PointerWrap p(ptr, mode); +} unsigned short DSP_ReadMailboxHigh(bool _CPUMailbox) { diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h b/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h index 9f0fa43ba7..563b52ba03 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h +++ b/Source/Plugins/Plugin_DSP_LLE/Src/Globals.h @@ -20,6 +20,7 @@ #include "pluginspecs_dsp.h" #include + #define WITH_DSP_ON_THREAD 1 #define DUMP_DSP_IMEM 0 diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index 7a84e0e150..98221d9e7e 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -41,6 +41,8 @@ CDisAsmDlg g_Dialog; pthread_t g_hDSPThread = NULL; #endif +#include "ChunkFile.h" + DSPInitialize g_dspInitialize; #define GDSP_MBOX_CPU 0 diff --git a/Source/Plugins/Plugin_PadDX9/Src/main.cpp b/Source/Plugins/Plugin_PadDX9/Src/main.cpp index 9e8ef3cf58..16ac6345e0 100644 --- a/Source/Plugins/Plugin_PadDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_PadDX9/Src/main.cpp @@ -190,11 +190,3 @@ void PAD_GetStatus(BYTE _numPAD, SPADStatus* _pPADStatus) void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) { } - -// __________________________________________________________________________________________________ -// SaveLoadState -// -unsigned __int32 SaveLoadState(char* _ptr, BOOL _bSave) -{ - return 0; -} \ No newline at end of file diff --git a/Source/Plugins/Plugin_PadSimple/Src/main.cpp b/Source/Plugins/Plugin_PadSimple/Src/main.cpp index 7ee3017cc9..cb8536a0cc 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/main.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/main.cpp @@ -598,13 +598,6 @@ void PAD_Rumble(BYTE _numPAD, unsigned int _uType, unsigned int _uStrength) #endif } - -unsigned int SaveLoadState(char* _ptr, BOOL _bSave) -{ - return(0); -} - - void LoadConfig() { #ifdef _WIN32 diff --git a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp index e818e20c1c..594413c2b5 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.cpp @@ -526,13 +526,13 @@ void BPWritten(int addr, int changes, int newval) CVertexHandler::Flush(); ((u32*)&bpmem)[addr] = newval; static int lastRGBA[2][4] = { - {0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE}, - {0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE,0xEEEEEEEE} + {0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE}, + {0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE} }; //Terrible hack //The reason is that there are two sets of registers //overloaded here... - int num=(addr>>1)&0x3; + int num = (addr >> 1) & 0x3; int type = bpmem.tevregs[num].high.type; int colorbase = type ? PS_CONST_KCOLORS : PS_CONST_COLORS; int r=bpmem.tevregs[num].low.a, a=bpmem.tevregs[num].low.b; @@ -543,9 +543,9 @@ void BPWritten(int addr, int changes, int newval) CVertexHandler::Flush(); lastRGBA[type][num] = rgba; float temp[4] = { - r/255.0f,g/255.0f,b/255.0f,a/255.0f + r/255.0f, g/255.0f, b/255.0f, a/255.0f }; - D3D::dev->SetPixelShaderConstantF(colorbase+num,temp,1); + D3D::dev->SetPixelShaderConstantF(colorbase + num, temp, 1); } } } @@ -726,21 +726,6 @@ void BPReload() BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]); } - -size_t BPSaveLoadState(char *ptr, BOOL save) -{ - /* - BEGINSAVELOAD; - SAVELOAD(&bpmem,sizeof(BPMemory)); - if (!save) - BPReload(); - char temp[256]; - sprintf(temp,"MOJS %08x",(bpmem.clearcolorAR<<16)|(bpmem.clearcolorGB)); - g_VideoInitialize.pLog(temp, FALSE); - ENDSAVELOAD;*/ - return 0; -} - void ActivateTextures() { for (int i = 0; i < 8; i++) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h index 476d55ef3b..d2f754f73a 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/BPStructs.h @@ -6,7 +6,6 @@ #include "BPMemory.h" void BPInit(); -size_t BPSaveLoadState(char *ptr, BOOL save); //bool BPWritten(int addr, int changes); void LoadBPReg(u32 value0); void ActivateTextures(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp index 5d0b6682cb..095100437b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.cpp @@ -53,23 +53,3 @@ void LoadCPReg(u32 SubCmd, u32 Value) case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break; } } - - -#define BEGINSAVELOAD char *optr=ptr; -#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size); -#define ENDSAVELOAD return ptr-optr; - -size_t CPSaveLoadState(char *ptr, BOOL save) -{ - BEGINSAVELOAD; - SAVELOAD(arraybases, 16 * sizeof(u32)); - SAVELOAD(arraystrides, 16 * sizeof(u32)); - SAVELOAD(&MatrixIndexA, sizeof(TMatrixIndexA)); - SAVELOAD(&MatrixIndexB, sizeof(TMatrixIndexB)); - if (!save) - { - CPUpdateMatricesA(); - CPUpdateMatricesB(); - } - ENDSAVELOAD; -} \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h index cb3e669d1f..fd279e5043 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/CPStructs.h @@ -7,7 +7,6 @@ void CPUpdateMatricesA(); void CPUpdateMatricesB(); -size_t CPSaveLoadState(char *ptr, BOOL save); void LoadCPReg(u32 SubCmd, u32 Value); #endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Globals.h b/Source/Plugins/Plugin_VideoDX9/Src/Globals.h index 0b95eb7ea8..3493a54478 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Globals.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/Globals.h @@ -51,42 +51,44 @@ extern Config g_Config; struct Statistics { - int numPrimitives; + int numPrimitives; - int numPixelShadersCreated; - int numPixelShadersAlive; - int numVertexShadersCreated; - int numVertexShadersAlive; + int numPixelShadersCreated; + int numPixelShadersAlive; + int numVertexShadersCreated; + int numVertexShadersAlive; - int numTexturesCreated; - int numTexturesAlive; + int numTexturesCreated; + int numTexturesAlive; - int numRenderTargetsCreated; - int numRenderTargetsAlive; - - int numDListsCalled; - int numDListsCreated; - int numDListsAlive; + int numRenderTargetsCreated; + int numRenderTargetsAlive; + + int numDListsCalled; + int numDListsCreated; + int numDListsAlive; - int numJoins; + int numJoins; - struct ThisFrame - { - int numBPLoads; - int numCPLoads; - int numXFLoads; - - int numBPLoadsInDL; - int numCPLoadsInDL; - int numXFLoadsInDL; - - int numDLs; - int numDLPrims; - int numPrims; - int numShaderChanges; - int numBadCommands; //hope this always is zero ;) - }; - ThisFrame thisFrame; + struct ThisFrame + { + int numBPLoads; + int numCPLoads; + int numXFLoads; + + int numBPLoadsInDL; + int numCPLoadsInDL; + int numXFLoadsInDL; + + int numDLs; + int numDLPrims; + int numPrims; + int numShaderChanges; + int numBadCommands; //hope this always is zero ;) + + int numDListsCalled; + }; + ThisFrame thisFrame; void ResetFrame() {memset(&thisFrame,0,sizeof(ThisFrame));} }; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp index d9bdc337da..e078a7b453 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/OpcodeDecoding.cpp @@ -55,23 +55,24 @@ void ExecuteDisplayList(u32 address, u32 size) g_pDataReader = &memoryReader; // temporarily swap dl and non-dl(small "hack" for the stats) - Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); - Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); - Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); - Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); + Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); + Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); + Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); + Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); while((memoryReader.GetReadAddress() - address) < size) { Decode(); } + INCSTAT(stats.numDListsCalled); + INCSTAT(stats.thisFrame.numDListsCalled); // un-swap - Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); - Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); - Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); - Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); + Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); + Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); + Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); + Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); - INCSTAT(stats.numDListsCalled); // reset to the old reader g_pDataReader = pOldReader; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.cpp index ee8cc62249..adf835fa1b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.cpp @@ -16,15 +16,6 @@ float *CTransformEngine::m_pNormalMatrix; float *CTransformEngine::m_pTexMatrix[8]; float *CTransformEngine::m_pTexPostMatrix[8]; -size_t CTransformEngine::SaveLoadState(char *ptr, bool save) -{ -// BEGINSAVELOAD; -// SAVELOAD(m_VtxAttribTable,sizeof(m_VtxAttribTable)); -// SAVELOAD(&m_VtxDesc,sizeof(TVtxDesc)); -// ENDSAVELOAD; - return 0; -} - const Light *GetLight(int i) { return (const Light *)(xfmem + XFMEM_LIGHTS) + i; @@ -345,4 +336,4 @@ void CTransformEngine::TransformVertices(int _numVertices, const DecodedVArray * vbuffer[i].uv[j].w = TempUVs[j].z; } } -} \ No newline at end of file +} diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h index 9139812b2a..70ecad9e43 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TransformEngine.h @@ -16,7 +16,6 @@ class CTransformEngine static float* m_pTexPostMatrix[8]; public: - static size_t SaveLoadState(char *ptr, bool save); static void TransformVertices(int _numVertices, const DecodedVArray *varray, D3DVertex *vbuffer); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp index 7a26cf7883..161380a014 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.cpp @@ -8,13 +8,7 @@ float rawViewPort[6]; float rawProjection[7]; -#define BEGINSAVELOAD char *optr=ptr; -#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size); -#define ENDSAVELOAD return ptr-optr; - -// __________________________________________________________________________________________________ // LoadXFReg 0x10 -// void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) { DVSTARTPROFILE(); @@ -30,7 +24,7 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) memcpy(p1, &pData[i], transferSize*4); i += transferSize; } - else if (address<0x2000) + else if (address < 0x2000) { u32 data = pData[i]; switch (address) @@ -120,25 +114,8 @@ void XFUpdateVP() { Renderer::SetViewport(rawViewPort); } + void XFUpdatePJ() { - Renderer::SetProjection(rawProjection,0); + Renderer::SetProjection(rawProjection, 0); } - -size_t XFSaveLoadState(char *ptr, BOOL save) -{ - BEGINSAVELOAD; - SAVELOAD(xfregs.colChans,2*sizeof(ColorChannel)); - SAVELOAD(xfregs.texcoords,16*sizeof(TexCoordInfo)); - SAVELOAD(rawViewPort,sizeof(rawViewPort)); - SAVELOAD(rawProjection,sizeof(rawProjection)); - SAVELOAD(xfmem,XFMEM_SIZE*sizeof(u32)); - - if (!save) - { - XFUpdateVP(); - XFUpdatePJ(); - } - - ENDSAVELOAD; -} \ No newline at end of file diff --git a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h index c00836b0d2..fcd83b8224 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/XFStructs.h @@ -8,7 +8,6 @@ extern float rawViewPort[6]; extern float rawProjection[7]; -size_t XFSaveLoadState(char *ptr, BOOL save); void XFUpdateVP(); void XFUpdatePJ(); void LoadXFReg(u32 transferSize, u32 address, u32 *pData); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp index 62f07fd4d5..f19eac6387 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.cpp @@ -719,16 +719,3 @@ void BPReload() for (int i=0; i<254; i++) BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]); } - - -size_t BPSaveLoadState(char *ptr, BOOL save) -{ - BEGINSAVELOAD; - SAVELOAD(&bpmem,sizeof(BPMemory)); - if (!save) - BPReload(); - //char temp[256]; - //sprintf(temp,"MOJS %08x",(bpmem.clearcolorAR<<16)|(bpmem.clearcolorGB)); - //g_VideoInitialize.pLog(temp, FALSE); - ENDSAVELOAD; -} diff --git a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h index 6cbb53bb90..6b1273db39 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/BPStructs.h @@ -21,7 +21,6 @@ #include "BPMemory.h" void BPInit(); -size_t BPSaveLoadState(char *ptr, BOOL save); //bool BPWritten(int addr, int changes); void LoadBPReg(u32 value0); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h index 1271868a34..5fba86cd02 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Globals.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Globals.h @@ -111,10 +111,6 @@ extern float MValueX, MValueY; #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif -#define BEGINSAVELOAD char *optr=ptr; -#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size); -#define ENDSAVELOAD return ptr-optr; - extern int frameCount; #define CONF_LOG 1 diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp index 9ef9f03b53..5abdd35a2c 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OpcodeDecoding.cpp @@ -60,10 +60,10 @@ void ExecuteDisplayList(u32 address, u32 size) g_pDataReader = &memoryReader; // temporarily swap dl and non-dl(small "hack" for the stats) - Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); - Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); - Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); - Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); + Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); + Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); + Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); + Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); while((memoryReader.GetReadAddress() - address) < size) { @@ -73,10 +73,10 @@ void ExecuteDisplayList(u32 address, u32 size) INCSTAT(stats.thisFrame.numDListsCalled); // un-swap - Xchg(stats.thisFrame.numDLPrims,stats.thisFrame.numPrims); - Xchg(stats.thisFrame.numXFLoadsInDL,stats.thisFrame.numXFLoads); - Xchg(stats.thisFrame.numCPLoadsInDL,stats.thisFrame.numCPLoads); - Xchg(stats.thisFrame.numBPLoadsInDL,stats.thisFrame.numBPLoads); + Xchg(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); + Xchg(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); + Xchg(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); + Xchg(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); // reset to the old reader g_pDataReader = pOldReader; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp index 1cf5224d1d..7d1cd5413e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.cpp @@ -1151,12 +1151,3 @@ void VertexManager::LoadCPReg(u32 SubCmd, u32 Value) case 0xB0: arraystrides[SubCmd & 0xF] = Value & 0xFF; break; } } - -size_t VertexManager::SaveLoadState(char *ptr, BOOL save) -{ - BEGINSAVELOAD; - SAVELOAD(arraybases,16*sizeof(u32)); - SAVELOAD(arraystrides,16*sizeof(u32)); - ENDSAVELOAD; -} - diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h index 34232f4428..85f7eba4f0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexLoader.h @@ -213,7 +213,6 @@ public: static TVtxDesc &GetVtxDesc() {return s_GlobalVtxDesc; } static void LoadCPReg(u32 SubCmd, u32 Value); - static size_t SaveLoadState(char *ptr, BOOL save); static u8* s_pCurBufferPointer; static float shiftLookup[32]; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp index bf70f9fed9..589035da75 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.cpp @@ -496,25 +496,6 @@ void VertexShaderMngr::SetProjection(float* _pProjection, int constantIndex) bProjectionChanged = true; } -size_t VertexShaderMngr::SaveLoadState(char *ptr, BOOL save) -{ - BEGINSAVELOAD; - - SAVELOAD(&xfregs,sizeof(xfregs)); - SAVELOAD(xfmem,XFMEM_SIZE*sizeof(u32)); - SAVELOAD(rawViewport,sizeof(rawViewport)); - SAVELOAD(rawProjection,sizeof(rawProjection)); - SAVELOAD(&MatrixIndexA,sizeof(TMatrixIndexA)); - SAVELOAD(&MatrixIndexB,sizeof(TMatrixIndexB)); - - if (!save) { - // invalidate all - InvalidateXFRange(0,0x1000); - } - - ENDSAVELOAD; -} - // LoadXFReg 0x10 void VertexShaderMngr::LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData) { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h index 017c719582..831c1fd1c2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/VertexShaderManager.h @@ -119,7 +119,6 @@ public: static void SetTexMatrixChangedA(u32 Value); static void SetTexMatrixChangedB(u32 Value); - static size_t SaveLoadState(char *ptr, BOOL save); static void LoadXFReg(u32 transferSize, u32 address, u32 *pData); static void LoadIndexedXF(u32 val, int array);