2014-06-23 13:44:06 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Drawing;
|
2017-07-18 16:16:42 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
2014-06-23 13:44:06 +00:00
|
|
|
|
|
2016-12-06 01:33:21 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
2017-07-18 16:16:42 +00:00
|
|
|
|
using BizHawk.Emulation.Cores.PCEngine;
|
2014-06-22 15:43:45 +00:00
|
|
|
|
|
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
|
|
|
|
{
|
2017-07-12 19:40:10 +00:00
|
|
|
|
[Schema("PCECD")]
|
2017-04-15 20:37:30 +00:00
|
|
|
|
public class PceCdSchema : PceSchema { }
|
2016-07-11 02:13:40 +00:00
|
|
|
|
|
2017-07-12 19:40:10 +00:00
|
|
|
|
[Schema("PCE")]
|
2014-06-23 13:44:06 +00:00
|
|
|
|
public class PceSchema : IVirtualPadSchema
|
2014-06-22 15:43:45 +00:00
|
|
|
|
{
|
2016-12-06 01:33:21 +00:00
|
|
|
|
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
2014-06-23 13:44:06 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
var ss = ((PCEngine)core).GetSyncSettings();
|
|
|
|
|
|
|
|
|
|
var padSchemas = new[]
|
|
|
|
|
{
|
|
|
|
|
ss.Port1,
|
|
|
|
|
ss.Port2,
|
|
|
|
|
ss.Port3,
|
|
|
|
|
ss.Port4,
|
|
|
|
|
ss.Port5,
|
|
|
|
|
}
|
|
|
|
|
.Where(p => p != PceControllerType.Unplugged)
|
|
|
|
|
.Select((p, i) => GenerateSchemaForPort(p, i + 1))
|
|
|
|
|
.Where(s => s != null);
|
|
|
|
|
|
|
|
|
|
return padSchemas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static PadSchema GenerateSchemaForPort(PceControllerType type, int controller)
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
2014-06-28 15:56:20 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
default:
|
|
|
|
|
MessageBox.Show($"{type} is not supported yet");
|
|
|
|
|
return null;
|
|
|
|
|
case PceControllerType.Unplugged:
|
|
|
|
|
return null;
|
|
|
|
|
case PceControllerType.GamePad:
|
|
|
|
|
return StandardController(controller);
|
2014-06-28 15:56:20 +00:00
|
|
|
|
}
|
2014-06-23 13:44:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-24 14:07:03 +00:00
|
|
|
|
private static PadSchema StandardController(int controller)
|
2014-06-22 15:43:45 +00:00
|
|
|
|
{
|
|
|
|
|
return new PadSchema
|
|
|
|
|
{
|
2014-06-23 01:43:33 +00:00
|
|
|
|
IsConsole = false,
|
2014-06-28 22:50:57 +00:00
|
|
|
|
DefaultSize = new Size(174, 90),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Buttons = new[]
|
|
|
|
|
{
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Up",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "",
|
|
|
|
|
Icon = Properties.Resources.BlueUp,
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(14, 12),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Down",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "",
|
|
|
|
|
Icon = Properties.Resources.BlueDown,
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(14, 56),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Left",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "",
|
|
|
|
|
Icon = Properties.Resources.Back,
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(2, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Right",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "",
|
|
|
|
|
Icon = Properties.Resources.Forward,
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(24, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} B2",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "II",
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(122, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} B1",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "I",
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(146, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Select",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "s",
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(52, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
},
|
2017-04-29 20:41:27 +00:00
|
|
|
|
new PadSchema.ButtonSchema
|
2014-06-23 01:43:33 +00:00
|
|
|
|
{
|
2017-07-18 16:16:42 +00:00
|
|
|
|
Name = $"P{controller} Run",
|
2014-06-23 01:43:33 +00:00
|
|
|
|
DisplayName = "R",
|
2014-06-28 22:50:57 +00:00
|
|
|
|
Location = new Point(74, 34),
|
2014-06-23 01:43:33 +00:00
|
|
|
|
Type = PadSchema.PadInputType.Boolean
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-06-22 15:43:45 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|