From 33c300ff7b970b7992b5a1a06aa9ceecba02ff3f Mon Sep 17 00:00:00 2001 From: beirich Date: Sun, 8 May 2011 00:06:43 +0000 Subject: [PATCH] good news: movies work! bad news: 1) movies don't work for TI83 yet 2) I broke some NES things, to be fixed in a later commit --- BizHawk.Emulation/Consoles/Calculator/TI83.cs | 4 +- .../Consoles/Nintendo/NES/Core.cs | 4 +- .../Consoles/Nintendo/NES/NES.cs | 8 +- BizHawk.Emulation/Consoles/PC Engine/Input.cs | 50 ----- BizHawk.Emulation/Consoles/Sega/SMS/Input.cs | 77 ------- .../Interfaces/Base Implementations/Movies.cs | 22 +- BizHawk.Emulation/Interfaces/IController.cs | 6 - BizHawk.Emulation/Interfaces/IEmulator.cs | 3 - BizHawk.MultiClient/Global.cs | 13 +- .../Input/ControllerBinding.cs | 203 ++++++++++++++++++ BizHawk.MultiClient/MainForm.MenuItems.cs | 2 +- BizHawk.MultiClient/MainForm.cs | 21 +- BizHawk.MultiClient/RenderPanel.cs | 2 +- BizHawk.MultiClient/TI83tools/TI83KeyPad.cs | 98 ++++----- BizHawk.MultiClient/movie/Movie.cs | 2 +- 15 files changed, 282 insertions(+), 233 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index f81a1379f5..cc02a82d51 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -27,7 +27,7 @@ namespace BizHawk.Emulation.Consoles.Calculator bool m_CursorMoved; //------- - public string GetControllersAsMnemonic() +/* public string GetControllersAsMnemonic() { string input = "|"; @@ -240,7 +240,7 @@ namespace BizHawk.Emulation.Consoles.Calculator Controller.ForceButton("COMMA"); if (mnemonic[50] != '.') Controller.ForceButton("SIN"); - } + }*/ public byte ReadMemory(ushort addr) { diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 0ac0f96c3e..d1c3f3081a 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -74,8 +74,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo } Controller.UpdateControls(Frame++); - if (resetSignal) - Controller.UnpressButton("Reset"); + //if (resetSignal) + //Controller.UnpressButton("Reset"); TODO fix this resetSignal = Controller["Reset"]; ppu.FrameAdvance(); if (lagged) diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index 7ff7c8413b..a325086a28 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -314,7 +314,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo return null; } - public void SetControllersAsMnemonic(string mnemonic) +/* public void SetControllersAsMnemonic(string mnemonic) { if (mnemonic.Length == 0) return; @@ -368,7 +368,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo input += "|"; return input; - } + }*/ public string GameName { get { return game_name; } } @@ -489,8 +489,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo ser.Sync("ram", ref ram, false); ser.Sync("CIRAM", ref CIRAM, false); ser.Sync("cpu_accumulate", ref cpu_accumulate); - string inp = GetControllersAsMnemonic(); - ser.SyncFixedString("input", ref inp, 32); + //string inp = GetControllersAsMnemonic(); TODO sorry bout that + //ser.SyncFixedString("input", ref inp, 32); board.SyncState(ser); ppu.SyncState(ser); ser.EndSection(); diff --git a/BizHawk.Emulation/Consoles/PC Engine/Input.cs b/BizHawk.Emulation/Consoles/PC Engine/Input.cs index 3f62f86740..2dc8746496 100644 --- a/BizHawk.Emulation/Consoles/PC Engine/Input.cs +++ b/BizHawk.Emulation/Consoles/PC Engine/Input.cs @@ -19,56 +19,6 @@ public ControllerDefinition ControllerDefinition { get { return PCEngineController; } } public IController Controller { get; set; } - public void SetControllersAsMnemonic(string mnemonic) - { - if (mnemonic.Length == 0) return; - - if (mnemonic[1] != '.') - Controller.ForceButton("Up"); - if (mnemonic[2] != '.') - Controller.ForceButton("Down"); - if (mnemonic[3] != '.') - Controller.ForceButton("Left"); - if (mnemonic[4] != '.') - Controller.ForceButton("Right"); - if (mnemonic[5] != '.') - Controller.ForceButton("I"); - if (mnemonic[6] != '.') - Controller.ForceButton("II"); - if (mnemonic[7] != '.') - Controller.ForceButton("Select"); - if (mnemonic[8] != '.') - Controller.ForceButton("Run"); - } - - public string GetControllersAsMnemonic() - { - //TODO: Implement all controllers - - 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("P1 Select")) input += "S"; - else input += "."; - if (Controller.IsPressed("P1 Run")) input += "R"; - else input += "."; - - input += "|.|"; //TODO: Add commands like reset here - - return input; - } - private int SelectedController; private byte InputByte; public bool SEL { get { return ((InputByte & 1) != 0) ;} } diff --git a/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs b/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs index 8322e6ded9..16cee61a21 100644 --- a/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs +++ b/BizHawk.Emulation/Consoles/Sega/SMS/Input.cs @@ -13,83 +13,6 @@ } }; - 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() - { - 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 += "."; - - input += "|"; - - return input; - } - public ControllerDefinition ControllerDefinition { get { return SmsController; } } public IController Controller { get; set; } diff --git a/BizHawk.Emulation/Interfaces/Base Implementations/Movies.cs b/BizHawk.Emulation/Interfaces/Base Implementations/Movies.cs index d738dab819..efc2a3cd0b 100644 --- a/BizHawk.Emulation/Interfaces/Base Implementations/Movies.cs +++ b/BizHawk.Emulation/Interfaces/Base Implementations/Movies.cs @@ -37,17 +37,7 @@ namespace BizHawk { return baseController.GetFloat(name); } - - public void UnpressButton(string name) - { - baseController.UnpressButton(name); - } - - public void ForceButton(string button) - { - baseController.ForceButton(button); - } - + private int frame; public void UpdateControls(int frame) @@ -73,16 +63,6 @@ namespace BizHawk writer.Seek(frame*2, SeekOrigin.Begin); writer.Write((ushort)encodedValue); } - - public void SetSticky(string button, bool sticky) - { - baseController.SetSticky(button, sticky); - } - - public bool IsSticky(string button) - { - return baseController.IsSticky(button); - } } public class InputPlayback : IController diff --git a/BizHawk.Emulation/Interfaces/IController.cs b/BizHawk.Emulation/Interfaces/IController.cs index 795466f0d9..eab629fa0f 100644 --- a/BizHawk.Emulation/Interfaces/IController.cs +++ b/BizHawk.Emulation/Interfaces/IController.cs @@ -17,12 +17,6 @@ namespace BizHawk bool IsPressed(string button); float GetFloat(string name); - void SetSticky(string button, bool sticky); - bool IsSticky(string button); - - void UnpressButton(string button); - void ForceButton(string button); - void UpdateControls(int frame); } } diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index f1f0f1e9e9..49f49d0cff 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -12,9 +12,6 @@ namespace BizHawk ControllerDefinition ControllerDefinition { get; } IController Controller { get; set; } - string GetControllersAsMnemonic(); - void SetControllersAsMnemonic(string mnemonic); - void LoadGame(IGame game); void FrameAdvance(bool render); diff --git a/BizHawk.MultiClient/Global.cs b/BizHawk.MultiClient/Global.cs index ad9a724cf0..f20eb170fd 100644 --- a/BizHawk.MultiClient/Global.cs +++ b/BizHawk.MultiClient/Global.cs @@ -13,11 +13,12 @@ namespace BizHawk.MultiClient public static Config Config; public static IEmulator Emulator; public static RomGame Game; - public static IController ClientControls; - public static IController SMSControls; - public static IController PCEControls; - public static IController GenControls; - public static IController TI83Controls; - public static IController NESControls; + public static Controller ClientControls; + public static Controller SMSControls; + public static Controller PCEControls; + public static Controller GenControls; + public static Controller TI83Controls; + public static Controller NESControls; + public static Controller ActiveController; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/Input/ControllerBinding.cs b/BizHawk.MultiClient/Input/ControllerBinding.cs index 07993dbb0f..5f7ff2b82e 100644 --- a/BizHawk.MultiClient/Input/ControllerBinding.cs +++ b/BizHawk.MultiClient/Input/ControllerBinding.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Text; namespace BizHawk.MultiClient { @@ -11,6 +12,19 @@ namespace BizHawk.MultiClient private List unpressedButtons = new List(); private List forcePressedButtons = new List(); private List removeFromForcePressedButtons = new List(); + private List programmaticallyPressedButtons = new List(); + + private bool movieMode; + public bool MovieMode + { + get { return movieMode; } + set + { + movieMode = value; + if (value == false) + programmaticallyPressedButtons.Clear(); + } + } public Controller(ControllerDefinition definition) { @@ -52,6 +66,10 @@ namespace BizHawk.MultiClient public bool IsPressed(string button) { + if (MovieMode) + { + return programmaticallyPressedButtons.Contains(button); + } if (forcePressedButtons.Contains(button)) { removeFromForcePressedButtons.Add(button); @@ -117,5 +135,190 @@ namespace BizHawk.MultiClient { forcePressedButtons.Add(button); } + + public string GetControllersAsMnemonic() + { + StringBuilder input = new StringBuilder("|"); + + if (type.Name == "SMS Controller") + { + input.Append(IsPressed("P1 Up") ? "U" : "."); + input.Append(IsPressed("P1 Down") ? "D" : "."); + input.Append(IsPressed("P1 Left") ? "L" : "."); + input.Append(IsPressed("P1 Right") ? "R" : "."); + input.Append(IsPressed("P1 B1") ? "1" : "."); + input.Append(IsPressed("P1 B2") ? "2" : "."); + input.Append("|"); + input.Append(IsPressed("P2 Up") ? "U" : "."); + input.Append(IsPressed("P2 Down") ? "D" : "."); + input.Append(IsPressed("P2 Left") ? "L" : "."); + input.Append(IsPressed("P2 Right") ? "R" : "."); + input.Append(IsPressed("P2 B1") ? "1" : "."); + input.Append(IsPressed("P2 B2") ? "2" : "."); + input.Append("|"); + input.Append(IsPressed("Pause") ? "P" : "."); + input.Append(IsPressed("Reset") ? "R" : "."); + return input.ToString(); + } + + if (type.Name == "PC Engine Controller") + { + input.Append(IsPressed("P1 Up") ? "U" : "."); + input.Append(IsPressed("P1 Down") ? "D" : "."); + input.Append(IsPressed("P1 Left") ? "L" : "."); + input.Append(IsPressed("P1 Right") ? "R" : "."); + input.Append(IsPressed("P1 B1") ? "1" : "."); + input.Append(IsPressed("P1 B2") ? "2" : "."); + input.Append(IsPressed("P1 Select") ? "S" : "."); + input.Append(IsPressed("P1 Run") ? "R" : "."); + input.Append("|"); + + input.Append(IsPressed("P2 Up") ? "U" : "."); + input.Append(IsPressed("P2 Down") ? "D" : "."); + input.Append(IsPressed("P2 Left") ? "L" : "."); + input.Append(IsPressed("P2 Right") ? "R" : "."); + input.Append(IsPressed("P2 B1") ? "1" : "."); + input.Append(IsPressed("P2 B2") ? "2" : "."); + input.Append(IsPressed("P2 Select") ? "S" : "."); + input.Append(IsPressed("P2 Run") ? "R" : "."); + input.Append("|"); + + input.Append(IsPressed("P3 Up") ? "U" : "."); + input.Append(IsPressed("P3 Down") ? "D" : "."); + input.Append(IsPressed("P3 Left") ? "L" : "."); + input.Append(IsPressed("P3 Right") ? "R" : "."); + input.Append(IsPressed("P3 B1") ? "1" : "."); + input.Append(IsPressed("P3 B2") ? "2" : "."); + input.Append(IsPressed("P3 Select") ? "S" : "."); + input.Append(IsPressed("P3 Run") ? "R" : "."); + input.Append("|"); + + input.Append(IsPressed("P4 Up") ? "U" : "."); + input.Append(IsPressed("P4 Down") ? "D" : "."); + input.Append(IsPressed("P4 Left") ? "L" : "."); + input.Append(IsPressed("P4 Right") ? "R" : "."); + input.Append(IsPressed("P4 B1") ? "1" : "."); + input.Append(IsPressed("P4 B2") ? "2" : "."); + input.Append(IsPressed("P4 Select") ? "S" : "."); + input.Append(IsPressed("P4 Run") ? "R" : "."); + input.Append("|"); + + input.Append(IsPressed("P5 Up") ? "U" : "."); + input.Append(IsPressed("P5 Down") ? "D" : "."); + input.Append(IsPressed("P5 Left") ? "L" : "."); + input.Append(IsPressed("P5 Right") ? "R" : "."); + input.Append(IsPressed("P5 B1") ? "1" : "."); + input.Append(IsPressed("P5 B2") ? "2" : "."); + input.Append(IsPressed("P5 Select") ? "S" : "."); + input.Append(IsPressed("P5 Run") ? "R" : "."); + input.Append("|"); + + return input.ToString(); + } + + if (type.Name == "NES Controls") + { + input.Append(IsPressed("Up") ? "U" : "."); + input.Append(IsPressed("Down") ? "D" : "."); + input.Append(IsPressed("Left") ? "L" : "."); + input.Append(IsPressed("Right") ? "R" : "."); + input.Append(IsPressed("A") ? "A" : "."); + input.Append(IsPressed("B") ? "B" : "."); + input.Append(IsPressed("Select") ? "s" : "."); + input.Append(IsPressed("Start") ? "S" : "."); + input.Append("|"); + input.Append(IsPressed("Reset") ? "R" : "."); + return input.ToString(); + } + + return "?"; + } + + public void SetControllersAsMnemonic(string mnemonic) + { + MovieMode = true; + programmaticallyPressedButtons.Clear(); + + if (type.Name == "SMS Controller") + { + if (mnemonic[1] != '.') programmaticallyPressedButtons.Add("P1 Up"); + if (mnemonic[2] != '.') programmaticallyPressedButtons.Add("P1 Down"); + if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("P1 Left"); + if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("P1 Right"); + if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("P1 B1"); + if (mnemonic[6] != '.') programmaticallyPressedButtons.Add("P1 B2"); + + if (mnemonic[8] != '.') programmaticallyPressedButtons.Add("P2 Up"); + if (mnemonic[9] != '.') programmaticallyPressedButtons.Add("P2 Down"); + if (mnemonic[10] != '.') programmaticallyPressedButtons.Add("P2 Left"); + if (mnemonic[11] != '.') programmaticallyPressedButtons.Add("P2 Right"); + if (mnemonic[12] != '.') programmaticallyPressedButtons.Add("P2 B1"); + if (mnemonic[13] != '.') programmaticallyPressedButtons.Add("P2 B2"); + + if (mnemonic[15] != '.') programmaticallyPressedButtons.Add("Pause"); + if (mnemonic[16] != '.') programmaticallyPressedButtons.Add("Reset"); + } + + if (type.Name == "PC Engine Controller") + { + if (mnemonic[1] != '.') programmaticallyPressedButtons.Add("P1 Up"); + if (mnemonic[2] != '.') programmaticallyPressedButtons.Add("P1 Down"); + if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("P1 Left"); + if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("P1 Right"); + if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("P1 B1"); + if (mnemonic[6] != '.') programmaticallyPressedButtons.Add("P1 B2"); + if (mnemonic[7] != '.') programmaticallyPressedButtons.Add("P1 Select"); + if (mnemonic[8] != '.') programmaticallyPressedButtons.Add("P1 Run"); + + if (mnemonic[10] != '.') programmaticallyPressedButtons.Add("P2 Up"); + if (mnemonic[11] != '.') programmaticallyPressedButtons.Add("P2 Down"); + if (mnemonic[12] != '.') programmaticallyPressedButtons.Add("P2 Left"); + if (mnemonic[13] != '.') programmaticallyPressedButtons.Add("P2 Right"); + if (mnemonic[14] != '.') programmaticallyPressedButtons.Add("P2 B1"); + if (mnemonic[15] != '.') programmaticallyPressedButtons.Add("P2 B2"); + if (mnemonic[16] != '.') programmaticallyPressedButtons.Add("P2 Select"); + if (mnemonic[17] != '.') programmaticallyPressedButtons.Add("P2 Run"); + + if (mnemonic[19] != '.') programmaticallyPressedButtons.Add("P3 Up"); + if (mnemonic[20] != '.') programmaticallyPressedButtons.Add("P3 Down"); + if (mnemonic[21] != '.') programmaticallyPressedButtons.Add("P3 Left"); + if (mnemonic[22] != '.') programmaticallyPressedButtons.Add("P3 Right"); + if (mnemonic[23] != '.') programmaticallyPressedButtons.Add("P3 B1"); + if (mnemonic[24] != '.') programmaticallyPressedButtons.Add("P3 B2"); + if (mnemonic[25] != '.') programmaticallyPressedButtons.Add("P3 Select"); + if (mnemonic[26] != '.') programmaticallyPressedButtons.Add("P3 Run"); + + if (mnemonic[28] != '.') programmaticallyPressedButtons.Add("P4 Up"); + if (mnemonic[29] != '.') programmaticallyPressedButtons.Add("P4 Down"); + if (mnemonic[30] != '.') programmaticallyPressedButtons.Add("P4 Left"); + if (mnemonic[31] != '.') programmaticallyPressedButtons.Add("P4 Right"); + if (mnemonic[32] != '.') programmaticallyPressedButtons.Add("P4 B1"); + if (mnemonic[33] != '.') programmaticallyPressedButtons.Add("P4 B2"); + if (mnemonic[34] != '.') programmaticallyPressedButtons.Add("P4 Select"); + if (mnemonic[35] != '.') programmaticallyPressedButtons.Add("P4 Run"); + + if (mnemonic[37] != '.') programmaticallyPressedButtons.Add("P5 Up"); + if (mnemonic[38] != '.') programmaticallyPressedButtons.Add("P5 Down"); + if (mnemonic[39] != '.') programmaticallyPressedButtons.Add("P5 Left"); + if (mnemonic[40] != '.') programmaticallyPressedButtons.Add("P5 Right"); + if (mnemonic[41] != '.') programmaticallyPressedButtons.Add("P5 B1"); + if (mnemonic[42] != '.') programmaticallyPressedButtons.Add("P5 B2"); + if (mnemonic[43] != '.') programmaticallyPressedButtons.Add("P5 Select"); + if (mnemonic[44] != '.') programmaticallyPressedButtons.Add("P5 Run"); + } + + if (type.Name == "NES Controls") + { + if (mnemonic[1] != '.') programmaticallyPressedButtons.Add("Up"); + if (mnemonic[2] != '.') programmaticallyPressedButtons.Add("Down"); + if (mnemonic[3] != '.') programmaticallyPressedButtons.Add("Left"); + if (mnemonic[4] != '.') programmaticallyPressedButtons.Add("Right"); + if (mnemonic[5] != '.') programmaticallyPressedButtons.Add("A"); + if (mnemonic[6] != '.') programmaticallyPressedButtons.Add("B"); + if (mnemonic[7] != '.') programmaticallyPressedButtons.Add("Select"); + if (mnemonic[8] != '.') programmaticallyPressedButtons.Add("Start"); + if (mnemonic[10] != '.') programmaticallyPressedButtons.Add("Reset"); + } + } } } \ No newline at end of file diff --git a/BizHawk.MultiClient/MainForm.MenuItems.cs b/BizHawk.MultiClient/MainForm.MenuItems.cs index 6d9e09e3e0..df26627316 100644 --- a/BizHawk.MultiClient/MainForm.MenuItems.cs +++ b/BizHawk.MultiClient/MainForm.MenuItems.cs @@ -269,7 +269,7 @@ namespace BizHawk.MultiClient private void resetToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset")) - Global.Emulator.Controller.ForceButton("Reset"); + Global.ActiveController.ForceButton("Reset"); } private void pauseToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index dcef6d64bc..ce19c5b9ad 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -506,32 +506,33 @@ namespace BizHawk.MultiClient case "SG": case "SMS": - Global.Emulator.Controller = Global.SMSControls; + Global.ActiveController = Global.SMSControls; break; case "GG": - Global.Emulator.Controller = Global.SMSControls; + Global.ActiveController = Global.SMSControls; break; case "PCE": - Global.Emulator.Controller = Global.PCEControls; + Global.ActiveController = Global.PCEControls; break; case "SGX": - Global.Emulator.Controller = Global.PCEControls; + Global.ActiveController = Global.PCEControls; break; case "GEN": - Global.Emulator.Controller = Global.GenControls; + Global.ActiveController = Global.GenControls; break; case "TI83": - Global.Emulator.Controller = Global.TI83Controls; + Global.ActiveController = Global.TI83Controls; break; case "NES": - Global.Emulator.Controller = Global.NESControls; + Global.ActiveController = Global.NESControls; break; case "GB": break; default: break; } - + Global.Emulator.Controller = Global.ActiveController; + Global.ActiveController.MovieMode = false; } private bool LoadRom(string path) @@ -915,7 +916,7 @@ namespace BizHawk.MultiClient UnpauseEmulator(); } } - wasPressed = Global.Emulator.GetControllersAsMnemonic(); + wasPressed = Global.ActiveController.GetControllersAsMnemonic(); } else { @@ -967,7 +968,7 @@ namespace BizHawk.MultiClient else if (!Global.Config.MuteFrameAdvance) genSound = true; if (InputLog.GetMovieMode() == MOVIEMODE.PLAY) - Global.Emulator.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame)+ 1); + Global.ActiveController.SetControllersAsMnemonic(InputLog.GetInputFrame(Global.Emulator.Frame) + 1); Global.Emulator.FrameAdvance(!throttle.skipnextframe); RamWatch1.UpdateValues(); RamSearch1.UpdateValues(); diff --git a/BizHawk.MultiClient/RenderPanel.cs b/BizHawk.MultiClient/RenderPanel.cs index d6245ae7de..c1385e4542 100644 --- a/BizHawk.MultiClient/RenderPanel.cs +++ b/BizHawk.MultiClient/RenderPanel.cs @@ -353,7 +353,7 @@ namespace BizHawk.MultiClient public string MakeInputDisplay() { - string tmp = Global.Emulator.GetControllersAsMnemonic(); + string tmp = Global.ActiveController.GetControllersAsMnemonic(); tmp = tmp.Replace(".", " "); tmp = tmp.Replace("|", ""); return tmp; diff --git a/BizHawk.MultiClient/TI83tools/TI83KeyPad.cs b/BizHawk.MultiClient/TI83tools/TI83KeyPad.cs index 8b90b8032f..471bce1880 100644 --- a/BizHawk.MultiClient/TI83tools/TI83KeyPad.cs +++ b/BizHawk.MultiClient/TI83tools/TI83KeyPad.cs @@ -123,247 +123,247 @@ namespace BizHawk.MultiClient private void button42_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("ENTER"); + Global.ActiveController.ForceButton("ENTER"); } private void button43_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("DASH"); + Global.ActiveController.ForceButton("DASH"); } private void button39_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("2"); + Global.ActiveController.ForceButton("2"); } private void ONE_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("1"); + Global.ActiveController.ForceButton("1"); } private void THREE_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("3"); + Global.ActiveController.ForceButton("3"); } private void FOUR_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("4"); + Global.ActiveController.ForceButton("4"); } private void FIVE_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("5"); + Global.ActiveController.ForceButton("5"); } private void SIX_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("6"); + Global.ActiveController.ForceButton("6"); } private void SEVEN_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("7"); + Global.ActiveController.ForceButton("7"); } private void EIGHT_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("8"); + Global.ActiveController.ForceButton("8"); } private void NINE_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("9"); + Global.ActiveController.ForceButton("9"); } private void ON_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("ON"); + Global.ActiveController.ForceButton("ON"); } private void STO_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("STO"); + Global.ActiveController.ForceButton("STO"); } private void PLUS_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("PLUS"); + Global.ActiveController.ForceButton("PLUS"); } private void LN_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("LN"); + Global.ActiveController.ForceButton("LN"); } private void MINUS_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("MINUS"); + Global.ActiveController.ForceButton("MINUS"); } private void LOG_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("LOG"); + Global.ActiveController.ForceButton("LOG"); } private void MULTIPLY_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("MULTIPLY"); + Global.ActiveController.ForceButton("MULTIPLY"); } private void button26_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("SQUARED"); + Global.ActiveController.ForceButton("SQUARED"); } private void button25_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("COMMA"); + Global.ActiveController.ForceButton("COMMA"); } private void button24_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("PARAOPEN"); + Global.ActiveController.ForceButton("PARAOPEN"); } private void button23_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("PARACLOSE"); + Global.ActiveController.ForceButton("PARACLOSE"); } private void button22_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("DIVIDE"); + Global.ActiveController.ForceButton("DIVIDE"); } private void button17_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("NEG1"); + Global.ActiveController.ForceButton("NEG1"); } private void button18_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("SIN"); + Global.ActiveController.ForceButton("SIN"); } private void button19_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("COS"); + Global.ActiveController.ForceButton("COS"); } private void button20_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("TAN"); + Global.ActiveController.ForceButton("TAN"); } private void button21_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("EXP"); + Global.ActiveController.ForceButton("EXP"); } private void button12_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("MATH"); + Global.ActiveController.ForceButton("MATH"); } private void button13_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("MATRIX"); + Global.ActiveController.ForceButton("MATRIX"); } private void button14_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("PRGM"); + Global.ActiveController.ForceButton("PRGM"); } private void button15_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("VARS"); + Global.ActiveController.ForceButton("VARS"); } private void button16_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("CLEAR"); + Global.ActiveController.ForceButton("CLEAR"); } private void button11_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("ALPHA"); + Global.ActiveController.ForceButton("ALPHA"); } private void button4_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("X"); + Global.ActiveController.ForceButton("X"); } private void button10_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("STAT"); + Global.ActiveController.ForceButton("STAT"); } private void button5_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("2ND"); + Global.ActiveController.ForceButton("2ND"); } private void button2_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("MODE"); + Global.ActiveController.ForceButton("MODE"); } private void button3_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("DEL"); + Global.ActiveController.ForceButton("DEL"); } private void button47_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("LEFT"); + Global.ActiveController.ForceButton("LEFT"); } private void button49_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("DOWN"); + Global.ActiveController.ForceButton("DOWN"); } private void button48_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("RIGHT"); + Global.ActiveController.ForceButton("RIGHT"); } private void button50_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("UP"); + Global.ActiveController.ForceButton("UP"); } private void button1_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("Y"); + Global.ActiveController.ForceButton("Y"); } private void button6_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("WINDOW"); + Global.ActiveController.ForceButton("WINDOW"); } private void button7_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("ZOOM"); + Global.ActiveController.ForceButton("ZOOM"); } private void button8_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("TRACE"); + Global.ActiveController.ForceButton("TRACE"); } private void button9_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("GRAPH"); + Global.ActiveController.ForceButton("GRAPH"); } private void PERIOD_Click(object sender, EventArgs e) { - Global.Emulator.Controller.ForceButton("DOT"); + Global.ActiveController.ForceButton("DOT"); } private void showHotkToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/BizHawk.MultiClient/movie/Movie.cs b/BizHawk.MultiClient/movie/Movie.cs index 1f28afc5be..c6a8d4542c 100644 --- a/BizHawk.MultiClient/movie/Movie.cs +++ b/BizHawk.MultiClient/movie/Movie.cs @@ -52,7 +52,7 @@ namespace BizHawk.MultiClient public void GetMnemonic() { if (MovieMode == MOVIEMODE.RECORD) - Log.AddFrame(Global.Emulator.GetControllersAsMnemonic()); + Log.AddFrame(Global.ActiveController.GetControllersAsMnemonic()); } public string GetInputFrame(int frame)