a7800 virtualpads - cleanup, support unplugged and lightgun options, remove unimplemented paddle controller logic
This commit is contained in:
parent
f98003f98e
commit
59a7b24df9
|
@ -1,6 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
using BizHawk.Common.ReflectionExtensions;
|
using BizHawk.Common.ReflectionExtensions;
|
||||||
|
@ -11,44 +10,65 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[Schema("A78")]
|
[Schema("A78")]
|
||||||
// ReSharper disable once UnusedMember.Global
|
// ReSharper disable once UnusedMember.Global
|
||||||
public class A78Schema : IVirtualPadSchema
|
public class A78Schema : IVirtualPadSchema
|
||||||
{
|
|
||||||
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
|
||||||
{
|
|
||||||
return Atari7800HawkSchema.GetPadSchemas((A7800Hawk)core);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static class Atari7800HawkSchema
|
|
||||||
{
|
{
|
||||||
private static string StandardControllerName => typeof(StandardController).DisplayName();
|
private static string StandardControllerName => typeof(StandardController).DisplayName();
|
||||||
private static string ProLineControllerName => typeof(ProLineController).DisplayName();
|
private static string ProLineControllerName => typeof(ProLineController).DisplayName();
|
||||||
|
private static string LightGunControllerName => typeof(LightGunController).DisplayName();
|
||||||
|
|
||||||
public static IEnumerable<PadSchema> GetPadSchemas(A7800Hawk core)
|
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
||||||
{
|
{
|
||||||
var a78SyncSettings = core.GetSyncSettings().Clone();
|
var ss = ((A7800Hawk)core).GetSyncSettings().Clone();
|
||||||
var port1 = a78SyncSettings.Port1;
|
|
||||||
var port2 = a78SyncSettings.Port2;
|
|
||||||
|
|
||||||
if (port1 == StandardControllerName)
|
var port1 = SchemaFor(ss.Port1, 1);
|
||||||
|
if (port1 != null)
|
||||||
{
|
{
|
||||||
yield return JoystickController(1);
|
yield return port1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port2 == StandardControllerName)
|
var port2 = SchemaFor(ss.Port2, 2);
|
||||||
|
if (port2 != null)
|
||||||
{
|
{
|
||||||
yield return JoystickController(2);
|
yield return port2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port1 == ProLineControllerName)
|
yield return ConsoleButtons();
|
||||||
{
|
|
||||||
yield return ProLineController(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port2 == ProLineControllerName)
|
private static PadSchema SchemaFor(string controllerName, int portNum)
|
||||||
{
|
{
|
||||||
yield return ProLineController(2);
|
if (controllerName == StandardControllerName)
|
||||||
|
{
|
||||||
|
return JoystickController(portNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (controllerName == ProLineControllerName)
|
||||||
|
{
|
||||||
|
return ProLineController(portNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controllerName == LightGunControllerName)
|
||||||
|
{
|
||||||
|
return LightGunController(portNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PadSchema JoystickController(int controller)
|
||||||
|
{
|
||||||
|
return new PadSchema
|
||||||
|
{
|
||||||
|
DisplayName = $"Player {controller}",
|
||||||
|
Size = new Size(174, 74),
|
||||||
|
Buttons = new []
|
||||||
|
{
|
||||||
|
ButtonSchema.Up(23, 15, controller),
|
||||||
|
ButtonSchema.Down(23, 36, controller),
|
||||||
|
ButtonSchema.Left(2, 24, controller),
|
||||||
|
ButtonSchema.Right(44, 24, controller),
|
||||||
|
new ButtonSchema(120, 24, controller, "Button") { DisplayName = "1" }
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PadSchema ProLineController(int controller)
|
private static PadSchema ProLineController(int controller)
|
||||||
|
@ -69,40 +89,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PadSchema JoystickController(int controller)
|
|
||||||
{
|
|
||||||
return new PadSchema
|
|
||||||
{
|
|
||||||
DisplayName = $"Player {controller}",
|
|
||||||
Size = new Size(174, 74),
|
|
||||||
Buttons = new[]
|
|
||||||
{
|
|
||||||
ButtonSchema.Up(23, 15, controller),
|
|
||||||
ButtonSchema.Down(23, 36, controller),
|
|
||||||
ButtonSchema.Left(2, 24, controller),
|
|
||||||
ButtonSchema.Right(54, 24, controller),
|
|
||||||
new ButtonSchema(120, 24, controller, "Button")
|
|
||||||
{
|
|
||||||
DisplayName = "1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PadSchema PaddleController(int controller)
|
|
||||||
{
|
|
||||||
return new PadSchema
|
|
||||||
{
|
|
||||||
DisplayName = $"Player {controller}",
|
|
||||||
Size = new Size(250, 74),
|
|
||||||
Buttons = new[]
|
|
||||||
{
|
|
||||||
new SingleFloatSchema(23, 15, controller, "Paddle"),
|
|
||||||
new ButtonSchema(12, 90, controller, "Trigger") { DisplayName = "1" }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PadSchema LightGunController(int controller)
|
private static PadSchema LightGunController(int controller)
|
||||||
{
|
{
|
||||||
return new PadSchema
|
return new PadSchema
|
||||||
|
@ -111,13 +97,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Size = new Size(356, 290),
|
Size = new Size(356, 290),
|
||||||
Buttons = new[]
|
Buttons = new[]
|
||||||
{
|
{
|
||||||
new TargetedPairSchema(14, 17, $"P{controller} VPos")
|
new TargetedPairSchema(14, 17, $"P{controller} X")
|
||||||
{
|
{
|
||||||
TargetSize = new Size(256, 240),
|
TargetSize = new Size(256, 240)
|
||||||
SecondaryNames = new[]
|
|
||||||
{
|
|
||||||
$"P{controller} HPos"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new ButtonSchema(284, 17, controller, "Trigger")
|
new ButtonSchema(284, 17, controller, "Trigger")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue