[Debugger] Detach Debugger from UI class

This commit is contained in:
zilmar 2018-01-10 18:05:57 +11:00
parent 57ac4c0607
commit ea1e0efbef
9 changed files with 58 additions and 53 deletions

View File

@ -12,6 +12,16 @@
__interface CDebugger
{
virtual void OpenCommandWindow(void) = 0;
virtual void OpenMemoryWindow(void) = 0;
virtual void OpenMemoryDump(void) = 0;
virtual void OpenMemorySearch(void) = 0;
virtual void OpenTLBWindow(void) = 0;
virtual void OpenScriptsWindow(void) = 0;
virtual void OpenSymbolsWindow(void) = 0;
virtual void OpenDMALogWindow(void) = 0;
virtual void OpenStackTraceWindow(void) = 0;
virtual void OpenStackViewWindow(void) = 0;
virtual void TLBChanged(void) = 0;
virtual bool CPUStepStarted(void) = 0;
virtual void CPUStep(void) = 0;

View File

@ -1141,7 +1141,7 @@ LRESULT CDebugCommandsView::OnViewPCButton(WORD /*wNotifyCode*/, WORD /*wID*/, H
LRESULT CDebugCommandsView::OnSymbolsButton(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hwnd*/, BOOL& /*bHandled*/)
{
m_Debugger->Debug_ShowSymbolsWindow();
m_Debugger->OpenSymbolsWindow();
return FALSE;
}

View File

@ -85,7 +85,7 @@ void CDebugScripts::ConsolePrint(const char* text)
void CDebugScripts::RefreshConsole()
{
m_Debugger->Debug_ShowScriptsWindow();
m_Debugger->OpenScriptsWindow();
CScriptSystem* scriptSystem = m_Debugger->ScriptSystem();
vector<char*>* logData = scriptSystem->LogData();

View File

@ -193,13 +193,13 @@ LRESULT CDebugMemoryView::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND, BOOL&
RefreshMemory(false);
break;
case IDC_DUMP_MEM:
m_Debugger->Debug_ShowMemoryDump();
m_Debugger->OpenMemoryDump();
break;
case IDC_SEARCH_MEM:
m_Debugger->Debug_ShowMemorySearch();
m_Debugger->OpenMemorySearch();
break;
case IDC_SYMBOLS_BTN:
m_Debugger->Debug_ShowSymbolsWindow();
m_Debugger->OpenSymbolsWindow();
break;
case IDCANCEL:
EndDialog(0);

View File

@ -157,7 +157,7 @@ void CDebuggerUI::Debug_Reset(void)
}
}
void CDebuggerUI::Debug_ShowMemoryDump()
void CDebuggerUI::OpenMemoryDump()
{
if (g_MMU == NULL)
{
@ -173,7 +173,7 @@ void CDebuggerUI::Debug_ShowMemoryDump()
}
}
void CDebuggerUI::Debug_ShowMemoryWindow(void)
void CDebuggerUI::OpenMemoryWindow(void)
{
if (g_MMU == NULL)
{
@ -191,14 +191,14 @@ void CDebuggerUI::Debug_ShowMemoryWindow(void)
void CDebuggerUI::Debug_ShowMemoryLocation(uint32_t Address, bool VAddr)
{
Debug_ShowMemoryWindow();
OpenMemoryWindow();
if (m_MemoryView)
{
m_MemoryView->ShowAddress(Address, VAddr);
}
}
void CDebuggerUI::Debug_ShowTLBWindow(void)
void CDebuggerUI::OpenTLBWindow(void)
{
if (g_MMU == NULL)
{
@ -222,7 +222,7 @@ void CDebuggerUI::Debug_RefreshTLBWindow(void)
}
}
void CDebuggerUI::Debug_ShowMemorySearch()
void CDebuggerUI::OpenMemorySearch()
{
if (m_MemorySearch == NULL)
{
@ -234,7 +234,7 @@ void CDebuggerUI::Debug_ShowMemorySearch()
}
}
void CDebuggerUI::Debug_ShowCommandsWindow()
void CDebuggerUI::OpenCommandWindow()
{
if (m_CommandsView == NULL)
{
@ -245,14 +245,14 @@ void CDebuggerUI::Debug_ShowCommandsWindow()
void CDebuggerUI::Debug_ShowCommandsLocation(uint32_t address, bool top)
{
Debug_ShowCommandsWindow();
OpenCommandWindow();
if (m_CommandsView)
{
m_CommandsView->ShowAddress(address, top);
}
}
void CDebuggerUI::Debug_ShowScriptsWindow()
void CDebuggerUI::OpenScriptsWindow()
{
if (m_Scripts == NULL)
{
@ -285,7 +285,7 @@ void CDebuggerUI::Debug_ClearScriptsWindow()
}
}
void CDebuggerUI::Debug_ShowSymbolsWindow()
void CDebuggerUI::OpenSymbolsWindow()
{
if (m_Symbols == NULL)
{
@ -302,7 +302,7 @@ void CDebuggerUI::Debug_RefreshSymbolsWindow()
}
}
void CDebuggerUI::Debug_ShowDMALogWindow(void)
void CDebuggerUI::OpenDMALogWindow(void)
{
if (m_DMALogView == NULL)
{
@ -311,7 +311,7 @@ void CDebuggerUI::Debug_ShowDMALogWindow(void)
m_DMALogView->ShowWindow();
}
void CDebuggerUI::Debug_ShowStackTrace(void)
void CDebuggerUI::OpenStackTraceWindow(void)
{
if (m_StackTrace == NULL)
{
@ -320,7 +320,7 @@ void CDebuggerUI::Debug_ShowStackTrace(void)
m_StackTrace->ShowWindow();
}
void CDebuggerUI::Debug_ShowStackWindow(void)
void CDebuggerUI::OpenStackViewWindow(void)
{
if (m_StackView == NULL)
{

View File

@ -9,6 +9,7 @@
* *
****************************************************************************/
#pragma once
#include <Project64-core/Debugger.h>
class CDumpMemory;
class CDebugMemoryView;
@ -25,17 +26,14 @@ class CDMALog;
class CBreakpoints;
class CScriptSystem;
__interface CDebugger
{
virtual void TLBChanged(void) = 0;
virtual bool CPUStepStarted(void) = 0;
virtual void CPUStep(void) = 0;
virtual void FrameDrawn(void) = 0;
};
class CDebuggerUI :
public CDebugger
{
public:
CDebuggerUI();
~CDebuggerUI();
private:
CDumpMemory * m_MemoryDump;
CDebugMemoryView * m_MemoryView;
CDebugMemorySearch * m_MemorySearch;
@ -54,9 +52,6 @@ class CDebuggerUI :
void BreakpointHit(void);
protected:
CDebuggerUI();
virtual ~CDebuggerUI();
void TLBChanged(void);
bool CPUStepStarted(void);
void CPUStep(void);
@ -64,25 +59,25 @@ protected:
public:
void Debug_Reset(void);
void Debug_ShowMemoryDump(void);
void Debug_ShowMemoryWindow(void);
void OpenMemoryDump(void);
void OpenMemoryWindow(void);
void Debug_ShowMemoryLocation(uint32_t Address, bool VAddr);
void Debug_ShowMemorySearch(void);
void Debug_ShowTLBWindow(void);
void OpenMemorySearch(void);
void OpenTLBWindow(void);
void Debug_RefreshTLBWindow(void);
void Debug_ShowCommandsWindow(void);
void OpenCommandWindow(void);
void Debug_ShowCommandsLocation(uint32_t address, bool top);
void Debug_ShowScriptsWindow(void);
void OpenScriptsWindow(void);
void Debug_LogScriptsWindow(const char* text);
void Debug_ClearScriptsWindow(void);
void Debug_RefreshScriptsWindow(void);
void Debug_RefreshSymbolsWindow(void);
void Debug_ShowSymbolsWindow(void);
void Debug_ShowStackTrace(void);
void Debug_ShowStackWindow(void);
void OpenSymbolsWindow(void);
void OpenStackTraceWindow(void);
void OpenStackViewWindow(void);
void Debug_RefreshStackWindow(void);
void Debug_RefreshStackTraceWindow(void);
void Debug_ShowDMALogWindow(void);
void OpenDMALogWindow(void);
CBreakpoints* Breakpoints();
CDebugSymbols* Symbols();

View File

@ -496,22 +496,22 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
case ID_DEBUGGER_GENERATELOG:
g_Settings->SaveBool(Logging_GenerateLog, !g_Settings->LoadBool(Logging_GenerateLog));
break;
case ID_DEBUGGER_DUMPMEMORY: m_Gui->Debug_ShowMemoryDump(); break;
case ID_DEBUGGER_SEARCHMEMORY: m_Gui->Debug_ShowMemorySearch(); break;
case ID_DEBUGGER_MEMORY: m_Gui->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: m_Gui->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_DUMPMEMORY: g_Debugger->OpenMemoryDump(); break;
case ID_DEBUGGER_SEARCHMEMORY: g_Debugger->OpenMemorySearch(); break;
case ID_DEBUGGER_MEMORY: g_Debugger->OpenMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: g_Debugger->OpenTLBWindow(); break;
case ID_DEBUGGER_INTERRUPT_SP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
case ID_DEBUGGER_INTERRUPT_SI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
case ID_DEBUGGER_INTERRUPT_AI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;
case ID_DEBUGGER_INTERRUPT_VI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_VI); break;
case ID_DEBUGGER_INTERRUPT_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
case ID_DEBUGGER_BREAKPOINTS: m_Gui->Debug_ShowCommandsWindow(); break;
case ID_DEBUGGER_SCRIPTS: m_Gui->Debug_ShowScriptsWindow(); break;
case ID_DEBUGGER_SYMBOLS: m_Gui->Debug_ShowSymbolsWindow(); break;
case ID_DEBUGGER_DMALOG: m_Gui->Debug_ShowDMALogWindow(); break;
case ID_DEBUGGER_STACKTRACE: m_Gui->Debug_ShowStackTrace(); break;
case ID_DEBUGGER_STACKVIEW: m_Gui->Debug_ShowStackWindow(); break;
case ID_DEBUGGER_BREAKPOINTS: g_Debugger->OpenCommandWindow(); break;
case ID_DEBUGGER_SCRIPTS: g_Debugger->OpenScriptsWindow(); break;
case ID_DEBUGGER_SYMBOLS: g_Debugger->OpenSymbolsWindow(); break;
case ID_DEBUGGER_DMALOG: g_Debugger->OpenDMALogWindow(); break;
case ID_DEBUGGER_STACKTRACE: g_Debugger->OpenStackTraceWindow(); break;
case ID_DEBUGGER_STACKVIEW: g_Debugger->OpenStackViewWindow(); break;
case ID_CURRENT_SAVE_DEFAULT:
g_Notify->DisplayMessage(3, stdstr_f(GS(MENU_SLOT_SAVE), GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str()).c_str());
g_Settings->SaveDword(Game_CurrentSaveState, (DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));

View File

@ -33,7 +33,6 @@ enum
class CMainGui :
public RenderWindow,
public CRomBrowser,
public CDebuggerUI,
private CGuiSettings
{
enum { StatusBarID = 400 };

View File

@ -18,7 +18,8 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
WriteTrace(TraceUserInterface, TraceDebug, "Create Main Window");
CMainGui MainWindow(true, stdstr_f("Project64 %s", VER_FILE_VERSION_STR).c_str()), HiddenWindow(false);
CMainMenu MainMenu(&MainWindow);
g_Debugger = &MainWindow;
CDebuggerUI Debugger;
g_Debugger = &Debugger;
g_Plugins->SetRenderWindows(&MainWindow, &HiddenWindow);
Notify().SetMainWindow(&MainWindow);
CSupportWindow SupportWindow;