Skip to content

Commit

Permalink
Set save redirect paths before set_environment (#15820)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored Oct 24, 2023
1 parent 7df3ca3 commit 06d5cd3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions runloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1996,8 +1996,9 @@ bool runloop_environment_cb(unsigned cmd, void *data)
break;

case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY:
RARCH_LOG("[Environ]: GET_SAVE_DIRECTORY.\n");
*(const char**)data = runloop_st->savefile_dir;
RARCH_LOG("[Environ]: SAVE_DIRECTORY: \"%s\".\n",
runloop_st->savefile_dir);
break;

case RETRO_ENVIRONMENT_GET_USERNAME:
Expand Down Expand Up @@ -4631,7 +4632,7 @@ bool runloop_event_init_core(
type, &runloop_st->current_core, NULL, NULL))
return false;
#ifdef HAVE_RUNAHEAD
/* remember last core type created, so creating a
/* Remember last core type created, so creating a
* secondary core will know what core type to use. */
runloop_st->last_core_type = type;
#endif
Expand Down Expand Up @@ -4690,7 +4691,7 @@ bool runloop_event_init_core(
settings, &runloop_st->fastmotion_override.current);

#ifdef HAVE_CHEEVOS
/* assume the core supports achievements unless it tells us otherwise */
/* Assume the core supports achievements unless it tells us otherwise */
rcheevos_set_support_cheevos(true);
#endif

Expand All @@ -4701,9 +4702,13 @@ bool runloop_event_init_core(
runloop_st->shader_delay_timer.timer_end = false; /* not expired */
#endif

/* reset video format to libretro's default */
/* Reset video format to libretro's default */
video_st->pix_fmt = RETRO_PIXEL_FORMAT_0RGB1555;

/* Set save redirection paths */
runloop_path_set_redirect(settings, old_savefile_dir, old_savestate_dir);

/* Set core environment */
runloop_st->current_core.retro_set_environment(runloop_environment_cb);

/* Load any input remap files
Expand All @@ -4720,9 +4725,6 @@ bool runloop_event_init_core(
config_load_remap(dir_input_remapping, &runloop_st->system);
#endif

/* Per-core saves: reset redirection paths */
runloop_path_set_redirect(settings, old_savefile_dir, old_savestate_dir);

video_st->frame_cache_data = NULL;

runloop_st->current_core.retro_init();
Expand Down

0 comments on commit 06d5cd3

Please sign in to comment.