gui:recording: All main window modifications and additions

This commit is contained in:
Tyler Wilding 2018-07-02 20:43:38 -04:00 committed by lightningterror
parent bad3fa73f4
commit e2e882e08b
7 changed files with 260 additions and 21 deletions

View File

@ -30,6 +30,12 @@
//Purely to make sure the saveslot define comes through. Remove if it gets removed.
#include "Saveslots.h"
#ifndef DISABLE_RECORDING
# include "Recording/InputRecordingEditor.h"
# include "Recording/VirtualPad.h"
# include "Recording/NewRecordingFrame.h"
#endif
class DisassemblyDialog;
#include "System.h"
@ -66,6 +72,19 @@ static const bool CloseViewportWithPlugins = false;
// All Menu Options for the Main Window! :D
// ------------------------------------------------------------------------
enum TopLevelMenuIndices
{
TopLevelMenu_System = 0,
TopLevelMenu_Cdvd,
TopLevelMenu_Config,
TopLevelMenu_Misc,
TopLevelMenu_Debug,
TopLevelMenu_Capture,
#ifndef DISABLE_RECORDING
TopLevelMenu_Recording,
#endif
};
enum MenuIdentifiers
{
// Main Menu Section
@ -105,14 +124,16 @@ enum MenuIdentifiers
MenuId_EnablePatches,
MenuId_EnableCheats,
MenuId_EnableWideScreenPatches,
MenuId_EnableRecordingTools,
MenuId_EnableLuaTools,
MenuId_EnableHostFs,
MenuId_State_Load,
MenuId_State_LoadOther,
MenuId_State_LoadFromFile,
MenuId_State_Load01, // first of many load slots
MenuId_State_LoadBackup = MenuId_State_Load01+20,
MenuId_State_Save,
MenuId_State_SaveOther,
MenuId_State_SaveToFile,
MenuId_State_Save01, // first of many save slots
MenuId_State_EndSlotSection = MenuId_State_Save01+20,
@ -160,6 +181,30 @@ enum MenuIdentifiers
MenuId_Debug_Logging, // dialog for selection additional log options
MenuId_Debug_CreateBlockdump,
MenuId_Config_ResetAll,
// Capture Subsection
MenuId_Capture_Video,
MenuId_Capture_Video_Record,
MenuId_Capture_Video_Stop,
MenuId_Capture_Screenshot,
MenuId_Capture_Screenshot_Screenshot,
MenuId_Capture_Screenshot_Screenshot_As,
#ifndef DISABLE_RECORDING
// Recording Subsection
MenuId_Recording_New,
MenuId_Recording_Play,
MenuId_Recording_Stop,
MenuId_Recording_Editor,
MenuId_Recording_VirtualPad_Port0,
MenuId_Recording_VirtualPad_Port1,
MenuId_Recording_Conversions,
MenuId_Recording_ConvertV2ToV3,
MenuId_Recording_ConvertV1_XToV2,
MenuId_Recording_ConvertV1ToV2,
MenuId_Recording_ConvertLegacy,
#endif
};
namespace Exception
@ -498,6 +543,12 @@ protected:
wxWindowID m_id_ProgramLogBox;
wxWindowID m_id_Disassembler;
#ifndef DISABLE_RECORDING
wxWindowID m_id_InputRecordingEditor;
wxWindowID m_id_VirtualPad[2];
wxWindowID m_id_NewRecordingFrame;
#endif
wxKeyEvent m_kevt;
public:
@ -522,6 +573,15 @@ public:
MainEmuFrame* GetMainFramePtr() const { return (MainEmuFrame*)wxWindow::FindWindowById( m_id_MainFrame ); }
DisassemblyDialog* GetDisassemblyPtr() const { return (DisassemblyDialog*)wxWindow::FindWindowById(m_id_Disassembler); }
#ifndef DISABLE_RECORDING
InputRecordingEditor * GetInputRecordingEditorPtr() const { return (InputRecordingEditor*)wxWindow::FindWindowById(m_id_InputRecordingEditor); }
VirtualPad * GetVirtualPadPtr(int port) const {
if (port < 0 || port > 1) return NULL; // TODO i believe this is always false, linter errors picked it up, double check
return (VirtualPad*)wxWindow::FindWindowById(m_id_VirtualPad[port]);
}
NewRecordingFrame * GetNewRecordingFramePtr() const { return (NewRecordingFrame*)wxWindow::FindWindowById(m_id_NewRecordingFrame); }
#endif
void enterDebugMode();
void leaveDebugMode();
void resetDebugger();
@ -619,6 +679,12 @@ protected:
void OpenWizardConsole();
void PadKeyDispatch( const keyEvent& ev );
#ifndef DISABLE_RECORDING
public:
void Recording_PadKeyDispatch(const keyEvent& ev) { PadKeyDispatch(ev); }
#endif
protected:
void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event) const;
void HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event);

View File

@ -939,6 +939,9 @@ AppConfig::UiTemplateOptions::UiTemplateOptions()
OutputInterlaced = L"Interlaced";
Paused = L"<PAUSED> ";
TitleTemplate = L"Slot: ${slot} | Speed: ${speed} (${vfps}) | ${videomode} | Limiter: ${limiter} | ${gsdx} | ${omodei} | ${cpuusage}";
#ifndef DISABLE_RECORDING
RecordingTemplate = L"Slot: ${slot} | Frame: ${frame}/${maxFrame} | Rec. Mode: ${mode} | Speed: ${speed} (${vfps}) | Limiter: ${limiter}";
#endif
}
void AppConfig::UiTemplateOptions::LoadSave(IniInterface& ini)
@ -955,6 +958,9 @@ void AppConfig::UiTemplateOptions::LoadSave(IniInterface& ini)
IniEntry(OutputInterlaced);
IniEntry(Paused);
IniEntry(TitleTemplate);
#ifndef DISABLE_RECORDING
IniEntry(RecordingTemplate);
#endif
}
int AppConfig::GetMaxPresetIndex()

View File

@ -263,6 +263,9 @@ public:
wxString OutputInterlaced;
wxString Paused;
wxString TitleTemplate;
#ifndef DISABLE_RECORDING
wxString RecordingTemplate;
#endif
};
public:

View File

@ -26,6 +26,10 @@
#include "Debugger/DisassemblyDialog.h"
#ifndef DISABLE_RECORDING
# include "Recording/VirtualPad.h"
#endif
#include <wx/cmdline.h>
#include <wx/intl.h>
#include <wx/stdpaths.h>
@ -72,6 +76,19 @@ void Pcsx2App::OpenMainFrame()
DisassemblyDialog* disassembly = new DisassemblyDialog( mainFrame );
m_id_Disassembler = disassembly->GetId();
#ifndef DISABLE_RECORDING
InputRecordingEditor* inputRecordingEditor = new InputRecordingEditor(mainFrame);
m_id_InputRecordingEditor = inputRecordingEditor->GetId();
VirtualPad* virtualPad0 = new VirtualPad(mainFrame, 0);
m_id_VirtualPad[0] = virtualPad0->GetId();
VirtualPad *virtualPad1 = new VirtualPad(mainFrame, 1);
m_id_VirtualPad[1] = virtualPad1->GetId();
NewRecordingFrame* newRecordingFrame = new NewRecordingFrame(mainFrame);
m_id_NewRecordingFrame = newRecordingFrame->GetId();
#endif
if (g_Conf->EmuOptions.Debugger.ShowDebuggerOnStart)
disassembly->Show();
@ -752,6 +769,9 @@ Pcsx2App::Pcsx2App()
m_id_GsFrame = wxID_ANY;
m_id_ProgramLogBox = wxID_ANY;
m_id_Disassembler = wxID_ANY;
#ifndef DISABLE_RECORDING
m_id_InputRecordingEditor = wxID_ANY;
#endif
m_ptr_ProgramLog = NULL;
SetAppName( L"PCSX2" );

View File

@ -31,6 +31,11 @@
#include "Debugger/DisassemblyDialog.h"
#ifndef DISABLE_RECORDING
# include "Recording/RecordingControls.h"
# include "Recording/InputRecording.h"
#endif
#include "Utilities/IniInterface.h"
#include "Utilities/AppTrait.h"
@ -607,7 +612,28 @@ void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent&
void Pcsx2App::HandleEvent(wxEvtHandler* handler, wxEventFunction func, wxEvent& event)
{
try {
try
{
#ifndef DISABLE_RECORDING
if (g_Conf->EmuOptions.EnableRecordingTools)
{
if (g_RecordingControls.isStop())
{
// While stopping, GSFrame key event also stops, so get key input from here
// Along with that, you can not use the shortcut keys set in GSFrame
if (PADkeyEvent != NULL)
{
// Acquire key information, possibly calling it only once per frame
const keyEvent* ev = PADkeyEvent();
if (ev != NULL)
{
sApp.Recording_PadKeyDispatch(*ev);
}
}
}
g_RecordingControls.StartCheck();
}
#endif
(handler->*func)(event);
}
// ----------------------------------------------------------------------------
@ -1030,6 +1056,13 @@ void Pcsx2App::OnProgramLogClosed( wxWindowID id )
void Pcsx2App::OnMainFrameClosed( wxWindowID id )
{
#ifndef DISABLE_RECORDING
if (g_Conf->EmuOptions.EnableRecordingTools)
{
g_InputRecording.Stop();
}
#endif
// Nothing threaded depends on the mainframe (yet) -- it all passes through the main wxApp
// message handler. But that might change in the future.
if( m_id_MainFrame != id ) return;

View File

@ -49,6 +49,7 @@ wxMenu* MainEmuFrame::MakeStatesSubMenu( int baseid, int loadBackupId ) const
m->Enable( false );
}
mnuSubstates->Append( baseid - 1, _("File...") );
return mnuSubstates;
}
@ -193,14 +194,17 @@ void MainEmuFrame::ConnectMenus()
Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStates_Click, this, MenuId_State_Load01 + 1, MenuId_State_Load01 + 10);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStates_Click, this, MenuId_State_LoadBackup);
//Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStateOther_Click, this, MenuId_State_LoadOther);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_LoadStateFromFile_Click, this, MenuId_State_LoadFromFile);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_SaveStates_Click, this, MenuId_State_Save01 + 1, MenuId_State_Save01 + 10);
//Bind(wxEVT_MENU, &MainEmuFrame::Menu_SaveStateOther_Click, this, MenuId_State_SaveOther);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_SaveStateToFile_Click, this, MenuId_State_SaveToFile);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableBackupStates_Click, this, MenuId_EnableBackupStates);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnablePatches_Click, this, MenuId_EnablePatches);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableCheats_Click, this, MenuId_EnableCheats);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableWideScreenPatches_Click, this, MenuId_EnableWideScreenPatches);
#ifndef DISABLE_RECORDING
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableRecordingTools_Click, this, MenuId_EnableRecordingTools);
#endif
Bind(wxEVT_MENU, &MainEmuFrame::Menu_EnableHostFs_Click, this, MenuId_EnableHostFs);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_SysShutdown_Click, this, MenuId_Sys_Shutdown);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Exit_Click, this, MenuId_Exit);
@ -239,6 +243,27 @@ void MainEmuFrame::ConnectMenus()
// Debug
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Debug_Open_Click, this, MenuId_Debug_Open);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Debug_Logging_Click, this, MenuId_Debug_Logging);
// Capture
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Record_Click, this, MenuId_Capture_Video_Record);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Video_Stop_Click, this, MenuId_Capture_Video_Stop);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_Click, this, MenuId_Capture_Screenshot_Screenshot);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Capture_Screenshot_Screenshot_As_Click, this, MenuId_Capture_Screenshot_Screenshot_As);
#ifndef DISABLE_RECORDING
// Recording
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_New_Click, this, MenuId_Recording_New);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_Play_Click, this, MenuId_Recording_Play);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_Stop_Click, this, MenuId_Recording_Stop);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_Editor_Click, this, MenuId_Recording_Editor);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_VirtualPad_Open_Click, this, MenuId_Recording_VirtualPad_Port0);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_VirtualPad_Open_Click, this, MenuId_Recording_VirtualPad_Port1);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_ConvertV2ToV3_Click, this, MenuId_Recording_ConvertV2ToV3);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_ConvertV1_XToV2_Click, this, MenuId_Recording_ConvertV1_XToV2);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_ConvertV1ToV2_Click, this, MenuId_Recording_ConvertV1ToV2);
Bind(wxEVT_MENU, &MainEmuFrame::Menu_Recording_ConvertLegacy_Click, this, MenuId_Recording_ConvertLegacy);
#endif
//Bind(wxEVT_MENU, &MainEmuFrame::Menu_Debug_MemoryDump_Click, this, MenuId_Debug_MemoryDump);
}
@ -319,7 +344,13 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
, m_menuConfig ( *new wxMenu() )
, m_menuMisc ( *new wxMenu() )
, m_menuDebug ( *new wxMenu() )
, m_menuCapture ( *new wxMenu() )
, m_submenuVideoCapture ( *new wxMenu() )
, m_submenuScreenshot ( *new wxMenu() )
#ifndef DISABLE_RECORDING
, m_menuRecording(*new wxMenu())
, m_submenuMovieConvert(*new wxMenu())
#endif
, m_LoadStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Load01, MenuId_State_LoadBackup ) )
, m_SaveStatesSubmenu( *MakeStatesSubMenu( MenuId_State_Save01 ) )
@ -343,9 +374,18 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
m_menubar.Append( &m_menuConfig, _("&Config") );
m_menubar.Append( &m_menuMisc, _("&Misc") );
m_menubar.Append( &m_menuDebug, _("&Debug") );
m_menubar.Append( &m_menuCapture, _("&Capture") );
SetMenuBar( &m_menubar );
#ifndef DISABLE_RECORDING
// Append the Recording / Lua options if previous enabled and picked up from ini
if (g_Conf->EmuOptions.EnableRecordingTools)
{
m_menubar.Append(&m_menuRecording, _("&Recording"));
}
#endif
// ------------------------------------------------------------------------
// The background logo and its window size are different on Windows. Use the
@ -437,6 +477,12 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
m_menuSys.Append(MenuId_EnableWideScreenPatches, _("Enable &Widescreen Patches"),
_("Enabling Widescreen Patches may occasionally cause issues."), wxITEM_CHECK);
#ifndef DISABLE_RECORDING
m_menuSys.Append(MenuId_EnableRecordingTools, _("Enable &Recording Tools"),
wxEmptyString, wxITEM_CHECK);
#endif
m_menuSys.AppendSeparator();
if(IsDebugBuild || IsDevBuild)
m_menuSys.Append(MenuId_EnableHostFs, _("Enable &Host Filesystem"),
wxEmptyString, wxITEM_CHECK);
@ -518,6 +564,34 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title)
#endif
m_menuDebug.AppendCheckItem(MenuId_Debug_CreateBlockdump, _("Create &Blockdump"), _("Creates a block dump for debugging purposes."));
// ------------------------------------------------------------------------
m_menuCapture.Append(MenuId_Capture_Video, _("Video"), &m_submenuVideoCapture);
m_submenuVideoCapture.Append(MenuId_Capture_Video_Record, _("Start Recording"));
m_submenuVideoCapture.Append(MenuId_Capture_Video_Stop, _("Stop Recording"))->Enable(false);
m_menuCapture.Append(MenuId_Capture_Screenshot, _("Screenshot"), &m_submenuScreenshot);
m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot, _("Screenshot"));
m_submenuScreenshot.Append(MenuId_Capture_Screenshot_Screenshot_As, _("Screenshot As..."));
// ------------------------------------------------------------------------
#ifndef DISABLE_RECORDING
m_menuRecording.Append(MenuId_Recording_New, _("New"));
m_menuRecording.Append(MenuId_Recording_Stop, _("Stop"))->Enable(false);
m_menuRecording.Append(MenuId_Recording_Play, _("Play"));
m_menuRecording.AppendSeparator();
m_menuRecording.Append(MenuId_Recording_Editor, _("Open Movie Editor"));
m_menuRecording.Append(MenuId_Recording_VirtualPad_Port0, _("Virtual Pad (Port 1)"));
m_menuRecording.Append(MenuId_Recording_VirtualPad_Port1, _("Virtual Pad (Port 2)"));
m_menuRecording.AppendSeparator();
m_menuRecording.Append(MenuId_Recording_Conversions, _("Movie File Conversions"), &m_submenuMovieConvert);
m_submenuMovieConvert.Append(MenuId_Recording_ConvertV2ToV3, _("Convert (v2.0 -> v3.0)"))->Enable(false); // TODO
m_submenuMovieConvert.Append(MenuId_Recording_ConvertV1_XToV2, _("Convert (v1.X -> v2.0)"));
m_submenuMovieConvert.Append(MenuId_Recording_ConvertV1ToV2, _("Convert (v1.0 -> v2.0)"))->Enable(false); // TODO
m_submenuMovieConvert.Append(MenuId_Recording_ConvertLegacy, _("Convert Legacy Movie (p2m -> p2m2)"));
#endif
m_MenuItem_Console.Check( g_Conf->ProgLogBox.Visible );
ConnectMenus();
@ -691,6 +765,9 @@ void MainEmuFrame::ApplyConfigToGui(AppConfig& configToApply, int flags)
menubar.Check( MenuId_EnableBackupStates, configToApply.EmuOptions.BackupSavestate );
menubar.Check( MenuId_EnableCheats, configToApply.EmuOptions.EnableCheats );
menubar.Check( MenuId_EnableWideScreenPatches, configToApply.EmuOptions.EnableWideScreenPatches );
#ifndef DISABLE_RECORDING
menubar.Check(MenuId_EnableRecordingTools, configToApply.EmuOptions.EnableRecordingTools);
#endif
menubar.Check( MenuId_EnableHostFs, configToApply.EmuOptions.HostFs );
menubar.Check( MenuId_Debug_CreateBlockdump, configToApply.EmuOptions.CdvdDumpBlocks );
#if defined(__unix__)

View File

@ -112,6 +112,15 @@ protected:
wxMenu& m_menuMisc;
wxMenu& m_menuDebug;
wxMenu& m_menuCapture;
wxMenu& m_submenuVideoCapture;
wxMenu& m_submenuScreenshot;
#ifndef DISABLE_RECORDING
wxMenu& m_menuRecording;
wxMenu& m_submenuMovieConvert;
#endif
wxMenu& m_LoadStatesSubmenu;
wxMenu& m_SaveStatesSubmenu;
@ -123,6 +132,10 @@ protected:
PerPluginMenuInfo m_PluginMenuPacks[PluginId_Count];
#ifndef DISABLE_RECORDING
bool m_capturingVideo;
#endif
virtual void DispatchEvent( const PluginEventType& plugin_evt );
virtual void DispatchEvent( const CoreThreadStatus& status );
virtual void AppStatusEvent_OnSettingsApplied();
@ -173,6 +186,9 @@ protected:
void Menu_EnablePatches_Click(wxCommandEvent &event);
void Menu_EnableCheats_Click(wxCommandEvent &event);
void Menu_EnableWideScreenPatches_Click(wxCommandEvent &event);
#ifndef DISABLE_RECORDING
void Menu_EnableRecordingTools_Click(wxCommandEvent &event);
#endif
void Menu_EnableHostFs_Click(wxCommandEvent &event);
void Menu_BootCdvd_Click(wxCommandEvent &event);
@ -181,8 +197,8 @@ protected:
void Menu_CdvdSource_Click(wxCommandEvent &event);
void Menu_LoadStates_Click(wxCommandEvent &event);
void Menu_SaveStates_Click(wxCommandEvent &event);
void Menu_LoadStateOther_Click(wxCommandEvent &event);
void Menu_SaveStateOther_Click(wxCommandEvent &event);
void Menu_LoadStateFromFile_Click(wxCommandEvent &event);
void Menu_SaveStateToFile_Click(wxCommandEvent &event);
void Menu_Exit_Click(wxCommandEvent &event);
void Menu_SuspendResume_Click(wxCommandEvent &event);
@ -203,6 +219,24 @@ protected:
void Menu_ShowConsole_Stdio(wxCommandEvent &event);
void Menu_ShowAboutBox(wxCommandEvent &event);
void Menu_Capture_Video_Record_Click(wxCommandEvent &event);
void Menu_Capture_Video_Stop_Click(wxCommandEvent &event);
void VideoCaptureUpdate();
void Menu_Capture_Screenshot_Screenshot_Click(wxCommandEvent &event);
void Menu_Capture_Screenshot_Screenshot_As_Click(wxCommandEvent &event);
#ifndef DISABLE_RECORDING
void Menu_Recording_New_Click(wxCommandEvent &event);
void Menu_Recording_Play_Click(wxCommandEvent &event);
void Menu_Recording_Stop_Click(wxCommandEvent &event);
void Menu_Recording_Editor_Click(wxCommandEvent &event);
void Menu_Recording_VirtualPad_Open_Click(wxCommandEvent &event);
void Menu_Recording_ConvertV2ToV3_Click(wxCommandEvent &event);
void Menu_Recording_ConvertV1_XToV2_Click(wxCommandEvent &event);
void Menu_Recording_ConvertV1ToV2_Click(wxCommandEvent &event);
void Menu_Recording_ConvertLegacy_Click(wxCommandEvent &event);
#endif
void _DoBootCdvd();
bool _DoSelectIsoBrowser( wxString& dest );
bool _DoSelectELFBrowser();