snesgfx-overhaul layout again; support bigger viewport windows and configurable viewport size; fix crashes in out of range palette area mouseovers
This commit is contained in:
parent
90cdebbc30
commit
15cd1ef6c3
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,6 @@
|
||||||
using System;
|
//TODO - disable scanline controls if box is unchecked
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
@ -25,6 +27,7 @@ namespace BizHawk.MultiClient
|
||||||
comboBGProps.SelectedIndex = 0;
|
comboBGProps.SelectedIndex = 0;
|
||||||
|
|
||||||
tabctrlDetails.SelectedIndex = 1;
|
tabctrlDetails.SelectedIndex = 1;
|
||||||
|
SyncViewerSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
LibsnesCore currentSnesCore;
|
LibsnesCore currentSnesCore;
|
||||||
|
@ -59,6 +62,7 @@ namespace BizHawk.MultiClient
|
||||||
public void UpdateToolsAfter()
|
public void UpdateToolsAfter()
|
||||||
{
|
{
|
||||||
SyncCore();
|
SyncCore();
|
||||||
|
if (!checkScanlineControl.Checked) UpdateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateToolsLoadstate()
|
public void UpdateToolsLoadstate()
|
||||||
|
@ -93,8 +97,13 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
currentSnesCore = core;
|
currentSnesCore = core;
|
||||||
|
|
||||||
if(currentSnesCore != null)
|
if (currentSnesCore != null)
|
||||||
|
{
|
||||||
|
if (checkScanlineControl.Checked)
|
||||||
currentSnesCore.ScanlineHookManager.Register(this, ScanlineHook);
|
currentSnesCore.ScanlineHookManager.Register(this, ScanlineHook);
|
||||||
|
else
|
||||||
|
currentSnesCore.ScanlineHookManager.Unregister(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScanlineHook(int line)
|
void ScanlineHook(int line)
|
||||||
|
@ -143,34 +152,6 @@ namespace BizHawk.MultiClient
|
||||||
RenderPalette();
|
RenderPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] lastPalette;
|
|
||||||
|
|
||||||
void RenderPalette()
|
|
||||||
{
|
|
||||||
var gd = new SNESGraphicsDecoder();
|
|
||||||
lastPalette = gd.GetPalette();
|
|
||||||
|
|
||||||
int pixsize = 16*16 + 3*17;
|
|
||||||
var bmp = new Bitmap(pixsize, pixsize, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
|
||||||
using (var g = Graphics.FromImage(bmp))
|
|
||||||
{
|
|
||||||
for (int y = 0; y < 16; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < 16; x++)
|
|
||||||
{
|
|
||||||
int rgb555 = lastPalette[y * 16 + x];
|
|
||||||
int color = gd.Colorize(rgb555);
|
|
||||||
using (var brush = new SolidBrush(Color.FromArgb(color)))
|
|
||||||
{
|
|
||||||
g.FillRectangle(brush, new Rectangle(3+x * 19, 3+y * 19, 16, 16));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
paletteViewer.SetBitmap(bmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
//todo - something smarter to cycle through bitmaps without repeatedly trashing them (use the dispose callback on the viewer)
|
//todo - something smarter to cycle through bitmaps without repeatedly trashing them (use the dispose callback on the viewer)
|
||||||
void RenderView()
|
void RenderView()
|
||||||
{
|
{
|
||||||
|
@ -337,14 +318,47 @@ namespace BizHawk.MultiClient
|
||||||
ClearDetails();
|
ClearDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int paletteCellSize = 17;
|
||||||
|
const int paletteCellSpacing = 3;
|
||||||
|
|
||||||
|
int[] lastPalette;
|
||||||
|
|
||||||
|
void RenderPalette()
|
||||||
|
{
|
||||||
|
var gd = new SNESGraphicsDecoder();
|
||||||
|
lastPalette = gd.GetPalette();
|
||||||
|
|
||||||
|
int pixsize = paletteCellSize * 16 + paletteCellSpacing * 17;
|
||||||
|
int cellTotalSize = (paletteCellSize + paletteCellSpacing);
|
||||||
|
var bmp = new Bitmap(pixsize, pixsize, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||||
|
using (var g = Graphics.FromImage(bmp))
|
||||||
|
{
|
||||||
|
for (int y = 0; y < 16; y++)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < 16; x++)
|
||||||
|
{
|
||||||
|
int rgb555 = lastPalette[y * 16 + x];
|
||||||
|
int color = gd.Colorize(rgb555);
|
||||||
|
using (var brush = new SolidBrush(Color.FromArgb(color)))
|
||||||
|
{
|
||||||
|
g.FillRectangle(brush, new Rectangle(3 + x * cellTotalSize, 3 + y * cellTotalSize, paletteCellSize, paletteCellSize));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
paletteViewer.SetBitmap(bmp);
|
||||||
|
}
|
||||||
|
|
||||||
private void paletteViewer_MouseMove(object sender, MouseEventArgs e)
|
private void paletteViewer_MouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var pt = e.Location;
|
var pt = e.Location;
|
||||||
pt.X -= 3;
|
pt.X -= paletteCellSpacing;
|
||||||
pt.Y -= 3;
|
pt.Y -= paletteCellSpacing;
|
||||||
int tx = pt.X / 19;
|
int tx = pt.X / (paletteCellSize + paletteCellSpacing);
|
||||||
int ty = pt.Y / 19;
|
int ty = pt.Y / (paletteCellSize + paletteCellSpacing);
|
||||||
int colorNum = ty*16+tx;
|
if (tx >= 16 || ty >= 16) return;
|
||||||
|
int colorNum = ty * 16 + tx;
|
||||||
|
|
||||||
int rgb555 = lastPalette[colorNum];
|
int rgb555 = lastPalette[colorNum];
|
||||||
var gd = new SNESGraphicsDecoder();
|
var gd = new SNESGraphicsDecoder();
|
||||||
|
@ -372,5 +386,22 @@ namespace BizHawk.MultiClient
|
||||||
//cd.ShowDialog(this);
|
//cd.ShowDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void rbQuad_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SyncViewerSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SyncViewerSize()
|
||||||
|
{
|
||||||
|
if (rbQuadAll.Checked)
|
||||||
|
viewer.Size = new Size(1024, 1024);
|
||||||
|
else
|
||||||
|
viewer.Size = new Size(512, 512);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkScanlineControl_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SyncCore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,4 +120,7 @@
|
||||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>17, 17</value>
|
<value>17, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>25</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
Loading…
Reference in New Issue