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; private string CurrentlyOpenRom;
//TODO: adelikat: can this be the official file extension? //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 //the currently selected savestate slot
private int SaveSlot = 0; private int SaveSlot = 0;
@ -148,12 +148,10 @@ namespace BizHawk.MultiClient
{ {
for (; ; ) for (; ; )
{ {
if (InputLog.GetMovieMode() != MOVIEMODE.PLAY) //TODO: user movie not input log
Input.Update(); Input.Update();
CheckHotkeys(); CheckHotkeys();
StepRunLoop_Core(); StepRunLoop_Core();
if(!IsNullEmulator()) if(!IsNullEmulator())
StepRunLoop_Throttle(); StepRunLoop_Throttle();
@ -587,9 +585,6 @@ namespace BizHawk.MultiClient
void StepRunLoop_Core() void StepRunLoop_Core()
{ {
if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame));
bool runFrame = false; bool runFrame = false;
runloop_frameadvance = false; runloop_frameadvance = false;
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
@ -659,6 +654,8 @@ namespace BizHawk.MultiClient
if (!runloop_frameadvance) genSound = true; if (!runloop_frameadvance) genSound = true;
else if (!Global.Config.MuteFrameAdvance) else if (!Global.Config.MuteFrameAdvance)
genSound = true; genSound = true;
if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame));
Global.Emulator.FrameAdvance(!throttle.skipnextframe); Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues(); RamWatch1.UpdateValues();
RamSearch1.UpdateValues(); RamSearch1.UpdateValues();
@ -1122,6 +1119,7 @@ namespace BizHawk.MultiClient
private void replayInputLogToolStripMenuItem_Click(object sender, EventArgs e) private void replayInputLogToolStripMenuItem_Click(object sender, EventArgs e)
{ {
InputLog.StopMovie();
InputLog.StartPlayback(); InputLog.StartPlayback();
LoadRom(CurrentlyOpenRom); 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 //TODO: If movie loaded use that frame counter, and also display total movie frame count if read-only
if (Global.Config.DisplayFrameCounter) 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) 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); private List<UIMessage> messages = new List<UIMessage>(5);
public void AddMessage(string message) public void AddMessage(string message)

View File

@ -7,7 +7,7 @@ using System.IO;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED }; public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED };
class Movie public class Movie
{ {
private MovieHeader Header = new MovieHeader(); private MovieHeader Header = new MovieHeader();
private MovieLog Log = new MovieLog(); private MovieLog Log = new MovieLog();