snesgfxdebugger-layer toggles, more information

This commit is contained in:
zeromus 2012-11-26 06:30:30 +00:00
parent 07ae382ac4
commit 0c58d62762
9 changed files with 1412 additions and 476 deletions

View File

@ -200,6 +200,27 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
OBSEL_NAMEBASE = 50,
OBSEL_NAMESEL = 51,
OBSEL_SIZE = 52,
//$2131 CGADSUB
CGADSUB_MODE = 60,
CGADSUB_HALF = 61,
CGADSUB_BG4 = 62,
CGADSUB_BG3 = 63,
CGADSUB_BG2 = 64,
CGADSUB_BG1 = 65,
CGADSUB_OBJ = 66,
CGADSUB_BACKDROP = 67,
//$212C TM
TM_BG1 =70,
TM_BG2 =71,
TM_BG3 =72,
TM_BG4 =73,
TM_OBJ =74,
//$212D TM
TS_BG1 =80,
TS_BG2 =81,
TS_BG3 =82,
TS_BG4 =83,
TS_OBJ =84
}
public enum SNES_MEMORY : uint

View File

@ -125,6 +125,21 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
/// </summary>
public int TILESIZE;
/// <summary>
/// enabled on MAIN Screen via $212C
/// </summary>
public bool MainEnabled;
/// <summary>
/// enabled on SUB Screen via $212D
/// </summary>
public bool SubEnabled;
/// <summary>
/// enabled for color math via $2131
/// </summary>
public bool MathEnabled;
/// <summary>
/// TileSize; 8 or 16
/// </summary>
@ -216,6 +231,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public ModeInfo Mode = new ModeInfo();
public bool Mode1_BG3_Priority { private set; get; }
public bool SETINI_Mode7ExtBG { private set; get; }
public bool SETINI_HiRes { private set; get; }
public bool SETINI_Overscan { private set; get; }
@ -226,6 +243,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public int CGWSEL_ColorSubMask { private set; get; }
public int CGWSEL_AddSubMode { private set; get; }
public bool CGWSEL_DirectColor { private set; get; }
public int CGADSUB_AddSub { private set; get; }
public bool CGADSUB_Half { private set; get; }
public int OBSEL_Size { private set; get; }
public int OBSEL_NameSel { private set; get; }
@ -234,10 +253,17 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public int OBJTable0Addr { private set; get; }
public int OBJTable1Addr { private set; get; }
public bool OBJ_MainEnabled { private set; get; }
public bool OBJ_SubEnabled { private set; get; }
public bool OBJ_MathEnabled { private set; get; }
public bool BK_MathEnabled { private set; get; }
public static ScreenInfo GetScreenInfo()
{
var si = new ScreenInfo();
si.Mode1_BG3_Priority = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG3_PRIORITY) == 1;
si.OBSEL_Size = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.OBSEL_SIZE);
si.OBSEL_NameSel = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.OBSEL_NAMESEL);
si.OBSEL_NameBase = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.OBSEL_NAMEBASE);
@ -256,6 +282,14 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
si.CGWSEL_AddSubMode = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGWSEL_ADDSUBMODE);
si.CGWSEL_DirectColor = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGWSEL_DIRECTCOLOR) == 1;
si.CGADSUB_AddSub = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_MODE);
si.CGADSUB_Half = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_HALF) == 1;
si.OBJ_MainEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TM_OBJ) == 1;
si.OBJ_SubEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TS_OBJ) == 1;
si.OBJ_MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_OBJ) == 1;
si.BK_MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_BACKDROP) == 1;
si.Mode.MODE = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG_MODE);
si.BG.BG1.Bpp = ModeBpps[si.Mode.MODE, 0];
si.BG.BG2.Bpp = ModeBpps[si.Mode.MODE, 1];
@ -283,6 +317,19 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
si.BG.BG3.TDADDR = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG3_TDADDR);
si.BG.BG4.TDADDR = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG4_TDADDR);
si.BG.BG1.MainEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TM_BG1) == 1;
si.BG.BG2.MainEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TM_BG2) == 1;
si.BG.BG3.MainEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TM_BG3) == 1;
si.BG.BG4.MainEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TM_BG4) == 1;
si.BG.BG1.SubEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TS_BG1) == 1;
si.BG.BG2.SubEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TS_BG2) == 1;
si.BG.BG3.SubEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TS_BG3) == 1;
si.BG.BG4.SubEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.TS_BG4) == 1;
si.BG.BG1.MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_BG1) == 1;
si.BG.BG2.MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_BG2) == 1;
si.BG.BG3.MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_BG3) == 1;
si.BG.BG4.MathEnabled = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.CGADSUB_BG4) == 1;
for (int i = 1; i <= 4; i++)
si.BG[i].Mode = si.Mode.MODE;
@ -400,6 +447,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public ushort tilenum;
public byte palette;
public TileEntryFlags flags;
public int address;
}
public enum TileEntryFlags : byte
@ -540,6 +588,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
buf[idx].tilenum = (ushort)(entry & 0x3FF);
buf[idx].palette = (byte)((entry >> 10) & 7);
buf[idx].flags = (TileEntryFlags)((entry >> 13) & 7);
buf[idx].address = addr;
addr += 2;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Emulation.Consoles.Nintendo.SNES;
using BizHawk.Core;
namespace BizHawk.MultiClient
{
@ -142,10 +143,11 @@ namespace BizHawk.MultiClient
currentSnesCore.ScanlineHookManager.Unregister(this);
}
if(currentSnesCore != core)
if(currentSnesCore != core && core != null)
{
suppression = true;
comboPalette.SelectedValue = core.CurrPalette;
RefreshBGENCheckStatesFromConfig();
suppression = false;
}
@ -206,6 +208,9 @@ namespace BizHawk.MultiClient
txtScreenCGWSEL_ColorSubMask.Text = si.CGWSEL_ColorSubMask.ToString();
txtScreenCGWSEL_MathFixed.Text = si.CGWSEL_AddSubMode.ToString();
checkScreenCGWSEL_DirectColor.Checked = si.CGWSEL_DirectColor;
txtScreenCGADSUB_AddSub.Text = si.CGWSEL_AddSubMode.ToString();
txtScreenCGADSUB_AddSub_Descr.Text = si.CGADSUB_AddSub == 1 ? "SUB" : "ADD";
txtScreenCGADSUB_Half.Checked = si.CGADSUB_Half;
txtModeBits.Text = si.Mode.MODE.ToString();
txtScreenBG1Bpp.Text = FormatBpp(si.BG.BG1.Bpp);
@ -219,28 +224,68 @@ namespace BizHawk.MultiClient
int bgnum = comboBGProps.SelectedIndex + 1;
txtBG1TSizeBits.Text = si.BG[bgnum].TILESIZE.ToString();
txtBG1TSizeDescr.Text = string.Format("{0}x{0}", si.BG[bgnum].TileSize);
txtBG1Bpp.Text = FormatBpp(si.BG[bgnum].Bpp);
txtBG1SizeBits.Text = si.BG[bgnum].SCSIZE.ToString();
txtBG1SizeInTiles.Text = FormatScreenSizeInTiles(si.BG[bgnum].ScreenSize);
txtBG1SCAddrBits.Text = si.BG[bgnum].SCADDR.ToString();
txtBG1SCAddrDescr.Text = FormatVramAddress(si.BG[bgnum].SCADDR << 9);
txtBG1Colors.Text = (1 << si.BG[bgnum].Bpp).ToString();
if (si.BG[bgnum].Bpp == 8 && si.CGWSEL_DirectColor) txtBG1Colors.Text = "(Direct Color)";
txtBG1TDAddrBits.Text = si.BG[bgnum].TDADDR.ToString();
txtBG1TDAddrDescr.Text = FormatVramAddress(si.BG[bgnum].TDADDR << 13);
var bg = si.BG[bgnum];
txtBG1TSizeBits.Text = bg.TILESIZE.ToString();
txtBG1TSizeDescr.Text = string.Format("{0}x{0}", bg.TileSize);
txtBG1Bpp.Text = FormatBpp(bg.Bpp);
txtBG1SizeBits.Text = bg.SCSIZE.ToString();
txtBG1SizeInTiles.Text = FormatScreenSizeInTiles(bg.ScreenSize);
txtBG1SCAddrBits.Text = bg.SCADDR.ToString();
txtBG1SCAddrDescr.Text = FormatVramAddress(bg.SCADDR << 9);
txtBG1Colors.Text = (1 << bg.Bpp).ToString();
if (bg.Bpp == 8 && si.CGWSEL_DirectColor) txtBG1Colors.Text = "(Direct Color)";
txtBG1TDAddrBits.Text = bg.TDADDR.ToString();
txtBG1TDAddrDescr.Text = FormatVramAddress(bg.TDADDR << 13);
var sizeInPixels = SNESGraphicsDecoder.SizeInTilesForBGSize(si.BG[bgnum].ScreenSize);
if (bg.Bpp != 0)
{
var pi = bg.PaletteSelection;
txtBGPaletteInfo.Text = string.Format("{0} colors from ${1:X2} - ${2:X2}", pi.size, pi.start, pi.start + pi.size - 1);
}
else txtBGPaletteInfo.Text = "";
var sizeInPixels = SNESGraphicsDecoder.SizeInTilesForBGSize(bg.ScreenSize);
sizeInPixels.Width *= si.BG[bgnum].TileSize;
sizeInPixels.Height *= si.BG[bgnum].TileSize;
txtBG1SizeInPixels.Text = string.Format("{0}x{1}", sizeInPixels.Width, sizeInPixels.Height);
checkTMOBJ.Checked = si.OBJ_MainEnabled;
checkTMBG1.Checked = si.BG.BG1.MainEnabled;
checkTMBG2.Checked = si.BG.BG2.MainEnabled;
checkTMBG3.Checked = si.BG.BG3.MainEnabled;
checkTMBG4.Checked = si.BG.BG4.MainEnabled;
checkTMOBJ.Checked = si.OBJ_SubEnabled;
checkTSBG1.Checked = si.BG.BG1.SubEnabled;
checkTSBG2.Checked = si.BG.BG2.SubEnabled;
checkTSBG3.Checked = si.BG.BG3.SubEnabled;
checkTSBG4.Checked = si.BG.BG4.SubEnabled;
checkTSOBJ.Checked = si.OBJ_MainEnabled;
checkMathOBJ.Checked = si.OBJ_MathEnabled;
checkMathBK.Checked = si.BK_MathEnabled;
checkMathBG1.Checked = si.BG.BG1.MathEnabled;
checkMathBG2.Checked = si.BG.BG2.MathEnabled;
checkMathBG3.Checked = si.BG.BG3.MathEnabled;
checkMathBG4.Checked = si.BG.BG4.MathEnabled;
if (si.Mode.MODE == 1 && si.Mode1_BG3_Priority)
{
lblBG3.ForeColor = Color.Red;
if(toolTip1.GetToolTip(lblBG3) != "Mode 1 BG3 priority toggle bit of $2105 is SET")
toolTip1.SetToolTip(lblBG3, "Mode 1 BG3 priority toggle bit of $2105 is SET");
}
else
{
lblBG3.ForeColor = Color.Black;
if (toolTip1.GetToolTip(lblBG3) != "Mode 1 BG3 priority toggle bit of $2105 is CLEAR")
toolTip1.SetToolTip(lblBG3, "Mode 1 BG3 priority toggle bit of $2105 is CLEAR");
}
SyncColorSelection();
RenderView();
RenderPalette();
RenderTileView();
UpdateColorDetails();
UpdateMapEntryDetails();
}
eDisplayType CurrDisplaySelection { get { return (comboDisplayType.SelectedValue as eDisplayType?).Value; } }
@ -621,6 +666,28 @@ namespace BizHawk.MultiClient
paletteViewer.SetBitmap(bmp);
}
void UpdateMapEntryDetails()
{
if (currMapEntryState == null) return;
txtMapEntryLocation.Text = string.Format("({0},{1}), @{2:X4}", currMapEntryState.Location.X, currMapEntryState.Location.Y, currMapEntryState.entry.address);
txtMapEntryTileNum.Text = string.Format("${0:X3}", currMapEntryState.entry.tilenum);
txtMapEntryPrio.Text = string.Format("{0}", (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Priority)!=0?1:0);
txtMapEntryPalette.Text = string.Format("{0}", currMapEntryState.entry.palette);
checkMapEntryHFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Horz) != 0;
checkMapEntryVFlip.Checked = (currMapEntryState.entry.flags & SNESGraphicsDecoder.TileEntryFlags.Vert) != 0;
//calculate address of tile
var bg = si.BG[currMapEntryState.bgnum];
int bpp = bg.Bpp;
int tiledataBaseAddr = bg.TiledataAddr;
int tileSizeBytes = 8 * bpp;
int baseTileNum = tiledataBaseAddr / tileSizeBytes;
int tileNum = baseTileNum + currMapEntryState.entry.tilenum;
int addr = tileNum * tileSizeBytes;
addr &= 0xFFFF;
txtMapEntryTileAddr.Text = "@" + addr.ToHexString(4);
}
void UpdateColorDetails()
{
int rgb555 = lastPalette[lastColorNum];
@ -632,13 +699,15 @@ namespace BizHawk.MultiClient
txtDetailsPaletteColorHex.Text = string.Format("#{0:X6}", color & 0xFFFFFF);
txtDetailsPaletteColorRGB.Text = string.Format("({0},{1},{2})", (color >> 16) & 0xFF, (color >> 8) & 0xFF, (color & 0xFF));
if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG Palette:)"; else lblDetailsOBJOrBG.Text = "(OBJ Palette:)";
if (lastColorNum < 128) lblDetailsOBJOrBG.Text = "(BG:)"; else lblDetailsOBJOrBG.Text = "(OBJ:)";
txtPaletteDetailsIndexHex.Text = string.Format("${0:X2}", lastColorNum);
txtPaletteDetailsIndexHexSpecific.Text = string.Format("${0:X2}", lastColorNum & 0x7F);
txtPaletteDetailsIndex.Text = string.Format("{0}", lastColorNum);
txtPaletteDetailsIndexSpecific.Text = string.Format("{0}", lastColorNum & 0x7F);
txtPaletteDetailsAddress.Text = string.Format("${0:X3}", lastColorNum * 2);
string test = string.Format(@"Pal# ${0:X2} @{1:X3}", lastColorNum, lastColorNum * 2);
}
@ -710,7 +779,7 @@ namespace BizHawk.MultiClient
{
viewerPan = true;
panStartLocation = viewer.PointToScreen(e.Location);
this.Cursor = Cursors.Hand;
this.Cursor = Cursors.SizeAll;
}
}
@ -718,6 +787,7 @@ namespace BizHawk.MultiClient
{
viewerPan = false;
viewer.Capture = false;
this.Cursor = Cursors.Default;
}
private void viewer_MouseMove(object sender, MouseEventArgs e)
@ -742,12 +812,13 @@ namespace BizHawk.MultiClient
}
}
class TileViewerBGState
class MapEntryState
{
public SNESGraphicsDecoder.TileEntry entry;
public int bgnum;
public Point Location;
}
TileViewerBGState currTileViewerBGState;
MapEntryState currMapEntryState;
int currViewingTile = -1;
int currViewingTileBpp = -1;
int currViewingSprite = -1;
@ -755,17 +826,17 @@ namespace BizHawk.MultiClient
{
//TODO - blech - handle invalid some other way with a dedicated black-setter
bool valid = currViewingTile != -1;
valid |= (currTileViewerBGState != null);
valid |= (currMapEntryState != null);
if (!valid && !force) return;
if (currTileViewerBGState != null)
if (currMapEntryState != null)
{
//view a BG tile (no mode7 support yet) - itd be nice if we could generalize this code a bit
//TODO - choose correct palette (commonize that code)
int paletteStart = 0;
var bmp = new Bitmap(8, 8, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bmpdata = bmp.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
var bgs = currTileViewerBGState;
var bgs = currMapEntryState;
var oneTileEntry = new SNESGraphicsDecoder.TileEntry[] { bgs.entry };
if (valid)
{
@ -775,7 +846,7 @@ namespace BizHawk.MultiClient
}
bmp.UnlockBits(bmpdata);
viewerTile.SetBitmap(bmp);
viewerMapEntryTile.SetBitmap(bmp);
}
else
{
@ -792,7 +863,7 @@ namespace BizHawk.MultiClient
void UpdateViewerMouseover(Point loc)
{
currTileViewerBGState = null;
currMapEntryState = null;
currViewingTile = -1;
currViewingTileBpp = -1;
int tx = loc.X / 8;
@ -821,9 +892,10 @@ namespace BizHawk.MultiClient
int tloc = ty * bg.ScreenSizeInTiles.Width + tx;
if (tloc > map.Length) break;
currTileViewerBGState = new TileViewerBGState();
currTileViewerBGState.bgnum = (int)CurrDisplaySelection;
currTileViewerBGState.entry = map[tloc];
currMapEntryState = new MapEntryState();
currMapEntryState.bgnum = (int)CurrDisplaySelection;
currMapEntryState.entry = map[tloc];
currMapEntryState.Location = new Point(tx, ty);
//public void DecodeBG(int* screen, int stride, TileEntry[] map, int tiledataBaseAddr, ScreenSize size, int bpp, int tilesize, int paletteStart)
@ -927,7 +999,7 @@ namespace BizHawk.MultiClient
Control found = null;
do
{
found = top.GetChildAtPoint(top.PointToClient(m));
found = top.GetChildAtPoint(top.PointToClient(m), GetChildAtPointSkip.Invisible);
top = found;
} while (found != null && found.HasChildren);
@ -965,6 +1037,62 @@ namespace BizHawk.MultiClient
RenderTileView();
}
void RefreshBGENCheckStatesFromConfig()
{
checkEN0_BG1.Checked = Global.Config.SNES_ShowBG1_0;
checkEN0_BG2.Checked = Global.Config.SNES_ShowBG2_0;
checkEN0_BG3.Checked = Global.Config.SNES_ShowBG3_0;
checkEN0_BG4.Checked = Global.Config.SNES_ShowBG4_0;
checkEN1_BG1.Checked = Global.Config.SNES_ShowBG1_1;
checkEN1_BG2.Checked = Global.Config.SNES_ShowBG2_1;
checkEN1_BG3.Checked = Global.Config.SNES_ShowBG3_1;
checkEN1_BG4.Checked = Global.Config.SNES_ShowBG4_1;
checkEN0_OBJ.Checked = Global.Config.SNES_ShowOBJ1;
checkEN1_OBJ.Checked = Global.Config.SNES_ShowOBJ2;
checkEN2_OBJ.Checked = Global.Config.SNES_ShowOBJ3;
checkEN3_OBJ.Checked = Global.Config.SNES_ShowOBJ4;
}
private void checkEN_CheckedChanged(object sender, EventArgs e)
{
if(suppression) return;
if (sender == checkEN0_BG1) Global.Config.SNES_ShowBG1_0 = checkEN0_BG1.Checked;
if (sender == checkEN0_BG2) Global.Config.SNES_ShowBG2_0 = checkEN0_BG2.Checked;
if (sender == checkEN0_BG3) Global.Config.SNES_ShowBG3_0 = checkEN0_BG3.Checked;
if (sender == checkEN0_BG4) Global.Config.SNES_ShowBG4_0 = checkEN0_BG4.Checked;
if (sender == checkEN1_BG1) Global.Config.SNES_ShowBG1_1 = checkEN1_BG1.Checked;
if (sender == checkEN1_BG2) Global.Config.SNES_ShowBG2_1 = checkEN1_BG2.Checked;
if (sender == checkEN1_BG3) Global.Config.SNES_ShowBG3_1 = checkEN1_BG3.Checked;
if (sender == checkEN1_BG4) Global.Config.SNES_ShowBG4_1 = checkEN1_BG4.Checked;
if (sender == checkEN0_OBJ) Global.Config.SNES_ShowOBJ1 = checkEN0_OBJ.Checked;
if (sender == checkEN1_OBJ) Global.Config.SNES_ShowOBJ2 = checkEN1_OBJ.Checked;
if (sender == checkEN2_OBJ) Global.Config.SNES_ShowOBJ3 = checkEN2_OBJ.Checked;
if (sender == checkEN3_OBJ) Global.Config.SNES_ShowOBJ4 = checkEN3_OBJ.Checked;
if ((Control.ModifierKeys & Keys.Shift) != 0)
{
if (sender == checkEN0_BG1) Global.Config.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_0;
if (sender == checkEN1_BG1) Global.Config.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_1;
if (sender == checkEN0_BG2) Global.Config.SNES_ShowBG2_1 = Global.Config.SNES_ShowBG2_0;
if (sender == checkEN1_BG2) Global.Config.SNES_ShowBG2_0 = Global.Config.SNES_ShowBG2_1;
if (sender == checkEN0_BG3) Global.Config.SNES_ShowBG3_1 = Global.Config.SNES_ShowBG3_0;
if (sender == checkEN1_BG3) Global.Config.SNES_ShowBG3_0 = Global.Config.SNES_ShowBG3_1;
if (sender == checkEN0_BG4) Global.Config.SNES_ShowBG4_1 = Global.Config.SNES_ShowBG4_0;
if (sender == checkEN1_BG4) Global.Config.SNES_ShowBG4_0 = Global.Config.SNES_ShowBG4_1;
if (sender == checkEN0_OBJ) Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ1;
if (sender == checkEN1_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ2;
if (sender == checkEN2_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ4 = Global.Config.SNES_ShowOBJ3;
if (sender == checkEN3_OBJ) Global.Config.SNES_ShowOBJ1 = Global.Config.SNES_ShowOBJ2 = Global.Config.SNES_ShowOBJ3 = Global.Config.SNES_ShowOBJ4;
suppression = true;
RefreshBGENCheckStatesFromConfig();
suppression = false;
}
Global.MainForm.SyncCoreInputComm();
}
}
}

View File

@ -134,6 +134,6 @@ BG parameters at certain scanlines.</value>
<value>218, 5</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
<value>61</value>
</metadata>
</root>

View File

@ -22,4 +22,57 @@ namespace BizHawk.Core
}
}
public class CustomCheckBox : CheckBox
{
Color _CheckBackColor = SystemColors.Control;
public Color CheckBackColor
{
get { return _CheckBackColor; }
set { _CheckBackColor = value; Refresh(); }
}
bool? _ForceChecked = null;
public bool? ForceChecked
{
get { return _ForceChecked; }
set { _ForceChecked = value; Refresh(); }
}
protected override void OnPaint(PaintEventArgs pevent)
{
//draw text-label part of the control with something so that it isn't hallofmirrorsy
using(var brush = new SolidBrush(Parent.BackColor))
pevent.Graphics.FillRectangle(brush, ClientRectangle);
var r = new Rectangle(ClientRectangle.Location, SystemInformation.MenuCheckSize);
var glyphLoc = ClientRectangle;
glyphLoc.Size = SystemInformation.MenuCheckSize;
//draw the selectedbackdrop color roughly where the glyph belongs
using (var brush = new SolidBrush(_CheckBackColor))
pevent.Graphics.FillRectangle(brush, glyphLoc);
//draw a checkbox menu glyph (we could do this more elegantly with DrawFrameControl)
bool c = CheckState == System.Windows.Forms.CheckState.Checked;
if (ForceChecked.HasValue)
{
c = ForceChecked.Value;
}
if (c)
{
glyphLoc.Y--;
glyphLoc.X++;
ControlPaint.DrawMenuGlyph(pevent.Graphics, glyphLoc, MenuGlyph.Checkmark, Color.Black, Color.Transparent);
}
//draw a border on top of it all
ControlPaint.DrawBorder3D(pevent.Graphics, r, Border3DStyle.Sunken);
//stuff that didnt work
//CheckBoxRenderer.DrawParentBackground(pevent.Graphics, ClientRectangle, this);
//CheckBoxRenderer.DrawCheckBox(pevent.Graphics, ClientRectangle.Location, System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal);
//glyphLoc.Size = new System.Drawing.Size(SystemInformation.MenuCheckSize.Width-1,SystemInformation.MenuCheckSize.Height-1);
}
}
}

View File

@ -332,13 +332,35 @@ int snes_peek_logical_register(int reg)
case SNES_REG_SETINI_SCREEN_INTERLACE: return SNES::ppu.regs.interlace?1:0;
//$2130 CGWSEL
case SNES_REG_CGWSEL_COLORMASK: return SNES::ppu.regs.color_mask;
case SNES_REG_CGWSEL_COLORSUBMASK: return SNES::ppu.regs.color_mask;
case SNES_REG_CGWSEL_COLORSUBMASK: return SNES::ppu.regs.colorsub_mask;
case SNES_REG_CGWSEL_ADDSUBMODE: return SNES::ppu.regs.addsub_mode?1:0;
case SNES_REG_CGWSEL_DIRECTCOLOR: return SNES::ppu.regs.direct_color?1:0;
//$2101 OBSEL
case SNES_REG_OBSEL_NAMEBASE: return SNES::ppu.regs.oam_tdaddr>>14;
case SNES_REG_OBSEL_NAMESEL: return SNES::ppu.regs.oam_nameselect;
case SNES_REG_OBSEL_SIZE: return SNES::ppu.regs.oam_basesize;
//$2131 CGADSUB
//enum { BG1 = 0, BG2 = 1, BG3 = 2, BG4 = 3, OAM = 4, BACK = 5, COL = 5 };
case SNES_REG_CGADSUB_MODE: return SNES::ppu.regs.color_mode;
case SNES_REG_CGADSUB_HALF: return SNES::ppu.regs.color_halve;
case SNES_REG_CGADSUB_BG4: return SNES::ppu.regs.color_enabled[3];
case SNES_REG_CGADSUB_BG3: return SNES::ppu.regs.color_enabled[2];
case SNES_REG_CGADSUB_BG2: return SNES::ppu.regs.color_enabled[1];
case SNES_REG_CGADSUB_BG1: return SNES::ppu.regs.color_enabled[0];
case SNES_REG_CGADSUB_OBJ: return SNES::ppu.regs.color_enabled[4];
case SNES_REG_CGADSUB_BACKDROP: return SNES::ppu.regs.color_enabled[5];
//$212C TM
case SNES_REG_TM_BG1: return SNES::ppu.regs.bg_enabled[0];
case SNES_REG_TM_BG2: return SNES::ppu.regs.bg_enabled[1];
case SNES_REG_TM_BG3: return SNES::ppu.regs.bg_enabled[2];
case SNES_REG_TM_BG4: return SNES::ppu.regs.bg_enabled[3];
case SNES_REG_TM_OBJ: return SNES::ppu.regs.bg_enabled[4];
//$212D TM
case SNES_REG_TS_BG1: return SNES::ppu.regs.bgsub_enabled[0];
case SNES_REG_TS_BG2: return SNES::ppu.regs.bgsub_enabled[1];
case SNES_REG_TS_BG3: return SNES::ppu.regs.bgsub_enabled[2];
case SNES_REG_TS_BG4: return SNES::ppu.regs.bgsub_enabled[3];
case SNES_REG_TS_OBJ: return SNES::ppu.regs.bgsub_enabled[4];
}
return 0;
}

View File

@ -189,6 +189,27 @@ void bus_write(unsigned addr, uint8_t val);
#define SNES_REG_OBSEL_NAMEBASE 50
#define SNES_REG_OBSEL_NAMESEL 51
#define SNES_REG_OBSEL_SIZE 52
//$2131 CGADSUB
#define SNES_REG_CGADSUB_MODE 60
#define SNES_REG_CGADSUB_HALF 61
#define SNES_REG_CGADSUB_BG4 62
#define SNES_REG_CGADSUB_BG3 63
#define SNES_REG_CGADSUB_BG2 64
#define SNES_REG_CGADSUB_BG1 65
#define SNES_REG_CGADSUB_OBJ 66
#define SNES_REG_CGADSUB_BACKDROP 67
//$212C TM
#define SNES_REG_TM_BG1 70
#define SNES_REG_TM_BG2 71
#define SNES_REG_TM_BG3 72
#define SNES_REG_TM_BG4 73
#define SNES_REG_TM_OBJ 74
//$212D TM
#define SNES_REG_TS_BG1 80
#define SNES_REG_TS_BG2 81
#define SNES_REG_TS_BG3 82
#define SNES_REG_TS_BG4 83
#define SNES_REG_TS_OBJ 84
int snes_peek_logical_register(int reg);