From 605264f15d31c42b1fe546fd47a6ffb1301c03c8 Mon Sep 17 00:00:00 2001 From: sonninnos Date: Wed, 7 Jun 2023 15:20:18 +0300 Subject: [PATCH] One more environment fix --- libretro/libretro-core.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libretro/libretro-core.c b/libretro/libretro-core.c index 5af1074e..8d63c72f 100644 --- a/libretro/libretro-core.c +++ b/libretro/libretro-core.c @@ -652,7 +652,7 @@ static void retro_set_paths(void) string_is_empty(save_dir) ? retro_system_directory : save_dir, sizeof(retro_save_directory)); } - else + else if (!retro_save_directory) { /* Make retro_save_directory the same in case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY is not implemented by the frontend */ strlcpy(retro_save_directory, @@ -3229,11 +3229,8 @@ void retro_set_environment(retro_environment_t cb) { environ_cb = cb; - /* Must set these here for the dynamic cartridge option, - * and must set only once, since `retro_set_environment` - * is called multiple times, and save dir is wrong later.. */ - if (string_is_empty(retro_temp_directory)) - retro_set_paths(); + /* Must set these here for the dynamic cartridge option */ + retro_set_paths(); retro_set_core_options(); retro_set_inputs(); @@ -3241,6 +3238,9 @@ void retro_set_environment(retro_environment_t cb) bool support_no_game = true; environ_cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &support_no_game); + struct retro_core_options_update_display_callback update_display_callback = {retro_update_display}; + environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, &update_display_callback); + struct retro_led_interface led_interface; if (environ_cb(RETRO_ENVIRONMENT_GET_LED_INTERFACE, &led_interface)) if (led_interface.set_led_state && !led_state_cb) @@ -5259,9 +5259,6 @@ void retro_init(void) static struct retro_keyboard_callback keyboard_callback = {retro_keyboard_event}; environ_cb(RETRO_ENVIRONMENT_SET_KEYBOARD_CALLBACK, &keyboard_callback); - static struct retro_core_options_update_display_callback update_display_callback = {retro_update_display}; - environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_UPDATE_DISPLAY_CALLBACK, &update_display_callback); - bool achievements = true; environ_cb(RETRO_ENVIRONMENT_SET_SUPPORT_ACHIEVEMENTS, &achievements);