rough in for gamepad or none virtualpad support for Turbo and Hyper Nyma cores, only 2 button currently supported, support some uppercase button names in mnemonics
This commit is contained in:
parent
a28f2b2a45
commit
e41659e237
|
@ -427,6 +427,7 @@
|
|||
<s:Boolean x:Key="/Default/UserDictionary/Words/=nsamp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Numerics/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=nvidia/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Nyma/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Objs/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Octect/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Octoshock/@EntryIndexedValue">True</s:Boolean>
|
||||
|
|
|
@ -92,8 +92,11 @@ namespace BizHawk.Client.Common
|
|||
["Z"] = 'Z',
|
||||
|
||||
["Select"] = 's',
|
||||
["SELECT"] = 's',
|
||||
["Start"] = 'S',
|
||||
["START"] = 'S',
|
||||
["Run"] = 'R',
|
||||
["RUN"] = 'R',
|
||||
|
||||
["Left Shoulder"] = 'l',
|
||||
["Right Shoulder"] = 'r',
|
||||
|
|
|
@ -59,6 +59,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static ButtonSchema Right(int x, int y, int controller)
|
||||
=> new ButtonSchema(x, y, controller, "Right") { Icon = Resources.Forward };
|
||||
|
||||
// Nyma has its own conventions
|
||||
public static ButtonSchema NymaUp(int x, int y, int controller)
|
||||
=> new ButtonSchema(x, y, controller, "UP ↑") { Icon = Resources.BlueUp };
|
||||
|
||||
public static ButtonSchema NymaDown(int x, int y, int controller)
|
||||
=> new ButtonSchema(x, y, controller, "DOWN ↓") { Icon = Resources.BlueDown };
|
||||
|
||||
public static ButtonSchema NymaLeft(int x, int y, int controller)
|
||||
=> new ButtonSchema(x, y, controller, "LEFT ←") { Icon = Resources.Back };
|
||||
|
||||
public static ButtonSchema NymaRight(int x, int y, int controller)
|
||||
=> new ButtonSchema(x, y, controller, "RIGHT →") { Icon = Resources.Forward };
|
||||
}
|
||||
|
||||
/// <summary>A single analog control (e.g. pressure sensitive button)</summary>
|
||||
|
|
|
@ -4,7 +4,9 @@ using System.Linq;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores.Consoles.NEC.PCE;
|
||||
using BizHawk.Emulation.Cores.PCEngine;
|
||||
using BizHawk.Emulation.Cores.Waterbox;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -17,29 +19,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
||||
{
|
||||
if (!(core is PCEngine))
|
||||
return core switch
|
||||
{
|
||||
return Enumerable.Empty<PadSchema>();
|
||||
}
|
||||
PCEngine pce => PceHawkSchemas(pce),
|
||||
NymaCore hyper => NymaSchemas(hyper),
|
||||
_ => Enumerable.Empty<PadSchema>()
|
||||
};
|
||||
}
|
||||
|
||||
var ss = ((PCEngine)core).GetSyncSettings();
|
||||
private static IEnumerable<PadSchema> PceHawkSchemas(PCEngine core)
|
||||
{
|
||||
var ss = core.GetSyncSettings();
|
||||
|
||||
var padSchemas = new[]
|
||||
{
|
||||
ss.Port1,
|
||||
ss.Port2,
|
||||
ss.Port3,
|
||||
ss.Port4,
|
||||
ss.Port5
|
||||
}
|
||||
.Where(p => p != PceControllerType.Unplugged)
|
||||
.Select((p, i) => GenerateSchemaForPort(p, i + 1))
|
||||
.Where(s => s != null);
|
||||
{
|
||||
ss.Port1,
|
||||
ss.Port2,
|
||||
ss.Port3,
|
||||
ss.Port4,
|
||||
ss.Port5
|
||||
}
|
||||
.Where(p => p != PceControllerType.Unplugged)
|
||||
.Select((p, i) => PceHawkGenerateSchemaForPort(p, i + 1))
|
||||
.Where(s => s != null);
|
||||
|
||||
return padSchemas;
|
||||
}
|
||||
|
||||
private static PadSchema GenerateSchemaForPort(PceControllerType type, int controller)
|
||||
private static PadSchema PceHawkGenerateSchemaForPort(PceControllerType type, int controller)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -49,11 +56,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
case PceControllerType.Unplugged:
|
||||
return null;
|
||||
case PceControllerType.GamePad:
|
||||
return StandardController(controller);
|
||||
return StandardHawkController(controller);
|
||||
}
|
||||
}
|
||||
|
||||
private static PadSchema StandardController(int controller)
|
||||
private static PadSchema StandardHawkController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
|
@ -83,5 +90,41 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static IEnumerable<PadSchema> NymaSchemas(NymaCore nyma)
|
||||
{
|
||||
foreach (NymaCore.PortResult result in nyma.ActualPortData)
|
||||
{
|
||||
var num = int.Parse(result.Port.ShortName.Last().ToString());
|
||||
var device = result.Device.ShortName;
|
||||
if (device == "gamepad")
|
||||
{
|
||||
yield return StandardController(num);
|
||||
}
|
||||
else if (device != "none")
|
||||
{
|
||||
MessageBox.Show($"Controller type {device} not supported yet.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static PadSchema StandardController(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
Size = new Size(174, 90),
|
||||
Buttons = new[]
|
||||
{
|
||||
ButtonSchema.NymaUp(14, 12, controller),
|
||||
ButtonSchema.NymaDown(14, 56, controller),
|
||||
ButtonSchema.NymaLeft(2, 34, controller),
|
||||
ButtonSchema.NymaRight(24, 34, controller),
|
||||
new ButtonSchema(122, 34, controller, "I"),
|
||||
new ButtonSchema(146, 34, controller, "II"),
|
||||
new ButtonSchema(52, 34, controller, "SELECT") { DisplayName = "s" },
|
||||
new ButtonSchema(74, 34, controller, "RUN") { DisplayName = "R" }
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue