somehow a movie recording object survived tucked away in Implementations that predates bizhawk movie recording
This commit is contained in:
parent
348171bdc5
commit
f52220bc5a
|
@ -453,7 +453,6 @@
|
|||
<Compile Include="CPUs\Z80\Tables.cs" />
|
||||
<Compile Include="CPUs\Z80\Z80A.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\IPS.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\Movies.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullController.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
|
||||
<Compile Include="Interfaces\CoreComms.cs" />
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
using System.IO;
|
||||
|
||||
namespace BizHawk
|
||||
{
|
||||
public class InputRecorder : IController
|
||||
{
|
||||
private IController baseController;
|
||||
private BinaryWriter writer;
|
||||
|
||||
public InputRecorder(IController baseController, BinaryWriter writer)
|
||||
{
|
||||
this.baseController = baseController;
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
public void CloseMovie()
|
||||
{
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
public ControllerDefinition Type
|
||||
{
|
||||
get { return baseController.Type; }
|
||||
}
|
||||
|
||||
public bool this[string button]
|
||||
{
|
||||
get { return baseController[button]; }
|
||||
}
|
||||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
return baseController[button];
|
||||
}
|
||||
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
return baseController.GetFloat(name);
|
||||
}
|
||||
|
||||
private int frame;
|
||||
|
||||
public void UpdateControls(int frame)
|
||||
{
|
||||
if (this.frame != frame)
|
||||
{
|
||||
this.frame = frame;
|
||||
baseController.UpdateControls(frame);
|
||||
RecordFrame();
|
||||
}
|
||||
}
|
||||
|
||||
private void RecordFrame()
|
||||
{
|
||||
int encodedValue = 0;
|
||||
for (int i = 0; i < Type.BoolButtons.Count; i++)
|
||||
{
|
||||
if (baseController[Type.BoolButtons[i]])
|
||||
{
|
||||
encodedValue |= (1 << i);
|
||||
}
|
||||
}
|
||||
writer.Seek(frame * 2, SeekOrigin.Begin);
|
||||
writer.Write((ushort)encodedValue);
|
||||
}
|
||||
}
|
||||
|
||||
public class InputPlayback : IController
|
||||
{
|
||||
private ControllerDefinition def;
|
||||
private int[] input;
|
||||
private int frame;
|
||||
|
||||
public InputPlayback(ControllerDefinition controllerDefinition, BinaryReader reader)
|
||||
{
|
||||
def = controllerDefinition;
|
||||
int numFrames = (int)(reader.BaseStream.Length / 2);
|
||||
input = new int[numFrames];
|
||||
for (int i = 0; i < numFrames; i++)
|
||||
input[i] = reader.ReadUInt16();
|
||||
}
|
||||
|
||||
public ControllerDefinition Type
|
||||
{
|
||||
get { return def; }
|
||||
}
|
||||
|
||||
public bool this[string button]
|
||||
{
|
||||
get { return IsPressed(button); }
|
||||
}
|
||||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
if (frame >= input.Length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < def.BoolButtons.Count; i++)
|
||||
{
|
||||
if (def.BoolButtons[i] == button)
|
||||
{
|
||||
return (input[frame] & (1 << i)) != 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateControls(int frame)
|
||||
{
|
||||
this.frame = frame;
|
||||
}
|
||||
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void UnpressButton(string name) { }
|
||||
public void ForceButton(string button) { }
|
||||
public void SetSticky(string button, bool sticky) { }
|
||||
public bool IsSticky(string button) { return false; }
|
||||
|
||||
public bool MovieEnded { get { return frame >= input.Length; } }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue