GUI/OpenGL: Video debugging window crash fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4225 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-09-07 13:33:40 +00:00
parent 7dffe43eaa
commit 24d68da653
7 changed files with 56 additions and 111 deletions

View File

@ -102,8 +102,7 @@ class CCodeWindow
void OnToggleBreakPointWindow(bool,int);
void OnToggleMemoryWindow(bool,int);
void OnToggleJitWindow(bool,int);
void OnToggleSoundWindow(bool,int);
void OnToggleVideoWindow(bool,int);
void OnToggleDLLWindow(int,bool,int);
void OnChangeFont(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event);

View File

@ -552,54 +552,62 @@ Notice: This windows docking for plugin windows will produce several wx debuggin
*/
//Toggle Sound Debugging Window
void CCodeWindow::OnToggleSoundWindow(bool _Show, int i)
// Toggle Sound Debugging Window
void CCodeWindow::OnToggleDLLWindow(int Id, bool _Show, int i)
{
#ifdef _WIN32
// ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
std::string DLLName;
wxString Title;
int PLUGINTYPE;
switch(Id)
{
case IDM_SOUNDWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str();
PLUGINTYPE = PLUGIN_TYPE_DSP;
Title = wxT("Sound");
break;
case IDM_VIDEOWINDOW:
DLLName = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str();
PLUGINTYPE = PLUGIN_TYPE_VIDEO;
Title = wxT("Video");
break;
}
if (_Show)
{
if (Parent->GetNotebookCount() == 0) return;
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
wxWindow *Win = Parent->GetWxWindow(Title);
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
// Show window
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
Win = Parent->GetWxWindow(wxT("Sound"));
Win = Parent->GetWxWindow(Title);
if (Win)
{
Win->SetName(wxT("Sound"));
Win->SetName(Title);
Win->Reparent(Parent);
Win->SetId(IDM_SOUNDWINDOW);
Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile);
Parent->GetNotebookFromId(i)->AddPage(Win, Title, true, Parent->aNormalFile);
}
else
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win not found\n").c_str());
}
}
}
else
{
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
wxWindow *Win = Parent->GetWxWindow(Title);
if (Win)
{
Parent->DoRemovePage(Win, false);
//Win->Reparent(NULL);
// Destroy
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, false
);
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
//WARN_LOG(CONSOLE, "Sound removed from NB");
}
else
@ -609,83 +617,6 @@ void CCodeWindow::OnToggleSoundWindow(bool _Show, int i)
}
#else
if (_Show)
{
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
//GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
}
else
{
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, false // DSP, hide
);
}
CPluginManager::GetInstance().OpenDebug(Parent->GetHandle(), DLLName.c_str(), (PLUGIN_TYPE)PLUGINTYPE, _Show);
#endif
}
// Toggle Video Debugging Window
void CCodeWindow::OnToggleVideoWindow(bool _Show, int i)
{
#ifdef _WIN32
//GetMenuBar()->Check(event.GetId(), false); // Turn off
if (_Show)
{
if (Parent->GetNotebookCount() == 0) return;
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
Win->SetId(IDM_VIDEOWINDOW);
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
// Show and/or create the window
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
Win = Parent->GetWxWindow(wxT("Video"));
if (Win) Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Video"), true, Parent->aNormalFile );
}
else // hide
{
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
if (Win)
{
Parent->DoRemovePage (Win, false);
Win->Reparent(NULL);
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, false // Video, hide
);
}
}
#else
if (_Show)
{
CPluginManager::GetInstance().OpenDebug(
Parent->GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
}
else
{
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, false // Video, hide
);
}
#endif
}
}

View File

@ -648,7 +648,7 @@ void CFrame::OnCustomHostMessage(int Id)
);
//Win->Reparent(NULL);
//g_pCodeWindow->OnToggleSoundWindow(false, 0);
//g_pCodeWindow->OnToggleDLLWindow(false, 0);
GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false);
NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(true, "Sound debugging window closed").c_str());
}

View File

@ -215,8 +215,8 @@ void CFrame::DoToggleWindow(int Id, bool bShow)
case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(bShow, g_pCodeWindow->iBreakpointWindow); break;
case IDM_MEMORYWINDOW: g_pCodeWindow->OnToggleMemoryWindow(bShow, g_pCodeWindow->iMemoryWindow); break;
case IDM_JITWINDOW: g_pCodeWindow->OnToggleJitWindow(bShow, g_pCodeWindow->iJitWindow); break;
case IDM_SOUNDWINDOW: g_pCodeWindow->OnToggleSoundWindow(bShow, g_pCodeWindow->iSoundWindow); break;
case IDM_VIDEOWINDOW: g_pCodeWindow->OnToggleVideoWindow(bShow, g_pCodeWindow->iVideoWindow); break;
case IDM_SOUNDWINDOW: g_pCodeWindow->OnToggleDLLWindow(IDM_SOUNDWINDOW, bShow, g_pCodeWindow->iSoundWindow); break;
case IDM_VIDEOWINDOW: g_pCodeWindow->OnToggleDLLWindow(IDM_VIDEOWINDOW, bShow, g_pCodeWindow->iVideoWindow); break;
}
}
void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)

View File

@ -46,15 +46,20 @@ GFXDebuggerOGL::GFXDebuggerOGL(wxWindow *parent, wxWindowID id, const wxString &
GFXDebuggerOGL::~GFXDebuggerOGL()
{
SaveSettings();
m_DebuggerFrame = NULL;
NOTICE_LOG(CONSOLE, "Stop [Video Thread]: Closing OpenGL debugging window");
}
void GFXDebuggerOGL::OnClose(wxCloseEvent& event)
{
// save the window position when we hide the window
// This means wxDialog's Destroy is used
//event.Skip();
// Save the window position
SaveSettings();
event.Skip(); // This means wxDialog's Destroy is used
// Destroy
delete this;
}
void GFXDebuggerOGL::SaveSettings() const

View File

@ -24,6 +24,12 @@
#include "VideoCommon.h"
#include "pluginspecs_video.h"
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h"
class GFXDebuggerOGL;
extern GFXDebuggerOGL *m_DebuggerFrame;
#endif
// A global plugin specification
extern PLUGIN_GLOBALS* globals;

View File

@ -154,13 +154,17 @@ wxWindow* GetParentedWxWindow(HWND Parent)
#if defined(HAVE_WX) && HAVE_WX
void DllDebugger(HWND _hParent, bool Show)
{
if (!m_DebuggerFrame)
m_DebuggerFrame = new GFXDebuggerOGL(GetParentedWxWindow(_hParent));
if (Show)
{
if (!m_DebuggerFrame)
m_DebuggerFrame = new GFXDebuggerOGL(NULL);
//m_DebuggerFrame = new GFXDebuggerOGL(GetParentedWxWindow(_hParent));
m_DebuggerFrame->Show();
}
else
m_DebuggerFrame->Hide();
{
if (m_DebuggerFrame) m_DebuggerFrame->Hide();
}
}
#else
void DllDebugger(HWND _hParent, bool Show) { }