NESPPU - progress on sprite viewer & details & other dialog todos
This commit is contained in:
parent
41d45ed180
commit
68e1e0b71d
|
@ -63,10 +63,10 @@
|
|||
this.Table1P7 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SpriteViewerBox = new System.Windows.Forms.GroupBox();
|
||||
this.txtScanline = new System.Windows.Forms.TextBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.SpriteView = new BizHawk.MultiClient.SpriteViewer();
|
||||
this.PaletteView = new BizHawk.MultiClient.PaletteViewer();
|
||||
this.PatternView = new BizHawk.MultiClient.PatternViewer();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.PatternGroup.SuspendLayout();
|
||||
this.PalettesGroup.SuspendLayout();
|
||||
this.DetailsBox.SuspendLayout();
|
||||
|
@ -363,7 +363,7 @@
|
|||
this.SpriteViewerBox.Controls.Add(this.SpriteView);
|
||||
this.SpriteViewerBox.Location = new System.Drawing.Point(299, 37);
|
||||
this.SpriteViewerBox.Name = "SpriteViewerBox";
|
||||
this.SpriteViewerBox.Size = new System.Drawing.Size(272, 155);
|
||||
this.SpriteViewerBox.Size = new System.Drawing.Size(272, 124);
|
||||
this.SpriteViewerBox.TabIndex = 5;
|
||||
this.SpriteViewerBox.TabStop = false;
|
||||
this.SpriteViewerBox.Text = "Sprites";
|
||||
|
@ -377,17 +377,30 @@
|
|||
this.txtScanline.Text = "0";
|
||||
this.txtScanline.TextChanged += new System.EventHandler(this.txtScanline_TextChanged);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtScanline);
|
||||
this.groupBox1.Location = new System.Drawing.Point(482, 200);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(75, 52);
|
||||
this.groupBox1.TabIndex = 8;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Scanline";
|
||||
//
|
||||
// SpriteView
|
||||
//
|
||||
this.SpriteView.BackColor = System.Drawing.Color.White;
|
||||
this.SpriteView.BackColor = System.Drawing.Color.Transparent;
|
||||
this.SpriteView.Location = new System.Drawing.Point(6, 18);
|
||||
this.SpriteView.Name = "SpriteView";
|
||||
this.SpriteView.Size = new System.Drawing.Size(256, 128);
|
||||
this.SpriteView.Size = new System.Drawing.Size(256, 96);
|
||||
this.SpriteView.TabIndex = 0;
|
||||
this.SpriteView.MouseEnter += new System.EventHandler(this.SpriteView_MouseEnter);
|
||||
this.SpriteView.MouseLeave += new System.EventHandler(this.SpriteView_MouseLeave);
|
||||
this.SpriteView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SpriteView_MouseMove);
|
||||
//
|
||||
// PaletteView
|
||||
//
|
||||
this.PaletteView.BackColor = System.Drawing.Color.White;
|
||||
this.PaletteView.BackColor = System.Drawing.Color.Transparent;
|
||||
this.PaletteView.Location = new System.Drawing.Point(6, 19);
|
||||
this.PaletteView.Name = "PaletteView";
|
||||
this.PaletteView.Size = new System.Drawing.Size(257, 34);
|
||||
|
@ -398,7 +411,7 @@
|
|||
//
|
||||
// PatternView
|
||||
//
|
||||
this.PatternView.BackColor = System.Drawing.Color.White;
|
||||
this.PatternView.BackColor = System.Drawing.Color.Transparent;
|
||||
this.PatternView.Location = new System.Drawing.Point(7, 20);
|
||||
this.PatternView.Name = "PatternView";
|
||||
this.PatternView.Size = new System.Drawing.Size(256, 128);
|
||||
|
@ -408,16 +421,6 @@
|
|||
this.PatternView.MouseLeave += new System.EventHandler(this.PatternView_MouseLeave);
|
||||
this.PatternView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PatternView_MouseMove);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.txtScanline);
|
||||
this.groupBox1.Location = new System.Drawing.Point(482, 200);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(75, 52);
|
||||
this.groupBox1.TabIndex = 8;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Scanline";
|
||||
//
|
||||
// NESPPU
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -430,6 +433,7 @@
|
|||
this.Controls.Add(this.PalettesGroup);
|
||||
this.Controls.Add(this.PatternGroup);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "NESPPU";
|
||||
this.Text = "NES PPU Viewer";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.NESPPU_FormClosed);
|
||||
|
|
|
@ -120,32 +120,43 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
PatternView.pattern.UnlockBits(bmpdata);
|
||||
PatternView.Refresh();
|
||||
/*
|
||||
int SpriteNum, TileNum, Attr, MemAddr;
|
||||
|
||||
|
||||
System.Drawing.Imaging.BitmapData bmpdata2 = SpriteView.sprites.LockBits(new Rectangle(new Point(0, 0), SpriteView.sprites.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
int* framebuf2 = (int*)bmpdata2.Scan0.ToPointer();
|
||||
int Addr, SpriteNum, TileNum, PatAddr, Attr;
|
||||
|
||||
//Sprite Viewer
|
||||
for (int y = 0; y < 4; y++)
|
||||
for (int n = 0; n < 4; n++)
|
||||
{
|
||||
for (int x = 0; x < 16; x++)
|
||||
for (int r = 0; r < 16; r++)
|
||||
{
|
||||
SpriteNum = (y << 4) | x;
|
||||
TileNum = 0; //TODO
|
||||
Addr = 0x23C1 + (n * 0x400) + (r + 4); //TODO: NEEDZ ADDRESS!
|
||||
SpriteNum = (n << 4) | r;
|
||||
TileNum = Nes.ppu.ppubus_read(Addr, true);
|
||||
PatAddr = (TileNum * 0x10) + (n > 1 ? 0x1000 : 0);
|
||||
Attr = 0; //TODO
|
||||
if (((int)Nes.ppu.reg_2000.Value & (int)0x20) > 0) //TODO why is C# being retarded about using & with a byte?
|
||||
{
|
||||
MemAddr = ((TileNum & 0xFE) << 4) | ((TileNum & 0x01) << 12);
|
||||
//DrawTile(SprArray + y * 24 * D_SPR_W + x * 16, MemAddr, 4 | (Attr & 3), D_SPR_W);
|
||||
//DrawTile(SprArray + y * 24 * D_SPR_W + x * 16 + 8 * D_SPR_W, MemAddr + 16, 4 | (Attr & 3), D_SPR_W);
|
||||
|
||||
}
|
||||
else
|
||||
//TODO: 8x16 viewing
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
MemAddr = (TileNum << 4) | ((Nes.ppu.reg_2000.Value & (byte)0x08) << 9);
|
||||
//DrawTile(SprArray + y * 24 * D_SPR_W + x * 16, MemAddr, 4 | (Attr & 3), D_SPR_W);
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
b0 = GetBit(PatAddr + y + 0 * 8, x);
|
||||
b1 = GetBit(PatAddr + y + 1 * 8, x);
|
||||
value = (byte)(b0 + (b1 << 1));
|
||||
cvalue = Nes.LookupColor(Nes.ppu.PALRAM[value + (PatternView.Pal0 * 4)]);
|
||||
Color color = Color.FromArgb(cvalue);
|
||||
|
||||
int adr = (x + (r * 8 * 2)) + (y + (n * 8 * 3)) * (bmpdata2.Stride / 4);
|
||||
framebuf2[adr] = color.ToArgb();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
* */
|
||||
SpriteView.sprites.UnlockBits(bmpdata2);
|
||||
SpriteView.Refresh();
|
||||
}
|
||||
|
||||
public unsafe void UpdateValues()
|
||||
|
@ -393,5 +404,27 @@ namespace BizHawk.MultiClient
|
|||
if (Nes.ppu.PPUViewCallback == Callback)
|
||||
Nes.ppu.PPUViewCallback = null;
|
||||
}
|
||||
|
||||
private void SpriteView_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SpriteView_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
ClearDetails();
|
||||
}
|
||||
|
||||
private void SpriteView_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
int SpriteNumber = ((e.Y / 24) * 16) + (e.X / 16);
|
||||
int X = 0;
|
||||
int Y = 0;
|
||||
|
||||
SectionLabel.Text = "Section Sprite";
|
||||
AddressLabel.Text = "Number: " + String.Format("{0:X2}", SpriteNumber);
|
||||
ValueLabel.Text = "X: " + String.Format("{0:X2}", X);
|
||||
Value2Label.Text = "Y: " + String.Format("{0:X2}", Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -59,9 +59,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.Size = new Size(128, 32);
|
||||
this.BackColor = Color.White;
|
||||
this.BackColor = Color.Transparent;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.PaletteViewer_Paint);
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PaletteViewer_KeyDown);
|
||||
|
||||
|
|
|
@ -22,8 +22,9 @@ namespace BizHawk.MultiClient
|
|||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
this.Size = pSize;
|
||||
this.BackColor = Color.White;
|
||||
this.BackColor = Color.Transparent;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.PatternViewer_Paint);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,13 +15,14 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public SpriteViewer()
|
||||
{
|
||||
pSize = new Size(256, 128);
|
||||
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
pSize = new Size(256, 96);
|
||||
sprites = new Bitmap(pSize.Width, pSize.Height);
|
||||
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
SetStyle(ControlStyles.UserPaint, true);
|
||||
SetStyle(ControlStyles.DoubleBuffer, true);
|
||||
this.Size = pSize;
|
||||
this.BackColor = Color.White;
|
||||
this.BackColor = Color.Transparent;
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.SpriteViewer_Paint);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue