mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Rerecording: Added frame step function and status bar for the input recording. Turn on frame stepping with Ctrl, step with Space. Build the Rerecording version with the setting in Setup.h.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2273 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -36,10 +36,13 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_DISABLE,ConfigDialog::ControllerSettingsChanged)
|
||||
//Recording
|
||||
EVT_CHECKBOX(ID_RECORDING,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PLAYBACK,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_BUTTON(ID_SAVE_RECORDING,ConfigDialog::ControllerSettingsChanged)
|
||||
|
||||
// Input recording
|
||||
#ifdef RERECORDING
|
||||
EVT_CHECKBOX(ID_RECORDING,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PLAYBACK,ConfigDialog::ControllerSettingsChanged)
|
||||
EVT_BUTTON(ID_SAVE_RECORDING,ConfigDialog::ControllerSettingsChanged)
|
||||
#endif
|
||||
|
||||
EVT_BUTTON(CTL_A,ConfigDialog::OnButtonClick)
|
||||
EVT_BUTTON(CTL_B,ConfigDialog::OnButtonClick)
|
||||
@ -182,36 +185,9 @@ void ConfigDialog::CreateGUIControls()
|
||||
m_SizeXInput[i]->Add(m_X360PadC[i], 0, wxEXPAND | wxALL, 1);
|
||||
m_SizeXInput[i]->Add(m_Rumble[i], 0, wxEXPAND | wxALL, 1);
|
||||
#endif
|
||||
|
||||
m_SizeRecording[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Input Recording"));
|
||||
m_CheckRecording[i] = new wxCheckBox(m_Controller[i], ID_RECORDING, wxT("Record input"));
|
||||
m_CheckPlayback[i] = new wxCheckBox(m_Controller[i], ID_PLAYBACK, wxT("Play back input"));
|
||||
m_BtnSaveRecording[i] = new wxButton(m_Controller[i], ID_SAVE_RECORDING, wxT("Save recording"), wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Tool tips
|
||||
m_CheckRecording[i]->SetToolTip(wxT("Your recording will be saved to pad-record.bin in the Dolphin dir when you stop the game"));
|
||||
m_CheckPlayback[i]->SetToolTip(wxT("Play back the pad-record.bin file from the Dolphin dir"));
|
||||
m_BtnSaveRecording[i]->SetToolTip(wxT(
|
||||
"This will save the current recording to pad-record.bin. Your recording will\n"
|
||||
"also be automatically saved every 60 * 10 frames. And when you shut down the\n"
|
||||
"game."));
|
||||
|
||||
m_SizeRecording[i]->Add(m_CheckRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
m_SizeRecording[i]->Add(m_CheckPlayback[i], 0, wxEXPAND | wxALL, 1);
|
||||
m_SizeRecording[i]->Add(m_BtnSaveRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
|
||||
// Set values
|
||||
m_Attached[i]->SetValue(pad[i].bAttached);
|
||||
m_Disable[i]->SetValue(pad[i].bDisable);
|
||||
m_CheckRecording[i]->SetValue(pad[i].bRecording);
|
||||
m_CheckPlayback[i]->SetValue(pad[i].bPlayback);
|
||||
|
||||
// Only enable these options for pad 0
|
||||
m_CheckRecording[i]->Enable(false); m_CheckRecording[0]->Enable(true);
|
||||
m_CheckPlayback[i]->Enable(false); m_CheckPlayback[0]->Enable(true);
|
||||
m_BtnSaveRecording[i]->Enable(false); m_BtnSaveRecording[0]->Enable(true);
|
||||
// Don't allow saving when we are not recording
|
||||
m_BtnSaveRecording[i]->Enable(g_EmulatorRunning && pad[0].bRecording);
|
||||
|
||||
#ifdef _WIN32
|
||||
// Check if any XInput pad was found
|
||||
@ -239,12 +215,50 @@ void ConfigDialog::CreateGUIControls()
|
||||
//sDevice[i]->AddStretchSpacer();
|
||||
#ifdef _WIN32
|
||||
sDevice[i]->Add(m_SizeXInput[i], 0, wxEXPAND | wxALL, 1);
|
||||
sDevice[i]->Add(m_SizeRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
|
||||
#endif
|
||||
// -----------------------------------
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
// Rerecording
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#ifdef RERECORDING
|
||||
// Create controls
|
||||
m_SizeRecording[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Input Recording"));
|
||||
m_CheckRecording[i] = new wxCheckBox(m_Controller[i], ID_RECORDING, wxT("Record input"));
|
||||
m_CheckPlayback[i] = new wxCheckBox(m_Controller[i], ID_PLAYBACK, wxT("Play back input"));
|
||||
m_BtnSaveRecording[i] = new wxButton(m_Controller[i], ID_SAVE_RECORDING, wxT("Save recording"), wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Tool tips
|
||||
m_CheckRecording[i]->SetToolTip(wxT("Your recording will be saved to pad-record.bin in the Dolphin dir when you stop the game"));
|
||||
m_CheckPlayback[i]->SetToolTip(wxT("Play back the pad-record.bin file from the Dolphin dir"));
|
||||
m_BtnSaveRecording[i]->SetToolTip(wxT(
|
||||
"This will save the current recording to pad-record.bin. Your recording will\n"
|
||||
"also be automatically saved every 60 * 10 frames. And when you shut down the\n"
|
||||
"game."));
|
||||
|
||||
// Sizers
|
||||
m_SizeRecording[i]->Add(m_CheckRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
m_SizeRecording[i]->Add(m_CheckPlayback[i], 0, wxEXPAND | wxALL, 1);
|
||||
m_SizeRecording[i]->Add(m_BtnSaveRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
|
||||
// Only enable these options for pad 0
|
||||
m_CheckRecording[i]->Enable(false); m_CheckRecording[0]->Enable(true);
|
||||
m_CheckPlayback[i]->Enable(false); m_CheckPlayback[0]->Enable(true);
|
||||
m_BtnSaveRecording[i]->Enable(false); m_BtnSaveRecording[0]->Enable(true);
|
||||
// Don't allow saving when we are not recording
|
||||
m_BtnSaveRecording[i]->Enable(g_EmulatorRunning && pad[0].bRecording);
|
||||
sDevice[i]->Add(m_SizeRecording[i], 0, wxEXPAND | wxALL, 1);
|
||||
|
||||
// Set values
|
||||
m_CheckRecording[0]->SetValue(pad[0].bRecording);
|
||||
m_CheckPlayback[0]->SetValue(pad[0].bPlayback);
|
||||
|
||||
Console::Print("m_CheckRecording: %i\n", pad[0].bRecording, pad[0].bPlayback);
|
||||
#endif
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Buttons
|
||||
// -----------------------------
|
||||
@ -400,21 +414,23 @@ void ConfigDialog::ControllerSettingsChanged(wxCommandEvent& event)
|
||||
pad[page].bRumble = m_Rumble[page]->GetValue();
|
||||
break;
|
||||
|
||||
case ID_RECORDING:
|
||||
pad[page].bRecording = m_CheckRecording[page]->GetValue();
|
||||
// Turn off the other option
|
||||
pad[page].bPlayback = false; m_CheckPlayback[page]->SetValue(false);
|
||||
break;
|
||||
case ID_PLAYBACK:
|
||||
pad[page].bPlayback = m_CheckPlayback[page]->GetValue();
|
||||
// Turn off the other option
|
||||
pad[page].bRecording = false; m_CheckRecording[page]->SetValue(false);
|
||||
break;
|
||||
case ID_SAVE_RECORDING:
|
||||
// Double check again that we are still running a game
|
||||
if (g_EmulatorRunning) SaveRecord();
|
||||
break;
|
||||
|
||||
// Input recording
|
||||
#ifdef RERECORDING
|
||||
case ID_RECORDING:
|
||||
pad[page].bRecording = m_CheckRecording[page]->GetValue();
|
||||
// Turn off the other option
|
||||
pad[page].bPlayback = false; m_CheckPlayback[page]->SetValue(false);
|
||||
break;
|
||||
case ID_PLAYBACK:
|
||||
pad[page].bPlayback = m_CheckPlayback[page]->GetValue();
|
||||
// Turn off the other option
|
||||
pad[page].bRecording = false; m_CheckRecording[page]->SetValue(false);
|
||||
break;
|
||||
case ID_SAVE_RECORDING:
|
||||
// Double check again that we are still running a game
|
||||
if (g_EmulatorRunning) SaveRecord();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "IniFile.h"
|
||||
#include "ConsoleWindow.h"
|
||||
#include "StringUtil.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
@ -617,7 +618,10 @@ void DllConfig(HWND _hParent)
|
||||
{
|
||||
//Console::Open(70, 5000);
|
||||
|
||||
// Load configuration
|
||||
LoadConfig();
|
||||
|
||||
// Show wxDialog
|
||||
#ifdef _WIN32
|
||||
wxWindow win;
|
||||
win.SetHWND(_hParent);
|
||||
@ -628,6 +632,8 @@ void DllConfig(HWND _hParent)
|
||||
ConfigDialog frame(NULL);
|
||||
frame.ShowModal();
|
||||
#endif
|
||||
|
||||
// Save configuration
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
@ -643,8 +649,29 @@ void Initialize(void *init)
|
||||
// Load configuration
|
||||
LoadConfig();
|
||||
|
||||
// -------------------------------------------
|
||||
// Rerecording
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
/* Check if we are starting the pad to record the input, and an old file exists. In that case ask
|
||||
if we really want to start the recording and eventually overwrite the file */
|
||||
if (pad[0].bRecording && File::Exists("pad-record.bin"))
|
||||
{
|
||||
if (!AskYesNo("An old version of '%s' aleady exists in your Dolphin directory. You can"
|
||||
" now make a copy of it before you start a new recording and overwrite the file."
|
||||
" Select Yes to continue and overwrite the file. Select No to turn off the input"
|
||||
" recording and continue without recording anything.",
|
||||
"pad-record.bin"))
|
||||
{
|
||||
// Turn off recording and continue
|
||||
pad[0].bRecording = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Load recorded input if we are to play it back, otherwise begin with a blank recording
|
||||
if (pad[0].bPlayback) LoadRecord();
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
g_PADInitialize = *(SPADInitialize*)init;
|
||||
|
||||
@ -668,10 +695,17 @@ void Shutdown()
|
||||
{
|
||||
//Console::Print("ShutDown()\n");
|
||||
|
||||
// -------------------------------------------
|
||||
// Play back input instead of accepting any user input
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
// Save recording
|
||||
if (pad[0].bRecording) SaveRecord();
|
||||
// Reset the counter
|
||||
count = 0;
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
// We have stopped the game
|
||||
g_EmulatorRunning = false;
|
||||
|
||||
@ -699,12 +733,17 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
// Check if all is okay
|
||||
if (_pPADStatus == NULL) return;
|
||||
|
||||
// -------------------------------------------
|
||||
// Play back input instead of accepting any user input
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
if (pad[0].bPlayback)
|
||||
{
|
||||
*_pPADStatus = PlayRecord();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// ----------------------
|
||||
|
||||
const int base = 0x80;
|
||||
// Clear pad
|
||||
@ -736,8 +775,14 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
|
||||
cocoa_Read(_numPAD, _pPADStatus);
|
||||
#endif
|
||||
|
||||
// -------------------------------------------
|
||||
// Rerecording
|
||||
// ----------------------
|
||||
#ifdef RERECORDING
|
||||
// Record input
|
||||
if (pad[0].bRecording) RecordInput(*_pPADStatus);
|
||||
#endif
|
||||
// ----------------------
|
||||
}
|
||||
|
||||
|
||||
@ -890,9 +935,12 @@ void LoadConfig()
|
||||
file.Get(SectionName, "DisableOnBackground", &pad[i].bDisable, false);
|
||||
file.Get(SectionName, "Rumble", &pad[i].bRumble, true);
|
||||
file.Get(SectionName, "XPad#", &pad[i].XPadPlayer);
|
||||
|
||||
file.Get(SectionName, "Recording", &pad[i].bRecording, false);
|
||||
file.Get(SectionName, "Playback", &pad[i].bPlayback, false);
|
||||
|
||||
// Recording
|
||||
#ifdef RERECORDING
|
||||
file.Get(SectionName, "Recording", &pad[0].bRecording, false);
|
||||
file.Get(SectionName, "Playback", &pad[0].bPlayback, false);
|
||||
#endif
|
||||
|
||||
for (int x = 0; x < NUMCONTROLS; x++)
|
||||
{
|
||||
@ -924,8 +972,10 @@ void SaveConfig()
|
||||
file.Set(SectionName, "Rumble", pad[i].bRumble);
|
||||
file.Set(SectionName, "XPad#", pad[i].XPadPlayer);
|
||||
// Recording
|
||||
file.Set(SectionName, "Recording", pad[i].bRecording);
|
||||
file.Set(SectionName, "Playback", pad[i].bPlayback);
|
||||
#ifdef RERECORDING
|
||||
file.Set(SectionName, "Recording", pad[0].bRecording);
|
||||
file.Set(SectionName, "Playback", pad[0].bPlayback);
|
||||
#endif
|
||||
|
||||
for (int x = 0; x < NUMCONTROLS; x++)
|
||||
{
|
||||
|
@ -18,6 +18,9 @@
|
||||
#ifndef __PADSIMPLE_H__
|
||||
#define __PADSIMPLE_H__
|
||||
|
||||
#include "Setup.h" // Common
|
||||
#include "ConsoleWindow.h"
|
||||
|
||||
// Controls
|
||||
enum
|
||||
{
|
||||
|
Reference in New Issue
Block a user