diff --git a/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs b/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs index 9db622672e..31b65c5df5 100644 --- a/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs +++ b/BizHawk.Client.ApiHawk/Classes/BizHawkSystemIdToCoreSystemEnumConverter.cs @@ -32,9 +32,6 @@ namespace BizHawk.Client.ApiHawk return CoreSystem.Atari2600; case "A78": - return CoreSystem.Atari2600; - - case "A7800": return CoreSystem.Atari7800; case "Coleco": diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index 3e3d4436b9..cbf70d2917 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -1167,7 +1167,6 @@ - @@ -1317,7 +1316,7 @@ A7800ControllerSettings.cs - + A7800FilterSettings.cs @@ -2166,4 +2165,4 @@ - + \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 3e469b7929..3f1d63e2c1 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -34,6 +34,7 @@ using BizHawk.Emulation.Cores.Nintendo.SNES9X; using BizHawk.Emulation.Cores.Consoles.SNK; using BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive; using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy; +using BizHawk.Emulation.Cores.Atari.A7800Hawk; namespace BizHawk.Client.EmuHawk { @@ -1725,8 +1726,11 @@ namespace BizHawk.Client.EmuHawk case "A26": AtariSubMenu.Visible = true; break; - case "A7800": - A7800SubMenu.Visible = true; + case "A78": + if (Emulator is A7800Hawk) + { + A7800SubMenu.Visible = true; + } break; case "PSX": PSXSubMenu.Visible = true; diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A7800HawkSchema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A7800HawkSchema.cs deleted file mode 100644 index 2f7fb562e4..0000000000 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A7800HawkSchema.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; - -using BizHawk.Common.ReflectionExtensions; -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Atari.A7800Hawk; - -namespace BizHawk.Client.EmuHawk -{ - [Schema("A7800")] - public class A7800HawkSchema : IVirtualPadSchema - { - private string UnpluggedControllerName => typeof(UnpluggedController).DisplayName(); - private string StandardControllerName => typeof(StandardController).DisplayName(); - private string ProLineControllerName => typeof(ProLineController).DisplayName(); - - public IEnumerable GetPadSchemas(IEmulator core) - { - var A78SyncSettings = ((A7800Hawk)core).GetSyncSettings().Clone(); - var port1 = A78SyncSettings.Port1; - var port2 = A78SyncSettings.Port2; - - if (port1 == StandardControllerName) - { - yield return JoystickController(1); - } - - if (port2 == StandardControllerName) - { - yield return JoystickController(2); - } - - if (port1 == ProLineControllerName) - { - yield return ProLineController(1); - } - - if (port2 == ProLineControllerName) - { - yield return ProLineController(2); - } - - } - - private static PadSchema ProLineController(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 + " Up", - DisplayName = "", - Icon = Properties.Resources.BlueUp, - Location = new Point(23, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Down", - DisplayName = "", - Icon = Properties.Resources.BlueDown, - Location = new Point(23, 36), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Left", - DisplayName = "", - Icon = Properties.Resources.Back, - Location = new Point(2, 24), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Right", - DisplayName = "", - Icon = Properties.Resources.Forward, - Location = new Point(44, 24), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Trigger", - DisplayName = "1", - Location = new Point(120, 24), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Trigger 2", - DisplayName = "2", - Location = new Point(145, 24), - Type = PadSchema.PadInputType.Boolean - } - } - }; - } - - private static PadSchema JoystickController(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 + " Up", - DisplayName = "", - Icon = Properties.Resources.BlueUp, - Location = new Point(23, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Down", - DisplayName = "", - Icon = Properties.Resources.BlueDown, - Location = new Point(23, 36), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Left", - DisplayName = "", - Icon = Properties.Resources.Back, - Location = new Point(2, 24), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Right", - DisplayName = "", - Icon = Properties.Resources.Forward, - Location = new Point(44, 24), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Trigger", - DisplayName = "1", - Location = new Point(120, 24), - Type = PadSchema.PadInputType.Boolean - } - } - }; - } - - private static PadSchema PaddleController(int controller) - { - return new PadSchema - { - DisplayName = "Player " + controller, - IsConsole = false, - DefaultSize = new Size(250, 74), - Buttons = new[] - { - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Paddle", - DisplayName = "Paddle", - Location = new Point(23, 15), - Type = PadSchema.PadInputType.FloatSingle - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Trigger", - DisplayName = "1", - Location = new Point(12, 90), - Type = PadSchema.PadInputType.Boolean - } - } - }; - } - - private static PadSchema LightGunController(int controller) - { - return new PadSchema - { - DisplayName = "Light Gun", - IsConsole = false, - DefaultSize = new Size(356, 290), - MaxSize = new Size(356, 290), - Buttons = new[] - { - new PadSchema.ButtonSchema - { - Name = "P" + controller + " VPos", - Location = new Point(14, 17), - Type = PadSchema.PadInputType.TargetedPair, - TargetSize = new Size(256, 240), - SecondaryNames = new[] - { - "P" + controller + " HPos", - } - }, - new PadSchema.ButtonSchema - { - Name = "P" + controller + " Trigger", - DisplayName = "Trigger", - Location = new Point(284, 17), - Type = PadSchema.PadInputType.Boolean - } - } - }; - } - - private static PadSchema ConsoleButtons() - { - return new PadSchema - { - DisplayName = "Console", - IsConsole = true, - DefaultSize = new Size(215, 50), - Buttons = new[] - { - new PadSchema.ButtonSchema - { - Name = "Select", - DisplayName = "Select", - Location = new Point(10, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "Reset", - DisplayName = "Reset", - Location = new Point(60, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "Power", - DisplayName = "Power", - Location = new Point(108, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "Pause", - DisplayName = "Pause", - Location = new Point(158, 15), - Type = PadSchema.PadInputType.Boolean - }, - new PadSchema.ButtonSchema - { - Name = "BW", - DisplayName = "BW", - Location = new Point(158, 15), - Type = PadSchema.PadInputType.Boolean - } - } - }; - } - } -} diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs index 2b7fd97471..257045e0d1 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/schema/A78Schema.cs @@ -4,6 +4,9 @@ using System.Drawing; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Atari.Atari7800; +using BizHawk.Common.ReflectionExtensions; +using BizHawk.Emulation.Cores.Atari.A7800Hawk; + namespace BizHawk.Client.EmuHawk { [Schema("A78")] @@ -11,7 +14,275 @@ namespace BizHawk.Client.EmuHawk { public IEnumerable GetPadSchemas(IEmulator core) { - switch (((Atari7800)core).ControlAdapter.ControlType.Name) + if (core is Atari7800) + { + return Emu7800Schema.GetPadSchemas((Atari7800)core); + } + + return Atari7800HawkSchema.GetPadSchemas((A7800Hawk)core); + } + } + + internal static class Atari7800HawkSchema + { + private static string UnpluggedControllerName => typeof(UnpluggedController).DisplayName(); + private static string StandardControllerName => typeof(StandardController).DisplayName(); + private static string ProLineControllerName => typeof(ProLineController).DisplayName(); + + public static IEnumerable GetPadSchemas(A7800Hawk core) + { + var A78SyncSettings = core.GetSyncSettings().Clone(); + var port1 = A78SyncSettings.Port1; + var port2 = A78SyncSettings.Port2; + + if (port1 == StandardControllerName) + { + yield return JoystickController(1); + } + + if (port2 == StandardControllerName) + { + yield return JoystickController(2); + } + + if (port1 == ProLineControllerName) + { + yield return ProLineController(1); + } + + if (port2 == ProLineControllerName) + { + yield return ProLineController(2); + } + + } + + private static PadSchema ProLineController(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 + " Up", + DisplayName = "", + Icon = Properties.Resources.BlueUp, + Location = new Point(23, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Down", + DisplayName = "", + Icon = Properties.Resources.BlueDown, + Location = new Point(23, 36), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Left", + DisplayName = "", + Icon = Properties.Resources.Back, + Location = new Point(2, 24), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Right", + DisplayName = "", + Icon = Properties.Resources.Forward, + Location = new Point(44, 24), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Trigger", + DisplayName = "1", + Location = new Point(120, 24), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Trigger 2", + DisplayName = "2", + Location = new Point(145, 24), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + + private static PadSchema JoystickController(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 + " Up", + DisplayName = "", + Icon = Properties.Resources.BlueUp, + Location = new Point(23, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Down", + DisplayName = "", + Icon = Properties.Resources.BlueDown, + Location = new Point(23, 36), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Left", + DisplayName = "", + Icon = Properties.Resources.Back, + Location = new Point(2, 24), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Right", + DisplayName = "", + Icon = Properties.Resources.Forward, + Location = new Point(44, 24), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Trigger", + DisplayName = "1", + Location = new Point(120, 24), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + + private static PadSchema PaddleController(int controller) + { + return new PadSchema + { + DisplayName = "Player " + controller, + IsConsole = false, + DefaultSize = new Size(250, 74), + Buttons = new[] + { + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Paddle", + DisplayName = "Paddle", + Location = new Point(23, 15), + Type = PadSchema.PadInputType.FloatSingle + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Trigger", + DisplayName = "1", + Location = new Point(12, 90), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + + private static PadSchema LightGunController(int controller) + { + return new PadSchema + { + DisplayName = "Light Gun", + IsConsole = false, + DefaultSize = new Size(356, 290), + MaxSize = new Size(356, 290), + Buttons = new[] + { + new PadSchema.ButtonSchema + { + Name = "P" + controller + " VPos", + Location = new Point(14, 17), + Type = PadSchema.PadInputType.TargetedPair, + TargetSize = new Size(256, 240), + SecondaryNames = new[] + { + "P" + controller + " HPos", + } + }, + new PadSchema.ButtonSchema + { + Name = "P" + controller + " Trigger", + DisplayName = "Trigger", + Location = new Point(284, 17), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + + private static PadSchema ConsoleButtons() + { + return new PadSchema + { + DisplayName = "Console", + IsConsole = true, + DefaultSize = new Size(215, 50), + Buttons = new[] + { + new PadSchema.ButtonSchema + { + Name = "Select", + DisplayName = "Select", + Location = new Point(10, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "Reset", + DisplayName = "Reset", + Location = new Point(60, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "Power", + DisplayName = "Power", + Location = new Point(108, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "Pause", + DisplayName = "Pause", + Location = new Point(158, 15), + Type = PadSchema.PadInputType.Boolean + }, + new PadSchema.ButtonSchema + { + Name = "BW", + DisplayName = "BW", + Location = new Point(158, 15), + Type = PadSchema.PadInputType.Boolean + } + } + }; + } + } + + internal static class Emu7800Schema + { + public static IEnumerable GetPadSchemas(Atari7800 core) + { + switch (core.ControlAdapter.ControlType.Name) { case "Atari 7800 Joystick Controller": yield return JoystickController(1); diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.IEmulator.cs index 82fc52e990..d99c43b873 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/A7800Hawk/A7800Hawk.IEmulator.cs @@ -284,7 +284,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk public int Frame => _frame; - public string SystemId => "A7800"; + public string SystemId => "A78"; public bool DeterministicEmulation { get; set; }