Slight playback fix (still broken)

This commit is contained in:
andres.delikat 2011-03-03 18:25:06 +00:00
parent 36bebea251
commit ced8256dc9
3 changed files with 21 additions and 11 deletions

View File

@ -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);
}

View File

@ -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<UIMessage> messages = new List<UIMessage>(5);
public void AddMessage(string message)

View File

@ -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();