Debugger: Fixed mouse over precision in PPU viewer (cause by recent DPI-related changes)

This commit is contained in:
Souryo 2017-09-28 20:34:14 -04:00
parent b8f51f876a
commit 8e37b81d3a
5 changed files with 15 additions and 15 deletions

View File

@ -217,8 +217,8 @@ namespace Mesen.GUI.Debugger.Controls
private void picChrBank_MouseMove(object sender, MouseEventArgs e)
{
int tileX = Math.Min(e.X * 256 / picChrBank1.Width / 16, 15);
int tileY = Math.Min(e.Y * 256 / picChrBank1.Height / 16, 15);
int tileX = Math.Min(e.X * 256 / (picChrBank1.Width - 2) / 16, 15);
int tileY = Math.Min(e.Y * 256 / (picChrBank1.Height - 2) / 16, 15);
bool bottomBank = sender == this.picChrBank2;
int tileIndex = tileY * 16 + tileX;
@ -234,8 +234,8 @@ namespace Mesen.GUI.Debugger.Controls
private void picChrBank_MouseDown(object sender, MouseEventArgs e)
{
int tileX = Math.Min(e.X * 256 / picChrBank1.Width / 16, 15);
int tileY = Math.Min(e.Y * 256 / picChrBank1.Height / 16, 15);
int tileX = Math.Min(e.X * 256 / (picChrBank1.Width - 2) / 16, 15);
int tileY = Math.Min(e.Y * 256 / (picChrBank1.Height - 2)/ 16, 15);
_tileIndex = tileY * 16 + tileX;
_bottomBank = sender == this.picChrBank2;

View File

@ -177,9 +177,9 @@ namespace Mesen.GUI.Debugger.Controls
private void picNametable_MouseMove(object sender, MouseEventArgs e)
{
int xPos = e.X * 512 / picNametable.Width;
int yPos = e.Y * 480 / picNametable.Height;
int xPos = e.X * 512 / (picNametable.Width - 2);
int yPos = e.Y * 480 / (picNametable.Height - 2);
_nametableIndex = 0;
if(xPos >= 256) {
_nametableIndex++;

View File

@ -69,8 +69,8 @@ namespace Mesen.GUI.Debugger.Controls
private void picPalette_MouseMove(object sender, MouseEventArgs e)
{
int tileX = Math.Min(e.X * 128 / picPalette.Width / 32, 31);
int tileY = Math.Min(e.Y * 256 / picPalette.Height / 32, 31);
int tileX = Math.Min(e.X * 128 / (picPalette.Width - 2) / 32, 31);
int tileY = Math.Min(e.Y * 256 / (picPalette.Height - 2) / 32, 31);
int tileIndex = tileY * 4 + tileX;

View File

@ -119,8 +119,8 @@ namespace Mesen.GUI.Debugger.Controls
{
_previewMousePosition = null;
int tileX = Math.Min(e.X * 256 / picSprites.Width / 32, 31);
int tileY = Math.Min(e.Y * 512 / picSprites.Height / 64, 63);
int tileX = Math.Min(e.X * 256 / (picSprites.Width - 2) / 32, 31);
int tileY = Math.Min(e.Y * 512 / (picSprites.Height - 2) / 64, 63);
int ramAddr = ((tileY << 3) + tileX) << 2;
if(ramAddr / 4 == _selectedSprite && !_forceRefresh) {
@ -244,8 +244,8 @@ namespace Mesen.GUI.Debugger.Controls
private void SelectSpriteUnderCursor()
{
Point p = _previewMousePosition.Value;
int xPos = p.X * 256 / picPreview.Width;
int yPos = p.Y * 240 / picPreview.Height;
int xPos = p.X * 256 / (picPreview.Width - 2);
int yPos = p.Y * 240 / (picPreview.Height - 2);
int prevSprite = _selectedSprite;
_selectedSprite = -1;
for(int i = 0x100 - 4; i >= 0; i-=4) {

View File

@ -131,13 +131,13 @@ namespace Mesen.GUI.Debugger.Controls
private void picPaletteSelection_MouseMove(object sender, MouseEventArgs e)
{
_hoverColor = e.X * 128 / this.Width / 32;
_hoverColor = e.X * 128 / (this.Width - 2) / 32;
RefreshPalette();
}
private void picPaletteSelection_MouseDown(object sender, MouseEventArgs e)
{
this.SelectedColor = e.X * 128 / this.Width / 32;
this.SelectedColor = e.X * 128 / (this.Width - 2) / 32;
RefreshPalette();
}