2013-09-14 19:07:11 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.MultiClient
|
|
|
|
|
{
|
|
|
|
|
class RamSearchEngine
|
|
|
|
|
{
|
2013-09-14 23:30:23 +00:00
|
|
|
|
private WatchList _watchList;
|
2013-09-16 01:24:06 +00:00
|
|
|
|
private Settings _settings;
|
2013-09-14 19:07:11 +00:00
|
|
|
|
|
|
|
|
|
#region Constructors
|
2013-09-16 01:24:06 +00:00
|
|
|
|
|
|
|
|
|
public RamSearchEngine(Settings settings)
|
2013-09-14 19:07:11 +00:00
|
|
|
|
{
|
2013-09-16 01:24:06 +00:00
|
|
|
|
_settings = settings;
|
2013-09-14 19:07:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2013-09-14 23:30:23 +00:00
|
|
|
|
#region Initialize, Manipulate
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
2013-09-16 01:24:06 +00:00
|
|
|
|
_watchList = new WatchList(_settings.Domain);
|
2013-09-14 23:30:23 +00:00
|
|
|
|
|
|
|
|
|
//TODO: other byte sizes, mis-aligned
|
2013-09-16 01:24:06 +00:00
|
|
|
|
for (int i = 0; i < _settings.Domain.Size; i++)
|
2013-09-14 23:30:23 +00:00
|
|
|
|
{
|
2013-09-16 01:24:06 +00:00
|
|
|
|
_watchList.Add(Watch.GenerateWatch(_settings.Domain, i, _settings.Size, _settings.Mode == Settings.SearchMode.Detailed));
|
2013-09-14 23:30:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-14 19:07:11 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Exposes the current watch state based on index
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Watch this[int index]
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2013-09-14 23:30:23 +00:00
|
|
|
|
return _watchList[index];
|
2013-09-14 19:07:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Count
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2013-09-14 23:30:23 +00:00
|
|
|
|
return _watchList.Count;
|
2013-09-14 19:07:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string DomainName
|
|
|
|
|
{
|
2013-09-16 01:24:06 +00:00
|
|
|
|
get { return _settings.Domain.Name; }
|
2013-09-14 19:07:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-14 23:30:23 +00:00
|
|
|
|
public void Update()
|
|
|
|
|
{
|
2013-09-16 01:24:06 +00:00
|
|
|
|
//TODO
|
2013-09-14 23:30:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Comparisons
|
|
|
|
|
|
|
|
|
|
public void LessThan()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LessThanOrEqual()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GreaterThan()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GreaterThanOrEqual()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Equal()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void NotEqual()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-14 19:07:11 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Private parts
|
|
|
|
|
#endregion
|
2013-09-16 01:24:06 +00:00
|
|
|
|
|
|
|
|
|
#region Classes
|
|
|
|
|
public class Settings
|
|
|
|
|
{
|
|
|
|
|
/*Require restart*/
|
|
|
|
|
public enum SearchMode { Fast, Detailed }
|
|
|
|
|
public SearchMode Mode = SearchMode.Detailed;
|
|
|
|
|
public MemoryDomain Domain = Global.Emulator.MainMemory;
|
|
|
|
|
public Watch.WatchSize Size = Watch.WatchSize.Byte;
|
|
|
|
|
public bool CheckMisAligned = false;
|
|
|
|
|
|
|
|
|
|
/*Can be changed mid-search*/
|
|
|
|
|
public Watch.DisplayType Type = Watch.DisplayType.Unsigned;
|
|
|
|
|
public bool BigEndian = false;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2013-09-14 19:07:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|