public void Undo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; bool wasBinding = movie.BindMarkersToInput; movie.ChangeLog.IsRecording = false; movie.BindMarkersToInput = bindMarkers; if (redoLength != length) { movie.InsertEmptyFrame(movie.InputLogLength, length - redoLength); } for (int i = 0; i < undoLength; i++) { movie.SetFrame(FirstFrame + i, oldLog[i]); } if (undoLength != length) { movie.RemoveFrames(FirstFrame + undoLength, movie.InputLogLength); } movie.ChangeLog.IsRecording = wasRecording; movie.BindMarkersToInput = bindMarkers; }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; bool wasBinding = movie.BindMarkersToInput; movie.ChangeLog.IsRecording = false; movie.BindMarkersToInput = _bindMarkers; if (_undoLength != Length) { movie.InsertEmptyFrame(FirstFrame, Length - _undoLength); } if (_redoLength != Length) { movie.RemoveFrames(FirstFrame, movie.InputLogLength - _redoLength); } for (int i = 0; i < _redoLength; i++) { movie.SetFrame(FirstFrame + i, _newLog[i]); } movie.ChangeLog.IsRecording = wasRecording; movie.BindMarkersToInput = _bindMarkers; }
public MovieActionBindInput(TasMovie movie, int frame, bool isDelete) { FirstFrame = LastFrame = frame; _log = movie.GetInputLogEntry(frame); _delete = isDelete; _bindMarkers = movie.BindMarkersToInput; }
public void SetRedoLog(TasMovie movie) { _redoLength = Math.Min(LastFrame + 1, movie.InputLogLength) - FirstFrame; _newLog = new List <string>(); for (int i = 0; i < _redoLength; i++) { _newLog.Add(movie.GetLogEntries()[FirstFrame + i]); } }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); accessed = new List<StateManagerState>(); if (_movie.StartsFromSavestate) SetState(0, _movie.BinarySavestate); }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); if (_movie.StartsFromSavestate) { SetState(0, _movie.BinarySavestate); } _stateCleanupTime = DateTime.Now.Ticks + _stateCleanupPeriod; }
public MovieAction(int firstFrame, int lastFrame, TasMovie movie) { FirstFrame = firstFrame; LastFrame = lastFrame; oldLog = new List<string>(length); undoLength = Math.Min(lastFrame + 1, movie.InputLogLength) - firstFrame; for (int i = 0; i < undoLength; i++) oldLog.Add(movie.GetLogEntries()[FirstFrame + i]); bindMarkers = movie.BindMarkersToInput; }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); if (_movie.StartsFromSavestate) { SetState(0, _movie.BinarySavestate); } _decay = new StateManagerDecay(this); }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); accessed = new List <StateManagerState>(); if (_movie.StartsFromSavestate) { SetState(0, _movie.BinarySavestate); } }
public MovieAction(int firstFrame, int lastFrame, TasMovie movie) { FirstFrame = firstFrame; LastFrame = lastFrame; _oldLog = new List <string>(Length); _undoLength = Math.Min(LastFrame + 1, movie.InputLogLength) - FirstFrame; for (int i = 0; i < _undoLength; i++) { _oldLog.Add(movie.GetLogEntries()[FirstFrame + i]); } _bindMarkers = movie.BindMarkersToInput; }
public void Redo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker { movie.Markers.Add(LastFrame, _oldMessage, true); } else if (LastFrame == -1) // Action: Remove marker { movie.Markers.Remove(movie.Markers.Get(FirstFrame), true); } else // Action: Move/rename marker { movie.Markers.Move(FirstFrame, LastFrame, true); movie.Markers.Get(LastFrame).Message = _newMessage; } }
public void Undo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker { movie.Markers.Remove(movie.Markers.Get(LastFrame)); } else if (LastFrame == -1) // Action: Remove marker { movie.Markers.Add(FirstFrame, oldMessage); } else // Action: Move/rename marker { movie.Markers.Move(LastFrame, FirstFrame); movie.Markers.Get(LastFrame).Message = oldMessage; } }
public void Undo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (_isFloat) { movie.SetFloatState(FirstFrame, _buttonName, _oldState); } else { movie.SetBoolState(FirstFrame, _buttonName, _oldState == 1); } movie.ChangeLog.IsRecording = wasRecording; }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (_isFloat) { movie.SetFloatStates(FirstFrame, LastFrame - FirstFrame + 1, _buttonName, _newState); } else { movie.SetBoolStates(FirstFrame, LastFrame - FirstFrame + 1, _buttonName, _newState == 1); } movie.ChangeLog.IsRecording = wasRecording; }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; bool wasBinding = movie.BindMarkersToInput; movie.ChangeLog.IsRecording = false; movie.BindMarkersToInput = bindMarkers; if (undoLength != length) movie.InsertEmptyFrame(FirstFrame, length - undoLength); if (redoLength != length) movie.RemoveFrames(FirstFrame, movie.InputLogLength - redoLength); for (int i = 0; i < redoLength; i++) movie.SetFrame(FirstFrame + i, newLog[i]); movie.ChangeLog.IsRecording = wasRecording; movie.BindMarkersToInput = bindMarkers; }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; bool wasBinding = movie.BindMarkersToInput; movie.ChangeLog.IsRecording = false; movie.BindMarkersToInput = _bindMarkers; if (_delete) { movie.RemoveFrame(FirstFrame); movie.RemoveLagHistory(FirstFrame + 1); } else { movie.InsertInput(FirstFrame, _log); movie.InsertLagHistory(FirstFrame + 1, true); } movie.ChangeLog.IsRecording = wasRecording; movie.BindMarkersToInput = _bindMarkers; }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); if (_movie.StartsFromSavestate) { SetState(0, _movie.BinarySavestate); } _decay = new StateManagerDecay(_movie, this); _expectedStateSize = (ulong)Core.SaveStateBinary().Length; if (_expectedStateSize == 0) { throw new InvalidOperationException("Savestate size can not be zero!"); } _states = new SortedList <int, byte[]>(MaxStates); UpdateStateFrequency(); }
public void Undo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (_isFloat) { for (int i = 0; i < _oldState.Count; i++) { movie.SetFloatState(FirstFrame + i, _buttonName, _oldState[i]); } } else { for (int i = 0; i < _oldState.Count; i++) { movie.SetBoolState(FirstFrame + i, _buttonName, _oldState[i] == 1); } } movie.ChangeLog.IsRecording = wasRecording; }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); int limit = 0; _expectedStateSize = (ulong)Core.SaveStateBinary().Length; if (_expectedStateSize > 0) { limit = maxStates; } States = new SortedList <int, byte[]>(limit); if (Directory.Exists(statePath)) { Directory.Delete(statePath, true); // To delete old files that may still exist. } Directory.CreateDirectory(statePath); accessed = new List <int>(); }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings); int limit = 0; _expectedStateSize = (ulong)Core.SaveStateBinary().Length; if (_expectedStateSize > 0) { limit = maxStates; } States = new SortedList<int, byte[]>(limit); if (Directory.Exists(statePath)) { Directory.Delete(statePath, true); // To delete old files that may still exist. } Directory.CreateDirectory(statePath); accessed = new List<int>(); }
public void Undo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker movie.Markers.Remove(movie.Markers.Get(LastFrame), true); else if (LastFrame == -1) // Action: Remove marker movie.Markers.Add(FirstFrame, oldMessage, true); else // Action: Move/rename marker { movie.Markers.Move(LastFrame, FirstFrame, true); movie.Markers.Get(LastFrame).Message = oldMessage; } }
public TasSession(TasMovie movie) { _movie = movie; CurrentFrame = 0; CurrentBranch = -1; }
public MovieActionPaint(int startFrame, int endFrame, string button, float newS, TasMovie movie) { newState = newS; FirstFrame = startFrame; LastFrame = endFrame; buttonName = button; isFloat = true; oldState = new List<float>(endFrame - startFrame + 1); for (int i = 0; i < endFrame - startFrame + 1; i++) oldState.Add(movie.BoolIsPressed(startFrame + i, button) ? 1 : 0); }
public void Redo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker movie.Markers.Add(LastFrame, oldMessage); else if (LastFrame == -1) // Action: Remove marker movie.Markers.Remove(movie.Markers.Get(FirstFrame)); else // Action: Move/rename marker { movie.Markers.Move(FirstFrame, LastFrame); movie.Markers.Get(LastFrame).Message = newMessage; } }
public void SetRedoLog(TasMovie movie) { redoLength = Math.Min(LastFrame + 1, movie.InputLogLength) - FirstFrame; newLog = new List<string>(); for (int i = 0; i < redoLength; i++) newLog.Add(movie.GetLogEntries()[FirstFrame + i]); }
public MovieActionPaint(int startFrame, int endFrame, string button, float newS, TasMovie movie) { _newState = newS; FirstFrame = startFrame; LastFrame = endFrame; _buttonName = button; _isFloat = true; _oldState = new List <float>(endFrame - startFrame + 1); for (int i = 0; i < endFrame - startFrame + 1; i++) { _oldState.Add(movie.BoolIsPressed(startFrame + i, button) ? 1 : 0); } }
public TasMovieChangeLog(TasMovie movie) { _movie = movie; }
private bool _align; // extra care about fine alignment. TODO: do we want it? public StateManagerDecay(TasMovie movie, IStateManager tsm) { _movie = movie; _tsm = tsm; _align = false; }
private void EngageTastudio() { GlobalWin.MainForm.PauseOnFrame = null; GlobalWin.OSD.AddMessage("TAStudio engaged"); _tas = Global.MovieSession.Movie as TasMovie; GlobalWin.MainForm.PauseEmulator(); GlobalWin.MainForm.RelinquishControl(this); _originalRewindStatus = Global.Rewinder.RewindActive; _originalEndAction = Global.Config.MovieEndAction; MarkerControl.Markers = _tas.Markers; GlobalWin.MainForm.EnableRewind(false); Global.Config.MovieEndAction = MovieEndAction.Record; GlobalWin.MainForm.SetMainformMovieInfo(); }
public TasStateManager(TasMovie movie) { _movie = movie; Settings = new ManagerSettings(); }
public MovieActionPaint(int startFrame, int endFrame, string button, bool newS, TasMovie movie) { newState = newS ? 1 : 0; FirstFrame = startFrame; LastFrame = endFrame; buttonName = button; oldState = new List <float>(endFrame - startFrame + 1); for (int i = 0; i < endFrame - startFrame + 1; i++) { oldState.Add(movie.BoolIsPressed(startFrame + i, button) ? 1 : 0); } }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (isFloat) movie.SetFloatStates(FirstFrame, LastFrame - FirstFrame + 1, buttonName, newState); else movie.SetBoolStates(FirstFrame, LastFrame - FirstFrame + 1, buttonName, newState == 1); movie.ChangeLog.IsRecording = wasRecording; }
public void Load(BinaryStateLoader bl, TasMovie movie) { var nheader = new IndexedStateLump(BinaryStateLump.BranchHeader); var ncore = new IndexedStateLump(BinaryStateLump.BranchCoreData); var ninput = new IndexedStateLump(BinaryStateLump.BranchInputLog); var nframebuffer = new IndexedStateLump(BinaryStateLump.BranchFrameBuffer); var ncoreframebuffer = new IndexedStateLump(BinaryStateLump.BranchCoreFrameBuffer); var nmarkers = new IndexedStateLump(BinaryStateLump.BranchMarkers); var nusertext = new IndexedStateLump(BinaryStateLump.BranchUserText); Clear(); while (true) { var b = new TasBranch(); if (!bl.GetLump(nheader, false, delegate(TextReader tr) { var header = (dynamic)JsonConvert.DeserializeObject(tr.ReadLine()); b.Frame = (int)header.Frame; var timestamp = header.TimeStamp; if (timestamp != null) { b.TimeStamp = (DateTime)timestamp; } else { b.TimeStamp = DateTime.Now; } var identifier = header.UniqueIdentifier; if (identifier != null) { b.UniqueIdentifier = (Guid)identifier; } else { b.UniqueIdentifier = Guid.NewGuid(); } })) { return; } bl.GetLump(ncore, true, delegate(Stream s, long length) { b.CoreData = new byte[length]; s.Read(b.CoreData, 0, b.CoreData.Length); }); bl.GetLump(ninput, true, delegate(TextReader tr) { b.InputLog = StringLogUtil.MakeStringLog(); string line; while ((line = tr.ReadLine()) != null) { b.InputLog.Add(line); } }); bl.GetLump(nframebuffer, true, delegate(Stream s, long length) { var vp = new QuickBmpFile.LoadedBMP(); QuickBmpFile.Load(vp, s); b.OSDFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer); }); bl.GetLump(ncoreframebuffer, false, delegate(Stream s, long length) { var vp = new QuickBmpFile.LoadedBMP(); QuickBmpFile.Load(vp, s); b.CoreFrameBuffer = new BitmapBuffer(vp.BufferWidth, vp.BufferHeight, vp.VideoBuffer); }); b.Markers = new TasMovieMarkerList(movie); bl.GetLump(nmarkers, false, delegate(TextReader tr) { string line; while ((line = tr.ReadLine()) != null) { if (!string.IsNullOrWhiteSpace(line)) { b.Markers.Add(new TasMovieMarker(line)); } } }); bl.GetLump(nusertext, false, delegate(TextReader tr) { string line; if ((line = tr.ReadLine()) != null) { if (!string.IsNullOrWhiteSpace(line)) { b.UserText = line; } } }); Add(b); nheader.Increment(); ncore.Increment(); ninput.Increment(); nframebuffer.Increment(); ncoreframebuffer.Increment(); nmarkers.Increment(); nusertext.Increment(); } }
public void Redo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; bool wasBinding = movie.BindMarkersToInput; movie.ChangeLog.IsRecording = false; movie.BindMarkersToInput = bindMarkers; if (delete) { movie.RemoveFrame(FirstFrame); movie.RemoveLagHistory(FirstFrame + 1); } else { movie.InsertInput(FirstFrame, log); movie.InsertLagHistory(FirstFrame + 1, true); } movie.ChangeLog.IsRecording = wasRecording; movie.BindMarkersToInput = bindMarkers; }
public TasMovieChangeLog(TasMovie movie) { History = new List <List <IMovieAction> >(); Names = new List <string>(); Movie = movie; }
private bool LoadFile(FileInfo file, bool startsFromSavestate = false) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return false; } TasMovie newMovie = new TasMovie(startsFromSavestate, _saveBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; Settings.RecentTas.Add(newMovie.Filename); if (!HandleMovieLoadStuff(newMovie)) return false; if (TasView.AllColumns.Count() == 0) SetUpColumns(); if (startsFromSavestate) GoToFrame(0); else GoToFrame(CurrentTasMovie.Session.CurrentFrame); CurrentTasMovie.PropertyChanged += new PropertyChangedEventHandler(this.TasMovie_OnPropertyChanged); CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return true; }
public TasMovieChangeLog(TasMovie movie) { History = new List<List<IMovieAction>>(); Names = new List<string>(); Movie = movie; }
public TasMovieMarkerList(TasMovie movie) { _movie = movie; }
public void Undo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (isFloat) movie.SetFloatState(FirstFrame, buttonName, oldState); else movie.SetBoolState(FirstFrame, buttonName, oldState == 1); movie.ChangeLog.IsRecording = wasRecording; }
private void NewTasMovie() { Global.MovieSession.Movie = new TasMovie(); _tas = Global.MovieSession.Movie as TasMovie; _tas.Filename = DefaultTasProjName(); // TODO don't do this, take over any mainform actions that can crash without a filename _tas.PopulateWithDefaultHeaderValues(); _tas.ClearChanges(); }
public void Undo(TasMovie movie) { bool wasRecording = movie.ChangeLog.IsRecording; movie.ChangeLog.IsRecording = false; if (isFloat) { for (int i = 0; i < oldState.Count; i++) movie.SetFloatState(FirstFrame + i, buttonName, oldState[i]); } else { for (int i = 0; i < oldState.Count; i++) movie.SetBoolState(FirstFrame + i, buttonName, oldState[i] == 1); } movie.ChangeLog.IsRecording = wasRecording; }
private bool LoadFile(FileInfo file) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return false; } TasMovie newMovie = new TasMovie(false, _saveBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; Settings.RecentTas.Add(newMovie.Filename); if (!HandleMovieLoadStuff(newMovie)) return false; SetUpColumns(); GoToFrame(CurrentTasMovie.Session.CurrentFrame); CurrentTasMovie.CurrentBranch = CurrentTasMovie.Session.CurrentBranch; // clear all selections TasView.DeselectAll(); BookMarkControl.Restart(); MarkerControl.Restart(); RefreshDialog(); return true; }
public MovieActionBindInput(TasMovie movie, int frame, bool isDelete) { FirstFrame = LastFrame = frame; log = movie.GetInputLogEntry(frame); delete = isDelete; bindMarkers = movie.BindMarkersToInput; }
private bool HandleMovieLoadStuff(TasMovie movie = null) { bool result; WantsToControlStopMovie = false; if (movie == null) { movie = CurrentTasMovie; result = StartNewMovieWrapper(movie.InputLogLength == 0, movie); } else { if (movie.Filename.EndsWith(TasMovie.Extension)) { } else if (movie.Filename.EndsWith(".bkm") || movie.Filename.EndsWith(".bk2")) // was loaded using "All Files" filter. todo: proper extention iteration { var result1 = MessageBox.Show("This is a regular movie, a new project must be created from it, in order to use in TAStudio\nProceed?", "Convert movie", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result1 == DialogResult.OK) { ConvertCurrentMovieToTasproj(); } else { return false; } } else { MessageBox.Show("This is not a BizHawk movie!", "Movie load error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } result = StartNewMovieWrapper(false, movie); } if (!result) return false; WantsToControlStopMovie = true; CurrentTasMovie.ChangeLog.ClearLog(); CurrentTasMovie.ClearChanges(); SetTextProperty(); MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " loaded."; return true; }
private void SetTasMovieCallbacks(TasMovie movie = null) { if (movie == null) movie = CurrentTasMovie; movie.ClientSettingsForSave = ClientSettingsForSave; movie.GetClientSettingsOnLoad = GetClientSettingsOnLoad; }
public TasMovieChangeLog(TasMovie movie) { _history = new List <List <IMovieAction> >(); _movie = movie; }
private bool HandleMovieLoadStuff(TasMovie movie = null) { bool result; WantsToControlStopMovie = false; if (movie == null) { movie = CurrentTasMovie; result = StartNewMovieWrapper(movie.InputLogLength == 0, movie); } else result = StartNewMovieWrapper(false, movie); if (!result) return false; WantsToControlStopMovie = true; CurrentTasMovie.ChangeLog.ClearLog(); CurrentTasMovie.ClearChanges(); SetTextProperty(); MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " loaded."; return true; }
private bool LoadFile(FileInfo file) { if (!file.Exists) { Settings.RecentTas.HandleLoadError(file.FullName); return false; } TasMovie newMovie = new TasMovie(false, _saveBackgroundWorker); newMovie.TasStateManager.InvalidateCallback = GreenzoneInvalidated; newMovie.Filename = file.FullName; Settings.RecentTas.Add(newMovie.Filename); if (!HandleMovieLoadStuff(newMovie)) return false; BookMarkControl.UpdateValues(); RefreshDialog(); return true; }
public void LoadProject(string path) { if (AskSave()) { var movie = new TasMovie { Filename = path }; var file = new FileInfo(path); if (!file.Exists) { Global.Config.RecentTas.HandleLoadError(path); } GlobalWin.MainForm.StartNewMovie(movie, record: false); _tas = Global.MovieSession.Movie as TasMovie; Global.Config.RecentTas.Add(path); RefreshDialog(); } }