mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Add RGUI actions for Softfilter directory path and Softfilter selection -
maister - test if this works - it doesn't here on my end and keeps saying that the example softfilter (dark.c) has the wrong color format)
This commit is contained in:
parent
b01754e63b
commit
6bdd5cf6ec
@ -340,6 +340,8 @@ static const char *default_shader_dir = ":/shaders_glsl/";
|
||||
static const char *default_shader_dir = NULL;
|
||||
#endif
|
||||
|
||||
static const char *default_filter_dir = NULL;
|
||||
|
||||
#if defined(__QNX__)
|
||||
static const char *default_config_path = "app/native/retroarch.cfg";
|
||||
#else
|
||||
|
@ -92,6 +92,7 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
#if defined(GEKKO) || defined(__CELLOS_LV2__)
|
||||
file_list_push(rgui->selection_buf, "Screen Resolution", RGUI_SETTINGS_VIDEO_RESOLUTION, 0);
|
||||
#endif
|
||||
file_list_push(rgui->selection_buf, "Soft Filter", RGUI_SETTINGS_VIDEO_SOFTFILTER, 0);
|
||||
#if defined(__CELLOS_LV2__)
|
||||
file_list_push(rgui->selection_buf, "PAL60 Mode", RGUI_SETTINGS_VIDEO_PAL60, 0);
|
||||
#endif
|
||||
@ -284,6 +285,9 @@ static void menu_common_entries_init(void *data, unsigned menu_type)
|
||||
#endif
|
||||
file_list_push(rgui->selection_buf, "Core Directory", RGUI_LIBRETRO_DIR_PATH, 0);
|
||||
file_list_push(rgui->selection_buf, "Core Info Directory", RGUI_LIBRETRO_INFO_DIR_PATH, 0);
|
||||
#ifdef HAVE_DYLIB
|
||||
file_list_push(rgui->selection_buf, "Filter Directory", RGUI_FILTER_DIR_PATH, 0);
|
||||
#endif
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
file_list_push(rgui->selection_buf, "Shader Directory", RGUI_SHADER_DIR_PATH, 0);
|
||||
#endif
|
||||
@ -577,6 +581,7 @@ static int menu_settings_iterate(void *data, unsigned action)
|
||||
if (rgui->need_refresh && !(menu_type == RGUI_FILE_DIRECTORY ||
|
||||
menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS||
|
||||
menu_type_is(menu_type) == RGUI_FILE_DIRECTORY ||
|
||||
menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER ||
|
||||
menu_type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
||||
menu_type == RGUI_SETTINGS_CORE ||
|
||||
menu_type == RGUI_SETTINGS_CONFIG ||
|
||||
@ -914,6 +919,8 @@ static void menu_parse_and_resolve(void *data, unsigned menu_type)
|
||||
exts = "cgp|glslp";
|
||||
else if (menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS)
|
||||
exts = "cg|glsl";
|
||||
else if (menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER)
|
||||
exts = "so";
|
||||
else if (menu_type == RGUI_SETTINGS_OVERLAY_PRESET)
|
||||
exts = "cfg";
|
||||
else if (menu_type_is(menu_type) == RGUI_FILE_DIRECTORY)
|
||||
@ -1204,6 +1211,7 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
menu_type_is(type) == RGUI_SETTINGS_SHADER_OPTIONS ||
|
||||
menu_type_is(type) == RGUI_FILE_DIRECTORY ||
|
||||
type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
||||
type == RGUI_SETTINGS_VIDEO_SOFTFILTER ||
|
||||
type == RGUI_SETTINGS_CORE ||
|
||||
type == RGUI_SETTINGS_CONFIG ||
|
||||
type == RGUI_SETTINGS_DISK_APPEND ||
|
||||
@ -1350,6 +1358,15 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
||||
}
|
||||
#endif
|
||||
else if (menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER)
|
||||
{
|
||||
fill_pathname_join(g_settings.video.filter_path, dir, path, sizeof(g_settings.video.filter_path));
|
||||
#ifdef HAVE_DYLIB
|
||||
rarch_deinit_filter();
|
||||
rarch_init_filter(g_extern.system.pix_fmt);
|
||||
#endif
|
||||
menu_flush_stack_type(rgui, RGUI_SETTINGS_VIDEO_OPTIONS);
|
||||
}
|
||||
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
||||
{
|
||||
strlcpy(g_extern.savestate_dir, dir, sizeof(g_extern.savestate_dir));
|
||||
@ -1379,6 +1396,11 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
strlcpy(g_settings.video.shader_dir, dir, sizeof(g_settings.video.shader_dir));
|
||||
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
||||
}
|
||||
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
||||
{
|
||||
strlcpy(g_settings.video.filter_dir, dir, sizeof(g_settings.video.filter_dir));
|
||||
menu_flush_stack_type(rgui, RGUI_SETTINGS_PATH_OPTIONS);
|
||||
}
|
||||
else if (menu_type == RGUI_SYSTEM_DIR_PATH)
|
||||
{
|
||||
strlcpy(g_settings.system_directory, dir, sizeof(g_settings.system_directory));
|
||||
@ -1454,6 +1476,7 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
menu_type_is(menu_type) == RGUI_SETTINGS_SHADER_OPTIONS ||
|
||||
menu_type_is(menu_type) == RGUI_FILE_DIRECTORY ||
|
||||
menu_type == RGUI_SETTINGS_OVERLAY_PRESET ||
|
||||
menu_type == RGUI_SETTINGS_VIDEO_SOFTFILTER ||
|
||||
menu_type == RGUI_SETTINGS_DEFERRED_CORE ||
|
||||
menu_type == RGUI_SETTINGS_CORE ||
|
||||
menu_type == RGUI_SETTINGS_CONFIG ||
|
||||
|
@ -436,6 +436,8 @@ static void lakka_render(void *data)
|
||||
#endif
|
||||
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
||||
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
||||
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
@ -352,6 +352,8 @@ static void rgui_render(void *data)
|
||||
#endif
|
||||
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
||||
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
||||
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
@ -210,6 +210,8 @@ static void rmenu_render(void *data)
|
||||
#endif
|
||||
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
||||
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
||||
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
@ -462,6 +462,8 @@ static void rmenu_xui_render(void *data)
|
||||
#endif
|
||||
else if (menu_type == RGUI_SHADER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SHADER DIR %s", dir);
|
||||
else if (menu_type == RGUI_FILTER_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "FILTER DIR %s", dir);
|
||||
else if (menu_type == RGUI_SAVESTATE_DIR_PATH)
|
||||
snprintf(title, sizeof(title), "SAVESTATE DIR %s", dir);
|
||||
#ifdef HAVE_DYNAMIC
|
||||
|
@ -88,6 +88,7 @@ typedef enum
|
||||
RGUI_SETTINGS_VIDEO_CROP_OVERSCAN,
|
||||
RGUI_SETTINGS_VIDEO_REFRESH_RATE_AUTO,
|
||||
RGUI_SETTINGS_VIDEO_MONITOR_INDEX,
|
||||
RGUI_SETTINGS_VIDEO_SOFTFILTER,
|
||||
RGUI_SETTINGS_VIDEO_OPTIONS_LAST,
|
||||
RGUI_SETTINGS_FONT_OPTIONS,
|
||||
RGUI_SETTINGS_FONT_ENABLE,
|
||||
@ -150,6 +151,7 @@ typedef enum
|
||||
RGUI_SETTINGS_PAUSE_IF_WINDOW_FOCUS_LOST,
|
||||
RGUI_SCREENSHOT_DIR_PATH,
|
||||
RGUI_BROWSER_DIR_PATH,
|
||||
RGUI_FILTER_DIR_PATH,
|
||||
RGUI_SHADER_DIR_PATH,
|
||||
RGUI_SAVESTATE_DIR_PATH,
|
||||
RGUI_SAVEFILE_DIR_PATH,
|
||||
|
@ -126,6 +126,7 @@ unsigned menu_type_is(unsigned type)
|
||||
|
||||
type_found = type == RGUI_BROWSER_DIR_PATH ||
|
||||
type == RGUI_SHADER_DIR_PATH ||
|
||||
type == RGUI_FILTER_DIR_PATH ||
|
||||
type == RGUI_SAVESTATE_DIR_PATH ||
|
||||
type == RGUI_LIBRETRO_DIR_PATH ||
|
||||
type == RGUI_LIBRETRO_INFO_DIR_PATH ||
|
||||
@ -773,6 +774,22 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case RGUI_SETTINGS_VIDEO_SOFTFILTER:
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_OK:
|
||||
file_list_push(rgui->menu_stack, g_settings.video.filter_dir, setting, rgui->selection_ptr);
|
||||
menu_clear_navigation(rgui);
|
||||
rgui->need_refresh = true;
|
||||
break;
|
||||
case RGUI_ACTION_START:
|
||||
rarch_deinit_filter();
|
||||
strlcpy(g_settings.video.filter_path, "", sizeof(g_settings.video.filter_path));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RGUI_SETTINGS_OVERLAY_OPACITY:
|
||||
{
|
||||
@ -1186,6 +1203,10 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
if (action == RGUI_ACTION_START)
|
||||
*g_settings.rgui_config_directory = '\0';
|
||||
break;
|
||||
case RGUI_FILTER_DIR_PATH:
|
||||
if (action == RGUI_ACTION_START)
|
||||
*g_settings.video.filter_dir = '\0';
|
||||
break;
|
||||
case RGUI_SHADER_DIR_PATH:
|
||||
if (action == RGUI_ACTION_START)
|
||||
*g_settings.video.shader_dir = '\0';
|
||||
@ -2162,6 +2183,9 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
|
||||
case RGUI_CONFIG_DIR_PATH:
|
||||
strlcpy(type_str, *g_settings.rgui_config_directory ? g_settings.rgui_config_directory : "<default>", type_str_size);
|
||||
break;
|
||||
case RGUI_FILTER_DIR_PATH:
|
||||
strlcpy(type_str, *g_settings.video.filter_dir ? g_settings.video.filter_dir : "<default>", type_str_size);
|
||||
break;
|
||||
case RGUI_SHADER_DIR_PATH:
|
||||
strlcpy(type_str, *g_settings.video.shader_dir ? g_settings.video.shader_dir : "<default>", type_str_size);
|
||||
break;
|
||||
@ -2215,6 +2239,9 @@ void menu_set_settings_label(char *type_str, size_t type_str_size, unsigned *w,
|
||||
case RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL:
|
||||
strlcpy(type_str, "...", type_str_size);
|
||||
break;
|
||||
case RGUI_SETTINGS_VIDEO_SOFTFILTER:
|
||||
strlcpy(type_str, path_basename(g_settings.video.filter_path), type_str_size);
|
||||
break;
|
||||
#ifdef HAVE_OVERLAY
|
||||
case RGUI_SETTINGS_OVERLAY_PRESET:
|
||||
strlcpy(type_str, path_basename(g_settings.input.overlay), type_str_size);
|
||||
|
@ -160,6 +160,7 @@ struct settings
|
||||
float refresh_rate;
|
||||
bool threaded;
|
||||
|
||||
char filter_dir[PATH_MAX];
|
||||
char shader_dir[PATH_MAX];
|
||||
|
||||
char font_path[PATH_MAX];
|
||||
@ -607,6 +608,12 @@ struct global
|
||||
size_t ptr;
|
||||
} shader_dir;
|
||||
|
||||
struct
|
||||
{
|
||||
struct string_list *list;
|
||||
size_t ptr;
|
||||
} filter_dir;
|
||||
|
||||
char sha256[64 + 1];
|
||||
|
||||
cheat_manager_t *cheat;
|
||||
|
14
gfx/filter.c
14
gfx/filter.c
@ -116,8 +116,18 @@ rarch_softfilter_t *rarch_softfilter_new(const char *filter_path,
|
||||
|
||||
// Simple assumptions.
|
||||
filt->pix_fmt = in_pixel_format;
|
||||
unsigned input_fmt = in_pixel_format == RETRO_PIXEL_FORMAT_XRGB8888 ?
|
||||
SOFTFILTER_FMT_XRGB8888 : SOFTFILTER_FMT_RGB565;
|
||||
unsigned input_fmt;
|
||||
switch (in_pixel_format)
|
||||
{
|
||||
case RETRO_PIXEL_FORMAT_XRGB8888:
|
||||
input_fmt = SOFTFILTER_FMT_XRGB8888;
|
||||
break;
|
||||
case RETRO_PIXEL_FORMAT_RGB565:
|
||||
default:
|
||||
input_fmt = SOFTFILTER_FMT_RGB565;
|
||||
break;
|
||||
}
|
||||
|
||||
unsigned input_fmts = filt->impl->query_input_formats();
|
||||
if (!(input_fmt & input_fmts))
|
||||
{
|
||||
|
@ -392,6 +392,7 @@ void config_set_defaults(void)
|
||||
*g_settings.content_directory = '\0';
|
||||
*g_settings.video.shader_path = '\0';
|
||||
*g_settings.video.shader_dir = '\0';
|
||||
*g_settings.video.filter_dir = '\0';
|
||||
#ifdef HAVE_MENU
|
||||
*g_settings.rgui_content_directory = '\0';
|
||||
*g_settings.rgui_config_directory = '\0';
|
||||
@ -442,6 +443,9 @@ void config_set_defaults(void)
|
||||
if (default_shader_dir)
|
||||
fill_pathname_expand_special(g_settings.video.shader_dir, default_shader_dir, sizeof(g_settings.video.shader_dir));
|
||||
|
||||
if (default_filter_dir)
|
||||
fill_pathname_expand_special(g_settings.video.filter_dir, default_filter_dir, sizeof(g_settings.video.filter_dir));
|
||||
|
||||
if (default_libretro_path && !g_extern.has_set_libretro)
|
||||
fill_pathname_expand_special(g_settings.libretro, default_libretro_path, sizeof(g_settings.libretro));
|
||||
|
||||
@ -875,6 +879,10 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||
if (!strcmp(g_settings.video.shader_dir, "default"))
|
||||
*g_settings.video.shader_dir = '\0';
|
||||
|
||||
CONFIG_GET_PATH(video.filter_dir, "video_filter_dir");
|
||||
if (!strcmp(g_settings.video.filter_dir, "default"))
|
||||
*g_settings.video.filter_dir = '\0';
|
||||
|
||||
CONFIG_GET_FLOAT(input.axis_threshold, "input_axis_threshold");
|
||||
CONFIG_GET_BOOL(input.netplay_client_swap_input, "netplay_client_swap_input");
|
||||
|
||||
@ -1312,6 +1320,7 @@ bool config_save_file(const char *path)
|
||||
config_set_path(conf, "savefile_directory", *g_extern.savefile_dir ? g_extern.savefile_dir : "default");
|
||||
config_set_path(conf, "savestate_directory", *g_extern.savestate_dir ? g_extern.savestate_dir : "default");
|
||||
config_set_path(conf, "video_shader_dir", *g_settings.video.shader_dir ? g_settings.video.shader_dir : "default");
|
||||
config_set_path(conf, "video_filter_dir", *g_settings.video.filter_dir ? g_settings.video.filter_dir : "default");
|
||||
|
||||
config_set_path(conf, "content_directory", *g_settings.content_directory ? g_settings.content_directory : "default");
|
||||
#ifdef HAVE_MENU
|
||||
|
Loading…
x
Reference in New Issue
Block a user