From d8fc690838ebe8059bd1edeac984a2805a7f577f Mon Sep 17 00:00:00 2001 From: "baby.lueshi" Date: Fri, 24 Jun 2011 06:50:50 +0000 Subject: [PATCH] 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 --- Source/Core/Core/CMakeLists.txt | 2 +- Source/Core/Core/Core.vcxproj | 4 +-- Source/Core/Core/Core.vcxproj.filters | 4 +-- Source/Core/Core/Src/Core.cpp | 12 +++---- Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp | 4 +-- Source/Core/Core/Src/HW/GCPadEmu.cpp | 4 ++- Source/Core/Core/Src/HW/SI.cpp | 8 ++--- .../Core/Src/HW/SI_DeviceGCController.cpp | 22 ++++++------- Source/Core/Core/Src/HW/Wiimote.cpp | 6 ++-- .../Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp | 10 +++--- .../Core/Core/Src/{OnFrame.cpp => Movie.cpp} | 27 +++++++++++++--- Source/Core/Core/Src/{OnFrame.h => Movie.h} | 14 ++++++--- Source/Core/Core/Src/State.cpp | 14 ++++----- Source/Core/DolphinWX/CMakeLists.txt | 1 + Source/Core/DolphinWX/Dolphin.vcxproj | 2 ++ Source/Core/DolphinWX/Dolphin.vcxproj.filters | 6 ++++ Source/Core/DolphinWX/Src/Frame.cpp | 11 +++++++ Source/Core/DolphinWX/Src/Frame.h | 7 +++++ Source/Core/DolphinWX/Src/FrameTools.cpp | 31 ++++++++++++------- Source/Core/DolphinWX/Src/Globals.h | 1 + .../Plugins/Plugin_VideoDX11/Src/Render.cpp | 4 +-- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 4 +-- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 4 +-- 23 files changed, 131 insertions(+), 71 deletions(-) rename Source/Core/Core/Src/{OnFrame.cpp => Movie.cpp} (96%) rename Source/Core/Core/Src/{OnFrame.h => Movie.h} (93%) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index b5d5954844..b5e731ce15 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -11,10 +11,10 @@ set(SRCS Src/ActionReplay.cpp Src/GeckoCodeConfig.cpp Src/GeckoCode.cpp Src/MemTools.cpp + Src/Movie.cpp Src/NetPlay.cpp Src/NetPlayClient.cpp Src/NetPlayServer.cpp - Src/OnFrame.cpp Src/PatchEngine.cpp Src/State.cpp Src/stdafx.cpp diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj index c9ccf22223..a9b0176a33 100644 --- a/Source/Core/Core/Core.vcxproj +++ b/Source/Core/Core/Core.vcxproj @@ -333,10 +333,10 @@ + - @@ -533,8 +533,8 @@ + - diff --git a/Source/Core/Core/Core.vcxproj.filters b/Source/Core/Core/Core.vcxproj.filters index 2b122f3034..e51098f2ec 100644 --- a/Source/Core/Core/Core.vcxproj.filters +++ b/Source/Core/Core/Core.vcxproj.filters @@ -8,7 +8,6 @@ - @@ -553,6 +552,7 @@ FifoPlayer + @@ -562,7 +562,6 @@ - @@ -1027,6 +1026,7 @@ FifoPlayer + diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index cc86c4385d..18ab457d92 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -71,7 +71,7 @@ #include "LogManager.h" #include "State.h" -#include "OnFrame.h" +#include "Movie.h" // TODO: ugly, remove bool g_aspect_wide; @@ -261,7 +261,7 @@ void Stop() // - Hammertime! SConfig::GetInstance().m_SYSCONF->Reload(); INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----"); - Frame::g_InputCounter = 0; + Movie::g_InputCounter = 0; g_bStopping = false; } @@ -561,7 +561,7 @@ void VideoThrottle() // Update info per second u32 ElapseTime = (u32)Timer.GetTimeDifference(); - if ((ElapseTime >= 1000 && DrawnVideo > 0) || Frame::g_bFrameStep) + if ((ElapseTime >= 1000 && DrawnVideo > 0) || Movie::g_bFrameStep) { SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter; @@ -599,8 +599,8 @@ void VideoThrottle() #else // Summary information std::string SFPS; - if (Frame::IsPlayingInput() || Frame::IsRecordingInput()) - SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", Frame::g_frameCounter, Frame::g_InputCounter, FPS, VPS, Speed); + if (Movie::IsPlayingInput() || Movie::IsRecordingInput()) + SFPS = StringFromFormat("VI: %u - Frame: %u - FPS: %u - VPS: %u - SPEED: %u%%", Movie::g_frameCounter, Movie::g_InputCounter, FPS, VPS, Speed); else SFPS = StringFromFormat("FPS: %u - VPS: %u - SPEED: %u%%", FPS, VPS, Speed); #endif @@ -652,7 +652,7 @@ void Callback_VideoCopiedToXFB(bool video_update) { if(video_update) Common::AtomicIncrement(DrawnFrame); - Frame::FrameUpdate(); + Movie::FrameUpdate(); } // Callback_ISOName: Let the DSP emulator get the game name diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp index 13f44fc372..620b7e79b8 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.cpp @@ -24,7 +24,7 @@ #include "../ConfigManager.h" #include "MemoryUtil.h" #include "FileUtil.h" -#include "../OnFrame.h" +#include "../Movie.h" // We should provide an option to choose from the above, or figure out the checksum (the algo in yagcd seems wrong) // so that people can change default language. @@ -340,7 +340,7 @@ u32 CEXIIPL::GetGCTime() // hack in some netplay stuff ltime = NetPlay_GetGCTime(); - if (Frame::IsRecordingInput() || Frame::IsPlayingInput()) + if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) ltime = 1234567890; // TODO: Should you be able to set a custom time in movies? else if (0 == ltime) ltime = Common::Timer::GetLocalTimeSinceJan1970(); diff --git a/Source/Core/Core/Src/HW/GCPadEmu.cpp b/Source/Core/Core/Src/HW/GCPadEmu.cpp index d826e1ad2e..47e32b1efc 100644 --- a/Source/Core/Core/Src/HW/GCPadEmu.cpp +++ b/Source/Core/Core/Src/HW/GCPadEmu.cpp @@ -106,7 +106,9 @@ void GCPad::GetInput(SPADStatus* const pad) // buttons m_buttons->GetState(&pad->button, button_bitmasks); - // TODO: set analog A/B analog to full or w/e, prolly not needed + // set analog A/B analog to full or w/e, prolly not needed + if (pad->button & PAD_BUTTON_A) pad->analogA = 0xFF; + if (pad->button & PAD_BUTTON_B) pad->analogB = 0xFF; // dpad m_dpad->GetState(&pad->button, dpad_bitmasks); diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index c5306eff86..178550b445 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -19,7 +19,7 @@ #include "ChunkFile.h" #include "../ConfigManager.h" #include "../CoreTiming.h" -#include "../OnFrame.h" +#include "../Movie.h" #include "SystemTimers.h" #include "ProcessorInterface.h" @@ -246,9 +246,9 @@ void Init() g_Channel[i].m_InHi.Hex = 0; g_Channel[i].m_InLo.Hex = 0; - if (Frame::IsUsingPad(i)) + if (Movie::IsUsingPad(i)) AddDevice(SI_GC_CONTROLLER, i); - else if (Frame::IsRecordingInput() || Frame::IsPlayingInput()) + else if (Movie::IsRecordingInput() || Movie::IsPlayingInput()) AddDevice(SI_NONE, i); else AddDevice(SConfig::GetInstance().m_SIDevice[i], i); @@ -622,7 +622,7 @@ void RunSIBuffer() int GetTicksToNextSIPoll() { // Poll for input at regular intervals (once per frame) when playing or recording a movie - if (Frame::IsPlayingInput() || Frame::IsRecordingInput()) + if (Movie::IsPlayingInput() || Movie::IsRecordingInput()) { return SystemTimers::GetTicksPerSecond() / VideoInterface::TargetRefreshRate; } diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index a928bc6874..f4ee12d9dc 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -27,7 +27,7 @@ #include "GCPad.h" -#include "../OnFrame.h" +#include "../Movie.h" #include "../CoreTiming.h" #include "SystemTimers.h" @@ -128,6 +128,7 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) memset(&PadStatus, 0, sizeof(PadStatus)); Pad::GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); + Movie::CallInputManip(&PadStatus, ISIDevice::m_iDeviceNumber); u32 netValues[2]; if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues)) @@ -137,22 +138,19 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) return true; } - Frame::SetPolledDevice(); + Movie::SetPolledDevice(); - if(Frame::IsPlayingInput()) + if(Movie::IsPlayingInput()) { - Frame::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); + Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); if(!Core::g_CoreStartupParameter.bWii) - Frame::InputUpdate(); + Movie::InputUpdate(); } - else + else if(Movie::IsRecordingInput()) { - if(Frame::IsRecordingInput()) - { - Frame::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); - if(!Core::g_CoreStartupParameter.bWii) - Frame::InputUpdate(); - } + Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); + if(!Core::g_CoreStartupParameter.bWii) + Movie::InputUpdate(); } // Thankfully changing mode does not change the high bits ;) diff --git a/Source/Core/Core/Src/HW/Wiimote.cpp b/Source/Core/Core/Src/HW/Wiimote.cpp index fbcd577cd7..149c1db01e 100644 --- a/Source/Core/Core/Src/HW/Wiimote.cpp +++ b/Source/Core/Core/Src/HW/Wiimote.cpp @@ -4,7 +4,7 @@ #include "Wiimote.h" #include "WiimoteReal/WiimoteReal.h" #include "WiimoteEmu/WiimoteEmu.h" -#include "OnFrame.h" +#include "Movie.h" #include "ControllerInterface/ControllerInterface.h" @@ -48,8 +48,8 @@ void Initialize(void* const hwnd) WiimoteReal::Initialize(); - if (Frame::IsPlayingInput()) // reload Wiimotes with our settings - Frame::ChangeWiiPads(); + if (Movie::IsPlayingInput()) // reload Wiimotes with our settings + Movie::ChangeWiiPads(); } // __________________________________________________________________________________________________ diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp index 6f34764f9c..937f785feb 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp @@ -37,7 +37,7 @@ inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } #include "MatrixMath.h" -#include "../../OnFrame.h" +#include "../../Movie.h" namespace WiimoteEmu { @@ -635,9 +635,9 @@ void Wiimote::Update() // figure out what data we need s8 rptf_size = MAX_PAYLOAD; - Frame::SetPolledDevice(); + Movie::SetPolledDevice(); - if (!Frame::IsPlayingInput() || !Frame::PlayWiimote(m_index, data, rptf_size)) + if (!Movie::IsPlayingInput() || !Movie::PlayWiimote(m_index, data, rptf_size)) { const ReportFeatures& rptf = reporting_mode_features[m_reporting_mode - WM_REPORT_CORE]; rptf_size = rptf.size; @@ -742,9 +742,9 @@ void Wiimote::Update() } } } - if (Frame::IsRecordingInput()) + if (Movie::IsRecordingInput()) { - Frame::RecordWiimote(m_index, data, rptf_size); + Movie::RecordWiimote(m_index, data, rptf_size); } } diff --git a/Source/Core/Core/Src/OnFrame.cpp b/Source/Core/Core/Src/Movie.cpp similarity index 96% rename from Source/Core/Core/Src/OnFrame.cpp rename to Source/Core/Core/Src/Movie.cpp index 355e4612cb..a8488de7f3 100644 --- a/Source/Core/Core/Src/OnFrame.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -15,7 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "OnFrame.h" +#include "Movie.h" #include "Core.h" #include "Thread.h" @@ -41,7 +41,7 @@ std::mutex cs_frameSkip; -namespace Frame { +namespace Movie { bool g_bFrameStep = false; bool g_bFrameStop = false; @@ -65,6 +65,8 @@ std::string tmpStateFilename = "dtm.sav"; std::string g_InputDisplay[4]; +ManipFunction mfunc = NULL; + std::string GetInputDisplay() { std::string inputDisplay = ""; @@ -451,13 +453,19 @@ void PlayController(SPADStatus *PadStatus, int controllerID) if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL) return; - memset(PadStatus, 0, sizeof(SPADStatus)); - if (inputOffset + 8 > tmpLength) { EndPlayInput(!g_bReadOnly); return; } + + // dtm files don't save the mic button or error bit. not sure if they're actually + // used, but better safe than sorry + bool m = PadStatus->MicButton; + signed char e = PadStatus->err; + memset(PadStatus, 0, sizeof(SPADStatus)); + PadStatus->MicButton = m; + PadStatus->err = e; memcpy(&g_padState, &(tmpInput[inputOffset]), 8); inputOffset += 8; @@ -634,4 +642,15 @@ void SaveRecording(const char *filename) else Core::DisplayMessage(StringFromFormat("Failed to save %s", filename).c_str(), 2000); } + +void SetInputManip(ManipFunction func) +{ + mfunc = func; +} + +void CallInputManip(SPADStatus *PadStatus, int controllerID) +{ + if (mfunc) + (*mfunc)(PadStatus, controllerID); +} }; diff --git a/Source/Core/Core/Src/OnFrame.h b/Source/Core/Core/Src/Movie.h similarity index 93% rename from Source/Core/Core/Src/OnFrame.h rename to Source/Core/Core/Src/Movie.h index aa926b707e..2978d0ec15 100644 --- a/Source/Core/Core/Src/OnFrame.h +++ b/Source/Core/Core/Src/Movie.h @@ -15,8 +15,8 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#ifndef __FRAME_H -#define __FRAME_H +#ifndef __MOVIE_H +#define __MOVIE_H #include "Common.h" #include "FileUtil.h" @@ -24,9 +24,9 @@ #include -// Per-(video )Frame actions +// Per-(video )Movie actions -namespace Frame { +namespace Movie { // Enumerations and structs enum PlayMode { @@ -125,6 +125,12 @@ void EndPlayInput(bool cont); void SaveRecording(const char *filename); std::string GetInputDisplay(); + +// Done this way to avoid mixing of core and gui code +typedef void(*ManipFunction)(SPADStatus *, int); + +void SetInputManip(ManipFunction); +void CallInputManip(SPADStatus *PadStatus, int controllerID); }; #endif // __FRAME_H diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 7f682ec4e6..d942255d2a 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -22,7 +22,7 @@ #include "StringUtil.h" #include "Thread.h" #include "CoreTiming.h" -#include "OnFrame.h" +#include "Movie.h" #include "HW/Wiimote.h" #include "HW/DSP.h" #include "HW/HW.h" @@ -235,9 +235,9 @@ void SaveFileStateCallback(u64 userdata, int cyclesLate) p.SetMode(PointerWrap::MODE_WRITE); DoState(p); - if ((Frame::IsRecordingInput() || Frame::IsPlayingInput()) && !Frame::IsRecordingInputFromSaveState()) - Frame::SaveRecording((g_current_filename + ".dtm").c_str()); - else if (!Frame::IsRecordingInput() && !Frame::IsPlayingInput()) + if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsRecordingInputFromSaveState()) + Movie::SaveRecording((g_current_filename + ".dtm").c_str()); + else if (!Movie::IsRecordingInput() && !Movie::IsPlayingInput()) File::Delete(g_current_filename + ".dtm"); Core::DisplayMessage("Saving State...", 1000); @@ -345,9 +345,9 @@ void LoadFileStateCallback(u64 userdata, int cyclesLate) Core::DisplayMessage("Unable to Load : Can't load state from other revisions !", 4000); if (File::Exists(g_current_filename + ".dtm")) - Frame::LoadInput((g_current_filename + ".dtm").c_str()); - else if (!Frame::IsRecordingInputFromSaveState()) - Frame::EndPlayInput(false); + Movie::LoadInput((g_current_filename + ".dtm").c_str()); + else if (!Movie::IsRecordingInputFromSaveState()) + Movie::EndPlayInput(false); } g_op_in_progress = false; diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index bac3ba2c05..7890c9fe96 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -53,6 +53,7 @@ if(wxWidgets_FOUND) Src/NetWindow.cpp Src/PHackSettings.cpp Src/PatchAddEdit.cpp + Src/TASInputDlg.cpp Src/UDPConfigDiag.cpp Src/VideoConfigDiag.cpp Src/WXInputBase.cpp diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj b/Source/Core/DolphinWX/Dolphin.vcxproj index 314a16faaf..534f61b70e 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj +++ b/Source/Core/DolphinWX/Dolphin.vcxproj @@ -274,6 +274,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / Create Create + @@ -320,6 +321,7 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e / + diff --git a/Source/Core/DolphinWX/Dolphin.vcxproj.filters b/Source/Core/DolphinWX/Dolphin.vcxproj.filters index 5fdf69b51b..3c14226fc0 100644 --- a/Source/Core/DolphinWX/Dolphin.vcxproj.filters +++ b/Source/Core/DolphinWX/Dolphin.vcxproj.filters @@ -132,6 +132,9 @@ GUI + + GUI + @@ -258,6 +261,9 @@ GUI + + GUI + diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index a0081384e0..4d29350744 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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 && diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 169cd694ea..526e52f3c9 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -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_ diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 052a65a063..60f2c7d7b7 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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 // 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); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 98e0b619c8..8089a2622c 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -79,6 +79,7 @@ enum IDM_PLAYRECORD, IDM_RECORDEXPORT, IDM_RECORDREADONLY, + IDM_TASINPUT, IDM_FRAMESTEP, IDM_SCREENSHOT, IDM_BROWSE, diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index e9dd941611..d0756bfa98 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -39,7 +39,7 @@ #include "TextureCache.h" #include "VertexShaderCache.h" #include "Core.h" -#include "OnFrame.h" +#include "Movie.h" #include "Television.h" #include "Host.h" @@ -1036,7 +1036,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; - StringCchPrintfA(inputDisplay, 1000, Frame::GetInputDisplay().c_str()); + StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); D3D::font.DrawTextScaled(0, 30, 20, 0.0f, 0xFF00FFFF, inputDisplay); } Renderer::DrawDebugText(); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 6c785aa012..e333cbc168 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -52,7 +52,7 @@ #include "DLCache.h" #include "Debugger.h" #include "Core.h" -#include "OnFrame.h" +#include "Movie.h" namespace DX9 { @@ -1139,7 +1139,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons if (g_ActiveConfig.bShowInputDisplay) { char inputDisplay[1000]; - StringCchPrintfA(inputDisplay, 1000, Frame::GetInputDisplay().c_str()); + StringCchPrintfA(inputDisplay, 1000, Movie::GetInputDisplay().c_str()); D3D::font.DrawTextScaled(0, 30, 20, 20, 0.0f, 0xFF00FFFF, inputDisplay); } Renderer::DrawDebugText(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index c8e667763c..0c9d904cad 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -58,7 +58,7 @@ #include "Fifo.h" #include "Debugger.h" #include "Core.h" -#include "OnFrame.h" +#include "Movie.h" #include "Host.h" #include "main.h" // Local @@ -544,7 +544,7 @@ void Renderer::DrawDebugInfo() p+=sprintf(p, "FPS: %d\n", s_fps); if (g_ActiveConfig.bShowInputDisplay) - p+=sprintf(p, "%s", Frame::GetInputDisplay().c_str()); + p+=sprintf(p, "%s", Movie::GetInputDisplay().c_str()); if (g_ActiveConfig.bShowEFBCopyRegions) {