Added default control bindings and prettified the controller configuration panels

This commit is contained in:
Asnivor 2018-03-06 11:17:30 +00:00
parent b409c88c50
commit 3cc4b94406
8 changed files with 178 additions and 9 deletions

View File

@ -461,6 +461,76 @@
"Key Cursor Up/Down": "DownArrow",
"Key Cursor Left/Right": "RightArrow",
"Key Space": "Space"
},
"ZXSpectrum Controller": {
"P1 Up": "NumberPad8, J1 POV1U, X1 DpadUp, X1 LStickUp",
"P1 Down": "NumberPad2, J1 POV1D, X1 DpadDown, X1 LStickDown",
"P1 Left": "NumberPad4, J1 POV1L, X1 DpadLeft, X1 LStickLeft",
"P1 Right": "NumberPad6, J1 POV1R, X1 DpadRight, X1 LStickRight",
"P1 Button": "NumberPad1, J1 B1, X1 X",
"Key True Video": "",
"Key Inv Video": "",
"Key 1": "D1",
"Key 2": "D2",
"Key 3": "D3",
"Key 4": "D4",
"Key 5": "D5",
"Key 6": "D6",
"Key 7": "D7",
"Key 8": "D8",
"Key 9": "D9",
"Key 0": "D0",
"Key Break": "Delete",
"Key Delete": "Backspace",
"Key Graph": "",
"Key Q": "Q",
"Key W": "W",
"Key E": "E",
"Key R": "R",
"Key T": "T",
"Key Y": "Y",
"Key U": "U",
"Key I": "I",
"Key O": "O",
"Key P": "P",
"Key Extend Mode": "",
"Key Edit": "",
"Key A": "A",
"Key S": "S",
"Key D": "D",
"Key F": "F",
"Key G": "G",
"Key H": "H",
"Key J": "J",
"Key K": "K",
"Key L": "L",
"Key Return": "Return",
"Key Caps Shift": "LeftShift, RightShift",
"Key Caps Lock": "",
"Key Z": "Z",
"Key X": "X",
"Key C": "C",
"Key V": "V",
"Key B": "B",
"Key N": "N",
"Key M": "M",
"Key Period": "Period",
"Key Symbol Shift": "LeftControl, RightControl",
"Key Semi-Colon": "Semicolon",
"Key Inverted-Comma": "",
"Key Left Cursor": "LeftArrow",
"Key Right Cursor": "RightArrow",
"Key Space": "Space",
"Key Up Cursor": "UpArrow",
"Key Down Cursor": "DownArrow",
"Key Comma": "Comma",
"Play Tape": "F1",
"Stop Tape": "F2",
"RTZ Tape": "F3",
"Record Tape": "",
"Key Quote": "Shift+D2",
"Insert Next Tape": "F6",
"Insert Previous Tape": "F5"
},
"Intellivision Controller": {
"P1 Up": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp",

View File

@ -1786,6 +1786,7 @@
<None Include="config\ControllerImages\GENController.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\ZXSpectrumKeyboard.bmp" />
<None Include="images\WSW.png" />
<None Include="images\WNW.png" />
<None Include="images\SW.png" />
@ -2110,6 +2111,7 @@
<None Include="images\ENE.png" />
<None Include="images\ESE.png" />
<None Include="images\ControllerImages\NGPController.png" />
<Content Include="config\ControllerImages\ZXSpectrumKeyboards.png" />
<Content Include="images\logo.ico" />
<None Include="images\Paste.png" />
<None Include="images\reboot.png" />

View File

@ -489,7 +489,7 @@ namespace BizHawk.Client.EmuHawk.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -3438,5 +3438,15 @@ namespace BizHawk.Client.EmuHawk.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap ZXSpectrumKeyboards {
get {
object obj = ResourceManager.GetObject("ZXSpectrumKeyboards", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -1557,4 +1557,7 @@
<data name="NGPController" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\ControllerImages\NGPController.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
<data name="ZXSpectrumKeyboards" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\config\controllerimages\zxspectrumkeyboards.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -172,15 +172,24 @@ namespace BizHawk.Client.EmuHawk
string tabname = cat.Key;
tt.TabPages.Add(tabname);
tt.TabPages[pageidx].Controls.Add(createpanel(settings, cat.Value, tt.Size));
}
// zxhawk hack - it uses multiple categoryLabels
if (Global.Emulator.SystemId == "ZXSpectrum")
pageidx++;
}
if (buckets[0].Count > 0)
{
string tabname = (Global.Emulator.SystemId == "C64" || Global.Emulator.SystemId == "ZXSpectrum") ? "Keyboard" : "Console"; // hack
tt.TabPages.Add(tabname);
tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[0], tt.Size));
}
}
// ZXHawk needs to skip this bit
if (Global.Emulator.SystemId == "ZXSpectrum")
return;
string tabname = (Global.Emulator.SystemId == "C64") ? "Keyboard" : "Console"; // hack
tt.TabPages.Add(tabname);
tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[0], tt.Size));
}
}
}
public ControllerConfig(ControllerDefinition def)
@ -256,6 +265,13 @@ namespace BizHawk.Client.EmuHawk
pictureBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
}
if (controlName == "ZXSpectrum Controller")
{
pictureBox1.Image = Properties.Resources.ZXSpectrumKeyboards;
pictureBox1.Size = Properties.Resources.ZXSpectrumKeyboards.Size;
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
}
}
// lazy methods, but they're not called often and actually

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 KiB

View File

@ -1,11 +1,77 @@

using BizHawk.Emulation.Common;
using System.Collections.Generic;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
public partial class ZXSpectrum
{
/// <summary>
/// The one ZX Hawk ControllerDefinition
/// </summary>
public static ControllerDefinition ZXSpectrumControllerDefinition
{
get
{
ControllerDefinition definition = new ControllerDefinition();
definition.Name = "ZXSpectrum Controller";
// joysticks
List<string> joys = new List<string>
{
// Kempston Joystick (P1)
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
};
foreach (var s in joys)
{
definition.BoolButtons.Add(s);
definition.CategoryLabels[s] = "Kempton Joystick";
}
// keyboard
List<string> keys = new List<string>
{
/// Controller mapping includes all keyboard keys from the following models:
/// https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/ZXSpectrum48k.jpg/1200px-ZXSpectrum48k.jpg
/// https://upload.wikimedia.org/wikipedia/commons/c/ca/ZX_Spectrum%2B.jpg
// Keyboard - row 1
"Key True Video", "Key Inv Video", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Break",
// Keyboard - row 2
"Key Delete", "Key Graph", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P",
// Keyboard - row 3
"Key Extend Mode", "Key Edit", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return",
// Keyboard - row 4
"Key Caps Shift", "Key Caps Lock", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Period",
// Keyboard - row 5
"Key Symbol Shift", "Key Semi-Colon", "Key Quote", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma",
};
foreach (var s in keys)
{
definition.BoolButtons.Add(s);
definition.CategoryLabels[s] = "Keyboard";
}
// Datacorder (tape device)
List<string> tape = new List<string>
{
// Tape functions
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape", "Insert Next Tape", "Insert Previous Tape", "Next Tape Block", "Prev Tape Block"
};
foreach (var s in tape)
{
definition.BoolButtons.Add(s);
definition.CategoryLabels[s] = "Datacorder";
}
return definition;
}
}
/*
/// <summary>
/// Controller mapping includes all keyboard keys from the following models:
/// https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/ZXSpectrum48k.jpg/1200px-ZXSpectrum48k.jpg
@ -29,8 +95,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// Keyboard - row 5
"Key Symbol Shift", "Key Semi-Colon", "Key Quote", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma",
// Tape functions
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape", "Insert Next Tape", "Insert Previous Tape"
"Play Tape", "Stop Tape", "RTZ Tape", "Record Tape", "Insert Next Tape", "Insert Previous Tape", "Next Tape Block", "Prev Tape Block"
}
};
*/
}
}