Fixed default keys and also fixed a major syncsettings snafu

This commit is contained in:
Asnivor 2018-03-06 16:40:25 +00:00
parent aa1cfde69b
commit 35bb1d0c93
8 changed files with 22 additions and 17 deletions

View File

@ -530,7 +530,9 @@
"Record Tape": "",
"Key Quote": "Shift+D2",
"Insert Next Tape": "F6",
"Insert Previous Tape": "F5"
"Insert Previous Tape": "F5",
"Next Tape Block": "F8",
"Prev Tape Block": "F7"
},
"Intellivision Controller": {
"P1 Up": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp",

View File

@ -1381,7 +1381,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Keyboard.cs" />
<Compile Include="Computers\SinclairSpectrum\Hardware\Input\StandardKeyboard.cs" />
<Compile Include="Computers\SinclairSpectrum\Machine\ZXSpectrum48K\ZX48.Port.cs" />
<None Include="Computers\SinclairSpectrum\readme.md" />
<Compile Include="Computers\SinclairSpectrum\Machine\SpectrumBase.Media.cs" />

View File

@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
/// <summary>
/// The 48k keyboard device
/// </summary>
public class Keyboard48 : IKeyboard
public class StandardKeyboard : IKeyboard
{
public SpectrumBase _machine { get; set; }
private byte[] LineStatus;
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
set { _nonMatrixKeys = value; }
}
public Keyboard48(SpectrumBase machine)
public StandardKeyboard(SpectrumBase machine)
{
_machine = machine;
@ -68,13 +68,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
};
var nonMatrix = new List<string>();
/*
foreach (var key in ZXSpectrum.ZXSpectrumControllerDefinition.BoolButtons)
foreach (var key in _machine.Spectrum.ZXSpectrumControllerDefinition.BoolButtons)
{
if (!KeyboardMatrix.Any(s => s == key))
nonMatrix.Add(key);
}
*/
NonMatrixKeys = nonMatrix.ToArray();
LineStatus = new byte[8];

View File

@ -40,7 +40,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// non matrix keys
/*
foreach (string k in KeyboardDevice.NonMatrixKeys)
{
if (!k.StartsWith("Key"))
@ -50,7 +49,6 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
KeyboardDevice.SetKeyStatus(k, currState);
}
*/
// J1
foreach (string j in JoystickCollection[0].ButtonCollection)

View File

@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
AYDevice = new AY38912();
AYDevice.Init(44100, ULADevice.FrameLength);
KeyboardDevice = new Keyboard48(this);
KeyboardDevice = new StandardKeyboard(this);
InitJoysticks(joysticks);
//KempstonDevice = new KempstonJoystick(this);

View File

@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
AYDevice = new AY38912();
AYDevice.Init(44100, ULADevice.FrameLength);
KeyboardDevice = new Keyboard48(this);
KeyboardDevice = new StandardKeyboard(this);
InitJoysticks(joysticks);
//KempstonDevice = new KempstonJoystick(this);

View File

@ -28,7 +28,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
BuzzerDevice = new Buzzer(this);
BuzzerDevice.Init(44100, ULADevice.FrameLength);
KeyboardDevice = new Keyboard48(this);
KeyboardDevice = new StandardKeyboard(this);
InitJoysticks(joysticks);

View File

@ -20,10 +20,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
[CoreConstructor("ZXSpectrum")]
public ZXSpectrum(CoreComm comm, IEnumerable<byte[]> files, List<GameInfo> game, object settings, object syncSettings)
{
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
{
var ser = new BasicServiceProvider(this);
ServiceProvider = ser;
InputCallbacks = new InputCallbackSystem();
@ -39,7 +36,15 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
//_file = file;
_files = files?.ToList() ?? new List<byte[]>();
List<JoystickType> joysticks = new List<JoystickType>();
if (settings == null)
settings = new ZXSpectrumSettings();
if (syncSettings == null)
syncSettings = new ZXSpectrumSyncSettings();
PutSyncSettings((ZXSpectrumSyncSettings)syncSettings ?? new ZXSpectrumSyncSettings());
PutSettings((ZXSpectrumSettings)settings ?? new ZXSpectrumSettings());
List <JoystickType> joysticks = new List<JoystickType>();
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings as ZXSpectrumSyncSettings).JoystickType1);
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings as ZXSpectrumSyncSettings).JoystickType2);
joysticks.Add(((ZXSpectrumSyncSettings)syncSettings as ZXSpectrumSyncSettings).JoystickType3);