From cecf29e90a1ca5a20324d56fd5ea92b29cff9e83 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 14 Jun 2020 15:10:39 -0500 Subject: [PATCH] Support PCE mouse in movie mnemonics and virtualpads --- .../movie/bk2/Bk2MnemonicLookup.cs | 3 ++ .../tools/VirtualPads/schema/PceSchema.cs | 39 ++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs index a0a4d8a60b..cdc13224a5 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs @@ -134,6 +134,9 @@ namespace BizHawk.Client.Common ["Mouse Center"] = 'c', ["Mouse Start"] = 's', + ["Left Button"] = 'l', + ["Right Button"] = 'r', + ["Mode"] = 'M', ["MODE"] = 'M', ["Mode 1"] = 'M', diff --git a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs index 26b277c57f..eaf98ca47f 100644 --- a/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs +++ b/src/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/PceSchema.cs @@ -4,7 +4,6 @@ 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; @@ -101,6 +100,10 @@ namespace BizHawk.Client.EmuHawk { yield return StandardController(num); } + else if (device == "mouse") + { + yield return Mouse(num); + } else if (device != "none") { MessageBox.Show($"Controller type {device} not supported yet."); @@ -126,5 +129,39 @@ namespace BizHawk.Client.EmuHawk } }; } + + private static PadSchema Mouse(int controller) + { + var range = new ControllerDefinition.AxisRange(-127, 0, 127); + return new PadSchema + { + Size = new Size(345, 225), + Buttons = new PadSchemaControl[] + { + new AnalogSchema(6, 14, $"P{controller} Motion Left / Right") + { + SecondaryName = $"P{controller} Motion Up / Down", + AxisRange = range, + SecondaryAxisRange = range + }, + new ButtonSchema(275, 15, controller, "Left Button") + { + DisplayName = "Left" + }, + new ButtonSchema(275, 45, controller, "Right Button") + { + DisplayName = "Right" + }, + new ButtonSchema(275, 75, controller, "SELECT") + { + DisplayName = "Select" + }, + new ButtonSchema(275, 105, controller, "RUN") + { + DisplayName = "Run" + } + } + }; + } } }