Remove ToList call when the returned List is used as an IEnumerable
This commit is contained in:
parent
2900484ad5
commit
c82ff6077a
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
|
||||||
if (!Frozen)
|
if (!Frozen)
|
||||||
{
|
{
|
||||||
var removed = false;
|
var removed = false;
|
||||||
foreach (var recent in recentlist.ToList())
|
foreach (var recent in recentlist)
|
||||||
{
|
{
|
||||||
if (string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0)
|
if (string.Compare(newFile, recent, StringComparison.CurrentCultureIgnoreCase) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,8 +119,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add missing displaynames
|
// Add missing displaynames
|
||||||
var missingDisplayPaths = Paths.Where(p => p.SystemDisplayName == null).ToList();
|
foreach (var path in Paths.Where(p => p.SystemDisplayName == null))
|
||||||
foreach (PathEntry path in missingDisplayPaths)
|
|
||||||
{
|
{
|
||||||
path.SystemDisplayName = DefaultValues.First(p => p.System == path.System).SystemDisplayName;
|
path.SystemDisplayName = DefaultValues.First(p => p.System == path.System).SystemDisplayName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,17 +41,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
VersionLabel.Text = "Version " + mainversion;
|
VersionLabel.Text = "Version " + mainversion;
|
||||||
DateLabel.Text = VersionInfo.RELEASEDATE;
|
DateLabel.Text = VersionInfo.RELEASEDATE;
|
||||||
|
|
||||||
var cores = Assembly
|
foreach (var core in Assembly.Load("BizHawk.Emulation.Cores").GetTypes()
|
||||||
.Load("BizHawk.Emulation.Cores")
|
|
||||||
.GetTypes()
|
|
||||||
.Where(t => typeof(IEmulator).IsAssignableFrom(t))
|
.Where(t => typeof(IEmulator).IsAssignableFrom(t))
|
||||||
.Select(t => t.GetCustomAttributes(false).OfType<CoreAttribute>().FirstOrDefault())
|
.Select(t => t.GetCustomAttributes(false).OfType<CoreAttribute>().FirstOrDefault())
|
||||||
.Where(a => a != null)
|
.Where(a => a != null)
|
||||||
.Where(a => a.Released)
|
.Where(a => a.Released)
|
||||||
.OrderByDescending(a => a.CoreName.ToLower())
|
.OrderByDescending(a => a.CoreName.ToLower()))
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach (var core in cores)
|
|
||||||
{
|
{
|
||||||
CoreInfoPanel.Controls.Add(new BizBoxInfoControl(core)
|
CoreInfoPanel.Controls.Add(new BizBoxInfoControl(core)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1374,7 +1374,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.First() > 0)
|
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.First() > 0)
|
||||||
{
|
{
|
||||||
foreach (var row in SelectedRows.ToList())
|
foreach (var row in SelectedRows)
|
||||||
{
|
{
|
||||||
SelectRow(row - 1, true);
|
SelectRow(row - 1, true);
|
||||||
SelectRow(row, false);
|
SelectRow(row, false);
|
||||||
|
@ -1385,7 +1385,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||||
{
|
{
|
||||||
foreach (var row in SelectedRows.Reverse().ToList())
|
foreach (var row in SelectedRows.Reverse())
|
||||||
{
|
{
|
||||||
SelectRow(row + 1, true);
|
SelectRow(row + 1, true);
|
||||||
SelectRow(row, false);
|
SelectRow(row, false);
|
||||||
|
|
|
@ -347,7 +347,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
type = " (on)";
|
type = " (on)";
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.CheatList.ToList().ForEach(x => x.Toggle());
|
foreach (var x in Global.CheatList) x.Toggle();
|
||||||
GlobalWin.OSD.AddMessage("Cheats toggled" + type);
|
GlobalWin.OSD.AddMessage("Cheats toggled" + type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public static IEnumerable<string> GetDeviceNames()
|
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; }
|
private int BufferSizeSamples { get; set; }
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
using (XAudio2 device = new XAudio2())
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,21 +101,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
HotkeyTabControl.TabPages.Clear();
|
HotkeyTabControl.TabPages.Clear();
|
||||||
|
|
||||||
// Buckets
|
// Buckets
|
||||||
var tabs = Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct().ToList();
|
|
||||||
|
|
||||||
foreach (var tab in tabs)
|
foreach (var tab in Global.Config.HotkeyBindings.Select(x => x.TabGroup).Distinct())
|
||||||
{
|
{
|
||||||
var _y = UIHelper.ScaleY(14);
|
var _y = UIHelper.ScaleY(14);
|
||||||
var _x = UIHelper.ScaleX(6);
|
var _x = UIHelper.ScaleX(6);
|
||||||
|
|
||||||
var tb = new TabPage {Name = tab, Text = tab};
|
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();
|
|
||||||
|
|
||||||
int iwOffsetX = UIHelper.ScaleX(110);
|
int iwOffsetX = UIHelper.ScaleX(110);
|
||||||
int iwOffsetY = UIHelper.ScaleY(-4);
|
int iwOffsetY = UIHelper.ScaleY(-4);
|
||||||
int iwWidth = UIHelper.ScaleX(120);
|
int iwWidth = UIHelper.ScaleX(120);
|
||||||
foreach (var b in bindings)
|
foreach (var b in Global.Config.HotkeyBindings.Where(x => x.TabGroup == tab)
|
||||||
|
.OrderBy(x => x.Ordinal)
|
||||||
|
.ThenBy(x => x.DisplayName))
|
||||||
{
|
{
|
||||||
var l = new Label
|
var l = new Label
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
typeof(NES.NESSyncSettings.Region),
|
typeof(NES.NESSyncSettings.Region),
|
||||||
(string)RegionComboBox.SelectedItem);
|
(string)RegionComboBox.SelectedItem);
|
||||||
|
|
||||||
List<byte> oldRam = _syncSettings.InitialWRamStatePattern?.ToList() ?? new List<byte>();
|
var oldRam = _syncSettings.InitialWRamStatePattern ?? Enumerable.Empty<byte>();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(RamPatternOverrideBox.Text))
|
if (!string.IsNullOrWhiteSpace(RamPatternOverrideBox.Text))
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,14 +111,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Width = UIHelper.ScaleX(200), // Initial Left/Width of child controls are based on this size.
|
Width = UIHelper.ScaleX(200), // Initial Left/Width of child controls are based on this size.
|
||||||
AutoScroll = true
|
AutoScroll = true
|
||||||
};
|
};
|
||||||
var paths = pathCollection
|
|
||||||
.Where(p => p.System == systemId)
|
|
||||||
.OrderBy(p => p.Ordinal)
|
|
||||||
.ThenBy(p => p.Type)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var y = UIHelper.ScaleY(14);
|
var y = UIHelper.ScaleY(14);
|
||||||
foreach (var path in paths)
|
foreach (var path in pathCollection.Where(p => p.System == systemId)
|
||||||
|
.OrderBy(p => p.Ordinal)
|
||||||
|
.ThenBy(p => p.Type))
|
||||||
{
|
{
|
||||||
var box = new TextBox
|
var box = new TextBox
|
||||||
{
|
{
|
||||||
|
@ -243,10 +240,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void DoRomToggle()
|
private void DoRomToggle()
|
||||||
{
|
{
|
||||||
AllPathControls
|
foreach (var control in AllPathControls.Where(c => c.Name == "ROM"))
|
||||||
.Where(c => c.Name == "ROM")
|
control.Enabled = !RecentForROMs.Checked;
|
||||||
.ToList()
|
|
||||||
.ForEach(control => control.Enabled = !RecentForROMs.Checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<TextBox> AllPathBoxes
|
private IEnumerable<TextBox> AllPathBoxes
|
||||||
|
|
|
@ -306,13 +306,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void MovieView_DragDrop(object sender, DragEventArgs e)
|
private void MovieView_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
foreach (var path in ((string[])e.Data.GetData(DataFormats.FileDrop))
|
||||||
|
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path)?.Replace(".", ""))))
|
||||||
filePaths
|
AddMovieToList(path, force: true);
|
||||||
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", "")))
|
|
||||||
.ToList()
|
|
||||||
.ForEach(path => AddMovieToList(path, force: true));
|
|
||||||
|
|
||||||
RefreshMovieList();
|
RefreshMovieList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,11 +466,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void EditMenuItem_Click(object sender, EventArgs e)
|
private void EditMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MovieView.SelectedIndices
|
foreach (var movie in MovieView.SelectedIndices.Cast<int>().SelectAsIndexOf(_movieList))
|
||||||
.Cast<int>()
|
System.Diagnostics.Process.Start(movie.Filename);
|
||||||
.SelectAsIndexOf(_movieList)
|
|
||||||
.ToList()
|
|
||||||
.ForEach(movie => System.Diagnostics.Process.Start(movie.Filename));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -438,10 +438,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
CurrentFileName = "";
|
CurrentFileName = "";
|
||||||
_bestBotAttempt = null;
|
_bestBotAttempt = null;
|
||||||
|
|
||||||
ControlProbabilityPanel.Controls
|
foreach (var cp in ControlProbabilityPanel.Controls.OfType<BotControlsRow>())
|
||||||
.OfType<BotControlsRow>()
|
cp.Probability = 0;
|
||||||
.ToList()
|
|
||||||
.ForEach(cp => cp.Probability = 0);
|
|
||||||
|
|
||||||
FrameLength = 0;
|
FrameLength = 0;
|
||||||
MaximizeAddress = 0;
|
MaximizeAddress = 0;
|
||||||
|
|
|
@ -478,13 +478,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Global.CheatList.Insert(index - 1, cheat);
|
Global.CheatList.Insert(index - 1, cheat);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newindices = indices.Select(t => t - 1).ToList();
|
|
||||||
|
|
||||||
CheatListView.SelectedIndices.Clear();
|
CheatListView.SelectedIndices.Clear();
|
||||||
foreach (var newi in newindices)
|
foreach (var index in indices) CheatListView.SelectItem(index - 1, true);
|
||||||
{
|
|
||||||
CheatListView.SelectItem(newi, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateMessageLabel();
|
UpdateMessageLabel();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
|
@ -507,13 +502,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
UpdateMessageLabel();
|
UpdateMessageLabel();
|
||||||
|
|
||||||
var newindices = indices.Select(t => t + 1).ToList();
|
|
||||||
|
|
||||||
CheatListView.SelectedIndices.Clear();
|
CheatListView.SelectedIndices.Clear();
|
||||||
foreach (var newi in newindices)
|
foreach (var index in indices) CheatListView.SelectItem(index + 1, true);
|
||||||
{
|
|
||||||
CheatListView.SelectItem(newi, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
|
@ -525,7 +515,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ToggleMenuItem_Click(object sender, EventArgs e)
|
private void ToggleMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SelectedCheats.ToList().ForEach(x => x.Toggle());
|
foreach (var x in SelectedCheats) x.Toggle();
|
||||||
CheatListView.Refresh();
|
CheatListView.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,46 +41,40 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (Controls.OfType<Panel>().Any(p => p.Name == "FlagPanel"))
|
if (Controls.OfType<Panel>().Any(p => p.Name == "FlagPanel"))
|
||||||
{
|
{
|
||||||
Controls
|
foreach (var checkbox in Controls
|
||||||
.OfType<Panel>()
|
.OfType<Panel>()
|
||||||
.First(p => p.Name == "FlagPanel")
|
.First(p => p.Name == "FlagPanel")
|
||||||
.Controls
|
.Controls
|
||||||
.OfType<CheckBox>()
|
.OfType<CheckBox>())
|
||||||
.ToList()
|
|
||||||
.ForEach(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)
|
if (_canSetCpuRegisters)
|
||||||
{
|
{
|
||||||
Controls
|
foreach (var textbox in Controls
|
||||||
.OfType<TextBox>()
|
.OfType<TextBox>())
|
||||||
.ToList()
|
|
||||||
.ForEach(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
|
else
|
||||||
{
|
{
|
||||||
Controls
|
foreach (var label in Controls
|
||||||
.OfType<Label>()
|
.OfType<Label>())
|
||||||
.ToList()
|
|
||||||
.ForEach(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);
|
SetDomain(domain);
|
||||||
SetHighlighted(addrList[0]);
|
SetHighlighted(addrList[0]);
|
||||||
_secondaryHighlightedAddresses.Clear();
|
_secondaryHighlightedAddresses.Clear();
|
||||||
_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]).ToList());
|
_secondaryHighlightedAddresses.AddRange(addrList.Where(addr => addr != addrList[0]));
|
||||||
ClearNibbles();
|
ClearNibbles();
|
||||||
UpdateValues();
|
UpdateValues();
|
||||||
MemoryViewerBox.Refresh();
|
MemoryViewerBox.Refresh();
|
||||||
|
@ -837,8 +837,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (address >= 0)
|
if (address >= 0)
|
||||||
{
|
{
|
||||||
// TODO: can't unfreeze address 0??
|
// TODO: can't unfreeze address 0??
|
||||||
Global.CheatList.RemoveRange(
|
Global.CheatList.RemoveRange(Global.CheatList.Where(x => x.Contains(address)));
|
||||||
Global.CheatList.Where(x => x.Contains(address)).ToList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryViewerBox.Refresh();
|
MemoryViewerBox.Refresh();
|
||||||
|
|
|
@ -149,8 +149,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (control.Handle == ptr)
|
if (control.Handle == ptr)
|
||||||
{
|
{
|
||||||
var luaEvents = form.ControlEvents.Where(x => x.Control == ptr).ToList();
|
foreach (var luaEvent in form.ControlEvents.Where(x => x.Control == ptr))
|
||||||
foreach (var luaEvent in luaEvents)
|
|
||||||
{
|
{
|
||||||
form.ControlEvents.Remove(luaEvent);
|
form.ControlEvents.Remove(luaEvent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -701,7 +701,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private static void UpdateRegisteredFunctionsDialog()
|
private static void UpdateRegisteredFunctionsDialog()
|
||||||
{
|
{
|
||||||
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>().ToList())
|
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>())
|
||||||
{
|
{
|
||||||
form.UpdateValues();
|
form.UpdateValues();
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void PauseScriptMenuItem_Click(object sender, EventArgs e)
|
private void PauseScriptMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SelectedFiles.ToList().ForEach(x => x.TogglePause());
|
foreach (var x in SelectedFiles) x.TogglePause();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,11 +932,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void EditScriptMenuItem_Click(object sender, EventArgs e)
|
private void EditScriptMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SelectedFiles.ToList().ForEach(file =>
|
foreach (var file in SelectedFiles)
|
||||||
{
|
{
|
||||||
string pathToLoad = ProcessPath(file.Path);
|
string pathToLoad = ProcessPath(file.Path);
|
||||||
System.Diagnostics.Process.Start(pathToLoad);
|
System.Diagnostics.Process.Start(pathToLoad);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
|
private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -46,8 +46,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
FunctionView.Items.Clear();
|
FunctionView.Items.Clear();
|
||||||
|
|
||||||
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().OrderBy(x => x.Event).ThenBy(x => x.Name).ToList();
|
foreach (var nlf in GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()
|
||||||
foreach (var nlf in nlfs)
|
.OrderBy(x => x.Event)
|
||||||
|
.ThenBy(x => x.Name))
|
||||||
{
|
{
|
||||||
var item = new ListViewItem { Text = nlf.Event };
|
var item = new ListViewItem { Text = nlf.Event };
|
||||||
item.SubItems.Add(nlf.Name);
|
item.SubItems.Add(nlf.Name);
|
||||||
|
|
|
@ -185,9 +185,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileSelectors = FileSelectors.ToList();
|
var names = FileSelectors.Select(f => f.GetName());
|
||||||
|
|
||||||
var names = fileSelectors.Select(f => f.GetName());
|
|
||||||
|
|
||||||
var name = NameBox.Text;
|
var name = NameBox.Text;
|
||||||
|
|
||||||
|
|
|
@ -677,13 +677,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (TasView.AnyRowsSelected)
|
if (TasView.AnyRowsSelected)
|
||||||
{
|
{
|
||||||
var wasPaused = Mainform.EmulatorPaused;
|
var wasPaused = Mainform.EmulatorPaused;
|
||||||
var framesToInsert = TasView.SelectedRows.ToList();
|
|
||||||
var insertionFrame = Math.Min(TasView.LastSelectedIndex.Value + 1, CurrentTasMovie.InputLogLength);
|
var insertionFrame = Math.Min(TasView.LastSelectedIndex.Value + 1, CurrentTasMovie.InputLogLength);
|
||||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||||
|
var inputLog = TasView.SelectedRows.Select(frame => CurrentTasMovie.GetInputLogEntry(frame)).ToList();
|
||||||
var inputLog = framesToInsert
|
|
||||||
.Select(frame => CurrentTasMovie.GetInputLogEntry(frame))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
CurrentTasMovie.InsertInput(insertionFrame, inputLog);
|
CurrentTasMovie.InsertInput(insertionFrame, inputLog);
|
||||||
|
|
||||||
|
@ -780,8 +776,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
|
private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
IEnumerable<TasMovieMarker> markers = CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame));
|
foreach (var m in CurrentTasMovie.Markers.Where(m => TasView.SelectedRows.Contains(m.Frame)))
|
||||||
foreach (TasMovieMarker m in markers.ToList())
|
|
||||||
{
|
{
|
||||||
CurrentTasMovie.Markers.Remove(m);
|
CurrentTasMovie.Markers.Remove(m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,10 +136,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void ClearBoolean()
|
public void ClearBoolean()
|
||||||
{
|
{
|
||||||
PadControls
|
foreach (var p in PadControls.OfType<VirtualPadButton>()) p.Clear();
|
||||||
.OfType<VirtualPadButton>()
|
|
||||||
.ToList()
|
|
||||||
.ForEach(p => p.Clear());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(IController controller)
|
public void Set(IController controller)
|
||||||
|
@ -149,28 +146,14 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public void SetPrevious(IController previous)
|
public void SetPrevious(IController previous)
|
||||||
{
|
{
|
||||||
PadControls
|
foreach (var c in PadControls.OfType<VirtualPadAnalogStick>()) c.SetPrevious(previous);
|
||||||
.OfType<VirtualPadAnalogStick>()
|
|
||||||
.ToList()
|
|
||||||
.ForEach(c => c.SetPrevious(previous));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BumpAnalog(int? x, int? y)
|
public void BumpAnalog(int? x, int? y)
|
||||||
{
|
{
|
||||||
PadControls
|
foreach (var a in PadControls.OfType<VirtualPadAnalogStick>()) a.Bump(x, y);
|
||||||
.OfType<VirtualPadAnalogStick>()
|
foreach (var a in PadControls.OfType<VirtualPadAnalogButton>()) a.Bump(x);
|
||||||
.ToList()
|
foreach (var a in PadControls.OfType<VirtualPadTargetScreen>()) a.Bump(x, y);
|
||||||
.ForEach(a => a.Bump(x, y));
|
|
||||||
|
|
||||||
PadControls
|
|
||||||
.OfType<VirtualPadAnalogButton>()
|
|
||||||
.ToList()
|
|
||||||
.ForEach(a => a.Bump(x));
|
|
||||||
|
|
||||||
PadControls
|
|
||||||
.OfType<VirtualPadTargetScreen>()
|
|
||||||
.ToList()
|
|
||||||
.ForEach(a => a.Bump(x, y));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,7 +876,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitialLocation = this.ChildPointToScreen(WatchListView)
|
InitialLocation = this.ChildPointToScreen(WatchListView)
|
||||||
};
|
};
|
||||||
|
|
||||||
poke.SetWatch(SelectedIndices.Select(t => _searches[t]).ToList());
|
poke.SetWatch(SelectedIndices.Select(t => _searches[t]));
|
||||||
poke.ShowHawkDialog();
|
poke.ShowHawkDialog();
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
|
@ -1512,10 +1512,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ErrorIconButton_Click(object sender, EventArgs e)
|
private void ErrorIconButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var outOfRangeAddresses = _searches.OutOfRangeAddress.ToList();
|
SetRemovedMessage(_searches.OutOfRangeAddress.Count());
|
||||||
|
|
||||||
SetRemovedMessage(outOfRangeAddresses.Count);
|
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
ToggleSearchDependentToolBarItems();
|
ToggleSearchDependentToolBarItems();
|
||||||
}
|
}
|
||||||
|
|
|
@ -915,10 +915,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
Changes();
|
Changes();
|
||||||
|
|
||||||
var indices = indexes.Select(t => t - 1).ToList();
|
|
||||||
|
|
||||||
WatchListView.SelectedIndices.Clear();
|
WatchListView.SelectedIndices.Clear();
|
||||||
foreach (var t in indices)
|
foreach (var t in indexes.Select(t => t - 1))
|
||||||
{
|
{
|
||||||
WatchListView.SelectItem(t, true);
|
WatchListView.SelectItem(t, true);
|
||||||
}
|
}
|
||||||
|
@ -941,10 +939,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_watches.Insert(indices[i] + 1, watch);
|
_watches.Insert(indices[i] + 1, watch);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newindices = indices.Select(t => t + 1).ToList();
|
|
||||||
|
|
||||||
WatchListView.SelectedIndices.Clear();
|
WatchListView.SelectedIndices.Clear();
|
||||||
foreach (var t in newindices)
|
foreach (var t in indices.Select(t => t + 1))
|
||||||
{
|
{
|
||||||
WatchListView.SelectItem(t, true);
|
WatchListView.SelectItem(t, true);
|
||||||
}
|
}
|
||||||
|
@ -1298,11 +1294,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ErrorIconButton_Click(object sender, EventArgs e)
|
private void ErrorIconButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var items = _watches
|
foreach (var item in _watches.Where(watch => watch.Address >= watch.Domain.Size))
|
||||||
.Where(watch => watch.Address >= watch.Domain.Size)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
{
|
||||||
_watches.Remove(item);
|
_watches.Remove(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.Stop();
|
Global.MovieSession.Movie.Stop();
|
||||||
|
|
||||||
foreach (var ew in EmulatorWindows.ToList())
|
foreach (var ew in EmulatorWindows)
|
||||||
{
|
{
|
||||||
ew.ShutDown();
|
ew.ShutDown();
|
||||||
}
|
}
|
||||||
|
@ -1421,7 +1421,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
|
|
||||||
private void CloseAllWindows()
|
private void CloseAllWindows()
|
||||||
{
|
{
|
||||||
foreach (var ew in EmulatorWindows.ToList())
|
foreach (var ew in EmulatorWindows)
|
||||||
{
|
{
|
||||||
ew.Close();
|
ew.Close();
|
||||||
}
|
}
|
||||||
|
@ -1431,7 +1431,7 @@ namespace BizHawk.Client.MultiHawk
|
||||||
|
|
||||||
private void NewSessionMenuItem_Click(object sender, EventArgs e)
|
private void NewSessionMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
foreach (var ew in EmulatorWindows.ToList())
|
foreach (var ew in EmulatorWindows)
|
||||||
{
|
{
|
||||||
ew.Close();
|
ew.Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,13 +300,9 @@ namespace BizHawk.Client.MultiHawk
|
||||||
|
|
||||||
private void MovieView_DragDrop(object sender, DragEventArgs e)
|
private void MovieView_DragDrop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
foreach (var path in ((string[])e.Data.GetData(DataFormats.FileDrop))
|
||||||
|
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path)?.Replace(".", ""))))
|
||||||
filePaths
|
AddMovieToList(path, force: true);
|
||||||
.Where(path => MovieService.MovieExtensions.Contains(Path.GetExtension(path).Replace(".", "")))
|
|
||||||
.ToList()
|
|
||||||
.ForEach(path => AddMovieToList(path, force: true));
|
|
||||||
|
|
||||||
RefreshMovieList();
|
RefreshMovieList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,11 +455,8 @@ namespace BizHawk.Client.MultiHawk
|
||||||
|
|
||||||
private void EditMenuItem_Click(object sender, EventArgs e)
|
private void EditMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MovieView.SelectedIndices
|
foreach (var movie in MovieView.SelectedIndices.Cast<int>().SelectAsIndexOf(_movieList))
|
||||||
.Cast<int>()
|
System.Diagnostics.Process.Start(movie.Filename);
|
||||||
.SelectAsIndexOf(_movieList)
|
|
||||||
.ToList()
|
|
||||||
.ForEach(movie => System.Diagnostics.Process.Start(movie.Filename));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -58,19 +58,15 @@ namespace BizHawk.Common.BizInvoke
|
||||||
|
|
||||||
public DelegateStorage(Type type)
|
public DelegateStorage(Type type)
|
||||||
{
|
{
|
||||||
var methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public)
|
var typeBuilder = ImplModuleBuilder.DefineType(
|
||||||
|
"Bizhawk.BizExvokeHolder" + type.Name, TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed);
|
||||||
|
foreach (var a in type.GetMethods(BindingFlags.Instance | BindingFlags.Public)
|
||||||
.Select(m => new
|
.Select(m => new
|
||||||
{
|
{
|
||||||
Info = m,
|
Info = m,
|
||||||
Attr = m.GetCustomAttributes(true).OfType<BizExportAttribute>().FirstOrDefault()
|
Attr = m.GetCustomAttributes(true).OfType<BizExportAttribute>().FirstOrDefault()
|
||||||
})
|
})
|
||||||
.Where(a => a.Attr != null)
|
.Where(a => a.Attr != null))
|
||||||
.ToList();
|
|
||||||
|
|
||||||
var typeBuilder = ImplModuleBuilder.DefineType(
|
|
||||||
"Bizhawk.BizExvokeHolder" + type.Name, TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed);
|
|
||||||
|
|
||||||
foreach (var a in methods)
|
|
||||||
{
|
{
|
||||||
MethodBuilder unused;
|
MethodBuilder unused;
|
||||||
var delegateType = BizInvokeUtilities.CreateDelegateType(a.Info, a.Attr.CallingConvention, typeBuilder, out unused).CreateType();
|
var delegateType = BizInvokeUtilities.CreateDelegateType(a.Info, a.Attr.CallingConvention, typeBuilder, out unused).CreateType();
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Common
|
||||||
{
|
{
|
||||||
public ServiceNotApplicableAttribute(params Type[] types)
|
public ServiceNotApplicableAttribute(params Type[] types)
|
||||||
{
|
{
|
||||||
NotApplicableTypes = types?.ToList() ?? new List<Type>();
|
NotApplicableTypes = types ?? Enumerable.Empty<Type>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Type> NotApplicableTypes { get; private set; }
|
public IEnumerable<Type> NotApplicableTypes { get; private set; }
|
||||||
|
|
|
@ -1034,13 +1034,9 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer()
|
||||||
{
|
{
|
||||||
// get only lines that have pixel data
|
|
||||||
var lines = ScreenLines.Where(a => a.Pixels.Count > 0).ToList();
|
|
||||||
var height = lines.Count();
|
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int lCount = 0;
|
int lCount = 0;
|
||||||
foreach (var l in lines)
|
foreach (var l in ScreenLines.Where(a => a.Pixels.Count > 0)) // get only lines that have pixel data
|
||||||
{
|
{
|
||||||
var lCop = l.Pixels.ToList();
|
var lCop = l.Pixels.ToList();
|
||||||
var len = l.Pixels.Count;
|
var len = l.Pixels.Count;
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
{
|
{
|
||||||
Name = _game.Name,
|
Name = _game.Name,
|
||||||
System = "A26",
|
System = "A26",
|
||||||
MetaData = "m=" + _mapper.GetType().ToString().Split('.').ToList().Last(),
|
MetaData = $"m={_mapper.GetType().ToString().Split('.').Last()}",
|
||||||
Hash = Rom.HashSHA1(),
|
Hash = Rom.HashSHA1(),
|
||||||
Region = _game.Region,
|
Region = _game.Region,
|
||||||
Status = RomStatus.Unknown
|
Status = RomStatus.Unknown
|
||||||
|
|
Loading…
Reference in New Issue