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

501 lines
13 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using System.Drawing;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
2017-07-13 17:02:08 +00:00
using BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive;
namespace BizHawk.Client.EmuHawk
{
2017-07-12 19:40:10 +00:00
[Schema("GEN")]
public class GenSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
2017-07-13 17:02:08 +00:00
if (core is GPGX)
{
return GpgxPadSchemas((GPGX)core);
}
return PicoPadSchemas((PicoDrive)core);
}
private IEnumerable<PadSchema> PicoPadSchemas(PicoDrive core)
{
yield return SixButtonController(1);
yield return SixButtonController(2);
yield return ConsoleButtons();
}
private IEnumerable<PadSchema> GpgxPadSchemas(GPGX core)
{
var devs = (core).GetDevices();
2014-06-27 17:59:45 +00:00
int player = 1;
foreach (var dev in devs)
{
2014-06-27 17:59:45 +00:00
switch (dev)
{
2014-06-27 17:59:45 +00:00
case LibGPGX.INPUT_DEVICE.DEVICE_NONE:
2014-06-28 15:59:26 +00:00
continue; // do not increment player number because no device was attached
2014-06-27 17:59:45 +00:00
case LibGPGX.INPUT_DEVICE.DEVICE_PAD3B:
yield return ThreeButtonController(player);
break;
case LibGPGX.INPUT_DEVICE.DEVICE_PAD6B:
yield return SixButtonController(player);
break;
case LibGPGX.INPUT_DEVICE.DEVICE_LIGHTGUN:
2014-07-06 16:06:38 +00:00
yield return LightGun(player);
2014-06-27 17:59:45 +00:00
break;
case LibGPGX.INPUT_DEVICE.DEVICE_MOUSE:
yield return Mouse(player);
break;
2014-06-30 01:27:35 +00:00
case LibGPGX.INPUT_DEVICE.DEVICE_ACTIVATOR:
yield return Activator(player);
break;
2014-06-28 12:58:13 +00:00
case LibGPGX.INPUT_DEVICE.DEVICE_XE_A1P:
2014-06-30 01:27:35 +00:00
yield return XE1AP(player);
break;
2014-06-28 15:59:26 +00:00
default:
2014-06-28 12:58:13 +00:00
// TO DO
break;
}
2014-06-27 17:59:45 +00:00
player++;
}
yield return ConsoleButtons();
}
2017-05-24 14:07:03 +00:00
private static PadSchema ThreeButtonController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 90),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} A",
DisplayName = "A",
Location = new Point(98, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} B",
DisplayName = "B",
Location = new Point(122, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} C",
DisplayName = "C",
Location = new Point(146, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Start",
DisplayName = "S",
Location = new Point(122, 12),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema SixButtonController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 90),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} A",
DisplayName = "A",
Location = new Point(98, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} B",
DisplayName = "B",
Location = new Point(122, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} C",
DisplayName = "C",
Location = new Point(146, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} X",
DisplayName = "X",
Location = new Point(98, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Y",
DisplayName = "Y",
Location = new Point(122, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Z",
DisplayName = "Z",
Location = new Point(146, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Start",
DisplayName = "S",
Location = new Point(122, 12),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema LightGun(int controller)
{
return new PadSchema
{
DisplayName = "Light Gun",
IsConsole = false,
DefaultSize = new Size(356, 300),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Lightgun X",
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
MaxValue = 10000,
TargetSize = new Size(320, 240),
2017-05-24 14:07:03 +00:00
SecondaryNames = new[]
{
2019-03-18 14:06:37 +00:00
$"P{controller} Lightgun Y",
}
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Lightgun Trigger",
DisplayName = "Trigger",
Location = new Point(284, 17),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Lightgun Start",
DisplayName = "Start",
Location = new Point(284, 40),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema Mouse(int controller)
{
return new PadSchema
{
DisplayName = "Mouse",
IsConsole = false,
DefaultSize = new Size(418, 290),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Mouse X",
Location = new Point(14, 17),
Type = PadSchema.PadInputType.AnalogStick,
MaxValue = 255,
TargetSize = new Size(520, 570),
2017-05-24 14:07:03 +00:00
SecondaryNames = new[]
{
2019-03-18 14:06:37 +00:00
$"P{controller} Mouse Y",
}
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Mouse Left",
DisplayName = "Left",
Location = new Point(365, 17),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Mouse Center",
DisplayName = "Center",
Location = new Point(365, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Mouse Right",
DisplayName = "Right",
Location = new Point(365, 63),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Mouse Start",
DisplayName = "Start",
Location = new Point(365, 86),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(150, 50),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
Name = "Reset",
DisplayName = "Reset",
Location = new Point(10, 15),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
{
Name = "Power",
DisplayName = "Power",
Location = new Point(58, 15),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema Activator(int controller)
2014-06-30 01:27:35 +00:00
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(110, 110),
Buttons = new[]
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Up",
2014-06-30 01:27:35 +00:00
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(47, 10),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Down",
2014-06-30 01:27:35 +00:00
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(47, 73),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Left",
2014-06-30 01:27:35 +00:00
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(15, 43),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Right",
2014-06-30 01:27:35 +00:00
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(80, 43),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} A",
2014-06-30 01:27:35 +00:00
DisplayName = "A",
Location = new Point(70, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} B",
2014-06-30 01:27:35 +00:00
DisplayName = "B",
Location = new Point(70, 20),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} C",
2014-06-30 01:27:35 +00:00
DisplayName = "C",
Location = new Point(22, 20),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} A",
2014-06-30 01:27:35 +00:00
DisplayName = "A",
Location = new Point(22, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:27:35 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Start",
2014-06-30 01:27:35 +00:00
DisplayName = "S",
Location = new Point(47, 43),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
2017-05-24 14:07:03 +00:00
private static PadSchema XE1AP(int controller)
2014-06-30 01:27:35 +00:00
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 90),
Buttons = new[]
2014-06-30 01:09:15 +00:00
{
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} A",
2014-06-30 01:09:15 +00:00
DisplayName = "A",
Location = new Point(98, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} B",
2014-06-30 01:09:15 +00:00
DisplayName = "B",
Location = new Point(122, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} C",
2014-06-30 01:09:15 +00:00
DisplayName = "C",
Location = new Point(146, 40),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} D",
2014-06-30 01:09:15 +00:00
DisplayName = "D",
Location = new Point(98, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} E1",
2014-06-30 01:09:15 +00:00
DisplayName = "E¹",
Location = new Point(122, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} E2",
2014-06-30 01:09:15 +00:00
DisplayName = "E²",
Location = new Point(152, 65),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Start",
2014-06-30 01:09:15 +00:00
DisplayName = "Start",
Location = new Point(122, 12),
Type = PadSchema.PadInputType.Boolean
},
2017-04-29 20:41:27 +00:00
new PadSchema.ButtonSchema
2014-06-30 01:09:15 +00:00
{
2019-03-18 14:06:37 +00:00
Name = $"P{controller} Select",
2014-06-30 01:09:15 +00:00
DisplayName = "Select",
Location = new Point(162, 12),
Type = PadSchema.PadInputType.Boolean
}
}
2014-06-30 01:27:35 +00:00
};
}
}
}