Atari 2600 - Virtual support for new controller configurations (Paddles just stubbed out), add Left and Rigth Difficulty toggle buttons to the console buttons section

This commit is contained in:
adelikat 2017-06-28 07:23:36 -05:00
parent c3b890c60c
commit d862ad8232
1 changed files with 66 additions and 4 deletions

View File

@ -2,6 +2,7 @@
using System.Drawing;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Atari.Atari2600;
namespace BizHawk.Client.EmuHawk
{
@ -10,11 +11,37 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController(1);
yield return StandardController(2);
var ss = ((Atari2600)core).GetSyncSettings().Clone();
var port1 = PadSchemaFromSetting(ss.Port1, 1);
if (port1 != null)
{
yield return port1;
}
var port2 = PadSchemaFromSetting(ss.Port2, 2);
if (port2 != null)
{
yield return port2;
}
yield return ConsoleButtons();
}
private static PadSchema PadSchemaFromSetting(Atari2600ControllerTypes type, int controller)
{
switch (type)
{
default:
case Atari2600ControllerTypes.Unplugged:
return null;
case Atari2600ControllerTypes.Joystick:
return StandardController(controller);
case Atari2600ControllerTypes.Paddle:
return PaddleController(controller);
}
}
private static PadSchema StandardController(int controller)
{
return new PadSchema
@ -68,13 +95,34 @@ namespace BizHawk.Client.EmuHawk
};
}
private static PadSchema PaddleController(int controller)
{
return new PadSchema
{
DisplayName = "Player " + controller,
IsConsole = false,
DefaultSize = new Size(174, 74),
MaxSize = new Size(174, 74),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Button",
DisplayName = "B",
Location = new Point(124, 24),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(160, 50),
DefaultSize = new Size(185, 75),
Buttons = new[]
{
new PadSchema.ButtonSchema
@ -97,7 +145,21 @@ namespace BizHawk.Client.EmuHawk
DisplayName = "Power",
Location = new Point(108, 15),
Type = PadSchema.PadInputType.Boolean
}
},
new PadSchema.ButtonSchema
{
Name = "Toggle Left Difficulty",
DisplayName = "Left Difficulty",
Location = new Point(10, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Toggle Right Difficulty",
DisplayName = "Right Difficulty",
Location = new Point(92, 40),
Type = PadSchema.PadInputType.Boolean
},
}
};
}