From a33f9266751c11c2df43c002d41e12fe642fbf10 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 26 Jun 2014 21:09:14 +0000 Subject: [PATCH] Do genesis controller logic for none, one player, and "normal", don't know what the other options mean --- .../tools/VirtualPads/VirtualpadsTool.cs | 7 +++-- .../tools/VirtualPads/schema/GenSchema.cs | 29 +++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs index 0361da8dbd..c110565b5c 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs @@ -84,8 +84,11 @@ namespace BizHawk.Client.EmuHawk if (schemaType != null) { - var pads = (Activator.CreateInstance(schemaType) as IVirtualPadSchema).GetPads(); - ControllerBox.Controls.AddRange(pads.Reverse().ToArray()); + var pads = (Activator.CreateInstance(schemaType) as IVirtualPadSchema).GetPads() ?? Enumerable.Empty(); + if (pads.Any()) + { + ControllerBox.Controls.AddRange(pads.Reverse().ToArray()); + } } } diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GenSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GenSchema.cs index cd888c24f3..aacd30162a 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GenSchema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GenSchema.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.Drawing; using BizHawk.Client.Common; +using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; namespace BizHawk.Client.EmuHawk { @@ -11,9 +12,31 @@ namespace BizHawk.Client.EmuHawk { public IEnumerable GetPads() { - yield return new VirtualPad(ThreeButtonController(1)); - - yield return new VirtualPad(SixButtonController(2)); + var ss = (GPGX.GPGXSyncSettings)Global.Emulator.GetSyncSettings(); + if (ss.ControlType == GPGX.ControlType.OnePlayer) + { + if (ss.UseSixButton) + { + yield return new VirtualPad(ThreeButtonController(1)); + } + } + else if (ss.ControlType == GPGX.ControlType.Normal) + { + if (ss.UseSixButton) + { + yield return new VirtualPad(ThreeButtonController(1)); + yield return new VirtualPad(ThreeButtonController(2)); + } + else + { + yield return new VirtualPad(SixButtonController(1)); + yield return new VirtualPad(SixButtonController(2)); + } + } + else + { + yield return null; + } } public static PadSchema ThreeButtonController(int controller)