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

152 lines
3.7 KiB
C#

using System.Collections.Generic;
using System.Drawing;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("SNES")]
public class SnesSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas()
{
for (var i = 0; i < Global.Emulator.ControllerDefinition.PlayerCount; i++)
{
yield return StandardController(i + 1);
}
yield return ConsoleButtons();
}
private static PadSchema StandardController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(200, 90),
Buttons = new[]
{
new PadSchema.ButtonScema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(34, 17),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(34, 61),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(22, 39),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(44, 39),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " L",
DisplayName = "L",
Location = new Point(2, 10),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " R",
DisplayName = "R",
Location = new Point(174, 10),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Select",
DisplayName = "s",
Location = new Point(70, 39),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Start",
DisplayName = "S",
Location = new Point(92, 39),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " Y",
DisplayName = "Y",
Location = new Point(121, 39),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(145, 52),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " X",
DisplayName = "X",
Location = new Point(122, 15),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(146, 25),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(150, 50),
Buttons = new[]
{
new PadSchema.ButtonScema
{
Name = "Reset",
DisplayName = "Reset",
Location = new Point(10, 15),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonScema
{
Name = "Power",
DisplayName = "Power",
Location = new Point(58, 15),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
}
}