snesgfxdebugger-add BG scroll regs

This commit is contained in:
zeromus 2012-12-03 18:59:08 +00:00
parent 0ef0ef6357
commit aaf06d76d3
10 changed files with 166 additions and 24 deletions

View File

@ -215,17 +215,38 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
CGADSUB_OBJ = 66,
CGADSUB_BACKDROP = 67,
//$212C TM
TM_BG1 =70,
TM_BG2 =71,
TM_BG3 =72,
TM_BG4 =73,
TM_OBJ =74,
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
TS_BG1 = 80,
TS_BG2 = 81,
TS_BG3 = 82,
TS_BG4 = 83,
TS_OBJ = 84,
//Mode7 regs
M7SEL_REPEAT = 90,
M7SEL_HFLIP = 91,
M7SEL_VFLIP = 92,
M7A = 93,
M7B = 94,
M7C = 95,
M7D = 96,
M7X = 97,
M7Y = 98,
//BG scroll regs
BG1HOFS = 100,
BG1VOFS = 101,
BG2HOFS = 102,
BG2VOFS = 103,
BG3HOFS = 104,
BG3VOFS = 105,
BG4HOFS = 106,
BG4VOFS = 107,
M7HOFS = 108,
M7VOFS = 109,
}
public enum SNES_MEMORY : uint

View File

@ -169,6 +169,11 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
/// </summary>
public bool MathEnabled;
/// <summary>
/// scroll registers
/// </summary>
public int HOFS, VOFS;
/// <summary>
/// TileSize; 8 or 16
/// </summary>
@ -315,6 +320,18 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
public bool OBJ_MathEnabled { private set; get; }
public bool BK_MathEnabled { private set; get; }
public int M7HOFS { private set; get; }
public int M7VOFS { private set; get; }
public int M7A { private set; get; }
public int M7B { private set; get; }
public int M7C { private set; get; }
public int M7D { private set; get; }
public int M7X { private set; get; }
public int M7Y { private set; get; }
public int M7SEL_REPEAT { private set; get; }
public bool M7SEL_HFLIP { private set; get; }
public bool M7SEL_VFLIP { private set; get; }
public static ScreenInfo GetScreenInfo()
{
var si = new ScreenInfo();
@ -393,6 +410,28 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
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;
si.BG.BG1.HOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG1HOFS);
si.BG.BG1.VOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG1VOFS);
si.BG.BG2.HOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG2HOFS);
si.BG.BG2.VOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG2VOFS);
si.BG.BG3.HOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG3HOFS);
si.BG.BG3.VOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG3VOFS);
si.BG.BG4.HOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG4HOFS);
si.BG.BG4.VOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.BG4VOFS);
si.M7HOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7HOFS);
si.M7VOFS = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7VOFS);
si.M7A = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7A);
si.M7B = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7B);
si.M7C = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7C);
si.M7D = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7D);
si.M7X = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7X);
si.M7Y = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7Y);
si.M7Y = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7Y);
si.M7SEL_REPEAT = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7SEL_REPEAT);
si.M7SEL_HFLIP = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7SEL_HFLIP)!=0;
si.M7SEL_VFLIP = LibsnesDll.snes_peek_logical_register(LibsnesDll.SNES_REG.M7SEL_VFLIP)!=0;
for (int i = 1; i <= 4; i++)
{
si.BG[i].Mode = si.Mode.MODE;

View File

@ -160,6 +160,8 @@
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtBG1Scroll = new System.Windows.Forms.TextBox();
this.label37 = new System.Windows.Forms.Label();
this.txtBG1MapSizeBytes = new System.Windows.Forms.TextBox();
this.txtBGPaletteInfo = new System.Windows.Forms.TextBox();
this.rbBG4 = new System.Windows.Forms.RadioButton();
@ -555,7 +557,7 @@
// groupBox6
//
this.groupBox6.Controls.Add(this.labelClipboard);
this.groupBox6.Location = new System.Drawing.Point(2, 495);
this.groupBox6.Location = new System.Drawing.Point(2, 520);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(220, 38);
this.groupBox6.TabIndex = 50;
@ -1701,6 +1703,8 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtBG1Scroll);
this.groupBox1.Controls.Add(this.label37);
this.groupBox1.Controls.Add(this.txtBG1MapSizeBytes);
this.groupBox1.Controls.Add(this.txtBGPaletteInfo);
this.groupBox1.Controls.Add(this.rbBG4);
@ -1729,11 +1733,30 @@
this.groupBox1.Controls.Add(this.txtBG1SizeBits);
this.groupBox1.Location = new System.Drawing.Point(2, 281);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(170, 208);
this.groupBox1.Size = new System.Drawing.Size(170, 233);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "BG";
//
// txtBG1Scroll
//
this.txtBG1Scroll.Location = new System.Drawing.Point(73, 134);
this.txtBG1Scroll.Multiline = true;
this.txtBG1Scroll.Name = "txtBG1Scroll";
this.txtBG1Scroll.ReadOnly = true;
this.txtBG1Scroll.Size = new System.Drawing.Size(72, 18);
this.txtBG1Scroll.TabIndex = 42;
this.txtBG1Scroll.Text = "1024,1024";
//
// label37
//
this.label37.AutoSize = true;
this.label37.Location = new System.Drawing.Point(35, 137);
this.label37.Name = "label37";
this.label37.Size = new System.Drawing.Size(36, 13);
this.label37.TabIndex = 41;
this.label37.Text = "Scroll:";
//
// txtBG1MapSizeBytes
//
this.txtBG1MapSizeBytes.Location = new System.Drawing.Point(34, 112);
@ -1746,7 +1769,7 @@
//
// txtBGPaletteInfo
//
this.txtBGPaletteInfo.Location = new System.Drawing.Point(5, 181);
this.txtBGPaletteInfo.Location = new System.Drawing.Point(5, 206);
this.txtBGPaletteInfo.Multiline = true;
this.txtBGPaletteInfo.Name = "txtBGPaletteInfo";
this.txtBGPaletteInfo.ReadOnly = true;
@ -1887,7 +1910,7 @@
//
// txtBG1TDAddrDescr
//
this.txtBG1TDAddrDescr.Location = new System.Drawing.Point(73, 156);
this.txtBG1TDAddrDescr.Location = new System.Drawing.Point(73, 177);
this.txtBG1TDAddrDescr.Multiline = true;
this.txtBG1TDAddrDescr.Name = "txtBG1TDAddrDescr";
this.txtBG1TDAddrDescr.ReadOnly = true;
@ -1898,7 +1921,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(30, 161);
this.label11.Location = new System.Drawing.Point(30, 182);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(40, 13);
this.label11.TabIndex = 14;
@ -1906,7 +1929,7 @@
//
// txtBG1SCAddrDescr
//
this.txtBG1SCAddrDescr.Location = new System.Drawing.Point(73, 134);
this.txtBG1SCAddrDescr.Location = new System.Drawing.Point(73, 155);
this.txtBG1SCAddrDescr.Multiline = true;
this.txtBG1SCAddrDescr.Name = "txtBG1SCAddrDescr";
this.txtBG1SCAddrDescr.ReadOnly = true;
@ -1926,7 +1949,7 @@
// txtBG1TDAddrBits
//
this.txtBG1TDAddrBits.BackColor = System.Drawing.Color.LightGreen;
this.txtBG1TDAddrBits.Location = new System.Drawing.Point(5, 158);
this.txtBG1TDAddrBits.Location = new System.Drawing.Point(5, 179);
this.txtBG1TDAddrBits.Multiline = true;
this.txtBG1TDAddrBits.Name = "txtBG1TDAddrBits";
this.txtBG1TDAddrBits.ReadOnly = true;
@ -1937,7 +1960,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(30, 137);
this.label10.Location = new System.Drawing.Point(30, 158);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(40, 13);
this.label10.TabIndex = 11;
@ -1965,7 +1988,7 @@
// txtBG1SCAddrBits
//
this.txtBG1SCAddrBits.BackColor = System.Drawing.Color.LightGreen;
this.txtBG1SCAddrBits.Location = new System.Drawing.Point(5, 134);
this.txtBG1SCAddrBits.Location = new System.Drawing.Point(5, 155);
this.txtBG1SCAddrBits.Multiline = true;
this.txtBG1SCAddrBits.Name = "txtBG1SCAddrBits";
this.txtBG1SCAddrBits.ReadOnly = true;
@ -2939,5 +2962,7 @@
private System.Windows.Forms.TextBox txtObjPaletteMemo;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.TextBox txtObjPalette;
private System.Windows.Forms.TextBox txtBG1Scroll;
private System.Windows.Forms.Label label37;
}
}

View File

@ -11,6 +11,7 @@
//TODO - add "scroll&screen" checkbox which changes BG1/2/3/4 display modes to render scrolled and limited to 256x224 (for matching obj screen)
// alternatively - add "BG1 Screen" as a complement to BG1
//TODO - make Sprites mode respect priority toggles
//TODO - add "mode" display to BG info (in addition to bpp) so we can readily see if its mode7 or unavailable
//DEFERRED:
//. 256bpp modes (difficult to use)
@ -54,6 +55,12 @@ namespace BizHawk.MultiClient
displayTypeItems.Add(new DisplayTypeItem("Sprites", eDisplayType.Sprites));
displayTypeItems.Add(new DisplayTypeItem("OBJ", eDisplayType.OBJ));
displayTypeItems.Add(new DisplayTypeItem("BG1 Screen", eDisplayType.BG1));
displayTypeItems.Add(new DisplayTypeItem("BG2 Screen", eDisplayType.BG2));
displayTypeItems.Add(new DisplayTypeItem("BG3 Screen", eDisplayType.BG3));
displayTypeItems.Add(new DisplayTypeItem("BG4 Screen", eDisplayType.BG4));
displayTypeItems.Add(new DisplayTypeItem("BG1", eDisplayType.BG1));
displayTypeItems.Add(new DisplayTypeItem("BG2",eDisplayType.BG2));
displayTypeItems.Add(new DisplayTypeItem("BG3",eDisplayType.BG3));
@ -254,6 +261,8 @@ namespace BizHawk.MultiClient
txtBG1TDAddrBits.Text = bg.TDADDR.ToString();
txtBG1TDAddrDescr.Text = FormatVramAddress(bg.TiledataAddr);
txtBG1Scroll.Text = string.Format("({0},{1})", bg.HOFS, bg.VOFS);
if (bg.Bpp != 0)
{
var pi = bg.PaletteSelection;
@ -454,7 +463,8 @@ namespace BizHawk.MultiClient
enum eDisplayType
{
BG1 = 1, BG2 = 2, BG3 = 3, BG4 = 4, OBJTiles0, OBJTiles1, Tiles2bpp, Tiles4bpp, Tiles8bpp, TilesMode7, TilesMode7Ext, TilesMode7DC, Sprites, OBJ
BG1 = 1, BG2 = 2, BG3 = 3, BG4 = 4, OBJTiles0, OBJTiles1, Tiles2bpp, Tiles4bpp, Tiles8bpp, TilesMode7, TilesMode7Ext, TilesMode7DC, Sprites, OBJ,
BG1Screen = 101, BG2Screen = 102, BG3Screen = 103, BG4Screen = 104,
}
static bool IsDisplayTypeBG(eDisplayType type) { return type == eDisplayType.BG1 || type == eDisplayType.BG2 || type == eDisplayType.BG3 || type == eDisplayType.BG4; }
static bool IsDisplayTypeOBJ(eDisplayType type) { return type == eDisplayType.OBJTiles0 || type == eDisplayType.OBJTiles1; }

View File

@ -123,9 +123,6 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 17</value>
</metadata>
<data name="comboPalette.ToolTip" xml:space="preserve">
<value>Colors can be converted from the snes 555 format to PC standard 888 in several ways.
Snes9x really didnt make any effort to make sense;

View File

@ -4,6 +4,11 @@ namespace SNES {
Interface *interface = nullptr;
Interface::Interface()
: wanttrace(false)
{
}
void Interface::videoRefresh(const uint32_t *data, bool hires, bool interlace, bool overscan) {
}

View File

@ -1,4 +1,5 @@
struct Interface {
Interface();
virtual void videoRefresh(const uint32_t *data, bool hires, bool interlace, bool overscan);
virtual void audioSample(int16_t lsample, int16_t rsample);
virtual int16_t inputPoll(bool port, Input::Device device, unsigned index, unsigned id);
@ -16,7 +17,7 @@ struct Interface {
//zero 17-oct-2012
virtual int getBackdropColor();
bool wanttrace = false;
bool wanttrace;
virtual void cpuTrace(const char *msg);
};

View File

@ -378,6 +378,29 @@ int snes_peek_logical_register(int reg)
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];
//Mode7 regs
case SNES_REG_M7SEL_REPEAT: return SNES::ppu.regs.mode7_repeat;
case SNES_REG_M7SEL_HFLIP: return SNES::ppu.regs.mode7_vflip;
case SNES_REG_M7SEL_VFLIP: return SNES::ppu.regs.mode7_hflip;
case SNES_REG_M7A: return SNES::ppu.regs.m7a;
case SNES_REG_M7B: return SNES::ppu.regs.m7b;
case SNES_REG_M7C: return SNES::ppu.regs.m7c;
case SNES_REG_M7D: return SNES::ppu.regs.m7d;
case SNES_REG_M7X: return SNES::ppu.regs.m7x;
case SNES_REG_M7Y: return SNES::ppu.regs.m7y;
//BG scroll regs
case SNES_REG_BG1HOFS: return SNES::ppu.regs.bg_hofs[0] & 0x3FF;
case SNES_REG_BG1VOFS: return SNES::ppu.regs.bg_vofs[0] & 0x3FF;
case SNES_REG_BG2HOFS: return SNES::ppu.regs.bg_hofs[1] & 0x3FF;
case SNES_REG_BG2VOFS: return SNES::ppu.regs.bg_vofs[1] & 0x3FF;
case SNES_REG_BG3HOFS: return SNES::ppu.regs.bg_hofs[2] & 0x3FF;
case SNES_REG_BG3VOFS: return SNES::ppu.regs.bg_vofs[2] & 0x3FF;
case SNES_REG_BG4HOFS: return SNES::ppu.regs.bg_hofs[3] & 0x3FF;
case SNES_REG_BG4VOFS: return SNES::ppu.regs.bg_vofs[3] & 0x3FF;
case SNES_REG_M7HOFS: return SNES::ppu.regs.m7_hofs & 0x1FFF; //rememebr to make these signed with <<19>>19
case SNES_REG_M7VOFS: return SNES::ppu.regs.m7_vofs & 0x1FFF; //rememebr to make these signed with <<19>>19
}
return 0;
}

View File

@ -213,6 +213,27 @@ void bus_write(unsigned addr, uint8_t val);
#define SNES_REG_TS_BG3 82
#define SNES_REG_TS_BG4 83
#define SNES_REG_TS_OBJ 84
//Mode7 regs
#define SNES_REG_M7SEL_REPEAT 90
#define SNES_REG_M7SEL_HFLIP 91
#define SNES_REG_M7SEL_VFLIP 92
#define SNES_REG_M7A 93
#define SNES_REG_M7B 94
#define SNES_REG_M7C 95
#define SNES_REG_M7D 96
#define SNES_REG_M7X 97
#define SNES_REG_M7Y 98
//BG scroll regs
#define SNES_REG_BG1HOFS 100
#define SNES_REG_BG1VOFS 101
#define SNES_REG_BG2HOFS 102
#define SNES_REG_BG2VOFS 103
#define SNES_REG_BG3HOFS 104
#define SNES_REG_BG3VOFS 105
#define SNES_REG_BG4HOFS 106
#define SNES_REG_BG4VOFS 107
#define SNES_REG_M7HOFS 108
#define SNES_REG_M7VOFS 109
int snes_peek_logical_register(int reg);