Merge pull request #4595 from aldelaro5/add-debugger-hotkeys

Add debugger hotkeys
This commit is contained in:
Mat M 2017-01-05 14:33:10 -05:00 committed by GitHub
commit e7359f247b
12 changed files with 142 additions and 24 deletions

View File

@ -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"),
@ -224,6 +236,9 @@ const std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> 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},
@ -334,6 +349,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`");

View File

@ -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,
@ -140,6 +152,9 @@ enum HotkeyGroup : int
HKGP_SPEED,
HKGP_FRAME_ADVANCE,
HKGP_MOVIE,
HKGP_STEPPING,
HKGP_PC,
HKGP_BREAKPOINT,
HKGP_WII,
HKGP_GRAPHICS_TOGGLES,
HKGP_IR,

View File

@ -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
{

View File

@ -6,16 +6,14 @@
#include <wx/dialog.h>
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);

View File

@ -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))

View File

@ -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();

View File

@ -6,7 +6,6 @@
#include <wx/dialog.h>
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;

View File

@ -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))

View File

@ -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

View File

@ -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);

View File

@ -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);
};

View File

@ -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"));