From 3a9eeeb1442c60ec5b15a8c35a156effa76768c4 Mon Sep 17 00:00:00 2001 From: nakeee Date: Wed, 7 Jan 2009 22:07:51 +0000 Subject: [PATCH] addded the setdllglobals function to the specs (no failure maybe warning on symbols git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1825 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Plugin.cpp | 20 ++++++-- Source/Core/Common/Src/Plugin.h | 3 ++ Source/Core/Core/Src/Plugins/Plugin_DSP.cpp | 19 ++++---- Source/Core/Core/Src/Plugins/Plugin_DSP.h | 20 ++++---- Source/Core/Core/Src/Plugins/Plugin_PAD.cpp | 19 ++++---- Source/Core/Core/Src/Plugins/Plugin_PAD.h | 2 + Source/Core/Core/Src/Plugins/Plugin_Video.cpp | 5 +- Source/Core/Core/Src/Plugins/Plugin_Video.h | 4 +- .../Core/Core/Src/Plugins/Plugin_Wiimote.cpp | 46 ++++++++----------- Source/Core/Core/Src/Plugins/Plugin_Wiimote.h | 20 ++++---- 10 files changed, 92 insertions(+), 66 deletions(-) diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index fb6c67e78e..4a77d9c11c 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -31,9 +31,10 @@ namespace Common { DynamicLibrary CPlugin::m_hInstLib; -void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0; -void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0; -void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent, bool Show) = 0; +void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0; +void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0; +void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent, bool Show) = 0; +void(__cdecl * CPlugin::m_SetDllGlobals) (PLUGIN_GLOBALS* _PluginGlobals) = 0; void CPlugin::Release(void) @@ -41,7 +42,8 @@ CPlugin::Release(void) m_GetDllInfo = 0; m_DllConfig = 0; m_DllDebugger = 0; - + m_SetDllGlobals = 0; + m_hInstLib.Unload(); } @@ -53,6 +55,7 @@ CPlugin::Load(const char* _szName) m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*)) m_hInstLib.Get("GetDllInfo"); m_DllConfig = (void (__cdecl*)(HWND)) m_hInstLib.Get("DllConfig"); m_DllDebugger = (void (__cdecl*)(HWND, bool)) m_hInstLib.Get("DllDebugger"); + m_SetDllGlobals = (void (__cdecl*)(PLUGIN_GLOBALS*)) m_hInstLib.Get("SetDllGlobals"); return(true); } @@ -87,4 +90,13 @@ void CPlugin::Debug(HWND _hwnd, bool Show) m_DllDebugger(_hwnd, Show); } } + +void CPlugin::SetGlobals(PLUGIN_GLOBALS& _pluginGlobals) +{ + if (m_SetDllGlobals != 0) + { + m_SetDllGlobals(&_pluginGlobals); + } +} + } // end of namespace Common diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index 0ae7fc26c5..26ed6279f4 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -32,6 +32,7 @@ class CPlugin static bool Load(const char* _szName); static bool GetInfo(PLUGIN_INFO& _pluginInfo); + static void SetGlobals(PLUGIN_GLOBALS& _PluginGlobals); static void Config(HWND _hwnd); static void About(HWND _hwnd); @@ -45,6 +46,8 @@ class CPlugin static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo); static void (__cdecl * m_DllConfig)(HWND _hParent); static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show); + static void (__cdecl * m_SetDllGlobals)(PLUGIN_GLOBALS* _PluginGlobals); + }; } // end of namespace Common diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp b/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp index d68a743806..c76dac7d84 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp @@ -23,19 +23,20 @@ namespace PluginDSP { // Function Pointer -TGetDllInfo GetDllInfo = 0; -TDllConfig DllConfig = 0; +TGetDllInfo GetDllInfo = 0; +TSetDllGlobals SetDllGlobals = 0; +TDllConfig DllConfig = 0; TDllDebugger DllDebugger = 0; -TDSP_Initialize DSP_Initialize = 0; -TDSP_Shutdown DSP_Shutdown = 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_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_Update DSP_Update = 0; +TDSP_SendAIBuffer DSP_SendAIBuffer = 0; TDSP_DoState DSP_DoState = 0; //! Library Instance @@ -57,6 +58,7 @@ void UnloadPlugin() // Set Functions to NULL GetDllInfo = 0; + SetDllGlobals = 0; DllConfig = 0; DllDebugger = 0; DSP_Initialize = 0; @@ -79,6 +81,7 @@ bool LoadPlugin(const char *_Filename) if (ret == 1) { GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); DllConfig = reinterpret_cast (plugin.Get("DllConfig")); DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); DSP_Initialize = reinterpret_cast (plugin.Get("DSP_Initialize")); @@ -104,7 +107,7 @@ bool LoadPlugin(const char *_Filename) (DSP_WriteControlRegister != 0) && (DSP_Update != 0) && (DSP_SendAIBuffer != 0) && - (DSP_DoState != 0)) + (DSP_DoState != 0)) { //PanicAlert("return true: %i", ret); return true; diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.h b/Source/Core/Core/Src/Plugins/Plugin_DSP.h index e62f3aa87a..6d9f40ca97 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.h +++ b/Source/Core/Core/Src/Plugins/Plugin_DSP.h @@ -28,6 +28,7 @@ void UnloadPlugin(); // Function Types typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl* TDllConfig)(HWND); typedef void (__cdecl* TDllDebugger)(HWND, bool); typedef void (__cdecl* TDSP_Initialize)(DSPInitialize); @@ -41,19 +42,20 @@ typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate) typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode); // Function Pointers -extern TGetDllInfo GetDllInfo; -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 TGetDllInfo GetDllInfo; +extern TSetDllGlobals SetDllGlobals; +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_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 6416ceeab2..add7163cb6 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp @@ -22,13 +22,14 @@ namespace PluginPAD { // Function Pointers -TGetDllInfo GetDllInfo = 0; -TPAD_Shutdown PAD_Shutdown = 0; -TDllConfig DllConfig = 0; -TPAD_Initialize PAD_Initialize = 0; -TPAD_GetStatus PAD_GetStatus = 0; -TPAD_Input PAD_Input = 0; -TPAD_Rumble PAD_Rumble = 0; +TGetDllInfo GetDllInfo = 0; +TSetDllGlobals SetDllGlobals = 0; +TPAD_Shutdown PAD_Shutdown = 0; +TDllConfig DllConfig = 0; +TPAD_Initialize PAD_Initialize = 0; +TPAD_GetStatus PAD_GetStatus = 0; +TPAD_Input PAD_Input = 0; +TPAD_Rumble PAD_Rumble = 0; TPAD_GetAttachedPads PAD_GetAttachedPads = 0; // Library Instance @@ -44,6 +45,7 @@ void UnloadPlugin() plugin.Unload(); // Set Functions to 0 GetDllInfo = 0; + SetDllGlobals = 0; PAD_Shutdown = 0; DllConfig = 0; PAD_Initialize = 0; @@ -57,11 +59,12 @@ bool LoadPlugin(const char *_Filename) if (plugin.Load(_Filename)) { GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); 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_Input = reinterpret_cast (plugin.Get("PAD_Input")); + PAD_Input = reinterpret_cast (plugin.Get("PAD_Input")); PAD_Rumble = reinterpret_cast (plugin.Get("PAD_Rumble")); PAD_GetAttachedPads = reinterpret_cast(plugin.Get("PAD_GetAttachedPads")); diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.h b/Source/Core/Core/Src/Plugins/Plugin_PAD.h index 6b2725144c..7f0303d9cb 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.h +++ b/Source/Core/Core/Src/Plugins/Plugin_PAD.h @@ -29,6 +29,7 @@ void UnloadPlugin(); // Function Types typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl* TDllConfig)(HWND); typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); typedef void (__cdecl* TPAD_Shutdown)(); @@ -39,6 +40,7 @@ typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); // Function Pointers extern TGetDllInfo GetDllInfo; +extern TSetDllGlobals SetDllGlobals; extern TPAD_Shutdown PAD_Shutdown; extern TDllConfig DllConfig; extern TPAD_Initialize PAD_Initialize; diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp b/Source/Core/Core/Src/Plugins/Plugin_Video.cpp index a9d09f6fa5..86fd9b8e68 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_Video.cpp @@ -27,6 +27,7 @@ namespace PluginVideo // Function Pointer TGetDllInfo GetDllInfo = 0; +TSetDllGlobals SetDllGlobals = 0; TDllConfig DllConfig = 0; TDllDebugger DllDebugger = 0; TVideo_Initialize Video_Initialize = 0; @@ -59,8 +60,9 @@ void UnloadPlugin() // set Functions to 0 GetDllInfo = 0; + SetDllGlobals = 0; DllConfig = 0; - DllDebugger = 0; + DllDebugger = 0; Video_Initialize = 0; Video_Prepare = 0; Video_Shutdown = 0; @@ -89,6 +91,7 @@ bool LoadPlugin(const char *_Filename) if (ret == 1) { GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); DllConfig = reinterpret_cast (plugin.Get("DllConfig")); DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); Video_Initialize = reinterpret_cast (plugin.Get("Video_Initialize")); diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.h b/Source/Core/Core/Src/Plugins/Plugin_Video.h index e8359e2ee4..7605be4629 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.h +++ b/Source/Core/Core/Src/Plugins/Plugin_Video.h @@ -32,6 +32,7 @@ void UnloadPlugin(); // Function Types typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl* TDllConfig)(HWND); typedef void (__cdecl* TDllDebugger)(HWND, bool); typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*); @@ -47,8 +48,9 @@ typedef void (__cdecl* TVideo_Stop)(); // Function Pointers extern TGetDllInfo GetDllInfo; +extern TSetDllGlobals SetDllGlobals; extern TDllConfig DllConfig; -extern TDllDebugger DllDebugger; +extern TDllDebugger DllDebugger; extern TVideo_Initialize Video_Initialize; extern TVideo_Prepare Video_Prepare; extern TVideo_Shutdown Video_Shutdown; diff --git a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp index 976fb9801b..be5f9c938a 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp +++ b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp @@ -23,15 +23,16 @@ namespace PluginWiimote { // Function Pointer - TGetDllInfo GetDllInfo = 0; - TDllConfig DllConfig = 0; - TWiimote_Initialize Wiimote_Initialize = 0; - TWiimote_Shutdown Wiimote_Shutdown = 0; - TWiimote_Output Wiimote_ControlChannel = 0; - TWiimote_Input Wiimote_InterruptChannel = 0; - TWiimote_Update Wiimote_Update = 0; + TGetDllInfo GetDllInfo = 0; + TSetDllGlobals SetDllGlobals = 0; + TDllConfig DllConfig = 0; + TWiimote_Initialize Wiimote_Initialize = 0; + TWiimote_Shutdown Wiimote_Shutdown = 0; + TWiimote_Output Wiimote_ControlChannel = 0; + TWiimote_Input Wiimote_InterruptChannel = 0; + TWiimote_Update Wiimote_Update = 0; TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers = 0; - TWiimote_DoState Wiimote_DoState = 0; + TWiimote_DoState Wiimote_DoState = 0; //! Library Instance DynamicLibrary plugin; @@ -47,6 +48,7 @@ namespace PluginWiimote // Set Functions to NULL GetDllInfo = 0; + SetDllGlobals = 0; DllConfig = 0; Wiimote_Initialize = 0; Wiimote_Shutdown = 0; @@ -61,26 +63,18 @@ namespace PluginWiimote { if (plugin.Load(_Filename)) { - LOG(MASTER_LOG, "getting Wiimote Plugin function pointers..."); - GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); - DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - Wiimote_Initialize = reinterpret_cast (plugin.Get("Wiimote_Initialize")); - Wiimote_Shutdown = reinterpret_cast (plugin.Get("Wiimote_Shutdown")); - Wiimote_ControlChannel = reinterpret_cast (plugin.Get("Wiimote_ControlChannel")); - Wiimote_InterruptChannel = reinterpret_cast (plugin.Get("Wiimote_InterruptChannel")); - Wiimote_Update = reinterpret_cast (plugin.Get("Wiimote_Update")); + GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); + SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); + DllConfig = reinterpret_cast (plugin.Get("DllConfig")); + Wiimote_Initialize = reinterpret_cast (plugin.Get("Wiimote_Initialize")); + Wiimote_Shutdown = reinterpret_cast (plugin.Get("Wiimote_Shutdown")); + Wiimote_ControlChannel = reinterpret_cast (plugin.Get("Wiimote_ControlChannel")); + Wiimote_InterruptChannel = reinterpret_cast (plugin.Get("Wiimote_InterruptChannel")); + Wiimote_Update = reinterpret_cast (plugin.Get("Wiimote_Update")); Wiimote_GetAttachedControllers = reinterpret_cast (plugin.Get("Wiimote_GetAttachedControllers")); - Wiimote_DoState = reinterpret_cast (plugin.Get("Wiimote_DoState")); + Wiimote_DoState = reinterpret_cast (plugin.Get("Wiimote_DoState")); + - LOG(MASTER_LOG, "%s: 0x%p", "GetDllInfo", GetDllInfo); - LOG(MASTER_LOG, "%s: 0x%p", "DllConfig", DllConfig); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Initialize", Wiimote_Initialize); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Shutdown", Wiimote_Shutdown); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_ControlChannel", Wiimote_ControlChannel); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_InterruptChannel", Wiimote_InterruptChannel); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Update", Wiimote_Update); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_GetAttachedControllers", Wiimote_GetAttachedControllers); - LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_DoState", Wiimote_DoState); if ((GetDllInfo != 0) && (Wiimote_Initialize != 0) && (Wiimote_Shutdown != 0) && diff --git a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h index 1605ba2446..e5ccea2e2b 100644 --- a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h +++ b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h @@ -28,6 +28,7 @@ void UnloadPlugin(); // Function Types typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); +typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); typedef void (__cdecl* TDllConfig)(HWND); typedef bool (__cdecl* TWiimote_Initialize)(SWiimoteInitialize); typedef void (__cdecl* TWiimote_Shutdown)(); @@ -38,15 +39,16 @@ typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)(); typedef void (__cdecl* TWiimote_DoState)(void *ptr, int mode); // Function Pointers -extern TGetDllInfo GetDllInfo; -extern TDllConfig DllConfig; -extern TWiimote_Initialize Wiimote_Initialize; -extern TWiimote_Shutdown Wiimote_Shutdown; -extern TWiimote_Output Wiimote_ControlChannel; -extern TWiimote_Input Wiimote_InterruptChannel; -extern TWiimote_Update Wiimote_Update; -extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; -extern TWiimote_DoState Wiimote_DoState; +extern TGetDllInfo GetDllInfo; +extern TSetDllGlobals SetDllGlobals; +extern TDllConfig DllConfig; +extern TWiimote_Initialize Wiimote_Initialize; +extern TWiimote_Shutdown Wiimote_Shutdown; +extern TWiimote_Output Wiimote_ControlChannel; +extern TWiimote_Input Wiimote_InterruptChannel; +extern TWiimote_Update Wiimote_Update; +extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; +extern TWiimote_DoState Wiimote_DoState; } // end of namespace PluginWiimote