Add SetControllersAsMnemonic() to IEmulator and implement it in the SMS core. Very crude playback now works.
This commit is contained in:
parent
dd109b76da
commit
423e9c8783
|
@ -28,6 +28,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
|||
//-------
|
||||
|
||||
public string GetControllersAsMnemonic() { return "|.|0|"; } //TODO: Implement this
|
||||
public void SetControllersAsMnemonic(string mnemonic) { return;/*TODO*/ }
|
||||
|
||||
public byte ReadMemory(ushort addr)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
}
|
||||
};
|
||||
|
||||
public void SetControllersAsMnemonic(string mnemonic)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public string GetControllersAsMnemonic()
|
||||
{
|
||||
return "|........|0|";
|
||||
|
|
|
@ -387,6 +387,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
|||
return "|........|........|0|"; //TODO: implement
|
||||
}
|
||||
|
||||
public void SetControllersAsMnemonic(string mnemonic) { return; } //TODO
|
||||
|
||||
public class RomInfo
|
||||
{
|
||||
public int MapperNo, Mirroring, Num_PRG_Banks, Num_CHR_Banks;
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
public ControllerDefinition ControllerDefinition { get { return PCEngineController; } }
|
||||
public IController Controller { get; set; }
|
||||
|
||||
public void SetControllersAsMnemonic(string mnemonic)
|
||||
{
|
||||
return; //TODO
|
||||
}
|
||||
|
||||
public string GetControllersAsMnemonic()
|
||||
{
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
return "|........|0|"; //TODO: implement
|
||||
}
|
||||
|
||||
public void SetControllersAsMnemonic(string mnemonic)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public ControllerDefinition ControllerDefinition { get { return GenesisController; } }
|
||||
public IController Controller { get; set; }
|
||||
}
|
||||
|
|
|
@ -13,6 +13,42 @@
|
|||
}
|
||||
};
|
||||
|
||||
public void SetControllersAsMnemonic(string mnemonic)
|
||||
{
|
||||
if (mnemonic.Length == 0) return;
|
||||
|
||||
if (mnemonic[1] != '.')
|
||||
Controller.ForceButton("P1 Up");
|
||||
if (mnemonic[2] != '.')
|
||||
Controller.ForceButton("P1 Down");
|
||||
if (mnemonic[3] != '.')
|
||||
Controller.ForceButton("P1 Left");
|
||||
if (mnemonic[4] != '.')
|
||||
Controller.ForceButton("P1 Right");
|
||||
if (mnemonic[5] != '.')
|
||||
Controller.ForceButton("P1 B1");
|
||||
if (mnemonic[6] != '.')
|
||||
Controller.ForceButton("P1 B2");
|
||||
if (mnemonic[7] != '.')
|
||||
Controller.ForceButton("P2 Up");
|
||||
if (mnemonic[8] != '.')
|
||||
Controller.ForceButton("P2 Down");
|
||||
if (mnemonic[9] != '.')
|
||||
Controller.ForceButton("P2 Left");
|
||||
if (mnemonic[10] != '.')
|
||||
Controller.ForceButton("P2 Right");
|
||||
if (mnemonic[11] != '.')
|
||||
Controller.ForceButton("P2 B1");
|
||||
if (mnemonic[12] != '.')
|
||||
Controller.ForceButton("P2 B2");
|
||||
if (mnemonic[13] != '.')
|
||||
Controller.ForceButton("Pause");
|
||||
|
||||
if (mnemonic[15] != '.' && mnemonic[15] != '0')
|
||||
Controller.ForceButton("Reset");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public string GetControllersAsMnemonic()
|
||||
{
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace BizHawk
|
|||
public ControllerDefinition ControllerDefinition { get { return NullController; } }
|
||||
public IController Controller { get; set; }
|
||||
|
||||
public string GetControllersAsMnemonic() { return "|.||"; }
|
||||
public string GetControllersAsMnemonic() { return "|.|.|"; }
|
||||
public void SetControllersAsMnemonic(string mnemonic) { return; }
|
||||
|
||||
public int Frame { get; set; }
|
||||
public byte[] SaveRam { get { return new byte[0]; } }
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace BizHawk
|
|||
IController Controller { get; set; }
|
||||
|
||||
string GetControllersAsMnemonic();
|
||||
void SetControllersAsMnemonic(string mnemonic);
|
||||
|
||||
void LoadGame(IGame game);
|
||||
void FrameAdvance(bool render);
|
||||
|
|
|
@ -129,7 +129,8 @@ namespace BizHawk.MultiClient
|
|||
if (Global.Config.StartPaused)
|
||||
PauseEmulator();
|
||||
|
||||
|
||||
InputLog.LoadMovie(); //TODO: Debug
|
||||
InputLog.StartPlayback(); //TODO: Debug
|
||||
}
|
||||
|
||||
void SetSpeedPercent(int value)
|
||||
|
@ -427,7 +428,7 @@ namespace BizHawk.MultiClient
|
|||
new BizHawk.Emulation.Consoles.Gameboy.Debugger(Global.Emulator as Gameboy).Show();
|
||||
}
|
||||
|
||||
InputLog.StartNewRecording();
|
||||
//InputLog.StartNewRecording(); //TODO: Uncomment and check for a user movie selected?
|
||||
|
||||
//setup the throttle based on platform's specifications
|
||||
//(one day later for some systems we will need to modify it at runtime as the display mode changes)
|
||||
|
@ -556,7 +557,10 @@ namespace BizHawk.MultiClient
|
|||
|
||||
void StepRunLoop_Core()
|
||||
{
|
||||
bool runFrame = false;
|
||||
if (InputLog.GetMovieMode() == MOVIEMODE.PLAY)
|
||||
Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame));
|
||||
|
||||
bool runFrame = false;
|
||||
runloop_frameadvance = false;
|
||||
DateTime now = DateTime.Now;
|
||||
bool suppressCaptureRewind = false;
|
||||
|
@ -628,7 +632,8 @@ namespace BizHawk.MultiClient
|
|||
Global.Emulator.FrameAdvance(!throttle.skipnextframe);
|
||||
RamWatch1.UpdateValues();
|
||||
RamSearch1.UpdateValues();
|
||||
InputLog.GetMnemonic();
|
||||
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
|
||||
InputLog.GetMnemonic();
|
||||
}
|
||||
|
||||
if(genSound)
|
||||
|
|
|
@ -35,6 +35,12 @@ namespace BizHawk.MultiClient
|
|||
Log.Clear();
|
||||
}
|
||||
|
||||
public void StartPlayback()
|
||||
{
|
||||
MovieMode = MOVIEMODE.PLAY;
|
||||
//TODO:...something else should be done here
|
||||
}
|
||||
|
||||
public MOVIEMODE GetMovieMode()
|
||||
{
|
||||
return MovieMode;
|
||||
|
@ -46,6 +52,14 @@ namespace BizHawk.MultiClient
|
|||
Log.AddFrame(Global.Emulator.GetControllersAsMnemonic());
|
||||
}
|
||||
|
||||
public string GetInputFrame(int frame)
|
||||
{
|
||||
if (frame < Log.GetMovieLength())
|
||||
return Log.GetFrame(frame);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
//Movie editing tools may like to have something like this
|
||||
public void AddMovieRecord(string record)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue