From 57c17d559f276fffd10146f17947d3c7c60ece2f Mon Sep 17 00:00:00 2001 From: zoltanvb <101990835+zoltanvb@users.noreply.github.com> Date: Mon, 19 Aug 2024 18:55:20 +0200 Subject: [PATCH] Use CLI shader path for shader dir init if present (#16196) If shader is given on command line, use it for directory init. Fixes #16181, shader cycle should now work using the dir of the shader passed to CLI. --- gfx/video_shader_parse.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index 71add020cf..18c421f3c6 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -2547,6 +2547,7 @@ static void video_shader_dir_init_shader( bool video_shader_remember_last_dir = settings->bools.video_shader_remember_last_dir; const char *last_shader_preset_dir = NULL; const char *last_shader_preset_file_name = NULL; + video_driver_state_t *video_st = video_state_get_ptr(); #if defined(HAVE_MENU) menu_handle_t *menu = (menu_handle_t*)menu_driver_data_; enum rarch_shader_type last_shader_preset_type = menu ? menu->last_shader_selection.preset_type : RARCH_SHADER_NONE; @@ -2572,6 +2573,18 @@ static void video_shader_dir_init_shader( show_hidden_files)) return; + /* Try directory of shader given as command line parameter */ + if (!string_is_empty(video_st->cli_shader_path)) + { + char cli_path[PATH_MAX_LENGTH]; + fill_pathname_basedir(cli_path, video_st->cli_shader_path, sizeof(cli_path)); + if (video_shader_dir_init_shader_internal( + video_shader_remember_last_dir, + dir_list, + cli_path, NULL, show_hidden_files)) + return; + } + /* Try video shaders directory */ if (!string_is_empty(directory_video_shader) && video_shader_dir_init_shader_internal(