Do genesis controller logic for none, one player, and "normal", don't know what the other options mean

This commit is contained in:
adelikat 2014-06-26 21:09:14 +00:00
parent 0fa75a5d77
commit a33f926675
2 changed files with 31 additions and 5 deletions

View File

@ -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<VirtualPad>();
if (pads.Any())
{
ControllerBox.Controls.AddRange(pads.Reverse().ToArray());
}
}
}

View File

@ -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<VirtualPad> 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)