From 0b44f8dd4107410779ce06075cee4a4eadba4483 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 10 Mar 2011 04:48:50 +0000 Subject: [PATCH] Ram Watch - format address value number of digits based on the domain size --- BizHawk.MultiClient/tools/RamWatch.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index 48aa4cb857..1da751fdba 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -125,7 +125,7 @@ namespace BizHawk.MultiClient if (watchList[index].type == atype.SEPARATOR) text = ""; else - text = String.Format("{0:X}", watchList[index].address); + text = String.Format("{0:X" + GetNumDigits((Global.Emulator.MainMemory.Size - 1)).ToString() + "}", watchList[index].address); } if (column == 1) //Value { @@ -1052,5 +1052,18 @@ namespace BizHawk.MultiClient Global.MainForm.HexEditor1.GoToAddress(watchList[indexes[0]].address); } } + + private int GetNumDigits(Int32 i) + { + //if (i == 0) return 0; + //if (i < 0x10) return 1; + //if (i < 0x100) return 2; + //if (i < 0x1000) return 3; //adelikat: commenting these out because I decided that regardless of domain, 4 digits should be the minimum + if (i < 0x10000) return 4; + //if (i < 0x100000) return 5; + if (i < 0x1000000) return 6; + //if (i < 0x10000000) return 7; + else return 8; + } } } \ No newline at end of file