diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index 70ee04e8286..eb4f1136e75 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -482,8 +482,9 @@ private void LoadOther( ); return; } - - if (_config.PreferredCores[game.System] is CoreNames.Bsnes or CoreNames.Bsnes115 or CoreNames.SubBsnes115) + 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; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs index 34bd21002d6..f06075a25f1 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.ISettable.cs @@ -111,11 +111,11 @@ public enum ConsoleModeType GB, GBC, GBA, - SGB2 + SGB2, } [DisplayName("Console Mode")] - [Description("Pick which console to run, 'Auto' chooses from ROM header; 'GB', 'GBC', 'GBA', and 'SGB2' chooses the respective system.")] + [Description("Which console to emulate ('Auto' picks based on the rom header)")] [DefaultValue(ConsoleModeType.Auto)] public ConsoleModeType ConsoleMode { get; set; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IEmulator.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IEmulator.cs index e4dcb065a14..a1de6b526f6 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IEmulator.cs @@ -119,9 +119,13 @@ public bool FrameAdvance(IController controller, bool render, bool rendersound = } if (IsAnySgb) { - if (IsSgb(i)) // all SGB borders will be displayed when any of them has the option enabled + // all SGB borders will be displayed when any of them has the option enabled + if (IsSgb(i)) { - if (LibGambatte.gambatte_updatescreenborder(_linkedCores[i].GambatteState, svbuff + (i * 256), sgbPitch) != 0) + if (LibGambatte.gambatte_updatescreenborder( + _linkedCores[i].GambatteState, + svbuff + (i * 256), + sgbPitch) is not 0) { throw new InvalidOperationException($"{nameof(LibGambatte.gambatte_updatescreenborder)}() returned non-zero (border error???)"); } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs index 6072a009ad7..493fd0ef34d 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.IVideoProvider.cs @@ -4,13 +4,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy { public partial class GambatteLink : IVideoProvider { - public int VirtualWidth => (ShowAnyBorder() ? 256 : 160) * _numCores; + public int VirtualWidth + => (ShowAnyBorder() ? 256 : 160) * _numCores; - public int VirtualHeight => ShowAnyBorder() ? 224 : 144; + public int VirtualHeight + => ShowAnyBorder() ? 224 : 144; - public int BufferWidth => (ShowAnyBorder() ? 256 : 160) * _numCores; + public int BufferWidth + => VirtualWidth; - public int BufferHeight => ShowAnyBorder() ? 224 : 144; + public int BufferHeight + => VirtualHeight; public int VsyncNumerator => _linkedCores[P1].VsyncNumerator; @@ -21,9 +25,7 @@ public partial class GambatteLink : IVideoProvider private readonly int[] FrameBuffer; public int[] GetVideoBuffer() - { - return ShowAnyBorder() ? SgbVideoBuffer : VideoBuffer; - } + => ShowAnyBorder() ? SgbVideoBuffer : VideoBuffer; private readonly int[] VideoBuffer; @@ -40,12 +42,6 @@ private int[] CreateVideoBuffer() } private int[] CreateSGBVideoBuffer() - { - if (IsAnySgb) - { - return new int[256 * _numCores * 224]; - } - return null; - } + => IsAnySgb ? new int[256 * _numCores * 224] : null; } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs index 39eab1ac037..29a7c1dd526 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/GambatteLink.cs @@ -50,7 +50,7 @@ public GambatteLink(CoreLoadParameters _linkedCores[i].IsSgb; - public bool IsAnySgb { get; set; } + public bool IsAnySgb { get; private set; } private bool ShowBorder(int i) - { - return IsSgb(i) && _settings._linkedSettings[i].ShowBorder; - } + => IsSgb(i) && _settings._linkedSettings[i].ShowBorder; public bool ShowAnyBorder() { - return Enumerable.Range(0, _numCores).Any(ShowBorder); + for (var i = 0; i < _numCores; i++) if (ShowBorder(i)) return true; + return false; } private const int P1 = 0;