Ram Search - don't allow user to select domains larger than 64mb

This commit is contained in:
adelikat 2013-09-29 15:42:00 +00:00
parent ad4f45d4e3
commit 665ceac228
2 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,7 @@ namespace BizHawk.MultiClient
{
class ToolHelpers
{
public static ToolStripMenuItem[] GenerateMemoryDomainMenuItems(Action<int> SetCallback, string SelectedDomain = "")
public static ToolStripMenuItem[] GenerateMemoryDomainMenuItems(Action<int> SetCallback, string SelectedDomain = "", int? maxSize = null)
{
var items = new List<ToolStripMenuItem>();
@ -28,6 +28,11 @@ namespace BizHawk.MultiClient
item.Checked = true;
}
if (maxSize.HasValue && domain.Size > maxSize.Value)
{
item.Enabled = false;
}
items.Add(item);
counter++;
}

View File

@ -45,7 +45,8 @@ namespace BizHawk.MultiClient
private bool dropdown_dontfire = false; //Used as a hack to get around lame .net dropdowns, there's no way to set their index without firing the selectedindexchanged event!
public const int MaxDetailedSize = 1048576; //1mb, semi-arbituary decision, sets the size to check for and automatically switch to fast mode for the user
public const int MaxDetailedSize = (1024 * 1024); //1mb, semi-arbituary decision, sets the size to check for and automatically switch to fast mode for the user
public const int MaxSupportedSize = (1024 * 1024 * 64); //64mb, semi-arbituary decision, sets the maximum size ram search will support (as it will crash beyond this)
#region Initialize, Load, and Save
@ -851,7 +852,7 @@ namespace BizHawk.MultiClient
private void MemoryDomainsSubMenu_DropDownOpened(object sender, EventArgs e)
{
MemoryDomainsSubMenu.DropDownItems.Clear();
MemoryDomainsSubMenu.DropDownItems.AddRange(ToolHelpers.GenerateMemoryDomainMenuItems(SetMemoryDomain, Searches.DomainName));
MemoryDomainsSubMenu.DropDownItems.AddRange(ToolHelpers.GenerateMemoryDomainMenuItems(SetMemoryDomain, Searches.DomainName, MaxSupportedSize));
}
private void SizeSubMenu_DropDownOpened(object sender, EventArgs e)