diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index a0efe67f32..5902c632d8 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -27,6 +27,8 @@ namespace BizHawk.Emulation.Consoles.Calculator bool m_CursorMoved; //------- + public string GetControllersAsMneumonic() { return "|.|0|"; } //TODO: Implement this + public byte ReadMemory(ushort addr) { int romPage = romPageLow3Bits | (romPageHighBit << 3); diff --git a/BizHawk.Emulation/Consoles/Gameboy/Input.cs b/BizHawk.Emulation/Consoles/Gameboy/Input.cs index a2c598a5c6..8b8dc733cf 100644 --- a/BizHawk.Emulation/Consoles/Gameboy/Input.cs +++ b/BizHawk.Emulation/Consoles/Gameboy/Input.cs @@ -11,6 +11,11 @@ } }; + public string GetControllersAsMneumonic() + { + return "|........|0|"; + } + public ControllerDefinition ControllerDefinition { get { return GbController; } } public IController Controller { get; set; } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 1b179ad2a6..595e769ab7 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -165,5 +165,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo { return null; } + + public string GetControllersAsMneumonic() + { + return "|........|........|0|"; //TODO: implement + } } } \ No newline at end of file diff --git a/BizHawk.Emulation/Consoles/PC Engine/Input.cs b/BizHawk.Emulation/Consoles/PC Engine/Input.cs index 2ea3fcfa30..68875c274e 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Input.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/Input.cs @@ -12,6 +12,12 @@ public ControllerDefinition ControllerDefinition { get { return PCEngineController; } } public IController Controller { get; set; } + + public string GetControllersAsMneumonic() + { + return "|........|0|"; //TODO: implement + } + private byte inputSelector; public bool SEL { get { return ((inputSelector & 1) != 0) ;} } diff --git a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs index f36c4a015b..5584aa6442 100644 --- a/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs +++ b/BizHawk.Emulation/Consoles/Sega/Genesis/Genesis.Input.cs @@ -12,6 +12,12 @@ } }; + + public string GetControllersAsMneumonic() + { + return "|........|0|"; //TODO: implement + } + 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 76e19a97b3..349e83bbdb 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs @@ -13,6 +13,48 @@ } }; + + public string GetControllersAsMneumonic() + { + string input = "|"; + + if (Controller.IsPressed("P1 Up")) input += "U"; + else input += "."; + if (Controller.IsPressed("P1 Down")) input += "D"; + else input += "."; + if (Controller.IsPressed("P1 Left")) input += "L"; + else input += "."; + if (Controller.IsPressed("P1 Right")) input += "R"; + else input += "."; + if (Controller.IsPressed("P1 B1")) input += "1"; + else input += "."; + if (Controller.IsPressed("P1 B2")) input += "2"; + else input += "."; + if (Controller.IsPressed("P2 Up")) input += "U"; + else input += "."; + if (Controller.IsPressed("P2 Down")) input += "D"; + else input += "."; + if (Controller.IsPressed("P2 Left")) input += "L"; + else input += "."; + if (Controller.IsPressed("P2 Right")) input += "R"; + else input += "."; + if (Controller.IsPressed("P2 B1")) input += "1"; + else input += "."; + if (Controller.IsPressed("P2 B2")) input += "2"; + else input += "."; + if (Controller.IsPressed("Pause")) input += "S"; + else input += "."; + + input += "|"; + + if (Controller.IsPressed("Reset")) input += "R"; + else input += "0"; + + input += "|"; + + return input; + } + public ControllerDefinition ControllerDefinition { get { return SmsController; } } public IController Controller { get; set; } diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs index 3ee8daac15..975acf258d 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/NullEmulator.cs @@ -28,6 +28,9 @@ namespace BizHawk } public ControllerDefinition ControllerDefinition { get { return NullController; } } public IController Controller { get; set; } + + public string GetControllersAsMneumonic() { return "|.|0|"; } + public int Frame { get; set; } public byte[] SaveRam { get { return new byte[0]; } } public bool DeterministicEmulation { get; set; } diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index 641fde5078..4bd4e4120e 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -12,6 +12,8 @@ namespace BizHawk ControllerDefinition ControllerDefinition { get; } IController Controller { get; set; } + string GetControllersAsMneumonic(); + void LoadGame(IGame game); void FrameAdvance(bool render); diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 7392050f39..e085f58d54 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -128,13 +128,13 @@ namespace BizHawk.MultiClient //p.ShowDialog(); //Hacky testing - InputLog.LoadMovie(); - InputLog.WriteMovie(); + //InputLog.LoadMovie(); + //InputLog.WriteMovie(); } private void stopMovieToolStripMenuItem_Click(object sender, EventArgs e) { - + InputLog.StopMovie(); //TODO: stop user movie if it exists, and start InputLog logging, else do nothing } private void playFromBeginningToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index f86318daa4..706b2b7097 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -425,6 +425,7 @@ namespace BizHawk.MultiClient new BizHawk.Emulation.Consoles.Gameboy.Debugger(Global.Emulator as Gameboy).Show(); } + InputLog.StartNewRecording(); //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) @@ -469,11 +470,12 @@ namespace BizHawk.MultiClient /// /// This functions calls Emulator.FrameAdvance(true) and handles any updates that need to happen on a per frame basis /// - public void DoFrameAdvance() + public void DoFrameAdvance() //TODO: rename this and run it once per frame { Global.Emulator.FrameAdvance(true); //TODO: Do these things need to happen on (false) as well? Think about it RamWatch1.UpdateValues(); RamSearch1.UpdateValues(); + InputLog.GetMneumonic(); //TODO: log to input log or user choice, if user choice & playback don't log! } public void CheckHotkeys() @@ -635,6 +637,7 @@ namespace BizHawk.MultiClient Global.Emulator.FrameAdvance(!throttle.skipnextframe); RamWatch1.UpdateValues(); RamSearch1.UpdateValues(); + InputLog.GetMneumonic(); } if(genSound) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 5e8567e881..c3679ca424 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -6,6 +6,7 @@ using System.IO; namespace BizHawk.MultiClient { + public enum MOVIEMODE { INACTIVE, PLAY, RECORD, FINISHED }; class Movie { private MovieHeader Header = new MovieHeader(); @@ -14,10 +15,35 @@ namespace BizHawk.MultiClient private bool IsText = true; private string Filename; + private MOVIEMODE MovieMode = new MOVIEMODE(); + public Movie(string filename) { Filename = filename; //TODO: Validate that file is writable - Log.AddFrame("|........|0|"); + MovieMode = MOVIEMODE.PLAY; + } + + public void StopMovie() + { + MovieMode = MOVIEMODE.INACTIVE; + WriteMovie(); + } + + public void StartNewRecording() + { + MovieMode = MOVIEMODE.RECORD; + Log.Clear(); + } + + public MOVIEMODE GetMovieMode() + { + return MovieMode; + } + + public void GetMneumonic() + { + if (MovieMode == MOVIEMODE.RECORD) + Log.AddFrame(Global.Emulator.GetControllersAsMneumonic()); } public void AddMovieRecord() diff --git a/BizHawk.MultiClient/output/log.tas b/BizHawk.MultiClient/output/log.tas index 17bba62950..836fd06f7c 100644 --- a/BizHawk.MultiClient/output/log.tas +++ b/BizHawk.MultiClient/output/log.tas @@ -1,6 +1,170 @@ EmulationVersion v1.0.0 MovieVersion v1.0.0 -Platform PCE -GameName Bonk.pce -|........|0| +Platform +GameName +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|...R.........|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|.D...........|0| +|.D...........|0| +|.D...........|0| +|.D...........|0| +|.D...........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|..L..........|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|....12.......|0| +|U...12.......|0| +|U...12.......|0| +|U...12.......|0| +|U...12.......|0| +|U...12.......|0| +|.............|0| +|.D...........|0| +|.D...........|0| +|.D...........|0| +|..L..........|0| +|..L..........|0| +|...R.........|0| +|...R.........|0| +|U............|0| +|U............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0| +|.............|0|