From ced8256dc9fc06d2216a8fd9cf479c35f0741987 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 3 Mar 2011 18:25:06 +0000 Subject: [PATCH] Slight playback fix (still broken) --- BizHawk.MultiClient/MainForm.cs | 16 +++++++--------- BizHawk.MultiClient/RenderPanel.cs | 14 +++++++++++++- BizHawk.MultiClient/movie/Movie.cs | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 8f9f1e05f5..3546e4511f 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -21,7 +21,7 @@ namespace BizHawk.MultiClient private string CurrentlyOpenRom; //TODO: adelikat: can this be the official file extension? - Movie InputLog = new Movie("log.tas", MOVIEMODE.RECORD); //This movie is always recording while user is playing + public Movie InputLog = new Movie("log.tas", MOVIEMODE.RECORD); //This movie is always recording while user is playing //the currently selected savestate slot private int SaveSlot = 0; @@ -148,12 +148,10 @@ namespace BizHawk.MultiClient { for (; ; ) { - if (InputLog.GetMovieMode() != MOVIEMODE.PLAY) //TODO: user movie not input log - Input.Update(); - + + Input.Update(); CheckHotkeys(); - - + StepRunLoop_Core(); if(!IsNullEmulator()) StepRunLoop_Throttle(); @@ -587,9 +585,6 @@ namespace BizHawk.MultiClient void StepRunLoop_Core() { - if (InputLog.GetMovieMode() == MOVIEMODE.PLAY) - Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame)); - bool runFrame = false; runloop_frameadvance = false; DateTime now = DateTime.Now; @@ -659,6 +654,8 @@ namespace BizHawk.MultiClient if (!runloop_frameadvance) genSound = true; else if (!Global.Config.MuteFrameAdvance) genSound = true; + if (InputLog.GetMovieMode() == MOVIEMODE.PLAY) + Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame)); Global.Emulator.FrameAdvance(!throttle.skipnextframe); RamWatch1.UpdateValues(); RamSearch1.UpdateValues(); @@ -1122,6 +1119,7 @@ namespace BizHawk.MultiClient private void replayInputLogToolStripMenuItem_Click(object sender, EventArgs e) { + InputLog.StopMovie(); InputLog.StartPlayback(); LoadRom(CurrentlyOpenRom); } diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index d293facddc..946036a69c 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -255,7 +255,7 @@ namespace BizHawk.MultiClient { //TODO: If movie loaded use that frame counter, and also display total movie frame count if read-only if (Global.Config.DisplayFrameCounter) - MessageFont.DrawString(null, Global.Emulator.Frame.ToString(), 1, 1, new Color4(Color.White)); //TODO: Allow user to set screen coordinates? + MessageFont.DrawString(null, MakeFrameCounter(), 1, 1, new Color4(Color.White)); //TODO: Allow user to set screen coordinates? if (Global.Config.DisplayInput) { @@ -264,6 +264,18 @@ namespace BizHawk.MultiClient } } + private string MakeFrameCounter() + { + if (Global.MainForm.InputLog.GetMovieMode() == MOVIEMODE.PLAY) //TODO: use user movie not input log (input log will never be allowed to be played back) + { + return Global.Emulator.Frame.ToString() + "/" + Global.MainForm.InputLog.GetMovieLength().ToString(); + } + else + { + return Global.Emulator.Frame.ToString(); + } + } + private List messages = new List(5); public void AddMessage(string message) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index e7a219391b..60297b31de 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -7,7 +7,7 @@ using System.IO; namespace BizHawk.MultiClient { public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED }; - class Movie + public class Movie { private MovieHeader Header = new MovieHeader(); private MovieLog Log = new MovieLog();