From fb507ce6761e1c0b95d3423b75e53682fca96287 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Fri, 21 Aug 2009 09:26:34 +0000 Subject: [PATCH] TAS: Recording now has GUI! git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4026 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/OnFrame.h | 2 +- Source/Core/DolphinWX/Src/Frame.cpp | 1 + Source/Core/DolphinWX/Src/Frame.h | 1 + Source/Core/DolphinWX/Src/FrameTools.cpp | 28 ++++++++++++++++++++++++ Source/Core/DolphinWX/Src/Globals.h | 1 + 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/OnFrame.h b/Source/Core/Core/Src/OnFrame.h index 2c5af7db14..72bc3108b2 100644 --- a/Source/Core/Core/Src/OnFrame.h +++ b/Source/Core/Core/Src/OnFrame.h @@ -84,7 +84,7 @@ void FrameSkipping(); void ModifyController(SPADStatus *PadStatus, int controllerID); -void BeginRecordingInput(const char *filename); +void BeginRecordingInput(const char *filename, int controllers); void RecordInput(SPADStatus *PadStatus, int controllerID); void EndRecordingInput(); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 2304d40e8f..f1d420fe07 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -235,6 +235,7 @@ EVT_MENU(IDM_HELPGOOGLECODE, CFrame::OnHelp) EVT_MENU(IDM_HELPABOUT, CFrame::OnHelp) EVT_MENU(wxID_REFRESH, CFrame::OnRefresh) EVT_MENU(IDM_PLAY, CFrame::OnPlay) +EVT_MENU(IDM_RECORD, CFrame::OnRecord) EVT_MENU(IDM_STOP, CFrame::OnStop) EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot) EVT_MENU(IDM_CONFIG_MAIN, CFrame::OnConfigMain) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index ccaa24aef3..b6bf177556 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -158,6 +158,7 @@ class CFrame : public wxFrame void OnBootDrive(wxCommandEvent& event); void OnPlay(wxCommandEvent& event); // Emulation + void OnRecord(wxCommandEvent& event); void OnChangeDisc(wxCommandEvent& event); void OnStop(wxCommandEvent& event); void OnScreenshot(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index ea62484595..603d8afd90 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -129,6 +129,7 @@ void CFrame::CreateMenu() // Emulation menu wxMenu* emulationMenu = new wxMenu; emulationMenu->Append(IDM_PLAY, _T("&Play\tF10")); + emulationMenu->Append(IDM_RECORD, _T("&Start Recording")); emulationMenu->Append(IDM_CHANGEDISC, _T("Change &Disc")); emulationMenu->Append(IDM_STOP, _T("&Stop")); @@ -486,6 +487,28 @@ void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event)) DoOpen(false); } +void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event)) +{ + wxString path = wxFileSelector( + _T("Select The Recording File"), + wxEmptyString, wxEmptyString, wxEmptyString, + wxString::Format + ( + _T("Dolphin TAS Movies (*.dtm)|*.dtm|All files (%s)|%s"), + wxFileSelectorDefaultWildcardStr, + wxFileSelectorDefaultWildcardStr + ), + wxFD_SAVE | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST, + this); + + if(path.IsEmpty()) + return; + + // TODO: Take controller settings from Gamecube Configuration menu + Frame::BeginRecordingInput(path.mb_str(), 1); + BootGame(); +} + void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event)) { BootGame(); @@ -532,6 +555,10 @@ void CFrame::DoStop() if(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) if(!AskYesNo("Are you sure you want to stop the current emulation?", "Confirm", wxYES_NO)) return; + + // TODO: Show the author/description dialog here + if(Frame::IsRecordingInput()) + Frame::EndRecordingInput(); Core::Stop(); UpdateGUI(); @@ -831,6 +858,7 @@ void CFrame::UpdateGUI() // Emulation GetMenuBar()->FindItem(IDM_STOP)->Enable(running || paused); + GetMenuBar()->FindItem(IDM_RECORD)->Enable(!running && !paused); GetMenuBar()->FindItem(IDM_SCREENSHOT)->Enable(running || paused); m_pSubMenuLoad->Enable(initialized); m_pSubMenuSave->Enable(initialized); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index bfebcd4ac5..ea1a4dbcad 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -62,6 +62,7 @@ enum IDM_FRAMESKIP8, IDM_FRAMESKIP9, IDM_PLAY, + IDM_RECORD, IDM_STOP, IDM_SCREENSHOT, IDM_BROWSE,