Slight Dialog performance tweaks

This commit is contained in:
andres.delikat 2011-08-27 04:32:54 +00:00
parent 35ead836d2
commit 293b7133c5
2 changed files with 49 additions and 48 deletions

View File

@ -24,6 +24,7 @@ namespace BizHawk.MultiClient
string Header = ""; string Header = "";
int NumDigits = 4; int NumDigits = 4;
string NumDigitsStr = "{0:X4} "; string NumDigitsStr = "{0:X4} ";
string DigitFormatString = "{0:X2} ";
char[] nibbles = { 'G', 'G', 'G', 'G' , 'G', 'G', 'G', 'G'}; //G = off 0-9 & A-F are acceptable values char[] nibbles = { 'G', 'G', 'G', 'G' , 'G', 'G', 'G', 'G'}; //G = off 0-9 & A-F are acceptable values
int addressHighlighted = -1; int addressHighlighted = -1;
int addressOver = -1; int addressOver = -1;
@ -92,8 +93,6 @@ namespace BizHawk.MultiClient
} }
public string GenerateMemoryViewString() public string GenerateMemoryViewString()
{
unchecked
{ {
StringBuilder rowStr = new StringBuilder(""); StringBuilder rowStr = new StringBuilder("");
addrOffset = (NumDigits % 4) * 9; addrOffset = (NumDigits % 4) * 9;
@ -111,7 +110,7 @@ namespace BizHawk.MultiClient
for (int j = 0; j < 16; j += Global.Config.HexEditorDataSize) for (int j = 0; j < 16; j += Global.Config.HexEditorDataSize)
{ {
if (addr + j < Domain.Size) if (addr + j < Domain.Size)
rowStr.AppendFormat("{0:X" + (Global.Config.HexEditorDataSize * 2).ToString() + "} ", MakeValue(addr + j)); rowStr.AppendFormat(DigitFormatString, MakeValue(addr + j));
} }
rowStr.Append(" | "); rowStr.Append(" | ");
for (int k = 0; k < 16; k++) for (int k = 0; k < 16; k++)
@ -123,7 +122,6 @@ namespace BizHawk.MultiClient
} }
return rowStr.ToString(); return rowStr.ToString();
} }
}
static char Remap(byte val) static char Remap(byte val)
{ {
@ -137,31 +135,34 @@ namespace BizHawk.MultiClient
private int MakeValue(int addr) private int MakeValue(int addr)
{ {
unchecked
{
switch (Global.Config.HexEditorDataSize) switch (Global.Config.HexEditorDataSize)
{ {
default: default:
case 1: case 1:
return Domain.PeekByte(addr); return Domain.PeekByte(addr);
case 2: case 2:
return MakeWord(addr, Global.Config.HexEditorBigEndian); if (Global.Config.HexEditorBigEndian)
return MakeWordBig(addr);
else
return MakeWordLittle(addr);
case 4: case 4:
return (MakeWord(addr, Global.Config.HexEditorBigEndian) * 65536) + if (Global.Config.HexEditorBigEndian)
MakeWord(addr + 2, Global.Config.HexEditorBigEndian); return (MakeWordBig(addr) * 65536) + MakeWordBig(addr + 2);
} else
return (MakeWordLittle(addr) * 65536) + MakeWordLittle(addr);
} }
} }
private int MakeWord(int addr, bool endian) private int MakeWordBig(int addr)
{ {
unchecked System.Diagnostics.Debugger.Break();
{
if (endian)
return (Domain.PeekByte(addr) * 256) + Domain.PeekByte(addr + 1); return (Domain.PeekByte(addr) * 256) + Domain.PeekByte(addr + 1);
else
return Domain.PeekByte(addr) + (Domain.PeekByte(addr + 1) * 256);
} }
private int MakeWordLittle(int addr)
{
return Domain.PeekByte(addr) + (Domain.PeekByte(addr + 1) * 256);
} }
public void Restart() public void Restart()
@ -395,7 +396,7 @@ namespace BizHawk.MultiClient
{ {
if (size == 1 || size == 2 || size == 4) if (size == 1 || size == 2 || size == 4)
Global.Config.HexEditorDataSize = size; Global.Config.HexEditorDataSize = size;
DigitFormatString = "{0:X" + (Global.Config.HexEditorDataSize * 2).ToString() + "} ";
SetHeader(); SetHeader();
UpdateGroupBoxTitle(); UpdateGroupBoxTitle();
UpdateValues(); UpdateValues();

View File

@ -63,8 +63,8 @@ namespace BizHawk.MultiClient
public void UpdateValues() public void UpdateValues()
{ {
WatchListView.BlazingFast = true;
if (!this.IsHandleCreated || this.IsDisposed) return; if (!this.IsHandleCreated || this.IsDisposed) return;
WatchListView.BlazingFast = true;
for (int x = 0; x < watchList.Count; x++) for (int x = 0; x < watchList.Count; x++)
{ {
watchList[x].prev = watchList[x].value; watchList[x].prev = watchList[x].value;