From 3ad780b52e34da593e44f2bfb5fe35e4331ed22c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 12 Jul 2020 00:41:09 +1000 Subject: [PATCH] libretro: Fix logging breaking when retro_set_environment called twice --- src/duckstation-libretro/libretro_host_interface.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/duckstation-libretro/libretro_host_interface.cpp b/src/duckstation-libretro/libretro_host_interface.cpp index d30d0eadf..299386241 100644 --- a/src/duckstation-libretro/libretro_host_interface.cpp +++ b/src/duckstation-libretro/libretro_host_interface.cpp @@ -63,13 +63,12 @@ LibretroHostInterface::~LibretroHostInterface() void LibretroHostInterface::InitLogging() { + if (s_libretro_log_callback_registered) + return; + s_libretro_log_callback_valid = g_retro_environment_callback(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &s_libretro_log_callback); - if (s_libretro_log_callback_registered) - { - Log::UnregisterCallback(LibretroLogCallback, nullptr); - s_libretro_log_callback_registered = false; - } + if (s_libretro_log_callback_valid) { Log::RegisterCallback(LibretroLogCallback, nullptr);