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.
This commit is contained in:
aldelaro5 2016-12-30 15:22:59 -05:00
parent 00e03f1436
commit cc7c410cf1
6 changed files with 123 additions and 4 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"),
@ -223,6 +235,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},
@ -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`");

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

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