Silence flood of prints on startup (in Debug), obviously no-one cares

This commit is contained in:
YoshiRulz 2021-05-14 13:41:13 +10:00
parent a9facd895a
commit fdb5dfb7e5
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 11 additions and 14 deletions

View File

@ -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);

View File

@ -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");
});
}