From 5ff33e75694fde76632b17427bc696ad521cbf80 Mon Sep 17 00:00:00 2001 From: adelikat Date: Mon, 12 Dec 2016 12:30:32 -0600 Subject: [PATCH] Rename IController.Type to IController.Definition to more clearly describe the property --- BizHawk.Client.ApiHawk/Classes/ClientApi.cs | 2 +- BizHawk.Client.Common/ControllerBinding.cs | 8 ++-- .../inputAdapters/BitwiseAdapters.cs | 6 +-- .../inputAdapters/InputAdapters.cs | 30 +++++++------- .../inputAdapters/InputManager.cs | 6 +-- .../lua/EmuLuaLibrary.Joypad.cs | 10 ++--- .../lua/EmuLuaLibrary.Movie.cs | 4 +- BizHawk.Client.Common/movie/MovieSession.cs | 2 +- .../movie/MultitrackRecording.cs | 2 +- .../movie/bk2/Bk2ControllerAdapter.cs | 12 +++--- .../movie/bk2/Bk2LogEntryGenerator.cs | 18 ++++----- .../movie/bk2/Bk2Movie.InputLog.cs | 2 +- BizHawk.Client.Common/movie/bk2/Bk2Movie.cs | 2 +- .../movie/bkm/BkmControllerAdapter.cs | 12 +++--- .../movie/bkm/BkmLogEntryGenerator.cs | 2 +- BizHawk.Client.Common/movie/bkm/BkmMovie.cs | 2 +- .../movie/import/MovieImport.cs | 40 +++++++++---------- .../movie/import/PJMImport.cs | 4 +- .../movie/interfaces/IMovieController.cs | 2 +- .../movie/tasproj/TasMovie.cs | 4 +- .../tools/BasicBot/BasicBot.cs | 2 +- .../tools/Macros/MovieZone.cs | 22 +++++----- .../tools/TAStudio/PatternsForm.cs | 18 ++++----- .../tools/TAStudio/TAStudio.ListView.cs | 16 ++++---- .../tools/TAStudio/TAStudio.cs | 6 +-- .../tools/TAStudio/TAStudioClipboard.cs | 4 +- BizHawk.Client.MultiHawk/InputManager.cs | 6 +-- .../Base Implementations/NullController.cs | 2 +- .../Interfaces/IController.cs | 5 ++- .../Consoles/Nintendo/NES/NESControllers.cs | 2 +- .../Consoles/Nintendo/SNES/LibsnesCore.cs | 4 +- 31 files changed, 130 insertions(+), 127 deletions(-) diff --git a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs index 8dd45af913..1e2094ac10 100644 --- a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs +++ b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs @@ -340,7 +340,7 @@ namespace BizHawk.Client.ApiHawk { AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter; - IEnumerable pressedButtons = from button in joypadAdaptor.Type.BoolButtons + IEnumerable pressedButtons = from button in joypadAdaptor.Definition.BoolButtons where joypadAdaptor[button] select button; diff --git a/BizHawk.Client.Common/ControllerBinding.cs b/BizHawk.Client.Common/ControllerBinding.cs index 1f2cf19978..b3a2d94bf7 100644 --- a/BizHawk.Client.Common/ControllerBinding.cs +++ b/BizHawk.Client.Common/ControllerBinding.cs @@ -27,7 +27,7 @@ namespace BizHawk.Client.Common } } - public ControllerDefinition Type { get { return _type; } } + public ControllerDefinition Definition { get { return _type; } } /// don't do this public void ForceType(ControllerDefinition newtype) { _type = newtype; } @@ -165,9 +165,9 @@ namespace BizHawk.Client.Common { // change: or from each button that the other input controller has // foreach (string button in type.BoolButtons) - if (controller.Type != null) + if (controller.Definition != null) { - foreach (var button in controller.Type.BoolButtons) + foreach (var button in controller.Definition.BoolButtons) { if (controller.IsPressed(button)) { @@ -259,7 +259,7 @@ namespace BizHawk.Client.Common public int On { get; set; } public int Off { get; set; } - public ControllerDefinition Type { get { return _type; } } + public ControllerDefinition Definition { get { return _type; } } public bool this[string button] { get { return IsPressed(button); } } public bool IsPressed(string button) { diff --git a/BizHawk.Client.Common/inputAdapters/BitwiseAdapters.cs b/BizHawk.Client.Common/inputAdapters/BitwiseAdapters.cs index 0d47ae8a0c..fd12a07878 100644 --- a/BizHawk.Client.Common/inputAdapters/BitwiseAdapters.cs +++ b/BizHawk.Client.Common/inputAdapters/BitwiseAdapters.cs @@ -17,7 +17,7 @@ namespace BizHawk.Client.Common public IController Source { get; set; } public IController SourceAnd { get; set; } - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } + public ControllerDefinition Definition { get { return Source.Definition; } set { throw new InvalidOperationException(); } } public bool this[string button] { @@ -52,9 +52,9 @@ namespace BizHawk.Client.Common public IController Source { get; set; } public IController SourceOr { get; set; } - public ControllerDefinition Type + public ControllerDefinition Definition { - get { return Source.Type; } + get { return Source.Definition; } set { throw new InvalidOperationException(); } } diff --git a/BizHawk.Client.Common/inputAdapters/InputAdapters.cs b/BizHawk.Client.Common/inputAdapters/InputAdapters.cs index 35a524d3d2..7f821950f3 100644 --- a/BizHawk.Client.Common/inputAdapters/InputAdapters.cs +++ b/BizHawk.Client.Common/inputAdapters/InputAdapters.cs @@ -14,7 +14,7 @@ namespace BizHawk.Client.Common /// public class ClickyVirtualPadController : IController { - public ControllerDefinition Type { get; set; } + public ControllerDefinition Definition { get; set; } public bool this[string button] { @@ -86,9 +86,9 @@ namespace BizHawk.Client.Common /// public class UD_LR_ControllerAdapter : IController { - public ControllerDefinition Type + public ControllerDefinition Definition { - get { return Source.Type; } + get { return Source.Definition; } } public bool this[string button] @@ -185,7 +185,7 @@ namespace BizHawk.Client.Common public class SimpleController : IController { - public ControllerDefinition Type { get; set; } + public ControllerDefinition Definition { get; set; } protected WorkingDictionary Buttons = new WorkingDictionary(); protected WorkingDictionary Floats = new WorkingDictionary(); @@ -219,7 +219,7 @@ namespace BizHawk.Client.Common public virtual void LatchFrom(IController source) { - foreach (var button in source.Type.BoolButtons) + foreach (var button in source.Definition.BoolButtons) { Buttons[button] = source[button]; } @@ -246,13 +246,13 @@ namespace BizHawk.Client.Common // this works in the code because SourceOr is the autofire controller public float GetFloat(string name) { - int i = Source.Type.FloatControls.IndexOf(name); - return Source.Type.FloatRanges[i].Mid; // Floats don't make sense in sticky land + int i = Source.Definition.FloatControls.IndexOf(name); + return Source.Definition.FloatRanges[i].Mid; // Floats don't make sense in sticky land } public ISticky Source { get; set; } public ISticky SourceStickyOr { get; set; } - public ControllerDefinition Type { get { return Source.Type; } set { throw new InvalidOperationException(); } } + public ControllerDefinition Definition { get { return Source.Definition; } set { throw new InvalidOperationException(); } } public bool this[string button] { @@ -280,9 +280,9 @@ namespace BizHawk.Client.Common public IController Source { get; set; } - public ControllerDefinition Type + public ControllerDefinition Definition { - get { return Source.Type; } + get { return Source.Definition; } set { throw new InvalidOperationException(); } } @@ -440,9 +440,9 @@ namespace BizHawk.Client.Common public IController Source { get; set; } - public ControllerDefinition Type + public ControllerDefinition Definition { - get { return Source.Type; } + get { return Source.Definition; } } public bool Locked { get; set; } // Pretty much a hack, @@ -598,9 +598,9 @@ namespace BizHawk.Client.Common } } - public ControllerDefinition Type + public ControllerDefinition Definition { - get { return Curr.Type; } + get { return Curr.Definition; } } public bool this[string button] @@ -654,7 +654,7 @@ namespace BizHawk.Client.Common } } - public ControllerDefinition Type { get; set; } + public ControllerDefinition Definition { get; set; } public IEnumerable Overrides { diff --git a/BizHawk.Client.Common/inputAdapters/InputManager.cs b/BizHawk.Client.Common/inputAdapters/InputManager.cs index d6b39dafb8..2963b419be 100644 --- a/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -9,7 +9,7 @@ namespace BizHawk.Client.Common public static void RewireInputChain() { Global.ControllerInputCoalescer.Clear(); - Global.ControllerInputCoalescer.Type = Global.ActiveController.Type; + Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition; Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController); @@ -21,7 +21,7 @@ namespace BizHawk.Client.Common Global.ControllerOutput.Source = Global.MovieOutputHardpoint; Global.Emulator.Controller = Global.ControllerOutput; - Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type; + Global.MovieSession.MovieControllerAdapter.Definition = Global.MovieInputSourceAdapter.Definition; // connect the movie session before MovieOutputHardpoint if it is doing anything // otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session @@ -45,7 +45,7 @@ namespace BizHawk.Client.Common // allow propogating controls that are in the current controller definition but not in the prebaked one // these two lines shouldn't be required anymore under the new system? Global.ActiveController.ForceType(new ControllerDefinition(def)); - Global.ClickyVirtualPadController.Type = new ControllerDefinition(def); + Global.ClickyVirtualPadController.Definition = new ControllerDefinition(def); RewireInputChain(); } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs index 350b3b967c..d458c18a41 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Joypad.cs @@ -21,7 +21,7 @@ namespace BizHawk.Client.Common { var buttons = Lua.NewTable(); var adaptor = Global.AutofireStickyXORAdapter; - foreach (var button in adaptor.Source.Type.BoolButtons) + foreach (var button in adaptor.Source.Definition.BoolButtons) { if (!controller.HasValue) { @@ -33,7 +33,7 @@ namespace BizHawk.Client.Common } } - foreach (var button in adaptor.Source.Type.FloatControls) + foreach (var button in adaptor.Source.Definition.FloatControls) { if (controller == null) { @@ -59,7 +59,7 @@ namespace BizHawk.Client.Common public LuaTable GetImmediate() { var buttons = Lua.NewTable(); - foreach (var button in Global.ActiveController.Type.BoolButtons) + foreach (var button in Global.ActiveController.Definition.BoolButtons) { buttons[button] = Global.ActiveController[button]; } @@ -78,12 +78,12 @@ namespace BizHawk.Client.Common var lg = Global.MovieSession.MovieControllerInstance(); lg.SetControllersAsMnemonic(inputLogEntry); - foreach (var button in lg.Type.BoolButtons) + foreach (var button in lg.Definition.BoolButtons) { Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button)); } - foreach (var floatButton in lg.Type.FloatControls) + foreach (var floatButton in lg.Definition.FloatControls) { Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton)); } diff --git a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs index 4463300264..f315742629 100644 --- a/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs +++ b/BizHawk.Client.Common/lua/EmuLuaLibrary.Movie.cs @@ -63,12 +63,12 @@ namespace BizHawk.Client.Common return null; } - foreach (var button in adapter.Type.BoolButtons) + foreach (var button in adapter.Definition.BoolButtons) { input[button] = adapter[button]; } - foreach (var button in adapter.Type.FloatControls) + foreach (var button in adapter.Definition.FloatControls) { input[button] = adapter[button]; } diff --git a/BizHawk.Client.Common/movie/MovieSession.cs b/BizHawk.Client.Common/movie/MovieSession.cs index 25f54c379c..9393d6e9f7 100644 --- a/BizHawk.Client.Common/movie/MovieSession.cs +++ b/BizHawk.Client.Common/movie/MovieSession.cs @@ -65,7 +65,7 @@ namespace BizHawk.Client.Common public IMovieController MovieControllerInstance() { var adapter = Movie.LogGeneratorInstance().MovieControllerAdapter; - adapter.Type = MovieControllerAdapter.Type; + adapter.Definition = MovieControllerAdapter.Definition; return adapter; } diff --git a/BizHawk.Client.Common/movie/MultitrackRecording.cs b/BizHawk.Client.Common/movie/MultitrackRecording.cs index a0a8446617..6b194295f5 100644 --- a/BizHawk.Client.Common/movie/MultitrackRecording.cs +++ b/BizHawk.Client.Common/movie/MultitrackRecording.cs @@ -94,7 +94,7 @@ namespace BizHawk.Client.Common public int PlayerSource { get; set; } public int PlayerTargetMask { get; set; } - public ControllerDefinition Type { get { return Source.Type; } } + public ControllerDefinition Definition { get { return Source.Definition; } } public bool this[string button] { diff --git a/BizHawk.Client.Common/movie/bk2/Bk2ControllerAdapter.cs b/BizHawk.Client.Common/movie/bk2/Bk2ControllerAdapter.cs index 72cc269909..1ab43b9f11 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2ControllerAdapter.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2ControllerAdapter.cs @@ -71,7 +71,7 @@ namespace BizHawk.Client.Common private Bk2ControllerDefinition _type = new Bk2ControllerDefinition(); - public ControllerDefinition Type + public ControllerDefinition Definition { get { @@ -90,7 +90,7 @@ namespace BizHawk.Client.Common /// public void LatchPlayerFromSource(IController playerSource, int playerNum) { - foreach (var button in playerSource.Type.BoolButtons) + foreach (var button in playerSource.Definition.BoolButtons) { var bnp = ButtonNameParser.Parse(button); if (bnp == null) @@ -107,7 +107,7 @@ namespace BizHawk.Client.Common MyBoolButtons[button] = val; } - foreach (var button in Type.FloatControls) + foreach (var button in Definition.FloatControls) { var bnp = ButtonNameParser.Parse(button); if (bnp == null) @@ -131,12 +131,12 @@ namespace BizHawk.Client.Common /// public void LatchFromSource(IController source) { - foreach (var button in Type.BoolButtons) + foreach (var button in Definition.BoolButtons) { MyBoolButtons[button] = source.IsPressed(button); } - foreach (var name in Type.FloatControls) + foreach (var name in Definition.FloatControls) { MyFloatControls[name] = source.GetFloat(name); } @@ -151,7 +151,7 @@ namespace BizHawk.Client.Common { var def = Global.Emulator.ControllerDefinition; var trimmed = mnemonic.Replace("|", ""); - var buttons = Type.ControlsOrdered.SelectMany(x => x).ToList(); + var buttons = Definition.ControlsOrdered.SelectMany(x => x).ToList(); var iterator = 0; foreach (var key in buttons) diff --git a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs index 3b0f698434..a283565143 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2LogEntryGenerator.cs @@ -67,7 +67,7 @@ namespace BizHawk.Client.Common var sb = new StringBuilder(); sb.Append("LogKey:"); - foreach (var group in _source.Type.ControlsOrdered.Where(c => c.Any())) + foreach (var group in _source.Definition.ControlsOrdered.Where(c => c.Any())) { sb.Append("#"); foreach (var button in group) @@ -84,15 +84,15 @@ namespace BizHawk.Client.Common public Dictionary Map() { var dict = new Dictionary(); - foreach (var group in _source.Type.ControlsOrdered.Where(c => c.Any())) + foreach (var group in _source.Definition.ControlsOrdered.Where(c => c.Any())) { foreach (var button in group) { - if (_source.Type.BoolButtons.Contains(button)) + if (_source.Definition.BoolButtons.Contains(button)) { dict.Add(button, Mnemonics[button].ToString()); } - else if (_source.Type.FloatControls.Contains(button)) + else if (_source.Definition.FloatControls.Contains(button)) { dict.Add(button, FloatLookup[button]); } @@ -109,17 +109,17 @@ namespace BizHawk.Client.Common if (!forInputDisplay) sb.Append('|'); - foreach (var group in _source.Type.ControlsOrdered) + foreach (var group in _source.Definition.ControlsOrdered) { if (group.Any()) { foreach (var button in group) { - if (_source.Type.FloatControls.Contains(button)) + if (_source.Definition.FloatControls.Contains(button)) { int val; - int i = _source.Type.FloatControls.IndexOf(button); - int mid = (int)_source.Type.FloatRanges[i].Mid; + int i = _source.Definition.FloatControls.IndexOf(button); + int mid = (int)_source.Definition.FloatRanges[i].Mid; if (createEmpty) { @@ -135,7 +135,7 @@ namespace BizHawk.Client.Common else sb.Append(val.ToString().PadLeft(5, ' ')).Append(','); } - else if (_source.Type.BoolButtons.Contains(button)) + else if (_source.Definition.BoolButtons.Contains(button)) { if (createEmpty) { diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs index efd991227d..9b58f0f3c6 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs @@ -321,7 +321,7 @@ namespace BizHawk.Client.Common private string ConvertLogEntryFromFile(string line, string logKey) { var adapter = new Bk2LogEntryGenerator(logKey).MovieControllerAdapter; - adapter.Type = Global.MovieSession.MovieControllerAdapter.Type; + adapter.Definition = Global.MovieSession.MovieControllerAdapter.Definition; adapter.SetControllersAsMnemonic(line); var lg = LogGeneratorInstance(); diff --git a/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs b/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs index ddbd4f4dd0..65705b81cf 100644 --- a/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs +++ b/BizHawk.Client.Common/movie/bk2/Bk2Movie.cs @@ -143,7 +143,7 @@ namespace BizHawk.Client.Common var adapter = new Bk2ControllerAdapter { - Type = Global.MovieSession.MovieControllerAdapter.Type + Definition = Global.MovieSession.MovieControllerAdapter.Definition }; adapter.SetControllersAsMnemonic(_log[getframe]); diff --git a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs index c2d08bd86d..04bc70e79b 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmControllerAdapter.cs @@ -28,14 +28,14 @@ namespace BizHawk.Client.Common #region IMovieController Implementation - public ControllerDefinition Type { get; set; } + public ControllerDefinition Definition { get; set; } /// /// latches one player from the source /// public void LatchPlayerFromSource(IController playerSource, int playerNum) { - foreach (var button in playerSource.Type.BoolButtons) + foreach (var button in playerSource.Definition.BoolButtons) { var bnp = ButtonNameParser.Parse(button); if (bnp == null) @@ -58,12 +58,12 @@ namespace BizHawk.Client.Common /// public void LatchFromSource(IController source) { - foreach (var button in Type.BoolButtons) + foreach (var button in Definition.BoolButtons) { MyBoolButtons[button] = source[button]; } - foreach (var name in Type.FloatControls) + foreach (var name in Definition.FloatControls) { MyFloatControls[name] = source.GetFloat(name); } @@ -258,7 +258,7 @@ namespace BizHawk.Client.Common private bool IsGenesis6Button() { - return this.Type.BoolButtons.Contains("P1 X"); + return this.Definition.BoolButtons.Contains("P1 X"); } private void Force(string button, bool state) @@ -271,7 +271,7 @@ namespace BizHawk.Client.Common MyFloatControls[name] = state; } - private string ControlType { get { return Type.Name; } } + private string ControlType { get { return Definition.Name; } } private void SetGBAControllersAsMnemonic(string mnemonic) { diff --git a/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs b/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs index bb93765f8e..b2f7d9760c 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmLogEntryGenerator.cs @@ -12,7 +12,7 @@ namespace BizHawk.Client.Common public void SetSource(IController source) { _source = source; - _controlType = source.Type.Name; + _controlType = source.Definition.Name; } public string GenerateLogEntry() diff --git a/BizHawk.Client.Common/movie/bkm/BkmMovie.cs b/BizHawk.Client.Common/movie/bkm/BkmMovie.cs index 17365d6fa9..25fbe38c4a 100644 --- a/BizHawk.Client.Common/movie/bkm/BkmMovie.cs +++ b/BizHawk.Client.Common/movie/bkm/BkmMovie.cs @@ -100,7 +100,7 @@ namespace BizHawk.Client.Common var adapter = new BkmControllerAdapter { - Type = Global.MovieSession.MovieControllerAdapter.Type + Definition = Global.MovieSession.MovieControllerAdapter.Definition }; adapter.SetControllersAsMnemonic(_log[getframe]); return adapter; diff --git a/BizHawk.Client.Common/movie/import/MovieImport.cs b/BizHawk.Client.Common/movie/import/MovieImport.cs index 6a80d0aa91..a3a92f8ca8 100644 --- a/BizHawk.Client.Common/movie/import/MovieImport.cs +++ b/BizHawk.Client.Common/movie/import/MovieImport.cs @@ -241,7 +241,7 @@ namespace BizHawk.Client.Common private static IController EmptyLmsvFrame(string line) { - var emptyController = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } }; + var emptyController = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } }; emptyController["Reset"] = false; emptyController["Power"] = false; @@ -294,7 +294,7 @@ namespace BizHawk.Client.Common controller = "Saturn Controller"; break; } - var controllers = new SimpleController { Type = new ControllerDefinition { Name = controller } }; + var controllers = new SimpleController { Definition = new ControllerDefinition { Name = controller } }; // Split up the sections of the frame. string[] sections = line.Split('|'); if (ext == ".FM2" && sections.Length >= 2 && sections[1].Length != 0) @@ -373,14 +373,14 @@ namespace BizHawk.Client.Common int player = section + player_offset; string prefix = "P" + (player) + " "; // Gameboy doesn't currently have a prefix saying which player the input is for. - if (controllers.Type.Name == "Gameboy Controller") + if (controllers.Definition.Name == "Gameboy Controller") { prefix = ""; } // Only count lines with that have the right number of buttons and are for valid players. if ( sections[section].Length == buttons.Length && - player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name] + player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name] ) { for (int button = 0; button < buttons.Length; button++) @@ -724,7 +724,7 @@ namespace BizHawk.Client.Common m.Header[HeaderKeys.AUTHOR] = author; // Advance to first byte of input data. r.BaseStream.Position = firstFrameOffset; - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } }; string[] buttons = { "A", "B", "Select", "Start", "Up", "Down", "Left", "Right" }; bool fds = false; bool fourscore = false; @@ -955,7 +955,7 @@ namespace BizHawk.Client.Common */ m.Header[HeaderKeys.PAL] = "False"; // 090 frame data begins here - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } }; /* * 01 Right * 02 Left @@ -1042,14 +1042,14 @@ namespace BizHawk.Client.Common string player1Config = r.ReadStringFixedAscii(1); // 015 ASCII-encoded controller config for player 2. '3' or '6'. string player2Config = r.ReadStringFixedAscii(1); - SimpleController controllers = new SimpleController { Type = new ControllerDefinition() }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() }; if (player1Config == "6" || player2Config == "6") { - controllers.Type.Name = "GPGX Genesis Controller"; + controllers.Definition.Name = "GPGX Genesis Controller"; } else { - controllers.Type.Name = "GPGX 3-Button Controller"; + controllers.Definition.Name = "GPGX 3-Button Controller"; } // 016 special flags (Version A and up only) byte flags = r.ReadByte(); @@ -1474,7 +1474,7 @@ namespace BizHawk.Client.Common r.ReadBytes(103); // TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not. // 100 variable Input data - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = name + " Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = name + " Controller" } }; int bytes = 256; // The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame. if (platform == "nes") @@ -1595,7 +1595,7 @@ namespace BizHawk.Client.Common // 00e4-00f3: binary: rom MD5 digest byte[] md5 = r.ReadBytes(16); m.Header[MD5] = string.Format("{0:x8}", md5.BytesToHexString().ToLower()); - var controllers = new SimpleController { Type = new ControllerDefinition { Name = "SMS Controller" } }; + var controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SMS Controller" } }; /* 76543210 * bit 0 (0x01): up @@ -1820,7 +1820,7 @@ namespace BizHawk.Client.Common // ... 4-byte little-endian unsigned int: length of controller data in bytes uint length = r.ReadUInt32(); // ... (variable) controller data - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } }; /* Standard controllers store data in the following format: * 01: A @@ -1923,7 +1923,7 @@ namespace BizHawk.Client.Common * bit 4: controller 5 in use * other: reserved, set to 0 */ - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } }; bool[] controllersUsed = new bool[5]; for (int controller = 1; controller <= controllersUsed.Length; controller++) { @@ -2109,7 +2109,7 @@ namespace BizHawk.Client.Common } } ushort controllerState = (ushort)(((controllerState1 << 4) & 0x0F00) | controllerState2); - if (player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name]) + if (player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name]) { for (int button = 0; button < buttons.Length; button++) { @@ -2334,14 +2334,14 @@ namespace BizHawk.Client.Common string movieDescription = NullTerminated(r.ReadStringFixedAscii(128)); m.Comments.Add(COMMENT + " " + movieDescription); r.BaseStream.Position = firstFrameOffset; - SimpleController controllers = new SimpleController { Type = new ControllerDefinition() }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() }; if (platform != "GBA") { - controllers.Type.Name = "Gameboy Controller"; + controllers.Definition.Name = "Gameboy Controller"; } else { - controllers.Type.Name = "GBA Controller"; + controllers.Definition.Name = "GBA Controller"; } /* * 01 00 A @@ -2512,7 +2512,7 @@ namespace BizHawk.Client.Common return m; } r.BaseStream.Position = firstFrameOffset; - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "NES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "NES Controller" } }; /* * 01 A * 02 B @@ -2749,7 +2749,7 @@ namespace BizHawk.Client.Common uint savestateSize = (uint)((r.ReadByte() | (r.ReadByte() << 8) | (r.ReadByte() << 16)) & 0x7FFFFF); // Next follows a ZST format savestate. r.ReadBytes((int)savestateSize); - SimpleController controllers = new SimpleController { Type = new ControllerDefinition { Name = "SNES Controller" } }; + SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = "SNES Controller" } }; /* * bit 11: A * bit 10: X @@ -2903,7 +2903,7 @@ namespace BizHawk.Client.Common } } leftOver = !leftOver; - if (player <= BkmMnemonicConstants.PLAYERS[controllers.Type.Name]) + if (player <= BkmMnemonicConstants.PLAYERS[controllers.Definition.Name]) { if (player != 2 || !superScope) { diff --git a/BizHawk.Client.Common/movie/import/PJMImport.cs b/BizHawk.Client.Common/movie/import/PJMImport.cs index 6102242f6f..32c9fbaab1 100644 --- a/BizHawk.Client.Common/movie/import/PJMImport.cs +++ b/BizHawk.Client.Common/movie/import/PJMImport.cs @@ -183,7 +183,7 @@ namespace BizHawk.Client.Common info.player2Type, OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None }; - controllers.Type = Octoshock.CreateControllerDefinition(settings); + controllers.Definition = Octoshock.CreateControllerDefinition(settings); string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left", "L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"}; @@ -290,7 +290,7 @@ namespace BizHawk.Client.Common info.player2Type, OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None,OctoshockDll.ePeripheralType.None }; - controllers.Type = Octoshock.CreateControllerDefinition(settings); + controllers.Definition = Octoshock.CreateControllerDefinition(settings); string[] buttons = { "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left", "L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square"}; diff --git a/BizHawk.Client.Common/movie/interfaces/IMovieController.cs b/BizHawk.Client.Common/movie/interfaces/IMovieController.cs index 4b09fcb584..ac1569ee9f 100644 --- a/BizHawk.Client.Common/movie/interfaces/IMovieController.cs +++ b/BizHawk.Client.Common/movie/interfaces/IMovieController.cs @@ -4,7 +4,7 @@ namespace BizHawk.Client.Common { public interface IMovieController: IController { - new ControllerDefinition Type { get; set; } + new ControllerDefinition Definition { get; set; } void LatchPlayerFromSource(IController playerSource, int playerNum); diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 127b06d7b7..644ce6ef5b 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -268,14 +268,14 @@ namespace BizHawk.Client.Common public string CreateDisplayValueForButton(IController adapter, string buttonName) { - if (adapter.Type.BoolButtons.Contains(buttonName)) + if (adapter.Definition.BoolButtons.Contains(buttonName)) { return adapter.IsPressed(buttonName) ? Mnemonics[buttonName].ToString() : string.Empty; } - if (adapter.Type.FloatControls.Contains(buttonName)) + if (adapter.Definition.FloatControls.Contains(buttonName)) { return adapter.GetFloat(buttonName).ToString(); } diff --git a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs index 96d5cfa6db..79b4a5d7ea 100644 --- a/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs +++ b/BizHawk.Client.EmuHawk/tools/BasicBot/BasicBot.cs @@ -903,7 +903,7 @@ namespace BizHawk.Client.EmuHawk var lg = Global.MovieSession.MovieControllerInstance(); lg.SetControllersAsMnemonic(logEntry); - foreach (var button in lg.Type.BoolButtons) + foreach (var button in lg.Definition.BoolButtons) { // TODO: make an input adapter specifically for the bot? Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button)); diff --git a/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs b/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs index b5f4748815..1230d9768e 100644 --- a/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs +++ b/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs @@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk var lg = Global.MovieSession.LogGeneratorInstance() as Bk2LogEntryGenerator; lg.SetSource(Global.MovieSession.MovieControllerAdapter); targetController = new Bk2ControllerAdapter(); - targetController.Type = Global.Emulator.ControllerDefinition; + targetController.Definition = Global.Emulator.ControllerDefinition; targetController.LatchFromSource(targetController); // Reference and create all buttons if (key == "") @@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk } } - controller = new Bk2ControllerAdapter { Type = d }; + controller = new Bk2ControllerAdapter { Definition = d }; var logGenerator = new Bk2LogEntryGenerator(""); logGenerator.SetSource(controller); logGenerator.GenerateLogEntry(); // Reference and create all buttons. @@ -104,7 +104,7 @@ namespace BizHawk.Client.EmuHawk } } - var newController = new Bk2ControllerAdapter { Type = d }; + var newController = new Bk2ControllerAdapter { Definition = d }; var logGenerator = new Bk2LogEntryGenerator(""); logGenerator.SetSource(newController); @@ -252,7 +252,7 @@ namespace BizHawk.Client.EmuHawk // Adapters targetController = new Bk2ControllerAdapter(); - targetController.Type = Global.Emulator.ControllerDefinition; + targetController.Definition = Global.Emulator.ControllerDefinition; targetController.LatchFromSource(targetController); // Reference and create all buttons string[] keys = _inputKey.Split('|'); ControllerDefinition d = new ControllerDefinition(); @@ -268,19 +268,19 @@ namespace BizHawk.Client.EmuHawk } } - controller = new Bk2ControllerAdapter { Type = d }; + controller = new Bk2ControllerAdapter { Definition = d }; } #region Custom Latch private void LatchFromSourceButtons(Bk2ControllerAdapter latching, IController source) { - foreach (string button in source.Type.BoolButtons) + foreach (string button in source.Definition.BoolButtons) { latching[button] = source.IsPressed(button); } - foreach (string name in source.Type.FloatControls) + foreach (string name in source.Definition.FloatControls) { latching.SetFloat(name, source.GetFloat(name)); } @@ -288,16 +288,16 @@ namespace BizHawk.Client.EmuHawk private void ORLatchFromSource(Bk2ControllerAdapter latching, IController source) { - foreach (string button in latching.Type.BoolButtons) + foreach (string button in latching.Definition.BoolButtons) { latching[button] |= source.IsPressed(button); } - foreach (string name in latching.Type.FloatControls) + foreach (string name in latching.Definition.FloatControls) { float sFloat = source.GetFloat(name); - int indexRange = source.Type.FloatControls.IndexOf(name); - if (sFloat == source.Type.FloatRanges[indexRange].Mid) + int indexRange = source.Definition.FloatControls.IndexOf(name); + if (sFloat == source.Definition.FloatRanges[indexRange].Mid) { latching.SetFloat(name, sFloat); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs index 3dce9909ec..975e18fe78 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/PatternsForm.cs @@ -20,9 +20,9 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); tastudio = owner; - foreach (var button in Global.MovieSession.MovieControllerAdapter.Type.BoolButtons) + foreach (var button in Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons) ButtonBox.Items.Add(button); - foreach (var button in Global.MovieSession.MovieControllerAdapter.Type.FloatControls) + foreach (var button in Global.MovieSession.MovieControllerAdapter.Definition.FloatControls) ButtonBox.Items.Add(button); ButtonBox.Items.Add("Default bool Auto-Fire"); ButtonBox.Items.Add("Default float Auto-Fire"); @@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk List values = new List(); int loopAt; string selectedButton { get { return ButtonBox.Text; } } - bool isBool { get { return selectedButton == "Default bool Auto-Fire" || Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(selectedButton); } } + bool isBool { get { return selectedButton == "Default bool Auto-Fire" || Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(selectedButton); } } private void ButtonBox_SelectedIndexChanged(object sender, EventArgs e) { @@ -150,7 +150,7 @@ namespace BizHawk.Client.EmuHawk if (PatternList.SelectedIndex != -1 && PatternList.SelectedIndex < values.Count) { - index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton); + index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton); if (selectedButton == "Default bool Auto-Fire") index = tastudio.BoolPatterns.Length + 1; if (index != -1) @@ -164,7 +164,7 @@ namespace BizHawk.Client.EmuHawk if (selectedButton == "Default float Auto-Fire") index = tastudio.FloatPatterns.Length + 1; else - index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton); + index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton); LagBox.Checked = tastudio.FloatPatterns[index].SkipsLag; ValueNum.Value = Convert.ToDecimal(values[PatternList.SelectedIndex]); @@ -180,7 +180,7 @@ namespace BizHawk.Client.EmuHawk private void UpdatePattern() { - int index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton); + int index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton); if (selectedButton == "Default bool Auto-Fire") index = tastudio.BoolPatterns.Length + 1; if (index != -1) @@ -198,7 +198,7 @@ namespace BizHawk.Client.EmuHawk if (selectedButton == "Default float Auto-Fire") index = tastudio.FloatPatterns.Length + 1; else - index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton); + index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton); List p = new List(); for (int i = 0; i < counts.Count; i++) { @@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk private void GetPattern() { - int index = Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.IndexOf(selectedButton); + int index = Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.IndexOf(selectedButton); if (selectedButton == "Default bool Auto-Fire") index = tastudio.BoolPatterns.Length + 1; if (index != -1) @@ -242,7 +242,7 @@ namespace BizHawk.Client.EmuHawk if (selectedButton == "Default float Auto-Fire") index = tastudio.FloatPatterns.Length + 1; else - index = Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(selectedButton); + index = Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(selectedButton); float[] p = tastudio.FloatPatterns[index].Pattern; float lastValue = p[0]; counts.Clear(); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 46a768c09a..3f74fbe186 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk private bool _wasRecording = false; private Emulation.Common.ControllerDefinition controllerType - { get { return Global.MovieSession.MovieControllerAdapter.Type; } } + { get { return Global.MovieSession.MovieControllerAdapter.Definition; } } public AutoPatternBool[] BoolPatterns; public AutoPatternFloat[] FloatPatterns; @@ -297,8 +297,8 @@ namespace BizHawk.Client.EmuHawk if (column.Type == InputRoll.RollColumn.InputType.Float) { // feos: this could be cashed, but I don't notice any slowdown this way either - Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges - [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(columnName)]; + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(columnName)]; if (text == range.Mid.ToString()) text = ""; } @@ -493,7 +493,7 @@ namespace BizHawk.Client.EmuHawk { bool wasPaused = Mainform.EmulatorPaused; - if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName)) + if (Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(buttonName)) { CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame); @@ -952,8 +952,8 @@ namespace BizHawk.Client.EmuHawk return; float value = _floatPaintState + increment; - Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges - [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)]; + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)]; // Range for N64 Y axis has max -128 and min 127. That should probably be fixed in ControllerDefinition.cs. // SuuperW: I really don't think changing it would break anything, but adelikat isn't so sure. float rMax = range.Max; @@ -1027,8 +1027,8 @@ namespace BizHawk.Client.EmuHawk float prev = value; string prevTyped = _floatTypedValue; - Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges - [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(_floatEditColumn)]; + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)]; float rMax = range.Max; float rMin = range.Min; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 8bd9088db2..208bc3fbd2 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -424,10 +424,10 @@ namespace BizHawk.Client.EmuHawk int digits = 1; foreach (var kvp in columnNames) { - if (Global.MovieSession.MovieControllerAdapter.Type.FloatControls.Contains(kvp.Key)) + if (Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.Contains(kvp.Key)) { - Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Type.FloatRanges - [Global.MovieSession.MovieControllerAdapter.Type.FloatControls.IndexOf(kvp.Key)]; + Emulation.Common.ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges + [Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(kvp.Key)]; type = InputRoll.RollColumn.InputType.Float; digits = Math.Max(kvp.Value.Length, range.MaxDigits()); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs index 79f39b256a..a42dbaf4bf 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudioClipboard.cs @@ -27,12 +27,12 @@ namespace BizHawk.Client.EmuHawk var lg = Global.MovieSession.MovieControllerInstance(); lg.SetControllersAsMnemonic(inputLogEntry); - foreach (var button in lg.Type.BoolButtons) + foreach (var button in lg.Definition.BoolButtons) { Global.LuaAndAdaptor.SetButton(button, lg.IsPressed(button)); } - foreach (var floatButton in lg.Type.FloatControls) + foreach (var floatButton in lg.Definition.FloatControls) { Global.LuaAndAdaptor.SetFloat(floatButton, lg.GetFloat(floatButton)); } diff --git a/BizHawk.Client.MultiHawk/InputManager.cs b/BizHawk.Client.MultiHawk/InputManager.cs index 08d63431e2..93cc40452a 100644 --- a/BizHawk.Client.MultiHawk/InputManager.cs +++ b/BizHawk.Client.MultiHawk/InputManager.cs @@ -20,7 +20,7 @@ namespace BizHawk.Client.MultiHawk public void RewireInputChain() { Global.ControllerInputCoalescer.Clear(); - Global.ControllerInputCoalescer.Type = Global.ActiveController.Type; + Global.ControllerInputCoalescer.Definition = Global.ActiveController.Definition; // TODO? //Global.UD_LR_ControllerAdapter.Source = Global.ActiveController.Or(Global.AutoFireController); @@ -42,7 +42,7 @@ namespace BizHawk.Client.MultiHawk window.Emulator.Controller = Global.ControllerOutput; } - Global.MovieSession.MovieControllerAdapter.Type = Global.MovieInputSourceAdapter.Type; + Global.MovieSession.MovieControllerAdapter.Definition = Global.MovieInputSourceAdapter.Definition; // connect the movie session before MovieOutputHardpoint if it is doing anything // otherwise connect the MovieInputSourceAdapter to it, effectively bypassing the movie session @@ -67,7 +67,7 @@ namespace BizHawk.Client.MultiHawk // allow propogating controls that are in the current controller definition but not in the prebaked one // these two lines shouldn't be required anymore under the new system? Global.ActiveController.ForceType(new ControllerDefinition(def)); - Global.ClickyVirtualPadController.Type = new ControllerDefinition(def); + Global.ClickyVirtualPadController.Definition = new ControllerDefinition(def); RewireInputChain(); } diff --git a/BizHawk.Emulation.Common/Base Implementations/NullController.cs b/BizHawk.Emulation.Common/Base Implementations/NullController.cs index 1d6b6e2912..126d75c060 100644 --- a/BizHawk.Emulation.Common/Base Implementations/NullController.cs +++ b/BizHawk.Emulation.Common/Base Implementations/NullController.cs @@ -2,7 +2,7 @@ { public class NullController : IController { - public ControllerDefinition Type { get { return null; } } + public ControllerDefinition Definition { get { return null; } } public bool this[string button] { get { return false; } } public bool IsPressed(string button) { return false; } public float GetFloat(string name) { return 0f; } diff --git a/BizHawk.Emulation.Common/Interfaces/IController.cs b/BizHawk.Emulation.Common/Interfaces/IController.cs index 05a742185d..0a4185f3e5 100644 --- a/BizHawk.Emulation.Common/Interfaces/IController.cs +++ b/BizHawk.Emulation.Common/Interfaces/IController.cs @@ -2,7 +2,10 @@ { public interface IController { - ControllerDefinition Type { get; } + /// + /// Defines the controller schema, including all currently available buttons and their types + /// + ControllerDefinition Definition { get; } // TODO - it is obnoxious for this to be here. must be removed. bool this[string button] { get; } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs index fc7e3aa9e5..594aec84a5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/NESControllers.cs @@ -1156,7 +1156,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES this.remaps = remaps; } - public ControllerDefinition Type { get { throw new NotImplementedException(); } } + public ControllerDefinition Definition { get { throw new NotImplementedException(); } } public bool this[string button] { get { return IsPressed(button); } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs index de3845cc00..514c6c1cf8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.cs @@ -862,7 +862,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// /// invalid until CopyFrom has been called /// - public ControllerDefinition Type + public ControllerDefinition Definition { get { return def; } } @@ -899,7 +899,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES /// public void CopyFrom(IController source) { - this.def = source.Type; + this.def = source.Definition; buttons.Clear(); foreach (var k in def.BoolButtons) buttons.Add(k, source.IsPressed(k) ? 1.0f : 0);