diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index f200484bb6..e42b619435 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -418,14 +418,13 @@ namespace BizHawk.Client.Common rom = new RomGame(file); // hacky for now - if (file.Extension == ".exe") + rom.GameInfo.System = file.Extension switch { - rom.GameInfo.System = VSystemID.Raw.PSX; - } - else if (file.Extension == ".nsf") - { - rom.GameInfo.System = VSystemID.Raw.NES; - } + ".exe" => VSystemID.Raw.PSX, + ".nsf" => VSystemID.Raw.NES, + ".gbs" => VSystemID.Raw.GB, + _ => rom.GameInfo.System, + }; Util.DebugWriteLine(rom.GameInfo.System); @@ -460,6 +459,18 @@ namespace BizHawk.Client.Common { case VSystemID.Raw.GB: case VSystemID.Raw.GBC: + if (file.Extension == ".gbs") + { + nextEmulator = new Sameboy( + nextComm, + rom.GameInfo, + rom.FileData, + GetCoreSettings(), + GetCoreSyncSettings() + ); + return; + } + if (_config.GbAsSgb) { game.System = VSystemID.Raw.SGB; @@ -494,19 +505,6 @@ namespace BizHawk.Client.Common nextEmulator = MakeCoreFromCoreInventory(cip, forcedCoreName); } - private void LoadGBS(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out RomGame rom, out GameInfo game) - { - rom = new RomGame(file); - rom.GameInfo.System = VSystemID.Raw.GB; - game = rom.GameInfo; - nextEmulator = new Sameboy( - nextComm, - rom.FileData, - GetCoreSettings(), - GetCoreSyncSettings() - ); - } - private void LoadPSF(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out RomGame rom, out GameInfo game) { // TODO: Why does the PSF loader need CbDeflater provided? Surely this is a matter internal to it. @@ -693,9 +691,6 @@ namespace BizHawk.Client.Common if (!LoadXML(path, nextComm, file, forcedCoreName, out nextEmulator, out rom, out game)) return false; break; - case ".gbs": - LoadGBS(path, nextComm, file, out nextEmulator, out rom, out game); - break; case ".psf": case ".minipsf": LoadPSF(path, nextComm, file, out nextEmulator, out rom, out game); @@ -875,7 +870,7 @@ namespace BizHawk.Client.Common /// TODO add and handle (you can drag-and-drop scripts and there are already non-rom things in this list, so why not?) private static readonly FilesystemFilterSet RomFSFilterSet = new FilesystemFilterSet( - new FilesystemFilter("Music Files", Array.Empty(), devBuildExtraExts: new[] { "psf", "minipsf", "sid", "nsf" }), + new FilesystemFilter("Music Files", Array.Empty(), devBuildExtraExts: new[] { "psf", "minipsf", "sid", "nsf", "gbs" }), new FilesystemFilter("Disc Images", new[] { "cue", "ccd", "mds", "m3u" }), new FilesystemFilter("NES", RomFileExtensions.NES.Concat(new[] { "nsf" }).ToList(), addArchiveExts: true), new FilesystemFilter("Super NES", RomFileExtensions.SNES, addArchiveExts: true), @@ -883,7 +878,7 @@ namespace BizHawk.Client.Common new FilesystemFilter("PSX Executables (experimental)", Array.Empty(), devBuildExtraExts: new[] { "exe" }), new FilesystemFilter("PSF Playstation Sound File", new[] { "psf", "minipsf" }), new FilesystemFilter("Nintendo 64", RomFileExtensions.N64), - new FilesystemFilter("Gameboy", RomFileExtensions.GB, addArchiveExts: true), + new FilesystemFilter("Gameboy", RomFileExtensions.GB.Concat(new[] { "gbs" }).ToList(), addArchiveExts: true), new FilesystemFilter("Gameboy Advance", RomFileExtensions.GBA, addArchiveExts: true), new FilesystemFilter("Nintendo DS", RomFileExtensions.NDS), new FilesystemFilter("Master System", RomFileExtensions.SMS, addArchiveExts: true), diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs index 3819256e82..4ec62395a3 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SameBoy/SameBoy.cs @@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy /// /// a gameboy/gameboy color emulator wrapped around native C libsameboy /// - [PortedCore(CoreNames.Sameboy, "LIJI32", "0.15.1", "https://github.com/LIJI32/SameBoy")] + [PortedCore(CoreNames.Sameboy, "LIJI32", "0.15.6", "https://github.com/LIJI32/SameBoy")] [ServiceNotApplicable(new[] { typeof(IDriveLight) })] public partial class Sameboy : ICycleTiming, IInputPollable, ILinkable, IRomInfo, IBoardInfo, IGameboyCommon { @@ -44,8 +44,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Sameboy private readonly LibSameboy.RumbleCallback _rumblecb; - public Sameboy(CoreComm comm, byte[] gbs, SameboySettings settings, SameboySyncSettings syncSettings) - : this(comm, GameInfo.NullInstance, null, settings, syncSettings, false) + public Sameboy(CoreComm comm, GameInfo game, byte[] gbs, SameboySettings settings, SameboySyncSettings syncSettings) + : this(comm, game, null, settings, syncSettings, false) { var gbsInfo = new LibSameboy.GBSInfo {