From cc7c410cf1f22b92dc7ab1725d095ae61c08d763 Mon Sep 17 00:00:00 2001 From: aldelaro5 Date: Fri, 30 Dec 2016 15:22:59 -0500 Subject: [PATCH] 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); };