mirror of https://github.com/PCSX2/pcsx2.git
recording: implementation for new keybindings
This commit is contained in:
parent
407224d29c
commit
bad3fa73f4
|
@ -24,7 +24,12 @@
|
|||
|
||||
#include "ConsoleLogger.h"
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
# include "Recording/InputRecording.h"
|
||||
#endif
|
||||
|
||||
#include <wx/utils.h>
|
||||
#include <wx/graphics.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
@ -80,6 +85,34 @@ void GSPanel::InitDefaultAccelerators()
|
|||
m_Accels->Map( AAC( WXK_F12 ), "Sys_RecordingToggle" );
|
||||
|
||||
m_Accels->Map( FULLSCREEN_TOGGLE_ACCELERATOR_GSPANEL, "FullscreenToggle" );
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
m_Accels->Map(AAC(WXK_SPACE), "FrameAdvance");
|
||||
m_Accels->Map(AAC(wxKeyCode('p')).Shift(), "TogglePause");
|
||||
m_Accels->Map(AAC(wxKeyCode('r')).Shift(), "InputRecordingModeToggle");
|
||||
|
||||
m_Accels->Map(AAC(WXK_NUMPAD0).Shift(), "States_SaveSlot0");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD1).Shift(), "States_SaveSlot1");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD2).Shift(), "States_SaveSlot2");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD3).Shift(), "States_SaveSlot3");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD4).Shift(), "States_SaveSlot4");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD5).Shift(), "States_SaveSlot5");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD6).Shift(), "States_SaveSlot6");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD7).Shift(), "States_SaveSlot7");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD8).Shift(), "States_SaveSlot8");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD9).Shift(), "States_SaveSlot9");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD0), "States_LoadSlot0");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD1), "States_LoadSlot1");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD2), "States_LoadSlot2");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD3), "States_LoadSlot3");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD4), "States_LoadSlot4");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD5), "States_LoadSlot5");
|
||||
m_Accels->Map(AAC(WXK_NUMPAD6), "States_LoadSlot6");
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
GSPanel::GSPanel( wxWindow* parent )
|
||||
|
@ -97,6 +130,16 @@ GSPanel::GSPanel( wxWindow* parent )
|
|||
|
||||
InitDefaultAccelerators();
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
// Retrieving FrameAdvance Key
|
||||
for (auto itr = m_Accels->begin(); itr != m_Accels->end(); ++itr) {
|
||||
if (itr->second->Id == "FrameAdvance") {
|
||||
m_frameAdvanceKey = itr->first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SetBackgroundColour(wxColour((unsigned long)0));
|
||||
if( g_Conf->GSWindow.AlwaysHideMouse )
|
||||
{
|
||||
|
@ -333,7 +376,22 @@ void GSPanel::OnKeyDownOrUp( wxKeyEvent& evt )
|
|||
evt.m_keyCode += (int)'a' - 'A';
|
||||
#endif
|
||||
|
||||
if( (PADopen != NULL) && CoreThread.IsOpen() ) return;
|
||||
if ((PADopen != NULL) && CoreThread.IsOpen())
|
||||
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 and I'm unsure if there is a place to put this logic
|
||||
if (evt.GetKeyCode() == m_frameAdvanceKey)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DirectKeyCommand( evt );
|
||||
}
|
||||
|
||||
|
@ -349,7 +407,7 @@ void GSPanel::DirectKeyCommand( const KeyAcceleratorCode& kac )
|
|||
|
||||
DbgCon.WriteLn( "(gsFrame) Invoking command: %s", cmd->Id );
|
||||
cmd->Invoke();
|
||||
|
||||
|
||||
if( cmd->AlsoApplyToGui && !g_ConfigPanelChanged)
|
||||
AppApplySettings();
|
||||
}
|
||||
|
@ -443,7 +501,9 @@ void GSPanel::OnLeftDclick(wxMouseEvent& evt)
|
|||
// --------------------------------------------------------------------------------------
|
||||
|
||||
static const uint TitleBarUpdateMs = 333;
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
static const uint TitleBarUpdateMsWhenRecording = 50;
|
||||
#endif
|
||||
|
||||
GSFrame::GSFrame( const wxString& title)
|
||||
: wxFrame(NULL, wxID_ANY, title, g_Conf->GSWindow.WindowPos)
|
||||
|
@ -505,7 +565,19 @@ bool GSFrame::ShowFullScreen(bool show, bool updateConfig)
|
|||
|
||||
void GSFrame::CoreThread_OnResumed()
|
||||
{
|
||||
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
|
||||
#ifndef DISABLE_RECORDING
|
||||
if (g_Conf->EmuOptions.EnableRecordingTools)
|
||||
{
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMsWhenRecording);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMs);
|
||||
}
|
||||
#else
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMs);
|
||||
#endif
|
||||
|
||||
if( !IsShown() ) Show();
|
||||
}
|
||||
|
||||
|
@ -540,8 +612,21 @@ bool GSFrame::Show( bool shown )
|
|||
gsPanel->DoResize();
|
||||
gsPanel->SetFocus();
|
||||
|
||||
if( !m_timer_UpdateTitle.IsRunning() )
|
||||
m_timer_UpdateTitle.Start( TitleBarUpdateMs );
|
||||
if (!m_timer_UpdateTitle.IsRunning())
|
||||
{
|
||||
#ifndef DISABLE_RECORDING
|
||||
if (g_Conf->EmuOptions.EnableRecordingTools)
|
||||
{
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMsWhenRecording);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMs);
|
||||
}
|
||||
#else
|
||||
m_timer_UpdateTitle.Start(TitleBarUpdateMs);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -573,7 +658,6 @@ GSPanel* GSFrame::GetViewport()
|
|||
return (GSPanel*)FindWindowById( m_id_gspanel );
|
||||
}
|
||||
|
||||
|
||||
void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
|
||||
{
|
||||
// Update the title only after the completion of at least a single Vsync, it's pointless to display the fps
|
||||
|
@ -640,8 +724,31 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
|
|||
const u64& smode2 = *(u64*)PS2GS_BASE(GS_SMODE2);
|
||||
wxString omodef = (smode2 & 2) ? templates.OutputFrame : templates.OutputField;
|
||||
wxString omodei = (smode2 & 1) ? templates.OutputInterlaced : templates.OutputProgressive;
|
||||
#ifndef DISABLE_RECORDING
|
||||
wxString title;
|
||||
wxString movieMode;
|
||||
switch (g_InputRecording.getModeState()) {
|
||||
case InputRecording::KEY_MOVIE_MODE::RECORD:
|
||||
movieMode = "Recording";
|
||||
title = templates.RecordingTemplate;
|
||||
break;
|
||||
case InputRecording::KEY_MOVIE_MODE::REPLAY:
|
||||
movieMode = "Replaying";
|
||||
title = templates.RecordingTemplate;
|
||||
break;
|
||||
case InputRecording::KEY_MOVIE_MODE::NONE:
|
||||
movieMode = "No movie";
|
||||
title = templates.TitleTemplate;
|
||||
break;
|
||||
}
|
||||
|
||||
title.Replace(L"${frame}", pxsFmt(L"%d", g_FrameCount));
|
||||
title.Replace(L"${maxFrame}", pxsFmt(L"%d", g_InputRecording.getInputRecordingData().getMaxFrame()));
|
||||
title.Replace(L"${mode}", movieMode);
|
||||
#else
|
||||
wxString title = templates.TitleTemplate;
|
||||
#endif
|
||||
|
||||
title.Replace(L"${slot}", pxsFmt(L"%d", States_GetCurrentSlot()));
|
||||
title.Replace(L"${limiter}", limiterStr);
|
||||
title.Replace(L"${speed}", pxsFmt(L"%3d%%", lround(percentage)));
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
|
||||
#include "AppCommon.h"
|
||||
#include "CpuUsageProvider.h"
|
||||
|
||||
#include "wx/dcbuffer.h"
|
||||
#include "wx/dcgraph.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
@ -47,14 +51,18 @@ protected:
|
|||
bool m_HasFocus;
|
||||
bool m_coreRunning;
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
int m_frameAdvanceKey;
|
||||
#endif
|
||||
|
||||
public:
|
||||
GSPanel( wxWindow* parent );
|
||||
virtual ~GSPanel();
|
||||
|
||||
void DoResize();
|
||||
virtual void DoResize();
|
||||
void DoShowMouse();
|
||||
void DirectKeyCommand( wxKeyEvent& evt );
|
||||
void DirectKeyCommand( const KeyAcceleratorCode& kac );
|
||||
virtual void DirectKeyCommand( const KeyAcceleratorCode& kac );
|
||||
|
||||
protected:
|
||||
void AppStatusEvent_OnSettingsApplied();
|
||||
|
@ -75,7 +83,6 @@ protected:
|
|||
void UpdateScreensaver();
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// GSFrame
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
|
@ -22,6 +22,11 @@
|
|||
#include "AppAccelerators.h"
|
||||
#include "AppSaveStates.h"
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
# include "Recording/RecordingControls.h"
|
||||
# include "Recording/InputRecording.h"
|
||||
#endif
|
||||
|
||||
// Various includes needed for dumping...
|
||||
#include "GS.h"
|
||||
#include "Dump.h"
|
||||
|
@ -458,6 +463,53 @@ namespace Implementations
|
|||
if( GSFrame* gsframe = wxGetApp().GetGsFramePtr() )
|
||||
gsframe->ShowFullScreen( !gsframe->IsFullScreen() );
|
||||
}
|
||||
#ifndef DISABLE_RECORDING
|
||||
void FrameAdvance()
|
||||
{
|
||||
if (g_Conf->EmuOptions.EnableRecordingTools)
|
||||
g_RecordingControls.FrameAdvance();
|
||||
}
|
||||
void TogglePause()
|
||||
{
|
||||
if (g_Conf->EmuOptions.EnableRecordingTools)
|
||||
g_RecordingControls.TogglePause();
|
||||
}
|
||||
void InputRecordingModeToggle()
|
||||
{
|
||||
if (g_Conf->EmuOptions.EnableRecordingTools)
|
||||
g_InputRecording.RecordModeToggle();
|
||||
}
|
||||
void States_SaveSlot(int slot)
|
||||
{
|
||||
States_SetCurrentSlot(slot);
|
||||
States_FreezeCurrentSlot();
|
||||
}
|
||||
void States_LoadSlot(int slot)
|
||||
{
|
||||
States_SetCurrentSlot(slot);
|
||||
States_DefrostCurrentSlot();
|
||||
}
|
||||
void States_SaveSlot0() { States_SaveSlot(0); }
|
||||
void States_SaveSlot1() { States_SaveSlot(1); }
|
||||
void States_SaveSlot2() { States_SaveSlot(2); }
|
||||
void States_SaveSlot3() { States_SaveSlot(3); }
|
||||
void States_SaveSlot4() { States_SaveSlot(4); }
|
||||
void States_SaveSlot5() { States_SaveSlot(5); }
|
||||
void States_SaveSlot6() { States_SaveSlot(6); }
|
||||
void States_SaveSlot7() { States_SaveSlot(7); }
|
||||
void States_SaveSlot8() { States_SaveSlot(8); }
|
||||
void States_SaveSlot9() { States_SaveSlot(9); }
|
||||
void States_LoadSlot0() { States_LoadSlot(0); }
|
||||
void States_LoadSlot1() { States_LoadSlot(1); }
|
||||
void States_LoadSlot2() { States_LoadSlot(2); }
|
||||
void States_LoadSlot3() { States_LoadSlot(3); }
|
||||
void States_LoadSlot4() { States_LoadSlot(4); }
|
||||
void States_LoadSlot5() { States_LoadSlot(5); }
|
||||
void States_LoadSlot6() { States_LoadSlot(6); }
|
||||
void States_LoadSlot7() { States_LoadSlot(7); }
|
||||
void States_LoadSlot8() { States_LoadSlot(8); }
|
||||
void States_LoadSlot9() { States_LoadSlot(9); }
|
||||
#endif
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -619,6 +671,31 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
|
|||
false,
|
||||
},
|
||||
|
||||
#ifndef DISABLE_RECORDING
|
||||
{ "FrameAdvance" , Implementations::FrameAdvance, NULL, NULL, false },
|
||||
{ "TogglePause" , Implementations::TogglePause, NULL, NULL, false },
|
||||
{ "InputRecordingModeToggle" , Implementations::InputRecordingModeToggle, NULL, NULL, false },
|
||||
{ "States_SaveSlot0" , Implementations::States_SaveSlot0, NULL, NULL, false },
|
||||
{ "States_SaveSlot1" , Implementations::States_SaveSlot1, NULL, NULL, false },
|
||||
{ "States_SaveSlot2" , Implementations::States_SaveSlot2, NULL, NULL, false },
|
||||
{ "States_SaveSlot3" , Implementations::States_SaveSlot3, NULL, NULL, false },
|
||||
{ "States_SaveSlot4" , Implementations::States_SaveSlot4, NULL, NULL, false },
|
||||
{ "States_SaveSlot5" , Implementations::States_SaveSlot5, NULL, NULL, false },
|
||||
{ "States_SaveSlot6" , Implementations::States_SaveSlot6, NULL, NULL, false },
|
||||
{ "States_SaveSlot7" , Implementations::States_SaveSlot7, NULL, NULL, false },
|
||||
{ "States_SaveSlot8" , Implementations::States_SaveSlot8, NULL, NULL, false },
|
||||
{ "States_SaveSlot9" , Implementations::States_SaveSlot9, NULL, NULL, false },
|
||||
{ "States_LoadSlot0" , Implementations::States_LoadSlot0, NULL, NULL, false },
|
||||
{ "States_LoadSlot1" , Implementations::States_LoadSlot1, NULL, NULL, false },
|
||||
{ "States_LoadSlot2" , Implementations::States_LoadSlot2, NULL, NULL, false },
|
||||
{ "States_LoadSlot3" , Implementations::States_LoadSlot3, NULL, NULL, false },
|
||||
{ "States_LoadSlot4" , Implementations::States_LoadSlot4, NULL, NULL, false },
|
||||
{ "States_LoadSlot5" , Implementations::States_LoadSlot5, NULL, NULL, false },
|
||||
{ "States_LoadSlot6" , Implementations::States_LoadSlot6, NULL, NULL, false },
|
||||
{ "States_LoadSlot7" , Implementations::States_LoadSlot7, NULL, NULL, false },
|
||||
{ "States_LoadSlot8" , Implementations::States_LoadSlot8, NULL, NULL, false },
|
||||
{ "States_LoadSlot9" , Implementations::States_LoadSlot9, NULL, NULL, false },
|
||||
#endif
|
||||
// Command Declarations terminator:
|
||||
// (must always be last in list!!)
|
||||
{ NULL }
|
||||
|
|
Loading…
Reference in New Issue