diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp index 1d18bef1e1..7344461592 100644 --- a/Source/Core/Common/Src/DynamicLibrary.cpp +++ b/Source/Core/Common/Src/DynamicLibrary.cpp @@ -15,20 +15,11 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ +/* + All plugins from Core > Plugins are loaded and unloaded with this class when + Dolpin is started and stopped. +*/ -////////////////////////////////////////////////////////////////////////////////////////// -// File description -/* ŻŻŻŻŻŻŻŻŻŻŻŻ - - All plugins from Core > Plugins are loaded and unloaded with this class when Dolpin is started - and stopped. - -//////////////////////////////////////*/ - - -////////////////////////////////////////////////////////////////////////////////////////// -// Include -// ŻŻŻŻŻŻŻŻŻŻŻŻ #include // System #ifdef _WIN32 #include @@ -42,7 +33,6 @@ #include "StringUtil.h" #include "DynamicLibrary.h" #include "ConsoleWindow.h" -//////////////////////////////////////// DynamicLibrary::DynamicLibrary() @@ -81,26 +71,25 @@ std::string GetLastErrorAsString() #endif } -/* Function: Loading means loading the dll with LoadLibrary() to get an instance to the dll. - This is done when Dolphin is started to determine which dlls are good, and before opening - the Config and Debugging windows from Plugin.cpp and before opening the dll for running - the emulation in Video_...cpp in Core. Since this is fairly slow, TODO: think about +/* Function: Loading means loading the dll with LoadLibrary() to get an + instance to the dll. This is done when Dolphin is started to determine + which dlls are good, and before opening the Config and Debugging windows + from Plugin.cpp and before opening the dll for running the emulation in + Video_...cpp in Core. Since this is fairly slow, TODO: think about implementing some sort of cache. Called from: The Dolphin Core */ int DynamicLibrary::Load(const char* filename) { - if (!filename || strlen(filename) == 0) - { - LOG(MASTER_LOG, "Missing filename of dynamic library to load"); - PanicAlert("Missing filename of dynamic library to load"); - return 0; + if (!filename || strlen(filename) == 0) { + LOG(MASTER_LOG, "Missing filename of dynamic library to load"); + PanicAlert("Missing filename of dynamic library to load"); + return 0; } LOG(MASTER_LOG, "Trying to load library %s", filename); - if (IsLoaded()) - { - LOG(MASTER_LOG, "Trying to load already loaded library %s", filename); - return 2; + if (IsLoaded()) { + LOG(MASTER_LOG, "Trying to load already loaded library %s", filename); + return 2; } #ifdef _WIN32 @@ -110,11 +99,10 @@ int DynamicLibrary::Load(const char* filename) library = dlopen(filename, RTLD_NOW | RTLD_LOCAL); #endif - if (!library) - { - LOG(MASTER_LOG, "Error loading DLL %s: %s", filename, GetLastErrorAsString().c_str()); - PanicAlert("Error loading DLL %s: %s\n", filename, GetLastErrorAsString().c_str()); - return 0; + if (!library) { + LOG(MASTER_LOG, "Error loading DLL %s: %s", filename, GetLastErrorAsString().c_str()); + PanicAlert("Error loading DLL %s: %s\n", filename, GetLastErrorAsString().c_str()); + return 0; } library_file = filename; @@ -162,7 +150,7 @@ void* DynamicLibrary::Get(const char* funcname) const if (!retval) { LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str()); - //PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str()); + PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str()); } return retval; diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index 35c5026086..c029fd1251 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -37,8 +37,17 @@ CPlugin::~CPlugin() CPlugin::CPlugin(const char* _szName) : valid(false) { - if (m_hInstLib.Load(_szName)) { + m_GetDllInfo = NULL; + m_DllConfig = NULL; + m_DllDebugger = NULL; + m_SetDllGlobals = NULL; + m_Initialize = NULL; + m_Shutdown = NULL; + m_DoState = NULL; + + if (m_hInstLib.Load(_szName)) { + m_GetDllInfo = reinterpret_cast (m_hInstLib.Get("GetDllInfo")); m_DllConfig = reinterpret_cast @@ -76,12 +85,11 @@ void *CPlugin::LoadSymbol(const char *sym) { // ______________________________________________________________________________________ // GetInfo: Get DLL info bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) { - if (m_GetDllInfo != 0) - { - m_GetDllInfo(&_pluginInfo); - return(true); + if (m_GetDllInfo != NULL) { + m_GetDllInfo(&_pluginInfo); + return(true); } - + return(false); } @@ -89,7 +97,8 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) { // Config: Open the Config window void CPlugin::Config(HWND _hwnd) { - if (m_DllConfig != 0) m_DllConfig(_hwnd); + if (m_DllConfig != NULL) + m_DllConfig(_hwnd); } @@ -97,32 +106,35 @@ void CPlugin::Config(HWND _hwnd) // Debug: Open the Debugging window void CPlugin::Debug(HWND _hwnd, bool Show) { - if (m_DllDebugger != 0) m_DllDebugger(_hwnd, Show); + if (m_DllDebugger != NULL) + m_DllDebugger(_hwnd, Show); } void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) { - if (m_SetDllGlobals != 0) + if (m_SetDllGlobals != NULL) m_SetDllGlobals(_pluginGlobals); } void CPlugin::DoState(unsigned char **ptr, int mode) { - if (m_DoState != 0) + if (m_DoState != NULL) m_DoState(ptr, mode); } // Run Initialize() in the plugin void CPlugin::Initialize(void *init) { - /* We first check that we have found the Initialize() function, but there is no - restriction on running this several times */ - if (m_Initialize != 0) m_Initialize(init); + /* We first check that we have found the Initialize() function, but there + is no restriction on running this several times */ + if (m_Initialize != NULL) + m_Initialize(init); } void CPlugin::Shutdown() { - if (m_Shutdown != 0) m_Shutdown(); + if (m_Shutdown != NULL) + m_Shutdown(); } -} // end of namespace Common \ No newline at end of file +} // end of namespace Common diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp index 743794f8b1..0e866977dd 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigDlg.cpp @@ -228,10 +228,12 @@ void ConfigDialog::CreateGUIControls() wxStaticBoxSizer * sbRealRecord = new wxStaticBoxSizer(wxVERTICAL, m_PageReal, wxT("Record movements")); wxArrayString StrHotKey; - for(int i = 0; i < 10; i++) StrHotKey.Add(wxString::Format("Shift + %i", i)); + for(int i = 0; i < 10; i++) + StrHotKey.Add(wxString::Format(wxT("Shift + %i"), i)); wxArrayString StrPlayBackSpeed; - for(int i = 1; i < 8; i++) StrPlayBackSpeed.Add(wxString::Format("%i", i*5)); + for(int i = 1; i < 8; i++) + StrPlayBackSpeed.Add(wxString::Format(wxT("%i"), i*5)); wxBoxSizer * sRealRecord[RECORDING_ROWS];