GBHawk: Fix Virtual Pad

This commit is contained in:
alyosha-tas 2018-10-08 18:54:12 -05:00
parent 77c186b0b2
commit bdc241d658
2 changed files with 137 additions and 3 deletions

View File

@ -10,10 +10,26 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController();
yield return ConsoleButtons();
if (core.ControllerDefinition.Name == "Gameboy Controller + Tilt")
{
yield return StandardControllerH();
yield return ConsoleButtonsH();
yield return TiltControls();
}
else if (core.ControllerDefinition.Name == "Gameboy Controller H")
{
yield return StandardControllerH();
yield return ConsoleButtonsH();
}
else
{
yield return StandardController();
yield return ConsoleButtons();
}
}
// Gambatte Controller
private static PadSchema StandardController()
{
return new PadSchema
@ -105,5 +121,123 @@ namespace BizHawk.Client.EmuHawk
}
};
}
// GBHawk controllers
private static PadSchema StandardControllerH()
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 79),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P1 Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 B",
DisplayName = "B",
Location = new Point(122, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 A",
DisplayName = "A",
Location = new Point(146, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 Select",
DisplayName = "s",
Location = new Point(52, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P1 Start",
DisplayName = "S",
Location = new Point(74, 34),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
private static PadSchema ConsoleButtonsH()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(75, 50),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P1 Power",
DisplayName = "Power",
Location = new Point(10, 15),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
private static PadSchema TiltControls()
{
return new PadSchema
{
DisplayName = "Tilt",
IsConsole = false,
DefaultSize = new Size(356, 290),
MaxSize = new Size(356, 290),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P1 Tilt X",
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 240),
SecondaryNames = new[]
{
"P1 Tilt Y",
}
}
}
};
}
}
}

View File

@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
PortNum = portNum;
Definition = new ControllerDefinition
{
Name = "Gameboy Controller",
Name = "Gameboy Controller H",
BoolButtons = BaseDefinition
.Select(b => "P" + PortNum + " " + b)
.ToList()