diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp index 628cf5324b..1d18bef1e1 100644 --- a/Source/Core/Common/Src/DynamicLibrary.cpp +++ b/Source/Core/Common/Src/DynamicLibrary.cpp @@ -130,7 +130,7 @@ int DynamicLibrary::Unload() } #ifdef _WIN32 - Console::Print("FreeLibrary: %i\n", library); + Console::Print("FreeLibrary: %i\n", library_file.c_str()); retval = FreeLibrary(library); #else retval = dlclose(library)?0:1; diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 565a47d1ae..34fbfd68ee 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -318,6 +318,7 @@ THREAD_RETURN EmuThread(void *pArg) VideoInitialize.pMemoryBase = Memory::base; VideoInitialize.pKeyPress = Callback_KeyPress; VideoInitialize.bWii = _CoreParameter.bWii; + Plugins.FreeVideo(); // This is needed for Stop and Start Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll // Under linux, this is an X11 Display, not an HWND! diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 86599d8a9b..97aec817d8 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -342,12 +342,23 @@ Common::PluginVideo *CPluginManager::GetVideo() return m_video; } +// ---------------------------------------- +// Free plugins to completely reset all variables and potential DLLs loaded by the plugins in turn +// ------------- +Common::PluginVideo *CPluginManager::FreeVideo() +{ + delete m_video; + m_video = NULL; + m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str(), 0); + return m_video; +} Common::PluginPAD *CPluginManager::FreePad() { delete m_pad[0]; m_pad[0] = NULL; m_pad[1] = NULL; m_pad[2] = NULL; m_pad[3] = NULL; m_pad[0] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[0].c_str(), 0); return m_pad[0]; + } /////////////////////////////////////////// diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index 4eb39a8ff5..87a7b91ed9 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -51,6 +51,7 @@ public: Common::PluginDSP *GetDSP(); Common::PluginVideo *GetVideo(); Common::PluginPAD *FreePad(); + Common::PluginVideo *FreeVideo(); bool InitPlugins(); void ShutdownPlugins(); diff --git a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj index 6ff346bb9e..591a460718 100644 --- a/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj +++ b/Source/Plugins/Plugin_Wiimote/Plugin_Wiimote.vcproj @@ -623,6 +623,10 @@ RelativePath="..\..\PluginSpecs\pluginspecs_wiimote.h" > + +