gp gpu view: some mouseover stuff
This commit is contained in:
parent
6be1c071f9
commit
0d77f77069
|
@ -39,12 +39,15 @@
|
|||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.radioButtonRefreshFrame = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonRefreshScanline = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonRefreshManual = new System.Windows.Forms.RadioButton();
|
||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
||||
this.labelScanline = new System.Windows.Forms.Label();
|
||||
this.hScrollBarScanline = new System.Windows.Forms.HScrollBar();
|
||||
this.labelScanline = new System.Windows.Forms.Label();
|
||||
this.buttonRefresh = new System.Windows.Forms.Button();
|
||||
this.radioButtonRefreshManual = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonRefreshScanline = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonRefreshFrame = new System.Windows.Forms.RadioButton();
|
||||
this.groupBoxDetails = new System.Windows.Forms.GroupBox();
|
||||
this.labelDetails = new System.Windows.Forms.Label();
|
||||
this.bmpViewDetails = new BizHawk.MultiClient.GBtools.BmpView();
|
||||
this.bmpViewOAM = new BizHawk.MultiClient.GBtools.BmpView();
|
||||
this.bmpViewBGPal = new BizHawk.MultiClient.GBtools.BmpView();
|
||||
this.bmpViewSPPal = new BizHawk.MultiClient.GBtools.BmpView();
|
||||
|
@ -57,6 +60,7 @@
|
|||
this.groupBox3.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.groupBoxDetails.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
|
@ -177,29 +181,34 @@
|
|||
this.groupBox5.TabStop = false;
|
||||
this.groupBox5.Text = "Refresh Control";
|
||||
//
|
||||
// radioButtonRefreshFrame
|
||||
// hScrollBarScanline
|
||||
//
|
||||
this.radioButtonRefreshFrame.AutoSize = true;
|
||||
this.radioButtonRefreshFrame.Location = new System.Drawing.Point(7, 20);
|
||||
this.radioButtonRefreshFrame.Name = "radioButtonRefreshFrame";
|
||||
this.radioButtonRefreshFrame.Size = new System.Drawing.Size(54, 17);
|
||||
this.radioButtonRefreshFrame.TabIndex = 0;
|
||||
this.radioButtonRefreshFrame.TabStop = true;
|
||||
this.radioButtonRefreshFrame.Text = "Frame";
|
||||
this.radioButtonRefreshFrame.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRefreshFrame.CheckedChanged += new System.EventHandler(this.radioButtonRefreshFrame_CheckedChanged);
|
||||
this.hScrollBarScanline.Location = new System.Drawing.Point(76, 45);
|
||||
this.hScrollBarScanline.Maximum = 153;
|
||||
this.hScrollBarScanline.Name = "hScrollBarScanline";
|
||||
this.hScrollBarScanline.Size = new System.Drawing.Size(192, 16);
|
||||
this.hScrollBarScanline.TabIndex = 21;
|
||||
this.hScrollBarScanline.ValueChanged += new System.EventHandler(this.hScrollBarScanline_ValueChanged);
|
||||
//
|
||||
// radioButtonRefreshScanline
|
||||
// labelScanline
|
||||
//
|
||||
this.radioButtonRefreshScanline.AutoSize = true;
|
||||
this.radioButtonRefreshScanline.Location = new System.Drawing.Point(7, 44);
|
||||
this.radioButtonRefreshScanline.Name = "radioButtonRefreshScanline";
|
||||
this.radioButtonRefreshScanline.Size = new System.Drawing.Size(66, 17);
|
||||
this.radioButtonRefreshScanline.TabIndex = 1;
|
||||
this.radioButtonRefreshScanline.TabStop = true;
|
||||
this.radioButtonRefreshScanline.Text = "Scanline";
|
||||
this.radioButtonRefreshScanline.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRefreshScanline.CheckedChanged += new System.EventHandler(this.radioButtonRefreshScanline_CheckedChanged);
|
||||
this.labelScanline.AutoSize = true;
|
||||
this.labelScanline.Location = new System.Drawing.Point(159, 24);
|
||||
this.labelScanline.Name = "labelScanline";
|
||||
this.labelScanline.Size = new System.Drawing.Size(21, 13);
|
||||
this.labelScanline.TabIndex = 5;
|
||||
this.labelScanline.Text = "SS";
|
||||
this.labelScanline.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// buttonRefresh
|
||||
//
|
||||
this.buttonRefresh.Location = new System.Drawing.Point(76, 65);
|
||||
this.buttonRefresh.Name = "buttonRefresh";
|
||||
this.buttonRefresh.Size = new System.Drawing.Size(80, 23);
|
||||
this.buttonRefresh.TabIndex = 4;
|
||||
this.buttonRefresh.Text = "Refresh Now";
|
||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
||||
this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
|
||||
//
|
||||
// radioButtonRefreshManual
|
||||
//
|
||||
|
@ -213,34 +222,57 @@
|
|||
this.radioButtonRefreshManual.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRefreshManual.CheckedChanged += new System.EventHandler(this.radioButtonRefreshManual_CheckedChanged);
|
||||
//
|
||||
// buttonRefresh
|
||||
// radioButtonRefreshScanline
|
||||
//
|
||||
this.buttonRefresh.Location = new System.Drawing.Point(76, 65);
|
||||
this.buttonRefresh.Name = "buttonRefresh";
|
||||
this.buttonRefresh.Size = new System.Drawing.Size(80, 23);
|
||||
this.buttonRefresh.TabIndex = 4;
|
||||
this.buttonRefresh.Text = "Refresh Now";
|
||||
this.buttonRefresh.UseVisualStyleBackColor = true;
|
||||
this.buttonRefresh.Click += new System.EventHandler(this.buttonRefresh_Click);
|
||||
this.radioButtonRefreshScanline.AutoSize = true;
|
||||
this.radioButtonRefreshScanline.Location = new System.Drawing.Point(7, 44);
|
||||
this.radioButtonRefreshScanline.Name = "radioButtonRefreshScanline";
|
||||
this.radioButtonRefreshScanline.Size = new System.Drawing.Size(66, 17);
|
||||
this.radioButtonRefreshScanline.TabIndex = 1;
|
||||
this.radioButtonRefreshScanline.TabStop = true;
|
||||
this.radioButtonRefreshScanline.Text = "Scanline";
|
||||
this.radioButtonRefreshScanline.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRefreshScanline.CheckedChanged += new System.EventHandler(this.radioButtonRefreshScanline_CheckedChanged);
|
||||
//
|
||||
// labelScanline
|
||||
// radioButtonRefreshFrame
|
||||
//
|
||||
this.labelScanline.AutoSize = true;
|
||||
this.labelScanline.Location = new System.Drawing.Point(159, 24);
|
||||
this.labelScanline.Name = "labelScanline";
|
||||
this.labelScanline.Size = new System.Drawing.Size(21, 13);
|
||||
this.labelScanline.TabIndex = 5;
|
||||
this.labelScanline.Text = "SS";
|
||||
this.labelScanline.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
this.radioButtonRefreshFrame.AutoSize = true;
|
||||
this.radioButtonRefreshFrame.Location = new System.Drawing.Point(7, 20);
|
||||
this.radioButtonRefreshFrame.Name = "radioButtonRefreshFrame";
|
||||
this.radioButtonRefreshFrame.Size = new System.Drawing.Size(54, 17);
|
||||
this.radioButtonRefreshFrame.TabIndex = 0;
|
||||
this.radioButtonRefreshFrame.TabStop = true;
|
||||
this.radioButtonRefreshFrame.Text = "Frame";
|
||||
this.radioButtonRefreshFrame.UseVisualStyleBackColor = true;
|
||||
this.radioButtonRefreshFrame.CheckedChanged += new System.EventHandler(this.radioButtonRefreshFrame_CheckedChanged);
|
||||
//
|
||||
// hScrollBarScanline
|
||||
// groupBoxDetails
|
||||
//
|
||||
this.hScrollBarScanline.Location = new System.Drawing.Point(76, 45);
|
||||
this.hScrollBarScanline.Maximum = 153;
|
||||
this.hScrollBarScanline.Name = "hScrollBarScanline";
|
||||
this.hScrollBarScanline.Size = new System.Drawing.Size(192, 16);
|
||||
this.hScrollBarScanline.TabIndex = 21;
|
||||
this.hScrollBarScanline.ValueChanged += new System.EventHandler(this.hScrollBarScanline_ValueChanged);
|
||||
this.groupBoxDetails.Controls.Add(this.labelDetails);
|
||||
this.groupBoxDetails.Controls.Add(this.bmpViewDetails);
|
||||
this.groupBoxDetails.Location = new System.Drawing.Point(12, 359);
|
||||
this.groupBoxDetails.Name = "groupBoxDetails";
|
||||
this.groupBoxDetails.Size = new System.Drawing.Size(418, 153);
|
||||
this.groupBoxDetails.TabIndex = 21;
|
||||
this.groupBoxDetails.TabStop = false;
|
||||
this.groupBoxDetails.Text = "Details";
|
||||
//
|
||||
// labelDetails
|
||||
//
|
||||
this.labelDetails.AutoSize = true;
|
||||
this.labelDetails.Location = new System.Drawing.Point(76, 16);
|
||||
this.labelDetails.Name = "labelDetails";
|
||||
this.labelDetails.Size = new System.Drawing.Size(206, 13);
|
||||
this.labelDetails.TabIndex = 1;
|
||||
this.labelDetails.Text = "Mouse over an item to see details about it.";
|
||||
//
|
||||
// bmpViewDetails
|
||||
//
|
||||
this.bmpViewDetails.BackColor = System.Drawing.Color.Black;
|
||||
this.bmpViewDetails.Location = new System.Drawing.Point(6, 19);
|
||||
this.bmpViewDetails.Name = "bmpViewDetails";
|
||||
this.bmpViewDetails.Size = new System.Drawing.Size(64, 128);
|
||||
this.bmpViewDetails.TabIndex = 0;
|
||||
//
|
||||
// bmpViewOAM
|
||||
//
|
||||
|
@ -249,6 +281,9 @@
|
|||
this.bmpViewOAM.Name = "bmpViewOAM";
|
||||
this.bmpViewOAM.Size = new System.Drawing.Size(320, 16);
|
||||
this.bmpViewOAM.TabIndex = 14;
|
||||
this.bmpViewOAM.MouseEnter += new System.EventHandler(this.bmpViewOAM_MouseEnter);
|
||||
this.bmpViewOAM.MouseLeave += new System.EventHandler(this.bmpViewOAM_MouseLeave);
|
||||
this.bmpViewOAM.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewOAM_MouseMove);
|
||||
//
|
||||
// bmpViewBGPal
|
||||
//
|
||||
|
@ -258,6 +293,9 @@
|
|||
this.bmpViewBGPal.Size = new System.Drawing.Size(128, 64);
|
||||
this.bmpViewBGPal.TabIndex = 10;
|
||||
this.bmpViewBGPal.Text = "bmpView1";
|
||||
this.bmpViewBGPal.MouseEnter += new System.EventHandler(this.bmpViewBGPal_MouseEnter);
|
||||
this.bmpViewBGPal.MouseLeave += new System.EventHandler(this.bmpViewBGPal_MouseLeave);
|
||||
this.bmpViewBGPal.Move += new System.EventHandler(this.bmpViewBGPal_Move);
|
||||
//
|
||||
// bmpViewSPPal
|
||||
//
|
||||
|
@ -267,6 +305,9 @@
|
|||
this.bmpViewSPPal.Size = new System.Drawing.Size(128, 64);
|
||||
this.bmpViewSPPal.TabIndex = 11;
|
||||
this.bmpViewSPPal.Text = "bmpView2";
|
||||
this.bmpViewSPPal.MouseEnter += new System.EventHandler(this.bmpViewSPPal_MouseEnter);
|
||||
this.bmpViewSPPal.MouseLeave += new System.EventHandler(this.bmpViewSPPal_MouseLeave);
|
||||
this.bmpViewSPPal.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewSPPal_MouseMove);
|
||||
//
|
||||
// bmpViewTiles1
|
||||
//
|
||||
|
@ -276,6 +317,9 @@
|
|||
this.bmpViewTiles1.Size = new System.Drawing.Size(128, 192);
|
||||
this.bmpViewTiles1.TabIndex = 6;
|
||||
this.bmpViewTiles1.Text = "bmpView1";
|
||||
this.bmpViewTiles1.MouseEnter += new System.EventHandler(this.bmpViewTiles1_MouseEnter);
|
||||
this.bmpViewTiles1.MouseLeave += new System.EventHandler(this.bmpViewTiles1_MouseLeave);
|
||||
this.bmpViewTiles1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewTiles1_MouseMove);
|
||||
//
|
||||
// bmpViewTiles2
|
||||
//
|
||||
|
@ -285,6 +329,9 @@
|
|||
this.bmpViewTiles2.Size = new System.Drawing.Size(128, 192);
|
||||
this.bmpViewTiles2.TabIndex = 7;
|
||||
this.bmpViewTiles2.Text = "bmpView2";
|
||||
this.bmpViewTiles2.MouseEnter += new System.EventHandler(this.bmpViewTiles2_MouseEnter);
|
||||
this.bmpViewTiles2.MouseLeave += new System.EventHandler(this.bmpViewTiles2_MouseLeave);
|
||||
this.bmpViewTiles2.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewTiles2_MouseMove);
|
||||
//
|
||||
// bmpViewBG
|
||||
//
|
||||
|
@ -294,6 +341,9 @@
|
|||
this.bmpViewBG.Size = new System.Drawing.Size(256, 256);
|
||||
this.bmpViewBG.TabIndex = 4;
|
||||
this.bmpViewBG.Text = "bmpView1";
|
||||
this.bmpViewBG.MouseEnter += new System.EventHandler(this.bmpViewBG_MouseEnter);
|
||||
this.bmpViewBG.MouseLeave += new System.EventHandler(this.bmpViewBG_MouseLeave);
|
||||
this.bmpViewBG.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewBG_MouseMove);
|
||||
//
|
||||
// bmpViewWin
|
||||
//
|
||||
|
@ -303,19 +353,24 @@
|
|||
this.bmpViewWin.Size = new System.Drawing.Size(256, 256);
|
||||
this.bmpViewWin.TabIndex = 5;
|
||||
this.bmpViewWin.Text = "bmpView2";
|
||||
this.bmpViewWin.MouseEnter += new System.EventHandler(this.bmpViewWin_MouseEnter);
|
||||
this.bmpViewWin.MouseLeave += new System.EventHandler(this.bmpViewWin_MouseLeave);
|
||||
this.bmpViewWin.MouseMove += new System.Windows.Forms.MouseEventHandler(this.bmpViewWin_MouseMove);
|
||||
//
|
||||
// GBGPUView
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(903, 500);
|
||||
this.ClientSize = new System.Drawing.Size(834, 555);
|
||||
this.Controls.Add(this.groupBoxDetails);
|
||||
this.Controls.Add(this.groupBox5);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "GBGPUView";
|
||||
this.Text = "GB GPU Viewer";
|
||||
this.Text = "GameBoy GPU Viewer";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.GBGPUView_FormClosed);
|
||||
this.Load += new System.EventHandler(this.GBGPUView_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
|
@ -327,6 +382,8 @@
|
|||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.groupBoxDetails.ResumeLayout(false);
|
||||
this.groupBoxDetails.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
@ -357,5 +414,8 @@
|
|||
private System.Windows.Forms.RadioButton radioButtonRefreshScanline;
|
||||
private System.Windows.Forms.RadioButton radioButtonRefreshFrame;
|
||||
private System.Windows.Forms.HScrollBar hScrollBarScanline;
|
||||
private System.Windows.Forms.GroupBox groupBoxDetails;
|
||||
private BmpView bmpViewDetails;
|
||||
private System.Windows.Forms.Label labelDetails;
|
||||
}
|
||||
}
|
|
@ -32,6 +32,7 @@ namespace BizHawk.MultiClient.GBtools
|
|||
bmpViewBGPal.ChangeBitmapSize(8, 4);
|
||||
bmpViewSPPal.ChangeBitmapSize(8, 4);
|
||||
bmpViewOAM.ChangeBitmapSize(320, 16);
|
||||
bmpViewDetails.ChangeBitmapSize(8, 16);
|
||||
|
||||
hScrollBarScanline.Value = 0;
|
||||
hScrollBarScanline_ValueChanged(null, null); // not firing in this case??
|
||||
|
@ -62,6 +63,8 @@ namespace BizHawk.MultiClient.GBtools
|
|||
bmpViewTiles2.Clear();
|
||||
bmpViewBGPal.Clear();
|
||||
bmpViewSPPal.Clear();
|
||||
bmpViewOAM.Clear();
|
||||
bmpViewDetails.Clear();
|
||||
cbscanline_emu = -4; // force refresh
|
||||
}
|
||||
else
|
||||
|
@ -72,45 +75,8 @@ namespace BizHawk.MultiClient.GBtools
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 0..153: scanline number. -1: frame. -2: manual
|
||||
/// </summary>
|
||||
int cbscanline;
|
||||
/// <summary>
|
||||
/// what was last passed to the emu core
|
||||
/// </summary>
|
||||
int cbscanline_emu = -4; // force refresh
|
||||
|
||||
/// <summary>
|
||||
/// put me in ToolsBefore
|
||||
/// </summary>
|
||||
public void UpdateValues()
|
||||
{
|
||||
if (!this.IsHandleCreated || this.IsDisposed)
|
||||
return;
|
||||
if (gb != null)
|
||||
{
|
||||
if (!this.Visible)
|
||||
{
|
||||
if (cbscanline_emu != -2)
|
||||
{
|
||||
cbscanline_emu = -2;
|
||||
gb.SetScanlineCallback(null, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cbscanline != cbscanline_emu)
|
||||
{
|
||||
cbscanline_emu = cbscanline;
|
||||
if (cbscanline == -2)
|
||||
gb.SetScanlineCallback(null, 0);
|
||||
else
|
||||
gb.SetScanlineCallback(ScanlineCallback, cbscanline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#region drawing primitives
|
||||
|
||||
/// <summary>
|
||||
/// draw a single 2bpp tile
|
||||
|
@ -351,6 +317,8 @@ namespace BizHawk.MultiClient.GBtools
|
|||
b.UnlockBits(lockdata);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void ScanlineCallback(int lcdc)
|
||||
{
|
||||
this.lcdc = lcdc;
|
||||
|
@ -470,6 +438,8 @@ namespace BizHawk.MultiClient.GBtools
|
|||
Restart();
|
||||
}
|
||||
|
||||
#region refresh
|
||||
|
||||
private void radioButtonRefreshFrame_CheckedChanged(object sender, EventArgs e) { ComputeRefreshValues(); }
|
||||
private void radioButtonRefreshScanline_CheckedChanged(object sender, EventArgs e) { ComputeRefreshValues(); }
|
||||
private void radioButtonRefreshManual_CheckedChanged(object sender, EventArgs e) { ComputeRefreshValues(); }
|
||||
|
@ -509,5 +479,226 @@ namespace BizHawk.MultiClient.GBtools
|
|||
{
|
||||
labelScanline.Text = ((hScrollBarScanline.Value + 145) % 154).ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 0..153: scanline number. -1: frame. -2: manual
|
||||
/// </summary>
|
||||
int cbscanline;
|
||||
/// <summary>
|
||||
/// what was last passed to the emu core
|
||||
/// </summary>
|
||||
int cbscanline_emu = -4; // force refresh
|
||||
|
||||
/// <summary>
|
||||
/// put me in ToolsBefore
|
||||
/// </summary>
|
||||
public void UpdateValues()
|
||||
{
|
||||
if (!this.IsHandleCreated || this.IsDisposed)
|
||||
return;
|
||||
if (gb != null)
|
||||
{
|
||||
if (!this.Visible)
|
||||
{
|
||||
if (cbscanline_emu != -2)
|
||||
{
|
||||
cbscanline_emu = -2;
|
||||
gb.SetScanlineCallback(null, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cbscanline != cbscanline_emu)
|
||||
{
|
||||
cbscanline_emu = cbscanline;
|
||||
if (cbscanline == -2)
|
||||
gb.SetScanlineCallback(null, 0);
|
||||
else
|
||||
gb.SetScanlineCallback(ScanlineCallback, cbscanline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region mouseovers
|
||||
|
||||
string freeze_label;
|
||||
Bitmap freeze_bmp;
|
||||
string freeze_details;
|
||||
|
||||
void SaveFreeze()
|
||||
{
|
||||
freeze_label = groupBoxDetails.Text;
|
||||
if (freeze_bmp != null)
|
||||
freeze_bmp.Dispose();
|
||||
freeze_bmp = (Bitmap)bmpViewDetails.bmp.Clone();
|
||||
freeze_details = labelDetails.Text;
|
||||
}
|
||||
|
||||
void LoadFreeze()
|
||||
{
|
||||
groupBoxDetails.Text = freeze_label;
|
||||
bmpViewDetails.Height = freeze_bmp.Height * 8;
|
||||
bmpViewDetails.ChangeBitmapSize(freeze_bmp.Size);
|
||||
using (var g = Graphics.FromImage(bmpViewDetails.bmp))
|
||||
g.DrawImageUnscaled(freeze_bmp, 0, 0);
|
||||
labelDetails.Text = freeze_details;
|
||||
bmpViewDetails.Refresh();
|
||||
}
|
||||
|
||||
unsafe void TilemapMouseover(int x, int y, bool win)
|
||||
{
|
||||
bmpViewDetails.ChangeBitmapSize(8, 8);
|
||||
if (bmpViewDetails.Height != 64)
|
||||
bmpViewDetails.Height = 64;
|
||||
var sb = new StringBuilder();
|
||||
bool secondmap = win ? lcdc.Bit(6) : lcdc.Bit(3);
|
||||
int mapoffs = secondmap ? 0x1c00 : 0x1800;
|
||||
x /= 8;
|
||||
y /= 8;
|
||||
mapoffs += y * 32 + x;
|
||||
byte *mapbase = (byte *)vram + mapoffs;
|
||||
int tileindex = mapbase[0];
|
||||
if (win || !lcdc.Bit(4)) // 0x9000 base
|
||||
if (tileindex < 128)
|
||||
tileindex += 256; // compute all if from 0x8000 base
|
||||
int tileoffs = tileindex * 16;
|
||||
var lockdata = bmpViewDetails.bmp.LockBits(new Rectangle(0, 0, 8, 8), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
if (!cgb)
|
||||
{
|
||||
sb.AppendLine(string.Format("{0} Map ({1},{2}) @{3:x4}", win ? "Win" : "BG", x, y, mapoffs + 0x8000));
|
||||
sb.AppendLine(string.Format(" Tile #{0} @{1:x4}", tileindex, tileoffs + 0x8000));
|
||||
DrawTile((byte*)vram + tileoffs, (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)bgpal);
|
||||
}
|
||||
else
|
||||
{
|
||||
int tileext = mapbase[8192];
|
||||
|
||||
sb.AppendLine(string.Format("{0} Map ({1},{2}) @{3:x4}", win ? "Win" : "BG", x, y, mapoffs + 0x8000));
|
||||
sb.AppendLine(string.Format(" Tile #{0} @{2}:{1:x4}", tileindex, tileoffs + 0x8000, tileext.Bit(3) ? 1 : 0));
|
||||
sb.AppendLine(string.Format(" Palette {0}", tileext & 7));
|
||||
sb.AppendLine(string.Format(" Flags {0}{1}{2}", tileext.Bit(5) ? 'H' : ' ', tileext.Bit(6) ? 'V' : ' ', tileext.Bit(7) ? 'P' : ' '));
|
||||
DrawTileHV((byte*)vram + tileoffs + (tileext.Bit(3) ? 8192 : 0), (int*)lockdata.Scan0, lockdata.Stride / sizeof(int), (int*)bgpal + 4 * (tileext & 7), tileext.Bit(5), tileext.Bit(6));
|
||||
}
|
||||
bmpViewDetails.bmp.UnlockBits(lockdata);
|
||||
labelDetails.Text = sb.ToString();
|
||||
bmpViewDetails.Refresh();
|
||||
}
|
||||
|
||||
private void bmpViewBG_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Background";
|
||||
}
|
||||
|
||||
private void bmpViewBG_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewBG_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
TilemapMouseover(e.X, e.Y, false);
|
||||
}
|
||||
|
||||
private void bmpViewWin_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Window";
|
||||
}
|
||||
|
||||
private void bmpViewWin_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewWin_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
TilemapMouseover(e.X, e.Y, true);
|
||||
}
|
||||
|
||||
private void bmpViewTiles1_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Tiles";
|
||||
}
|
||||
|
||||
private void bmpViewTiles1_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewTiles1_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bmpViewTiles2_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Tiles";
|
||||
}
|
||||
|
||||
private void bmpViewTiles2_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewTiles2_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bmpViewBGPal_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Palette";
|
||||
}
|
||||
|
||||
private void bmpViewBGPal_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewBGPal_Move(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bmpViewSPPal_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Palette";
|
||||
}
|
||||
|
||||
private void bmpViewSPPal_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewSPPal_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void bmpViewOAM_MouseEnter(object sender, EventArgs e)
|
||||
{
|
||||
SaveFreeze();
|
||||
groupBoxDetails.Text = "Details - Sprite";
|
||||
}
|
||||
|
||||
private void bmpViewOAM_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
LoadFreeze();
|
||||
}
|
||||
|
||||
private void bmpViewOAM_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue