Basic rerecording! Inputlog is now saved into savestates, and input log is replaced by savestates contents if in record mode. Still TODO: lots of logic about proper error/timeline checking & logic
This commit is contained in:
parent
b9c334b93a
commit
3ac209217c
|
@ -1015,6 +1015,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
var writer = new StreamWriter(path);
|
||||
Global.Emulator.SaveStateText(writer);
|
||||
//TODO: logic surrounding the behavior of movie modes & settings
|
||||
//TODO: refactor save/loadstate as functions to automatically include this behavior too
|
||||
InputLog.DumpLogIntoSavestateText(writer);
|
||||
writer.Close();
|
||||
Global.RenderPanel.AddMessage("Saved state: " + name);
|
||||
}
|
||||
|
@ -1048,6 +1051,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
var reader = new StreamReader(path);
|
||||
Global.Emulator.LoadStateText(reader);
|
||||
//TODO: more logic regarding each movie mode
|
||||
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
|
||||
InputLog.LoadLogFromSavestateText(reader);
|
||||
reader.Close();
|
||||
Global.RenderPanel.AddMessage("Loaded state: " + name);
|
||||
}
|
||||
|
|
|
@ -186,5 +186,27 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
return Log.GetMovieLength();
|
||||
}
|
||||
|
||||
public void DumpLogIntoSavestateText(TextWriter writer)
|
||||
{
|
||||
writer.WriteLine("[Input]");
|
||||
for (int x = 0; x < Log.Length(); x++)
|
||||
writer.WriteLine(Log.GetFrame(x));
|
||||
writer.WriteLine("[/Input]");
|
||||
}
|
||||
|
||||
public void LoadLogFromSavestateText(TextReader reader)
|
||||
{
|
||||
Log.Clear();
|
||||
while (true)
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
if (line.Trim() == "") continue;
|
||||
if (line == "[Input]") continue;
|
||||
if (line == "[/Input]") break;
|
||||
if (line[0] == '|')
|
||||
Log.AddFrame(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,11 @@ namespace BizHawk.MultiClient
|
|||
|
||||
}
|
||||
|
||||
public int Length()
|
||||
{
|
||||
return MovieRecords.Count;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
MovieRecords.Clear();
|
||||
|
|
Loading…
Reference in New Issue