diff --git a/BizHawk.Client.Common/BizHawk.Client.Common.csproj b/BizHawk.Client.Common/BizHawk.Client.Common.csproj index 013fea1fd2..b779419d6a 100644 --- a/BizHawk.Client.Common/BizHawk.Client.Common.csproj +++ b/BizHawk.Client.Common/BizHawk.Client.Common.csproj @@ -111,7 +111,10 @@ - + + + + @@ -153,7 +156,6 @@ - @@ -215,6 +217,7 @@ BizHawk.Bizware.BizwareGL + "$(SolutionDir)subwcrev.bat" "$(ProjectDir)" diff --git a/BizHawk.Client.Common/Global.cs b/BizHawk.Client.Common/Global.cs index bad4ac0c53..3393006a46 100644 --- a/BizHawk.Client.Common/Global.cs +++ b/BizHawk.Client.Common/Global.cs @@ -55,11 +55,6 @@ namespace BizHawk.Client.Common public static AutoFireStickyXorAdapter AutofireStickyXORAdapter = new AutoFireStickyXorAdapter(); - /// - /// will OR together two IControllers - /// - public static ORAdapter OrControllerAdapter = new ORAdapter(); - /// /// provides an opportunity to mutate the player's input in an autohold style /// diff --git a/BizHawk.Client.Common/movie/InputAdapters.cs b/BizHawk.Client.Common/inputAdapters/InputAdapters.cs similarity index 86% rename from BizHawk.Client.Common/movie/InputAdapters.cs rename to BizHawk.Client.Common/inputAdapters/InputAdapters.cs index 304a9342b0..c73a36f45a 100644 --- a/BizHawk.Client.Common/movie/InputAdapters.cs +++ b/BizHawk.Client.Common/inputAdapters/InputAdapters.cs @@ -1,13 +1,11 @@ using System; using System.Collections.Generic; - +using System.Linq; using BizHawk.Common; 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? @@ -173,70 +171,6 @@ namespace BizHawk.Client.Common } } - public class ORAdapter : IController - { - 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 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 - { - return (Source != null ? Source[button] : false) | - (SourceOr != null ? SourceOr[button] : false); - } - set - { - throw new InvalidOperationException(); - } - } - - } - - public class AndAdapter : IController - { - 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 IController Source { get; set; } - public IController SourceAnd { get; set; } - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } - - public bool this[string button] - { - get - { - if (Source != null && SourceAnd != null) - { - return Source[button] & SourceAnd[button]; - } - - return false; - } - - set - { - throw new InvalidOperationException(); - } - } - } - // Used by input display, to determine if either autofire or regular stickies are "in effect" because we color this scenario differently public class StickyOrAdapter : IController { diff --git a/BizHawk.Client.Common/InputManager.cs b/BizHawk.Client.Common/inputAdapters/InputManager.cs similarity index 91% rename from BizHawk.Client.Common/InputManager.cs rename to BizHawk.Client.Common/inputAdapters/InputManager.cs index f620df529d..fcdc68a959 100644 --- a/BizHawk.Client.Common/InputManager.cs +++ b/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using BizHawk.Emulation.Common; - +using BizHawk.Client.Common.InputAdapterExtensions; namespace BizHawk.Client.Common { public static class InputManager @@ -11,9 +11,7 @@ namespace BizHawk.Client.Common Global.ControllerInputCoalescer.Clear(); Global.ControllerInputCoalescer.Type = Global.ActiveController.Type; - Global.OrControllerAdapter.Source = Global.ActiveController; - Global.OrControllerAdapter.SourceOr = Global.AutoFireController; - Global.UD_LR_ControllerAdapter.Source = Global.OrControllerAdapter; + Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController); Global.StickyXORAdapter.Source = Global.UD_LR_ControllerAdapter; Global.AutofireStickyXORAdapter.Source = Global.StickyXORAdapter; diff --git a/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs b/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs index caa27a0309..15e9d3b217 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/OSDManager.cs @@ -5,7 +5,7 @@ using System.Drawing; using System.Collections.Generic; using BizHawk.Client.Common; - +using BizHawk.Client.Common.InputAdapterExtensions; using BizHawk.Bizware.BizwareGL; namespace BizHawk.Client.EmuHawk @@ -261,16 +261,9 @@ namespace BizHawk.Client.EmuHawk Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) : Global.MovieSession.MovieControllerInstance(); - var orAdaptor = new ORAdapter() - { - Source = Global.AutofireStickyXORAdapter, - SourceOr = m - }; - - var lg = Global.MovieSession.LogGeneratorInstance(); - lg.SetSource(orAdaptor); + lg.SetSource(Global.AutofireStickyXORAdapter.Or(m)); return lg.GenerateInputDisplay(); } @@ -293,17 +286,11 @@ namespace BizHawk.Client.EmuHawk if (Global.MovieSession.Movie.IsActive) { var m = Global.MovieSession.Movie.IsActive && !Global.MovieSession.Movie.IsFinished ? - Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) : - Global.MovieSession.MovieControllerInstance(); - - var andAdaptor = new AndAdapter - { - Source = Global.AutofireStickyXORAdapter, - SourceAnd = m - }; + Global.MovieSession.Movie.GetInputState(Global.Emulator.Frame - 1) : + Global.MovieSession.MovieControllerInstance(); var lg = Global.MovieSession.LogGeneratorInstance(); - lg.SetSource(andAdaptor); + lg.SetSource(Global.AutofireStickyXORAdapter.And(m)); return lg.GenerateInputDisplay(); }