Attempt to fix melonDS log line prefixing (resolves #4317)

doesn't properly handle the case of changing loglevel w/ an "unfinished"
message, but neither did the naive impl.
This commit is contained in:
YoshiRulz 2025-05-13 02:17:37 +10:00
parent 243bf80777
commit b5253317d0
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 13 additions and 2 deletions

View File

@ -12,6 +12,7 @@ using BizHawk.BizInvoke;
using BizHawk.Common;
using BizHawk.Common.IOExtensions;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Properties;
using BizHawk.Emulation.Cores.Waterbox;
@ -28,8 +29,18 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
private readonly LibMelonDS.LogCallback _logCallback;
private static void LogCallback(LibMelonDS.LogLevel level, string message)
=> Console.Write($"[{level}] {message}");
private bool loggingShouldInsertLevelNextCall = true;
private void LogCallback(LibMelonDS.LogLevel level, string message)
{
if (loggingShouldInsertLevelNextCall)
{
Console.Write($"[{level}] ");
loggingShouldInsertLevelNextCall = false;
}
Console.Write(message);
if (message.EndsWith('\n')) loggingShouldInsertLevelNextCall = true;
}
private readonly MelonDSGLTextureProvider _glTextureProvider;
private readonly IOpenGLProvider _openGLProvider;