Core Stop and Start: Fixed stop and start again by avoiding FreeLibrary() of the OpenGL plugin, and avoiding a crash in its ShutDown() function. You need to use SETUP_FREE_PLUGIN_ON_BOOT to compile with this option that works on my system. Also, I noticed that I don't need the SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG anymore, I can now delete the g_EmuThread without having it hanging in its waiting function.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2356 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-22 04:24:53 +00:00
parent 5057d3b446
commit fc6a7c47d5
10 changed files with 98 additions and 45 deletions

View File

@ -39,7 +39,8 @@
// This may fix a problem with Stop and Start that I described in the comments to revision 2,139
//#define SETUP_FREE_PLUGIN_ON_BOOT
// Use Stop when rendering to a child window
/* This will avoid deleting the g_EmuThread after Stop, that may hang when we are rendering to a child
window, however, I didn't seem to need this any more */
//#define SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG
// Build with playback rerecording options

View File

@ -229,22 +229,26 @@ void Stop() // - Hammertime!
// If dual core mode, the CPU thread should immediately exit here.
// The quit is to get it out of its message loop
// Should be moved inside the plugin.
if (_CoreParameter.bUseDualCore)
CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();
/* Video_EnterLoop() should now exit so that EmuThread() will continue concurrently with the rest
of the commands in this function */
/* The quit is to get it out of its message loop. There is no guarantee of when this will occur though.
And since we have no while(GetMessage()) loop we can't wait for this to happen, or say exactly when
the loop has ended */
#ifdef _WIN32
PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0);
PostMessage((HWND)g_pWindowHandle, WM_QUIT, 0, 0);
#endif
Core::StopTrace();
LogManager::Shutdown();
Host_SetWaitCursor(false);
#ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG
/* I have to use this to avoid the hangings, it seems harmless and it works so I'm
okay with it */
/* This may hang when we are rendering to a child window, but currently it doesn't, at least
not on my system, but I'll leave this option for a while anyway */
if (GetParent((HWND)g_pWindowHandle) == NULL)
#endif
delete g_EmuThread; // Wait for emuthread to close.

View File

@ -72,6 +72,7 @@
#include "FileUtil.h"
#include "StringUtil.h"
#include "ConsoleWindow.h"
#include "Setup.h"
// Create the plugin manager class
CPluginManager CPluginManager::m_Instance;
@ -214,6 +215,7 @@ void CPluginManager::ShutdownPlugins()
#endif
}
if (m_dsp)
{
m_dsp->Shutdown();

View File

@ -519,10 +519,9 @@ void CFrame::DoStop()
{
Core::Stop();
/* This is needed to let GetState() == CORE_UNINITIALIZED together with the
"delete g_pThread" in Core.cpp. Todo: Please feel free to fix it some other way. */
//PanicAlert("%i", (int)bRenderToMain);
#ifdef _WIN32
/* This is needed together with the option to not "delete g_EmuThread" in Core.cpp, because then
we have to wait a moment before GetState() == CORE_UNINITIALIZED so that UpdateGUI() works */
#ifdef SETUP_AVOID_CHILD_WINDOW_RENDERING_HANG
if (bRenderToMain)
while(Core::GetState() != Core::CORE_UNINITIALIZED) Sleep(10);
#endif

View File

@ -206,6 +206,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
Console::Print(
"Pad | Number:%i Enabled:%i Handle:%i\n"
"Main Stick | X:%03i Y:%03i\n"
"C Stick | X:%03i Y:%03i\n"
"Trigger | Type:%s DigitalL:%i DigitalR:%i AnalogL:%03i AnalogR:%03i HalfPress:%i\n"
"Buttons | A:%i X:%i\n"
"D-Pad | Type:%s Hat:%i U:%i D:%i\n"
@ -214,6 +215,7 @@ void GetJoyState(CONTROLLER_STATE &_PadState, CONTROLLER_MAPPING _PadMapping, in
Controller, _PadMapping.enabled, _PadState.joy,
_PadState.axis[InputCommon::CTL_MAIN_X], _PadState.axis[InputCommon::CTL_MAIN_Y],
_PadState.axis[InputCommon::CTL_SUB_X], _PadState.axis[InputCommon::CTL_SUB_Y],
(_PadMapping.triggertype ? "CTL_TRIGGER_XINPUT" : "CTL_TRIGGER_SDL"),
_PadState.buttons[InputCommon::CTL_L_SHOULDER], _PadState.buttons[InputCommon::CTL_R_SHOULDER],