diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index ca874f72c7..3e0f99b083 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -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) { diff --git a/BizHawk.Emulation/Consoles/Gameboy/Input.cs b/BizHawk.Emulation/Consoles/Gameboy/Input.cs index 5a9d0b5638..dd3c06f2a2 100644 --- a/BizHawk.Emulation/Consoles/Gameboy/Input.cs +++ b/BizHawk.Emulation/Consoles/Gameboy/Input.cs @@ -11,6 +11,11 @@ } }; + public void SetControllersAsMnemonic(string mnemonic) + { + //TODO + } + public string GetControllersAsMnemonic() { return "|........|0|"; diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index f8fe77f160..dac1c9c79d 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -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; diff --git a/BizHawk.Emulation/Consoles/PC Engine/Input.cs b/BizHawk.Emulation/Consoles/PC Engine/Input.cs index 2c8c8ced23..ed01895563 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Input.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/Input.cs @@ -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() { diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs index 4464b69494..1164289f2e 100644 --- a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs +++ b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs @@ -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; } } diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs b/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs index a403f73957..2aa4bf02b5 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs @@ -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() { diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs index bda6323350..46a321aae4 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs @@ -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]; } } diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index d294ab9eb6..53da020a73 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -13,6 +13,7 @@ namespace BizHawk IController Controller { get; set; } string GetControllersAsMnemonic(); + void SetControllersAsMnemonic(string mnemonic); void LoadGame(IGame game); void FrameAdvance(bool render); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index c439615390..249abce675 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -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) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index ad3417c96f..32f6e462bf 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -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) {