diff --git a/libretro-common/include/compat/msvc.h b/libretro-common/include/compat/msvc.h index f2b9fafe92..5782f9e36a 100644 --- a/libretro-common/include/compat/msvc.h +++ b/libretro-common/include/compat/msvc.h @@ -30,6 +30,9 @@ #ifndef snprintf #define snprintf _snprintf #endif +#ifndef vsnprintf +#define vsnprintf _vsnprintf +#endif #endif #undef UNICODE /* Do not bother with UNICODE at this time. */ diff --git a/runloop.h b/runloop.h index 4c8ddcf242..415f2003e9 100644 --- a/runloop.h +++ b/runloop.h @@ -344,6 +344,9 @@ int rarch_main_iterate(unsigned *sleep_ms); void rarch_main_msg_queue_push(const char *msg, unsigned prio, unsigned duration, bool flush); +void rarch_main_msg_queue_pushf(unsigned prio, unsigned duration, + bool flush, const char *fmt, ...); + void rarch_main_msg_queue_push_new(uint32_t hash, unsigned prio, unsigned duration, bool flush); diff --git a/runloop_msg.c b/runloop_msg.c index 7931fc5a83..25e0d66cff 100644 --- a/runloop_msg.c +++ b/runloop_msg.c @@ -89,6 +89,17 @@ void rarch_main_msg_queue_push(const char *msg, unsigned prio, unsigned duration } } +void rarch_main_msg_queue_pushf(unsigned prio, unsigned duration, + bool flush, const char *fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + va_end(ap); + rarch_main_msg_queue_push(buf, prio, duration, flush); +} + void rarch_main_msg_queue_free(void) { if (!g_msg_queue)