From 517be084ab7621c18419ea5b723e4f68dc3016bf Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Tue, 27 Jul 2021 15:12:31 +1000 Subject: [PATCH] Replace Debug.WriteLine w/ Util.DebugWriteLine (or `Console.WriteLine` if it's in `#if DEBUG`) bonus wtf: 2 calls in Database were to `WriteLine(string, string)` overload, not the intended `WriteLine(string, params object[])` overload --- src/BizHawk.Bizware.OpenTK3/OTK_Gamepad.cs | 4 ++-- src/BizHawk.Client.Common/RomLoader.cs | 3 +-- src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs | 2 +- src/BizHawk.Common/HawkFile/HawkFile.cs | 5 ++--- src/BizHawk.Emulation.Common/Database/Database.cs | 6 +++--- .../Computers/Commodore64/MOS/Vic.cs | 9 +++++---- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/BizHawk.Bizware.OpenTK3/OTK_Gamepad.cs b/src/BizHawk.Bizware.OpenTK3/OTK_Gamepad.cs index 0b088b1b77..ce56e1ee57 100644 --- a/src/BizHawk.Bizware.OpenTK3/OTK_Gamepad.cs +++ b/src/BizHawk.Bizware.OpenTK3/OTK_Gamepad.cs @@ -174,13 +174,13 @@ namespace BizHawk.Bizware.OpenTK3 [Conditional("DEBUG")] private void DebugState(GamePadState tmpState) { - if (!tmpState.Equals(state)) Debug.WriteLine($"GamePad State:\t{tmpState}"); + if (!tmpState.Equals(state)) Console.WriteLine($"GamePad State:\t{tmpState}"); } [Conditional("DEBUG")] private void DebugState(JoystickState tmpJstate) { - if (!tmpJstate.Equals(jState)) Debug.WriteLine($"Joystick State:\t{tmpJstate}"); + if (!tmpJstate.Equals(jState)) Console.WriteLine($"Joystick State:\t{tmpJstate}"); } public IEnumerable<(string AxisID, float Value)> GetAxes() diff --git a/src/BizHawk.Client.Common/RomLoader.cs b/src/BizHawk.Client.Common/RomLoader.cs index c7694f3046..8f3c991f29 100644 --- a/src/BizHawk.Client.Common/RomLoader.cs +++ b/src/BizHawk.Client.Common/RomLoader.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; @@ -422,7 +421,7 @@ namespace BizHawk.Client.Common rom.GameInfo.System = "NES"; } - Debug.WriteLine(rom.GameInfo.System); + Util.DebugWriteLine(rom.GameInfo.System); if (string.IsNullOrEmpty(rom.GameInfo.System)) { diff --git a/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs b/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs index 96ea0c6cc5..efd566cc2e 100644 --- a/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs +++ b/src/BizHawk.Client.EmuHawk/tools/ExternalToolManager.cs @@ -119,7 +119,7 @@ namespace BizHawk.Client.EmuHawk #if DEBUG if (e is ReflectionTypeLoadException rtle) { - foreach (var e1 in rtle.LoaderExceptions) System.Diagnostics.Debug.WriteLine(e1.Message); + foreach (var e1 in rtle.LoaderExceptions) Console.WriteLine(e1.Message); } #endif item.ToolTipText = e switch diff --git a/src/BizHawk.Common/HawkFile/HawkFile.cs b/src/BizHawk.Common/HawkFile/HawkFile.cs index e5db2da79f..56318dbdf8 100644 --- a/src/BizHawk.Common/HawkFile/HawkFile.cs +++ b/src/BizHawk.Common/HawkFile/HawkFile.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; @@ -169,7 +168,7 @@ namespace BizHawk.Common _extractor.ExtractFile(archiveIndex, _boundStream); _boundStream.Position = 0; ArchiveMemberPath = _archiveItems[index].Name; // TODO - maybe go through our own list of names? maybe not, its indices don't match... - Debug.WriteLine($"{nameof(HawkFile)} bound {CanonicalFullPath}"); + Util.DebugWriteLine($"{nameof(HawkFile)} bound {CanonicalFullPath}"); BoundIndex = archiveIndex; return this; } @@ -240,7 +239,7 @@ namespace BizHawk.Common private void BindRoot() { _boundStream = _rootStream; - Debug.WriteLine($"{nameof(HawkFile)} bound {CanonicalFullPath}"); + Util.DebugWriteLine($"{nameof(HawkFile)} bound {CanonicalFullPath}"); } /// As , but doesn't bind anything if there are multiple archive members with a matching file extension. diff --git a/src/BizHawk.Emulation.Common/Database/Database.cs b/src/BizHawk.Emulation.Common/Database/Database.cs index c062c6674b..94e36124ab 100644 --- a/src/BizHawk.Emulation.Common/Database/Database.cs +++ b/src/BizHawk.Emulation.Common/Database/Database.cs @@ -49,12 +49,12 @@ namespace BizHawk.Emulation.Common var filename = Path.Combine(path, line); if (File.Exists(filename)) { - Debug.WriteLine("loading external game database {0}", line); + Util.DebugWriteLine($"loading external game database {line}"); initializeWork(filename, warnForCollisions); } else { - Debug.WriteLine("BENIGN: missing external game database {0}", line); + Util.DebugWriteLine($"BENIGN: missing external game database {line}"); } } @@ -153,7 +153,7 @@ namespace BizHawk.Emulation.Common } catch { - Debug.WriteLine($"Error parsing database entry: {line}"); + Util.DebugWriteLine($"Error parsing database entry: {line}"); } } diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs index 1a997b0fce..b1159ee643 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/MOS/Vic.cs @@ -1,8 +1,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; +using BizHawk.Common; + namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS { public sealed partial class Vic @@ -45,11 +46,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS public Vic(int newCycles, int newLines, IList newPipeline, int newCyclesPerSec, int hblankStart, int hblankEnd, int vblankStart, int vblankEnd, C64.BorderType borderType, int pixelRatioNum, int pixelRatioDen) { - Debug.WriteLine("C64 VIC timings:"); - Debug.WriteLine("RX FTCH BA ACT"); + Util.DebugWriteLine("C64 VIC timings:"); + Util.DebugWriteLine("RX FTCH BA ACT"); for (var i = 0; i < newPipeline[0].Length; i++) { - Debug.WriteLine("{0:x4} {1:x4} {2:x4} {3:x8}", newPipeline[0][i], newPipeline[1][i], newPipeline[2][i], newPipeline[3][i]); + Util.DebugWriteLine("{0:x4} {1:x4} {2:x4} {3:x8}", newPipeline[0][i], newPipeline[1][i], newPipeline[2][i], newPipeline[3][i]); } _pixelRatioNum = pixelRatioNum;