Ram Search - save & load memory domain name in .wch files

This commit is contained in:
andres.delikat 2011-03-20 00:26:54 +00:00
parent 437e185e68
commit 77841c0c47
2 changed files with 16 additions and 1 deletions

View File

@ -1208,7 +1208,7 @@ namespace BizHawk.MultiClient
using (StreamWriter sw = new StreamWriter(path)) using (StreamWriter sw = new StreamWriter(path))
{ {
string str = ""; string str = "Domain " + Domain.Name + "\n";
for (int x = 0; x < searchList.Count; x++) for (int x = 0; x < searchList.Count; x++)
{ {
@ -1279,6 +1279,17 @@ namespace BizHawk.MultiClient
return count; return count;
} }
private int GetDomainPos(string name)
{
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
if (Global.Emulator.MemoryDomains[x].Name == name)
return x;
}
return 0;
}
bool LoadSearchFile(string path, bool append, bool truncate, List<Watch> list) bool LoadSearchFile(string path, bool append, bool truncate, List<Watch> list)
{ {
int y, z; int y, z;
@ -1305,6 +1316,9 @@ namespace BizHawk.MultiClient
//Any properly formatted line couldn't possibly be this short anyway, this also takes care of any garbage lines that might be in a file //Any properly formatted line couldn't possibly be this short anyway, this also takes care of any garbage lines that might be in a file
if (s.Length < 5) continue; if (s.Length < 5) continue;
if (s.Substring(0, 6) == "Domain")
SetMemoryDomain(GetDomainPos(s.Substring(7, s.Length - 7)));
z = HowMany(s, '\t'); z = HowMany(s, '\t');
if (z == 5) if (z == 5)
{ {

View File

@ -17,6 +17,7 @@ namespace BizHawk.MultiClient
public partial class RamWatch : Form public partial class RamWatch : Form
{ {
//TODO: //TODO:
//Make default .wch filename based on Rom, ditto for Ram Search & Cheat Search
//address num digits based on domain size //address num digits based on domain size
//Restore window size should restore column order as well //Restore window size should restore column order as well
//When receiving a watch from a different domain, should something be done? //When receiving a watch from a different domain, should something be done?