diff --git a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs index 2f89aed99fa..439c53e0213 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/MemoryDomain.cs @@ -108,7 +108,7 @@ public virtual void BulkPeekByte(Range addresses, byte[] values) if (addresses is null) throw new ArgumentNullException(paramName: nameof(addresses)); if (values is null) throw new ArgumentNullException(paramName: nameof(values)); - if ((long) addresses.Count() != values.Length) + if ((long) addresses.Count() > values.Length) { throw new InvalidOperationException("Invalid length of values array"); } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs index 6ee4c175da1..81840fdf6b0 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.IDebuggable.cs @@ -7,6 +7,24 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy { public partial class Gameboy : IDebuggable { + public ushort GetMapper(string bank) + { + switch(bank) + { + case "ROM0 BANK": + return (ushort)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.ROM0); + case "ROMX BANK": + return (ushort)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.ROMX); + case "VRAM BANK": + return (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.VRAM); + case "SRAM BANK": + return (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.SRAM); + case "WRAM BANK": + return (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.WRAM); + default: + throw new NotImplementedException(); + } + } public IDictionary GetCpuFlagsAndRegisters() { var data = new int[10]; @@ -24,12 +42,6 @@ public IDictionary GetCpuFlagsAndRegisters() ["F"] = (byte)(data[(int)LibGambatte.RegIndices.F] & 0xff), ["H"] = (byte)(data[(int)LibGambatte.RegIndices.H] & 0xff), ["L"] = (byte)(data[(int)LibGambatte.RegIndices.L] & 0xff), - // banks - ["ROM0 BANK"] = (ushort)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.ROM0), - ["ROMX BANK"] = (ushort)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.ROMX), - ["VRAM BANK"] = (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.VRAM), - ["SRAM BANK"] = (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.SRAM), - ["WRAM BANK"] = (byte)LibGambatte.gambatte_getbank(GambatteState, LibGambatte.BankType.WRAM), // todo: maybe do [bc]/[de]/[hl]? }; } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.IDebuggable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.IDebuggable.cs index d8767c047cb..128161ad9db 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.IDebuggable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES/LibsnesCore.IDebuggable.cs @@ -20,8 +20,6 @@ public IDictionary GetCpuFlagsAndRegisters() bool fz = (regs.p & 0x02) != 0; bool fc = (regs.p & 0x01) != 0; - Api.QUERY_peek_gb_banks(out var banks); - return new Dictionary { ["PC"] = regs.pc, @@ -41,7 +39,16 @@ public IDictionary GetCpuFlagsAndRegisters() ["Flag Z"] = fz, ["Flag C"] = fc, ["V"] = regs.v, - ["H"] = regs.h, + ["H"] = regs.h + }; + } + + public IDictionary GetBanks() + { + Api.QUERY_peek_gb_banks(out var banks); + + return new Dictionary + { ["ROM0 BANK"] = banks.rom0, ["ROMX BANK"] = banks.romx, ["VRAM BANK"] = banks.vram,