SubNESHawk: fix gambatte frameadvancepost, allow ppuviewer and nametableviewer

This commit is contained in:
alyosha-tas 2019-01-12 08:12:21 -06:00
parent c19c7cd5c3
commit 9fdeb9f5eb
3 changed files with 107 additions and 5 deletions

View File

@ -344,7 +344,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
LibGambatte.gambatte_setlayers(GambatteState, (_settings.DisplayBG ? 1 : 0) | (_settings.DisplayOBJ ? 2 : 0) | (_settings.DisplayWindow ? 4 : 0));
}
internal bool FrameAdvancePost()
internal void FrameAdvancePost()
{
if (IsLagFrame)
{
@ -352,8 +352,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
}
endofframecallback?.Invoke(LibGambatte.gambatte_cpuread(GambatteState, 0xff40));
return true;
}

View File

@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
public int cpuclockrate { get; private set; }
//user configuration
int[] palette_compiled = new int[64 * 8];
public int[] palette_compiled = new int[64 * 8];
//variable set when VS system games are running
internal bool _isVS = false;

View File

@ -13,7 +13,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
public partial class SubNESHawk : IEmulator, ISaveRam, IDebuggable, IStatable, IInputPollable, IRegionable,
ISettable<SubNESHawk.SubNESHawkSettings, SubNESHawk.SubNESHawkSyncSettings>
ISettable<SubNESHawk.SubNESHawkSettings, SubNESHawk.SubNESHawkSyncSettings>, INESPPUViewable
{
public NES.NES subnes;
@ -76,5 +76,109 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
{
MemoryCallbacks.CallExecutes(addr, "System Bus");
}
#region PPU Viewable
public int[] GetPalette()
{
return subnes.palette_compiled;
}
public bool BGBaseHigh
{
get { return subnes.ppu.reg_2000.bg_pattern_hi; }
}
public bool SPBaseHigh
{
get { return subnes.ppu.reg_2000.obj_pattern_hi; }
}
public bool SPTall
{
get { return subnes.ppu.reg_2000.obj_size_16; }
}
public byte[] GetPPUBus()
{
byte[] ret = new byte[0x3000];
for (int i = 0; i < 0x3000; i++)
{
ret[i] = subnes.ppu.ppubus_peek(i);
}
return ret;
}
public byte[] GetPalRam()
{
return subnes.ppu.PALRAM;
}
public byte[] GetOam()
{
return subnes.ppu.OAM;
}
public byte PeekPPU(int addr)
{
return subnes.Board.PeekPPU(addr);
}
public byte[] GetExTiles()
{
if (subnes.Board is ExROM)
{
return subnes.Board.VROM ?? subnes.Board.VRAM;
}
else
{
throw new InvalidOperationException();
}
}
public bool ExActive
{
get { return subnes.Board is ExROM && (subnes.Board as ExROM).ExAttrActive; }
}
public byte[] GetExRam()
{
if (subnes.Board is ExROM)
{
return (subnes.Board as ExROM).GetExRAMArray();
}
else
{
throw new InvalidOperationException();
}
}
public MemoryDomain GetCHRROM()
{
return _memoryDomains["CHR VROM"];
}
public void InstallCallback1(Action cb, int sl)
{
subnes.ppu.NTViewCallback = new PPU.DebugCallback { Callback = cb, Scanline = sl };
}
public void InstallCallback2(Action cb, int sl)
{
subnes.ppu.PPUViewCallback = new PPU.DebugCallback { Callback = cb, Scanline = sl };
}
public void RemoveCallback1()
{
subnes.ppu.NTViewCallback = null;
}
public void RemoveCallback2()
{
subnes.ppu.PPUViewCallback = null;
}
#endregion
}
}