Debugger: Tilemap Viewer - Fixed scroll overlay size (large tiles vs large screen bug)

This commit is contained in:
Sour 2019-07-16 21:21:10 -04:00
parent 904d514cf1
commit cd5792ebf5
4 changed files with 17 additions and 5 deletions

View file

@ -122,6 +122,8 @@ void Ppu::GetState(PpuState &state, bool returnPartialState)
state.OverscanMode = _overscanMode;
state.BgMode = _bgMode;
state.DirectColorMode = _directColorMode;
state.HiResMode = _hiResMode;
state.ScreenInterlace = _screenInterlace;
state.Mode7 = _mode7;
state.Layers[0] = _layerConfig[0];
state.Layers[1] = _layerConfig[1];

View file

@ -90,6 +90,8 @@ struct PpuState
uint8_t BgMode;
bool DirectColorMode;
bool HiResMode;
bool ScreenInterlace;
Mode7Config Mode7;
LayerConfig Layers[4];

View file

@ -138,6 +138,16 @@ namespace Mesen.GUI.Debugger
_cgram = DebugApi.GetMemoryState(SnesMemoryType.CGRam);
}
private bool IsDoubleWidthScreen
{
get { return _state.Ppu.HiResMode || _state.Ppu.BgMode == 5 || _state.Ppu.BgMode == 6; }
}
private bool IsDoubleHeightScreen
{
get { return _state.Ppu.ScreenInterlace || _state.Ppu.BgMode == 5 || _state.Ppu.BgMode == 6; }
}
private bool IsLargeTileWidth
{
get { return _state.Ppu.Layers[_options.Layer].LargeTiles || _state.Ppu.BgMode == 5 || _state.Ppu.BgMode == 6; }
@ -225,14 +235,10 @@ namespace Mesen.GUI.Debugger
if(chkShowScrollOverlay.Checked) {
LayerConfig layer = _state.Ppu.Layers[_options.Layer];
bool largeTileWidth = layer.LargeTiles || _state.Ppu.BgMode == 5 || _state.Ppu.BgMode == 6;
bool largeTileHeight = layer.LargeTiles;
int hScroll = _state.Ppu.BgMode == 7 ? (int)_state.Ppu.Mode7.HScroll : layer.HScroll;
int vScroll = _state.Ppu.BgMode == 7 ? (int)_state.Ppu.Mode7.VScroll : layer.VScroll;
int height = _state.Ppu.OverscanMode ? 239 : 224;
ctrlImagePanel.Overlay = new Rectangle(hScroll, vScroll, largeTileWidth ? 512 : 256, largeTileHeight ? height*2 : height);
ctrlImagePanel.Overlay = new Rectangle(hScroll, vScroll, IsDoubleWidthScreen ? 512 : 256, IsDoubleHeightScreen ? height*2 : height);
} else {
ctrlImagePanel.Overlay = Rectangle.Empty;
}

View file

@ -290,6 +290,8 @@ namespace Mesen.GUI
public byte BgMode;
[MarshalAs(UnmanagedType.I1)] public bool DirectColorMode;
[MarshalAs(UnmanagedType.I1)] public bool HiResMode;
[MarshalAs(UnmanagedType.I1)] public bool ScreenInterlace;
public Mode7Config Mode7;