diff --git a/gfx/video_filters/epx.c b/gfx/video_filters/epx.c index 3bc5074e3c..ac5722f7e7 100644 --- a/gfx/video_filters/epx.c +++ b/gfx/video_filters/epx.c @@ -15,6 +15,7 @@ */ #include "softfilter.h" +#include #include #ifdef RARCH_INTERNAL @@ -75,7 +76,7 @@ static void *epx_generic_create(const struct softfilter_config *config, return NULL; filt->workers = (struct softfilter_thread_data*) calloc(threads, sizeof(struct softfilter_thread_data)); - filt->threads = threads; + filt->threads = 1; filt->in_fmt = in_fmt; if (!filt->workers) { @@ -104,15 +105,19 @@ static void epx_generic_destroy(void *data) free(filt); } -static void EPX_16 (int width, int height, +static void EPX_16(int width, int height, int first, int last, - uint16_t *src, int src_stride, uint16_t *dst, int dst_stride) + uint16_t *src, unsigned src_stride, uint16_t *dst, + unsigned dst_stride) { uint16_t colorX, colorA, colorB, colorC, colorD; - uint16_t *sP, *uP, *lP; - uint32_t *dP1, *dP2; + uint16_t *sP = NULL, *uP = NULL, *lP = NULL; + uint32_t *dP1 = NULL, *dP2 = NULL; int w, prevline; + if (!src || !dst) + return; + prevline = (first) ? 0 : src_stride; height -= 2; @@ -125,9 +130,9 @@ static void EPX_16 (int width, int height, /* top edge */ sP = (uint16_t *)(src - prevline); - lP = (uint16_t *) (src + src_stride); - dP1 = (uint32_t *) dst; - dP2 = (uint32_t *) (dst + dst_stride); + lP = (uint16_t *)(src + src_stride); + dP1 = (uint32_t *)(dst); + dP2 = (uint32_t *)(dst + dst_stride); // left edge diff --git a/menu/menu_entries_cbs.c b/menu/menu_entries_cbs.c index 57276f73e4..36ed4c2b55 100644 --- a/menu/menu_entries_cbs.c +++ b/menu/menu_entries_cbs.c @@ -455,13 +455,6 @@ static int action_ok_cheat_file(const char *path, if (!menu) return -1; - if (!path_file_exists(g_settings.cheat_database)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, "Cheat Directory doesn't exist or cannot be accessed.\n", 1, 180); - return -1; - } - return menu_list_push_stack_refresh( menu->menu_list, g_settings.cheat_database, @@ -471,25 +464,21 @@ static int action_ok_cheat_file(const char *path, static int action_ok_audio_dsp_plugin(const char *path, const char *label, unsigned type, size_t idx) { - if (!path_file_exists(path)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, "Audio Filter Directory doesn't exist or cannot be accessed.\n", 1, 180); - return -1; - } return 0; } static int action_ok_video_filter(const char *path, const char *label, unsigned type, size_t idx) { - if (!path_file_exists(path)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, "Video Filter Directory doesn't exist or cannot be accessed.\n", 1, 180); + menu_handle_t *menu = menu_driver_resolve(); + if (!menu) return -1; - } - return 0; + + return menu_list_push_stack_refresh( + menu->menu_list, + g_settings.video.filter_dir, + "deferred_video_filter", + 0, idx); } static int action_ok_remap_file(const char *path, @@ -499,12 +488,6 @@ static int action_ok_remap_file(const char *path, if (!menu) return -1; - if (!path_file_exists(g_settings.input_remapping_directory)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, "Remapping Directory doesn't exist or cannot be accessed.\n", 1, 180); - return -1; - } return menu_list_push_stack_refresh( menu->menu_list, g_settings.input_remapping_directory, @@ -518,12 +501,6 @@ static int action_ok_core_list(const char *path, if (!menu) return -1; - if (!path_file_exists(g_settings.libretro_directory)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, "Core Directory doesn't exist or cannot be accessed.\n", 1, 180); - return -1; - } return menu_list_push_stack_refresh( menu->menu_list, g_settings.libretro_directory, @@ -553,6 +530,33 @@ static int action_ok_remap_file_load(const char *path, return 0; } +static int action_ok_video_filter_file_load(const char *path, + const char *label, unsigned type, size_t idx) +{ + const char *menu_path = NULL; + char filter_path[PATH_MAX_LENGTH]; + menu_handle_t *menu = menu_driver_resolve(); + if (!menu) + return -1; + + (void)filter_path; + (void)menu_path; + + menu_list_get_last_stack(menu->menu_list, &menu_path, NULL, + NULL); + + fill_pathname_join(filter_path, menu_path, path, sizeof(filter_path)); + + strlcpy(g_settings.video.softfilter_plugin, filter_path, + sizeof(g_settings.video.softfilter_plugin)); + + rarch_main_command(RARCH_CMD_REINIT); + + menu_list_flush_stack_by_needle(menu->menu_list, "video_options"); + + return 0; +} + static int action_ok_cheat_file_load(const char *path, const char *label, unsigned type, size_t idx) { @@ -1358,14 +1362,6 @@ static int action_ok_database_manager_list(const char *path, fill_pathname_join(rdb_path, g_settings.content_database, path, sizeof(rdb_path)); - if (!path_file_exists(rdb_path)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, - "Database Directory doesn't exist or cannot be accessed.\n", - 1, 180); - return -1; - } return menu_list_push_stack_refresh( menu->menu_list, rdb_path, @@ -1385,14 +1381,6 @@ static int action_ok_cursor_manager_list(const char *path, fill_pathname_join(cursor_path, g_settings.cursor_directory, path, sizeof(cursor_path)); - if (!path_file_exists(cursor_path)) - { - msg_queue_clear(g_extern.msg_queue); - msg_queue_push(g_extern.msg_queue, - "Cursor Directory doesn't exist or cannot be accessed.\n", - 1, 180); - return -1; - } return menu_list_push_stack_refresh( menu->menu_list, cursor_path, @@ -3228,6 +3216,10 @@ static int deferred_push_video_options(void *data, void *userdata, #endif menu_list_push(list, "Custom Ratio", "", MENU_SETTINGS_CUSTOM_VIEWPORT, 0); +#ifndef HAVE_FILTERS_BUILTIN + menu_list_push(list, "Video Filter", "video_filter", + 0, 0); +#endif if (driver.menu_ctx && driver.menu_ctx->populate_entries) driver.menu_ctx->populate_entries(path, label, type); @@ -5580,9 +5572,11 @@ static void menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, case MENU_FILE_FONT: case MENU_FILE_OVERLAY: case MENU_FILE_AUDIOFILTER: - case MENU_FILE_VIDEOFILTER: cbs->action_ok = action_ok_set_path; break; + case MENU_FILE_VIDEOFILTER: + cbs->action_ok = action_ok_video_filter_file_load; + break; #ifdef HAVE_COMPRESSION case MENU_FILE_IN_CARCHIVE: #endif @@ -5933,6 +5927,8 @@ static void menu_entries_cbs_init_bind_deferred_push(menu_file_list_cbs_t *cbs, cbs->action_deferred_push = deferred_push_category; else if (!strcmp(label, "deferred_core_list")) cbs->action_deferred_push = deferred_push_core_list_deferred; + else if (!strcmp(label, "deferred_video_filter")) + cbs->action_deferred_push = deferred_push_video_filter; else if (!strcmp(label, "deferred_database_manager_list")) cbs->action_deferred_push = deferred_push_database_manager_list_deferred; else if (!strcmp(label, "deferred_cursor_manager_list")) diff --git a/retroarch.c b/retroarch.c index 8027d93ffd..a1e5fa9653 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2255,9 +2255,8 @@ bool rarch_main_command(unsigned cmd) driver.input->poll(driver.input_data); #ifdef HAVE_MENU - if (g_extern.is_menu) { + if (g_extern.is_menu) rarch_main_command(RARCH_CMD_VIDEO_SET_BLOCKING_STATE); - } #endif break; case RARCH_CMD_CHEATS_DEINIT: diff --git a/settings_data.c b/settings_data.c index d6b4b2e230..3983777cce 100644 --- a/settings_data.c +++ b/settings_data.c @@ -4274,21 +4274,6 @@ static bool setting_data_append_list_video_options( general_write_handler, general_read_handler); -#ifndef HAVE_FILTERS_BUILTIN - CONFIG_PATH( - g_settings.video.softfilter_plugin, - "video_filter", - "Software filter", - g_settings.video.filter_dir, - group_info.name, - subgroup_info.name, - general_write_handler, - general_read_handler); - settings_list_current_add_values(list, list_info, "filt"); - settings_list_current_add_cmd(list, list_info, RARCH_CMD_REINIT); - settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); -#endif - #if defined(_XBOX1) || defined(HW_RVL) CONFIG_BOOL( g_extern.console.softfilter_enable,