Communicate with IMovie via MnemonicsGenerator objects
This commit is contained in:
parent
a2b3201912
commit
b80f5a07ea
|
@ -84,14 +84,14 @@ namespace BizHawk.Client.Common
|
||||||
#region Editing API
|
#region Editing API
|
||||||
|
|
||||||
void ClearFrame(int frame);
|
void ClearFrame(int frame);
|
||||||
void AppendFrame(string record);
|
void AppendFrame(MnemonicsGenerator mg);
|
||||||
void Truncate(int frame);
|
void Truncate(int frame);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Dubious, should reconsider
|
#region Dubious, should reconsider
|
||||||
|
|
||||||
void CommitFrame(int frameNum, IController source); // Why pass in frameNum? Calling api
|
void CommitFrame(int frameNum, MnemonicsGenerator mg); // Why pass in frameNum? Calling api
|
||||||
void PokeFrame(int frameNum, string input); // Why does this exist as something different than Commit Frame?
|
void PokeFrame(int frameNum, string input); // Why does this exist as something different than Commit Frame?
|
||||||
LoadStateResult CheckTimeLines(TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage); // No need to return a status, no reason to have hacky flags, no need to pass a textreader
|
LoadStateResult CheckTimeLines(TextReader reader, bool onlyGuid, bool ignoreGuidMismatch, out string errorMessage); // No need to return a status, no reason to have hacky flags, no need to pass a textreader
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace BizHawk.Client.Common
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// String representation of the controller input as a series of mnemonics
|
/// String representation of the controller input as a series of mnemonics
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Input { get; }
|
string Input { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not this was a lag frame,
|
/// Whether or not this was a lag frame,
|
||||||
|
|
|
@ -349,9 +349,9 @@ namespace BizHawk.Client.Common
|
||||||
_changes = true;
|
_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendFrame(string record)
|
public void AppendFrame(MnemonicsGenerator mg)
|
||||||
{
|
{
|
||||||
_log.AppendFrame(record);
|
_log.AppendFrame(mg.GetControllersAsMnemonic());
|
||||||
_changes = true;
|
_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ namespace BizHawk.Client.Common
|
||||||
_log.SetFrameAt(frameNum, input);
|
_log.SetFrameAt(frameNum, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CommitFrame(int frameNum, IController source)
|
public void CommitFrame(int frameNum, MnemonicsGenerator mg)
|
||||||
{
|
{
|
||||||
// Note: Truncation here instead of loadstate will make VBA style loadstates
|
// Note: Truncation here instead of loadstate will make VBA style loadstates
|
||||||
// (Where an entire movie is loaded then truncated on the next frame
|
// (Where an entire movie is loaded then truncated on the next frame
|
||||||
|
@ -386,8 +386,6 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
_changes = true;
|
_changes = true;
|
||||||
var mg = new MnemonicsGenerator();
|
|
||||||
mg.SetSource(source);
|
|
||||||
_log.SetFrameAt(frameNum, mg.GetControllersAsMnemonic());
|
_log.SetFrameAt(frameNum, mg.GetControllersAsMnemonic());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
// Convert the data for the controllers to a mnemonic and add it as a frame.
|
// Convert the data for the controllers to a mnemonic and add it as a frame.
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,6 @@ namespace BizHawk.Client.Common
|
||||||
while (frame <= frameCount)
|
while (frame <= frameCount)
|
||||||
{
|
{
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
string mnemonic = mg.GetControllersAsMnemonic();
|
|
||||||
byte update = r.ReadByte();
|
byte update = r.ReadByte();
|
||||||
// aa: Number of delta bytes to follow
|
// aa: Number of delta bytes to follow
|
||||||
int delta = (update >> 5) & 0x3;
|
int delta = (update >> 5) & 0x3;
|
||||||
|
@ -597,11 +596,10 @@ namespace BizHawk.Client.Common
|
||||||
frame += frames;
|
frame += frames;
|
||||||
while (frames > 0)
|
while (frames > 0)
|
||||||
{
|
{
|
||||||
m.AppendFrame(mnemonic);
|
m.AppendFrame(mg);
|
||||||
if (controllers["Reset"])
|
if (controllers["Reset"])
|
||||||
{
|
{
|
||||||
controllers["Reset"] = false;
|
controllers["Reset"] = false;
|
||||||
mnemonic = mg.GetControllersAsMnemonic();
|
|
||||||
}
|
}
|
||||||
frames--;
|
frames--;
|
||||||
}
|
}
|
||||||
|
@ -856,7 +854,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -983,7 +981,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1328,7 @@ namespace BizHawk.Client.Common
|
||||||
warningMsg = "Control commands are not properly supported.";
|
warningMsg = "Control commands are not properly supported.";
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -1452,7 +1450,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -1682,7 +1680,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -1954,7 +1952,7 @@ namespace BizHawk.Client.Common
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -2226,7 +2224,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -2446,7 +2444,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
r.Close();
|
r.Close();
|
||||||
fs.Close();
|
fs.Close();
|
||||||
|
@ -2614,7 +2612,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
controllers["Reset"] = true;
|
controllers["Reset"] = true;
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
controllers["Reset"] = false;
|
controllers["Reset"] = false;
|
||||||
}
|
}
|
||||||
// TODO: Other commands.
|
// TODO: Other commands.
|
||||||
|
@ -2630,7 +2628,7 @@ namespace BizHawk.Client.Common
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
for (; frames <= frame; frames++)
|
for (; frames <= frame; frames++)
|
||||||
{
|
{
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (((flag >> 2) & 0x1) != 0)
|
else if (((flag >> 2) & 0x1) != 0)
|
||||||
|
@ -2743,7 +2741,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mg.SetSource(controllers);
|
mg.SetSource(controllers);
|
||||||
m.AppendFrame(mg.GetControllersAsMnemonic());
|
m.AppendFrame(mg);
|
||||||
frames++;
|
frames++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
private List<byte> _state = new List<byte>();
|
private List<byte> _state = new List<byte>();
|
||||||
|
|
||||||
public string Input { get; private set; }
|
public string Input { get; set; }
|
||||||
public bool Lagged { get; private set; }
|
public bool Lagged { get; private set; }
|
||||||
public IEnumerable<byte> State
|
public IEnumerable<byte> State
|
||||||
{
|
{
|
||||||
|
|
|
@ -182,7 +182,9 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
|
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
|
||||||
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
|
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
|
||||||
Movie.CommitFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint);
|
var mg = new MnemonicsGenerator();
|
||||||
|
mg.SetSource(Global.MovieOutputHardpoint);
|
||||||
|
Movie.CommitFrame(Global.Emulator.Frame, mg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,12 +172,15 @@ namespace BizHawk.Client.Common
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendFrame(string record)
|
public void AppendFrame(MnemonicsGenerator mg)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
_records.Add(new MovieRecord()
|
||||||
|
{
|
||||||
|
Input = mg.GetControllersAsMnemonic(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CommitFrame(int frameNum, Emulation.Common.IController source)
|
public void CommitFrame(int frameNum, MnemonicsGenerator mg)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue