BizHawk/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/GenSchema.cs

212 lines
5.5 KiB
C#

using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("GEN")]
public class GenSchema : IVirtualPadSchema
{
public IEnumerable<VirtualPad> GetPads()
{
var ss = (GPGX.GPGXSyncSettings)Global.Emulator.GetSyncSettings();
if (ss.ControlType == GPGX.ControlType.OnePlayer)
{
if (ss.UseSixButton)
{
yield return new VirtualPad(SixButtonController(1));
}
else
{
yield return new VirtualPad(ThreeButtonController(2));
}
}
else if (ss.ControlType == GPGX.ControlType.Normal)
{
if (ss.UseSixButton)
{
yield return new VirtualPad(SixButtonController(1));
yield return new VirtualPad(SixButtonController(2));
}
else
{
yield return new VirtualPad(ThreeButtonController(1));
yield return new VirtualPad(ThreeButtonController(2));
}
}
else
{
yield return null;
}
}
public static PadSchema ThreeButtonController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 90),
Buttons = new[]
{
new PadSchema.ButtonScema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(98, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(122, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " C",
DisplayName = "C",
Location = new Point(146, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Start",
DisplayName = "S",
Location = new Point(122, 12),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
public static PadSchema SixButtonController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 90),
Buttons = new[]
{
new PadSchema.ButtonScema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(98, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(122, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " C",
DisplayName = "C",
Location = new Point(146, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " X",
DisplayName = "X",
Location = new Point(98, 65),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Y",
DisplayName = "Y",
Location = new Point(122, 65),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Z",
DisplayName = "Z",
Location = new Point(146, 65),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Start",
DisplayName = "S",
Location = new Point(122, 12),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
}
}