From a4472134206906098e16fffc57eaf085ac93a9d2 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Fri, 30 Dec 2016 14:18:10 -0500 Subject: [PATCH 1/3] Remove the menu hotkeys of the debug menu bar I think it's best to remove these if we are going to be adding new hotkeys since these would work no matter what so I can simply make these the default one instead. --- Source/Core/DolphinWX/MainMenuBar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/DolphinWX/MainMenuBar.cpp b/Source/Core/DolphinWX/MainMenuBar.cpp index 679c6821b6..df46d67081 100644 --- a/Source/Core/DolphinWX/MainMenuBar.cpp +++ b/Source/Core/DolphinWX/MainMenuBar.cpp @@ -401,10 +401,10 @@ wxMenu* MainMenuBar::CreateDebugMenu() _("Disable docking of perspective panes to main window")); auto* const debug_menu = new wxMenu; - debug_menu->Append(IDM_STEP, _("Step &Into\tF11")); - debug_menu->Append(IDM_STEPOVER, _("Step &Over\tF10")); - debug_menu->Append(IDM_STEPOUT, _("Step O&ut\tSHIFT+F11")); - debug_menu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint\tF9")); + debug_menu->Append(IDM_STEP, _("Step &Into")); + debug_menu->Append(IDM_STEPOVER, _("Step &Over")); + debug_menu->Append(IDM_STEPOUT, _("Step O&ut")); + debug_menu->Append(IDM_TOGGLE_BREAKPOINT, _("Toggle &Breakpoint")); debug_menu->AppendSeparator(); debug_menu->AppendSubMenu(perspective_menu, _("Perspectives"), _("Edit Perspectives")); From 00e03f14361c5eefd3f81f1609cd8d44a10bcbe4 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Mon, 2 Jan 2017 15:39:02 -0500 Subject: [PATCH 2/3] Update the breakpoint list after an add from the parent Doing it from the add dialogs instead would prevent the call to these dialogs outside of a breakpointWindow which would be necessary for hotkeys binding. --- Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp | 6 ++---- Source/Core/DolphinWX/Debugger/BreakpointDlg.h | 4 +--- Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp | 10 ++++++++-- Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp | 7 +++---- Source/Core/DolphinWX/Debugger/MemoryCheckDlg.h | 4 +--- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp index b9d1bca401..db36092e62 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointDlg.cpp @@ -16,8 +16,7 @@ #include "DolphinWX/Debugger/BreakpointWindow.h" #include "DolphinWX/WxUtils.h" -BreakPointDlg::BreakPointDlg(CBreakPointWindow* _Parent) - : wxDialog(_Parent, wxID_ANY, _("Add Breakpoint")), Parent(_Parent) +BreakPointDlg::BreakPointDlg(wxWindow* _Parent) : wxDialog(_Parent, wxID_ANY, _("Add Breakpoint")) { Bind(wxEVT_BUTTON, &BreakPointDlg::OnOK, this, wxID_OK); @@ -42,8 +41,7 @@ void BreakPointDlg::OnOK(wxCommandEvent& event) if (AsciiToHex(WxStrToStr(AddressString), Address)) { PowerPC::breakpoints.Add(Address); - Parent->NotifyUpdate(); - Close(); + EndModal(wxID_OK); } else { diff --git a/Source/Core/DolphinWX/Debugger/BreakpointDlg.h b/Source/Core/DolphinWX/Debugger/BreakpointDlg.h index 6918f4d614..2b9a1f713e 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointDlg.h +++ b/Source/Core/DolphinWX/Debugger/BreakpointDlg.h @@ -6,16 +6,14 @@ #include -class CBreakPointWindow; class wxTextCtrl; class BreakPointDlg : public wxDialog { public: - BreakPointDlg(CBreakPointWindow* _Parent); + BreakPointDlg(wxWindow* _Parent); private: - CBreakPointWindow* Parent; wxTextCtrl* m_pEditAddress; void OnOK(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp index 5a1edf7117..7e83b4502e 100644 --- a/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp +++ b/Source/Core/DolphinWX/Debugger/BreakpointWindow.cpp @@ -146,13 +146,19 @@ void CBreakPointWindow::OnClear(wxCommandEvent& WXUNUSED(event)) void CBreakPointWindow::OnAddBreakPoint(wxCommandEvent& WXUNUSED(event)) { BreakPointDlg bpDlg(this); - bpDlg.ShowModal(); + if (bpDlg.ShowModal() == wxID_OK) + { + NotifyUpdate(); + } } void CBreakPointWindow::OnAddMemoryCheck(wxCommandEvent& WXUNUSED(event)) { MemoryCheckDlg memDlg(this); - memDlg.ShowModal(); + if (memDlg.ShowModal() == wxID_OK) + { + NotifyUpdate(); + } } void CBreakPointWindow::Event_SaveAll(wxCommandEvent& WXUNUSED(event)) diff --git a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp index 0cd16577c4..9d1ca0ca5c 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp +++ b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.cpp @@ -16,8 +16,8 @@ #include "DolphinWX/Debugger/MemoryCheckDlg.h" #include "DolphinWX/WxUtils.h" -MemoryCheckDlg::MemoryCheckDlg(CBreakPointWindow* parent) - : wxDialog(parent, wxID_ANY, _("Add a Memory Breakpoint")), m_parent(parent) +MemoryCheckDlg::MemoryCheckDlg(wxWindow* parent) + : wxDialog(parent, wxID_ANY, _("Add a Memory Breakpoint")) { Bind(wxEVT_BUTTON, &MemoryCheckDlg::OnOK, this, wxID_OK); Bind(wxEVT_RADIOBUTTON, &MemoryCheckDlg::OnRadioButtonClick, this); @@ -165,8 +165,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& event) MemCheck.Break = Break; PowerPC::memchecks.Add(MemCheck); - m_parent->NotifyUpdate(); - Close(); + EndModal(wxID_OK); } event.Skip(); diff --git a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.h b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.h index ca3357cf7f..f894155891 100644 --- a/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.h +++ b/Source/Core/DolphinWX/Debugger/MemoryCheckDlg.h @@ -6,7 +6,6 @@ #include -class CBreakPointWindow; class wxRadioButton; class wxStaticText; class wxTextCtrl; @@ -14,10 +13,9 @@ class wxTextCtrl; class MemoryCheckDlg : public wxDialog { public: - MemoryCheckDlg(CBreakPointWindow* parent); + MemoryCheckDlg(wxWindow* parent); private: - CBreakPointWindow* m_parent; wxStaticText* m_textAddress; wxStaticText* m_textStartAddress; wxStaticText* m_textEndAddress; From cc7c410cf1f22b92dc7ab1725d095ae61c08d763 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Fri, 30 Dec 2016 15:22:59 -0500 Subject: [PATCH 3/3] Add debugging hotkeys They are separated into 3 groups and will only be shown in the input config dialog if the emulator was in debug mode. --- Source/Core/Core/HotkeyManager.cpp | 19 ++++++ Source/Core/Core/HotkeyManager.h | 15 +++++ Source/Core/DolphinWX/Frame.cpp | 59 +++++++++++++++++++ Source/Core/DolphinWX/FrameTools.cpp | 2 +- .../DolphinWX/Input/HotkeyInputConfigDiag.cpp | 30 +++++++++- .../DolphinWX/Input/HotkeyInputConfigDiag.h | 2 +- 6 files changed, 123 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/HotkeyManager.cpp b/Source/Core/Core/HotkeyManager.cpp index f94408e536..2f0912d1fb 100644 --- a/Source/Core/Core/HotkeyManager.cpp +++ b/Source/Core/Core/HotkeyManager.cpp @@ -38,6 +38,18 @@ const std::string hotkey_labels[] = { _trans("Export Recording"), _trans("Read-only mode"), + _trans("Step Into"), + _trans("Step Over"), + _trans("Step Out"), + _trans("Skip"), + + _trans("Show PC"), + _trans("Set PC"), + + _trans("Toggle Breakpoint"), + _trans("Add a Breakpoint"), + _trans("Add a Memory Breakpoint"), + _trans("Press Sync Button"), _trans("Connect Wii Remote 1"), _trans("Connect Wii Remote 2"), @@ -223,6 +235,9 @@ const std::array groups_info = { {_trans("Emulation speed"), HK_DECREASE_EMULATION_SPEED, HK_TOGGLE_THROTTLE}, {_trans("Frame advance"), HK_FRAME_ADVANCE, HK_FRAME_ADVANCE_RESET_SPEED}, {_trans("Movie"), HK_START_RECORDING, HK_READ_ONLY_MODE}, + {_trans("Stepping"), HK_STEP, HK_SKIP}, + {_trans("Program Counter"), HK_SHOW_PC, HK_SET_PC}, + {_trans("Breakpoint"), HK_BP_TOGGLE, HK_MBP_ADD}, {_trans("Wii"), HK_TRIGGER_SYNC_BUTTON, HK_BALANCEBOARD_CONNECT}, {_trans("Graphics toggles"), HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES}, {_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR}, @@ -333,6 +348,10 @@ void HotkeyManager::LoadDefaults(const ControllerInterface& ciface) set_key_expression(HK_STOP, "Escape"); set_key_expression(HK_FULLSCREEN, ALT + " & Return"); #endif + set_key_expression(HK_STEP, NON + " & `F11`"); + set_key_expression(HK_STEP_OVER, NON + " & `F10`"); + set_key_expression(HK_STEP_OUT, SHIFT + " & `F11`"); + set_key_expression(HK_BP_TOGGLE, NON + " & `F9`"); set_key_expression(HK_SCREENSHOT, NON + " & `F9`"); set_key_expression(HK_WIIMOTE1_CONNECT, ALT + " & `F5`"); set_key_expression(HK_WIIMOTE2_CONNECT, ALT + " & `F6`"); diff --git a/Source/Core/Core/HotkeyManager.h b/Source/Core/Core/HotkeyManager.h index bd89cf44a8..da75cc4132 100644 --- a/Source/Core/Core/HotkeyManager.h +++ b/Source/Core/Core/HotkeyManager.h @@ -40,6 +40,18 @@ enum Hotkey HK_EXPORT_RECORDING, HK_READ_ONLY_MODE, + HK_STEP, + HK_STEP_OVER, + HK_STEP_OUT, + HK_SKIP, + + HK_SHOW_PC, + HK_SET_PC, + + HK_BP_TOGGLE, + HK_BP_ADD, + HK_MBP_ADD, + HK_TRIGGER_SYNC_BUTTON, HK_WIIMOTE1_CONNECT, HK_WIIMOTE2_CONNECT, @@ -139,6 +151,9 @@ enum HotkeyGroup : int HKGP_SPEED, HKGP_FRAME_ADVANCE, HKGP_MOVIE, + HKGP_STEPPING, + HKGP_PC, + HKGP_BREAKPOINT, HKGP_WII, HKGP_GRAPHICS_TOGGLES, HKGP_IR, diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index e4bd51fccc..e1b1a8b03c 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -52,7 +52,9 @@ #include "Core/State.h" #include "DolphinWX/Config/ConfigMain.h" +#include "DolphinWX/Debugger/BreakpointDlg.h" #include "DolphinWX/Debugger/CodeWindow.h" +#include "DolphinWX/Debugger/MemoryCheckDlg.h" #include "DolphinWX/GameListCtrl.h" #include "DolphinWX/Globals.h" #include "DolphinWX/LogWindow.h" @@ -1282,6 +1284,63 @@ void CFrame::ParseHotkeys() ->UpdateSyncButtonState(IsHotkey(HK_TRIGGER_SYNC_BUTTON, true)); } + if (UseDebugger) + { + if (IsHotkey(HK_STEP)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_STEP); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_STEP_OVER)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_STEPOVER); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_STEP_OUT)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_STEPOUT); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_SKIP)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_SKIP); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_SHOW_PC)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_GOTOPC); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_SET_PC)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_SETPC); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_BP_TOGGLE)) + { + wxCommandEvent evt(wxEVT_MENU, IDM_TOGGLE_BREAKPOINT); + GetEventHandler()->AddPendingEvent(evt); + } + if (IsHotkey(HK_BP_ADD)) + { + BreakPointDlg bpDlg(this); + if (bpDlg.ShowModal() == wxID_OK) + { + wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS); + g_pCodeWindow->GetEventHandler()->AddPendingEvent(evt); + } + } + if (IsHotkey(HK_MBP_ADD)) + { + MemoryCheckDlg memDlg(this); + if (memDlg.ShowModal() == wxID_OK) + { + wxCommandEvent evt(wxEVT_HOST_COMMAND, IDM_UPDATE_BREAKPOINTS); + g_pCodeWindow->GetEventHandler()->AddPendingEvent(evt); + } + } + } + // Wiimote connect and disconnect hotkeys int WiimoteId = -1; if (IsHotkey(HK_WIIMOTE1_CONNECT)) diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index 515785ac12..680e8d6db9 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1015,7 +1015,7 @@ void CFrame::OnConfigHotkey(wxCommandEvent& WXUNUSED(event)) HotkeyManagerEmu::Enable(false); - HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys")); + HotkeyInputConfigDialog m_ConfigFrame(this, *hotkey_plugin, _("Dolphin Hotkeys"), UseDebugger); m_ConfigFrame.ShowModal(); // Update references in case controllers were refreshed diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp index 419c1e28f0..fd2d2e2358 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.cpp @@ -11,8 +11,9 @@ enum HotkeyGroup : int; -HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* const parent, InputConfig& config, - const wxString& name, const int port_num) +HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* parent, InputConfig& config, + const wxString& name, bool using_debugger, + int port_num) : InputConfigDialog(parent, config, name, port_num) { const int space5 = FromDIP(5); @@ -68,6 +69,31 @@ HotkeyInputConfigDialog::HotkeyInputConfigDialog(wxWindow* const parent, InputCo // Frame advance is an example of a typical TAS tool. notebook->AddPage(tab_tas, _("TAS Tools")); + if (using_debugger) + { + // Debugging + auto* const tab_debugging = new wxPanel(notebook); + + auto* const group_box_steping = + new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_STEPPING), tab_debugging, this); + auto* const group_box_pc = + new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_PC), tab_debugging, this); + auto* const group_box_breakpoint = + new ControlGroupBox(HotkeyManagerEmu::GetHotkeyGroup(HKGP_BREAKPOINT), tab_debugging, this); + + auto* const szr_debugging = new wxBoxSizer(wxHORIZONTAL); + szr_debugging->AddSpacer(space5); + szr_debugging->Add(group_box_steping, 0, wxEXPAND | wxTOP, space5); + szr_debugging->AddSpacer(space5); + szr_debugging->Add(group_box_pc, 0, wxEXPAND | wxTOP, space5); + szr_debugging->AddSpacer(space5); + szr_debugging->Add(group_box_breakpoint, 0, wxEXPAND | wxTOP, space5); + szr_debugging->AddSpacer(space5); + + tab_debugging->SetSizerAndFit(szr_debugging); + + notebook->AddPage(tab_debugging, _("Debugging")); + } // WII and Wii Remote auto* const tab_wii = new wxPanel(notebook); diff --git a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h index 3a964b8d46..48fa2ddfd4 100644 --- a/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h +++ b/Source/Core/DolphinWX/Input/HotkeyInputConfigDiag.h @@ -10,5 +10,5 @@ class HotkeyInputConfigDialog final : public InputConfigDialog { public: HotkeyInputConfigDialog(wxWindow* parent, InputConfig& config, const wxString& name, - int port_num = 0); + bool using_debugger, int port_num = 0); };