Watch object - add ValueToString() and PrevToString() methods and make Ram Watch use these methods and thus simplify the UpdateValues logic. Added an override for ToString() that displays notes + value in preparation for a on screen ram watch option.
This commit is contained in:
parent
7db54e08a8
commit
73add14d28
|
@ -177,34 +177,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
if (column == 1) //Value
|
if (column == 1) //Value
|
||||||
{
|
{
|
||||||
if (watchList[index].type == atype.SEPARATOR)
|
text = watchList[index].ValueToString();
|
||||||
text = "";
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (watchList[index].signed)
|
|
||||||
{
|
|
||||||
case asigned.HEX:
|
|
||||||
switch (watchList[index].type)
|
|
||||||
{
|
|
||||||
case atype.BYTE:
|
|
||||||
text = String.Format("{0:X2}", watchList[index].value);
|
|
||||||
break;
|
|
||||||
case atype.WORD:
|
|
||||||
text = String.Format("{0:X4}", watchList[index].value);
|
|
||||||
break;
|
|
||||||
case atype.DWORD:
|
|
||||||
text = String.Format("{0:X8}", watchList[index].value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case asigned.SIGNED:
|
|
||||||
text = ((sbyte)watchList[index].value).ToString();
|
|
||||||
break;
|
|
||||||
case asigned.UNSIGNED:
|
|
||||||
text = watchList[index].value.ToString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (column == 2) //Prev
|
if (column == 2) //Prev
|
||||||
{
|
{
|
||||||
|
@ -222,29 +195,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (watchList[index].signed)
|
text = watchList[index].PrevToString();
|
||||||
{
|
|
||||||
case asigned.HEX:
|
|
||||||
switch (watchList[index].type)
|
|
||||||
{
|
|
||||||
case atype.BYTE:
|
|
||||||
text = String.Format("{0:X2}", watchList[index].prev);
|
|
||||||
break;
|
|
||||||
case atype.WORD:
|
|
||||||
text = String.Format("{0:X4}", watchList[index].prev);
|
|
||||||
break;
|
|
||||||
case atype.DWORD:
|
|
||||||
text = String.Format("{0:X8}", watchList[index].prev);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case asigned.SIGNED:
|
|
||||||
text = ((sbyte)watchList[index].prev).ToString();
|
|
||||||
break;
|
|
||||||
case asigned.UNSIGNED:
|
|
||||||
text = watchList[index].prev.ToString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,6 +231,73 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (type == atype.SEPARATOR)
|
||||||
|
return "";
|
||||||
|
|
||||||
|
StringBuilder str = new StringBuilder(notes);
|
||||||
|
str.Append(": ");
|
||||||
|
str.Append(ValueToString());
|
||||||
|
return str.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ValueToString()
|
||||||
|
{
|
||||||
|
if (type == atype.SEPARATOR)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (signed)
|
||||||
|
{
|
||||||
|
case asigned.HEX:
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case atype.BYTE:
|
||||||
|
return String.Format("{0:X2}", value);
|
||||||
|
case atype.WORD:
|
||||||
|
return String.Format("{0:X4}", value);
|
||||||
|
case atype.DWORD:
|
||||||
|
return String.Format("{0:X8}", value);
|
||||||
|
}
|
||||||
|
case asigned.SIGNED:
|
||||||
|
return ((sbyte)value).ToString();
|
||||||
|
default:
|
||||||
|
case asigned.UNSIGNED:
|
||||||
|
return value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string PrevToString()
|
||||||
|
{
|
||||||
|
if (type == atype.SEPARATOR)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (signed)
|
||||||
|
{
|
||||||
|
case asigned.HEX:
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case atype.BYTE:
|
||||||
|
return String.Format("{0:X2}", prev);
|
||||||
|
case atype.WORD:
|
||||||
|
return String.Format("{0:X4}", prev);
|
||||||
|
case atype.DWORD:
|
||||||
|
return String.Format("{0:X8}", prev);
|
||||||
|
}
|
||||||
|
case asigned.SIGNED:
|
||||||
|
return ((sbyte)prev).ToString();
|
||||||
|
default:
|
||||||
|
case asigned.UNSIGNED:
|
||||||
|
return prev.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private int CompareAddress(Watch Other)
|
private int CompareAddress(Watch Other)
|
||||||
{
|
{
|
||||||
if (this.address < Other.address)
|
if (this.address < Other.address)
|
||||||
|
|
Loading…
Reference in New Issue