Minor fixup to debug menu

This commit is contained in:
YoshiRulz 2021-08-05 04:37:55 +10:00
parent ec2baf17af
commit a6e36b30be
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 4 additions and 4 deletions

View File

@ -62,9 +62,9 @@ namespace BizHawk.Client.EmuHawk
else if (pi.PropertyType.IsEnum) propDict[pi] = Enum.GetValues(pi.PropertyType).Cast<object>().ToArray();
}
static object RandomElem(IReadOnlyList<object> a, Random rng) => a[rng.Next(a.Count)];
Random rng = new();
void Fuzz(bool limit)
{
Random rng = new();
var props = propDict.Keys.ToList();
if (limit)
{
@ -77,9 +77,9 @@ namespace BizHawk.Client.EmuHawk
foreach (var pi in props) pi.SetValue(obj: glidenSS, value: RandomElem(propDict[pi], rng));
((MainForm) MainForm).PutCoreSyncSettings(ss);
}
SzButtonEx btnLightFuzz = new() { Size = new(200, 23), Text = "=> randomise some props" };
SzButtonEx btnLightFuzz = new() { Size = new(200, 23), Text = "--> randomise some props" };
btnLightFuzz.Click += (_, _) => Fuzz(limit: true);
SzButtonEx btnHeavyFuzz = new() { Size = new(200, 23), Text = "=> randomise every prop" };
SzButtonEx btnHeavyFuzz = new() { Size = new(200, 23), Text = "--> randomise every prop" };
btnHeavyFuzz.Click += (_, _) => Fuzz(limit: false);
Controls.Add(new SingleColumnFLP { Controls = { comboPlugin, btnLightFuzz, btnHeavyFuzz } });
ResumeLayout();
@ -117,7 +117,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var item in ((ToolStripMenuItemEx) ddoSender).DropDownItems.OfType<DebugVSystemMenuItem>())
{
var groupEnabled = item.Text == sysID || item.ExtraSysIDs.Contains(sysID);
foreach (var child in item.DropDownItems.Cast<DebugVSystemChildItem>().Where(child => child.RequiresLoadedRom)) // RequiresLoadedRom == false => leave Enabled as default true
foreach (var child in item.DropDownItems.Cast<DebugVSystemChildItem>().Where(static child => child.RequiresLoadedRom)) // RequiresLoadedRom == false => leave Enabled as default true
{
child.Enabled = groupEnabled && (child.RequiresCore is null || child.RequiresCore == coreName);
}