Add and use DEBUG-conditional WriteLine methods

This commit is contained in:
YoshiRulz 2020-06-26 14:37:36 +10:00
parent 46e744cd33
commit 69146b04b2
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
6 changed files with 25 additions and 7 deletions

View File

@ -11,6 +11,7 @@ using System.IO;
using System.Collections.Generic;
using BizHawk.Bizware.BizwareGL;
using BizHawk.Common;
using OpenTK;
using OpenTK.Graphics;
@ -221,7 +222,7 @@ namespace BizHawk.Client.EmuHawk
throw new InvalidOperationException($"Error creating pipeline (link status false returned from glLinkProgram): \r\n\r\n{resultLog}");
else success = false;
resultLog = GL.GetProgramInfoLog(pid);
Console.WriteLine(resultLog);
Util.DebugWriteLine(resultLog);
}
//need to work on validation. apparently there are some weird caveats to glValidate which make it complicated and possibly excuses (barely) the intel drivers' dysfunctional operation

View File

@ -1138,9 +1138,9 @@ namespace BizHawk.Client.EmuHawk
}
Console.WriteLine($"For emulator framebuffer {new Size(_currentVideoProvider.BufferWidth, _currentVideoProvider.BufferHeight)}:");
Console.WriteLine($" For virtual size {new Size(_currentVideoProvider.VirtualWidth, _currentVideoProvider.VirtualHeight)}:");
Console.WriteLine($" 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

@ -156,7 +156,7 @@ namespace BizHawk.Client.EmuHawk
afsfreq = 1000;
tmethod = 0;
}
Console.WriteLine("throttle method: {0}; resolution: {1}", tmethod, afsfreq);
Util.DebugWriteLine("throttle method: {0}; resolution: {1}", tmethod, afsfreq);
tfreq = afsfreq * 65536;
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
@ -21,6 +22,22 @@ namespace BizHawk.Common
}
}
/// <summary>equivalent to <see cref="Console.WriteLine()">Console.WriteLine</see> but is <c>#ifdef DEBUG</c></summary>
[Conditional("DEBUG")]
public static void DebugWriteLine() => Console.WriteLine();
/// <summary>equivalent to <see cref="Console.WriteLine(string)">Console.WriteLine</see> but is <c>#ifdef DEBUG</c></summary>
[Conditional("DEBUG")]
public static void DebugWriteLine(string value) => Console.WriteLine(value);
/// <summary>equivalent to <see cref="Console.WriteLine(object)">Console.WriteLine</see> but is <c>#ifdef DEBUG</c></summary>
[Conditional("DEBUG")]
public static void DebugWriteLine(object value) => Console.WriteLine(value);
/// <summary>equivalent to <see cref="Console.WriteLine(string, object[])">Console.WriteLine</see> but is <c>#ifdef DEBUG</c></summary>
[Conditional("DEBUG")]
public static void DebugWriteLine(string format, params object[] arg) => Console.WriteLine(format, arg);
/// <exception cref="InvalidOperationException">issues with parsing <paramref name="src"/></exception>
/// <remarks>TODO use <see cref="MemoryStream(int)"/> and <see cref="MemoryStream.ToArray"/> instead of using <see cref="MemoryStream(byte[])"/> and keeping a reference to the array? --yoshi</remarks>
public static byte[] DecompressGzipFile(Stream src)

View File

@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Common
var stopwatch = Stopwatch.StartNew();
ThreadPool.QueueUserWorkItem(_=> {
initializeWork(path);
Console.WriteLine("GameDB load: " + stopwatch.Elapsed + " sec");
Util.DebugWriteLine("GameDB load: " + stopwatch.Elapsed + " sec");
});
}

View File

@ -30,7 +30,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
ThreadPool.QueueUserWorkItem(_ =>
{
instance = new BootGodDb(basePath);
Console.WriteLine("Bootgod DB load: " + stopwatch.Elapsed + " sec");
Util.DebugWriteLine("Bootgod DB load: " + stopwatch.Elapsed + " sec");
acquire.Set();
});
}