From 999dcdaec8b5f0e41ba6c9371ad8dfb62560a814 Mon Sep 17 00:00:00 2001 From: nattthebear Date: Sun, 7 May 2017 16:54:18 -0400 Subject: [PATCH] The power of C# 5, or 6, or something --- .../Consoles/Nintendo/NES/FDS/RamAdapter.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/RamAdapter.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/RamAdapter.cs index 2a43f2831a..4861d49708 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/RamAdapter.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/FDS/RamAdapter.cs @@ -212,8 +212,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES state = RamAdapterState.IDLE; SetCycles(); Console.WriteLine("FDS: Disk ejected"); - if (DriveLightCallback != null) - DriveLightCallback(false); + DriveLightCallback?.Invoke(false); } /// @@ -234,8 +233,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES SetCycles(); Console.WriteLine("FDS: Disk Inserted"); originaldisk = (byte[])disk.Clone(); - if (DriveLightCallback != null) - DriveLightCallback(false); + DriveLightCallback?.Invoke(false); } /// @@ -383,8 +381,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES state = RamAdapterState.SPINUP; SetCycles(); //} - if (DriveLightCallback != null) - DriveLightCallback(true); + DriveLightCallback?.Invoke(true); } } if ((value & 2) != 0) @@ -495,8 +492,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES state = RamAdapterState.RESET; transferreset = false; //numcrc = 0; - if (DriveLightCallback != null) - DriveLightCallback(false); + DriveLightCallback?.Invoke(false); } SetCycles(); break; @@ -509,16 +505,14 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES transferreset = false; //numcrc = 0; // Console.WriteLine("FDS: Return or Insert Complete"); - if (DriveLightCallback != null) - DriveLightCallback(false); + DriveLightCallback?.Invoke(false); break; case RamAdapterState.SPINUP: state = RamAdapterState.RUNNING; SetCycles(); //transferreset = false; // this definitely does not happen. // Console.WriteLine("FDS: Spin up complete! Disk is running"); - if (DriveLightCallback != null) - DriveLightCallback(true); + DriveLightCallback?.Invoke(true); break; case RamAdapterState.IDLE: