From a9c9d0a5687014784e2d2330fc6849ae251b85d4 Mon Sep 17 00:00:00 2001 From: zoltanvb Date: Sat, 3 Feb 2024 18:40:27 +0100 Subject: [PATCH] Use CLI shader path for shader dir init if present 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 744cc24ce0ce..9d4b5bb82a00 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -2555,6 +2555,7 @@ static void video_shader_dir_init_shader( #else enum rarch_shader_type last_shader_preset_type = RARCH_SHADER_NONE; #endif + video_driver_state_t *video_st = video_state_get_ptr(); /* Always free existing shader list */ video_shader_dir_free_shader(dir_list, @@ -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(