Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUAE core #3941

Merged
merged 6 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@
path = waterbox/gpgx/Genesis-Plus-GX
url = https://github.com/TASEmulators/Genesis-Plus-GX.git
branch = tasvideos-2.1
[submodule "waterbox/uae/libretro-uae"]
path = waterbox/uae/libretro-uae
url = https://github.com/TASEmulators/libretro-uae.git
branch = wbx
Binary file added Assets/dll/puae.wbx.zst
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
using System;
using System.Globalization;

using BizHawk.Emulation.Common;

namespace BizHawk.Client.Common
{
/// <summary>
/// This class holds a converter for BizHawk SystemId (which is a simple <see cref="string"/>
/// It allows you to convert it to a <see cref="CoreSystem"/> value and vice versa
/// </summary>
/// <remarks>I made it this way just in case one day we need it for WPF (DependencyProperty binding). Just uncomment :IValueConverter implementation
/// I didn't implemented it because of mono compatibility
/// </remarks>
public sealed class BizHawkSystemIdToEnumConverter //:IValueConverter
{
/// <summary>
/// Convert BizHawk SystemId <see cref="string"/> to <see cref="CoreSystem"/> value
/// </summary>
/// <param name="value"><see cref="string"/> you want to convert</param>
/// <param name="targetType">The type of the binding target property</param>
/// <param name="parameter">The converter parameter to use; null in our case</param>
/// <param name="cultureInfo">The culture to use in the converter</param>
/// <returns>A <see cref="CoreSystem"/> that is equivalent to BizHawk SystemId <see cref="string"/></returns>
/// <exception cref="InvalidOperationException">Thrown when SystemId hasn't been found</exception>
public object Convert(object value, Type targetType, object parameter, CultureInfo cultureInfo)
{
return (string) value switch
{
VSystemID.Raw.Amiga => CoreSystem.Amiga,
VSystemID.Raw.AppleII => CoreSystem.AppleII,
VSystemID.Raw.A26 => CoreSystem.Atari2600,
VSystemID.Raw.A78 => CoreSystem.Atari7800,
VSystemID.Raw.Arcade => CoreSystem.Arcade,
VSystemID.Raw.Coleco => CoreSystem.ColecoVision,
VSystemID.Raw.C64 => CoreSystem.Commodore64,
VSystemID.Raw.GBL => CoreSystem.GameBoyLink,
VSystemID.Raw.GB => CoreSystem.GameBoy,
VSystemID.Raw.GBA => CoreSystem.GameBoyAdvance,
VSystemID.Raw.GEN => CoreSystem.Genesis,
VSystemID.Raw.INTV => CoreSystem.Intellivision,
VSystemID.Raw.Libretro => CoreSystem.Libretro,
VSystemID.Raw.Lynx => CoreSystem.Lynx,
VSystemID.Raw.SMS => CoreSystem.MasterSystem,
VSystemID.Raw.NDS => CoreSystem.NintendoDS,
VSystemID.Raw.NES => CoreSystem.NES,
VSystemID.Raw.N64 => CoreSystem.Nintendo64,
VSystemID.Raw.NULL => CoreSystem.Null,
VSystemID.Raw.PCE => CoreSystem.PCEngine,
VSystemID.Raw.PCECD => CoreSystem.PCEngine,
VSystemID.Raw.SGX => CoreSystem.PCEngine,
VSystemID.Raw.PSX => CoreSystem.Playstation,
VSystemID.Raw.SAT => CoreSystem.Saturn,
VSystemID.Raw.SNES => CoreSystem.SNES,
VSystemID.Raw.TI83 => CoreSystem.TI83,
VSystemID.Raw.VEC => CoreSystem.Vectrex,
VSystemID.Raw.WSWAN => CoreSystem.WonderSwan,
VSystemID.Raw.ZXSpectrum => CoreSystem.ZXSpectrum,
VSystemID.Raw.AmstradCPC => CoreSystem.AmstradCPC,
VSystemID.Raw.GGL => CoreSystem.GGL,
VSystemID.Raw.ChannelF => CoreSystem.ChannelF,
VSystemID.Raw.O2 => CoreSystem.Odyssey2,
VSystemID.Raw.MSX => CoreSystem.MSX,
VSystemID.Raw.VB => CoreSystem.VirtualBoy,
VSystemID.Raw.NGP => CoreSystem.NeoGeoPocket,
VSystemID.Raw.SGB => CoreSystem.SuperGameBoy,
VSystemID.Raw.UZE => CoreSystem.UzeBox,
VSystemID.Raw.PCFX => CoreSystem.PcFx,
_ => throw new InvalidOperationException($"{value} is missing in convert list")
};
}


/// <summary>
/// Convert BizHawk SystemId <see cref="string"/> to <see cref="CoreSystem"/> value
/// </summary>
/// <param name="value"><see cref="string"/> you want to convert</param>
/// <returns>A <see cref="CoreSystem"/> that is equivalent to BizHawk SystemId <see cref="string"/></returns>
/// <exception cref="InvalidOperationException">Thrown when SystemId hasn't been found</exception>
public CoreSystem Convert(string value)
{
return (CoreSystem)Convert(value, null, null, CultureInfo.CurrentCulture);
}


/// <summary>
/// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
/// </summary>
/// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
/// <param name="targetType">The type of the binding target property</param>
/// <param name="parameter">The converter parameter to use; null in our case</param>
/// <param name="cultureInfo">The culture to use in the converter</param>
/// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
/// <exception cref="InvalidOperationException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo cultureInfo)
{
return (CoreSystem) value switch
{
CoreSystem.Amiga => VSystemID.Raw.Amiga,
CoreSystem.AppleII => VSystemID.Raw.AppleII,
CoreSystem.Atari2600 => VSystemID.Raw.A26,
CoreSystem.Atari7800 => VSystemID.Raw.A78,
CoreSystem.Arcade => VSystemID.Raw.Arcade,
CoreSystem.ChannelF => VSystemID.Raw.ChannelF,
CoreSystem.ColecoVision => VSystemID.Raw.Coleco,
CoreSystem.Commodore64 => VSystemID.Raw.C64,
CoreSystem.GameBoyLink => VSystemID.Raw.GBL,
CoreSystem.GameBoy => VSystemID.Raw.GB,
CoreSystem.GameBoyAdvance => VSystemID.Raw.GBA,
CoreSystem.Genesis => VSystemID.Raw.GEN,
CoreSystem.GGL => VSystemID.Raw.GGL,
CoreSystem.Intellivision => VSystemID.Raw.INTV,
CoreSystem.Libretro => VSystemID.Raw.Libretro,
CoreSystem.Lynx => VSystemID.Raw.Lynx,
CoreSystem.MasterSystem => VSystemID.Raw.SMS,
CoreSystem.MSX => VSystemID.Raw.MSX,
CoreSystem.NeoGeoPocket => VSystemID.Raw.NGP,
CoreSystem.NES => VSystemID.Raw.NES,
CoreSystem.Nintendo64 => VSystemID.Raw.N64,
CoreSystem.NintendoDS => VSystemID.Raw.NDS,
CoreSystem.Null => VSystemID.Raw.NULL,
CoreSystem.PCEngine => VSystemID.Raw.PCE,
CoreSystem.PcFx => VSystemID.Raw.PCFX,
CoreSystem.Playstation => VSystemID.Raw.PSX,
CoreSystem.Saturn => VSystemID.Raw.SAT,
CoreSystem.SNES => VSystemID.Raw.SNES,
CoreSystem.SuperGameBoy => VSystemID.Raw.SGB,
CoreSystem.TI83 => VSystemID.Raw.TI83,
CoreSystem.UzeBox => VSystemID.Raw.UZE,
CoreSystem.Vectrex => VSystemID.Raw.VEC,
CoreSystem.VirtualBoy => VSystemID.Raw.VB,
CoreSystem.WonderSwan => VSystemID.Raw.WSWAN,
CoreSystem.ZXSpectrum => VSystemID.Raw.ZXSpectrum,
CoreSystem.AmstradCPC => VSystemID.Raw.AmstradCPC,
CoreSystem.Odyssey2 => VSystemID.Raw.O2,
_ => throw new InvalidOperationException($"{value} is missing in convert list")
};
}


/// <summary>
/// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
/// </summary>
/// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
/// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
/// <exception cref="InvalidOperationException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
public string ConvertBack(CoreSystem value)
{
return (string)ConvertBack(value, null, null, CultureInfo.CurrentCulture);
}
}
}
46 changes: 46 additions & 0 deletions src/BizHawk.Client.Common/Api/CoreSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace BizHawk.Client.Common
{
/// <summary>
/// Enumeration of each system emulated by BizHawk
/// </summary>
public enum CoreSystem
{
Null = 0,
TI83,
AppleII,
Commodore64,
Atari2600,
Atari7800,
Lynx,
ColecoVision,
Intellivision,
GameBoy,
GameBoyLink,
GameBoyAdvance,
NintendoDS,
Nintendo64,
NES,
SNES,
PCEngine,
Genesis,
Saturn,
MasterSystem,
Playstation,
WonderSwan,
Libretro,
VirtualBoy,
Vectrex,
NeoGeoPocket,
ZXSpectrum,
AmstradCPC,
GGL,
ChannelF,
Odyssey2,
Arcade,
MSX,
SuperGameBoy,
UzeBox,
PcFx,
Amiga
}
}
4 changes: 4 additions & 0 deletions src/BizHawk.Client.Common/RomLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ private static class RomFileExtensions

public static readonly IReadOnlyCollection<string> A78 = new[] { "a78" };

public static readonly IReadOnlyCollection<string> Amiga = new[] { "adf", "adz", "dms", "fdi", "ipf", "lha" };

public static readonly IReadOnlyCollection<string> AppleII = new[] { "dsk", "do", "po" };

public static readonly IReadOnlyCollection<string> Arcade = new[] { "zip", "7z", "chd" };
Expand Down Expand Up @@ -934,6 +936,7 @@ private static class RomFileExtensions
public static readonly IReadOnlyCollection<string> AutoloadFromArchive = Array.Empty<string>()
.Concat(A26)
.Concat(A78)
.Concat(Amiga)
.Concat(AppleII)
.Concat(C64)
.Concat(Coleco)
Expand Down Expand Up @@ -1004,6 +1007,7 @@ private static class RomFileExtensions
new FilesystemFilter("Vectrex", RomFileExtensions.VEC),
new FilesystemFilter("MSX", RomFileExtensions.MSX),
new FilesystemFilter("Arcade", RomFileExtensions.Arcade),
new FilesystemFilter("Amiga", RomFileExtensions.Amiga),
FilesystemFilter.EmuHawkSaveStates)
{
CombinedEntryDesc = "Everything",
Expand Down
3 changes: 3 additions & 0 deletions src/BizHawk.Client.Common/config/PathEntryCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class PathEntryCollection
private static readonly Dictionary<string, string> _displayNameLookup = new()
{
[GLOBAL] = "Global",
[VSystemID.Raw.Amiga] = "Amiga",
[VSystemID.Raw.Arcade] = "Arcade",
[VSystemID.Raw.INTV] = "Intellivision",
[VSystemID.Raw.NES] = "NES",
Expand Down Expand Up @@ -193,6 +194,8 @@ public void ResolveWithDefaults()

CommonEntriesFor(VSystemID.Raw.Sega32X, basePath: Path.Combine(".", "32X")),

CommonEntriesFor(VSystemID.Raw.Amiga, basePath: Path.Combine(".", "Amiga")),

CommonEntriesFor(VSystemID.Raw.A26, basePath: Path.Combine(".", "Atari 2600"), omitSaveRAM: true),

CommonEntriesFor(VSystemID.Raw.A78, basePath: Path.Combine(".", "Atari 7800")),
Expand Down
13 changes: 13 additions & 0 deletions src/BizHawk.Client.Common/movie/bk2/Bk2MnemonicLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,19 @@ public static string LookupAxis(string button, string systemId)
["F11"] = '1',
["F12"] = '2',
},
[VSystemID.Raw.Amiga] = new()
{
["Joystick Up"] = 'U',
["Joystick Down"] = 'D',
["Joystick Left"] = 'L',
["Joystick Right"] = 'R',
["Joystick Button 1"] = '1',
["Joystick Button 2"] = '2',
["Joystick Button 3"] = '3',
["Mouse Left Button"] = 'l',
["Mouse Middle Button"] = 'm',
["Mouse Right Button"] = 'r',
}
};

private static readonly Dictionary<string, string> BaseAxisLookupTable = new Dictionary<string, string>
Expand Down
1 change: 1 addition & 0 deletions src/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public partial class FirmwaresConfig : Form, IDialogParent
// Redundant with SystemLookup? Not so fast. That data drives things. This is one step abstracted. Don't be such a smart guy. Keep this redundant list up to date.
private static readonly Dictionary<string, string> SystemGroupNames = new Dictionary<string, string>
{
["Amiga"] = "Amiga",
["NES"] = "NES",
["SNES"] = "SNES",
["BSX"] = "SNES+Satellaview",
Expand Down
9 changes: 9 additions & 0 deletions src/BizHawk.Emulation.Common/Database/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,15 @@ public static GameInfo GetGameInfo(byte[] romData, string fileName)
game.System = VSystemID.Raw.TIC80;
break;

case ".ADF":
case ".ADZ":
case ".DMS":
case ".IPF":
case ".FDI":
case ".LHA":
game.System = VSystemID.Raw.Amiga;
break;

case ".32X":
game.System = VSystemID.Raw.Sega32X;
game.AddOption("32X", "true");
Expand Down
24 changes: 24 additions & 0 deletions src/BizHawk.Emulation.Common/Database/FirmwareDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,30 @@ void AddPatchAndMaybeReverse(FirmwarePatchOption fpo)
FirmwareAndOption("10C4173C2A7EB09C6579818F72EF18FA0B6D32DE", 4 * 1024 * 1024, "N64DD", "IPL_DEV", "64DD_IPL_DEV.bin", "N64DD Development IPL");
FirmwareAndOption("3C5B93CA231550C68693A14F03CEA8D5DBD1BE9E", 4 * 1024 * 1024, "N64DD", "IPL_USA", "64DD_IPL_USA.bin", "N64DD Prototype USA IPL");

Firmware("Amiga", "A500", "A500 Kickstart");
Option("Amiga", "A500", File("891E9A547772FE0C6C19B610BAF8BC4EA7FCB785", 262144, "amiga-os-130.rom", "Kickstart v1.3 r34.005 (1987-12)(Commodore)(A500-A1000-A2000-CDTV)[!]"), FirmwareOptionStatus.Ideal);
Option("Amiga", "A500", File("11F9E62CF299F72184835B7B2A70A16333FC0D88", 262144, "amiga-os-120.rom", "Kickstart v1.2 r33.180 (1986-10)(Commodore)(A500-A1000-A2000)[!]"));
Option("Amiga", "A500", File("3B7F1493B27E212830F989F26CA76C02049F09CA", 524288, "amiga-os-310-a600.rom", "Kickstart v3.1 r40.063 (1993-07)(Commodore)(A500-A600-A2000)[!]"));

Firmware("Amiga", "A600", "A500+/A600/A600HD Kickstart");
Option("Amiga", "A600", File("02843C4253BBD29ABA535B0AA3BD9A85034ECDE4", 524288, "amiga-os-205-a600.rom", "Kickstart v2.05 r37.350 (1992-04)(Commodore)(A600HD)[!]"), FirmwareOptionStatus.Ideal);
Option("Amiga", "A600", File("C5839F5CB98A7A8947065C3ED2F14F5F42E334A1", 524288, "amiga-os-204.rom", "Kickstart v2.04 r37.175 (1991-05)(Commodore)(A500+)[!]"));
Option("Amiga", "A600", File("3B7F1493B27E212830F989F26CA76C02049F09CA", 524288, "amiga-os-310-a600.rom", "Kickstart v3.1 r40.063 (1993-07)(Commodore)(A500-A600-A2000)[!]"));

Firmware("Amiga", "A1200", "A1200 Kickstart");
Option("Amiga", "A1200", File("E21545723FE8374E91342617604F1B3D703094F1", 524288, "amiga-os-310-a1200.rom", "Kickstart v3.1 r40.068 (1993-12)(Commodore)(A1200)[!]"), FirmwareOptionStatus.Ideal);
Option("Amiga", "A1200", File("70033828182FFFC7ED106E5373A8B89DDA76FAA5", 524288, "amiga-os-300-a1200.rom", "Kickstart v3.0 r39.106 (1992-09)(Commodore)(A1200)[!]"));

Firmware("Amiga", "A4000", "A4000/A4000T Kickstart");
Option("Amiga", "A4000", File("5FE04842D04A489720F0F4BB0E46948199406F49", 524288, "amiga-os-310-a4000.rom", "Kickstart v3.1 r40.068 (1993-12)(Commodore)(A4000)[!]"), FirmwareOptionStatus.Ideal);
Option("Amiga", "A4000", File("F0B4E9E29E12218C2D5BD7020E4E785297D91FD7", 524288, "amiga-os-300-a4000.rom", "Kickstart v3.0 r39.106 (1992-09)(Commodore)(A4000)[!]"));
Option("Amiga", "A4000", File("B0EC8B84D6768321E01209F11E6248F2F5281A21", 524288, "amiga-os-310-a4000t.rom", "Kickstart v3.1 r40.070 (1994-02)(Commodore)(A4000T)[!]"));

Firmware("Amiga", "CD32", "CD32 Kickstart");
Option("Amiga", "CD32", File("3525BE8887F79B5929E017B42380A79EDFEE542D", 524288, "amiga-os-310-cd32.rom", "Kickstart v3.1 r40.060 (1993-05)(Commodore)(CD32)[!].rom"), FirmwareOptionStatus.Ideal);
Firmware("Amiga", "CD32ext", "CD32 Extended ROM");
Option("Amiga", "CD32ext", File("5BEF3D628CE59CC02A66E6E4AE0DA48F60E78F7F", 524288, "amiga-os-310-cd32-ext.rom", "CD32 Extended-ROM r40.60 (1993)(Commodore)(CD32).rom"), FirmwareOptionStatus.Ideal);

/*Firmware("PS2", "BIOS", "PS2 Bios");
Option("PS2", "BIOS", File("FBD54BFC020AF34008B317DCB80B812DD29B3759", 4 * 1024 * 1024, "ps2-0230j-20080220.bin", "PS2 Bios"));
Option("PS2", "BIOS", File("8361D615CC895962E0F0838489337574DBDC9173", 4 * 1024 * 1024, "ps2-0220a-20060905.bin", "PS2 Bios"));
Expand Down
1 change: 1 addition & 0 deletions src/BizHawk.Emulation.Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static class EmulatorExtensions
/// <remarks>need to think about e.g. Genesis / Mega Drive using one sysID but having a different display name depending on the BIOS region --yoshi</remarks>
public static readonly IReadOnlyDictionary<string, string> SystemIDDisplayNames = new Dictionary<string, string>
{
[VSystemID.Raw.Amiga] = "Amiga",
[VSystemID.Raw.A26] = "Atari 2600",
[VSystemID.Raw.A78] = "Atari 7800",
[VSystemID.Raw.AmstradCPC] = "Amstrad CPC",
Expand Down
Loading
Loading