libretro: Do SET_CORE_OPTIONS unconditionally

This commit is contained in:
Connor McLaughlin 2020-07-08 12:48:57 +10:00
parent 57cf40d1ae
commit 068b244303
2 changed files with 14 additions and 9 deletions

View File

@ -36,6 +36,7 @@ retro_input_state_t g_retro_input_state_callback;
static retro_log_callback s_libretro_log_callback = {};
static bool s_libretro_log_callback_valid = false;
static bool s_libretro_log_callback_registered = false;
static void LibretroLogCallback(void* pUserParam, const char* channelName, const char* functionName, LOGLEVEL level,
const char* message)
@ -64,8 +65,16 @@ void LibretroHostInterface::InitLogging()
{
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);
s_libretro_log_callback_registered = true;
}
}
bool LibretroHostInterface::Initialize()

View File

@ -121,16 +121,12 @@ RETRO_API size_t retro_get_memory_size(unsigned id)
RETRO_API void retro_set_environment(retro_environment_t f)
{
static bool core_options_set = false;
g_retro_environment_callback = f;
if (!core_options_set)
{
core_options_set = true;
g_libretro_host_interface.InitLogging();
if (!g_libretro_host_interface.SetCoreOptions())
Log_WarningPrintf("Failed to set core options, settings will not be changeable.");
}
if (!g_libretro_host_interface.SetCoreOptions())
Log_WarningPrintf("Failed to set core options, settings will not be changeable.");
g_libretro_host_interface.InitLogging();
}
RETRO_API void retro_set_video_refresh(retro_video_refresh_t f)