From fdb5dfb7e580645d76e2921a4653027a8fdcf4e6 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 14 May 2021 13:41:13 +1000 Subject: [PATCH] Silence flood of prints on startup (in Debug), obviously no-one cares --- src/BizHawk.Client.EmuHawk/MainForm.cs | 9 ++++----- .../Database/Database.cs | 16 +++++++--------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 9a09766ad7..3f778e21fe 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -290,7 +290,7 @@ namespace BizHawk.Client.EmuHawk } //do this threaded stuff early so it has plenty of time to run in background - Database.InitializeDatabase(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb.txt")); + Database.InitializeDatabase(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb", "gamedb.txt"), warnForCollisions: false); BootGodDb.Initialize(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb")); Config = config; @@ -1224,10 +1224,9 @@ namespace BizHawk.Client.EmuHawk } } - - Util.DebugWriteLine($"For emulator framebuffer {new Size(_currentVideoProvider.BufferWidth, _currentVideoProvider.BufferHeight)}:"); - Util.DebugWriteLine($" For virtual size {new Size(_currentVideoProvider.VirtualWidth, _currentVideoProvider.VirtualHeight)}:"); - Util.DebugWriteLine($" Selecting display size {lastComputedSize}"); +// Util.DebugWriteLine($"For emulator framebuffer {new Size(_currentVideoProvider.BufferWidth, _currentVideoProvider.BufferHeight)}:"); +// Util.DebugWriteLine($" For virtual size {new Size(_currentVideoProvider.VirtualWidth, _currentVideoProvider.VirtualHeight)}:"); +// Util.DebugWriteLine($" Selecting display size {lastComputedSize}"); // Change size Size = new Size(lastComputedSize.Width + borderWidth, lastComputedSize.Height + borderHeight); diff --git a/src/BizHawk.Emulation.Common/Database/Database.cs b/src/BizHawk.Emulation.Common/Database/Database.cs index 0806878674..2749b70c11 100644 --- a/src/BizHawk.Emulation.Common/Database/Database.cs +++ b/src/BizHawk.Emulation.Common/Database/Database.cs @@ -36,7 +36,7 @@ namespace BizHawk.Emulation.Common return hash; } - private static void LoadDatabase_Escape(string line, string path) + private static void LoadDatabase_Escape(string line, string path, bool warnForCollisions) { if (!line.ToUpperInvariant().StartsWith("#INCLUDE")) { @@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Common if (File.Exists(filename)) { Debug.WriteLine("loading external game database {0}", line); - initializeWork(filename); + initializeWork(filename, warnForCollisions); } else { @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Common private static bool initialized = false; - private static void initializeWork(string path) + private static void initializeWork(string path, bool warnForCollisions) { //reminder: this COULD be done on several threads, if it takes even longer using var reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)); @@ -107,7 +107,7 @@ namespace BizHawk.Emulation.Common if (line.StartsWith("#")) { - LoadDatabase_Escape(line, Path.GetDirectoryName(path)); + LoadDatabase_Escape(line, Path.GetDirectoryName(path), warnForCollisions); continue; } @@ -142,12 +142,10 @@ namespace BizHawk.Emulation.Common ForcedCore = items.Length >= 8 ? items[7].ToLowerInvariant() : "" }; -#if DEBUG - if (DB.ContainsKey(game.Hash)) + if (warnForCollisions && DB.ContainsKey(game.Hash)) { Console.WriteLine("gamedb: Multiple hash entries {0}, duplicate detected on \"{1}\" and \"{2}\"", game.Hash, game.Name, DB[game.Hash].Name); } -#endif DB[game.Hash] = game; } @@ -160,14 +158,14 @@ namespace BizHawk.Emulation.Common acquire.Set(); } - public static void InitializeDatabase(string path) + public static void InitializeDatabase(string path, bool warnForCollisions) { if (initialized) throw new InvalidOperationException("Did not expect re-initialize of game Database"); initialized = true; var stopwatch = Stopwatch.StartNew(); ThreadPool.QueueUserWorkItem(_=> { - initializeWork(path); + initializeWork(path, warnForCollisions); Util.DebugWriteLine("GameDB load: " + stopwatch.Elapsed + " sec"); }); }