From 50d4a3307a8458d2a1bcb6ad0983328ec512f563 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 7 Dec 2013 00:53:06 +0000 Subject: [PATCH] Rip out UpdateControls() method from IController, also some code cleanup in related files --- BizHawk.Client.Common/ControllerBinding.cs | 2 - BizHawk.Client.Common/Global.cs | 4 +- BizHawk.Client.Common/movie/InputAdapters.cs | 453 ++++++++++-------- BizHawk.Client.Common/movie/MovieMnemonics.cs | 1 - .../Base Implementations/NullController.cs | 1 - .../Interfaces/IController.cs | 51 +- BizHawk.Emulation.Cores/Calculator/TI83.cs | 5 +- .../Consoles/Nintendo/GBA/Meteor.cs | 2 +- .../Consoles/Nintendo/Gameboy/Gambatte.cs | 2 +- .../Consoles/Nintendo/NES/Core.cs | 3 +- .../Consoles/Nintendo/SNES/LibsnesCore.cs | 5 - .../Consoles/PC Engine/PCEngine.cs | 2 +- .../Consoles/Sega/Genesis/Genesis.cs | 3 +- .../Consoles/Sega/SMS/SMS.cs | 12 +- 14 files changed, 314 insertions(+), 232 deletions(-) diff --git a/BizHawk.Client.Common/ControllerBinding.cs b/BizHawk.Client.Common/ControllerBinding.cs index bb6461329e..b09ff24999 100644 --- a/BizHawk.Client.Common/ControllerBinding.cs +++ b/BizHawk.Client.Common/ControllerBinding.cs @@ -39,7 +39,6 @@ namespace BizHawk.Client.Common } public float GetFloat(string name) { return FloatButtons[name]; } - public void UpdateControls(int frame) { } //look for bindings which are activated by the supplied physical button. public List SearchBindings(string button) @@ -201,7 +200,6 @@ namespace BizHawk.Client.Common } public float GetFloat(string name) { throw new NotImplementedException(); } - public void UpdateControls(int frame) { } //look for bindings which are activated by the supplied physical button. public List SearchBindings(string button) diff --git a/BizHawk.Client.Common/Global.cs b/BizHawk.Client.Common/Global.cs index 658997bfe3..e36e660e3b 100644 --- a/BizHawk.Client.Common/Global.cs +++ b/BizHawk.Client.Common/Global.cs @@ -59,7 +59,7 @@ namespace BizHawk.Client.Common public static UD_LR_ControllerAdapter UD_LR_ControllerAdapter = new UD_LR_ControllerAdapter(); - public static AutoFireStickyXORAdapter AutofireStickyXORAdapter = new AutoFireStickyXORAdapter(); + public static AutoFireStickyXorAdapter AutofireStickyXORAdapter = new AutoFireStickyXorAdapter(); /// /// will OR together two IControllers @@ -69,7 +69,7 @@ namespace BizHawk.Client.Common /// /// provides an opportunity to mutate the player's input in an autohold style /// - public static StickyXORAdapter StickyXORAdapter = new StickyXORAdapter(); + public static StickyXorAdapter StickyXORAdapter = new StickyXorAdapter(); /// /// Forces any controller button to Off, useful for things like Joypad.Set diff --git a/BizHawk.Client.Common/movie/InputAdapters.cs b/BizHawk.Client.Common/movie/InputAdapters.cs index eafc54c27f..e32b196f30 100644 --- a/BizHawk.Client.Common/movie/InputAdapters.cs +++ b/BizHawk.Client.Common/movie/InputAdapters.cs @@ -6,6 +6,8 @@ using BizHawk.Emulation.Common; namespace BizHawk.Client.Common { + using System.Linq; + /// /// will hold buttons for 1 frame and then release them. (Calling Click() from your button click is what you want to do) /// TODO - should the duration be controllable? @@ -13,19 +15,29 @@ namespace BizHawk.Client.Common public class ClickyVirtualPadController : IController { public ControllerDefinition Type { get; set; } - public bool this[string button] { get { return IsPressed(button); } } - public float GetFloat(string name) { return 0.0f; } //TODO - public void UpdateControls(int frame) { } + + public bool this[string button] + { + get { return IsPressed(button); } + } + + public float GetFloat(string name) + { + return 0.0f; + } + + // TODO public bool IsPressed(string button) { - return Pressed.Contains(button); + return _pressed.Contains(button); } + /// /// call this once per frame to do the timekeeping for the hold and release /// public void FrameTick() { - Pressed.Clear(); + _pressed.Clear(); } /// @@ -33,40 +45,52 @@ namespace BizHawk.Client.Common /// public void Click(string button) { - Pressed.Add(button); + _pressed.Add(button); } public void Unclick(string button) { - Pressed.Remove(button); + _pressed.Remove(button); } public void Toggle(string button) { if (IsPressed(button)) { - Pressed.Remove(button); + _pressed.Remove(button); } else { - Pressed.Add(button); + _pressed.Add(button); } } - readonly HashSet Pressed = new HashSet(); + private readonly HashSet _pressed = new HashSet(); } - //filters input for things called Up and Down while considering the client's AllowUD_LR option. - //this is a bit gross but it is unclear how to do it more nicely + /// + /// Filters input for things called Up and Down while considering the client's AllowUD_LR option. + /// This is a bit gross but it is unclear how to do it more nicely + /// public class UD_LR_ControllerAdapter : IController { - public ControllerDefinition Type { get { return Source.Type; } } - public IController Source; + public ControllerDefinition Type + { + get { return Source.Type; } + } - public bool this[string button] { get { return IsPressed(button); } } - // the float format implies no U+D and no L+R no matter what, so just passthru - public float GetFloat(string name) { return Source.GetFloat(name); } - public void UpdateControls(int frame) { } + public bool this[string button] + { + get { return IsPressed(button); } + } + + public IController Source { get; set; } + + // The float format implies no U+D and no L+R no matter what, so just passthru + public float GetFloat(string name) + { + return Source.GetFloat(name); + } public bool IsPressed(string button) { @@ -85,6 +109,7 @@ namespace BizHawk.Client.Common return false; } } + if (button.Contains("Right") && !button.Contains(" C ")) { prefix = button.GetPrecedingString("Right"); @@ -104,10 +129,21 @@ namespace BizHawk.Client.Common protected WorkingDictionary Buttons = new WorkingDictionary(); protected WorkingDictionary Floats = new WorkingDictionary(); - public virtual bool this[string button] { get { return Buttons[button]; } set { Buttons[button] = value; } } - public virtual bool IsPressed(string button) { return this[button]; } - public float GetFloat(string name) { return Floats[name]; } - public void UpdateControls(int frame) { } + + public virtual bool this[string button] + { + get { return Buttons[button]; } set { Buttons[button] = value; } + } + + public virtual bool IsPressed(string button) + { + return this[button]; + } + + public float GetFloat(string name) + { + return Floats[name]; + } public IEnumerable> BoolButtons() { @@ -116,39 +152,46 @@ namespace BizHawk.Client.Common public virtual void LatchFrom(IController source) { - foreach (string button in source.Type.BoolButtons) + foreach (var button in source.Type.BoolButtons) { Buttons[button] = source[button]; } } - public void AcceptNewFloats(IEnumerable> NewValues) + public void AcceptNewFloats(IEnumerable> newValues) { - foreach (var sv in NewValues) + foreach (var sv in newValues) + { Floats[sv.Item1] = sv.Item2; + } } } public class ORAdapter : IController { - public bool IsPressed(string button) { return this[button]; } + public bool IsPressed(string button) + { + return this[button]; + } + // pass floats solely from the original source // this works in the code because SourceOr is the autofire controller public float GetFloat(string name) { return Source.GetFloat(name); } - public void UpdateControls(int frame) { } - public IController Source; - public IController SourceOr; + public IController Source { get; set; } + public IController SourceOr { get; set; } public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } public bool this[string button] { get { - bool source = Source[button] | SourceOr[button]; - return source; + return Source[button] | SourceOr[button]; + } + set + { + throw new InvalidOperationException(); } - set { throw new InvalidOperationException(); } } } @@ -156,89 +199,114 @@ namespace BizHawk.Client.Common public class ForceOffAdaptor : IController { public bool IsPressed(string button) { return this[button]; } + // what exactly would we want to do here with floats? // ForceOffAdaptor is only used by lua, and the code there looks like a big mess... public float GetFloat(string name) { return Source.GetFloat(name); } - public void UpdateControls(int frame) { } - protected HashSet stickySet = new HashSet(); - public IController Source; - public IController SourceOr; - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } + protected HashSet StickySet = new HashSet(); + public IController Source { get; set; } + public IController SourceOr { get; set; } + + public ControllerDefinition Type + { + get { return Source.Type; } + set { throw new InvalidOperationException(); } + } public bool this[string button] { get { - if (stickySet.Contains(button)) - { - return false; - } - else - { - return Source[button]; - } + return !StickySet.Contains(button) && Source[button]; + } + + set + { + throw new InvalidOperationException(); } - set { throw new InvalidOperationException(); } } public void SetSticky(string button, bool isSticky) { if (isSticky) - stickySet.Add(button); - else stickySet.Remove(button); + { + this.StickySet.Add(button); + } + else + { + this.StickySet.Remove(button); + } } } - public class StickyXORAdapter : IController + public class StickyXorAdapter : IController { protected HashSet stickySet = new HashSet(); - public IController Source; + + public IController Source { get; set; } - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } - public bool Locked = false; //Pretty much a hack, + public ControllerDefinition Type + { + get { return Source.Type; } + set { throw new InvalidOperationException(); } + } + + public bool Locked { get; set; } // Pretty much a hack, public bool IsPressed(string button) { return this[button]; } // if SetFloat() is called (typically virtual pads), then that float will entirely override the Source input // otherwise, the source is passed thru. - readonly WorkingDictionary FloatSet = new WorkingDictionary(); + private readonly WorkingDictionary _floatSet = new WorkingDictionary(); + public void SetFloat(string name, float? value) { if (value.HasValue) - FloatSet[name] = value; - else FloatSet.Remove(name); + { + _floatSet[name] = value; + } + else + { + _floatSet.Remove(name); + } } + public float GetFloat(string name) { - return FloatSet[name] ?? Source.GetFloat(name); + return _floatSet[name] ?? Source.GetFloat(name); } + public void ClearStickyFloats() { - FloatSet.Clear(); + _floatSet.Clear(); } - - public void UpdateControls(int frame) { } - - public bool this[string button] { + public bool this[string button] + { get { - bool source = Source[button]; - if (source) - { - } + var source = Source[button]; source ^= stickySet.Contains(button); return source; } - set { throw new InvalidOperationException(); } + + set + { + throw new InvalidOperationException(); + } } public void SetSticky(string button, bool isSticky) { - if(isSticky) + if (isSticky) + { stickySet.Add(button); - else stickySet.Remove(button); + } + else + { + stickySet.Remove(button); + } } public bool IsSticky(string button) @@ -261,35 +329,33 @@ namespace BizHawk.Client.Common public void MassToggleStickyState(List buttons) { - foreach (string button in buttons) + foreach (var button in buttons.Where(button => !_justPressed.Contains(button))) { - if (!JustPressed.Contains(button)) + if (stickySet.Contains(button)) { - if (stickySet.Contains(button)) - { - stickySet.Remove(button); - } - else - { - stickySet.Add(button); - } + stickySet.Remove(button); + } + else + { + stickySet.Add(button); } } - JustPressed = buttons; + + _justPressed = buttons; } - private List JustPressed = new List(); + private List _justPressed = new List(); } - public class AutoFireStickyXORAdapter : IController + public class AutoFireStickyXorAdapter : IController { public int On { get; set; } public int Off { get; set; } public WorkingDictionary buttonStarts = new WorkingDictionary(); - private readonly HashSet stickySet = new HashSet(); + private readonly HashSet _stickySet = new HashSet(); - public IController Source; + public IController Source { get; set; } public void SetOnOffPatternFromConfig() { @@ -297,23 +363,27 @@ namespace BizHawk.Client.Common Off = Global.Config.AutofireOff < 1 ? 0 : Global.Config.AutofireOff; } - public AutoFireStickyXORAdapter() + public AutoFireStickyXorAdapter() { - //On = Global.Config.AutofireOn < 1 ? 0 : Global.Config.AutofireOn; - //Off = Global.Config.AutofireOff < 1 ? 0 : Global.Config.AutofireOff; + // On = Global.Config.AutofireOn < 1 ? 0 : Global.Config.AutofireOn; + // Off = Global.Config.AutofireOff < 1 ? 0 : Global.Config.AutofireOff; On = 1; Off = 1; } public bool IsPressed(string button) { - if (stickySet.Contains(button)) + if (_stickySet.Contains(button)) { - int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); + var a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); if (a < On) + { return this[button]; + } else + { return false; + } } else { @@ -325,15 +395,11 @@ namespace BizHawk.Client.Common { get { - bool source = Source[button]; - if (source) - { - } - if (stickySet.Contains(button)) - { + var source = Source[button]; - - int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); + if (_stickySet.Contains(button)) + { + var a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off); if (a < On) { source ^= true; @@ -346,103 +412,134 @@ namespace BizHawk.Client.Common return source; } - set { throw new InvalidOperationException(); } + + set + { + throw new InvalidOperationException(); + } } - - - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } - public bool Locked = false; //Pretty much a hack, + public bool Locked { get; set; } // Pretty much a hack, // dumb passthrough for floats, because autofire doesn't care about them - public float GetFloat(string name) { return Source.GetFloat(name); } - public void UpdateControls(int frame) { } + public float GetFloat(string name) + { + return Source.GetFloat(name); + } public void SetSticky(string button, bool isSticky) { if (isSticky) - stickySet.Add(button); - else stickySet.Remove(button); + { + this._stickySet.Add(button); + } + else + { + this._stickySet.Remove(button); + } } public bool IsSticky(string button) { - return stickySet.Contains(button); + return this._stickySet.Contains(button); } public HashSet CurrentStickies { get { - return stickySet; + return this._stickySet; } } public void ClearStickies() { - stickySet.Clear(); + this._stickySet.Clear(); } public void MassToggleStickyState(List buttons) { - foreach (string button in buttons) + foreach (var button in buttons.Where(button => !_justPressed.Contains(button))) { - if (!JustPressed.Contains(button)) + if (_stickySet.Contains(button)) { - if (stickySet.Contains(button)) - { - stickySet.Remove(button); - } - else - { - stickySet.Add(button); - } + _stickySet.Remove(button); + } + else + { + _stickySet.Add(button); } } - JustPressed = buttons; + + _justPressed = buttons; } - private List JustPressed = new List(); + private List _justPressed = new List(); } /// - /// just copies source to sink, or returns whatever a NullController would if it is disconnected. useful for immovable hardpoints. + /// Just copies source to sink, or returns whatever a NullController would if it is disconnected. useful for immovable hardpoints. /// public class CopyControllerAdapter : IController { - public IController Source; + public IController Source { get; set; } private readonly NullController _null = new NullController(); - IController Curr + private IController Curr { get { - if (Source == null) return _null; - else return Source; + if (Source == null) + { + return _null; + } + else + { + return Source; + } } } - public ControllerDefinition Type { get { return Curr.Type; } } - public bool this[string button] { get { return Curr[button]; } } - public bool IsPressed(string button) { return Curr.IsPressed(button); } - public float GetFloat(string name) { return Curr.GetFloat(name); } - public void UpdateControls(int frame) { Curr.UpdateControls(frame); } - } - - class ButtonNameParser - { - ButtonNameParser() + public ControllerDefinition Type { + get { return Curr.Type; } } + public bool this[string button] + { + get { return Curr[button]; } + } + + public bool IsPressed(string button) + { + return Curr.IsPressed(button); + } + + public float GetFloat(string name) + { + return Curr.GetFloat(name); + } + } + + public class ButtonNameParser + { public static ButtonNameParser Parse(string button) { - //see if we're being asked for a button that we know how to rewire - string[] parts = button.Split(' '); - if (parts.Length < 2) return null; - if (parts[0][0] != 'P') return null; + // See if we're being asked for a button that we know how to rewire + var parts = button.Split(' '); + + if (parts.Length < 2) + { + return null; + } + + if (parts[0][0] != 'P') + { + return null; + } + int player; if (!int.TryParse(parts[0].Substring(1), out player)) { @@ -454,8 +551,8 @@ namespace BizHawk.Client.Common } } - public int PlayerNum; - public string ButtonPart; + public int PlayerNum { get; set; } + public string ButtonPart { get; private set; } public override string ToString() { @@ -468,30 +565,41 @@ namespace BizHawk.Client.Common /// public class MultitrackRewiringControllerAdapter : IController { - public IController Source; + public IController Source { get; set; } public int PlayerSource = 1; public int PlayerTargetMask = 0; public ControllerDefinition Type { get { return Source.Type; } } public bool this[string button] { get { return IsPressed(button); } } + // floats can be player number remapped just like boolbuttons public float GetFloat(string name) { return Source.GetFloat(RemapButtonName(name)); } - public void UpdateControls(int frame) { Source.UpdateControls(frame); } - string RemapButtonName(string button) + private string RemapButtonName(string button) { - //do we even have a source? - if (PlayerSource == -1) return button; + // Do we even have a source? + if (PlayerSource == -1) + { + return button; + } - //see if we're being asked for a button that we know how to rewire - ButtonNameParser bnp = ButtonNameParser.Parse(button); - if (bnp == null) return button; + // See if we're being asked for a button that we know how to rewire + var bnp = ButtonNameParser.Parse(button); + + if (bnp == null) + { + return button; + } - //ok, this looks like a normal `P1 Button` type thing. we can handle it - //were we supposed to replace this one? + // Ok, this looks like a normal `P1 Button` type thing. we can handle it + // Were we supposed to replace this one? int foundPlayerMask = (1 << bnp.PlayerNum); - if ((PlayerTargetMask & foundPlayerMask) == 0) return button; - //ok, we were. swap out the source player and then grab his button + if ((PlayerTargetMask & foundPlayerMask) == 0) + { + return button; + } + + // Ok, we were. swap out the source player and then grab his button bnp.PlayerNum = PlayerSource; return bnp.ToString(); } @@ -501,43 +609,4 @@ namespace BizHawk.Client.Common return Source.IsPressed(RemapButtonName(button)); } } - - - //not being used.. - - ///// - ///// adapts an IController to force some buttons to a different state. - ///// unforced button states will flow through to the adaptee - ///// - //public class ForceControllerAdapter : IController - //{ - // public IController Controller; - - // public Dictionary Forces = new Dictionary(); - // public void Clear() - // { - // Forces.Clear(); - // } - - // public ControllerDefinition Type { get { return Controller.Type; } } - - // public bool this[string button] { get { return IsPressed(button); } } - - // public bool IsPressed(string button) - // { - // if (Forces.ContainsKey(button)) - // return Forces[button]; - // else return Controller.IsPressed(button); - // } - - // public float GetFloat(string name) - // { - // return Controller.GetFloat(name); //TODO! - // } - - // public void UpdateControls(int frame) - // { - // Controller.UpdateControls(frame); - // } - //} } \ No newline at end of file diff --git a/BizHawk.Client.Common/movie/MovieMnemonics.cs b/BizHawk.Client.Common/movie/MovieMnemonics.cs index 2ffa7c0b3e..1542076cef 100644 --- a/BizHawk.Client.Common/movie/MovieMnemonics.cs +++ b/BizHawk.Client.Common/movie/MovieMnemonics.cs @@ -654,7 +654,6 @@ namespace BizHawk.Client.Common public bool this[string button] { get { return MyBoolButtons[button]; } } public bool IsPressed(string button) { return MyBoolButtons[button]; } public float GetFloat(string name) { return MyFloatControls[name]; } - public void UpdateControls(int frame) { } //-------- private readonly WorkingDictionary MyBoolButtons = new WorkingDictionary(); diff --git a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullController.cs b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullController.cs index 1a02f31c51..7dc76fd313 100644 --- a/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullController.cs +++ b/BizHawk.Emulation.Common/Interfaces/Base Implementations/NullController.cs @@ -6,7 +6,6 @@ public bool this[string button] { get { return false; } } public bool IsPressed(string button) { return false; } public float GetFloat(string name) { return 0f; } - public void UpdateControls(int frame) { } public void UnpressButton(string button) { } public void ForceButton(string button) { } diff --git a/BizHawk.Emulation.Common/Interfaces/IController.cs b/BizHawk.Emulation.Common/Interfaces/IController.cs index e95f17f4c3..5f78bf174b 100644 --- a/BizHawk.Emulation.Common/Interfaces/IController.cs +++ b/BizHawk.Emulation.Common/Interfaces/IController.cs @@ -21,56 +21,71 @@ namespace BizHawk.Emulation.Common { public readonly float Min; public readonly float Max; + /// /// default position /// public readonly float Mid; - public FloatRange(float Min, float Mid, float Max) + + public FloatRange(float min, float mid, float max) { - this.Min = Min; - this.Mid = Mid; - this.Max = Max; + Min = min; + Mid = mid; + Max = max; } + // for terse construction public static implicit operator FloatRange(float[] f) { if (f.Length != 3) + { throw new ArgumentException(); + } + return new FloatRange(f[0], f[1], f[2]); } } - public string Name; - public List BoolButtons = new List(); - public List FloatControls = new List(); - public List FloatRanges = new List(); - /// - /// copy - /// - /// + public string Name { get; set; } + + public List BoolButtons { get; set; } + public List FloatControls { get; private set; } + public List FloatRanges { get; private set; } + public ControllerDefinition(ControllerDefinition source) + : this() { Name = source.Name; + foreach (var s in source.BoolButtons) + { BoolButtons.Add(s); + } + foreach (var s in source.FloatControls) + { FloatControls.Add(s); + } + } + + public ControllerDefinition() + { + BoolButtons = new List(); + FloatControls = new List(); + FloatRanges = new List(); } - public ControllerDefinition() { } } public interface IController { ControllerDefinition Type { get; } - //TODO - it is obnoxious for this to be here. must be removed. + // TODO - it is obnoxious for this to be here. must be removed. bool this[string button] { get; } - //TODO - this can stay but it needs to be changed to go through the float + + // TODO - this can stay but it needs to be changed to go through the float bool IsPressed(string button); float GetFloat(string name); - - //TODO - why does this have a frame argument. must be removed. - void UpdateControls(int frame); } } diff --git a/BizHawk.Emulation.Cores/Calculator/TI83.cs b/BizHawk.Emulation.Cores/Calculator/TI83.cs index e10738999a..acde0d55fe 100644 --- a/BizHawk.Emulation.Cores/Calculator/TI83.cs +++ b/BizHawk.Emulation.Cores/Calculator/TI83.cs @@ -492,14 +492,17 @@ namespace BizHawk.Emulation.Cores.Calculators cpu.ExecuteCycles(10000); cpu.Interrupt = true; } - Controller.UpdateControls(Frame++); + + Frame++; if (lagged) { _lagcount++; islag = true; } else + { islag = false; + } } public void HardReset() diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs index aa6fe178b1..f396dd81bc 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.cs @@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA public void FrameAdvance(bool render, bool rendersound = true) { - Controller.UpdateControls(Frame++); + Frame++; IsLagFrame = true; if (Controller["Power"]) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index dd22b1bc9d..dcc9ad8dd1 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -153,7 +153,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy internal void FrameAdvancePrep() { - Controller.UpdateControls(Frame++); + Frame++; // update our local copy of the controller data CurrentButtons = 0; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Core.cs index 0349fa4207..df200ca518 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Core.cs @@ -243,7 +243,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES HardReset(); } - Controller.UpdateControls(Frame++); + Frame++; + //if (resetSignal) //Controller.UnpressButton("Reset"); TODO fix this resetSignal = Controller["Reset"]; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index ed6c626705..c8b97c945b 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -772,11 +772,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES { return buttons[name]; } - - public void UpdateControls(int frame) - { - //throw new NotImplementedException(); - } } diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index 7c1d265806..55ab6266c6 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -250,7 +250,7 @@ namespace BizHawk.Emulation.Cores.PCEngine { lagged = true; CoreComm.DriveLED = false; - Controller.UpdateControls(Frame++); + Frame++; PSG.BeginFrame(Cpu.TotalExecutedCycles); Cpu.Debug = CoreComm.Tracer.Enabled; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs index aba76acaf6..0bf900c977 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/Genesis/Genesis.cs @@ -147,8 +147,7 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis public void FrameAdvance(bool render, bool rendersound) { lagged = true; - - Controller.UpdateControls(Frame++); + Frame++; PSG.BeginFrame(SoundCPU.TotalExecutedCycles); YM2612.BeginFrame(SoundCPU.TotalExecutedCycles); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 65e6150935..bf977dff51 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -240,14 +240,18 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem public void FrameAdvance(bool render, bool rendersound) { lagged = true; - Controller.UpdateControls(Frame++); + Frame++; PSG.BeginFrame(Cpu.TotalExecutedCycles); - Cpu.Debug = CoreComm.Tracer.Enabled; - if (Cpu.Debug && Cpu.Logger == null) // TODO, lets not do this on each frame. But lets refactor CoreComm/CoreComm first - Cpu.Logger = (s) => CoreComm.Tracer.Put(s); + Cpu.Debug = CoreComm.Tracer.Enabled; + if (Cpu.Debug && Cpu.Logger == null) // TODO, lets not do this on each frame. But lets refactor CoreComm/CoreComm first + { + Cpu.Logger = (s) => CoreComm.Tracer.Put(s); + } if (IsGameGear == false) + { Cpu.NonMaskableInterrupt = Controller["Pause"]; + } Vdp.ExecFrame(render); PSG.EndFrame(Cpu.TotalExecutedCycles);