diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs index 25f3e04d7e..d34e9c11d4 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs @@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX { get { - return MSXController; + return current_controller; } } @@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX if (_controller.IsPressed("P2 B1")) ctrl2_byte -= 0x10; if (_controller.IsPressed("P2 B2")) ctrl2_byte -= 0x20; - kb_rows_check(controller); + if (current_controller == MSXControllerKB) { kb_rows_check(controller); } _frame++; diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.ISettable.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.ISettable.cs index 11b96c56f8..9c04eca93e 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.ISettable.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.ISettable.cs @@ -55,6 +55,11 @@ namespace BizHawk.Emulation.Cores.Computers.MSX return (MSXSettings)MemberwiseClone(); } + public MSXSettings() + { + SettingsUtil.SetDefaultValues(this); + } + public static bool RebootNeeded(MSXSettings x, MSXSettings y) { return false; @@ -63,11 +68,28 @@ namespace BizHawk.Emulation.Cores.Computers.MSX public class MSXSyncSettings { + public enum ContrType + { + Joystick, + Keyboard + } + + [DisplayName("Controller Configuration")] + [Description("Pick Between Controller Types")] + [DefaultValue(ContrType.Joystick)] + public ContrType Contr_Setting { get; set; } + + public MSXSyncSettings Clone() { return (MSXSyncSettings)MemberwiseClone(); } + public MSXSyncSettings() + { + SettingsUtil.SetDefaultValues(this); + } + public static bool RebootNeeded(MSXSyncSettings x, MSXSyncSettings y) { return false; diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.Input.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.Input.cs index 1dfa9a7e00..3d02b95164 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.Input.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.Input.cs @@ -7,9 +7,9 @@ namespace BizHawk.Emulation.Cores.Computers.MSX public partial class MSX { - public static readonly ControllerDefinition MSXController = new ControllerDefinition + public static readonly ControllerDefinition MSXControllerKB = new ControllerDefinition { - Name = "MSX Controller", + Name = "MSX Controller Keyboard", BoolButtons = { "Reset", @@ -26,5 +26,16 @@ namespace BizHawk.Emulation.Cores.Computers.MSX "RIGHT", "DOWN", "UP", "LEFT", "DEL", "INS", "HOME", "SPACE" } }; + + public static readonly ControllerDefinition MSXControllerJS = new ControllerDefinition + { + Name = "MSX Controller Joystick", + BoolButtons = + { + "Reset", + "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 B1", "P1 B2", + "P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 B1", "P2 B2" + } + }; } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs index 1a92bbe7b5..cc77d64098 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs @@ -89,6 +89,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX var serviceProvider = ServiceProvider as BasicServiceProvider; serviceProvider.Register(Tracer); + + current_controller = SyncSettings.Contr_Setting == MSXSyncSettings.ContrType.Keyboard ? MSXControllerKB : MSXControllerJS; } public void HardReset() @@ -110,6 +112,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX // Machine resources private IController _controller = NullController.Instance; + private ControllerDefinition current_controller = null; + private int _frame = 0; public DisplayType Region => DisplayType.NTSC;