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

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

View File

@ -1306,9 +1306,10 @@ namespace BizHawk.MultiClient
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1); Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1);
} }
} }
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && Global.MainForm.UserMovie.MultiTrack.isActive) if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD && UserMovie.MultiTrack.isActive)
{ {
Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame) + 1); Global.ActiveController.SetControllersAsMnemonic(UserMovie.GetInputFrame(Global.Emulator.Frame-1));
//Console.WriteLine("Out: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
} }
Global.Emulator.FrameAdvance(!throttle.skipnextframe); Global.Emulator.FrameAdvance(!throttle.skipnextframe);
RamWatch1.UpdateValues(); RamWatch1.UpdateValues();
@ -1319,7 +1320,10 @@ namespace BizHawk.MultiClient
TAStudio1.UpdateValues(); TAStudio1.UpdateValues();
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD)
{
UserMovie.GetMnemonic(); UserMovie.GetMnemonic();
//Console.WriteLine("In: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
}
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD) else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.GetMnemonic(); InputLog.GetMnemonic();
} }

View File

@ -90,7 +90,7 @@ namespace BizHawk.MultiClient
{ {
if (Global.Emulator.Frame < Log.Length()) if (Global.Emulator.Frame < Log.Length())
Log.AddFrameAt(Global.ActiveController.GetControllersAsMnemonic(), Global.Emulator.Frame - 1); Log.ReplaceFrameAt(Global.ActiveController.GetControllersAsMnemonic(),Global.Emulator.Frame);
else else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic()); Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
} }
@ -349,6 +349,8 @@ namespace BizHawk.MultiClient
public void LoadLogFromSavestateText(TextReader reader) public void LoadLogFromSavestateText(TextReader reader)
{ {
//We are in record mode so replace the movie log with the one from the savestate //We are in record mode so replace the movie log with the one from the savestate
if (!MultiTrack.isActive)
{
Log.Clear(); Log.Clear();
while (true) while (true)
{ {
@ -359,6 +361,24 @@ namespace BizHawk.MultiClient
if (line == "[/Input]") break; if (line == "[/Input]") break;
if (line[0] == '|') if (line[0] == '|')
Log.AddFrame(line); 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) //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? //However, VBA will load it all, then truncate on the next frame, do we want that?

View File

@ -39,7 +39,13 @@ namespace BizHawk.MultiClient
{ {
MovieRecords.Add(frame); 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) public void AddFrameAt(string frame, int frameNum)
{ {
MovieRecords.Insert(frameNum, frame); MovieRecords.Insert(frameNum, frame);