From d87a2b27a25d4258d4b124a2e46de191baaeec62 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 5 Feb 2017 04:20:07 -0600 Subject: [PATCH] make lua's new tastudio.setplayback re-enable the record flag if it was set (the existing logic leaves it disabled I think as security against the GUI use case where users might stomp their video seeking while playing in record mode). future work: add lua control for the record mode flag --- .../tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs | 2 +- .../tools/TAStudio/TAStudio.Navigation.cs | 4 ++-- BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs index b0011ae680..ce305978fb 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs @@ -174,7 +174,7 @@ namespace BizHawk.Client.EmuHawk } if (f < Tastudio.CurrentTasMovie.InputLogLength && f>=0) { - Tastudio.GoToFrame(f); + Tastudio.GoToFrame(f,true); } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs index e0f421f8f8..01c799e8ef 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Navigation.cs @@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk } // SuuperW: I changed this to public so that it could be used by MarkerControl.cs - public void GoToFrame(int frame) + public void GoToFrame(int frame, bool fromLua = false) { // If seeking to a frame before or at the end of the movie, use StartAtNearestFrameAndEmulate // Otherwise, load the latest state (if not already there) and seek while recording. @@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk if (frame <= CurrentTasMovie.InputLogLength) { // Get as close as we can then emulate there - StartAtNearestFrameAndEmulate(frame); + StartAtNearestFrameAndEmulate(frame, fromLua); MaybeFollowCursor(); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index bbb0632837..43af63fe6b 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -805,7 +805,7 @@ namespace BizHawk.Client.EmuHawk //_autoRestoreFrame = null; } - private void StartAtNearestFrameAndEmulate(int frame) + private void StartAtNearestFrameAndEmulate(int frame, bool fromLua) { if (frame == Emulator.Frame) return; @@ -825,6 +825,16 @@ namespace BizHawk.Client.EmuHawk { StartSeeking(frame); } + else + { + if (_wasRecording) + { + //lua botting users will want to re-activate record mode automatically -- it should be like nothing ever happened + //GUI users on the other hand need to be protected from clobbering their video when skipping around + if(fromLua) + TastudioRecordMode(); + } + } } }