diff --git a/src/BizHawk.Client.Common/Api/Classes/GameInfoApi.cs b/src/BizHawk.Client.Common/Api/Classes/GameInfoApi.cs index 9cb128c4e7..a74d9a527a 100644 --- a/src/BizHawk.Client.Common/Api/Classes/GameInfoApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/GameInfoApi.cs @@ -25,7 +25,7 @@ namespace BizHawk.Client.Common public string GetBoardType() => BoardInfo?.BoardName ?? ""; - public Dictionary GetOptions() + public IReadOnlyDictionary GetOptions() { var options = new Dictionary(); if (_game == null) return options; diff --git a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs index 33663b4d81..4a0d2cb2a6 100644 --- a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs @@ -20,17 +20,17 @@ namespace BizHawk.Client.Common _movieSession = movieSession; } - public IDictionary Get(int? controller = null) + public IReadOnlyDictionary Get(int? controller = null) { return _inputManager.AutofireStickyXorAdapter.ToDictionary(controller); } - public IDictionary GetWithMovie(int? controller = null) + public IReadOnlyDictionary GetWithMovie(int? controller = null) { return _inputManager.ControllerOutput.ToDictionary(controller); } - public IDictionary GetImmediate(int? controller = null) + public IReadOnlyDictionary GetImmediate(int? controller = null) { return _inputManager.ActiveController.ToDictionary(controller); } @@ -51,7 +51,7 @@ namespace BizHawk.Client.Common foreach (var axis in controller.Definition.Axes.Keys) _inputManager.ButtonOverrideAdapter.SetAxis(axis, controller.AxisValue(axis)); } - public void Set(IDictionary buttons, int? controller = null) + public void Set(IReadOnlyDictionary buttons, int? controller = null) { // If a controller is specified, we need to iterate over unique button names. If not, we iterate over // ALL button names with P{controller} prefixes @@ -88,7 +88,7 @@ namespace BizHawk.Client.Common } } - public void SetAnalog(IDictionary controls, object controller = null) + public void SetAnalog(IReadOnlyDictionary controls, object controller = null) { foreach (var kvp in controls) SetAnalog(kvp.Key, kvp.Value, controller); } diff --git a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs index dd1b83555d..6c905b95c8 100644 --- a/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/MovieApi.cs @@ -23,7 +23,7 @@ namespace BizHawk.Client.Common public bool StartsFromSaveram() => _movieSession.Movie.IsActive() && _movieSession.Movie.StartsFromSaveRam; - public IDictionary GetInput(int frame, int? controller = null) + public IReadOnlyDictionary GetInput(int frame, int? controller = null) { if (_movieSession.Movie.NotActive()) { diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IGameInfoApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/IGameInfoApi.cs index 67c84c39cb..bbc7e92d96 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IGameInfoApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IGameInfoApi.cs @@ -10,6 +10,6 @@ namespace BizHawk.Client.Common string GetStatus(); bool IsStatusBad(); string GetBoardType(); - Dictionary GetOptions(); + IReadOnlyDictionary GetOptions(); } } diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs index b8523afe54..9fcc85b58c 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IJoypadApi.cs @@ -4,13 +4,13 @@ namespace BizHawk.Client.Common { public interface IJoypadApi : IExternalApi { - IDictionary Get(int? controller = null); - IDictionary GetWithMovie(int? controller = null); - IDictionary GetImmediate(int? controller = null); + IReadOnlyDictionary Get(int? controller = null); + IReadOnlyDictionary GetWithMovie(int? controller = null); + IReadOnlyDictionary GetImmediate(int? controller = null); void SetFromMnemonicStr(string inputLogEntry); - void Set(IDictionary buttons, int? controller = null); + void Set(IReadOnlyDictionary buttons, int? controller = null); void Set(string button, bool? state = null, int? controller = null); - void SetAnalog(IDictionary controls, object controller = null); + void SetAnalog(IReadOnlyDictionary controls, object controller = null); void SetAnalog(string control, int? value = null, object controller = null); } } diff --git a/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs b/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs index dde5ae3c4d..bed563b7d7 100644 --- a/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs +++ b/src/BizHawk.Client.Common/Api/Interfaces/IMovieApi.cs @@ -7,7 +7,7 @@ namespace BizHawk.Client.Common bool StartsFromSavestate(); bool StartsFromSaveram(); string Filename(); - IDictionary GetInput(int frame, int? controller = null); + IReadOnlyDictionary GetInput(int frame, int? controller = null); string GetInputAsMnemonic(int frame); bool GetReadOnly(); ulong GetRerecordCount(); diff --git a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs index 9fe2f93986..00679d731d 100644 --- a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -32,7 +32,7 @@ namespace BizHawk.Client.Common public StickyXorAdapter StickyXorAdapter { get; } = new StickyXorAdapter(); /// - /// Used to AND to another controller, used for JoypadApi.Set + /// Used to AND to another controller, used for JoypadApi.Set /// public OverrideAdapter ButtonOverrideAdapter { get; } = new OverrideAdapter(); diff --git a/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs b/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs index da28d73cea..054c596693 100644 --- a/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs +++ b/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs @@ -22,7 +22,7 @@ namespace BizHawk.Client.Common public LuaTable CreateTable() => _lua.NewTable(); - public LuaTable DictToTable(IDictionary dictionary) + public LuaTable DictToTable(IReadOnlyDictionary dictionary) { var table = _lua.NewTable(); diff --git a/src/BizHawk.Emulation.Common/Extensions.cs b/src/BizHawk.Emulation.Common/Extensions.cs index 1ba5ea40c9..59c35dab08 100644 --- a/src/BizHawk.Emulation.Common/Extensions.cs +++ b/src/BizHawk.Emulation.Common/Extensions.cs @@ -390,7 +390,7 @@ namespace BizHawk.Emulation.Common return buttons; } - public static IDictionary ToDictionary(this IController controller, int? controllerNum = null) + public static IReadOnlyDictionary ToDictionary(this IController controller, int? controllerNum = null) { var buttons = new Dictionary();