Ram Watch/Ram Search - small speed optimization to the QueryItemText functions

This commit is contained in:
andres.delikat 2011-08-27 13:20:02 +00:00
parent 18a6b21deb
commit c7e8e7ece1
2 changed files with 6 additions and 3 deletions

View File

@ -44,7 +44,7 @@ namespace BizHawk.MultiClient
int defaultPrevWidth; int defaultPrevWidth;
int defaultChangesWidth; int defaultChangesWidth;
string currentSearchFile = ""; string currentSearchFile = "";
string addressFormatStr = "{0:X4} ";
bool sortReverse; bool sortReverse;
string sortedCol; string sortedCol;
@ -184,6 +184,7 @@ namespace BizHawk.MultiClient
} }
SetPlatformAndMemoryDomainLabel(); SetPlatformAndMemoryDomainLabel();
StartNewSearch(); StartNewSearch();
addressFormatStr = "X" + GetNumDigits(Domain.Size - 1).ToString();
} }
private void SetTotal() private void SetTotal()
@ -563,7 +564,7 @@ namespace BizHawk.MultiClient
text = ""; text = "";
if (column == 0) if (column == 0)
{ {
text = searchList[index].address.ToString("X" + GetNumDigits(Domain.Size - 1).ToString()); text = searchList[index].address.ToString(addressFormatStr);
} }
if (column == 1) if (column == 1)
{ {

View File

@ -34,6 +34,7 @@ namespace BizHawk.MultiClient
string currentWatchFile = ""; string currentWatchFile = "";
bool changes = false; bool changes = false;
List<ToolStripMenuItem> domainMenuItems = new List<ToolStripMenuItem>(); List<ToolStripMenuItem> domainMenuItems = new List<ToolStripMenuItem>();
string addressFormatStr = "{0:X4} ";
string sortedCol; string sortedCol;
bool sortReverse; bool sortReverse;
@ -168,7 +169,7 @@ namespace BizHawk.MultiClient
if (watchList[index].type == atype.SEPARATOR) if (watchList[index].type == atype.SEPARATOR)
text = ""; text = "";
else else
text = String.Format("{0:X" + GetNumDigits((Domain.Size - 1)).ToString() + "}", watchList[index].address); text = watchList[index].address.ToString(addressFormatStr);
} }
if (column == 1) //Value if (column == 1) //Value
{ {
@ -1321,6 +1322,7 @@ namespace BizHawk.MultiClient
{ {
Domain = Global.Emulator.MemoryDomains[pos]; Domain = Global.Emulator.MemoryDomains[pos];
} }
addressFormatStr = "X" + GetNumDigits(Domain.Size - 1).ToString();
SetPlatformAndMemoryDomainLabel(); SetPlatformAndMemoryDomainLabel();
Update(); Update();
} }