parent
0e9cc431d9
commit
90b0574bc3
|
@ -89,17 +89,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (!Frozen)
|
||||
{
|
||||
var removed = false;
|
||||
foreach (var recent in recentlist.ToList())
|
||||
{
|
||||
if (string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||
{
|
||||
recentlist.Remove(newFile); // intentionally keeps iterating after this to remove duplicate instances, though those should never exist in the first place
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return removed;
|
||||
return recentlist.RemoveAll(recent => string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0) != 0; // none removed => return false
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -96,13 +96,8 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
List<Binding> entriesToRemove = (from entry in Bindings let binding = DefaultValues.FirstOrDefault(b => b.DisplayName == entry.DisplayName) where binding == null select entry).ToList();
|
||||
|
||||
// Remove entries that no longer exist in defaults
|
||||
foreach (Binding entry in entriesToRemove)
|
||||
{
|
||||
Bindings.Remove(entry);
|
||||
}
|
||||
Bindings.RemoveAll(entry => DefaultValues.All(b => b.DisplayName != entry.DisplayName));
|
||||
}
|
||||
|
||||
private static List<Binding> _defaultValues;
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
// Add missing displaynames
|
||||
var missingDisplayPaths = Paths.Where(p => p.SystemDisplayName == null).ToList();
|
||||
var missingDisplayPaths = Paths.Where(p => p.SystemDisplayName == null);
|
||||
foreach (PathEntry path in missingDisplayPaths)
|
||||
{
|
||||
path.SystemDisplayName = DefaultValues.First(p => p.System == path.System).SystemDisplayName;
|
||||
|
|
|
@ -50,78 +50,66 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void CallSaveStateEvent(string name)
|
||||
{
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnSavestateSave").ToList();
|
||||
if (lfs.Any())
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnSavestateSave");
|
||||
try
|
||||
{
|
||||
try
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
lf.Call(name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
|
||||
lf.Call(name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void CallLoadStateEvent(string name)
|
||||
{
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnSavestateLoad").ToList();
|
||||
if (lfs.Any())
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnSavestateLoad");
|
||||
try
|
||||
{
|
||||
try
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
lf.Call(name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
|
||||
lf.Call(name);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void CallFrameBeforeEvent()
|
||||
{
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnFrameStart").ToList();
|
||||
if (lfs.Any())
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnFrameStart");
|
||||
try
|
||||
{
|
||||
try
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
lf.Call();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
|
||||
lf.Call();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public void CallFrameAfterEvent()
|
||||
{
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnFrameEnd").ToList();
|
||||
if (lfs.Any())
|
||||
var lfs = _luaFunctions.Where(l => l.Event == "OnFrameEnd");
|
||||
try
|
||||
{
|
||||
try
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
foreach (var lf in lfs)
|
||||
{
|
||||
lf.Call();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
|
||||
lf.Call();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private bool N64CoreTypeDynarec()
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var def = Global.Emulator.ControllerDefinition;
|
||||
var trimmed = mnemonic.Replace("|", "");
|
||||
var buttons = Definition.ControlsOrdered.SelectMany(c => c).ToList();
|
||||
var buttons = Definition.ControlsOrdered.SelectMany(c => c);
|
||||
var iterator = 0;
|
||||
|
||||
foreach (var key in buttons)
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void RemoveRange(IEnumerable<Cheat> cheats)
|
||||
{
|
||||
foreach (var cheat in cheats.ToList())
|
||||
foreach (var cheat in cheats.ToList()) // enumerate passed IEnumerable because it may depend on the value of _cheatList
|
||||
{
|
||||
_cheatList.Remove(cheat);
|
||||
}
|
||||
|
@ -232,12 +232,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void RemoveRange(IEnumerable<Watch> watches)
|
||||
{
|
||||
var removeList = _cheatList.Where(cheat => watches.Any(w => w == cheat)).ToList();
|
||||
foreach (var cheat in removeList)
|
||||
{
|
||||
_cheatList.Remove(cheat);
|
||||
}
|
||||
|
||||
_cheatList.RemoveAll(cheat => watches.Any(w => w == cheat));
|
||||
Changes = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -341,8 +341,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
var addresses = watches.Select(w => w.Address);
|
||||
var removeList = _watchList.Where(w => addresses.Contains(w.Address)).ToList();
|
||||
_watchList = _watchList.Except(removeList).ToList();
|
||||
_watchList.RemoveAll(w => addresses.Contains(w.Address));
|
||||
}
|
||||
|
||||
public void RemoveRange(IEnumerable<int> indices)
|
||||
|
|
|
@ -188,11 +188,11 @@ namespace BizHawk.Client.DBMan
|
|||
// process dump info flags and other info contained in []
|
||||
if (nameString.Contains("[") && nameString.Contains("]"))
|
||||
{
|
||||
List<string> e = nameString.ToString().Split('[', ']').ToList();
|
||||
// remove first entry (this is the bit before the [] entries start
|
||||
e.RemoveAt(0);
|
||||
// remove empty entries
|
||||
e = e.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
|
||||
var e = nameString.Split('[', ']')
|
||||
.Skip(1) // remove first entry (this is the bit before the [] entries start)
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s)) // remove empty entries
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
if (e.Count > 0)
|
||||
{
|
||||
|
|
|
@ -206,11 +206,11 @@ namespace BizHawk.Client.DBMan
|
|||
// process dump info flags and other info contained in []
|
||||
if (nameString.Contains("[") && nameString.Contains("]"))
|
||||
{
|
||||
List<string> e = nameString.ToString().Split('[', ']').ToList();
|
||||
// remove first entry (this is the bit before the [] entries start
|
||||
e.RemoveAt(0);
|
||||
// remove empty entries
|
||||
e = e.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
|
||||
var e = nameString.Split('[', ']')
|
||||
.Skip(1) // remove first entry (this is the bit before the [] entries start)
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s)) // remove empty entries
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
if (e.Count > 0)
|
||||
{
|
||||
|
|
|
@ -23,15 +23,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
.Where(t => typeof(IExternalApi).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t))
|
||||
.ToList();
|
||||
|
||||
apis.AddRange(
|
||||
Assembly
|
||||
.GetAssembly(typeof(ApiContainer))
|
||||
.GetTypes()
|
||||
.Where(t => typeof(IExternalApi).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t)));
|
||||
.Concat(Assembly
|
||||
.GetAssembly(typeof(ApiContainer))
|
||||
.GetTypes()
|
||||
.Where(t => typeof(IExternalApi).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t)));
|
||||
|
||||
foreach (var api in apis)
|
||||
{
|
||||
|
|
|
@ -48,8 +48,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
.Select(t => t.GetCustomAttributes(false).OfType<CoreAttribute>().FirstOrDefault())
|
||||
.Where(a => a != null)
|
||||
.Where(a => a.Released)
|
||||
.OrderByDescending(a => a.CoreName.ToLower())
|
||||
.ToList();
|
||||
.OrderByDescending(a => a.CoreName.ToLower());
|
||||
|
||||
foreach (var core in cores)
|
||||
{
|
||||
|
|
|
@ -1373,7 +1373,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.First() > 0)
|
||||
{
|
||||
foreach (var row in SelectedRows.ToList())
|
||||
foreach (var row in SelectedRows.ToList()) // clones SelectedRows
|
||||
{
|
||||
SelectRow(row - 1, true);
|
||||
SelectRow(row, false);
|
||||
|
@ -1384,7 +1384,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||
{
|
||||
foreach (var row in SelectedRows.Reverse().ToList())
|
||||
foreach (var row in SelectedRows.Reverse()) // clones SelectedRows
|
||||
{
|
||||
SelectRow(row + 1, true);
|
||||
SelectRow(row, false);
|
||||
|
@ -1695,14 +1695,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (toggle && _selectedItems.Any(x => x.RowIndex.HasValue && x.RowIndex == cell.RowIndex))
|
||||
{
|
||||
var items = _selectedItems
|
||||
.Where(x => x.RowIndex.HasValue && x.RowIndex == cell.RowIndex)
|
||||
.ToList();
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
_selectedItems.Remove(item);
|
||||
}
|
||||
_selectedItems.RemoveWhere(x => x.RowIndex.HasValue && x.RowIndex == cell.RowIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2054,13 +2047,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
int pos = 0;
|
||||
|
||||
var columns = VisibleColumns.ToList();
|
||||
|
||||
for (int i = 0; i < columns.Count; i++)
|
||||
foreach (var col in VisibleColumns)
|
||||
{
|
||||
columns[i].Left = pos;
|
||||
pos += columns[i].Width.Value;
|
||||
columns[i].Right = pos;
|
||||
col.Left = pos;
|
||||
pos += col.Width.Value;
|
||||
col.Right = pos;
|
||||
}
|
||||
|
||||
DoChangeCallback();
|
||||
|
|
|
@ -347,7 +347,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
type = " (on)";
|
||||
}
|
||||
|
||||
Global.CheatList.ToList().ForEach(x => x.Toggle());
|
||||
foreach (var x in Global.CheatList)
|
||||
{
|
||||
x.Toggle();
|
||||
}
|
||||
GlobalWin.OSD.AddMessage($"Cheats toggled{type}");
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public static IEnumerable<string> GetDeviceNames()
|
||||
{
|
||||
return DirectSound.GetDevices().Select(d => d.Description).ToList();
|
||||
return DirectSound.GetDevices().Select(d => d.Description);
|
||||
}
|
||||
|
||||
private int BufferSizeSamples { get; set; }
|
||||
|
|
|
@ -49,7 +49,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
using (XAudio2 device = new XAudio2())
|
||||
{
|
||||
return Enumerable.Range(0, device.DeviceCount).Select(n => device.GetDeviceDetails(n).DisplayName).ToList();
|
||||
return Enumerable.Range(0, device.DeviceCount)
|
||||
.Select(n => device.GetDeviceDetails(n).DisplayName)
|
||||
.ToList(); // enumerate before local var device is disposed
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
HotkeyTabControl.TabPages.Clear();
|
||||
|
||||
// Buckets
|
||||
var tabs = Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct().ToList();
|
||||
var tabs = Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct();
|
||||
|
||||
foreach (var tab in tabs)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
var tb = new TabPage {Name = tab, Text = tab};
|
||||
|
||||
var bindings = Global.Config.HotkeyBindings.Where(x => x.TabGroup == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.DisplayName).ToList();
|
||||
var bindings = Global.Config.HotkeyBindings.Where(x => x.TabGroup == tab).OrderBy(x => x.Ordinal).ThenBy(x => x.DisplayName);
|
||||
|
||||
int iwOffsetX = UIHelper.ScaleX(110);
|
||||
int iwOffsetY = UIHelper.ScaleY(-4);
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
typeof(NES.NESSyncSettings.Region),
|
||||
(string)RegionComboBox.SelectedItem);
|
||||
|
||||
List<byte> oldRam = _syncSettings.InitialWRamStatePattern?.ToList() ?? new List<byte>();
|
||||
var oldRam = _syncSettings.InitialWRamStatePattern ?? new List<byte>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(RamPatternOverrideBox.Text))
|
||||
{
|
||||
|
|
|
@ -114,8 +114,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var paths = pathCollection
|
||||
.Where(p => p.System == systemId)
|
||||
.OrderBy(p => p.Ordinal)
|
||||
.ThenBy(p => p.Type)
|
||||
.ToList();
|
||||
.ThenBy(p => p.Type);
|
||||
|
||||
var y = UIHelper.ScaleY(14);
|
||||
foreach (var path in paths)
|
||||
|
@ -243,10 +242,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DoRomToggle()
|
||||
{
|
||||
AllPathControls
|
||||
.Where(c => c.Name == "ROM")
|
||||
.ToList()
|
||||
.ForEach(control => control.Enabled = !RecentForROMs.Checked);
|
||||
foreach (var control in AllPathControls.Where(c => c.Name == "ROM"))
|
||||
{
|
||||
control.Enabled = !RecentForROMs.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<TextBox> AllPathBoxes
|
||||
|
|
|
@ -306,10 +306,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
||||
filePaths
|
||||
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", "")))
|
||||
.ToList()
|
||||
.ForEach(path => AddMovieToList(path, force: true));
|
||||
foreach (var path in filePaths.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", ""))))
|
||||
{
|
||||
AddMovieToList(path, force: true);
|
||||
}
|
||||
|
||||
RefreshMovieList();
|
||||
}
|
||||
|
@ -468,11 +468,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void EditMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MovieView.SelectedIndices
|
||||
.Cast<int>()
|
||||
.Select(index => _movieList[index])
|
||||
.ToList()
|
||||
.ForEach(movie => System.Diagnostics.Process.Start(movie.Filename));
|
||||
foreach (var movie in MovieView.SelectedIndices.Cast<int>()
|
||||
.Select(index => _movieList[index]))
|
||||
{
|
||||
System.Diagnostics.Process.Start(movie.Filename);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -449,10 +449,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
CurrentFileName = "";
|
||||
_bestBotAttempt = null;
|
||||
|
||||
ControlProbabilityPanel.Controls
|
||||
.OfType<BotControlsRow>()
|
||||
.ToList()
|
||||
.ForEach(cp => cp.Probability = 0);
|
||||
foreach (var cp in ControlProbabilityPanel.Controls.OfType<BotControlsRow>())
|
||||
{
|
||||
cp.Probability = 0;
|
||||
}
|
||||
|
||||
FrameLength = 0;
|
||||
MaximizeAddress = 0;
|
||||
|
|
|
@ -486,7 +486,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.CheatList.Insert(index - 1, cheat);
|
||||
}
|
||||
|
||||
var newindices = indices.Select(t => t - 1).ToList();
|
||||
var newindices = indices.Select(t => t - 1);
|
||||
|
||||
CheatListView.SelectedIndices.Clear();
|
||||
foreach (var newi in newindices)
|
||||
|
@ -515,7 +515,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
UpdateMessageLabel();
|
||||
|
||||
var newindices = indices.Select(t => t + 1).ToList();
|
||||
var newindices = indices.Select(t => t + 1);
|
||||
|
||||
CheatListView.SelectedIndices.Clear();
|
||||
foreach (var newi in newindices)
|
||||
|
@ -533,7 +533,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ToggleMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedCheats.ToList().ForEach(x => x.Toggle());
|
||||
foreach (var x in SelectedCheats)
|
||||
{
|
||||
x.Toggle();
|
||||
}
|
||||
CheatListView.Refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,46 +41,37 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Controls.OfType<Panel>().Any(p => p.Name == "FlagPanel"))
|
||||
{
|
||||
Controls
|
||||
.OfType<Panel>()
|
||||
foreach (var checkbox in Controls.OfType<Panel>()
|
||||
.First(p => p.Name == "FlagPanel")
|
||||
.Controls
|
||||
.OfType<CheckBox>()
|
||||
.ToList()
|
||||
.ForEach(checkbox =>
|
||||
.OfType<CheckBox>())
|
||||
{
|
||||
if (checkbox.Name == register.Key)
|
||||
{
|
||||
if (checkbox.Name == register.Key)
|
||||
{
|
||||
checkbox.Checked = register.Value.Value == 1;
|
||||
}
|
||||
});
|
||||
checkbox.Checked = register.Value.Value == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_canSetCpuRegisters)
|
||||
{
|
||||
Controls
|
||||
.OfType<TextBox>()
|
||||
.ToList()
|
||||
.ForEach(textbox =>
|
||||
foreach (var textbox in Controls.OfType<TextBox>())
|
||||
{
|
||||
if (textbox.Name == register.Key)
|
||||
{
|
||||
if (textbox.Name == register.Key)
|
||||
{
|
||||
textbox.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4);
|
||||
}
|
||||
});
|
||||
textbox.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Controls
|
||||
.OfType<Label>()
|
||||
.ToList()
|
||||
.ForEach(label =>
|
||||
foreach (var label in Controls.OfType<Label>())
|
||||
{
|
||||
if (label.Name == register.Key)
|
||||
{
|
||||
if (label.Name == register.Key)
|
||||
{
|
||||
label.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4);
|
||||
}
|
||||
});
|
||||
label.Text = register.Value.Value.ToHexString(register.Value.BitSize / 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SetDomain(domain);
|
||||
SetHighlighted(addrList[0]);
|
||||
_secondaryHighlightedAddresses.Clear();
|
||||
_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]).ToList());
|
||||
_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]));
|
||||
ClearNibbles();
|
||||
UpdateValues();
|
||||
MemoryViewerBox.Refresh();
|
||||
|
@ -835,8 +835,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (address >= 0)
|
||||
{
|
||||
// TODO: can't unfreeze address 0??
|
||||
Global.CheatList.RemoveRange(
|
||||
Global.CheatList.Where(x => x.Contains(address)).ToList());
|
||||
Global.CheatList.RemoveRange(Global.CheatList.Where(x => x.Contains(address)));
|
||||
}
|
||||
|
||||
MemoryViewerBox.Refresh();
|
||||
|
|
|
@ -123,8 +123,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
kvps = kvps.OrderBy(x => x.Key).ToList();
|
||||
foreach (var kvp in kvps)
|
||||
foreach (var kvp in kvps.OrderBy(x => x.Key))
|
||||
{
|
||||
sb
|
||||
.Append("\"")
|
||||
|
|
|
@ -149,11 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (control.Handle == ptr)
|
||||
{
|
||||
var luaEvents = form.ControlEvents.Where(x => x.Control == ptr).ToList();
|
||||
foreach (var luaEvent in luaEvents)
|
||||
{
|
||||
form.ControlEvents.Remove(luaEvent);
|
||||
}
|
||||
form.ControlEvents.RemoveAll(x => x.Control == ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,15 +35,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t))
|
||||
.ToList();
|
||||
|
||||
libs.AddRange(
|
||||
Assembly
|
||||
.GetAssembly(typeof(EmuLuaLibrary))
|
||||
.GetTypes()
|
||||
.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t)));
|
||||
.Concat(Assembly
|
||||
.GetAssembly(typeof(EmuLuaLibrary))
|
||||
.GetTypes()
|
||||
.Where(t => typeof(LuaLibraryBase).IsAssignableFrom(t))
|
||||
.Where(t => t.IsSealed)
|
||||
.Where(t => ServiceInjector.IsAvailable(serviceProvider, t)));
|
||||
|
||||
foreach (var lib in libs)
|
||||
{
|
||||
|
|
|
@ -171,14 +171,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LuaImp.CallExitEvent(file);
|
||||
|
||||
var functions = LuaImp.GetRegisteredFunctions()
|
||||
.Where(lf => lf.Lua == file.Thread)
|
||||
.ToList();
|
||||
|
||||
foreach (var function in functions)
|
||||
{
|
||||
LuaImp.GetRegisteredFunctions().Remove(function);
|
||||
}
|
||||
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == file.Thread);
|
||||
|
||||
UpdateRegisteredFunctionsDialog();
|
||||
|
||||
|
@ -692,7 +685,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private static void UpdateRegisteredFunctionsDialog()
|
||||
{
|
||||
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>().ToList())
|
||||
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>())
|
||||
{
|
||||
form.UpdateValues();
|
||||
}
|
||||
|
@ -850,16 +843,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LuaImp.CallExitEvent(file);
|
||||
|
||||
var items = SelectedItems.ToList();
|
||||
foreach (var selectedItem in items)
|
||||
foreach (var selectedItem in SelectedItems)
|
||||
{
|
||||
var temp = selectedItem;
|
||||
var functions = LuaImp.GetRegisteredFunctions().Where(lf => lf.Lua == temp.Thread).ToList();
|
||||
foreach (var function in functions)
|
||||
{
|
||||
LuaImp.GetRegisteredFunctions().Remove(function);
|
||||
}
|
||||
|
||||
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == temp.Thread);
|
||||
UpdateRegisteredFunctionsDialog();
|
||||
}
|
||||
|
||||
|
@ -913,7 +900,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PauseScriptMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedFiles.ToList().ForEach(x => x.TogglePause());
|
||||
foreach (var x in SelectedFiles)
|
||||
{
|
||||
x.TogglePause();
|
||||
}
|
||||
UpdateDialog();
|
||||
}
|
||||
|
||||
|
@ -926,14 +916,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void EditScriptMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedFiles.ToList().ForEach(file =>
|
||||
foreach (var file in SelectedFiles)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
Verb = "Open",
|
||||
FileName = ProcessPath(file.Path)
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -944,11 +934,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (var item in items)
|
||||
{
|
||||
var temp = item;
|
||||
var functions = LuaImp.GetRegisteredFunctions().Where(x => x.Lua == temp.Thread).ToList();
|
||||
foreach (var function in functions)
|
||||
{
|
||||
LuaImp.GetRegisteredFunctions().Remove(function);
|
||||
}
|
||||
LuaImp.GetRegisteredFunctions().RemoveAll(x => x.Lua == temp.Thread);
|
||||
|
||||
LuaImp.ScriptList.Remove(item);
|
||||
}
|
||||
|
@ -1018,7 +1004,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LuaImp.ScriptList.Insert(index - 1, file);
|
||||
}
|
||||
|
||||
var newIndices = indices.Select(t => t - 1).ToList();
|
||||
var newIndices = indices.Select(t => t - 1);
|
||||
|
||||
LuaListView.SelectedIndices.Clear();
|
||||
foreach (var i in newIndices)
|
||||
|
@ -1044,7 +1030,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
LuaImp.ScriptList.Insert(indices[i] + 1, file);
|
||||
}
|
||||
|
||||
var newIndices = indices.Select(t => t + 1).ToList();
|
||||
var newIndices = indices.Select(t => t + 1);
|
||||
|
||||
LuaListView.SelectedIndices.Clear();
|
||||
foreach (var i in newIndices)
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
FunctionView.Items.Clear();
|
||||
|
||||
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().OrderBy(x => x.Event).ThenBy(x => x.Name).ToList();
|
||||
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().OrderBy(x => x.Event).ThenBy(x => x.Name);
|
||||
foreach (var nlf in nlfs)
|
||||
{
|
||||
var item = new ListViewItem { Text = nlf.Event };
|
||||
|
|
|
@ -186,9 +186,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
try
|
||||
{
|
||||
var fileSelectors = FileSelectors.ToList();
|
||||
|
||||
var names = fileSelectors.Select(f => f.GetName());
|
||||
var names = FileSelectors.Select(f => f.GetName());
|
||||
|
||||
var name = NameBox.Text;
|
||||
|
||||
|
|
|
@ -677,13 +677,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (TasView.AnyRowsSelected)
|
||||
{
|
||||
var wasPaused = Mainform.EmulatorPaused;
|
||||
var framesToInsert = TasView.SelectedRows.ToList();
|
||||
var framesToInsert = TasView.SelectedRows;
|
||||
var insertionFrame = Math.Min(TasView.LastSelectedIndex.Value + 1, CurrentTasMovie.InputLogLength);
|
||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||
|
||||
var inputLog = framesToInsert
|
||||
.Select(frame => CurrentTasMovie.GetInputLogEntry(frame))
|
||||
.ToList();
|
||||
.Select(frame => CurrentTasMovie.GetInputLogEntry(frame));
|
||||
|
||||
CurrentTasMovie.InsertInput(insertionFrame, inputLog);
|
||||
|
||||
|
@ -780,11 +779,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
IEnumerable<TasMovieMarker> markers = CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame));
|
||||
foreach (TasMovieMarker m in markers.ToList())
|
||||
{
|
||||
CurrentTasMovie.Markers.Remove(m);
|
||||
}
|
||||
CurrentTasMovie.Markers.RemoveAll(m => TasView.SelectedRows.Contains(m.Frame));
|
||||
MarkerControl.ShrinkSelection();
|
||||
RefreshDialog();
|
||||
}
|
||||
|
|
|
@ -136,10 +136,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void ClearBoolean()
|
||||
{
|
||||
PadControls
|
||||
.OfType<VirtualPadButton>()
|
||||
.ToList()
|
||||
.ForEach(p => p.Clear());
|
||||
foreach (var p in PadControls.OfType<VirtualPadButton>())
|
||||
{
|
||||
p.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(IController controller)
|
||||
|
@ -149,28 +149,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void SetPrevious(IController previous)
|
||||
{
|
||||
PadControls
|
||||
.OfType<VirtualPadAnalogStick>()
|
||||
.ToList()
|
||||
.ForEach(c => c.SetPrevious(previous));
|
||||
foreach (var c in PadControls.OfType<VirtualPadAnalogStick>())
|
||||
{
|
||||
c.SetPrevious(previous);
|
||||
}
|
||||
}
|
||||
|
||||
public void BumpAnalog(int? x, int? y)
|
||||
{
|
||||
PadControls
|
||||
.OfType<VirtualPadAnalogStick>()
|
||||
.ToList()
|
||||
.ForEach(a => a.Bump(x, y));
|
||||
foreach (var a in PadControls.OfType<VirtualPadAnalogStick>())
|
||||
{
|
||||
a.Bump(x, y);
|
||||
}
|
||||
|
||||
PadControls
|
||||
.OfType<VirtualPadAnalogButton>()
|
||||
.ToList()
|
||||
.ForEach(a => a.Bump(x));
|
||||
foreach (var a in PadControls.OfType<VirtualPadAnalogButton>())
|
||||
{
|
||||
a.Bump(x);
|
||||
}
|
||||
|
||||
PadControls
|
||||
.OfType<VirtualPadTargetScreen>()
|
||||
.ToList()
|
||||
.ForEach(a => a.Bump(x, y));
|
||||
foreach (var a in PadControls.OfType<VirtualPadTargetScreen>())
|
||||
{
|
||||
a.Bump(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -875,7 +875,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitialLocation = this.ChildPointToScreen(WatchListView)
|
||||
};
|
||||
|
||||
poke.SetWatch(SelectedIndices.Select(t => _searches[t]).ToList());
|
||||
poke.SetWatch(SelectedIndices.Select(t => _searches[t]));
|
||||
poke.ShowHawkDialog();
|
||||
|
||||
UpdateList();
|
||||
|
|
|
@ -898,7 +898,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Changes();
|
||||
|
||||
var indices = indexes.Select(t => t - 1).ToList();
|
||||
var indices = indexes.Select(t => t - 1);
|
||||
|
||||
WatchListView.SelectedIndices.Clear();
|
||||
foreach (var t in indices)
|
||||
|
@ -924,7 +924,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_watches.Insert(indices[i] + 1, watch);
|
||||
}
|
||||
|
||||
var newIndices = indices.Select(t => t + 1).ToList();
|
||||
var newIndices = indices.Select(t => t + 1);
|
||||
|
||||
WatchListView.SelectedIndices.Clear();
|
||||
foreach (var t in newIndices)
|
||||
|
@ -1284,7 +1284,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var items = _watches
|
||||
.Where(watch => watch.Address >= watch.Domain.Size)
|
||||
.ToList();
|
||||
.ToList(); // enumerate because _watches is about to be changed
|
||||
|
||||
foreach (var item in items)
|
||||
{
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
{
|
||||
Global.MovieSession.Movie.Stop();
|
||||
|
||||
foreach (var ew in EmulatorWindows.ToList())
|
||||
foreach (var ew in EmulatorWindows)
|
||||
{
|
||||
ew.ShutDown();
|
||||
}
|
||||
|
@ -1421,7 +1421,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
|
||||
private void CloseAllWindows()
|
||||
{
|
||||
foreach (var ew in EmulatorWindows.ToList())
|
||||
foreach (var ew in EmulatorWindows)
|
||||
{
|
||||
ew.Close();
|
||||
}
|
||||
|
@ -1431,7 +1431,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
|
||||
private void NewSessionMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var ew in EmulatorWindows.ToList())
|
||||
foreach (var ew in EmulatorWindows)
|
||||
{
|
||||
ew.Close();
|
||||
}
|
||||
|
|
|
@ -300,10 +300,10 @@ namespace BizHawk.Client.MultiHawk
|
|||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
||||
filePaths
|
||||
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", "")))
|
||||
.ToList()
|
||||
.ForEach(path => AddMovieToList(path, force: true));
|
||||
foreach (var path in filePaths.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", ""))))
|
||||
{
|
||||
AddMovieToList(path, force: true);
|
||||
}
|
||||
|
||||
RefreshMovieList();
|
||||
}
|
||||
|
@ -457,11 +457,11 @@ namespace BizHawk.Client.MultiHawk
|
|||
|
||||
private void EditMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MovieView.SelectedIndices
|
||||
.Cast<int>()
|
||||
.Select(index => _movieList[index])
|
||||
.ToList()
|
||||
.ForEach(movie => System.Diagnostics.Process.Start(movie.Filename));
|
||||
foreach (var movie in MovieView.SelectedIndices.Cast<int>()
|
||||
.Select(index => _movieList[index]))
|
||||
{
|
||||
System.Diagnostics.Process.Start(movie.Filename);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -64,8 +64,7 @@ namespace BizHawk.Common.BizInvoke
|
|||
Info = m,
|
||||
Attr = m.GetCustomAttributes(true).OfType<BizExportAttribute>().FirstOrDefault()
|
||||
})
|
||||
.Where(a => a.Attr != null)
|
||||
.ToList();
|
||||
.Where(a => a.Attr != null);
|
||||
|
||||
var typeBuilder = ImplModuleBuilder.DefineType($"Bizhawk.BizExvokeHolder{type.Name}", TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Common
|
|||
{
|
||||
public ServiceNotApplicableAttribute(params Type[] types)
|
||||
{
|
||||
NotApplicableTypes = types?.ToList() ?? new List<Type>();
|
||||
NotApplicableTypes = types?.AsEnumerable() ?? Enumerable.Empty<Type>();
|
||||
}
|
||||
|
||||
public IEnumerable<Type> NotApplicableTypes { get; private set; }
|
||||
|
|
|
@ -1035,8 +1035,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
public int[] GetVideoBuffer()
|
||||
{
|
||||
// get only lines that have pixel data
|
||||
var lines = ScreenLines.Where(a => a.Pixels.Count > 0).ToList();
|
||||
var height = lines.Count();
|
||||
var lines = ScreenLines.Where(a => a.Pixels.Count > 0);
|
||||
|
||||
int pos = 0;
|
||||
int lCount = 0;
|
||||
|
|
|
@ -152,12 +152,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
|||
/// </summary>
|
||||
public void SetDataPeriodsArray(int[] periodArray)
|
||||
{
|
||||
DataPeriods = new List<int>();
|
||||
|
||||
if (periodArray == null)
|
||||
return;
|
||||
|
||||
DataPeriods = periodArray.ToList();
|
||||
DataPeriods = periodArray?.ToList() ?? new List<int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
// now process the blocks
|
||||
var infoBlock = blocks.Where(a => a.RecordType == RecordHeaderType.INFO).FirstOrDefault();
|
||||
var IMGEblocks = blocks.Where(a => a.RecordType == RecordHeaderType.IMGE).ToList();
|
||||
var DATAblocks = blocks.Where(a => a.RecordType == RecordHeaderType.DATA).ToList();
|
||||
var DATAblocks = blocks.Where(a => a.RecordType == RecordHeaderType.DATA);
|
||||
|
||||
DiskHeader.NumberOfTracks = (byte)(IMGEblocks.Count());
|
||||
DiskHeader.NumberOfSides = (byte)(infoBlock.INFOmaxSide + 1);
|
||||
|
|
|
@ -153,12 +153,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
|
|||
/// </summary>
|
||||
public void SetDataPeriodsArray(int[] periodArray)
|
||||
{
|
||||
DataPeriods = new List<int>();
|
||||
|
||||
if (periodArray == null)
|
||||
return;
|
||||
|
||||
DataPeriods = periodArray.ToList();
|
||||
DataPeriods = periodArray?.ToList() ?? new List<int>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
{
|
||||
Name = _game.Name,
|
||||
System = "A26",
|
||||
MetaData = "m=" + _mapper.GetType().ToString().Split('.').ToList().Last(),
|
||||
MetaData = "m=" + _mapper.GetType().ToString().Split('.').Last(),
|
||||
Hash = Rom.HashSHA1(),
|
||||
Region = _game.Region,
|
||||
Status = RomStatus.Unknown
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
var right = R.GetCpuFlagsAndRegisters()
|
||||
.Select(reg => new KeyValuePair<string, RegisterValue>("Right " + reg.Key, reg.Value));
|
||||
|
||||
return left.Union(right).ToList().ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
return left.Union(right).ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace BizHawk.Emulation.Cores
|
|||
if (coreattr.Length != 1)
|
||||
throw new InvalidOperationException($"{nameof(IEmulator)} {typ} without {nameof(CoreAttribute)}s!");
|
||||
var cons = typ.GetConstructors(BindingFlags.Public | BindingFlags.Instance)
|
||||
.Where(c => c.GetCustomAttributes(typeof(CoreConstructorAttribute), false).Length > 0).ToList();
|
||||
.Where(c => c.GetCustomAttributes(typeof(CoreConstructorAttribute), false).Length > 0);
|
||||
foreach(var con in cons)
|
||||
{
|
||||
foreach (string system in ((CoreConstructorAttribute)con.GetCustomAttributes(typeof(CoreConstructorAttribute), false)[0]).Systems)
|
||||
|
|
|
@ -253,17 +253,15 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
|
||||
private void RegisterSymbols()
|
||||
{
|
||||
var symbols = ((ISymbolTable)_elf.GetSection(".symtab"))
|
||||
.Entries
|
||||
.Cast<SymbolEntry<long>>();
|
||||
_symlist = ((ISymbolTable) _elf.GetSection(".symtab")).Entries
|
||||
.Cast<SymbolEntry<long>>()
|
||||
.ToList();
|
||||
|
||||
// when there are duplicate names, don't register either in the dictionary
|
||||
_symdict = symbols
|
||||
.GroupBy(e => e.Name)
|
||||
.Where(g => g.Count() == 1)
|
||||
.ToDictionary(g => g.Key, g => g.First());
|
||||
|
||||
_symlist = symbols.ToList();
|
||||
_symdict = _symlist
|
||||
.GroupBy(e => e.Name)
|
||||
.Where(g => g.Count() == 1)
|
||||
.ToDictionary(g => g.Key, g => g.First());
|
||||
}
|
||||
|
||||
public void Seal()
|
||||
|
|
|
@ -182,9 +182,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
return fileNodes;
|
||||
|
||||
// get all folders
|
||||
List<KeyValuePair<string, ISONode>> dirs = (from a in Root.Children
|
||||
where a.Value.GetType() == typeof(ISODirectoryNode)
|
||||
select a).ToList();
|
||||
var dirs = (from a in Root.Children where a.Value.GetType() == typeof(ISODirectoryNode) select a);
|
||||
// iterate through each folder
|
||||
foreach (var d in dirs)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue