New "TAS Input" feature for precise joystick inputs. The feature is still a work in progress, but is functional. Currently overwrites any joystick/keyboard analog inputs and does so for all controllers.

Renamed OnFrame.cpp/h to a more accurate Movie.cpp/h. Made some small changes that may improve movie synchronization.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7620 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
baby.lueshi
2011-06-24 06:50:50 +00:00
parent 2309e36b28
commit d8fc690838
23 changed files with 131 additions and 71 deletions

View File

@ -43,6 +43,7 @@
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "State.h"
#include "VolumeHandler.h"
#include "Movie.h"
#include "VideoBackendBase.h"
@ -242,6 +243,7 @@ EVT_MENU(IDM_RECORD, CFrame::OnRecord)
EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport)
EVT_MENU(IDM_RECORDREADONLY, CFrame::OnRecordReadOnly)
EVT_MENU(IDM_TASINPUT, CFrame::OnTASInput)
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
@ -405,6 +407,9 @@ CFrame::CFrame(wxFrame* parent,
m_LogWindow->Hide();
m_LogWindow->Disable();
g_TASInputDlg = new TASInputDlg(this);
Movie::SetInputManip(TASManipFunction);
// Setup perspectives
if (g_pCodeWindow)
{
@ -850,6 +855,12 @@ int GetCmdForHotkey(unsigned int key)
return -1;
}
void TASManipFunction(SPADStatus *PadStatus, int controllerID)
{
if (main_frame)
main_frame->g_TASInputDlg->GetValues(PadStatus, controllerID);
}
void CFrame::OnKeyDown(wxKeyEvent& event)
{
if(Core::GetState() != Core::CORE_UNINITIALIZED &&

View File

@ -33,6 +33,8 @@
#include "Debugger/CodeWindow.h"
#include "LogWindow.h"
#include "LogConfigWindow.h"
#include "TASInputDlg.h"
#include "Movie.h"
#if defined(HAVE_X11) && HAVE_X11
#include "X11Utils.h"
#endif
@ -118,6 +120,7 @@ public:
CCodeWindow* g_pCodeWindow;
NetPlaySetupDiag* g_NetPlaySetupDiag;
wxCheatsWindow* g_CheatsWindow;
TASInputDlg* g_TASInputDlg;
void InitBitmaps();
void DoPause();
@ -293,6 +296,7 @@ private:
void OnPlayRecording(wxCommandEvent& event);
void OnRecordExport(wxCommandEvent& event);
void OnRecordReadOnly(wxCommandEvent& event);
void OnTASInput(wxCommandEvent& event);
void OnChangeDisc(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnActive(wxActivateEvent& event);
@ -357,5 +361,8 @@ private:
int GetCmdForHotkey(unsigned int key);
// For TASInputDlg
void TASManipFunction(SPADStatus *PadStatus, int controllerID);
#endif // __FRAME_H_

View File

@ -56,7 +56,7 @@ Core::GetWindowHandle().
#include "ConfigManager.h" // Core
#include "Core.h"
#include "OnFrame.h"
#include "Movie.h"
#include "HW/CPU.h"
#include "PowerPC/PowerPC.h"
#include "HW/DVDInterface.h"
@ -72,6 +72,7 @@ Core::GetWindowHandle().
#include "WiimoteConfigDiag.h"
#include "InputConfigDiag.h"
#include "HotkeyDlg.h"
#include "TASInputDlg.h"
#include <wx/datetime.h> // wxWidgets
@ -140,6 +141,7 @@ void CFrame::CreateMenu()
emulationMenu->Append(IDM_PLAYRECORD, GetMenuLabel(HK_PLAY_RECORDING));
emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING));
emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK);
emulationMenu->Append(IDM_TASINPUT, _("TAS Input"));
emulationMenu->Check(IDM_RECORDREADONLY, true);
emulationMenu->AppendSeparator();
@ -692,12 +694,17 @@ void CFrame::DoOpen(bool Boot)
void CFrame::OnRecordReadOnly(wxCommandEvent& event)
{
Frame::SetReadOnly(event.IsChecked());
Movie::SetReadOnly(event.IsChecked());
}
void CFrame::OnTASInput(wxCommandEvent& event)
{
g_TASInputDlg->Show(true);
}
void CFrame::OnFrameStep(wxCommandEvent& event)
{
Frame::SetFrameStepping(event.IsChecked());
Movie::SetFrameStepping(event.IsChecked());
}
void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event))
@ -717,7 +724,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
controllers |= (1 << (i + 4));
}
if(Frame::BeginRecordingInput(controllers))
if(Movie::BeginRecordingInput(controllers))
BootGame(std::string(""));
}
@ -734,7 +741,7 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
if(path.IsEmpty())
return;
if(Frame::PlayInput(path.mb_str()))
if(Movie::PlayInput(path.mb_str()))
BootGame(std::string(""));
}
@ -1047,10 +1054,10 @@ void CFrame::DoStop()
}
// TODO: Show the author/description dialog here
if(Frame::IsRecordingInput())
if(Movie::IsRecordingInput())
DoRecordingSave();
if(Frame::IsPlayingInput() || Frame::IsRecordingInput())
Frame::EndPlayInput(false);
if(Movie::IsPlayingInput() || Movie::IsRecordingInput())
Movie::EndPlayInput(false);
wxBeginBusyCursor();
BootManager::Stop();
@ -1134,7 +1141,7 @@ void CFrame::DoRecordingSave()
if(path.IsEmpty())
return;
Frame::SaveRecording(path.mb_str());
Movie::SaveRecording(path.mb_str());
if (!paused)
DoPause();
@ -1507,7 +1514,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
{
int amount = event.GetId() - IDM_FRAMESKIP0;
Frame::SetFrameSkipping((unsigned int)amount);
Movie::SetFrameSkipping((unsigned int)amount);
}
@ -1544,9 +1551,9 @@ void CFrame::UpdateGUI()
// Emulation
GetMenuBar()->FindItem(IDM_STOP)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_RESET)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Frame::IsRecordingInput());
GetMenuBar()->FindItem(IDM_RECORD)->Enable(!Movie::IsRecordingInput());
GetMenuBar()->FindItem(IDM_PLAYRECORD)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_RECORDEXPORT)->Enable(Frame::IsRecordingInput());
GetMenuBar()->FindItem(IDM_RECORDEXPORT)->Enable(Movie::IsRecordingInput());
GetMenuBar()->FindItem(IDM_FRAMESTEP)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(Running || Paused);
GetMenuBar()->FindItem(IDM_TOGGLE_FULLSCREEN)->Enable(Running || Paused);

View File

@ -79,6 +79,7 @@ enum
IDM_PLAYRECORD,
IDM_RECORDEXPORT,
IDM_RECORDREADONLY,
IDM_TASINPUT,
IDM_FRAMESTEP,
IDM_SCREENSHOT,
IDM_BROWSE,