Getting closer.

This commit is contained in:
kylethomson 2011-06-17 02:43:22 +00:00
parent 9e7510894e
commit c228699255
4 changed files with 75 additions and 46 deletions

View File

@ -317,8 +317,7 @@ namespace BizHawk.MultiClient
}
}
else
{
Console.WriteLine(mnemonic);
{
for (int i = 1; i < 6; i++)
{
if ((Global.MainForm.UserMovie.MultiTrack.CurrentPlayer == i) || Global.MainForm.UserMovie.MultiTrack.RecordAll)

View File

@ -1136,7 +1136,7 @@ namespace BizHawk.MultiClient
Global.RenderPanel.MT = "Recording None";
}
else
Global.RenderPanel.AddMessage("MultiTrack Disabled");
Global.RenderPanel.AddMessage("MultiTrack Disabled");
Global.MainForm.UserMovie.MultiTrack.RecordAll = false;
Global.MainForm.UserMovie.MultiTrack.CurrentPlayer = 0;
Global.ClientControls.UnpressButton("Toggle MultiTrack");
@ -1306,9 +1306,10 @@ namespace BizHawk.MultiClient
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
}
}
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && Global.MainForm.UserMovie.MultiTrack.isActive)
{
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && UserMovie.MultiTrack.isActive)
{
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame-1));
//Console.WriteLine("Out: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
}
Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues();
@ -1318,10 +1319,13 @@ namespace BizHawk.MultiClient
NESPPU1.UpdateValues();
TAStudio1.UpdateValues();
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD)
UserMovie.GetMnemonic();
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.GetMnemonic();
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD)
{
UserMovie.GetMnemonic();
//Console.WriteLine("In: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
}
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.GetMnemonic();
}
if (genSound)

View File

@ -84,30 +84,30 @@ namespace BizHawk.MultiClient
public void GetMnemonic()
{
if (MultiTrack.isActive)
{
if (MovieMode == MOVIEMODE.RECORD)
{
if (Global.Emulator.Frame < Log.Length())
Log.AddFrameAt(Global.ActiveController.GetControllersAsMnemonic(), Global.Emulator.Frame - 1);
else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
}
}
else
if (MovieMode == MOVIEMODE.RECORD)
{
if (Global.Emulator.Frame < Log.Length())
{
Log.Truncate(Global.Emulator.Frame);
}
// if (Global.MainForm.TAStudio1.Engaged)
// Log.AddFrame(Global.MainForm.TAStudio1.GetMnemonic());
// else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
}
if (MultiTrack.isActive)
{
if (MovieMode == MOVIEMODE.RECORD)
{
if (Global.Emulator.Frame < Log.Length())
Log.ReplaceFrameAt(Global.ActiveController.GetControllersAsMnemonic(),Global.Emulator.Frame);
else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
}
}
else
if (MovieMode == MOVIEMODE.RECORD)
{
if (Global.Emulator.Frame < Log.Length())
{
Log.Truncate(Global.Emulator.Frame);
}
// if (Global.MainForm.TAStudio1.Engaged)
// Log.AddFrame(Global.MainForm.TAStudio1.GetMnemonic());
// else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
}
}
public string GetInputFrame(int frame)
@ -349,17 +349,37 @@ namespace BizHawk.MultiClient
public void LoadLogFromSavestateText(TextReader reader)
{
//We are in record mode so replace the movie log with the one from the savestate
Log.Clear();
while (true)
{
string line = reader.ReadLine();
if (line == null) break;
if (line.Trim() == "") continue;
if (line == "[Input]") continue;
if (line == "[/Input]") break;
if (line[0] == '|')
Log.AddFrame(line);
}
if (!MultiTrack.isActive)
{
Log.Clear();
while (true)
{
string line = reader.ReadLine();
if (line == null) break;
if (line.Trim() == "") continue;
if (line == "[Input]") continue;
if (line == "[/Input]") break;
if (line[0] == '|')
Log.AddFrame(line);
}
}
else
{
int i = 0;
while (true)
{
string line = reader.ReadLine();
if (line == null) break;
if (line.Trim() == "") continue;
if (line == "[Input]") continue;
if (line == "[/Input]") break;
if (line[0] == '|')
{
Log.ReplaceFrameAt(line, i);
i++;
}
}
}
//TODO: we can truncate the movie down to the current frame now (in case the savestate has a larger input log)
//However, VBA will load it all, then truncate on the next frame, do we want that?
IncrementRerecordCount();

View File

@ -39,7 +39,13 @@ namespace BizHawk.MultiClient
{
MovieRecords.Add(frame);
}
public void ReplaceFrameAt(string frame, int frameNum)
{
if (MovieRecords.Count > frameNum)
MovieRecords[frameNum] = frame;
else
MovieRecords.Insert(frameNum, frame);
}
public void AddFrameAt(string frame, int frameNum)
{
MovieRecords.Insert(frameNum, frame);