pcsx2-gui: Disable recording shortcuts on any GS panel close, even from pausing or shutting down

Now that there's a reason for it, enable the call to the CloseGSPanel function (although it still won't delete the panel).

pcsx2-gui: Remove input recording keybinds when tools are disabled


recording: Log "Recording" > "Input Recording" consistency
This commit is contained in:
sonicfind 2020-09-24 00:39:46 -05:00 committed by refractionpcsx2
parent 0df056ac61
commit 329a1ae59d
6 changed files with 26 additions and 18 deletions

View File

@ -363,7 +363,7 @@ bool AppCorePlugins::OpenPlugin_GS()
void AppCorePlugins::ClosePlugin_GS()
{
_parent::ClosePlugin_GS();
if( CloseViewportWithPlugins && GetMTGS().IsSelf() && GSopen2 ) sApp.CloseGsPanel();
if( GetMTGS().IsSelf() && GSopen2 ) sApp.CloseGsPanel();
}

View File

@ -1038,6 +1038,12 @@ void Pcsx2App::CloseGsPanel()
if (GSPanel* woot = gsFrame->GetViewport())
woot->Destroy();
}
#ifndef DISABLE_RECORDING
// Disable recording controls that only make sense if the game is running
sMainFrame.enableRecordingMenuItem(MenuId_Recording_FrameAdvance, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_TogglePause, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_ToggleRecordingMode, false);
#endif
}
void Pcsx2App::OnGsFrameClosed( wxWindowID id )
@ -1052,15 +1058,6 @@ void Pcsx2App::OnGsFrameClosed( wxWindowID id )
// right now there's no way to resume from suspend without GUI.
PrepForExit();
}
#ifndef DISABLE_RECORDING
else
{
// Disable recording controls that only make sense if the game is running
sMainFrame.enableRecordingMenuItem(MenuId_Recording_FrameAdvance, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_TogglePause, false);
sMainFrame.enableRecordingMenuItem(MenuId_Recording_ToggleRecordingMode, false);
}
#endif
}
void Pcsx2App::OnProgramLogClosed( wxWindowID id )

View File

@ -142,7 +142,14 @@ void GSPanel::InitRecordingAccelerators()
m_Accels->findKeycodeWithCommandId("InputRecordingModeToggle").toTitleizedString(),
g_InputRecording.IsActive());
recordingConLog(L"Initialized Recording Key Bindings\n");
recordingConLog(L"Initialized Input Recording Key Bindings\n");
}
void GSPanel::RemoveRecordingAccelerators()
{
m_Accels.reset(new AcceleratorDictionary);
InitDefaultAccelerators();
recordingConLog(L"Disabled Input Recording Key Bindings\n");
}
#endif

View File

@ -59,6 +59,7 @@ public:
wxString GetAssociatedKeyCode(const char* id);
#ifndef DISABLE_RECORDING
void InitRecordingAccelerators();
void RemoveRecordingAccelerators();
#endif
protected:

View File

@ -796,13 +796,15 @@ void MainEmuFrame::AppendKeycodeNamesToMenuOptions() {
}
#ifndef DISABLE_RECORDING
void MainEmuFrame::initializeRecordingMenuItem(MenuIdentifiers menuId, wxString keyCodeStr, bool enable) {
void MainEmuFrame::initializeRecordingMenuItem(MenuIdentifiers menuId, wxString keyCodeStr, bool enable)
{
wxMenuItem& item = *m_menuRecording.FindChildItem(menuId);
wxString text = item.GetItemLabel();
const size_t tabPos = text.rfind(L'\t');
item.SetItemLabel(text.Mid(0, tabPos ) + L"\t" + keyCodeStr);
item.SetItemLabel(text.Mid(0, tabPos) + L"\t" + keyCodeStr);
item.Enable(enable);
}
void MainEmuFrame::enableRecordingMenuItem(MenuIdentifiers menuId, bool enable)
{
wxMenuItem& item = *m_menuRecording.FindChildItem(menuId);

View File

@ -562,6 +562,7 @@ void MainEmuFrame::Menu_EnableRecordingTools_Click(wxCommandEvent& event)
if (checked)
{
GetMenuBar()->Insert(TopLevelMenu_InputRecording, &m_menuRecording, _("&Input Record"));
SysConsole.recordingConsole.Enabled = true;
// Enable Recording Keybindings
if (GSFrame* gsFrame = wxGetApp().GetGsFramePtr())
{
@ -584,15 +585,15 @@ void MainEmuFrame::Menu_EnableRecordingTools_Click(wxCommandEvent& event)
{
if (GSPanel* viewport = gsFrame->GetViewport())
{
viewport->InitDefaultAccelerators();
viewport->RemoveRecordingAccelerators();
}
}
SysConsole.recordingConsole.Enabled = false;
if (g_InputRecordingControls.IsPaused())
g_InputRecordingControls.Resume();
}
g_Conf->EmuOptions.EnableRecordingTools = checked;
SysConsole.recordingConsole.Enabled = checked;
// Enable Recording Logs
ConsoleLogFrame* progLog = wxGetApp().GetProgramLog();
progLog->UpdateLogList();
@ -978,19 +979,19 @@ void MainEmuFrame::Menu_Recording_Stop_Click(wxCommandEvent &event)
void MainEmuFrame::Menu_Recording_TogglePause_Click(wxCommandEvent& event)
{
if (g_Conf->EmuOptions.EnableRecordingTools)
g_RecordingControls.TogglePause();
g_InputRecordingControls.TogglePause();
}
void MainEmuFrame::Menu_Recording_FrameAdvance_Click(wxCommandEvent& event)
{
if (g_Conf->EmuOptions.EnableRecordingTools)
g_RecordingControls.FrameAdvance();
g_InputRecordingControls.FrameAdvance();
}
void MainEmuFrame::Menu_Recording_ToggleRecordingMode_Click(wxCommandEvent& event)
{
if (g_Conf->EmuOptions.EnableRecordingTools)
g_InputRecording.RecordModeToggle();
g_InputRecordingControls.RecordModeToggle();
}
void MainEmuFrame::Menu_Recording_VirtualPad_Open_Click(wxCommandEvent& event)