From 0076c8802b73f3daf314c7aee9b20f73e18a4a6f Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 7 Dec 2022 03:01:51 +1000 Subject: [PATCH] Add `saveChanges` parameter to `IMovieApi.Stop`/`movie.stop` --- src/BizHawk.Client.Common/Api/Classes/MovieApi.cs | 4 ++-- src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs | 4 +++- src/BizHawk.Client.Common/lua/CommonLibs/MovieLuaLibrary.cs | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs index 01fc3912f1..dabf91cc94 100644 --- a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs @@ -106,8 +106,8 @@ namespace BizHawk.Client.Common public void SetRerecordCounting(bool counting) => _movieSession.Movie.IsCountingRerecords = counting; - public void Stop() - => _mainForm.StopMovie(); + public void Stop(bool saveChanges = true) + => _mainForm.StopMovie(saveChanges: saveChanges); public double GetFps() { diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs index 6538bfbd4b..fa49b7e9c9 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs @@ -19,7 +19,9 @@ namespace BizHawk.Client.Common void SetReadOnly(bool readOnly); void SetRerecordCount(ulong count); void SetRerecordCounting(bool counting); - void Stop(); + + void Stop(bool saveChanges = true); + double GetFps(); IReadOnlyDictionary GetHeader(); IReadOnlyList GetComments(); diff --git a/src/BizHawk.Client.Common/lua/CommonLibs/MovieLuaLibrary.cs b/src/BizHawk.Client.Common/lua/CommonLibs/MovieLuaLibrary.cs index df49be9bea..b582d2a446 100644 --- a/src/BizHawk.Client.Common/lua/CommonLibs/MovieLuaLibrary.cs +++ b/src/BizHawk.Client.Common/lua/CommonLibs/MovieLuaLibrary.cs @@ -93,9 +93,9 @@ namespace BizHawk.Client.Common => APIs.Movie.SetRerecordCounting(counting); [LuaMethodExample("movie.stop( );")] - [LuaMethod("stop", "Stops the current movie")] - public void Stop() - => APIs.Movie.Stop(); + [LuaMethod("stop", "Stops the current movie. Pass false to discard changes.")] + public void Stop(bool saveChanges = true) + => APIs.Movie.Stop(saveChanges); [LuaMethodExample("local domovget = movie.getfps( );")] [LuaMethod("getfps", "If a movie is loaded, gets the frames per second used by the movie to determine the movie length time")]