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 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

@ -1136,7 +1136,7 @@ namespace BizHawk.MultiClient
Global.RenderPanel.MT = "Recording None"; Global.RenderPanel.MT = "Recording None";
} }
else else
Global.RenderPanel.AddMessage("MultiTrack Disabled"); Global.RenderPanel.AddMessage("MultiTrack Disabled");
Global.MainForm.UserMovie.MultiTrack.RecordAll = false; Global.MainForm.UserMovie.MultiTrack.RecordAll = false;
Global.MainForm.UserMovie.MultiTrack.CurrentPlayer = 0; Global.MainForm.UserMovie.MultiTrack.CurrentPlayer = 0;
Global.ClientControls.UnpressButton("Toggle MultiTrack"); Global.ClientControls.UnpressButton("Toggle MultiTrack");
@ -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();
@ -1318,10 +1319,13 @@ namespace BizHawk.MultiClient
NESPPU1.UpdateValues(); NESPPU1.UpdateValues();
TAStudio1.UpdateValues(); TAStudio1.UpdateValues();
if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD) if (UserMovie.GetMovieMode() == MOVIEMODE.RECORD)
UserMovie.GetMnemonic(); {
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD) UserMovie.GetMnemonic();
InputLog.GetMnemonic(); //Console.WriteLine("In: " + UserMovie.GetInputFrame(Global.Emulator.Frame));
}
else if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.GetMnemonic();
} }
if (genSound) if (genSound)

View File

@ -84,30 +84,30 @@ namespace BizHawk.MultiClient
public void GetMnemonic() public void GetMnemonic()
{ {
if (MultiTrack.isActive) if (MultiTrack.isActive)
{ {
if (MovieMode == MOVIEMODE.RECORD) if (MovieMode == MOVIEMODE.RECORD)
{ {
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());
} }
} }
else else
if (MovieMode == MOVIEMODE.RECORD) if (MovieMode == MOVIEMODE.RECORD)
{ {
if (Global.Emulator.Frame < Log.Length()) if (Global.Emulator.Frame < Log.Length())
{ {
Log.Truncate(Global.Emulator.Frame); Log.Truncate(Global.Emulator.Frame);
} }
// if (Global.MainForm.TAStudio1.Engaged) // if (Global.MainForm.TAStudio1.Engaged)
// Log.AddFrame(Global.MainForm.TAStudio1.GetMnemonic()); // Log.AddFrame(Global.MainForm.TAStudio1.GetMnemonic());
// else // else
Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic()); Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic());
} }
} }
public string GetInputFrame(int frame) public string GetInputFrame(int frame)
@ -349,17 +349,37 @@ 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
Log.Clear(); if (!MultiTrack.isActive)
while (true) {
{ Log.Clear();
string line = reader.ReadLine(); while (true)
if (line == null) break; {
if (line.Trim() == "") continue; string line = reader.ReadLine();
if (line == "[Input]") continue; if (line == null) break;
if (line == "[/Input]") break; if (line.Trim() == "") continue;
if (line[0] == '|') if (line == "[Input]") continue;
Log.AddFrame(line); 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) //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?
IncrementRerecordCount(); IncrementRerecordCount();

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