From: hizzlekizzle Date: Mon, 3 Aug 2020 13:37:13 +0000 (-0500) Subject: Merge pull request #440 from negativeExponent/log_interface X-Git-Tag: r24l~631 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=996dfb25c3a7ef8a485c3ce394a532cb0ee2e5c2;hp=f2556fe8b35a523a4dcf558865f89d7773d95a96;p=pcsx_rearmed.git Merge pull request #440 from negativeExponent/log_interface Log interface --- diff --git a/frontend/libretro.c b/frontend/libretro.c index 50392a9c..a8895d83 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -2885,3 +2885,17 @@ void SysPrintf(const char *fmt, ...) if (log_cb) log_cb(RETRO_LOG_INFO, "%s", msg); } + +/* Prints debug-level logs */ +void SysDLog(const char *fmt, ...) +{ + va_list list; + char msg[512]; + + va_start(list, fmt); + vsprintf(msg, fmt, list); + va_end(list); + + if (log_cb) + log_cb(RETRO_LOG_DEBUG, "%s", msg); +} diff --git a/libpcsxcore/lightrec/plugin.c b/libpcsxcore/lightrec/plugin.c index 79bf0215..9e3c0c74 100644 --- a/libpcsxcore/lightrec/plugin.c +++ b/libpcsxcore/lightrec/plugin.c @@ -549,7 +549,7 @@ static void lightrec_plugin_execute_block(void) } if ((psxRegs.cycle & ~0xfffffff) != old_cycle_counter) { - printf("RAM usage: Lightrec %u KiB, IR %u KiB, CODE %u KiB, " + SysDLog("RAM usage: Lightrec %u KiB, IR %u KiB, CODE %u KiB, " "MIPS %u KiB, TOTAL %u KiB, avg. IPI %f\n", lightrec_get_mem_usage(MEM_FOR_LIGHTREC) / 1024, lightrec_get_mem_usage(MEM_FOR_IR) / 1024, diff --git a/libpcsxcore/system.h b/libpcsxcore/system.h index c869fdf1..cd1814c2 100644 --- a/libpcsxcore/system.h +++ b/libpcsxcore/system.h @@ -35,6 +35,7 @@ void SysCloseLibrary(void *lib); // Closes Library void SysUpdate(); // Called on VBlank (to update i.e. pads) void SysRunGui(); // Returns to the Gui void SysClose(); // Close mem and plugins +void SysDLog(const char *fmt, ...); // Prints debug-level logs #ifdef __cplusplus }