diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj
index 4ee10ca9ee..93958f9d86 100644
--- a/Source/Core/Common/Common.vcproj
+++ b/Source/Core/Common/Common.vcproj
@@ -69,7 +69,7 @@
/>
+#include
#elif __GNUC__
#include
#include
@@ -132,3 +134,28 @@ void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute)
mprotect(ptr, size, allowExecute ? (PROT_READ | PROT_WRITE | PROT_EXEC) : PROT_WRITE | PROT_READ);
#endif
}
+
+
+std::string MemUsage()
+{
+ #ifdef _WIN32
+ DWORD processID = GetCurrentProcessId();
+ HANDLE hProcess;
+ PROCESS_MEMORY_COUNTERS pmc;
+ std::string Ret;
+
+ // Print information about the memory usage of the process.
+
+ hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID);
+ if (NULL == hProcess) return "MemUsage Error";
+
+ if (GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)))
+ Ret = StringFromFormat("%s K", ThS(pmc.WorkingSetSize / 1024, true, 7).c_str());
+
+ CloseHandle(hProcess);
+ return Ret;
+
+ #else
+ return "";
+ #endif
+}
\ No newline at end of file
diff --git a/Source/Core/Common/Src/MemoryUtil.h b/Source/Core/Common/Src/MemoryUtil.h
index 6cd9b075a9..0488fdef1c 100644
--- a/Source/Core/Common/Src/MemoryUtil.h
+++ b/Source/Core/Common/Src/MemoryUtil.h
@@ -18,11 +18,14 @@
#ifndef _MEMORYUTIL_H
#define _MEMORYUTIL_H
+#include
+
void* AllocateExecutableMemory(size_t size, bool low = true);
void* AllocateMemoryPages(size_t size);
void FreeMemoryPages(void* ptr, size_t size);
void WriteProtectMemory(void* ptr, size_t size, bool executable = false);
void UnWriteProtectMemory(void* ptr, size_t size, bool allowExecute = false);
+std::string MemUsage();
inline int GetPageSize() { return 4096; }
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index 1ab10a2f0c..6eb3580e92 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -452,7 +452,7 @@ std::string ThS(int Integer, bool Unsigned, int Spaces)
// Spaces
std::string Spc = "";
- for (int i = 0; i < (Spaces - Sbuf.length()); i++) Spc += " ";
+ for (int i = 0; i < (int)(Spaces - Sbuf.length()); i++) Spc += " ";
return Spc + Sbuf;
}
diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp
index 0cd237e2f8..05a930b9f3 100644
--- a/Source/Core/Common/Src/Thread.cpp
+++ b/Source/Core/Common/Src/Thread.cpp
@@ -26,6 +26,15 @@
namespace Common
{
+int Thread::CurrentId()
+{
+ #ifdef _WIN32
+ return GetCurrentThreadId();
+ #else
+ return 0;
+ #endif
+}
+
#ifdef _WIN32
void InitThreading()
@@ -81,14 +90,16 @@ Thread::~Thread()
WaitForDeath();
}
-void Thread::WaitForDeath(const int _Wait)
+DWORD Thread::WaitForDeath(const int iWait)
{
if (m_hThread)
{
- WaitForSingleObject(m_hThread, _Wait);
+ DWORD Wait = WaitForSingleObject(m_hThread, iWait);
CloseHandle(m_hThread);
m_hThread = NULL;
+ return Wait;
}
+ return NULL;
}
void Thread::SetAffinity(int mask)
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index c829aded9f..ec1c3884bc 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -105,9 +105,10 @@ public:
void SetAffinity(int mask);
static void SetCurrentThreadAffinity(int mask);
-#ifdef _WIN32
+ static int CurrentId();
+#ifdef _WIN32
void SetPriority(int priority);
- void WaitForDeath(const int _Wait = INFINITE);
+ DWORD WaitForDeath(const int iWait = INFINITE);
#else
void WaitForDeath();
#endif
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index aa5108abff..86db7abc86 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -26,6 +26,7 @@
#include "Common.h"
#include "StringUtil.h"
#include "MathUtil.h"
+#include "MemoryUtil.h"
#include "Console.h"
#include "Core.h"
@@ -92,6 +93,7 @@ THREAD_RETURN EmuThread(void *pArg);
void Stop();
+bool g_bStopping = false;
bool g_bHwInit = false;
bool g_bRealWiimote = false;
HWND g_pWindowHandle = NULL;
@@ -106,6 +108,14 @@ Common::Event gpuShutdownCall;
// Display messages and return values
+
+// Formatted stop message
+std::string StopMessage(bool bMainThread, std::string Message)
+{
+ return StringFromFormat("Stop [%s %i]\t%s\t%s",
+ bMainThread ? "Main Thread" : "Video Thread", Common::Thread::CurrentId(), MemUsage().c_str(), Message.c_str());
+}
+
//
bool PanicAlertToVideo(const char* text, bool yes_no)
{
@@ -207,11 +217,20 @@ bool Init()
void Stop() // - Hammertime!
{
const SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
+ g_bStopping = true;
+
+ WARN_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutting down ----");
+
+ // This must be done a while before freeing the dll to not crash wx around MSWWindowProc and DefWindowProc, will investigate further
+ Host_Message(AUDIO_DESTROY);
+ Host_Message(VIDEO_DESTROY);
Host_SetWaitCursor(true); // hourglass!
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
return;
+ WARN_LOG(CONSOLE, "%s", StopMessage(true, "Stop CPU").c_str());
+
// Stop the CPU
PowerPC::Stop();
CCPU::StepOpcode(); // Kick it if it's waiting (code stepping wait loop)
@@ -226,7 +245,7 @@ void Stop() // - Hammertime!
// If dual core mode, the CPU thread should immediately exit here.
if (_CoreParameter.bUseDualCore) {
- INFO_LOG(CONSOLE, "Stop [Main Thread]: Wait for Video Loop to exit...\n");
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Wait for Video Loop to exit ...").c_str());
CPluginManager::GetInstance().GetVideo()->Video_ExitLoop();
}
@@ -235,13 +254,29 @@ void Stop() // - Hammertime!
// Close the trace file
Core::StopTrace();
- NOTICE_LOG(BOOT, "Shutting down core");
+ WARN_LOG(CONSOLE, "%s", StopMessage(true, "Shutting down core").c_str());
// Update mouse pointer
Host_SetWaitCursor(false);
+ WARN_LOG(CONSOLE, "%s", StopMessage(true, "Stopping Emu thread ...").c_str());
#ifdef _WIN32
- g_EmuThread->WaitForDeath(5000);
+ DWORD Wait = g_EmuThread->WaitForDeath(5000);
+ switch(Wait)
+ {
+ case WAIT_ABANDONED:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "Emu wait returned: WAIT_ABANDONED").c_str());
+ break;
+ case WAIT_OBJECT_0:
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Emu wait returned: WAIT_OBJECT_0").c_str());
+ break;
+ case WAIT_TIMEOUT:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "Emu wait returned: WAIT_TIMEOUT").c_str());
+ break;
+ case WAIT_FAILED:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "Emu wait returned: WAIT_FAILED").c_str());
+ break;
+ }
#else
g_EmuThread->WaitForDeath();
#endif
@@ -469,17 +504,20 @@ THREAD_RETURN EmuThread(void *pArg)
#endif
}
- INFO_LOG(CONSOLE, "Stop [Video Thread]: Stop() and Video Loop Ended\n");
- INFO_LOG(CONSOLE, "Stop [Video Thread]: Shutting down HW and Plugins\n");
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Stop() and Video Loop Ended").c_str());
+ WARN_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down HW").c_str());
// We have now exited the Video Loop and will shut down
// Write message
- if (g_pUpdateFPSDisplay != NULL)
- g_pUpdateFPSDisplay("Stopping...");
+ if (g_pUpdateFPSDisplay != NULL) g_pUpdateFPSDisplay("Stopping...");
HW::Shutdown();
+
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
+ WARN_LOG(CONSOLE, "%s", StopMessage(false, "Shutting down plugins").c_str());
Plugins.ShutdownPlugins();
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(false, "Plugins shutdown").c_str());
#ifdef _WIN32
gpuShutdownCall.Set();
@@ -495,9 +533,25 @@ THREAD_RETURN EmuThread(void *pArg)
if (cpuThread)
{
+ WARN_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU thread ...").c_str());
// There is a CPU thread - join it.
-#ifdef _WIN32
- cpuThread->WaitForDeath(3000);
+#ifdef _WIN32
+ DWORD Wait = cpuThread->WaitForDeath(3000);
+ switch(Wait)
+ {
+ case WAIT_ABANDONED:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "CPU wait returned: WAIT_ABANDONED").c_str());
+ break;
+ case WAIT_OBJECT_0:
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "CPU wait returned: WAIT_OBJECT_0").c_str());
+ break;
+ case WAIT_TIMEOUT:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "CPU wait returned: WAIT_TIMEOUT").c_str());
+ break;
+ case WAIT_FAILED:
+ ERROR_LOG(CONSOLE, "%s", StopMessage(true, "CPU wait returned: WAIT_FAILED").c_str());
+ break;
+ }
#else
cpuThread->WaitForDeath();
#endif
@@ -508,8 +562,10 @@ THREAD_RETURN EmuThread(void *pArg)
// The hardware is uninitialized
g_bHwInit = false;
-
- INFO_LOG(MASTER_LOG, "EmuThread exited");
+ g_bStopping = false;
+
+ NOTICE_LOG(CONSOLE, "%s", StopMessage(true, "Main thread stopped").c_str());
+ NOTICE_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
Host_UpdateMainFrame();
@@ -545,6 +601,8 @@ EState GetState()
{
if (CCPU::IsStepping())
return CORE_PAUSE;
+ else if (g_bStopping)
+ return CORE_STOPPING;
else
return CORE_RUN;
}
@@ -752,7 +810,7 @@ void Callback_VideoCopiedToXFB(bool video_update)
// Callback_DSPLog
-// WARNING - THIS MAY EXECUTED FROM DSP THREAD
+// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
void Callback_DSPLog(const TCHAR* _szMessage, int _v)
{
GENERIC_LOG(LogTypes::AUDIO, (LogTypes::LOG_LEVELS)_v, _szMessage);
@@ -760,7 +818,7 @@ void Callback_VideoCopiedToXFB(bool video_update)
// Callback_DSPInterrupt
-// WARNING - THIS MAY EXECUTED FROM DSP THREAD
+// WARNING - THIS MAY BE EXECUTED FROM DSP THREAD
void Callback_DSPInterrupt()
{
DSP::GenerateDSPInterruptFromPlugin(DSP::INT_DSP);
@@ -831,4 +889,4 @@ const SCoreStartupParameter& GetStartupParameter() {
return SConfig::GetInstance().m_LocalCoreStartupParameter;
}
-} // end of namespace Core
+} // Core
diff --git a/Source/Core/Core/Src/Core.h b/Source/Core/Core/Src/Core.h
index 49cbaa7ec0..9ee184dd9d 100644
--- a/Source/Core/Core/Src/Core.h
+++ b/Source/Core/Core/Src/Core.h
@@ -38,12 +38,15 @@ namespace Core
CORE_UNINITIALIZED,
CORE_PAUSE,
CORE_RUN,
+ CORE_STOPPING
};
// Init core
bool Init();
void Stop();
+ std::string StopMessage(bool, std::string);
+
bool isRunning();
void SetState(EState _State);
diff --git a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp
index af4133258f..f8bfe2695f 100644
--- a/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp
+++ b/Source/Core/Core/Src/Debugger/PPCDebugInterface.cpp
@@ -30,6 +30,9 @@
void PPCDebugInterface::disasm(unsigned int address, char *dest, int max_size)
{
+ // Memory::ReadUnchecked_U32 seemed to crash on shutdown
+ if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
+
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{
if (Memory::IsRAMAddress(address, true))
diff --git a/Source/Core/Core/Src/Host.h b/Source/Core/Core/Src/Host.h
index 40ea0680f7..17d866650d 100644
--- a/Source/Core/Core/Src/Host.h
+++ b/Source/Core/Core/Src/Host.h
@@ -36,6 +36,7 @@
// The host can be just a command line app that opens a window, or a full blown debugger
// interface.
+void Host_Message(int Id);
void Host_UpdateMainFrame();
void Host_UpdateDisasmDialog();
void Host_UpdateLogDisplay();
diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp
index 82da44bcf0..da2b296811 100644
--- a/Source/Core/Core/Src/PluginManager.cpp
+++ b/Source/Core/Core/Src/PluginManager.cpp
@@ -36,10 +36,12 @@
#include "ConfigManager.h"
#include "LogManager.h"
#include "Core.h"
+#include "Host.h"
#include "FileSearch.h" // Common
#include "FileUtil.h"
#include "StringUtil.h"
+#include "MemoryUtil.h"
#include "Setup.h"
// Create the plugin manager class
@@ -182,9 +184,8 @@ void CPluginManager::ShutdownPlugins()
if (m_dsp)
{
m_dsp->Shutdown();
- // With this option, this is done on boot instead
- delete m_dsp;
- m_dsp = NULL;
+ FreeDSP();
+ NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(false, "Audio shutdown").c_str());
}
}
@@ -193,9 +194,8 @@ void CPluginManager::ShutdownVideoPlugin()
if (m_video)
{
m_video->Shutdown();
- // With this option, this is done on boot instead
- delete m_video;
- m_video = NULL;
+ FreeVideo();
+ NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(false, "Video shutdown").c_str());
}
}
@@ -443,12 +443,16 @@ Common::PluginVideo *CPluginManager::GetVideo()
// the plugins in turn
void CPluginManager::FreeVideo()
{
+ //Host_Message(VIDEO_DESTROY);
+ WARN_LOG(CONSOLE, "%s", Core::StopMessage(false, "Will unload video DLL").c_str());
delete m_video;
m_video = NULL;
}
void CPluginManager::FreeDSP()
{
+ //Host_Message(AUDIO_DESTROY);
+ WARN_LOG(CONSOLE, "%s", Core::StopMessage(false, "Will unload audio DLL").c_str());
delete m_dsp;
m_dsp = NULL;
}
diff --git a/Source/Core/DebuggerUICommon/Src/CodeView.cpp b/Source/Core/DebuggerUICommon/Src/CodeView.cpp
index 64e28a25f7..ad7d0780ec 100644
--- a/Source/Core/DebuggerUICommon/Src/CodeView.cpp
+++ b/Source/Core/DebuggerUICommon/Src/CodeView.cpp
@@ -460,6 +460,7 @@ void CCodeView::OnPaint(wxPaintEvent& event)
dc.SetTextForeground(_T("#000000"));
}
+ // If running
if (debugger->isAlive())
{
char dis[256];
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index bb06ddaa19..5d1000fc76 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -123,8 +123,8 @@ EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
// Menu tooltips
//EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
-/* Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
- and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL */
+// Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
+// and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL
//EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
// Toolbar
@@ -136,25 +136,25 @@ EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
-
// Other
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
-EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
+//EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
-EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
+//EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
END_EVENT_TABLE()
// Class
-CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *ParentObject, wxWindow* parent,
+CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent,
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
- : wxPanel(parent, id, position, size, style, name)
- , Parent(ParentObject)
+ : wxPanel((wxWindow*)parent, id, position, size, style, name)
+ , Parent(parent)
+ , codeview(NULL)
, m_RegisterWindow(NULL)
, m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL)
@@ -163,10 +163,6 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter);
- // Create the toolbar
- //RecreateToolbar();
- // Update bitmap buttons
- //UpdateButtonStates();
// Connect keyboard
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN,
@@ -201,6 +197,8 @@ void CCodeWindow::OnKeyDown(wxKeyEvent& event)
void CCodeWindow::OnHostMessage(wxCommandEvent& event)
{
+ return;
+
switch (event.GetId())
{
case IDM_NOTIFYMAPLOADED:
@@ -295,7 +293,6 @@ void CCodeWindow::JumpToAddress(u32 _Address)
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
{
- //PanicAlert("boo");
UpdateLists();
}
@@ -391,6 +388,10 @@ void CCodeWindow::UpdateLists()
void CCodeWindow::UpdateCallstack()
{
+ return;
+ //if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
+ //if (Core::GetState() == Core::CORE_STOPPING) return;
+
callstack->Clear();
std::vector stack;
@@ -410,9 +411,7 @@ void CCodeWindow::UpdateCallstack()
}
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
-{
- //CreateMenu(_LocalCoreStartupParameter);
-
+{
// Configure the code window
wxBoxSizer* sizerBig = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* sizerLeft = new wxBoxSizer(wxVERTICAL);
@@ -679,13 +678,17 @@ void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
void CCodeWindow::Update()
{
+ return;
+
+ if (!codeview) return;
+
codeview->Refresh();
UpdateCallstack();
UpdateButtonStates();
/* DO NOT Automatically show the current PC position when a breakpoint is hit or
when we pause SINCE THIS CAN BE CALLED AT OTHER TIMES TOO */
- // codeview->Center(PC);
+ //codeview->Center(PC);
}
void CCodeWindow::UpdateButtonStates()
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h
index 43777edce7..897d63553b 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.h
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.h
@@ -44,8 +44,8 @@ class CCodeWindow
{
public:
- CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *,
- wxWindow* parent,
+ CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
+ CFrame * parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
diff --git a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp
index fe599e1ccf..4f05ade5e3 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindowFunctions.cpp
@@ -386,6 +386,8 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
void CCodeWindow::NotifyMapLoaded()
{
+ if (!codeview) return;
+
g_symbolDB.FillInCallers();
//symbols->Show(false); // hide it for faster filling
symbols->Freeze(); // HyperIris: wx style fast filling
@@ -455,6 +457,7 @@ void CCodeWindow::OpenPages()
}
void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{
+ event.Skip();
Parent->DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
}
void CCodeWindow::OnToggleCodeWindow(bool _Show, int i)
@@ -552,108 +555,137 @@ Notice: This windows docking for plugin windows will produce several wx debuggin
//Toggle Sound Debugging Window
void CCodeWindow::OnToggleSoundWindow(bool _Show, int i)
{
- // ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
+#ifdef _WIN32
+ // ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
if (_Show)
{
if (Parent->GetNotebookCount() == 0) return;
if (i < 0 || i > Parent->GetNotebookCount()-1) i = 0;
- #ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
- {
- #endif
- //Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str());
- CPluginManager::GetInstance().OpenDebug(
- Parent->GetHandle(),
- //GetHandle(),
- SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
- PLUGIN_TYPE_DSP, true // DSP, show
- );
- #ifdef _WIN32
- }
-
+ CPluginManager::GetInstance().OpenDebug(
+ Parent->GetHandle(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
+ PLUGIN_TYPE_DSP, true // DSP, show
+ );
+
Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
{
Win->SetName(wxT("Sound"));
Win->Reparent(Parent);
- Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
- //Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
- //Parent->ListChildren();
- //Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win %i\n", FindWindowByName(wxT("Sound"))).c_str());
+ Win->SetId(IDM_SOUNDWINDOW);
+ Parent->GetNotebookFromId(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile);
}
else
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win not found\n").c_str());
}
- #endif
+
}
- else // hide
- {
- #ifdef _WIN32
+ else
+ {
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
- {
+ {
Parent->DoRemovePage(Win, false);
- //Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound removed from NB (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
+ //Win->Reparent(NULL);
+
+ // Destroy
+ CPluginManager::GetInstance().OpenDebug(
+ GetHandle(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
+ PLUGIN_TYPE_DSP, false
+ );
+
+ //WARN_LOG(CONSOLE, "Sound removed from NB");
}
else
{
- //Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound not found (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
+ //WARN_LOG(CONSOLE, "Sound not found (Win %i)", FindWindowByName(wxT("Sound")));
}
- #endif
- // Close the sound dll that has an open debugger
+ }
+
+#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
);
}
+#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;
- #ifdef _WIN32
+
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
+ Win->SetId(IDM_VIDEOWINDOW);
if (Win && Parent->GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
- {
- #endif
- // 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
- );
- #ifdef _WIN32
- }
+ // 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 );
- #endif
}
else // hide
{
- #ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Video"));
- Parent->DoRemovePage (Win, false);
- #endif
- // Close the video dll that has an open debugger
- CPluginManager::GetInstance().OpenDebug(
- GetHandle(),
- SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
- PLUGIN_TYPE_VIDEO, false // Video, hide
- );
+ 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
}
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp
index 60d6039e8e..1eeb0ec928 100644
--- a/Source/Core/DolphinWX/Src/Frame.cpp
+++ b/Source/Core/DolphinWX/Src/Frame.cpp
@@ -159,7 +159,7 @@ int abc = 0;
// Stop
case OPENGL_WM_USER_STOP:
main_frame->DoStop();
- return 0; // Don't bother letting wxWidgets process this at all
+ return 0;
case OPENGL_WM_USER_CREATE:
// We don't have a local setting for bRenderToMain but we can detect it this way instead
@@ -349,10 +349,10 @@ CFrame::CFrame(wxFrame* parent,
// Debugger class
if (UseDebugger)
{
- g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this, IDM_CODEWINDOW);
+ g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
g_pCodeWindow->Hide();
g_pCodeWindow->Load();
- }
+ }
// Create timer
#if wxUSE_TIMER
@@ -396,7 +396,7 @@ CFrame::CFrame(wxFrame* parent,
TOOLBAR_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_TEXT | wxAUI_TB_OVERFLOW /*overflow visible*/;
wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
- if (UseDebugger)
+ if (g_pCodeWindow)
{
m_Mgr->AddPane(m_Panel, wxAuiPaneInfo().Name(wxT("Pane 0")).Caption(wxT("Pane 0")).Show());
}
@@ -407,7 +407,7 @@ CFrame::CFrame(wxFrame* parent,
}
// Setup perspectives
- if (UseDebugger)
+ if (g_pCodeWindow)
{
m_Mgr->GetPane(wxT("Pane 0")).CenterPane().PaneBorder(false);
AuiFullscreen = m_Mgr->SavePerspective();
@@ -427,7 +427,7 @@ CFrame::CFrame(wxFrame* parent,
CPluginManager::GetInstance().ScanForPlugins();
// Setup perspectives
- if (UseDebugger)
+ if (g_pCodeWindow)
{
// Load perspective
SaveLocal();
@@ -441,7 +441,7 @@ CFrame::CFrame(wxFrame* parent,
// Show window
Show();
- if (!UseDebugger)
+ if (!g_pCodeWindow)
{
SetSimplePaneSize();
if (SConfig::GetInstance().m_InterfaceLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
@@ -461,6 +461,10 @@ CFrame::CFrame(wxFrame* parent,
// -------------------------
// Connect event handlers
+ wxTheApp->Connect(wxID_ANY, wxEVT_SIZE, // Keyboard
+ wxSizeEventHandler(CFrame::OnResizeAll),
+ (wxObject*)0, this);
+
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
wxKeyEventHandler(CFrame::OnKeyDown),
(wxObject*)0, this);
@@ -524,7 +528,7 @@ void CFrame::OnRestart(wxCommandEvent& WXUNUSED (event))
char Str[MAX_PATH + 1];
DWORD Size = sizeof(Str)/sizeof(char);
DWORD n = GetModuleFileNameA(NULL, Str, Size);
- ShellExecuteA(NULL, "open", PathToFilename(*new std::string(Str)).c_str(), UseDebugger ? "" : "-d", NULL, SW_SHOW);
+ ShellExecuteA(NULL, "open", PathToFilename(*new std::string(Str)).c_str(), g_pCodeWindow ? "" : "-d", NULL, SW_SHOW);
#endif
Close(true);
@@ -538,8 +542,8 @@ void CFrame::OnClose(wxCloseEvent& event)
// Don't forget the skip or the window won't be destroyed
event.Skip();
// Save GUI settings
- if (UseDebugger) g_pCodeWindow->Save();
- if (UseDebugger) Save();
+ if (g_pCodeWindow) g_pCodeWindow->Save();
+ if (g_pCodeWindow) Save();
// Uninit
m_Mgr->UnInit();
@@ -575,6 +579,18 @@ void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event);
}
+void CFrame::OnResize(wxSizeEvent& event)
+{
+ event.Skip();
+
+ DoMoveIcons(); // In FrameWiimote.cpp
+}
+void CFrame::OnResizeAll(wxSizeEvent& event)
+{
+ event.Skip();
+ //wxWindow * Win = (wxWindow*)event.GetEventObject();
+ //NOTICE_LOG(CONSOLE, "OnResizeAll: %i", (HWND)Win->GetHWND());
+}
// Host messages
@@ -590,10 +606,8 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
case SC_MONITORPOWER:
return 0;
}
- default:
- // Let wxWidgets process it as normal
- return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
+ return wxFrame::MSWWindowProc(nMsg, wParam, lParam);
}
#endif
@@ -614,6 +628,37 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
}
}
+void CFrame::OnCustomHostMessage(int Id)
+{
+ wxWindow *Win;
+
+ switch(Id)
+ {
+ // Destroy windows
+ case AUDIO_DESTROY:
+ Win = GetWxWindow(wxT("Sound"));
+ if (Win)
+ {
+ DoRemovePage(Win, false);
+
+ CPluginManager::GetInstance().OpenDebug(
+ GetHandle(),
+ SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
+ PLUGIN_TYPE_DSP, false
+ );
+
+ //Win->Reparent(NULL);
+ //g_pCodeWindow->OnToggleSoundWindow(false, 0);
+ GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false);
+ NOTICE_LOG(CONSOLE, "%s", Core::StopMessage(true, "Sound debugging window closed").c_str());
+ }
+ break;
+
+ case VIDEO_DESTROY:
+ break;
+ }
+}
+
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
{
// Show all platforms and regions if...
@@ -790,9 +835,7 @@ void CFrame::Update()
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow * Child)
{
- //NOTICE_LOG(CONSOLE, "CreateParentFrame: %i %s %i", Id, Title.mb_str(), Child->GetId())
-
- wxFrame * Frame = new wxFrame(this, Id, Title);
+ wxFrame * Frame = new wxFrame(this, Id, Title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
Child->Reparent(Frame);
Child->Show();
@@ -921,4 +964,26 @@ void CFrame::ListChildren()
}
Console->Log(LogTypes::LNOTICE, "--------------------------------------------------------------------\n");
+}
+
+void CFrame::ListTopWindows()
+{
+ wxWindowList::const_iterator i;
+ int j = 0;
+ const wxWindowList::const_iterator end = wxTopLevelWindows.end();
+
+ for (i = wxTopLevelWindows.begin(); i != end; ++i)
+ {
+ wxTopLevelWindow * const Win = wx_static_cast(wxTopLevelWindow *, *i);
+ NOTICE_LOG(CONSOLE, "%i: %i %s", j, Win, Win->GetTitle().mb_str());
+ /*
+ if ( win->ShouldPreventAppExit() )
+ {
+ // there remains at least one important TLW, don't exit
+ return false;
+ }
+ */
+ j++;
+ }
+ NOTICE_LOG(CONSOLE, "\n");
}
\ No newline at end of file
diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h
index b335411182..a22c516ef6 100644
--- a/Source/Core/DolphinWX/Src/Frame.h
+++ b/Source/Core/DolphinWX/Src/Frame.h
@@ -81,6 +81,7 @@ class CFrame : public wxFrame
void PostUpdateUIEvent(wxUpdateUIEvent& event);
void StatusBarMessage(char * Text, ...);
void ClearStatusBar();
+ void OnCustomHostMessage(int Id);
// ---------------------------------------
// Wiimote leds
@@ -122,6 +123,8 @@ class CFrame : public wxFrame
int Limit(int,int,int);
int PercentageToPixels(int,int);
int PixelsToPercentage(int,int);
+ void ListChildren();
+ void ListTopWindows();
// Perspectives
void AddRemoveBlankPage();
@@ -131,7 +134,6 @@ class CFrame : public wxFrame
void OnFloatWindow(wxCommandEvent& event);
void OnTab(wxAuiNotebookEvent& event);
int GetNootebookAffiliation(wxString Name);
- void ListChildren();
void ClosePages();
void DoToggleWindow(int,bool);
void ShowAllNotebooks(bool Window = false);
@@ -285,6 +287,7 @@ class CFrame : public wxFrame
void OnToggleThrottle(wxCommandEvent& event);
void OnManagerResize(wxAuiManagerEvent& event);
void OnResize(wxSizeEvent& event);
+ void OnResizeAll(wxSizeEvent& event);
void OnToggleToolbar(wxCommandEvent& event);
void DoToggleToolbar(bool);
void OnToggleStatusbar(wxCommandEvent& event);
diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp
index 0a1ba29251..cac8cc5933 100644
--- a/Source/Core/DolphinWX/Src/FrameAui.cpp
+++ b/Source/Core/DolphinWX/Src/FrameAui.cpp
@@ -64,13 +64,6 @@ void CFrame::OnManagerResize(wxAuiManagerEvent& event)
event.Skip();
ResizeConsole();
}
-void CFrame::OnResize(wxSizeEvent& event)
-{
- event.Skip();
- // fit frame content, not needed right now
- //FitInside();
- DoMoveIcons(); // In FrameWiimote.cpp
-}
void CFrame::OnPaneClose(wxAuiManagerEvent& event)
{
@@ -127,7 +120,7 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
}
// Hide pane
- if (!UseDebugger) HidePane();
+ if (!g_pCodeWindow) HidePane();
// Make sure the check is updated (if wxw isn't calling this func)
//GetMenuBar()->FindItem(IDM_LOGWINDOW)->Check(Show);
@@ -181,7 +174,7 @@ void CFrame::ToggleConsole(bool bShow, int i)
}
// Hide pane
- if (!UseDebugger) HidePane();
+ if (!g_pCodeWindow) HidePane();
// Make sure the check is updated (if wxw isn't calling this func)
//GetMenuBar()->FindItem(IDM_CONSOLEWINDOW)->Check(Show);
@@ -209,11 +202,11 @@ void CFrame::DoToggleWindow(int Id, bool bShow)
{
switch (Id)
{
- case IDM_LOGWINDOW: ToggleLogWindow(bShow, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break;
- case IDM_CONSOLEWINDOW: ToggleConsole(bShow, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break;
+ case IDM_LOGWINDOW: ToggleLogWindow(bShow, g_pCodeWindow ? g_pCodeWindow->iLogWindow : 0); break;
+ case IDM_CONSOLEWINDOW: ToggleConsole(bShow, g_pCodeWindow ? g_pCodeWindow->iConsoleWindow : 0); break;
}
- if (!UseDebugger) return;
+ if (!g_pCodeWindow) return;
switch (Id)
{
@@ -229,7 +222,7 @@ void CFrame::DoToggleWindow(int Id, bool bShow)
void CFrame::OnNotebookPageChanged(wxAuiNotebookEvent& event)
{
event.Skip();
- if (!UseDebugger) return;
+ if (!g_pCodeWindow) return;
// Remove the blank page if any
AddRemoveBlankPage();
@@ -270,11 +263,11 @@ void CFrame::OnFloatWindow(wxCommandEvent& event)
}
switch(event.GetId())
{
- case IDM_FLOAT_LOGWINDOW: if (FindWindowById(IDM_LOGWINDOW)) DoUnfloatPage(IDM_LOGWINDOW); break;
- case IDM_FLOAT_CONSOLEWINDOW: if (FindWindowById(IDM_CONSOLEWINDOW)) DoUnfloatPage(IDM_CONSOLEWINDOW); break;
+ case IDM_FLOAT_LOGWINDOW: if (FindWindowById(IDM_LOGWINDOW)) DoUnfloatPage(IDM_LOGWINDOW_PARENT); break;
+ case IDM_FLOAT_CONSOLEWINDOW: if (FindWindowById(IDM_CONSOLEWINDOW)) DoUnfloatPage(IDM_CONSOLEWINDOW_PARENT); break;
}
- if (!UseDebugger) return;
+ if (!g_pCodeWindow) return;
switch(event.GetId())
{
@@ -286,17 +279,17 @@ void CFrame::OnFloatWindow(wxCommandEvent& event)
}
switch(event.GetId())
{
- case IDM_FLOAT_CODEWINDOW: if (FindWindowById(IDM_CODEWINDOW)) DoUnfloatPage(IDM_LOGWINDOW); break;
- case IDM_FLOAT_REGISTERWINDOW: if (FindWindowById(IDM_REGISTERWINDOW)) DoUnfloatPage(IDM_REGISTERWINDOW); break;
- case IDM_FLOAT_BREAKPOINTWINDOW: if (FindWindowById(IDM_BREAKPOINTWINDOW)) DoUnfloatPage(IDM_BREAKPOINTWINDOW); break;
- case IDM_FLOAT_MEMORYWINDOW: if (FindWindowById(IDM_MEMORYWINDOW)) DoUnfloatPage(IDM_MEMORYWINDOW); break;
- case IDM_FLOAT_JITWINDOW: if (FindWindowById(IDM_JITWINDOW)) DoUnfloatPage(IDM_JITWINDOW); break;
+ case IDM_FLOAT_CODEWINDOW: if (FindWindowById(IDM_CODEWINDOW)) DoUnfloatPage(IDM_LOGWINDOW_PARENT); break;
+ case IDM_FLOAT_REGISTERWINDOW: if (FindWindowById(IDM_REGISTERWINDOW)) DoUnfloatPage(IDM_REGISTERWINDOW_PARENT); break;
+ case IDM_FLOAT_BREAKPOINTWINDOW: if (FindWindowById(IDM_BREAKPOINTWINDOW)) DoUnfloatPage(IDM_BREAKPOINTWINDOW_PARENT); break;
+ case IDM_FLOAT_MEMORYWINDOW: if (FindWindowById(IDM_MEMORYWINDOW)) DoUnfloatPage(IDM_MEMORYWINDOW_PARENT); break;
+ case IDM_FLOAT_JITWINDOW: if (FindWindowById(IDM_JITWINDOW)) DoUnfloatPage(IDM_JITWINDOW_PARENT); break;
}
}
void CFrame::OnTab(wxAuiNotebookEvent& event)
{
event.Skip();
- if (!UseDebugger) return;
+ if (!g_pCodeWindow) return;
// Create the popup menu
wxMenu MenuPopup;
@@ -416,11 +409,12 @@ void CFrame::DoRemovePage(wxWindow * Win, bool _Hide)
//wxASSERT(Win != NULL);
if (!Win) return;
- if (FindWindowById(WindowParentIdFromChildId(Win->GetId())))
+ if (Win->GetId() > 0 && FindWindowById(WindowParentIdFromChildId(Win->GetId())))
{
Win->Reparent(this);
Win->Hide();
FindWindowById(WindowParentIdFromChildId(Win->GetId()))->Destroy();
+ WARN_LOG(CONSOLE, "Floating window %i closed", Win->GetId());
}
else
{
@@ -916,10 +910,10 @@ void CFrame::ReloadPanes()
// Restore settings
SConfig::GetInstance().m_InterfaceConsole = bConsole;
// Load GUI settings
- g_pCodeWindow->Load();
+ if (g_pCodeWindow) g_pCodeWindow->Load();
// Open notebook pages
AddRemoveBlankPage();
- g_pCodeWindow->OpenPages();
+ if (g_pCodeWindow) g_pCodeWindow->OpenPages();
if (SConfig::GetInstance().m_InterfaceLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
@@ -1274,13 +1268,13 @@ wxAuiNotebook * CFrame::GetNotebookFromId(u32 NBId)
}
return NULL;
}
-void CFrame::ShowAllNotebooks(bool Window)
+void CFrame::ShowAllNotebooks(bool bShow)
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
- if (Window)
+ if (bShow)
m_Mgr->GetAllPanes().Item(i).Show();
else
m_Mgr->GetAllPanes().Item(i).window->Hide();
diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp
index b99e3d8d88..a3b07f13da 100644
--- a/Source/Core/DolphinWX/Src/FrameTools.cpp
+++ b/Source/Core/DolphinWX/Src/FrameTools.cpp
@@ -119,7 +119,7 @@ void CFrame::CreateMenu()
fileMenu->AppendSeparator();
fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs..."));
fileMenu->AppendSeparator();
- fileMenu->Append(IDM_RESTART, UseDebugger ? _T("Restart in regular mode") : _T("Restart in debugging mode"));
+ fileMenu->Append(IDM_RESTART, g_pCodeWindow ? _T("Restart in regular mode") : _T("Restart in debugging mode"));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt+F4"));
m_MenuBar->Append(fileMenu, _T("&File"));
@@ -174,7 +174,7 @@ void CFrame::CreateMenu()
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote Settings"));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
- if (UseDebugger)
+ if (g_pCodeWindow)
{
pOptionsMenu->AppendSeparator();
g_pCodeWindow->CreateMenuOptions(NULL, pOptionsMenu);
@@ -210,7 +210,7 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_CONSOLEWINDOW, SConfig::GetInstance().m_InterfaceConsole);
viewMenu->AppendSeparator();
- if (UseDebugger)
+ if (g_pCodeWindow)
{
g_pCodeWindow->CreateMenuView(NULL, viewMenu);
viewMenu->AppendSeparator();
@@ -234,7 +234,7 @@ void CFrame::CreateMenu()
viewMenu->Append(IDM_PURGECACHE, _T("Purge Cache"));
m_MenuBar->Append(viewMenu, _T("&View"));
- if (UseDebugger) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
+ if (g_pCodeWindow) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
// Help menu
wxMenu* helpMenu = new wxMenu;
@@ -276,7 +276,7 @@ void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar)
ToolBar->AddTool(IDM_CONFIG_DSP_PLUGIN, _T("DSP"), m_Bitmaps[Toolbar_PluginDSP], _T("DSP settings"));
ToolBar->AddTool(IDM_CONFIG_PAD_PLUGIN, _T("Pad"), m_Bitmaps[Toolbar_PluginPAD], _T("Pad settings"));
ToolBar->AddTool(IDM_CONFIG_WIIMOTE_PLUGIN, _T("Wiimote"), m_Bitmaps[Toolbar_Wiimote], _T("Wiimote settings"));
- if (!UseDebugger)
+ if (!g_pCodeWindow)
{
ToolBar->AddSeparator();
ToolBar->AddTool(IDM_HELPABOUT, _T("About"), m_Bitmaps[Toolbar_Help], _T("About Dolphin"));
@@ -313,7 +313,7 @@ void CFrame::RecreateToolbar()
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
- if (UseDebugger)
+ if (g_pCodeWindow)
{
m_ToolBarDebug = new wxAuiToolBar(this, ID_TOOLBAR_DEBUG, wxDefaultPosition, wxDefaultSize, TOOLBAR_STYLE);
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
@@ -859,45 +859,45 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
void CFrame::UpdateGUI()
{
// Save status
- bool initialized = Core::isRunning();
- bool running = Core::GetState() == Core::CORE_RUN;
- bool paused = Core::GetState() == Core::CORE_PAUSE;
+ bool Initialized = Core::isRunning();
+ bool Running = Core::GetState() == Core::CORE_RUN;
+ bool Paused = Core::GetState() == Core::CORE_PAUSE;
// Make sure that we have a toolbar
if (m_ToolBar != NULL)
{
// Enable/disable the Config and Stop buttons
//GetToolBar()->EnableTool(IDM_CONFIG_MAIN, !initialized);
- m_ToolBar->EnableTool(wxID_OPEN, !initialized);
- m_ToolBar->EnableTool(wxID_REFRESH, !initialized); // Don't allow refresh when we don't show the list
- m_ToolBar->EnableTool(IDM_STOP, running || paused);
- m_ToolBar->EnableTool(IDM_SCREENSHOT, running || paused);
+ m_ToolBar->EnableTool(wxID_OPEN, !Initialized);
+ m_ToolBar->EnableTool(wxID_REFRESH, !Initialized); // Don't allow refresh when we don't show the list
+ m_ToolBar->EnableTool(IDM_STOP, Running || Paused);
+ m_ToolBar->EnableTool(IDM_SCREENSHOT, Running || Paused);
}
// File
- GetMenuBar()->FindItem(wxID_OPEN)->Enable(!initialized);
- m_pSubMenuDrive->Enable(!initialized);
- GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!initialized);
- GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!initialized);
+ GetMenuBar()->FindItem(wxID_OPEN)->Enable(!Initialized);
+ m_pSubMenuDrive->Enable(!Initialized);
+ GetMenuBar()->FindItem(wxID_REFRESH)->Enable(!Initialized);
+ GetMenuBar()->FindItem(IDM_BROWSE)->Enable(!Initialized);
// Emulation
- GetMenuBar()->FindItem(IDM_STOP)->Enable(running || paused);
- GetMenuBar()->FindItem(IDM_RECORD)->Enable(!initialized);
- GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!initialized);
- GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(running || paused);
- GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(running || paused);
- m_pSubMenuLoad->Enable(initialized);
- m_pSubMenuSave->Enable(initialized);
+ GetMenuBar()->FindItem(IDM_STOP)->Enable(Running || Paused);
+ GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Initialized);
+ GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
+ GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
+ GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
+ m_pSubMenuLoad->Enable(Initialized);
+ m_pSubMenuSave->Enable(Initialized);
// Let's enable it by default.
//m_pSubMenuFrameSkipping->Enable(initialized);
// Misc
- GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(initialized);
+ GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized);
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid())
- GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!initialized);
+ GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
- if (running)
+ if (Running)
{
if (m_ToolBar != NULL)
{
@@ -919,12 +919,13 @@ void CFrame::UpdateGUI()
}
- if (!initialized)
+ if (!Initialized)
{
if (m_GameListCtrl)
{
if (!m_GameListCtrl->IsShown())
{
+ m_GameListCtrl->Reparent(m_Panel);
m_GameListCtrl->Enable();
m_GameListCtrl->Show();
sizerPanel->FitInside(m_Panel);
@@ -945,7 +946,7 @@ void CFrame::UpdateGUI()
// Commit changes to toolbar
if (m_ToolBar != NULL) m_ToolBar->Realize();
- if (UseDebugger) g_pCodeWindow->Update();
+ if (g_pCodeWindow) g_pCodeWindow->Update();
// Commit changes to manager
m_Mgr->Update();
}
@@ -1005,13 +1006,13 @@ void CFrame::DoToggleToolbar(bool _show)
if (_show)
{
m_Mgr->GetPane(wxT("TBMain")).Show();
- if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show(); }
+ if (g_pCodeWindow) { m_Mgr->GetPane(wxT("TBDebug")).Show(); m_Mgr->GetPane(wxT("TBAui")).Show(); }
m_Mgr->Update();
}
else
{
m_Mgr->GetPane(wxT("TBMain")).Hide();
- if (UseDebugger) { m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide(); }
+ if (g_pCodeWindow) { m_Mgr->GetPane(wxT("TBDebug")).Hide(); m_Mgr->GetPane(wxT("TBAui")).Hide(); }
m_Mgr->Update();
}
}
diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp
index 24d33c6271..8b44d65b51 100644
--- a/Source/Core/DolphinWX/Src/Main.cpp
+++ b/Source/Core/DolphinWX/Src/Main.cpp
@@ -371,7 +371,7 @@ bool DolphinApp::OnInit()
}
/* If we have selected Automatic Start, start the default ISO, or if no default
ISO exists, start the last loaded ISO */
- else if (UseDebugger)
+ else if (main_frame->g_pCodeWindow)
{
if (main_frame->g_pCodeWindow->AutomaticStart())
{
@@ -436,6 +436,11 @@ CFrame* DolphinApp::GetCFrame()
return main_frame;
}
+void Host_Message(int Id)
+{
+ main_frame->OnCustomHostMessage(Id);
+}
+
// OK, this thread boundary is DANGEROUS on linux
// wxPostEvent / wxAddPendingEvent is the solution.
void Host_NotifyMapLoaded()
diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp
index 761154181c..6e487c721e 100644
--- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp
@@ -56,6 +56,7 @@ void Host_NotifyMapLoaded(){}
void Host_ShowJitResults(unsigned int address){}
+void Host_Message(int Id){}
void Host_UpdateLogDisplay(){}
diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h
index 94fb6d70ca..d1538090d7 100644
--- a/Source/PluginSpecs/PluginSpecs.h
+++ b/Source/PluginSpecs/PluginSpecs.h
@@ -18,8 +18,7 @@
-/* Plugin communication. I place this here rather in Common.h since these messages are only received
- at one place, by the CPanel in Frame.cpp. That way I don't have to rebuild if any of this is changed */
+/* Plugin communication. I place this here rather in Common.h to rebuild less if any of this is changed */
// -----------------
enum PLUGIN_COMM
{
@@ -27,10 +26,12 @@ enum PLUGIN_COMM
OPENGL_WM_USER_STOP = 10,
OPENGL_WM_USER_CREATE,
OPENGL_WM_USER_KEYDOWN,
+ OPENGL_VIDEO_STOP,
+ VIDEO_DESTROY, // The video debugging window was destroyed
+ AUDIO_DESTROY, // The audio debugging window was destroyed
NJOY_RELOAD, // Reload nJoy if DirectInput has failed
WIIMOTE_RECONNECT, // Reconnect the Wiimote if it has disconnected
- INPUT_FRAME_COUNTER, // Wind back the frame counter for rerecording
- OPENGL_VIDEO_STOP
+ INPUT_FRAME_COUNTER // Wind back the frame counter for rerecording
};
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
index 9bf8c123ee..da0e09ce9e 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/Debugger/Debugger.cpp
@@ -89,6 +89,9 @@ DSPDebuggerHLE::DSPDebuggerHLE(wxWindow *parent, wxWindowID id, const wxString &
, upd93(false)
, upd92(false)
{
+ // Confirm parenting
+ //this->Reparent(parent);
+
CreateGUIControls();
// load ini...
@@ -144,17 +147,18 @@ DSPDebuggerHLE::DSPDebuggerHLE(wxWindow *parent, wxWindowID id, const wxString &
DSPDebuggerHLE::~DSPDebuggerHLE()
{
+ /*
// empty
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
+ */
// Reset
m_DebuggerFrame = NULL;
// Talk
- ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
- Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound closed\n").c_str());
+ NOTICE_LOG(CONSOLE, "Stop [Sound]\t\tDSPDebuggerHLE destroyed");
}
// ====================
@@ -162,15 +166,21 @@ DSPDebuggerHLE::~DSPDebuggerHLE()
// ========================================================================
// System functions
// --------------
-void DSPDebuggerHLE::OnClose(wxCloseEvent& /*event*/)
+void DSPDebuggerHLE::OnClose(wxCloseEvent& event)
{
- // Save the window position when we hide the window to
+ //PanicAlert("OnClose");
+ //event.Skip();
+
+ // Save the window position
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
- EndModal(0);
+ //EndModal(0);
+ //Close(true);
+ //Destroy();
+ delete this;
}
void DSPDebuggerHLE::OnUpdate(wxCommandEvent& /*event*/)
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
index 19aaae8fd0..edea3fb0be 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_AX.cpp
@@ -157,6 +157,7 @@ if(m_DebuggerFrame->ScanMails)
void CUCode_AX::SaveMail(bool Wii, u32 _uMail)
{
#if defined(HAVE_WX) && HAVE_WX
+if (!m_DebuggerFrame) return;
if(m_DebuggerFrame->ScanMails)
{
int i = 0;
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
index d8656e6575..a500296b1c 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp
@@ -139,13 +139,17 @@ wxWindow* GetParentedWxWindow(HWND Parent)
void DllDebugger(HWND _hParent, bool Show)
{
#if defined(HAVE_WX) && HAVE_WX
- if (!m_DebuggerFrame)
- m_DebuggerFrame = new DSPDebuggerHLE(GetParentedWxWindow(_hParent));
-
if (Show)
+ {
+ if (!m_DebuggerFrame)
+ m_DebuggerFrame = new DSPDebuggerHLE(NULL);
+ //m_DebuggerFrame = new DSPDebuggerHLE(GetParentedWxWindow(_hParent));
m_DebuggerFrame->Show();
+ }
else
- m_DebuggerFrame->Hide();
+ {
+ if (m_DebuggerFrame) m_DebuggerFrame->Close();
+ }
#endif
}
@@ -229,6 +233,7 @@ void Shutdown()
#if defined(HAVE_WX) && HAVE_WX
// Reset mails
+ /*
if (m_DebuggerFrame)
{
sMailLog.clear();
@@ -236,8 +241,8 @@ void Shutdown()
m_DebuggerFrame->sMail.clear();
m_DebuggerFrame->sMailEnd.clear();
}
-#endif
-
+ */
+#endif
}
void DoState(unsigned char **ptr, int mode)
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.cpp
index 5c8800639e..b2819eafcb 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Debugger/Debugger.cpp
@@ -46,6 +46,7 @@ GFXDebuggerOGL::GFXDebuggerOGL(wxWindow *parent, wxWindowID id, const wxString &
GFXDebuggerOGL::~GFXDebuggerOGL()
{
SaveSettings();
+ NOTICE_LOG(CONSOLE, "Stop [Video Thread]: Closing OpenGL debugging window");
}
void GFXDebuggerOGL::OnClose(wxCloseEvent& event)
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
index 48942096b2..fc0d830001 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp
@@ -146,7 +146,7 @@ namespace EmuWindow
{
HWND m_hWnd = NULL; // The new window that is created here
-HWND m_hParent = NULL; // The main CPanel or the main wxFrame
+HWND m_hParent = NULL; // The main CPanel
HINSTANCE m_hInstance = NULL;
WNDCLASSEX wndClass;