MSXHawk: controller selection

This commit is contained in:
alyosha-tas 2020-01-30 20:18:24 -05:00
parent 1fdb7a6fe2
commit 8cb19ede1c
4 changed files with 41 additions and 4 deletions

View File

@ -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++;

View File

@ -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;

View File

@ -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"
}
};
}
}

View File

@ -89,6 +89,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
var serviceProvider = ServiceProvider as BasicServiceProvider;
serviceProvider.Register<ITraceable>(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;