Require `ControllerDefinition.Name` to be set (via ctor)
src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLinkControllers.cs src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink3x/GBHawkLink3xControllers.cs src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink4x/GBHawkLink4xControllers.cs
This commit is contained in:
parent
7881067133
commit
15a03a26e8
|
@ -11,6 +11,13 @@ namespace BizHawk.Client.Common
|
|||
[ImporterFor("DeSmuME", ".dsm")]
|
||||
internal class DsmImport : MovieImporter
|
||||
{
|
||||
private static readonly ControllerDefinition DeSmuMEControllerDef = new ControllerDefinition("NDS Controller")
|
||||
{
|
||||
BoolButtons = { "Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power" },
|
||||
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96) //TODO verify direction against hardware
|
||||
.AddAxis("Mic Input", 0.RangeTo(2047), 0)
|
||||
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0);
|
||||
|
||||
protected override void RunImport()
|
||||
{
|
||||
Result.Movie.HeaderEntries[HeaderKeys.Platform] = VSystemID.Raw.NDS;
|
||||
|
@ -84,16 +91,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private void ImportInputFrame(string line)
|
||||
{
|
||||
SimpleController controller = new(
|
||||
new ControllerDefinition
|
||||
{
|
||||
BoolButtons =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
|
||||
}
|
||||
}.AddXYPair("Touch {0}", AxisPairOrientation.RightAndUp, 0.RangeTo(255), 128, 0.RangeTo(191), 96) //TODO verify direction against hardware
|
||||
.AddAxis("Mic Input", 0.RangeTo(2047), 0)
|
||||
.AddAxis("GBA Light Sensor", 0.RangeTo(10), 0));
|
||||
SimpleController controller = new(DeSmuMEControllerDef);
|
||||
|
||||
controller["LidOpen"] = false;
|
||||
controller["LidClose"] = false;
|
||||
|
|
|
@ -296,7 +296,7 @@ namespace BizHawk.Client.Common.movie.import
|
|||
}
|
||||
|
||||
private static SimpleController GbController()
|
||||
=> new(new ControllerDefinition
|
||||
=> new(new ControllerDefinition("Gameboy Controller")
|
||||
{
|
||||
BoolButtons = { "Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Power" }
|
||||
});
|
||||
|
|
|
@ -100,9 +100,8 @@ namespace BizHawk.Client.Common.movie.import
|
|||
private void ImportTextFrame(string line)
|
||||
{
|
||||
// Yabause only supported 1 controller
|
||||
SimpleController controllers = new(new ControllerDefinition
|
||||
SimpleController controllers = new(new ControllerDefinition("Saturn Controller")
|
||||
{
|
||||
Name = "Saturn Controller",
|
||||
BoolButtons = new List<string>
|
||||
{
|
||||
"Reset", "Power", "Previous Disk", "Next Disk", "P1 Left", "P1 Right", "P1 Up", "P1 Down", "P1 Start", "P1 A", "P1 B", "P1 C", "P1 X", "P1 Y", "P1 Z", "P1 L", "P1 R"
|
||||
|
|
|
@ -10,11 +10,9 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public BkmControllerAdapter(ControllerDefinition definition, string systemId)
|
||||
{
|
||||
Definition = definition;
|
||||
|
||||
// We do need to map the definition name to the legacy
|
||||
// controller names that were used back in the bkm days
|
||||
Definition.Name = systemId switch
|
||||
var name = systemId switch
|
||||
{
|
||||
"Lynx" => "Lynx Controller",
|
||||
"SNES" => "SNES Controller",
|
||||
|
@ -34,6 +32,7 @@ namespace BizHawk.Client.Common
|
|||
"SMS Controller" => "SMS",
|
||||
_ => "Null Controller",
|
||||
};
|
||||
Definition = new(copyFrom: definition, withName: name);
|
||||
}
|
||||
|
||||
public ControllerDefinition Definition { get; set; }
|
||||
|
|
|
@ -2101,12 +2101,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void InitControls()
|
||||
{
|
||||
var controls = new Controller(
|
||||
new ControllerDefinition
|
||||
{
|
||||
Name = "Emulator Frontend Controls",
|
||||
BoolButtons = Config.HotkeyBindings.Select(x => x.DisplayName).ToList()
|
||||
});
|
||||
Controller controls = new(new ControllerDefinition("Emulator Frontend Controls")
|
||||
{
|
||||
BoolButtons = Config.HotkeyBindings.Select(static x => x.DisplayName).ToList(),
|
||||
});
|
||||
|
||||
foreach (var b in Config.HotkeyBindings)
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void InitController(string key)
|
||||
{
|
||||
string[] keys = key.Split('|');
|
||||
var d = new ControllerDefinition();
|
||||
ControllerDefinition d = new(_emulator.ControllerDefinition.Name);
|
||||
foreach (var k in keys)
|
||||
{
|
||||
if (_emulator.ControllerDefinition.BoolButtons.Contains(k))
|
||||
|
@ -105,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// Get a IController that only contains buttons in key.
|
||||
string[] keys = _inputKey.Split('|');
|
||||
var d = new ControllerDefinition();
|
||||
ControllerDefinition d = new(_emulator.ControllerDefinition.Name);
|
||||
foreach (var key in keys)
|
||||
{
|
||||
if (_emulator.ControllerDefinition.BoolButtons.Contains(key))
|
||||
|
|
|
@ -14,23 +14,20 @@ namespace BizHawk.Emulation.Common
|
|||
/// <seealso cref="IEmulator" />
|
||||
public class ControllerDefinition
|
||||
{
|
||||
public ControllerDefinition() {}
|
||||
public readonly string Name;
|
||||
|
||||
public ControllerDefinition(ControllerDefinition source)
|
||||
: this()
|
||||
public ControllerDefinition(string name)
|
||||
=> Name = name;
|
||||
|
||||
public ControllerDefinition(ControllerDefinition copyFrom, string withName = null)
|
||||
: this(withName ?? copyFrom.Name)
|
||||
{
|
||||
Name = source.Name;
|
||||
BoolButtons.AddRange(source.BoolButtons);
|
||||
foreach (var kvp in source.Axes) Axes.Add(kvp);
|
||||
HapticsChannels.AddRange(source.HapticsChannels);
|
||||
CategoryLabels = source.CategoryLabels;
|
||||
BoolButtons.AddRange(copyFrom.BoolButtons);
|
||||
foreach (var kvp in copyFrom.Axes) Axes.Add(kvp);
|
||||
HapticsChannels.AddRange(copyFrom.HapticsChannels);
|
||||
CategoryLabels = copyFrom.CategoryLabels;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the controller definition
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of all button types that have a boolean (on/off) value
|
||||
/// </summary>
|
||||
|
|
|
@ -12,10 +12,7 @@ namespace BizHawk.Emulation.Common
|
|||
/// <seealso cref="IController" />
|
||||
public class NullController : IController
|
||||
{
|
||||
public ControllerDefinition Definition => new ControllerDefinition
|
||||
{
|
||||
Name = "Null Controller"
|
||||
};
|
||||
public ControllerDefinition Definition { get; } = new ControllerDefinition("Null Controller");
|
||||
|
||||
public bool IsPressed(string button) => false;
|
||||
|
||||
|
|
|
@ -27,9 +27,12 @@ namespace BizHawk.Emulation.Common
|
|||
/// <summary>
|
||||
/// merge some controller definitions for different ports, and such. i promise to fully document this tomorrow
|
||||
/// </summary>
|
||||
public static ControllerDefinition GetMerged(IEnumerable<ControllerDefinition> controllers, out List<ControlDefUnMerger> unmergers)
|
||||
public static ControllerDefinition GetMerged(
|
||||
string mergedName,
|
||||
IEnumerable<ControllerDefinition> controllers,
|
||||
out List<ControlDefUnMerger> unmergers)
|
||||
{
|
||||
ControllerDefinition ret = new ControllerDefinition();
|
||||
ControllerDefinition ret = new(mergedName);
|
||||
unmergers = new List<ControlDefUnMerger>();
|
||||
int plr = 1;
|
||||
int playerNext = 1;
|
||||
|
|
|
@ -13,11 +13,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
[FeatureNotImplemented]
|
||||
public IInputCallbackSystem InputCallbacks => throw new NotImplementedException();
|
||||
|
||||
public static ControllerDefinition MAMEController = new ControllerDefinition
|
||||
{
|
||||
Name = "MAME Controller",
|
||||
BoolButtons = new List<string>()
|
||||
};
|
||||
public static ControllerDefinition MAMEController = new("MAME Controller");
|
||||
|
||||
private IController _controller = NullController.Instance;
|
||||
private readonly SortedDictionary<string, string> _fieldsPorts = new SortedDictionary<string, string>();
|
||||
|
|
|
@ -77,22 +77,20 @@ namespace BizHawk.Emulation.Cores.Calculators
|
|||
|
||||
internal int LinkState => (_linkOutput | LinkInput) ^ 3;
|
||||
|
||||
private static readonly ControllerDefinition TI83Controller =
|
||||
new ControllerDefinition
|
||||
private static readonly ControllerDefinition TI83Controller = new ControllerDefinition("TI83 Controller")
|
||||
{
|
||||
BoolButtons =
|
||||
{
|
||||
Name = "TI83 Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "DOT",
|
||||
"ON", "ENTER",
|
||||
"DOWN", "LEFT", "UP", "RIGHT",
|
||||
"PLUS", "MINUS", "MULTIPLY", "DIVIDE",
|
||||
"CLEAR", "EXP", "DASH", "PARACLOSE", "TAN", "VARS", "PARAOPEN",
|
||||
"COS", "PRGM", "STAT", "COMMA", "SIN", "MATRIX", "X",
|
||||
"STO", "LN", "LOG", "SQUARED", "NEG1", "MATH", "ALPHA",
|
||||
"GRAPH", "TRACE", "ZOOM", "WINDOW", "Y", "2ND", "MODE", "DEL"
|
||||
}
|
||||
};
|
||||
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "DOT",
|
||||
"ON", "ENTER",
|
||||
"DOWN", "LEFT", "UP", "RIGHT",
|
||||
"PLUS", "MINUS", "MULTIPLY", "DIVIDE",
|
||||
"CLEAR", "EXP", "DASH", "PARACLOSE", "TAN", "VARS", "PARAOPEN",
|
||||
"COS", "PRGM", "STAT", "COMMA", "SIN", "MATRIX", "X",
|
||||
"STO", "LN", "LOG", "SQUARED", "NEG1", "MATH", "ALPHA",
|
||||
"GRAPH", "TRACE", "ZOOM", "WINDOW", "Y", "2ND", "MODE", "DEL",
|
||||
},
|
||||
};
|
||||
|
||||
private byte ReadMemory(ushort addr)
|
||||
{
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
{
|
||||
get
|
||||
{
|
||||
var definition = new ControllerDefinition
|
||||
{
|
||||
Name = "AmstradCPC Controller"
|
||||
};
|
||||
ControllerDefinition definition = new("AmstradCPC Controller");
|
||||
|
||||
// joysticks
|
||||
var joys1 = new List<string>
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|||
{
|
||||
static AppleII()
|
||||
{
|
||||
AppleIIController = new ControllerDefinition { Name = "Apple IIe Keyboard" };
|
||||
AppleIIController = new("Apple IIe Keyboard");
|
||||
AppleIIController.BoolButtons.AddRange(RealButtons);
|
||||
AppleIIController.BoolButtons.AddRange(ExtraButtons);
|
||||
}
|
||||
|
|
|
@ -135,9 +135,8 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
|
||||
private readonly List<byte[]> _roms;
|
||||
|
||||
private static readonly ControllerDefinition C64ControllerDefinition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition C64ControllerDefinition = new ControllerDefinition("Commodore 64 Controller")
|
||||
{
|
||||
Name = "Commodore 64 Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button",
|
||||
|
|
|
@ -5,9 +5,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
public partial class MSX
|
||||
{
|
||||
|
||||
public static readonly ControllerDefinition MSXControllerKB = new ControllerDefinition
|
||||
public static readonly ControllerDefinition MSXControllerKB = new ControllerDefinition("MSX Controller Keyboard")
|
||||
{
|
||||
Name = "MSX Controller Keyboard",
|
||||
BoolButtons =
|
||||
{
|
||||
"Reset",
|
||||
|
@ -25,9 +24,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
|
|||
}
|
||||
};
|
||||
|
||||
public static readonly ControllerDefinition MSXControllerJS = new ControllerDefinition
|
||||
public static readonly ControllerDefinition MSXControllerJS = new ControllerDefinition("MSX Controller Joystick")
|
||||
{
|
||||
Name = "MSX Controller Joystick",
|
||||
BoolButtons =
|
||||
{
|
||||
"Reset",
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
{
|
||||
get
|
||||
{
|
||||
var definition = new ControllerDefinition
|
||||
{
|
||||
Name = "ZXSpectrum Controller"
|
||||
};
|
||||
ControllerDefinition definition = new("ZXSpectrum Controller");
|
||||
|
||||
// joysticks
|
||||
var joys1 = new List<string>
|
||||
|
|
|
@ -15,9 +15,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
Port1 = ControllerCtors[controller1](1);
|
||||
Port2 = ControllerCtors[controller2](2);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Atari 2600 Basic Controller")
|
||||
{
|
||||
Name = "Atari 2600 Basic Controller",
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
|
@ -38,10 +37,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public UnpluggedController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
BoolButtons = new List<string>()
|
||||
};
|
||||
Definition = new("(Atari 2600 Basic Controller fragment)");
|
||||
}
|
||||
|
||||
public byte Read(IController c)
|
||||
|
@ -69,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public StandardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(Atari 2600 Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
@ -115,7 +111,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public PaddleController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("(Atari 2600 Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
@ -167,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public BoostGripController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(Atari 2600 Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
@ -231,7 +227,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public DrivingController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("(Atari 2600 Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
@ -325,7 +321,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
public KeyboardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(Atari 2600 Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
|
|
@ -19,9 +19,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -34,9 +34,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
public UnpluggedController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Unplugged Controller")
|
||||
{
|
||||
Name = "Unplugged Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -98,9 +97,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
public StandardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Atari 7800 Basic Controller")
|
||||
{
|
||||
Name = "Atari 7800 Basic Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -182,9 +180,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
public ProLineController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Atari 7800 ProLine Joystick Controller")
|
||||
{
|
||||
Name = "Atari 7800 ProLine Joystick Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -276,9 +273,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
public LightGunController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("Light Gun Controller")
|
||||
{
|
||||
Name = "Light Gun Controller",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddXYPair($"P{PortNum} {{0}}", AxisPairOrientation.RightAndUp, 1.RangeTo(320), 160, 1.RangeTo(242), 121); //TODO verify direction against hardware
|
||||
}
|
||||
|
|
|
@ -161,9 +161,8 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
|||
}
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition LynxTroller = new ControllerDefinition
|
||||
private static readonly ControllerDefinition LynxTroller = new ControllerDefinition("Lynx Controller")
|
||||
{
|
||||
Name = "Lynx Controller",
|
||||
BoolButtons = { "Up", "Down", "Left", "Right", "A", "B", "Option 1", "Option 2", "Pause", "Power" },
|
||||
};
|
||||
|
||||
|
|
|
@ -47,9 +47,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Belogic
|
|||
PostInit();
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition TwoPads = new ControllerDefinition
|
||||
private static readonly ControllerDefinition TwoPads = new ControllerDefinition("SNES Controller")
|
||||
{
|
||||
Name = "SNES Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Select", "P1 Start", "P1 X", "P1 A", "P1 B", "P1 Y", "P1 L", "P1 R",
|
||||
|
@ -58,9 +57,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Belogic
|
|||
}
|
||||
};
|
||||
|
||||
private static readonly ControllerDefinition Mouse = new ControllerDefinition
|
||||
private static readonly ControllerDefinition Mouse = new ControllerDefinition("SNES Controller")
|
||||
{
|
||||
Name = "SNES Controller",
|
||||
BoolButtons = { "P1 Mouse Left", "P1 Mouse Right", "Power" }
|
||||
}.AddXYPair("P1 Mouse {0}", AxisPairOrientation.RightAndUp, (-127).RangeTo(127), 0); //TODO verify direction against hardware
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("ColecoVision Basic Controller")
|
||||
{
|
||||
Name = "ColecoVision Basic Controller",
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -30,10 +29,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public UnpluggedController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
BoolButtons = new List<string>()
|
||||
};
|
||||
Definition = new("(ColecoVision Basic Controller fragment)");
|
||||
}
|
||||
|
||||
public byte Read(IController c, bool leftMode, bool updateWheel, float wheelAngle)
|
||||
|
@ -59,7 +55,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public StandardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(ColecoVision Basic Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
|
@ -130,7 +126,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public ColecoTurboController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
Definition = new ControllerDefinition("(ColecoVision Basic Controller fragment)") { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
.AddXYPair($"P{PortNum} Disc {{0}}", AxisPairOrientation.RightAndUp, (-127).RangeTo(127), 0); //TODO verify direction against hardware
|
||||
}
|
||||
|
||||
|
@ -229,7 +225,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
public ColecoSuperActionController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
Definition = new ControllerDefinition("(ColecoVision Basic Controller fragment)") { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
.AddXYPair($"P{PortNum} Disc {{0}}", AxisPairOrientation.RightAndUp, (-127).RangeTo(127), 0); //TODO verify direction against hardware
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,7 @@ namespace BizHawk.Emulation.Cores.Consoles.ChannelF
|
|||
{
|
||||
get
|
||||
{
|
||||
ControllerDefinition definition = new ControllerDefinition
|
||||
{
|
||||
Name = "ChannelF Controller"
|
||||
};
|
||||
ControllerDefinition definition = new("ChannelF Controller");
|
||||
|
||||
string pre = "P1 ";
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -26,9 +26,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
public StandardControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Vectrex Digital Controller")
|
||||
{
|
||||
Name = "Vectrex Digital Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList(),
|
||||
|
@ -75,9 +74,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
|||
public AnalogControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("Vectrex Analog Controller")
|
||||
{
|
||||
Name = "Vectrex Analog Controller",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddXYPair($"P{PortNum} Stick {{0}}", AxisPairOrientation.RightAndUp, (-128).RangeTo(127), 0);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Intellivision Controller")
|
||||
{
|
||||
Name = "Intellivision Controller",
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -28,10 +27,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
public UnpluggedController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
BoolButtons = new List<string>()
|
||||
};
|
||||
Definition = new("(Intellivision Controller fragment)");
|
||||
}
|
||||
|
||||
public byte Read(IController c)
|
||||
|
@ -55,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
public StandardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(Intellivision Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
|
@ -139,7 +135,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
public FakeAnalogController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
Definition = new ControllerDefinition("(Intellivision Controller fragment)") { BoolButtons = BaseBoolDefinition.Select(b => $"P{PortNum} {b}").ToList() }
|
||||
.AddXYPair($"P{PortNum} Disc {{0}}", AxisPairOrientation.RightAndUp, (-127).RangeTo(127), 0); //TODO verify direction against hardware
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,8 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
if (is_G7400)
|
||||
{
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
@ -42,9 +41,8 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
}
|
||||
else
|
||||
{
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[]
|
||||
|
|
|
@ -26,9 +26,8 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
public StandardControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("O2 Joystick")
|
||||
{
|
||||
Name = "O2 Joystick",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
|
|
@ -43,13 +43,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
GetController(ss.RightPort, ss)
|
||||
};
|
||||
|
||||
Definition = ControllerDefinitionMerger.GetMerged(_ports.Select(p => p.Definition), out var tmp);
|
||||
Definition = ControllerDefinitionMerger.GetMerged(
|
||||
"SNES Controller",
|
||||
_ports.Select(p => p.Definition),
|
||||
out var tmp);
|
||||
_mergers = tmp.ToArray();
|
||||
|
||||
// add buttons that the core itself will handle
|
||||
Definition.BoolButtons.Add("Reset");
|
||||
Definition.BoolButtons.Add("Power");
|
||||
Definition.Name = "SNES Controller";
|
||||
}
|
||||
|
||||
public void CoreInputPoll(IController controller)
|
||||
|
@ -84,7 +86,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
|
||||
internal class BsnesUnpluggedController : IBsnesController
|
||||
{
|
||||
private static readonly ControllerDefinition _definition = new();
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)");
|
||||
|
||||
public ControllerDefinition Definition => _definition;
|
||||
|
||||
|
@ -118,7 +120,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
["0R"] = 11
|
||||
};
|
||||
|
||||
private static readonly ControllerDefinition _definition = new()
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Buttons.OrderBy(b => ButtonsOrder[b]).ToList()
|
||||
};
|
||||
|
@ -146,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
{
|
||||
private readonly short[] _state = new short[4];
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition("(SNES Controller fragment)")
|
||||
{ BoolButtons = { "0Mouse Left", "0Mouse Right" } }
|
||||
.AddXYPair("0Mouse {0}", AxisPairOrientation.RightAndDown, (-127).RangeTo(127), 0); //TODO verify direction against hardware, R+D inferred from behaviour in Mario Paint
|
||||
|
||||
|
@ -207,7 +209,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
["L"] = 11
|
||||
};
|
||||
|
||||
private static readonly ControllerDefinition _definition = new()
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Enumerable.Range(0, 4)
|
||||
.SelectMany(i => Buttons.OrderBy(b => ButtonsOrder[b])
|
||||
|
@ -241,7 +243,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
|
||||
private readonly int[] _buttonsOrder = {4, 5, 6, 7, 0, 8, 1, 9, 10, 11, 2, 3, 12, 13, 14, 15};
|
||||
|
||||
private static readonly ControllerDefinition _definition = new()
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Enumerable.Range(0, 32).Select(i => $"0B{i}").ToList()
|
||||
};
|
||||
|
@ -270,7 +272,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
{
|
||||
private readonly short[] _state = new short[6];
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition("(SNES Controller fragment)")
|
||||
{ BoolButtons = { "0Trigger", "0Cursor", "0Turbo", "0Pause" } }
|
||||
.AddLightGun("0Scope {0}");
|
||||
|
||||
|
@ -300,11 +302,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
|||
public BsnesJustifierController(bool chained)
|
||||
{
|
||||
Definition = chained
|
||||
? new ControllerDefinition
|
||||
? new ControllerDefinition("(SNES Controller fragment)")
|
||||
{ BoolButtons = { "0Trigger", "0Start", "1Trigger", "1Start" } }
|
||||
.AddLightGun("0Justifier {0}")
|
||||
.AddLightGun("1Justifier {0}")
|
||||
: new ControllerDefinition
|
||||
: new ControllerDefinition("(SNES Controller fragment)")
|
||||
{BoolButtons = { "0Trigger", "0Start"} }
|
||||
.AddLightGun("0Justifier {0}");
|
||||
_state = new short[chained ? 8 : 4];
|
||||
|
|
|
@ -261,9 +261,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
return baseTime + increment;
|
||||
}
|
||||
|
||||
public static readonly ControllerDefinition GBAController = new ControllerDefinition
|
||||
public static readonly ControllerDefinition GBAController = new ControllerDefinition("GBA Controller")
|
||||
{
|
||||
Name = "GBA Controller",
|
||||
BoolButtons = { "Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "L", "R", "Power" }
|
||||
}.AddXYZTriple("Tilt {0}", (-32767).RangeTo(32767), 0)
|
||||
.AddAxis("Light Sensor", 0.RangeTo(255), 0);
|
||||
|
|
|
@ -16,9 +16,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
? ctor1(1)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller1Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.ToList()
|
||||
};
|
||||
|
|
|
@ -29,9 +29,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public StandardControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("Gameboy Controller H")
|
||||
{
|
||||
Name = "Gameboy Controller H",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -102,9 +101,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public StandardTilt(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("Gameboy Controller + Tilt")
|
||||
{
|
||||
Name = "Gameboy Controller + Tilt",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddXYPair($"P{PortNum} Tilt {{0}}", AxisPairOrientation.RightAndUp, (-90).RangeTo(90), 0); //TODO verify direction against hardware
|
||||
}
|
||||
|
|
|
@ -18,9 +18,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[] { "Toggle Cable" } )
|
||||
|
|
|
@ -21,9 +21,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink3x
|
|||
? ctor3(3)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller3Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(Port3.Definition.BoolButtons)
|
||||
|
|
|
@ -24,9 +24,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink4x
|
|||
? ctor4(4)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller4Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(Port3.Definition.BoolButtons)
|
||||
|
|
|
@ -265,8 +265,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
public static ControllerDefinition CreateControllerDefinition(bool sgb, bool sub)
|
||||
{
|
||||
var ret = sub
|
||||
? new ControllerDefinition { Name = "Subframe Gameboy Controller" }.AddAxis("Input Length", 0.RangeTo(35112), 35112)
|
||||
: new ControllerDefinition { Name = "Gameboy Controller" };
|
||||
? new ControllerDefinition("Subframe Gameboy Controller").AddAxis("Input Length", 0.RangeTo(35112), 35112)
|
||||
: new ControllerDefinition("Gameboy Controller");
|
||||
if (sgb)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
|
||||
private ControllerDefinition CreateControllerDefinition()
|
||||
{
|
||||
var ret = new ControllerDefinition { Name = $"GB Link {_numCores}x Controller" };
|
||||
ControllerDefinition ret = new($"GB Link {_numCores}x Controller");
|
||||
for (int i = 0; i < _numCores; i++)
|
||||
{
|
||||
ret.BoolButtons.AddRange(
|
||||
|
|
|
@ -246,7 +246,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
|
||||
public DisplayType Region => _display_type;
|
||||
|
||||
public ControllerDefinition ControllerDefinition { get; } = new ControllerDefinition { Name = "Nintendo 64 Controller" };
|
||||
public ControllerDefinition ControllerDefinition { get; } = new("Nintendo 64 Controller");
|
||||
|
||||
public void ResetCounters()
|
||||
{
|
||||
|
|
|
@ -181,9 +181,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
|
|||
|
||||
public override ControllerDefinition ControllerDefinition => NDSController;
|
||||
|
||||
public static readonly ControllerDefinition NDSController = new ControllerDefinition
|
||||
public static readonly ControllerDefinition NDSController = new ControllerDefinition("NDS Controller")
|
||||
{
|
||||
Name = "NDS Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"Up", "Down", "Left", "Right", "Start", "Select", "B", "A", "Y", "X", "L", "R", "LidOpen", "LidClose", "Touch", "Power"
|
||||
|
|
|
@ -250,9 +250,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
[Obsolete] // with the changes to both nes and quicknes cores, nothing uses this anymore
|
||||
public static readonly ControllerDefinition NESController =
|
||||
new ControllerDefinition
|
||||
new ControllerDefinition("NES Controller")
|
||||
{
|
||||
Name = "NES Controller",
|
||||
BoolButtons = {
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Start", "P1 Select", "P1 B", "P1 A", "Reset", "Power",
|
||||
"P2 Up", "P2 Down", "P2 Left", "P2 Right", "P2 Start", "P2 Select", "P2 B", "P2 A"
|
||||
|
|
|
@ -146,9 +146,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
_left = left;
|
||||
_right = right;
|
||||
ControllerDef = ControllerDefinitionMerger.GetMerged(
|
||||
"NES Controller",
|
||||
new[] { left.ControllerDefFragment, right.ControllerDefFragment },
|
||||
out var cdum);
|
||||
ControllerDef.Name = "NES Controller";
|
||||
_leftU = cdum[0];
|
||||
_rightU = cdum[1];
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
public class UnpluggedNES : INesPort
|
||||
{
|
||||
public ControllerDefinition ControllerDefFragment { get; } = new();
|
||||
public ControllerDefinition ControllerDefFragment { get; } = new("(NES Controller fragment)");
|
||||
|
||||
public void Strobe(StrobeInfo s, IController c)
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
public ControllerNES()
|
||||
{
|
||||
ControllerDefFragment = new() { BoolButtons = Buttons.OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
ControllerDefFragment = new("(NES Controller fragment)") { BoolButtons = Buttons.OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,11 +254,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
if (famicomP2)
|
||||
{
|
||||
ControllerDefFragment = new() { BoolButtons = FamicomP2Buttons.Where(static s => s is not null).OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
ControllerDefFragment = new("(NES Controller fragment)") { BoolButtons = FamicomP2Buttons.Where(static s => s is not null).OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
}
|
||||
else
|
||||
{
|
||||
ControllerDefFragment = new() { BoolButtons = Buttons.OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
ControllerDefFragment = new("(NES Controller fragment)") { BoolButtons = Buttons.OrderBy(x => _buttonOrdinals[x]).ToList() };
|
||||
}
|
||||
|
||||
_famicomP2Hack = famicomP2;
|
||||
|
@ -313,7 +313,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
};
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new() { BoolButtons = Buttons.Where(static s => s is not null).ToList() };
|
||||
= new("(NES Controller fragment)") { BoolButtons = Buttons.Where(static s => s is not null).ToList() };
|
||||
|
||||
// reset is not edge triggered; so long as it's high, the latch is continuously reloading
|
||||
// so we need to latch in two places:
|
||||
|
@ -359,7 +359,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
private byte _latchedValue = 0x54 ^ 0xff;
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new ControllerDefinition { BoolButtons = { "0Fire" } }
|
||||
= new ControllerDefinition("(NES Controller fragment)") { BoolButtons = { "0Fire" } }
|
||||
.AddAxis("0Paddle", 0.RangeTo(160), 80);
|
||||
|
||||
public void Strobe(StrobeInfo s, IController c)
|
||||
|
@ -409,7 +409,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
};
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new() { BoolButtons = Buttons.ToList() };
|
||||
= new("(NES Controller fragment)") { BoolButtons = Buttons.ToList() };
|
||||
|
||||
private bool _resetting;
|
||||
private int _latchedValue;
|
||||
|
@ -455,7 +455,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
private static readonly string[] D4Buttons = { "0PP4", "0PP3", "0PP12", "0PP8" };
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new() { BoolButtons = D3Buttons.Concat(D4Buttons).ToList() };
|
||||
= new("(NES Controller fragment)") { BoolButtons = D3Buttons.Concat(D4Buttons).ToList() };
|
||||
|
||||
private bool _resetting;
|
||||
private int _latched3;
|
||||
|
@ -516,7 +516,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
public LightgunDelegate PPUCallback { get; set; }
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new ControllerDefinition { BoolButtons = { "0Fire" } }
|
||||
= new ControllerDefinition("(NES Controller fragment)") { BoolButtons = { "0Fire" } }
|
||||
.AddZapper("0Zapper {0}");
|
||||
|
||||
public void Strobe(StrobeInfo s, IController c)
|
||||
|
@ -561,7 +561,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
private uint _latchedValue;
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new ControllerDefinition { BoolButtons = { "0Fire" } }
|
||||
= new ControllerDefinition("(NES Controller fragment)") { BoolButtons = { "0Fire" } }
|
||||
.AddZapper("0Zapper {0}");
|
||||
|
||||
private void Latch(IController c)
|
||||
|
@ -630,10 +630,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
{
|
||||
_player3 = expSlot;
|
||||
ControllerDef = ControllerDefinitionMerger.GetMerged(
|
||||
"NES Controller",
|
||||
new[] { _player1.ControllerDefFragment, _player2.ControllerDefFragment, _player3.ControllerDefFragment },
|
||||
out var cdum);
|
||||
ControllerDef.BoolButtons.Add("P2 Microphone");
|
||||
ControllerDef.Name = "NES Controller";
|
||||
_player1U = cdum[0];
|
||||
_player2U = cdum[1];
|
||||
_player3U = cdum[2];
|
||||
|
@ -692,7 +692,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
private byte _latchedValue = 0x54 ^ 0xff;
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new ControllerDefinition { BoolButtons = { "0Fire" } }
|
||||
= new ControllerDefinition("(NES Controller fragment)") { BoolButtons = { "0Fire" } }
|
||||
.AddAxis("0Paddle", 0.RangeTo(160), 80);
|
||||
|
||||
public void Strobe(StrobeInfo s, IController c)
|
||||
|
@ -821,7 +821,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
};
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new() { BoolButtons = Buttons.ToList() };
|
||||
= new("(NES Controller fragment)") { BoolButtons = Buttons.ToList() };
|
||||
|
||||
private bool _active;
|
||||
private int _column;
|
||||
|
@ -886,7 +886,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
};
|
||||
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new() { BoolButtons = P1Buttons.Concat(P2Buttons).ToList() };
|
||||
= new("(NES Controller fragment)") { BoolButtons = P1Buttons.Concat(P2Buttons).ToList() };
|
||||
|
||||
private bool _resetting;
|
||||
private int _latchedP1;
|
||||
|
@ -936,7 +936,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
public class OekaKids : IFamicomExpansion
|
||||
{
|
||||
public ControllerDefinition ControllerDefFragment { get; }
|
||||
= new ControllerDefinition { BoolButtons = { "0Click", "0Touch" } }
|
||||
= new ControllerDefinition("(NES Controller fragment)") { BoolButtons = { "0Click", "0Touch" } }
|
||||
.AddZapper("0Pen {0}"); // why would a tablet have the same resolution as a CRT monitor? --yoshi
|
||||
|
||||
private bool _resetting;
|
||||
|
@ -999,7 +999,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
|
||||
public class UnpluggedFam : IFamicomExpansion
|
||||
{
|
||||
public ControllerDefinition ControllerDefFragment => new();
|
||||
public ControllerDefinition ControllerDefFragment => new("(NES Controller fragment)");
|
||||
|
||||
public void Strobe(StrobeInfo s, IController c)
|
||||
{
|
||||
|
|
|
@ -119,8 +119,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
|
||||
private void SetControllerDefinition()
|
||||
{
|
||||
var def = new ControllerDefinition();
|
||||
def.Name = "NES Controller";
|
||||
ControllerDefinition def = new("NES Controller");
|
||||
if (_syncSettings.LeftPortConnected || _syncSettings.RightPortConnected)
|
||||
def.BoolButtons.AddRange(PadP1.Select(p => p.Name));
|
||||
if (_syncSettings.LeftPortConnected && _syncSettings.RightPortConnected)
|
||||
|
|
|
@ -60,13 +60,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
Factory(ss.RightPort, ss)
|
||||
};
|
||||
|
||||
Definition = ControllerDefinitionMerger.GetMerged(_ports.Select(p => p.Definition), out var tmp);
|
||||
Definition = ControllerDefinitionMerger.GetMerged(
|
||||
"SNES Controller",
|
||||
_ports.Select(p => p.Definition),
|
||||
out var tmp);
|
||||
_mergers = tmp.ToArray();
|
||||
|
||||
// add buttons that the core itself will handle
|
||||
Definition.BoolButtons.Add("Reset");
|
||||
Definition.BoolButtons.Add("Power");
|
||||
Definition.Name = "SNES Controller";
|
||||
}
|
||||
|
||||
public void NativeInit(LibsnesApi api)
|
||||
|
@ -161,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
return order[btn];
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Buttons.OrderBy(ButtonOrder).ToList()
|
||||
};
|
||||
|
@ -223,7 +225,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
return order[btn];
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Enumerable.Range(0, 4)
|
||||
.SelectMany(i => Buttons
|
||||
|
@ -253,7 +255,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
{
|
||||
public LibsnesApi.SNES_INPUT_PORT PortType { get; } = LibsnesApi.SNES_INPUT_PORT.Multitap;
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Enumerable.Range(0, 32).Select(i => "0B" + i).ToList()
|
||||
};
|
||||
|
@ -270,7 +272,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
{
|
||||
public LibsnesApi.SNES_INPUT_PORT PortType { get; } = LibsnesApi.SNES_INPUT_PORT.None;
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition();
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)");
|
||||
|
||||
public ControllerDefinition Definition { get; } = _definition;
|
||||
|
||||
|
@ -285,7 +287,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
public LibsnesApi.SNES_INPUT_PORT PortType => LibsnesApi.SNES_INPUT_PORT.Mouse;
|
||||
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Mouse Left", "0Mouse Right" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Mouse Left", "0Mouse Right" } }
|
||||
.AddXYPair("0Mouse {0}", AxisPairOrientation.RightAndDown, (-127).RangeTo(127), 0); //TODO verify direction against hardware, R+D inferred from behaviour in Mario Paint
|
||||
|
||||
public ControllerDefinition Definition => _definition;
|
||||
|
@ -327,7 +329,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
public LibsnesApi.SNES_INPUT_PORT PortType => LibsnesApi.SNES_INPUT_PORT.SuperScope;
|
||||
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Trigger", "0Cursor", "0Turbo", "0Pause" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Trigger", "0Cursor", "0Turbo", "0Pause" } }
|
||||
.AddLightGun("0Scope {0}");
|
||||
|
||||
public ControllerDefinition Definition => _definition;
|
||||
|
@ -361,7 +363,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
public LibsnesApi.SNES_INPUT_PORT PortType => LibsnesApi.SNES_INPUT_PORT.Justifier;
|
||||
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Trigger", "0Start", "1Trigger", "1Start" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Trigger", "0Start", "1Trigger", "1Start" } }
|
||||
.AddLightGun("0Justifier {0}")
|
||||
.AddLightGun("1Justifier {0}");
|
||||
|
||||
|
|
|
@ -108,12 +108,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
}
|
||||
|
||||
_controllerDefinition = ControllerDefinitionMerger.GetMerged(
|
||||
_controllers.Select(c => c.Definition), out _cdums);
|
||||
"SNES Controller",
|
||||
_controllers.Select(c => c.Definition),
|
||||
out _cdums);
|
||||
|
||||
// add buttons that the core itself will handle
|
||||
_controllerDefinition.BoolButtons.Add("Reset");
|
||||
_controllerDefinition.BoolButtons.Add("Power");
|
||||
_controllerDefinition.Name = "SNES Controller";
|
||||
}
|
||||
|
||||
private void UpdateControls(IController c)
|
||||
|
@ -174,7 +175,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
return order[btn];
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
private static readonly ControllerDefinition _definition = new("(SNES Controller fragment)")
|
||||
{
|
||||
BoolButtons = Buttons.OrderBy(ButtonOrder).ToList()
|
||||
};
|
||||
|
@ -204,7 +205,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
private class Mouse : Analog
|
||||
{
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Mouse Left", "0Mouse Right" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Mouse Left", "0Mouse Right" } }
|
||||
.AddXYPair("0Mouse {0}", AxisPairOrientation.RightAndUp, (-127).RangeTo(127), 0); //TODO verify direction against hardware
|
||||
|
||||
public override ControllerDefinition Definition => _definition;
|
||||
|
@ -213,7 +214,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
private class SuperScope : Analog
|
||||
{
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Trigger", "0Cursor", "0Turbo", "0Pause" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Trigger", "0Cursor", "0Turbo", "0Pause" } }
|
||||
.AddLightGun("0Scope {0}");
|
||||
|
||||
public override ControllerDefinition Definition => _definition;
|
||||
|
@ -222,7 +223,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
private class Justifier : Analog
|
||||
{
|
||||
private static readonly ControllerDefinition _definition
|
||||
= new ControllerDefinition { BoolButtons = { "0Trigger", "0Start" } }
|
||||
= new ControllerDefinition("(SNES Controller fragment)") { BoolButtons = { "0Trigger", "0Start" } }
|
||||
.AddLightGun("0Justifier {0}");
|
||||
|
||||
public override ControllerDefinition Definition => _definition;
|
||||
|
|
|
@ -104,9 +104,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.VB
|
|||
["Start"] = 14
|
||||
};
|
||||
|
||||
private static readonly ControllerDefinition VirtualBoyController = new ControllerDefinition
|
||||
private static readonly ControllerDefinition VirtualBoyController = new ControllerDefinition("VirtualBoy Controller")
|
||||
{
|
||||
Name = "VirtualBoy Controller",
|
||||
BoolButtons = CoreButtons
|
||||
.OrderBy(b => _buttonOrdinals[b])
|
||||
.Concat(new[] { "Power" })
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -33,9 +32,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
_port4 = (IPort)Activator.CreateInstance(Implementors[(int)controller4], 4);
|
||||
_port5 = (IPort)Activator.CreateInstance(Implementors[(int)controller5], 5);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("PC Engine Controller")
|
||||
{
|
||||
Name = "PC Engine Controller",
|
||||
BoolButtons = _port1.Definition.BoolButtons
|
||||
.Concat(_port2.Definition.BoolButtons)
|
||||
.Concat(_port3.Definition.BoolButtons)
|
||||
|
@ -92,10 +90,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
public UnpluggedController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
{
|
||||
BoolButtons = new List<string>()
|
||||
};
|
||||
Definition = new("(PC Engine Controller fragment)");
|
||||
}
|
||||
|
||||
public byte Read(IController c, bool sel)
|
||||
|
@ -113,7 +108,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
public StandardController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("(PC Engine Controller fragment)")
|
||||
{
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => $"P{PortNum} " + b)
|
||||
|
|
|
@ -19,9 +19,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
|||
? ctor2(2)
|
||||
: throw new InvalidOperationException($"Invalid controller type: {controller2Name}");
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
BoolButtons = Port1.Definition.BoolButtons
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
.Concat(new[] { "Toggle Cable" } )
|
||||
|
|
|
@ -26,9 +26,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
|||
public StandardControls(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("GG Controller")
|
||||
{
|
||||
Name = "GG Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
|
|
@ -123,9 +123,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive
|
|||
|
||||
public bool Is32XActive { get; }
|
||||
|
||||
public static readonly ControllerDefinition PicoDriveController = new ControllerDefinition
|
||||
public static readonly ControllerDefinition PicoDriveController = new ControllerDefinition("PicoDrive Genesis Controller")
|
||||
{
|
||||
Name = "PicoDrive Genesis Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 A", "P1 B", "P1 C", "P1 Start", "P1 X", "P1 Y", "P1 Z", "P1 Mode",
|
||||
|
|
|
@ -18,10 +18,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
// Port 2 is defined, but not used for Game Gear
|
||||
Port2 = new GGController(2);
|
||||
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
|
||||
BoolButtons = new[] { "Reset" }
|
||||
.Concat(Port1.Definition.BoolButtons)
|
||||
.ToList()
|
||||
|
@ -34,10 +32,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
|
||||
if (!use_keyboard)
|
||||
{
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
|
||||
BoolButtons = new[] { "Reset", "Pause" }
|
||||
.Concat(Port1.Definition.BoolButtons)
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
|
@ -46,10 +42,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
}
|
||||
else
|
||||
{
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition(Port1.Definition.Name)
|
||||
{
|
||||
Name = Port1.Definition.Name,
|
||||
|
||||
BoolButtons = new[] { "Reset", "Pause" }
|
||||
.Concat(Port1.Definition.BoolButtons)
|
||||
.Concat(Port2.Definition.BoolButtons)
|
||||
|
|
|
@ -49,9 +49,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public SmsController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("SMS Controller")
|
||||
{
|
||||
Name = "SMS Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -130,9 +129,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public GGController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new("GG Controller")
|
||||
{
|
||||
Name = "GG Controller",
|
||||
BoolButtons = BaseDefinition
|
||||
.Select(b => "P" + PortNum + " " + b)
|
||||
.ToList()
|
||||
|
@ -203,9 +201,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public SMSPaddleController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("SMS Paddle Controller")
|
||||
{
|
||||
Name = "SMS Paddle Controller",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddAxis($"P{PortNum} Paddle", 0.RangeTo(255), 128);
|
||||
}
|
||||
|
@ -336,9 +333,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public SMSSportsPadController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("SMS Sports Pad Controller")
|
||||
{
|
||||
Name = "SMS Sports Pad Controller",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddXYPair($"P{PortNum} {{0}}", AxisPairOrientation.RightAndUp, (-64).RangeTo(63), 0); //TODO verify direction against hardware
|
||||
}
|
||||
|
@ -626,9 +622,8 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
public SMSLightPhaserController(int portNum)
|
||||
{
|
||||
PortNum = portNum;
|
||||
Definition = new ControllerDefinition
|
||||
Definition = new ControllerDefinition("SMS Light Phaser Controller")
|
||||
{
|
||||
Name = "SMS Light Phaser Controller",
|
||||
BoolButtons = BaseDefinition.Select(b => $"P{PortNum} {b}").ToList()
|
||||
}.AddXYPair($"P{PortNum} {{0}}", AxisPairOrientation.RightAndUp, 0.RangeTo(127), 64, 0.RangeTo(192), 96); //TODO verify direction against hardware
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
int player = 1;
|
||||
|
||||
ControllerDef = new ControllerDefinition();
|
||||
ControllerDef = new("GPGX Genesis Controller");
|
||||
|
||||
ControllerDef.BoolButtons.Add("Power");
|
||||
ControllerDef.BoolButtons.Add("Reset");
|
||||
|
@ -235,8 +235,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
throw new Exception("Unknown Genesis control device! Something went wrong.");
|
||||
}
|
||||
}
|
||||
|
||||
ControllerDef.Name = "GPGX Genesis Controller";
|
||||
}
|
||||
|
||||
public void Convert(IController source, LibGPGX.InputData target)
|
||||
|
|
|
@ -135,9 +135,8 @@ namespace BizHawk.Emulation.Cores.Sony.PS2
|
|||
: PutSettingsDirtyBits.None;
|
||||
}
|
||||
|
||||
private static readonly ControllerDefinition DualShock = new ControllerDefinition
|
||||
private static readonly ControllerDefinition DualShock = new ControllerDefinition("PS2 DualShock")
|
||||
{
|
||||
Name = "PS2 DualShock",
|
||||
BoolButtons =
|
||||
{
|
||||
"SELECT",
|
||||
|
|
|
@ -285,7 +285,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
|
||||
public static ControllerDefinition CreateControllerDefinition(SyncSettings syncSettings)
|
||||
{
|
||||
var definition = new ControllerDefinition { Name = "PSX Front Panel" };
|
||||
ControllerDefinition definition = new("PSX Front Panel");
|
||||
|
||||
var cfg = syncSettings.FIOConfig.ToLogical();
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
{
|
||||
partial class WonderSwan
|
||||
{
|
||||
public static readonly ControllerDefinition WonderSwanController = new ControllerDefinition
|
||||
public static readonly ControllerDefinition WonderSwanController = new ControllerDefinition("WonderSwan Controller")
|
||||
{
|
||||
Name = "WonderSwan Controller",
|
||||
BoolButtons =
|
||||
{
|
||||
"P1 X1",
|
||||
|
|
|
@ -245,8 +245,7 @@ namespace BizHawk.Emulation.Cores.Libretro
|
|||
|
||||
public static ControllerDefinition CreateControllerDefinition(SyncSettings syncSettings)
|
||||
{
|
||||
ControllerDefinition definition = new ControllerDefinition();
|
||||
definition.Name = "LibRetro Controls"; // <-- for compatibility
|
||||
ControllerDefinition definition = new("LibRetro Controls"/*for compatibility*/);
|
||||
|
||||
foreach(var item in new[] {
|
||||
"P1 {0} Up", "P1 {0} Down", "P1 {0} Left", "P1 {0} Right", "P1 {0} Select", "P1 {0} Start", "P1 {0} Y", "P1 {0} B", "P1 {0} X", "P1 {0} A", "P1 {0} L", "P1 {0} R",
|
||||
|
|
|
@ -46,9 +46,8 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
HashSet<string> hiddenPorts,
|
||||
string controllerDeckName)
|
||||
{
|
||||
var ret = new ControllerDefinition
|
||||
ControllerDefinition ret = new(controllerDeckName)
|
||||
{
|
||||
Name = controllerDeckName,
|
||||
CategoryLabels =
|
||||
{
|
||||
{ "Power", "System" },
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace BizHawk.Tests.Client.Common.Display
|
|||
[TestInitialize]
|
||||
public void Initializer()
|
||||
{
|
||||
_boolController = new(new ControllerDefinition { BoolButtons = { "A" } });
|
||||
_axisController = new(new ControllerDefinition().AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), MidValue));
|
||||
_boolController = new(new ControllerDefinition("Dummy Gamepad") { BoolButtons = { "A" } });
|
||||
_axisController = new(new ControllerDefinition("Dummy Gamepad").AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), MidValue));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
@ -15,14 +15,14 @@ namespace BizHawk.Tests.Client.Common.Movie
|
|||
[TestInitialize]
|
||||
public void Initializer()
|
||||
{
|
||||
_boolController = new(new ControllerDefinition { BoolButtons = { "A" } });
|
||||
_axisController = new(new ControllerDefinition().AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), 100));
|
||||
_boolController = new(new ControllerDefinition("Dummy Gamepad") { BoolButtons = { "A" } });
|
||||
_axisController = new(new ControllerDefinition("Dummy Gamepad").AddXYPair("Stick{0}", AxisPairOrientation.RightAndUp, 0.RangeTo(200), 100));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenerateLogEntry_ExclamationForUnknownButtons()
|
||||
{
|
||||
SimpleController controller = new(new ControllerDefinition { BoolButtons = { "Unknown Button" } });
|
||||
SimpleController controller = new(new ControllerDefinition("Dummy Gamepad") { BoolButtons = { "Unknown Button" } });
|
||||
var lg = new Bk2LogEntryGenerator("NES", controller);
|
||||
controller["Unknown Button"] = true;
|
||||
var actual = lg.GenerateLogEntry();
|
||||
|
|
Loading…
Reference in New Issue