Skip to content

Commit

Permalink
Remove special SGB handling and mark bsnes* as GB/GBC cores
Browse files Browse the repository at this point in the history
  • Loading branch information
Morilli committed Jun 19, 2024
1 parent ec1e462 commit 8a1a4c3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
11 changes: 0 additions & 11 deletions src/BizHawk.Client.Common/RomLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,6 @@ private void LoadOther(
);
return;
}
static bool IsPreferredCoreSGB(Config config)
=> config.PreferredCores[VSystemID.Raw.GB] is CoreNames.Bsnes or CoreNames.Bsnes115 or CoreNames.SubBsnes115;
if (IsPreferredCoreSGB(_config))
{
game.System = VSystemID.Raw.SGB;
}
break;
case VSystemID.Raw.PSX when ext is ".bin":
const string FILE_EXT_CUE = ".cue";
Expand Down Expand Up @@ -853,11 +847,6 @@ private void DispatchErrorMessage(Exception ex, string system, string path)
{
DoLoadErrorCallback(ex.Message, system, path, Deterministic, LoadErrorType.MissingFirmware);
}
else if (ex is CGBNotSupportedException)
{
// failed to load SGB bios or game does not support SGB mode.
DoLoadErrorCallback("Failed to load a GB rom in SGB mode. You might try disabling SGB Mode.", system);
}
else if (ex is NoAvailableCoreException)
{
// handle exceptions thrown by the new detected systems that BizHawk does not have cores for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public partial class BsnesCore : IEmulator, IDebuggable, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ISettable<BsnesCore.SnesSettings, BsnesCore.SnesSyncSettings>, IBSNESForGfxDebugger, IBoardInfo
{
[CoreConstructor(VSystemID.Raw.GB)]
[CoreConstructor(VSystemID.Raw.GBC)]
[CoreConstructor(VSystemID.Raw.Satellaview)]
[CoreConstructor(VSystemID.Raw.SGB)]
[CoreConstructor(VSystemID.Raw.SNES)]
public BsnesCore(CoreLoadParameters<SnesSettings, SnesSyncSettings> loadParameters) : this(loadParameters, false) { }
public BsnesCore(CoreLoadParameters<SnesSettings, SnesSyncSettings> loadParameters, bool subframe = false)
Expand All @@ -29,8 +30,8 @@ public BsnesCore(CoreLoadParameters<SnesSettings, SnesSyncSettings> loadParamete
this._romPath = Path.ChangeExtension(loadParameters.Roms[0].RomPath, null);
CoreComm = loadParameters.Comm;
_syncSettings = loadParameters.SyncSettings ?? new SnesSyncSettings();
SystemId = loadParameters.Game.System;
_isSGB = SystemId == VSystemID.Raw.SGB;
_isSGB = loadParameters.Game.System is VSystemID.Raw.GB or VSystemID.Raw.GBC;
SystemId = _isSGB ? VSystemID.Raw.SGB : loadParameters.Game.System;
_currentMsuTrack = new ProxiedFile();

byte[] sgbRomData = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
[ServiceNotApplicable(new[] { typeof(IDriveLight) })]
public class SubBsnesCore : IEmulator, ICycleTiming
{
[CoreConstructor(VSystemID.Raw.GB)]
[CoreConstructor(VSystemID.Raw.GBC)]
[CoreConstructor(VSystemID.Raw.Satellaview)]
[CoreConstructor(VSystemID.Raw.SGB)]
[CoreConstructor(VSystemID.Raw.SNES)]
public SubBsnesCore(CoreLoadParameters<BsnesCore.SnesSettings, BsnesCore.SnesSyncSettings> loadParameters)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
public unsafe partial class LibsnesCore : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ICodeDataLogger,
IDebuggable, ISettable<LibsnesCore.SnesSettings, LibsnesCore.SnesSyncSettings>, IBSNESForGfxDebugger
{
[CoreConstructor(VSystemID.Raw.SGB)]
[CoreConstructor(VSystemID.Raw.GB)]
[CoreConstructor(VSystemID.Raw.GBC)]
[CoreConstructor(VSystemID.Raw.SNES)]
public LibsnesCore(GameInfo game, byte[] rom, CoreComm comm,
LibsnesCore.SnesSettings settings, LibsnesCore.SnesSyncSettings syncSettings)
Expand All @@ -45,8 +46,9 @@ public LibsnesCore(GameInfo game, byte[] romData, byte[] xmlData, string baseRom
_game = game;
CoreComm = comm;
byte[] sgbRomData = null;
IsSGB = game.System is VSystemID.Raw.GB or VSystemID.Raw.GBC;

if (game.System == VSystemID.Raw.SGB)
if (IsSGB)
{
if ((romData[0x143] & 0xc0) == 0xc0)
{
Expand Down Expand Up @@ -110,9 +112,8 @@ public LibsnesCore(GameInfo game, byte[] romData, byte[] xmlData, string baseRom
romData = newData;
}

if (game.System == VSystemID.Raw.SGB)
if (IsSGB)
{
IsSGB = true;
SystemId = VSystemID.Raw.SNES;
ser.Register<IBoardInfo>(new SGBBoardInfo());

Expand Down

0 comments on commit 8a1a4c3

Please sign in to comment.