Ram Watch - Implement separator feature + reading it from files. Todo: Insert Separator menu/toolbar item

This commit is contained in:
andres.delikat 2011-01-21 18:37:53 +00:00
parent ffa43f795e
commit 479dc75b32
2 changed files with 24 additions and 5 deletions

View File

@ -21,6 +21,7 @@ namespace BizHawk.MultiClient
//TODO: Call AskSave in main client X function
//Address can be changed, when that event is triggered, open the edit watch dialog
//Append sets the currentWatach file to the new file rather than the old!
//Save as displays the old file in the message label instead of the new one
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
List<Watch> watchList = new List<Watch>();
@ -31,6 +32,7 @@ namespace BizHawk.MultiClient
{
for (int x = 0; x < watchList.Count; x++)
{
if (watchList[x].type == atype.SEPARATOR) continue;
watchList[x].value = Global.Emulator.MainMemory.PeekByte(watchList[x].address);
//TODO: readbytes based on type, size, endian values
}
@ -464,10 +466,22 @@ namespace BizHawk.MultiClient
WatchListView.Items.Clear();
for (int x = 0; x < watchList.Count; x++)
{
ListViewItem item = new ListViewItem(String.Format("{0:X4}", watchList[x].address));
item.SubItems.Add(watchList[x].value.ToString());
item.SubItems.Add(watchList[x].notes);
WatchListView.Items.Add(item);
if (watchList[x].type == atype.SEPARATOR)
{
ListViewItem item = new ListViewItem("");
item.SubItems.Add("");
item.SubItems.Add("");
item.BackColor = this.BackColor;
WatchListView.Items.Add(item);
}
else
{
ListViewItem item = new ListViewItem(String.Format("{0:X4}", watchList[x].address));
item.SubItems.Add(watchList[x].value.ToString());
item.SubItems.Add(watchList[x].notes);
WatchListView.Items.Add(item);
}
}
}

View File

@ -6,7 +6,7 @@ using System.Text;
namespace BizHawk.MultiClient
{
//Data structure for a watch item in the Ram Watch Dialog
public enum atype { BYTE, WORD, DWORD }; //TODO: more custom types too like 12.4 and 24.12 fixed point
public enum atype { BYTE, WORD, DWORD, SEPARATOR }; //TODO: more custom types too like 12.4 and 24.12 fixed point
public enum asigned { SIGNED, UNSIGNED, HEX };
public class Watch
{
@ -48,6 +48,9 @@ namespace BizHawk.MultiClient
case 'd':
type = atype.DWORD;
return true;
case 'S':
type = atype.SEPARATOR;
return true;
default:
return false;
}
@ -63,6 +66,8 @@ namespace BizHawk.MultiClient
return 'w';
case atype.DWORD:
return 'd';
case atype.SEPARATOR:
return 'S';
default:
return 'b'; //Just in case
}