From c8fbde16d25691c5e0c71ebfcf869c5c92d79c9f Mon Sep 17 00:00:00 2001 From: Stephanie Gawroriski Date: Wed, 6 Dec 2023 01:13:57 +0000 Subject: [PATCH] Use partial message for libretro. --- nanocoat/frontend/libretro/boot.c | 9 +++++---- nanocoat/include/sjme/debug.h | 6 ++++-- nanocoat/src/debug.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/nanocoat/frontend/libretro/boot.c b/nanocoat/frontend/libretro/boot.c index 51b8c5fd1f..99c4de36ed 100644 --- a/nanocoat/frontend/libretro/boot.c +++ b/nanocoat/frontend/libretro/boot.c @@ -14,7 +14,8 @@ #include "3rdparty/libretro/libretro.h" #include "frontend/libretro/shared.h" -static sjme_jboolean sjme_libretro_danglingMessage(const char* message) +static sjme_jboolean sjme_libretro_danglingMessage(const char* fullMessage, + const char* partMessage) { struct retro_message retroMessage; struct retro_log_callback retroLogCallback; @@ -22,8 +23,8 @@ static sjme_jboolean sjme_libretro_danglingMessage(const char* message) if (sjme_libretro_envCallback != NULL) { /* Setup details. */ - retroMessage.frames = 120; - retroMessage.msg = message; + retroMessage.frames = 240; + retroMessage.msg = partMessage; /* Emit message. */ sjme_libretro_envCallback(RETRO_ENVIRONMENT_SET_MESSAGE, @@ -34,7 +35,7 @@ static sjme_jboolean sjme_libretro_danglingMessage(const char* message) if (true == sjme_libretro_envCallback( RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &retroLogCallback) && retroLogCallback.log != NULL) - retroLogCallback.log(RETRO_LOG_INFO, "%s", message); + retroLogCallback.log(RETRO_LOG_INFO, "%s", fullMessage); /* We handled it here, so SquirrelJME does not have to print it. */ return SJME_JNI_TRUE; diff --git a/nanocoat/include/sjme/debug.h b/nanocoat/include/sjme/debug.h index 353322ab37..bf04925f5c 100644 --- a/nanocoat/include/sjme/debug.h +++ b/nanocoat/include/sjme/debug.h @@ -154,12 +154,14 @@ void sjme_todoR(SJME_DEBUG_DECL_FILE_LINE_FUNC, /** * Emits a dangling reference message. * - * @param message The message to emit. + * @param fullMessage The message to emit. + * @param partMessage Partial message, without any prepend. * @return Return @c SJME_JNI_TRUE if the message is handled, otherwise * a standard @c fprintf to @c stderr will be used. * @since 2023/12/05 */ -typedef sjme_jboolean (*sjme_danglingMessageFunc)(const char* message); +typedef sjme_jboolean (*sjme_danglingMessageFunc)(const char* fullMessage, + const char* partMessage); /** The dangling message implementation to use. */ extern sjme_danglingMessageFunc sjme_danglingMessage; diff --git a/nanocoat/src/debug.c b/nanocoat/src/debug.c index 2ffcc02117..ad611be6b3 100644 --- a/nanocoat/src/debug.c +++ b/nanocoat/src/debug.c @@ -75,7 +75,7 @@ static void sjme_genericMessage(const char* file, int line, prefix, buf); /* First try to print to the frontend callback, if any. */ - if (sjme_danglingMessage == NULL || !sjme_danglingMessage(fullBuf)) + if (sjme_danglingMessage == NULL || !sjme_danglingMessage(fullBuf, buf)) fprintf(stderr, "%s\n", fullBuf); /* Make sure it gets written. */ -- 2.11.4.GIT