diff --git a/Common.ruleset b/Common.ruleset index 23e2d7c20d..9973a6e929 100644 --- a/Common.ruleset +++ b/Common.ruleset @@ -351,9 +351,6 @@ - - - diff --git a/src/BizHawk.Client.Common/lua/NamedLuaFunction.cs b/src/BizHawk.Client.Common/lua/NamedLuaFunction.cs index adaf443a48..7174108dfa 100644 --- a/src/BizHawk.Client.Common/lua/NamedLuaFunction.cs +++ b/src/BizHawk.Client.Common/lua/NamedLuaFunction.cs @@ -17,7 +17,7 @@ namespace BizHawk.Client.Common LuaFile = luaFile; Guid = Guid.NewGuid(); - Callback = delegate + Callback = () => { try { @@ -29,10 +29,7 @@ namespace BizHawk.Client.Common } }; - MemCallback = delegate - { - Callback(); - }; + MemCallback = (address, value, flags) => Callback(); } public Guid Guid { get; } diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 57b81262e1..5fb04e3376 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -2652,7 +2652,7 @@ namespace BizHawk.Client.EmuHawk private void FdsInsertDiskMenuAdd(string name, string button, string msg) { - FDSControlsMenuItem.DropDownItems.Add(name, null, delegate + FDSControlsMenuItem.DropDownItems.Add(name, null, (sender, e) => { if (Emulator.ControllerDefinition.BoolButtons.Contains(button) && !MovieSession.Movie.IsPlaying()) diff --git a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs index a978465b1d..7a09d883b6 100644 --- a/src/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -152,10 +152,7 @@ namespace BizHawk.Client.EmuHawk var tempBox = box; var tempPath = path.Type; var tempSystem = path.System; - btn.Click += delegate - { - BrowseFolder(tempBox, tempPath, tempSystem); - }; + btn.Click += (sender, args) => BrowseFolder(tempBox, tempPath, tempSystem); int infoPadding = UIHelper.ScaleX(0); if (t.Name.Contains("Global") && path.Type == "Firmware") @@ -172,7 +169,7 @@ namespace BizHawk.Client.EmuHawk Anchor = AnchorStyles.Top | AnchorStyles.Right }; - firmwareButton.Click += delegate + firmwareButton.Click += (sender, e) => { if (Owner is FirmwaresConfig) { diff --git a/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs index 4165c63460..5dcbd0f681 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs @@ -39,7 +39,7 @@ namespace BizHawk.Client.EmuHawk DirectoryMonitor.Created += DirectoryMonitor_Created; DirectoryMonitor.EnableRaisingEvents = true; - ClientApi.RomLoaded += delegate { BuildToolStrip(); }; + ClientApi.RomLoaded += (sender, e) => BuildToolStrip(); BuildToolStrip(); } diff --git a/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs b/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs index 8a6d2ad66e..a62f0ce539 100644 --- a/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/GBA/GBAGPUView.cs @@ -671,7 +671,7 @@ namespace BizHawk.Client.EmuHawk { Form form = (Form)f; // close becomes hide - form.FormClosing += delegate(object sender, FormClosingEventArgs e) + form.FormClosing += (sender, e) => { e.Cancel = true; listBoxWidgets.Items.Add(sender); diff --git a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs index dbfe3145b7..f7aba5113d 100644 --- a/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs +++ b/src/BizHawk.Emulation.Cores/Arcades/MAME/MAME.cs @@ -527,10 +527,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME { return _peek(addr, firstOffset, size); }, - read == "rom" ? (Action)null : delegate (long addr, byte val) - { - _poke(addr, val, firstOffset, size); - }, + read == "rom" ? (Action) null : (addr, val) => _poke(addr, val, firstOffset, size), dataWidth)); } } diff --git a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs index 4f211585b4..81e92d782d 100644 --- a/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs +++ b/src/BizHawk.Emulation.Cores/CPUs/HuC6280/HuC6280.cs @@ -318,7 +318,7 @@ namespace BizHawk.Emulation.Cores.Components.H6280 public Func ReadMemory21; public Action WriteMemory21; public Action WriteVDC; - public Action ThinkAction = delegate { }; + public Action ThinkAction = i => {}; public IMemoryCallbackSystem MemoryCallbacks; diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IMemoryDomains.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IMemoryDomains.cs index 06d4868343..3286646d78 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IMemoryDomains.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/MGBAHawk.IMemoryDomains.cs @@ -88,7 +88,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA // special combined ram memory domain _cwram.Peek = - delegate (long addr) + addr => { if (addr < 0 || addr >= (256 + 32) * 1024) { @@ -103,7 +103,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA return PeekWRAM(s.wram, addr); }; _cwram.Poke = - delegate (long addr, byte val) + (addr, val) => { if (addr < 0 || addr >= (256 + 32) * 1024) { diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index 1ec9d15287..00763e84dc 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -437,10 +437,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } else if (line >= 0 && line <= 153) { - scanlinecb = delegate - { - callback(LibGambatte.gambatte_cpuread(GambatteState, 0xff40)); - }; + scanlinecb = () => callback(LibGambatte.gambatte_cpuread(GambatteState, 0xff40)); LibGambatte.gambatte_setscanlinecallback(GambatteState, scanlinecb, line); } else diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IDebuggable.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IDebuggable.cs index 0d60e0ab2a..3658e6a7cb 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IDebuggable.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IDebuggable.cs @@ -113,15 +113,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 { var mcs = MemoryCallbacks; - api.BreakpointHit += delegate(uint address, mupen64plusApi.BreakType type) + api.BreakpointHit += (address, type) => api.OnBreakpoint(new mupen64plusApi.BreakParams { - api.OnBreakpoint(new mupen64plusApi.BreakParams - { - _type = type, - _addr = address, - _mcs = mcs - }); - }; + _type = type, + _addr = address, + _mcs = mcs + }); } private void AddBreakpoint(IMemoryCallback callback) diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs index 214ae8a30e..4cdd0be192 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/N64/N64.IMemoryDomains.cs @@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 if (swizzled) { - peekByte = delegate(long addr) + peekByte = addr => { if (addr < 0 || addr >= size) { @@ -39,7 +39,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 return Marshal.ReadByte(memPtr, (int)(addr ^ 3)); }; - pokeByte = delegate(long addr, byte val) + pokeByte = (addr, val) => { if (addr < 0 || addr >= size) { @@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 } else { - peekByte = delegate(long addr) + peekByte = addr => { if (addr < 0 || addr >= size) { @@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 return Marshal.ReadByte(memPtr, (int)(addr)); }; - pokeByte = delegate(long addr, byte val) + pokeByte = (addr, val) => { if (addr < 0 || addr >= size) { @@ -117,18 +117,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64 } - Func peekByte; - Action pokeByte; - - peekByte = delegate(long addr) - { - return api.m64p_read_memory_8((uint)addr); - }; - - pokeByte = delegate(long addr, byte val) - { - api.m64p_write_memory_8((uint)addr, val); - }; + Func peekByte = addr => api.m64p_read_memory_8((uint) addr); + Action pokeByte = (addr, val) => api.m64p_write_memory_8((uint) addr, val); _memoryDomains.Add(new MemoryDomainDelegate ( diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGXControlConverter.cs b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGXControlConverter.cs index 66e67682fa..84bed93eef 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGXControlConverter.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Sega/gpgx64/GPGXControlConverter.cs @@ -109,7 +109,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx string name = $"P{player} {button.Name}"; ControllerDef.BoolButtons.Add(name); var buttonFlag = button.Key; - _converts.Add(delegate + _converts.Add(() => { if (_source.IsPressed(name)) { @@ -124,7 +124,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx ControllerDef.AddXYPair($"P{player} Mouse {{0}}", AxisPairOrientation.RightAndUp, -256, 0, 255); //TODO verify direction against hardware var nx = $"P{player} Mouse X"; var ny = $"P{player} Mouse Y"; - _converts.Add(delegate + _converts.Add(() => { _target.analog[(2 * idx) + 0] = (short)_source.AxisValue(nx); _target.analog[(2 * idx) + 1] = (short)_source.AxisValue(ny); @@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx ControllerDef.AddXYPair($"P{player} Lightgun {{0}}", AxisPairOrientation.RightAndUp, 0, 5000, 10000); //TODO verify direction against hardware var nx = $"P{player} Lightgun X"; var ny = $"P{player} Lightgun Y"; - _converts.Add(delegate + _converts.Add(() => { _target.analog[(2 * idx) + 0] = (short)(_source.AxisValue(nx) / 10000.0f * (ScreenWidth - 1)); _target.analog[(2 * idx) + 1] = (short)(_source.AxisValue(ny) / 10000.0f * (ScreenHeight - 1)); @@ -150,7 +150,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx var nx = $"P{player} Stick X"; var ny = $"P{player} Stick Y"; var nz = $"P{player} Stick Z"; - _converts.Add(delegate + _converts.Add(() => { _target.analog[(2 * idx) + 0] = (short)_source.AxisValue(nx); _target.analog[(2 * idx) + 1] = (short)_source.AxisValue(ny); diff --git a/src/BizHawk.Emulation.Cores/Sound/CDAudio.cs b/src/BizHawk.Emulation.Cores/Sound/CDAudio.cs index 2d9f73535b..4a8c8b1568 100644 --- a/src/BizHawk.Emulation.Cores/Sound/CDAudio.cs +++ b/src/BizHawk.Emulation.Cores/Sound/CDAudio.cs @@ -21,7 +21,7 @@ namespace BizHawk.Emulation.Cores.Components public const byte PlaybackMode_LoopOnCompletion = 2; public const byte PlaybackMode_CallbackOnCompletion = 3; - public Action CallbackAction = delegate { }; + public Action CallbackAction = () => {}; public Disc Disc; public DiscSectorReader DiscSectorReader;