diff --git a/bin/PCSX2_keys.ini.default b/bin/PCSX2_keys.ini.default index 739bcb5181..cf44b5a413 100644 --- a/bin/PCSX2_keys.ini.default +++ b/bin/PCSX2_keys.ini.default @@ -82,28 +82,30 @@ GSwindow_OffsetXplus = Alt-Ctrl-RIGHT GSwindow_OffsetReset = Alt-Ctrl-KP_DIVIDE # Recording Bindings +# Note - These are disabled if 'System > Enable Recording Tools' is disabled FrameAdvance = SPACE TogglePause = Shift-P InputRecordingModeToggle = Shift-R # Save State Management -States_SaveSlot0 = Shift-KP_1 -States_SaveSlot1 = Shift-KP_2 -States_SaveSlot2 = Shift-KP_3 -States_SaveSlot3 = Shift-KP_4 -States_SaveSlot4 = Shift-KP_5 -States_SaveSlot5 = Shift-KP_6 -States_SaveSlot6 = Shift-KP_7 -States_SaveSlot7 = Shift-KP_8 -States_SaveSlot8 = Shift-KP_9 -States_SaveSlot9 = Shift-KP_0 -States_LoadSlot0 = KP_1 -States_LoadSlot1 = KP_2 -States_LoadSlot2 = KP_3 -States_LoadSlot3 = KP_4 -States_LoadSlot4 = KP_5 -States_LoadSlot5 = KP_6 -States_LoadSlot6 = KP_7 -States_LoadSlot7 = KP_8 -States_LoadSlot8 = KP_9 -States_LoadSlot9 = KP_0 +# Note - These are disabled if 'System > Enable Recording Tools' is disabled +States_SaveSlot0 = Shift-KP_0 +States_SaveSlot1 = Shift-KP_1 +States_SaveSlot2 = Shift-KP_2 +States_SaveSlot3 = Shift-KP_3 +States_SaveSlot4 = Shift-KP_4 +States_SaveSlot5 = Shift-KP_5 +States_SaveSlot6 = Shift-KP_6 +States_SaveSlot7 = Shift-KP_7 +States_SaveSlot8 = Shift-KP_8 +States_SaveSlot9 = Shift-KP_9 +States_LoadSlot0 = KP_0 +States_LoadSlot1 = KP_1 +States_LoadSlot2 = KP_2 +States_LoadSlot3 = KP_3 +States_LoadSlot4 = KP_4 +States_LoadSlot5 = KP_5 +States_LoadSlot6 = KP_6 +States_LoadSlot7 = KP_7 +States_LoadSlot8 = KP_8 +States_LoadSlot9 = KP_9 diff --git a/pcsx2/gui/FrameForGS.cpp b/pcsx2/gui/FrameForGS.cpp index 5ed9bdfaa7..fa625be96e 100644 --- a/pcsx2/gui/FrameForGS.cpp +++ b/pcsx2/gui/FrameForGS.cpp @@ -85,8 +85,20 @@ void GSPanel::InitDefaultAccelerators() m_Accels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle" ); m_Accels->Map( FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL, "FullscreenToggle" ); +} #ifndef DISABLE_RECORDING +void GSPanel::InitRecordingAccelerators() +{ + // Note: these override GlobalAccels ( Pcsx2App::InitDefaultGlobalAccelerators() ) + // For plain letters or symbols, replace e.g. WXK_F1 with e.g. wxKeyCode('q') or wxKeyCode('-') + // For plain letter keys with shift, use e.g. AAC( wxKeyCode('q') ).Shift() and NOT wxKeyCode('Q') + // For a symbol with shift (e.g. '_' which is '-' with shift) use AAC( wxKeyCode('-') ).Shift() + + typedef KeyAcceleratorCode AAC; + + if (!m_Accels) m_Accels = std::unique_ptr(new AcceleratorDictionary); + m_Accels->Map(AAC(WXK_SPACE), "FrameAdvance"); m_Accels->Map(AAC(wxKeyCode('p')).Shift(), "TogglePause"); m_Accels->Map(AAC(wxKeyCode('r')).Shift(), "InputRecordingModeToggle"); @@ -111,9 +123,8 @@ void GSPanel::InitDefaultAccelerators() m_Accels->Map(AAC(WXK_NUMPAD7), "States_LoadSlot7"); m_Accels->Map(AAC(WXK_NUMPAD8), "States_LoadSlot8"); m_Accels->Map(AAC(WXK_NUMPAD9), "States_LoadSlot9"); -#endif - } +#endif GSPanel::GSPanel( wxWindow* parent ) : wxWindow() @@ -131,14 +142,9 @@ GSPanel::GSPanel( wxWindow* parent ) InitDefaultAccelerators(); #ifndef DISABLE_RECORDING - // Retrieving FrameAdvance Key - for (auto itr = m_Accels->begin(); itr != m_Accels->end(); ++itr) + if (g_Conf->EmuOptions.EnableRecordingTools) { - if (itr->second->Id == "FrameAdvance") - { - m_frameAdvanceKey = itr->first; - break; - } + InitRecordingAccelerators(); } #endif @@ -383,19 +389,6 @@ void GSPanel::OnKeyDownOrUp( wxKeyEvent& evt ) return; } -#ifndef DISABLE_RECORDING - if (g_Conf->EmuOptions.EnableRecordingTools) - { - // TODO-Recording: This is to allow for repeated frame-advance while holding the key - // However as per the explaination above, this event no longer seems to fire under normal - // circumstances - if (evt.GetKeyCode() == m_frameAdvanceKey) - { - return; - } - } -#endif - DirectKeyCommand( evt ); } diff --git a/pcsx2/gui/GSFrame.h b/pcsx2/gui/GSFrame.h index 5648236710..c474a25380 100644 --- a/pcsx2/gui/GSFrame.h +++ b/pcsx2/gui/GSFrame.h @@ -47,10 +47,6 @@ protected: bool m_HasFocus; bool m_coreRunning; -#ifndef DISABLE_RECORDING - int m_frameAdvanceKey; -#endif - public: GSPanel( wxWindow* parent ); virtual ~GSPanel(); @@ -59,10 +55,13 @@ public: void DoShowMouse(); void DirectKeyCommand( wxKeyEvent& evt ); void DirectKeyCommand( const KeyAcceleratorCode& kac ); + void InitDefaultAccelerators(); +#ifndef DISABLE_RECORDING + void InitRecordingAccelerators(); +#endif protected: void AppStatusEvent_OnSettingsApplied(); - void InitDefaultAccelerators(); void OnCloseWindow( wxCloseEvent& evt ); void OnResize(wxSizeEvent& event); diff --git a/pcsx2/gui/MainMenuClicks.cpp b/pcsx2/gui/MainMenuClicks.cpp index 6a53b0c0d6..e8161a666a 100644 --- a/pcsx2/gui/MainMenuClicks.cpp +++ b/pcsx2/gui/MainMenuClicks.cpp @@ -18,6 +18,7 @@ #include "App.h" #include "CDVD/CDVD.h" #include "GS.h" +#include "GSFrame.h" #include "ConsoleLogger.h" #include "MainFrame.h" @@ -513,16 +514,33 @@ void MainEmuFrame::Menu_EnableRecordingTools_Click(wxCommandEvent&) if (checked) { GetMenuBar()->Insert(TopLevelMenu_Recording, &m_menuRecording, _("&Recording")); + // Enable Recording Keybindings + if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr()) + { + if (GSPanel* viewport = gsFrame->GetViewport()) + { + viewport->InitRecordingAccelerators(); + } + } } else { GetMenuBar()->Remove(TopLevelMenu_Recording); // Always turn controller logs off, but never turn it on by default SysConsole.controlInfo.Enabled = checked; + // Return Keybindings Back to Normal + if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr()) + { + if (GSPanel* viewport = gsFrame->GetViewport()) + { + viewport->InitDefaultAccelerators(); + } + } } g_Conf->EmuOptions.EnableRecordingTools = checked; SysConsole.recordingConsole.Enabled = checked; + // Enable Recording Logs ConsoleLogFrame* progLog = wxGetApp().GetProgramLog(); progLog->UpdateLogList(); AppApplySettings();