provide correct sysid in BsnesCore
This commit is contained in:
parent
f668e09048
commit
81fe56fa6e
|
@ -2067,20 +2067,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GBSubMenu.Visible = true;
|
GBSubMenu.Visible = true;
|
||||||
SameBoyColorChooserMenuItem.Visible = Emulator is Sameboy sameboy && !sameboy.IsCGBMode(); // palette config only works in DMG mode
|
SameBoyColorChooserMenuItem.Visible = Emulator is Sameboy sameboy && !sameboy.IsCGBMode(); // palette config only works in DMG mode
|
||||||
break;
|
break;
|
||||||
case VSystemID.Raw.SNES when Emulator is LibsnesCore { IsSGB: true }: // doesn't use "SGB" sysID
|
case VSystemID.Raw.SNES when Emulator is LibsnesCore or BsnesCore or SubBsnesCore:
|
||||||
SNESSubMenu.Text = "&SGB";
|
case VSystemID.Raw.SGB when Emulator is BsnesCore or SubBsnesCore:
|
||||||
SNESSubMenu.Visible = true;
|
|
||||||
break;
|
|
||||||
case VSystemID.Raw.SNES when Emulator is LibsnesCore { IsSGB: false }:
|
|
||||||
SNESSubMenu.Text = "&SNES";
|
|
||||||
SNESSubMenu.Visible = true;
|
|
||||||
break;
|
|
||||||
case VSystemID.Raw.SNES when Emulator is BsnesCore bsnesCore:
|
|
||||||
SNESSubMenu.Text = bsnesCore.IsSGB ? "&SGB" : "&SNES";
|
|
||||||
SNESSubMenu.Visible = true;
|
|
||||||
break;
|
|
||||||
case VSystemID.Raw.SNES when Emulator is SubBsnesCore subBsnesCore:
|
|
||||||
SNESSubMenu.Text = subBsnesCore.IsSGB ? "&SGB" : "&SNES";
|
|
||||||
SNESSubMenu.Visible = true;
|
SNESSubMenu.Visible = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -159,12 +159,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
VSystemID.Raw.SGX => ConsoleID.PCEngine, // ???
|
VSystemID.Raw.SGX => ConsoleID.PCEngine, // ???
|
||||||
VSystemID.Raw.SGXCD => ConsoleID.PCEngineCD, // ???
|
VSystemID.Raw.SGXCD => ConsoleID.PCEngineCD, // ???
|
||||||
VSystemID.Raw.SMS => ConsoleID.MasterSystem,
|
VSystemID.Raw.SMS => ConsoleID.MasterSystem,
|
||||||
VSystemID.Raw.SNES => Emu switch
|
VSystemID.Raw.SNES when Emu is LibsnesCore libsnes => libsnes.IsSGB ? ConsoleID.GB : ConsoleID.SNES,
|
||||||
{
|
VSystemID.Raw.SNES => ConsoleID.SNES,
|
||||||
LibsnesCore libsnes => libsnes.IsSGB ? ConsoleID.GB : ConsoleID.SNES,
|
|
||||||
BsnesCore bsnes => bsnes.IsSGB ? ConsoleID.GB : ConsoleID.SNES,
|
|
||||||
_ => ConsoleID.SNES,
|
|
||||||
},
|
|
||||||
VSystemID.Raw.TI83 => ConsoleID.UnknownConsoleID,
|
VSystemID.Raw.TI83 => ConsoleID.UnknownConsoleID,
|
||||||
VSystemID.Raw.TIC80 => ConsoleID.Tic80,
|
VSystemID.Raw.TIC80 => ConsoleID.Tic80,
|
||||||
VSystemID.Raw.UZE => ConsoleID.UnknownConsoleID,
|
VSystemID.Raw.UZE => ConsoleID.UnknownConsoleID,
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
|
|
||||||
public int Frame { get; private set; }
|
public int Frame { get; private set; }
|
||||||
|
|
||||||
public string SystemId => VSystemID.Raw.SNES;
|
public string SystemId { get; }
|
||||||
|
|
||||||
public bool DeterministicEmulation => true;
|
public bool DeterministicEmulation => true;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
address => Api.core.snes_bus_read((uint) address),
|
address => Api.core.snes_bus_read((uint) address),
|
||||||
(address, value) => Api.core.snes_bus_write((uint) address, value), wordSize: 4));
|
(address, value) => Api.core.snes_bus_write((uint) address, value), wordSize: 4));
|
||||||
|
|
||||||
if (IsSGB)
|
if (_isSGB)
|
||||||
{
|
{
|
||||||
foreach (int i in Enum.GetValues(typeof(BsnesApi.SGB_MEMORY)))
|
foreach (int i in Enum.GetValues(typeof(BsnesApi.SGB_MEMORY)))
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
_memoryDomains = new(mm);
|
_memoryDomains = new(mm);
|
||||||
((BasicServiceProvider) ServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
||||||
|
|
||||||
_memoryDomains.MainMemory = _memoryDomains[IsSGB ? "SGB WRAM" : "WRAM"];
|
_memoryDomains.MainMemory = _memoryDomains[_isSGB ? "SGB WRAM" : "WRAM"];
|
||||||
_memoryDomains.SystemBus = _memoryDomains[IsSGB ? "SGB System Bus" : "System Bus"];
|
_memoryDomains.SystemBus = _memoryDomains[_isSGB ? "SGB System Bus" : "System Bus"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
byte[] saveRamCopy = new byte[_saveRamSize];
|
byte[] saveRamCopy = new byte[_saveRamSize];
|
||||||
using (Api.exe.EnterExit())
|
using (Api.exe.EnterExit())
|
||||||
{
|
{
|
||||||
if (IsSGB)
|
if (_isSGB)
|
||||||
{
|
{
|
||||||
Api.core.snes_sgb_save_battery(saveRamCopy, _saveRamSize);
|
Api.core.snes_sgb_save_battery(saveRamCopy, _saveRamSize);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
|
|
||||||
using (Api.exe.EnterExit())
|
using (Api.exe.EnterExit())
|
||||||
{
|
{
|
||||||
if (IsSGB)
|
if (_isSGB)
|
||||||
{
|
{
|
||||||
Api.core.snes_sgb_load_battery(data, _saveRamSize);
|
Api.core.snes_sgb_load_battery(data, _saveRamSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double virtualWidth = BufferWidth * PixelAspectRatio;
|
double virtualWidth = BufferWidth * PixelAspectRatio;
|
||||||
if (!IsSGB && BufferWidth == 256 && (BufferHeight > 240 || _settings.AlwaysDoubleSize)) virtualWidth *= 2;
|
if (!_isSGB && BufferWidth == 256 && (BufferHeight > 240 || _settings.AlwaysDoubleSize)) virtualWidth *= 2;
|
||||||
|
|
||||||
return (int)Math.Round(virtualWidth);
|
return (int)Math.Round(virtualWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int VirtualHeight => !IsSGB && BufferHeight <= 240 && (BufferWidth > 256 || _settings.AlwaysDoubleSize) ? BufferHeight * 2 : BufferHeight;
|
public int VirtualHeight => !_isSGB && BufferHeight <= 240 && (BufferWidth > 256 || _settings.AlwaysDoubleSize) ? BufferHeight * 2 : BufferHeight;
|
||||||
|
|
||||||
public int BufferWidth { get; private set; } = 256;
|
public int BufferWidth { get; private set; } = 256;
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
CoreComm = loadParameters.Comm;
|
CoreComm = loadParameters.Comm;
|
||||||
_settings = loadParameters.Settings ?? new SnesSettings();
|
_settings = loadParameters.Settings ?? new SnesSettings();
|
||||||
_syncSettings = loadParameters.SyncSettings ?? new SnesSyncSettings();
|
_syncSettings = loadParameters.SyncSettings ?? new SnesSyncSettings();
|
||||||
|
SystemId = loadParameters.Game.System;
|
||||||
|
_isSGB = SystemId == VSystemID.Raw.SGB;
|
||||||
|
|
||||||
IsSGB = loadParameters.Game.System == VSystemID.Raw.SGB;
|
|
||||||
byte[] sgbRomData = null;
|
byte[] sgbRomData = null;
|
||||||
if (IsSGB)
|
if (_isSGB)
|
||||||
{
|
{
|
||||||
if ((loadParameters.Roms[0].RomData[0x143] & 0xc0) == 0xc0)
|
if ((loadParameters.Roms[0].RomData[0x143] & 0xc0) == 0xc0)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +85,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
InitAudio();
|
InitAudio();
|
||||||
ser.Register<ISoundProvider>(_soundProvider);
|
ser.Register<ISoundProvider>(_soundProvider);
|
||||||
|
|
||||||
if (IsSGB)
|
if (_isSGB)
|
||||||
{
|
{
|
||||||
Api.core.snes_load_cartridge_super_gameboy(sgbRomData, loadParameters.Roms[0].RomData,
|
Api.core.snes_load_cartridge_super_gameboy(sgbRomData, loadParameters.Roms[0].RomData,
|
||||||
sgbRomData!.Length, loadParameters.Roms[0].RomData.Length);
|
sgbRomData!.Length, loadParameters.Roms[0].RomData.Length);
|
||||||
|
@ -127,9 +128,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
private IController _controller;
|
private IController _controller;
|
||||||
private SimpleSyncSoundProvider _soundProvider;
|
private SimpleSyncSoundProvider _soundProvider;
|
||||||
private readonly string _romPath;
|
private readonly string _romPath;
|
||||||
|
private readonly bool _isSGB;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
public bool IsSGB { get; }
|
|
||||||
public string BoardName { get; }
|
public string BoardName { get; }
|
||||||
|
|
||||||
internal BsnesApi Api { get; }
|
internal BsnesApi Api { get; }
|
||||||
|
@ -201,7 +202,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
private void snes_no_lag(bool sgbPoll)
|
private void snes_no_lag(bool sgbPoll)
|
||||||
{
|
{
|
||||||
// gets called whenever there was input read in the core
|
// gets called whenever there was input read in the core
|
||||||
if (!IsSGB || sgbPoll)
|
if (!_isSGB || sgbPoll)
|
||||||
{
|
{
|
||||||
IsLagFrame = false;
|
IsLagFrame = false;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +245,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
private unsafe void snes_video_refresh(IntPtr data, int width, int height, int pitch)
|
private unsafe void snes_video_refresh(IntPtr data, int width, int height, int pitch)
|
||||||
{
|
{
|
||||||
ushort* vp = (ushort*)data;
|
ushort* vp = (ushort*)data;
|
||||||
if (_settings.CropSGBFrame && IsSGB)
|
if (_settings.CropSGBFrame && _isSGB)
|
||||||
{
|
{
|
||||||
BufferWidth = 160;
|
BufferWidth = 160;
|
||||||
BufferHeight = 144;
|
BufferHeight = 144;
|
||||||
|
@ -262,7 +263,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
}
|
}
|
||||||
|
|
||||||
int di = 0;
|
int di = 0;
|
||||||
if (_settings.CropSGBFrame && IsSGB)
|
if (_settings.CropSGBFrame && _isSGB)
|
||||||
{
|
{
|
||||||
int initialY = _settings.ShowOverscan ? 47 : 39;
|
int initialY = _settings.ShowOverscan ? 47 : 39;
|
||||||
for (int y = initialY; y < initialY + 144; y++)
|
for (int y = initialY; y < initialY + 144; y++)
|
||||||
|
|
|
@ -37,8 +37,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
|
||||||
|
|
||||||
private readonly BsnesCore _bsnesCore;
|
private readonly BsnesCore _bsnesCore;
|
||||||
|
|
||||||
public bool IsSGB => _bsnesCore.IsSGB;
|
|
||||||
|
|
||||||
public IEmulatorServiceProvider ServiceProvider { get; }
|
public IEmulatorServiceProvider ServiceProvider { get; }
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _bsnesCore.ControllerDefinition;
|
public ControllerDefinition ControllerDefinition => _bsnesCore.ControllerDefinition;
|
||||||
|
|
Loading…
Reference in New Issue