mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 07:59:42 +00:00
Refactor a bunch of menu code - menu 'settings' can now be implemented
per-menu context
This commit is contained in:
parent
690ec2a1c4
commit
3d8d807e6b
6
Makefile
6
Makefile
@ -96,14 +96,18 @@ ifneq ($(findstring Linux,$(OS)),)
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/menu_settings.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/backend/menu_common_backend.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
DEFINES += -DHAVE_MENU
|
||||
HAVE_MENU_COMMON = 1
|
||||
ifeq ($(HAVE_LAKKA), 1)
|
||||
OBJ += frontend/menu/disp/lakka.o
|
||||
DEFINES += -DHAVE_LAKKA
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o frontend/menu/backend/menu_common_settings.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_THREADS), 1)
|
||||
OBJ += autosave.o thread.o gfx/video_thread_wrapper.o audio/thread_wrapper.o
|
||||
|
@ -71,7 +71,12 @@ endif
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_MENU -DHAVE_RGUI
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/disp/menu_common_backend.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
HAVE_MENU_COMMON = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o frontend/menu/backend/menu_common_settings.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
|
@ -115,7 +115,12 @@ JLIBS =
|
||||
|
||||
ifeq ($(HAVE_RGUI), 1)
|
||||
DEFINES += -DHAVE_RGUI -DHAVE_MENU
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_common.o frontend/menu/menu_settings.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/backend/menu_common_backend.o frontend/menu/history.o
|
||||
OBJ += frontend/menu/menu_input_line_cb.o frontend/menu/menu_navigation.o frontend/menu/file_list.o frontend/menu/disp/rgui.o frontend/menu/history.o
|
||||
HAVE_MENU_COMMON = 1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_MENU_COMMON), 1)
|
||||
OBJ += frontend/menu/backend/menu_common_backend.o frontend/menu/backend/menu_common_settings.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_SDL), 1)
|
||||
|
10
driver.h
10
driver.h
@ -389,8 +389,14 @@ typedef struct video_driver
|
||||
|
||||
typedef struct menu_ctx_driver_backend
|
||||
{
|
||||
void (*entries_init)(void*, unsigned);
|
||||
int (*iterate)(void *, unsigned);
|
||||
void (*entries_init)(void*, unsigned);
|
||||
int (*iterate)(void *, unsigned);
|
||||
void (*shader_manager_init)(void *);
|
||||
void (*shader_manager_get_str)(void *, char *, size_t, unsigned);
|
||||
void (*shader_manager_set_preset)(void *, unsigned, const char*);
|
||||
void (*shader_manager_save_preset)(void *, const char *, bool);
|
||||
unsigned (*shader_manager_get_type)(void *);
|
||||
int (*shader_manager_toggle_setting)(void *, unsigned, unsigned);
|
||||
const char *ident;
|
||||
} menu_ctx_driver_backend_t;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include "../menu_common.h"
|
||||
#include "menu_common_backend.h"
|
||||
#include "../menu_navigation.h"
|
||||
|
||||
#include "../../../gfx/gfx_common.h"
|
||||
@ -1233,7 +1233,8 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
{
|
||||
char shader_path[PATH_MAX];
|
||||
fill_pathname_join(shader_path, dir, path, sizeof(shader_path));
|
||||
shader_manager_set_preset(&rgui->shader, gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_set_preset)
|
||||
driver.menu_ctx->backend->shader_manager_set_preset(&rgui->shader, gfx_shader_parse_type(shader_path, RARCH_SHADER_NONE),
|
||||
shader_path);
|
||||
}
|
||||
else
|
||||
@ -1495,9 +1496,394 @@ static int menu_common_iterate(void *data, unsigned action)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
static void menu_common_shader_manager_init(void *data)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
memset(&rgui->shader, 0, sizeof(rgui->shader));
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
const char *config_path = NULL;
|
||||
if (*g_extern.core_specific_config_path && g_settings.core_specific_config)
|
||||
config_path = g_extern.core_specific_config_path;
|
||||
else if (*g_extern.config_path)
|
||||
config_path = g_extern.config_path;
|
||||
|
||||
// In a multi-config setting, we can't have conflicts on rgui.cgp/rgui.glslp.
|
||||
if (config_path)
|
||||
{
|
||||
fill_pathname_base(rgui->default_glslp, config_path, sizeof(rgui->default_glslp));
|
||||
path_remove_extension(rgui->default_glslp);
|
||||
strlcat(rgui->default_glslp, ".glslp", sizeof(rgui->default_glslp));
|
||||
fill_pathname_base(rgui->default_cgp, config_path, sizeof(rgui->default_cgp));
|
||||
path_remove_extension(rgui->default_cgp);
|
||||
strlcat(rgui->default_cgp, ".cgp", sizeof(rgui->default_cgp));
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(rgui->default_glslp, "rgui.glslp", sizeof(rgui->default_glslp));
|
||||
strlcpy(rgui->default_cgp, "rgui.cgp", sizeof(rgui->default_cgp));
|
||||
}
|
||||
|
||||
char cgp_path[PATH_MAX];
|
||||
|
||||
const char *ext = path_get_extension(g_settings.video.shader_path);
|
||||
if (strcmp(ext, "glslp") == 0 || strcmp(ext, "cgp") == 0)
|
||||
{
|
||||
conf = config_file_new(g_settings.video.shader_path);
|
||||
if (conf)
|
||||
{
|
||||
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
||||
gfx_shader_resolve_relative(&rgui->shader, g_settings.video.shader_path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
else if (strcmp(ext, "glsl") == 0 || strcmp(ext, "cg") == 0)
|
||||
{
|
||||
strlcpy(rgui->shader.pass[0].source.cg, g_settings.video.shader_path,
|
||||
sizeof(rgui->shader.pass[0].source.cg));
|
||||
rgui->shader.passes = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *shader_dir = *g_settings.video.shader_dir ?
|
||||
g_settings.video.shader_dir : g_settings.system_directory;
|
||||
|
||||
fill_pathname_join(cgp_path, shader_dir, "rgui.glslp", sizeof(cgp_path));
|
||||
conf = config_file_new(cgp_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(cgp_path, shader_dir, "rgui.cgp", sizeof(cgp_path));
|
||||
conf = config_file_new(cgp_path);
|
||||
}
|
||||
|
||||
if (conf)
|
||||
{
|
||||
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
||||
gfx_shader_resolve_relative(&rgui->shader, cgp_path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_common_shader_manager_set_preset(void *data, unsigned type, const char *path)
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
RARCH_LOG("Setting RGUI shader: %s.\n", path ? path : "N/A (stock)");
|
||||
bool ret = video_set_shader_func((enum rarch_shader_type)type, path);
|
||||
if (ret)
|
||||
{
|
||||
// Makes sure that we use RGUI CGP shader on driver reinit.
|
||||
// Only do this when the cgp actually works to avoid potential errors.
|
||||
strlcpy(g_settings.video.shader_path, path ? path : "",
|
||||
sizeof(g_settings.video.shader_path));
|
||||
g_settings.video.shader_enable = true;
|
||||
|
||||
if (path && shader)
|
||||
{
|
||||
// Load stored CGP into RGUI menu on success.
|
||||
// Used when a preset is directly loaded.
|
||||
// No point in updating when the CGP was created from RGUI itself.
|
||||
config_file_t *conf = config_file_new(path);
|
||||
if (conf)
|
||||
{
|
||||
gfx_shader_read_conf_cgp(conf, shader);
|
||||
gfx_shader_resolve_relative(shader, path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
|
||||
rgui->need_refresh = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR("Setting RGUI CGP failed.\n");
|
||||
g_settings.video.shader_enable = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_common_shader_manager_get_str(void *data, char *type_str, size_t type_str_size, unsigned type)
|
||||
{
|
||||
struct gfx_shader *shader = (struct gfx_shader*)data;
|
||||
if (type == RGUI_SETTINGS_SHADER_APPLY)
|
||||
*type_str = '\0';
|
||||
else if (type == RGUI_SETTINGS_SHADER_PASSES)
|
||||
snprintf(type_str, type_str_size, "%u", shader->passes);
|
||||
else
|
||||
{
|
||||
unsigned pass = (type - RGUI_SETTINGS_SHADER_0) / 3;
|
||||
switch ((type - RGUI_SETTINGS_SHADER_0) % 3)
|
||||
{
|
||||
case 0:
|
||||
if (*shader->pass[pass].source.cg)
|
||||
fill_pathname_base(type_str,
|
||||
shader->pass[pass].source.cg, type_str_size);
|
||||
else
|
||||
strlcpy(type_str, "N/A", type_str_size);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
switch (shader->pass[pass].filter)
|
||||
{
|
||||
case RARCH_FILTER_LINEAR:
|
||||
strlcpy(type_str, "Linear", type_str_size);
|
||||
break;
|
||||
|
||||
case RARCH_FILTER_NEAREST:
|
||||
strlcpy(type_str, "Nearest", type_str_size);
|
||||
break;
|
||||
|
||||
case RARCH_FILTER_UNSPEC:
|
||||
strlcpy(type_str, "Don't care", type_str_size);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
unsigned scale = shader->pass[pass].fbo.scale_x;
|
||||
if (!scale)
|
||||
strlcpy(type_str, "Don't care", type_str_size);
|
||||
else
|
||||
snprintf(type_str, type_str_size, "%ux", scale);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void menu_common_shader_manager_save_preset(void *data, const char *basename, bool apply)
|
||||
{
|
||||
unsigned type;
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_type)
|
||||
type = driver.menu_ctx->backend->shader_manager_get_type(&rgui->shader);
|
||||
else
|
||||
type = RARCH_SHADER_NONE;
|
||||
|
||||
if (type == RARCH_SHADER_NONE)
|
||||
return;
|
||||
|
||||
const char *conf_path = NULL;
|
||||
char buffer[PATH_MAX];
|
||||
if (basename)
|
||||
{
|
||||
strlcpy(buffer, basename, sizeof(buffer));
|
||||
// Append extension automatically as appropriate.
|
||||
if (!strstr(basename, ".cgp") && !strstr(basename, ".glslp"))
|
||||
{
|
||||
if (type == RARCH_SHADER_GLSL)
|
||||
strlcat(buffer, ".glslp", sizeof(buffer));
|
||||
else if (type == RARCH_SHADER_CG)
|
||||
strlcat(buffer, ".cgp", sizeof(buffer));
|
||||
}
|
||||
conf_path = buffer;
|
||||
}
|
||||
else
|
||||
conf_path = type == RARCH_SHADER_GLSL ? rgui->default_glslp : rgui->default_cgp;
|
||||
|
||||
char config_directory[PATH_MAX];
|
||||
if (*g_extern.config_path)
|
||||
fill_pathname_basedir(config_directory, g_extern.config_path, sizeof(config_directory));
|
||||
else
|
||||
*config_directory = '\0';
|
||||
|
||||
char cgp_path[PATH_MAX];
|
||||
const char *dirs[] = {
|
||||
g_settings.video.shader_dir,
|
||||
g_settings.rgui_config_directory,
|
||||
config_directory,
|
||||
};
|
||||
|
||||
config_file_t *conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
return;
|
||||
gfx_shader_write_conf_cgp(conf, &rgui->shader);
|
||||
|
||||
bool ret = false;
|
||||
unsigned d;
|
||||
for (d = 0; d < ARRAY_SIZE(dirs); d++)
|
||||
{
|
||||
if (!*dirs[d])
|
||||
continue;
|
||||
|
||||
fill_pathname_join(cgp_path, dirs[d], conf_path, sizeof(cgp_path));
|
||||
if (config_file_write(conf, cgp_path))
|
||||
{
|
||||
RARCH_LOG("Saved shader preset to %s.\n", cgp_path);
|
||||
if (apply)
|
||||
{
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_set_preset)
|
||||
driver.menu_ctx->backend->shader_manager_set_preset(NULL, type, cgp_path);
|
||||
}
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
RARCH_LOG("Failed writing shader preset to %s.\n", cgp_path);
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
if (!ret)
|
||||
RARCH_ERR("Failed to save shader preset. Make sure config directory and/or shader dir are writable.\n");
|
||||
}
|
||||
|
||||
static unsigned menu_common_shader_manager_get_type(void *data)
|
||||
{
|
||||
unsigned i, type;
|
||||
const struct gfx_shader *shader = (const struct gfx_shader*)data;
|
||||
|
||||
// All shader types must be the same, or we cannot use it.
|
||||
type = RARCH_SHADER_NONE;
|
||||
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
enum rarch_shader_type pass_type = gfx_shader_parse_type(shader->pass[i].source.cg,
|
||||
RARCH_SHADER_NONE);
|
||||
|
||||
switch (pass_type)
|
||||
{
|
||||
case RARCH_SHADER_CG:
|
||||
case RARCH_SHADER_GLSL:
|
||||
if (type == RARCH_SHADER_NONE)
|
||||
type = pass_type;
|
||||
else if (type != pass_type)
|
||||
return RARCH_SHADER_NONE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return RARCH_SHADER_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
static int menu_common_shader_manager_toggle_setting(void *data, unsigned setting, unsigned action)
|
||||
{
|
||||
unsigned dist_shader, dist_filter, dist_scale;
|
||||
rgui_handle_t *rgui;
|
||||
|
||||
rgui = (rgui_handle_t*)data;
|
||||
dist_shader = setting - RGUI_SETTINGS_SHADER_0;
|
||||
dist_filter = setting - RGUI_SETTINGS_SHADER_0_FILTER;
|
||||
dist_scale = setting - RGUI_SETTINGS_SHADER_0_SCALE;
|
||||
|
||||
if (setting == RGUI_SETTINGS_SHADER_FILTER)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
g_settings.video.smooth = true;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
g_settings.video.smooth = !g_settings.video.smooth;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (setting == RGUI_SETTINGS_SHADER_APPLY || setting == RGUI_SETTINGS_SHADER_PASSES)
|
||||
return menu_set_settings(rgui, setting, action);
|
||||
else if ((dist_shader % 3) == 0 || setting == RGUI_SETTINGS_SHADER_PRESET)
|
||||
{
|
||||
dist_shader /= 3;
|
||||
struct gfx_shader_pass *pass = setting == RGUI_SETTINGS_SHADER_PRESET ?
|
||||
&rgui->shader.pass[dist_shader] : NULL;
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_OK:
|
||||
file_list_push(rgui->menu_stack, g_settings.video.shader_dir, setting, rgui->selection_ptr);
|
||||
menu_clear_navigation(rgui);
|
||||
rgui->need_refresh = true;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_START:
|
||||
if (pass)
|
||||
*pass->source.cg = '\0';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_filter % 3) == 0)
|
||||
{
|
||||
dist_filter /= 3;
|
||||
struct gfx_shader_pass *pass = &rgui->shader.pass[dist_filter];
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
rgui->shader.pass[dist_filter].filter = RARCH_FILTER_UNSPEC;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
{
|
||||
unsigned delta = action == RGUI_ACTION_LEFT ? 2 : 1;
|
||||
pass->filter = (enum gfx_filter_type)((pass->filter + delta) % 3);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_scale % 3) == 0)
|
||||
{
|
||||
dist_scale /= 3;
|
||||
struct gfx_shader_pass *pass = &rgui->shader.pass[dist_scale];
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = 0;
|
||||
pass->fbo.valid = false;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
{
|
||||
unsigned current_scale = pass->fbo.scale_x;
|
||||
unsigned delta = action == RGUI_ACTION_LEFT ? 5 : 1;
|
||||
current_scale = (current_scale + delta) % 6;
|
||||
pass->fbo.valid = current_scale;
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = current_scale;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
const menu_ctx_driver_backend_t menu_ctx_backend_common = {
|
||||
menu_common_entries_init,
|
||||
menu_common_iterate,
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
menu_common_shader_manager_init,
|
||||
menu_common_shader_manager_get_str,
|
||||
menu_common_shader_manager_set_preset,
|
||||
menu_common_shader_manager_save_preset,
|
||||
menu_common_shader_manager_get_type,
|
||||
menu_common_shader_manager_toggle_setting,
|
||||
#else
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
"menu_common",
|
||||
};
|
||||
|
269
frontend/menu/backend/menu_common_backend.h
Normal file
269
frontend/menu/backend/menu_common_backend.h
Normal file
@ -0,0 +1,269 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2014 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MENU_COMMON_BACKEND_H
|
||||
#define _MENU_COMMON_BACKEND_H
|
||||
|
||||
#include "../menu_common.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
// Shader stuff
|
||||
RGUI_SETTINGS_GENERAL_OPTIONS = RGUI_START_SCREEN + 1,
|
||||
RGUI_SETTINGS_VIDEO_OPTIONS,
|
||||
RGUI_SETTINGS_VIDEO_OPTIONS_FIRST,
|
||||
RGUI_SETTINGS_VIDEO_RESOLUTION,
|
||||
RGUI_SETTINGS_VIDEO_PAL60,
|
||||
RGUI_SETTINGS_VIDEO_FILTER,
|
||||
RGUI_SETTINGS_VIDEO_SOFT_FILTER,
|
||||
RGUI_SETTINGS_FLICKER_FILTER,
|
||||
RGUI_SETTINGS_SOFT_DISPLAY_FILTER,
|
||||
RGUI_SETTINGS_VIDEO_GAMMA,
|
||||
RGUI_SETTINGS_VIDEO_INTEGER_SCALE,
|
||||
RGUI_SETTINGS_VIDEO_ASPECT_RATIO,
|
||||
RGUI_SETTINGS_CUSTOM_VIEWPORT,
|
||||
RGUI_SETTINGS_CUSTOM_VIEWPORT_2,
|
||||
RGUI_SETTINGS_TOGGLE_FULLSCREEN,
|
||||
RGUI_SETTINGS_VIDEO_THREADED,
|
||||
RGUI_SETTINGS_VIDEO_ROTATION,
|
||||
RGUI_SETTINGS_VIDEO_VSYNC,
|
||||
RGUI_SETTINGS_VIDEO_HARD_SYNC,
|
||||
RGUI_SETTINGS_VIDEO_HARD_SYNC_FRAMES,
|
||||
RGUI_SETTINGS_VIDEO_BLACK_FRAME_INSERTION,
|
||||
RGUI_SETTINGS_VIDEO_SWAP_INTERVAL,
|
||||
RGUI_SETTINGS_VIDEO_WINDOW_SCALE_X,
|
||||
RGUI_SETTINGS_VIDEO_WINDOW_SCALE_Y,
|
||||
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,
|
||||
RGUI_SETTINGS_FONT_SCALE,
|
||||
RGUI_SETTINGS_FONT_SIZE,
|
||||
RGUI_SETTINGS_LOAD_DUMMY_ON_CORE_SHUTDOWN,
|
||||
RGUI_SETTINGS_SHADER_OPTIONS,
|
||||
RGUI_SETTINGS_SHADER_FILTER,
|
||||
RGUI_SETTINGS_SHADER_PRESET,
|
||||
RGUI_SETTINGS_SHADER_APPLY,
|
||||
RGUI_SETTINGS_SHADER_PASSES,
|
||||
RGUI_SETTINGS_SHADER_0,
|
||||
RGUI_SETTINGS_SHADER_0_FILTER,
|
||||
RGUI_SETTINGS_SHADER_0_SCALE,
|
||||
RGUI_SETTINGS_SHADER_LAST = RGUI_SETTINGS_SHADER_0_SCALE + (3 * (GFX_MAX_SHADERS - 1)),
|
||||
RGUI_SETTINGS_SHADER_PRESET_SAVE,
|
||||
|
||||
// settings options are done here too
|
||||
RGUI_SETTINGS_OPEN_FILEBROWSER,
|
||||
RGUI_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE,
|
||||
RGUI_SETTINGS_OPEN_HISTORY,
|
||||
RGUI_SETTINGS_CORE,
|
||||
RGUI_SETTINGS_CORE_INFO,
|
||||
RGUI_SETTINGS_DEFERRED_CORE,
|
||||
RGUI_SETTINGS_CONFIG,
|
||||
RGUI_SETTINGS_SAVE_CONFIG,
|
||||
RGUI_SETTINGS_CORE_OPTIONS,
|
||||
RGUI_SETTINGS_AUDIO_OPTIONS,
|
||||
RGUI_SETTINGS_INPUT_OPTIONS,
|
||||
RGUI_SETTINGS_PATH_OPTIONS,
|
||||
RGUI_SETTINGS_OVERLAY_OPTIONS,
|
||||
RGUI_SETTINGS_NETPLAY_OPTIONS,
|
||||
RGUI_SETTINGS_PRIVACY_OPTIONS,
|
||||
RGUI_SETTINGS_OPTIONS,
|
||||
RGUI_SETTINGS_DRIVERS,
|
||||
RGUI_SETTINGS_REWIND_ENABLE,
|
||||
RGUI_SETTINGS_REWIND_GRANULARITY,
|
||||
RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT,
|
||||
RGUI_SETTINGS_PER_CORE_CONFIG,
|
||||
RGUI_SETTINGS_SRAM_AUTOSAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_SAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_LOAD,
|
||||
RGUI_SETTINGS_DISK_OPTIONS,
|
||||
RGUI_SETTINGS_DISK_INDEX,
|
||||
RGUI_SETTINGS_DISK_APPEND,
|
||||
RGUI_SETTINGS_DRIVER_VIDEO,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO_DEVICE,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO_RESAMPLER,
|
||||
RGUI_SETTINGS_DRIVER_INPUT,
|
||||
RGUI_SETTINGS_DRIVER_CAMERA,
|
||||
RGUI_SETTINGS_DRIVER_LOCATION,
|
||||
RGUI_SETTINGS_DRIVER_MENU,
|
||||
RGUI_SETTINGS_SCREENSHOT,
|
||||
RGUI_SETTINGS_GPU_SCREENSHOT,
|
||||
RGUI_SETTINGS_SAVESTATE_AUTO_SAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_AUTO_LOAD,
|
||||
RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE,
|
||||
RGUI_SETTINGS_WINDOW_COMPOSITING_ENABLE,
|
||||
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,
|
||||
RGUI_LIBRETRO_DIR_PATH,
|
||||
RGUI_LIBRETRO_INFO_DIR_PATH,
|
||||
RGUI_CONFIG_DIR_PATH,
|
||||
RGUI_OVERLAY_DIR_PATH,
|
||||
RGUI_SYSTEM_DIR_PATH,
|
||||
RGUI_SETTINGS_RESTART_GAME,
|
||||
RGUI_SETTINGS_AUDIO_MUTE,
|
||||
RGUI_SETTINGS_AUDIO_CONTROL_RATE_DELTA,
|
||||
RGUI_SETTINGS_AUDIO_DSP_EFFECT,
|
||||
RGUI_SETTINGS_AUDIO_VOLUME,
|
||||
RGUI_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE,
|
||||
RGUI_SETTINGS_ZIP_EXTRACT,
|
||||
RGUI_SETTINGS_DEBUG_TEXT,
|
||||
RGUI_SETTINGS_RESTART_EMULATOR,
|
||||
RGUI_SETTINGS_RESUME_GAME,
|
||||
RGUI_SETTINGS_QUIT_RARCH,
|
||||
|
||||
RGUI_SETTINGS_NETPLAY_ENABLE,
|
||||
RGUI_SETTINGS_NETPLAY_MODE,
|
||||
RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE,
|
||||
RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS,
|
||||
RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT,
|
||||
RGUI_SETTINGS_NETPLAY_DELAY_FRAMES,
|
||||
RGUI_SETTINGS_NETPLAY_NICKNAME,
|
||||
|
||||
RGUI_SETTINGS_PRIVACY_CAMERA_ALLOW,
|
||||
RGUI_SETTINGS_PRIVACY_LOCATION_ALLOW,
|
||||
|
||||
RGUI_SETTINGS_OVERLAY_PRESET,
|
||||
RGUI_SETTINGS_OVERLAY_OPACITY,
|
||||
RGUI_SETTINGS_OVERLAY_SCALE,
|
||||
RGUI_SETTINGS_BIND_PLAYER,
|
||||
RGUI_SETTINGS_BIND_DEVICE,
|
||||
RGUI_SETTINGS_BIND_DEVICE_TYPE,
|
||||
RGUI_SETTINGS_BIND_ANALOG_MODE,
|
||||
RGUI_SETTINGS_DEVICE_AUTODETECT_ENABLE,
|
||||
|
||||
// Match up with libretro order for simplicity.
|
||||
RGUI_SETTINGS_BIND_BEGIN,
|
||||
RGUI_SETTINGS_BIND_B = RGUI_SETTINGS_BIND_BEGIN,
|
||||
RGUI_SETTINGS_BIND_Y,
|
||||
RGUI_SETTINGS_BIND_SELECT,
|
||||
RGUI_SETTINGS_BIND_START,
|
||||
RGUI_SETTINGS_BIND_UP,
|
||||
RGUI_SETTINGS_BIND_DOWN,
|
||||
RGUI_SETTINGS_BIND_LEFT,
|
||||
RGUI_SETTINGS_BIND_RIGHT,
|
||||
RGUI_SETTINGS_BIND_A,
|
||||
RGUI_SETTINGS_BIND_X,
|
||||
RGUI_SETTINGS_BIND_L,
|
||||
RGUI_SETTINGS_BIND_R,
|
||||
RGUI_SETTINGS_BIND_L2,
|
||||
RGUI_SETTINGS_BIND_R2,
|
||||
RGUI_SETTINGS_BIND_L3,
|
||||
RGUI_SETTINGS_BIND_R3,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_X_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_X_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_Y_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_Y_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_X_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_X_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
|
||||
|
||||
RGUI_SETTINGS_BIND_TURBO_ENABLE,
|
||||
RGUI_SETTINGS_BIND_FAST_FORWARD_KEY,
|
||||
RGUI_SETTINGS_BIND_FAST_FORWARD_HOLD_KEY,
|
||||
RGUI_SETTINGS_BIND_LOAD_STATE_KEY,
|
||||
RGUI_SETTINGS_BIND_SAVE_STATE_KEY,
|
||||
RGUI_SETTINGS_BIND_FULLSCREEN_TOGGLE_KEY,
|
||||
RGUI_SETTINGS_BIND_QUIT_KEY,
|
||||
RGUI_SETTINGS_BIND_STATE_SLOT_PLUS,
|
||||
RGUI_SETTINGS_BIND_STATE_SLOT_MINUS,
|
||||
RGUI_SETTINGS_BIND_REWIND,
|
||||
RGUI_SETTINGS_BIND_MOVIE_RECORD_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_PAUSE_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_FRAMEADVANCE,
|
||||
RGUI_SETTINGS_BIND_RESET,
|
||||
RGUI_SETTINGS_BIND_SHADER_NEXT,
|
||||
RGUI_SETTINGS_BIND_SHADER_PREV,
|
||||
RGUI_SETTINGS_BIND_CHEAT_INDEX_PLUS,
|
||||
RGUI_SETTINGS_BIND_CHEAT_INDEX_MINUS,
|
||||
RGUI_SETTINGS_BIND_CHEAT_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_SCREENSHOT,
|
||||
RGUI_SETTINGS_BIND_DSP_CONFIG,
|
||||
RGUI_SETTINGS_BIND_MUTE,
|
||||
RGUI_SETTINGS_BIND_NETPLAY_FLIP,
|
||||
RGUI_SETTINGS_BIND_SLOWMOTION,
|
||||
RGUI_SETTINGS_BIND_ENABLE_HOTKEY,
|
||||
RGUI_SETTINGS_BIND_VOLUME_UP,
|
||||
RGUI_SETTINGS_BIND_VOLUME_DOWN,
|
||||
RGUI_SETTINGS_BIND_OVERLAY_NEXT,
|
||||
RGUI_SETTINGS_BIND_DISK_EJECT_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_DISK_NEXT,
|
||||
RGUI_SETTINGS_BIND_GRAB_MOUSE_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_MENU_TOGGLE,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_MODE,
|
||||
RGUI_SETTINGS_CUSTOM_BIND,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_KEYBOARD,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_ALL,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
|
||||
RGUI_SETTINGS_ONSCREEN_KEYBOARD_ENABLE,
|
||||
RGUI_SETTINGS_BIND_LAST = RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
|
||||
RGUI_SETTINGS_CORE_INFO_NONE = 0xffff,
|
||||
RGUI_SETTINGS_CORE_OPTION_NONE = 0xffff,
|
||||
RGUI_SETTINGS_CORE_OPTION_START = 0x10000
|
||||
} rgui_settings_t;
|
||||
|
||||
#ifdef GEKKO
|
||||
enum
|
||||
{
|
||||
GX_RESOLUTIONS_512_192 = 0,
|
||||
GX_RESOLUTIONS_598_200,
|
||||
GX_RESOLUTIONS_640_200,
|
||||
GX_RESOLUTIONS_384_224,
|
||||
GX_RESOLUTIONS_448_224,
|
||||
GX_RESOLUTIONS_480_224,
|
||||
GX_RESOLUTIONS_512_224,
|
||||
GX_RESOLUTIONS_576_224,
|
||||
GX_RESOLUTIONS_608_224,
|
||||
GX_RESOLUTIONS_640_224,
|
||||
GX_RESOLUTIONS_340_232,
|
||||
GX_RESOLUTIONS_512_232,
|
||||
GX_RESOLUTIONS_512_236,
|
||||
GX_RESOLUTIONS_336_240,
|
||||
GX_RESOLUTIONS_384_240,
|
||||
GX_RESOLUTIONS_512_240,
|
||||
GX_RESOLUTIONS_530_240,
|
||||
GX_RESOLUTIONS_640_240,
|
||||
GX_RESOLUTIONS_512_384,
|
||||
GX_RESOLUTIONS_598_400,
|
||||
GX_RESOLUTIONS_640_400,
|
||||
GX_RESOLUTIONS_384_448,
|
||||
GX_RESOLUTIONS_448_448,
|
||||
GX_RESOLUTIONS_480_448,
|
||||
GX_RESOLUTIONS_512_448,
|
||||
GX_RESOLUTIONS_576_448,
|
||||
GX_RESOLUTIONS_608_448,
|
||||
GX_RESOLUTIONS_640_448,
|
||||
GX_RESOLUTIONS_340_464,
|
||||
GX_RESOLUTIONS_512_464,
|
||||
GX_RESOLUTIONS_512_472,
|
||||
GX_RESOLUTIONS_384_480,
|
||||
GX_RESOLUTIONS_512_480,
|
||||
GX_RESOLUTIONS_530_480,
|
||||
GX_RESOLUTIONS_640_480,
|
||||
GX_RESOLUTIONS_LAST,
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
@ -17,17 +17,18 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "../../file.h"
|
||||
#include "menu_common.h"
|
||||
#include "menu_navigation.h"
|
||||
#include "menu_input_line_cb.h"
|
||||
#include "../../gfx/gfx_common.h"
|
||||
#include "../../input/input_common.h"
|
||||
#include "../../config.def.h"
|
||||
#include "../../input/keyboard_line.h"
|
||||
#include "../../../file.h"
|
||||
#include "menu_common_backend.h"
|
||||
#include "../menu_common.h"
|
||||
#include "../menu_navigation.h"
|
||||
#include "../menu_input_line_cb.h"
|
||||
#include "../../../gfx/gfx_common.h"
|
||||
#include "../../../input/input_common.h"
|
||||
#include "../../../config.def.h"
|
||||
#include "../../../input/keyboard_line.h"
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../../config.h"
|
||||
#include "../../../config.h"
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
@ -145,212 +146,11 @@ unsigned menu_type_is(unsigned type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
static enum rarch_shader_type shader_manager_get_type(const struct gfx_shader *shader)
|
||||
{
|
||||
unsigned i;
|
||||
// All shader types must be the same, or we cannot use it.
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
|
||||
for (i = 0; i < shader->passes; i++)
|
||||
{
|
||||
enum rarch_shader_type pass_type = gfx_shader_parse_type(shader->pass[i].source.cg,
|
||||
RARCH_SHADER_NONE);
|
||||
|
||||
switch (pass_type)
|
||||
{
|
||||
case RARCH_SHADER_CG:
|
||||
case RARCH_SHADER_GLSL:
|
||||
if (type == RARCH_SHADER_NONE)
|
||||
type = pass_type;
|
||||
else if (type != pass_type)
|
||||
return RARCH_SHADER_NONE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return RARCH_SHADER_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
void shader_manager_save_preset(void *data, const char *basename, bool apply)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
enum rarch_shader_type type = shader_manager_get_type(&rgui->shader);
|
||||
if (type == RARCH_SHADER_NONE)
|
||||
return;
|
||||
|
||||
const char *conf_path = NULL;
|
||||
char buffer[PATH_MAX];
|
||||
if (basename)
|
||||
{
|
||||
strlcpy(buffer, basename, sizeof(buffer));
|
||||
// Append extension automatically as appropriate.
|
||||
if (!strstr(basename, ".cgp") && !strstr(basename, ".glslp"))
|
||||
{
|
||||
if (type == RARCH_SHADER_GLSL)
|
||||
strlcat(buffer, ".glslp", sizeof(buffer));
|
||||
else if (type == RARCH_SHADER_CG)
|
||||
strlcat(buffer, ".cgp", sizeof(buffer));
|
||||
}
|
||||
conf_path = buffer;
|
||||
}
|
||||
else
|
||||
conf_path = type == RARCH_SHADER_GLSL ? rgui->default_glslp : rgui->default_cgp;
|
||||
|
||||
char config_directory[PATH_MAX];
|
||||
if (*g_extern.config_path)
|
||||
fill_pathname_basedir(config_directory, g_extern.config_path, sizeof(config_directory));
|
||||
else
|
||||
*config_directory = '\0';
|
||||
|
||||
char cgp_path[PATH_MAX];
|
||||
const char *dirs[] = {
|
||||
g_settings.video.shader_dir,
|
||||
g_settings.rgui_config_directory,
|
||||
config_directory,
|
||||
};
|
||||
|
||||
config_file_t *conf = config_file_new(NULL);
|
||||
if (!conf)
|
||||
return;
|
||||
gfx_shader_write_conf_cgp(conf, &rgui->shader);
|
||||
|
||||
bool ret = false;
|
||||
unsigned d;
|
||||
for (d = 0; d < ARRAY_SIZE(dirs); d++)
|
||||
{
|
||||
if (!*dirs[d])
|
||||
continue;
|
||||
|
||||
fill_pathname_join(cgp_path, dirs[d], conf_path, sizeof(cgp_path));
|
||||
if (config_file_write(conf, cgp_path))
|
||||
{
|
||||
RARCH_LOG("Saved shader preset to %s.\n", cgp_path);
|
||||
if (apply)
|
||||
shader_manager_set_preset(NULL, type, cgp_path);
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
RARCH_LOG("Failed writing shader preset to %s.\n", cgp_path);
|
||||
}
|
||||
|
||||
config_file_free(conf);
|
||||
if (!ret)
|
||||
RARCH_ERR("Failed to save shader preset. Make sure config directory and/or shader dir are writable.\n");
|
||||
}
|
||||
|
||||
static int shader_manager_toggle_setting(void *data, unsigned setting, unsigned action)
|
||||
{
|
||||
unsigned dist_shader, dist_filter, dist_scale;
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
dist_shader = setting - RGUI_SETTINGS_SHADER_0;
|
||||
dist_filter = setting - RGUI_SETTINGS_SHADER_0_FILTER;
|
||||
dist_scale = setting - RGUI_SETTINGS_SHADER_0_SCALE;
|
||||
|
||||
if (setting == RGUI_SETTINGS_SHADER_FILTER)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
g_settings.video.smooth = true;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
g_settings.video.smooth = !g_settings.video.smooth;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (setting == RGUI_SETTINGS_SHADER_APPLY || setting == RGUI_SETTINGS_SHADER_PASSES)
|
||||
return menu_set_settings(rgui, setting, action);
|
||||
else if ((dist_shader % 3) == 0 || setting == RGUI_SETTINGS_SHADER_PRESET)
|
||||
{
|
||||
dist_shader /= 3;
|
||||
struct gfx_shader_pass *pass = setting == RGUI_SETTINGS_SHADER_PRESET ?
|
||||
&rgui->shader.pass[dist_shader] : NULL;
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_OK:
|
||||
file_list_push(rgui->menu_stack, g_settings.video.shader_dir, setting, rgui->selection_ptr);
|
||||
menu_clear_navigation(rgui);
|
||||
rgui->need_refresh = true;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_START:
|
||||
if (pass)
|
||||
*pass->source.cg = '\0';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_filter % 3) == 0)
|
||||
{
|
||||
dist_filter /= 3;
|
||||
struct gfx_shader_pass *pass = &rgui->shader.pass[dist_filter];
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
rgui->shader.pass[dist_filter].filter = RARCH_FILTER_UNSPEC;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
{
|
||||
unsigned delta = action == RGUI_ACTION_LEFT ? 2 : 1;
|
||||
pass->filter = (enum gfx_filter_type)((pass->filter + delta) % 3);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((dist_scale % 3) == 0)
|
||||
{
|
||||
dist_scale /= 3;
|
||||
struct gfx_shader_pass *pass = &rgui->shader.pass[dist_scale];
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_START:
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = 0;
|
||||
pass->fbo.valid = false;
|
||||
break;
|
||||
|
||||
case RGUI_ACTION_LEFT:
|
||||
case RGUI_ACTION_RIGHT:
|
||||
case RGUI_ACTION_OK:
|
||||
{
|
||||
unsigned current_scale = pass->fbo.scale_x;
|
||||
unsigned delta = action == RGUI_ACTION_LEFT ? 5 : 1;
|
||||
current_scale = (current_scale + delta) % 6;
|
||||
pass->fbo.valid = current_scale;
|
||||
pass->fbo.scale_x = pass->fbo.scale_y = current_scale;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int menu_core_setting_toggle(unsigned setting, unsigned action)
|
||||
{
|
||||
unsigned index = setting - RGUI_SETTINGS_CORE_OPTION_START;
|
||||
unsigned index;
|
||||
index = setting - RGUI_SETTINGS_CORE_OPTION_START;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case RGUI_ACTION_LEFT:
|
||||
@ -377,8 +177,13 @@ int menu_settings_toggle_setting(void *data, unsigned setting, unsigned action,
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
if (setting >= RGUI_SETTINGS_SHADER_FILTER && setting <= RGUI_SETTINGS_SHADER_LAST)
|
||||
return shader_manager_toggle_setting(rgui, setting, action);
|
||||
if ((setting >= RGUI_SETTINGS_SHADER_FILTER) && (setting <= RGUI_SETTINGS_SHADER_LAST))
|
||||
{
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_toggle_setting)
|
||||
return driver.menu_ctx->backend->shader_manager_toggle_setting(rgui, setting, action);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (setting >= RGUI_SETTINGS_CORE_OPTION_START)
|
||||
return menu_core_setting_toggle(setting, action);
|
||||
@ -1770,15 +1575,20 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
break;
|
||||
case RGUI_SETTINGS_SHADER_APPLY:
|
||||
{
|
||||
unsigned type = RARCH_SHADER_NONE;
|
||||
|
||||
if (!driver.video || !driver.video->set_shader || action != RGUI_ACTION_OK)
|
||||
return 0;
|
||||
|
||||
RARCH_LOG("Applying shader ...\n");
|
||||
|
||||
enum rarch_shader_type type = shader_manager_get_type(&rgui->shader);
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_type)
|
||||
type = driver.menu_ctx->backend->shader_manager_get_type(&rgui->shader);
|
||||
|
||||
if (rgui->shader.passes && type != RARCH_SHADER_NONE)
|
||||
shader_manager_save_preset(rgui, NULL, true);
|
||||
if (rgui->shader.passes && type != RARCH_SHADER_NONE
|
||||
&& driver.menu_ctx && driver.menu_ctx->backend &&
|
||||
driver.menu_ctx->backend->shader_manager_save_preset)
|
||||
driver.menu_ctx->backend->shader_manager_save_preset(rgui, NULL, true);
|
||||
else
|
||||
{
|
||||
type = gfx_shader_parse_type("", DEFAULT_SHADER_TYPE);
|
||||
@ -1790,7 +1600,8 @@ int menu_set_settings(void *data, unsigned setting, unsigned action)
|
||||
type = RARCH_SHADER_CG;
|
||||
#endif
|
||||
}
|
||||
shader_manager_set_preset(NULL, type, NULL);
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_set_preset)
|
||||
driver.menu_ctx->backend->shader_manager_set_preset(NULL, type, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../backend/menu_common_backend.h"
|
||||
#include "../menu_common.h"
|
||||
#include "../file_list.h"
|
||||
#include "../../../general.h"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../backend/menu_common_backend.h"
|
||||
#include "../menu_common.h"
|
||||
#include "../file_list.h"
|
||||
#include "../../../general.h"
|
||||
@ -29,7 +30,6 @@
|
||||
#include "../../../file.h"
|
||||
#include "../../../dynamic.h"
|
||||
#include "../../../compat/posix_string.h"
|
||||
#include "../../../gfx/shader_parse.h"
|
||||
#include "../../../performance.h"
|
||||
#include "../../../input/input_common.h"
|
||||
|
||||
@ -444,8 +444,8 @@ static void rgui_render(void *data)
|
||||
else if (type == RGUI_SETTINGS_SHADER_FILTER)
|
||||
snprintf(type_str, sizeof(type_str), "%s",
|
||||
g_settings.video.smooth ? "Linear" : "Nearest");
|
||||
else
|
||||
shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
|
||||
driver.menu_ctx->backend->shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../backend/menu_common_backend.h"
|
||||
#include "../menu_common.h"
|
||||
#include "../file_list.h"
|
||||
#include "../../../general.h"
|
||||
@ -312,8 +313,8 @@ static void rmenu_render(void *data)
|
||||
else if (type == RGUI_SETTINGS_SHADER_FILTER)
|
||||
snprintf(type_str, sizeof(type_str), "%s",
|
||||
g_settings.video.smooth ? "Linear" : "Nearest");
|
||||
else
|
||||
shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
|
||||
driver.menu_ctx->backend->shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <xui.h>
|
||||
#include <xuiapp.h>
|
||||
|
||||
#include "../backend/menu_common_backend.h"
|
||||
#include "../menu_common.h"
|
||||
|
||||
#include "../../../gfx/gfx_common.h"
|
||||
@ -538,7 +539,6 @@ static void rmenu_xui_render(void *data)
|
||||
else if (menu_type == RGUI_SETTINGS_PATH_OPTIONS)
|
||||
w = 24;
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
if (type >= RGUI_SETTINGS_SHADER_FILTER &&
|
||||
type <= RGUI_SETTINGS_SHADER_LAST)
|
||||
{
|
||||
@ -555,11 +555,10 @@ static void rmenu_xui_render(void *data)
|
||||
else if (type == RGUI_SETTINGS_SHADER_FILTER)
|
||||
snprintf(type_str, sizeof(type_str), "%s",
|
||||
g_settings.video.smooth ? "Linear" : "Nearest");
|
||||
else
|
||||
shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
else if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_get_str)
|
||||
driver.menu_ctx->backend->shader_manager_get_str(&rgui->shader, type_str, sizeof(type_str), type);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
// Pretty-print libretro cores from menu.
|
||||
if (menu_type == RGUI_SETTINGS_CORE || menu_type == RGUI_SETTINGS_DEFERRED_CORE)
|
||||
{
|
||||
|
@ -68,163 +68,6 @@ void menu_update_system_info(void *data, bool *load_no_rom)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
void shader_manager_init(void *data)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)data;
|
||||
memset(&rgui->shader, 0, sizeof(rgui->shader));
|
||||
config_file_t *conf = NULL;
|
||||
|
||||
const char *config_path = NULL;
|
||||
if (*g_extern.core_specific_config_path && g_settings.core_specific_config)
|
||||
config_path = g_extern.core_specific_config_path;
|
||||
else if (*g_extern.config_path)
|
||||
config_path = g_extern.config_path;
|
||||
|
||||
// In a multi-config setting, we can't have conflicts on rgui.cgp/rgui.glslp.
|
||||
if (config_path)
|
||||
{
|
||||
fill_pathname_base(rgui->default_glslp, config_path, sizeof(rgui->default_glslp));
|
||||
path_remove_extension(rgui->default_glslp);
|
||||
strlcat(rgui->default_glslp, ".glslp", sizeof(rgui->default_glslp));
|
||||
fill_pathname_base(rgui->default_cgp, config_path, sizeof(rgui->default_cgp));
|
||||
path_remove_extension(rgui->default_cgp);
|
||||
strlcat(rgui->default_cgp, ".cgp", sizeof(rgui->default_cgp));
|
||||
}
|
||||
else
|
||||
{
|
||||
strlcpy(rgui->default_glslp, "rgui.glslp", sizeof(rgui->default_glslp));
|
||||
strlcpy(rgui->default_cgp, "rgui.cgp", sizeof(rgui->default_cgp));
|
||||
}
|
||||
|
||||
char cgp_path[PATH_MAX];
|
||||
|
||||
const char *ext = path_get_extension(g_settings.video.shader_path);
|
||||
if (strcmp(ext, "glslp") == 0 || strcmp(ext, "cgp") == 0)
|
||||
{
|
||||
conf = config_file_new(g_settings.video.shader_path);
|
||||
if (conf)
|
||||
{
|
||||
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
||||
gfx_shader_resolve_relative(&rgui->shader, g_settings.video.shader_path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
else if (strcmp(ext, "glsl") == 0 || strcmp(ext, "cg") == 0)
|
||||
{
|
||||
strlcpy(rgui->shader.pass[0].source.cg, g_settings.video.shader_path,
|
||||
sizeof(rgui->shader.pass[0].source.cg));
|
||||
rgui->shader.passes = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *shader_dir = *g_settings.video.shader_dir ?
|
||||
g_settings.video.shader_dir : g_settings.system_directory;
|
||||
|
||||
fill_pathname_join(cgp_path, shader_dir, "rgui.glslp", sizeof(cgp_path));
|
||||
conf = config_file_new(cgp_path);
|
||||
|
||||
if (!conf)
|
||||
{
|
||||
fill_pathname_join(cgp_path, shader_dir, "rgui.cgp", sizeof(cgp_path));
|
||||
conf = config_file_new(cgp_path);
|
||||
}
|
||||
|
||||
if (conf)
|
||||
{
|
||||
if (gfx_shader_read_conf_cgp(conf, &rgui->shader))
|
||||
gfx_shader_resolve_relative(&rgui->shader, cgp_path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void shader_manager_set_preset(struct gfx_shader *shader, enum rarch_shader_type type, const char *path)
|
||||
{
|
||||
RARCH_LOG("Setting RGUI shader: %s.\n", path ? path : "N/A (stock)");
|
||||
bool ret = video_set_shader_func(type, path);
|
||||
if (ret)
|
||||
{
|
||||
// Makes sure that we use RGUI CGP shader on driver reinit.
|
||||
// Only do this when the cgp actually works to avoid potential errors.
|
||||
strlcpy(g_settings.video.shader_path, path ? path : "",
|
||||
sizeof(g_settings.video.shader_path));
|
||||
g_settings.video.shader_enable = true;
|
||||
|
||||
if (path && shader)
|
||||
{
|
||||
// Load stored CGP into RGUI menu on success.
|
||||
// Used when a preset is directly loaded.
|
||||
// No point in updating when the CGP was created from RGUI itself.
|
||||
config_file_t *conf = config_file_new(path);
|
||||
if (conf)
|
||||
{
|
||||
gfx_shader_read_conf_cgp(conf, shader);
|
||||
gfx_shader_resolve_relative(shader, path);
|
||||
config_file_free(conf);
|
||||
}
|
||||
|
||||
rgui->need_refresh = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RARCH_ERR("Setting RGUI CGP failed.\n");
|
||||
g_settings.video.shader_enable = false;
|
||||
}
|
||||
}
|
||||
|
||||
void shader_manager_get_str(struct gfx_shader *shader,
|
||||
char *type_str, size_t type_str_size, unsigned type)
|
||||
{
|
||||
if (type == RGUI_SETTINGS_SHADER_APPLY)
|
||||
*type_str = '\0';
|
||||
else if (type == RGUI_SETTINGS_SHADER_PASSES)
|
||||
snprintf(type_str, type_str_size, "%u", shader->passes);
|
||||
else
|
||||
{
|
||||
unsigned pass = (type - RGUI_SETTINGS_SHADER_0) / 3;
|
||||
switch ((type - RGUI_SETTINGS_SHADER_0) % 3)
|
||||
{
|
||||
case 0:
|
||||
if (*shader->pass[pass].source.cg)
|
||||
fill_pathname_base(type_str,
|
||||
shader->pass[pass].source.cg, type_str_size);
|
||||
else
|
||||
strlcpy(type_str, "N/A", type_str_size);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
switch (shader->pass[pass].filter)
|
||||
{
|
||||
case RARCH_FILTER_LINEAR:
|
||||
strlcpy(type_str, "Linear", type_str_size);
|
||||
break;
|
||||
|
||||
case RARCH_FILTER_NEAREST:
|
||||
strlcpy(type_str, "Nearest", type_str_size);
|
||||
break;
|
||||
|
||||
case RARCH_FILTER_UNSPEC:
|
||||
strlcpy(type_str, "Don't care", type_str_size);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
unsigned scale = shader->pass[pass].fbo.scale_x;
|
||||
if (!scale)
|
||||
strlcpy(type_str, "Don't care", type_str_size);
|
||||
else
|
||||
snprintf(type_str, type_str_size, "%ux", scale);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void menu_rom_history_push(const char *path,
|
||||
const char *core_path,
|
||||
const char *core_name)
|
||||
@ -403,9 +246,8 @@ bool load_menu_game(void)
|
||||
// Update menu state which depends on config.
|
||||
menu_update_libretro_info();
|
||||
menu_init_history();
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
shader_manager_init(rgui);
|
||||
#endif
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init)
|
||||
driver.menu_ctx->backend->shader_manager_init(rgui);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -447,9 +289,8 @@ void menu_init(void)
|
||||
|
||||
menu_update_libretro_info();
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
shader_manager_init(rgui);
|
||||
#endif
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_init)
|
||||
driver.menu_ctx->backend->shader_manager_init(rgui);
|
||||
|
||||
menu_init_history();
|
||||
rgui->last_time = rarch_get_time_usec();
|
||||
|
@ -59,208 +59,6 @@ typedef enum
|
||||
RGUI_FILE_USE_DIRECTORY,
|
||||
RGUI_SETTINGS,
|
||||
RGUI_START_SCREEN,
|
||||
|
||||
// Shader stuff
|
||||
RGUI_SETTINGS_GENERAL_OPTIONS,
|
||||
RGUI_SETTINGS_VIDEO_OPTIONS,
|
||||
RGUI_SETTINGS_VIDEO_OPTIONS_FIRST,
|
||||
RGUI_SETTINGS_VIDEO_RESOLUTION,
|
||||
RGUI_SETTINGS_VIDEO_PAL60,
|
||||
RGUI_SETTINGS_VIDEO_FILTER,
|
||||
RGUI_SETTINGS_VIDEO_SOFT_FILTER,
|
||||
RGUI_SETTINGS_FLICKER_FILTER,
|
||||
RGUI_SETTINGS_SOFT_DISPLAY_FILTER,
|
||||
RGUI_SETTINGS_VIDEO_GAMMA,
|
||||
RGUI_SETTINGS_VIDEO_INTEGER_SCALE,
|
||||
RGUI_SETTINGS_VIDEO_ASPECT_RATIO,
|
||||
RGUI_SETTINGS_CUSTOM_VIEWPORT,
|
||||
RGUI_SETTINGS_CUSTOM_VIEWPORT_2,
|
||||
RGUI_SETTINGS_TOGGLE_FULLSCREEN,
|
||||
RGUI_SETTINGS_VIDEO_THREADED,
|
||||
RGUI_SETTINGS_VIDEO_ROTATION,
|
||||
RGUI_SETTINGS_VIDEO_VSYNC,
|
||||
RGUI_SETTINGS_VIDEO_HARD_SYNC,
|
||||
RGUI_SETTINGS_VIDEO_HARD_SYNC_FRAMES,
|
||||
RGUI_SETTINGS_VIDEO_BLACK_FRAME_INSERTION,
|
||||
RGUI_SETTINGS_VIDEO_SWAP_INTERVAL,
|
||||
RGUI_SETTINGS_VIDEO_WINDOW_SCALE_X,
|
||||
RGUI_SETTINGS_VIDEO_WINDOW_SCALE_Y,
|
||||
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,
|
||||
RGUI_SETTINGS_FONT_SCALE,
|
||||
RGUI_SETTINGS_FONT_SIZE,
|
||||
RGUI_SETTINGS_LOAD_DUMMY_ON_CORE_SHUTDOWN,
|
||||
RGUI_SETTINGS_SHADER_OPTIONS,
|
||||
RGUI_SETTINGS_SHADER_FILTER,
|
||||
RGUI_SETTINGS_SHADER_PRESET,
|
||||
RGUI_SETTINGS_SHADER_APPLY,
|
||||
RGUI_SETTINGS_SHADER_PASSES,
|
||||
RGUI_SETTINGS_SHADER_0,
|
||||
RGUI_SETTINGS_SHADER_0_FILTER,
|
||||
RGUI_SETTINGS_SHADER_0_SCALE,
|
||||
RGUI_SETTINGS_SHADER_LAST = RGUI_SETTINGS_SHADER_0_SCALE + (3 * (GFX_MAX_SHADERS - 1)),
|
||||
RGUI_SETTINGS_SHADER_PRESET_SAVE,
|
||||
|
||||
// settings options are done here too
|
||||
RGUI_SETTINGS_OPEN_FILEBROWSER,
|
||||
RGUI_SETTINGS_OPEN_FILEBROWSER_DEFERRED_CORE,
|
||||
RGUI_SETTINGS_OPEN_HISTORY,
|
||||
RGUI_SETTINGS_CORE,
|
||||
RGUI_SETTINGS_CORE_INFO,
|
||||
RGUI_SETTINGS_DEFERRED_CORE,
|
||||
RGUI_SETTINGS_CONFIG,
|
||||
RGUI_SETTINGS_SAVE_CONFIG,
|
||||
RGUI_SETTINGS_CORE_OPTIONS,
|
||||
RGUI_SETTINGS_AUDIO_OPTIONS,
|
||||
RGUI_SETTINGS_INPUT_OPTIONS,
|
||||
RGUI_SETTINGS_PATH_OPTIONS,
|
||||
RGUI_SETTINGS_OVERLAY_OPTIONS,
|
||||
RGUI_SETTINGS_NETPLAY_OPTIONS,
|
||||
RGUI_SETTINGS_PRIVACY_OPTIONS,
|
||||
RGUI_SETTINGS_OPTIONS,
|
||||
RGUI_SETTINGS_DRIVERS,
|
||||
RGUI_SETTINGS_REWIND_ENABLE,
|
||||
RGUI_SETTINGS_REWIND_GRANULARITY,
|
||||
RGUI_SETTINGS_CONFIG_SAVE_ON_EXIT,
|
||||
RGUI_SETTINGS_PER_CORE_CONFIG,
|
||||
RGUI_SETTINGS_SRAM_AUTOSAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_SAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_LOAD,
|
||||
RGUI_SETTINGS_DISK_OPTIONS,
|
||||
RGUI_SETTINGS_DISK_INDEX,
|
||||
RGUI_SETTINGS_DISK_APPEND,
|
||||
RGUI_SETTINGS_DRIVER_VIDEO,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO_DEVICE,
|
||||
RGUI_SETTINGS_DRIVER_AUDIO_RESAMPLER,
|
||||
RGUI_SETTINGS_DRIVER_INPUT,
|
||||
RGUI_SETTINGS_DRIVER_CAMERA,
|
||||
RGUI_SETTINGS_DRIVER_LOCATION,
|
||||
RGUI_SETTINGS_DRIVER_MENU,
|
||||
RGUI_SETTINGS_SCREENSHOT,
|
||||
RGUI_SETTINGS_GPU_SCREENSHOT,
|
||||
RGUI_SETTINGS_SAVESTATE_AUTO_SAVE,
|
||||
RGUI_SETTINGS_SAVESTATE_AUTO_LOAD,
|
||||
RGUI_SETTINGS_BLOCK_SRAM_OVERWRITE,
|
||||
RGUI_SETTINGS_WINDOW_COMPOSITING_ENABLE,
|
||||
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,
|
||||
RGUI_LIBRETRO_DIR_PATH,
|
||||
RGUI_LIBRETRO_INFO_DIR_PATH,
|
||||
RGUI_CONFIG_DIR_PATH,
|
||||
RGUI_OVERLAY_DIR_PATH,
|
||||
RGUI_SYSTEM_DIR_PATH,
|
||||
RGUI_SETTINGS_RESTART_GAME,
|
||||
RGUI_SETTINGS_AUDIO_MUTE,
|
||||
RGUI_SETTINGS_AUDIO_CONTROL_RATE_DELTA,
|
||||
RGUI_SETTINGS_AUDIO_DSP_EFFECT,
|
||||
RGUI_SETTINGS_AUDIO_VOLUME,
|
||||
RGUI_SETTINGS_CUSTOM_BGM_CONTROL_ENABLE,
|
||||
RGUI_SETTINGS_ZIP_EXTRACT,
|
||||
RGUI_SETTINGS_DEBUG_TEXT,
|
||||
RGUI_SETTINGS_RESTART_EMULATOR,
|
||||
RGUI_SETTINGS_RESUME_GAME,
|
||||
RGUI_SETTINGS_QUIT_RARCH,
|
||||
|
||||
RGUI_SETTINGS_NETPLAY_ENABLE,
|
||||
RGUI_SETTINGS_NETPLAY_MODE,
|
||||
RGUI_SETTINGS_NETPLAY_SPECTATOR_MODE_ENABLE,
|
||||
RGUI_SETTINGS_NETPLAY_HOST_IP_ADDRESS,
|
||||
RGUI_SETTINGS_NETPLAY_TCP_UDP_PORT,
|
||||
RGUI_SETTINGS_NETPLAY_DELAY_FRAMES,
|
||||
RGUI_SETTINGS_NETPLAY_NICKNAME,
|
||||
|
||||
RGUI_SETTINGS_PRIVACY_CAMERA_ALLOW,
|
||||
RGUI_SETTINGS_PRIVACY_LOCATION_ALLOW,
|
||||
|
||||
RGUI_SETTINGS_OVERLAY_PRESET,
|
||||
RGUI_SETTINGS_OVERLAY_OPACITY,
|
||||
RGUI_SETTINGS_OVERLAY_SCALE,
|
||||
RGUI_SETTINGS_BIND_PLAYER,
|
||||
RGUI_SETTINGS_BIND_DEVICE,
|
||||
RGUI_SETTINGS_BIND_DEVICE_TYPE,
|
||||
RGUI_SETTINGS_BIND_ANALOG_MODE,
|
||||
RGUI_SETTINGS_DEVICE_AUTODETECT_ENABLE,
|
||||
|
||||
// Match up with libretro order for simplicity.
|
||||
RGUI_SETTINGS_BIND_BEGIN,
|
||||
RGUI_SETTINGS_BIND_B = RGUI_SETTINGS_BIND_BEGIN,
|
||||
RGUI_SETTINGS_BIND_Y,
|
||||
RGUI_SETTINGS_BIND_SELECT,
|
||||
RGUI_SETTINGS_BIND_START,
|
||||
RGUI_SETTINGS_BIND_UP,
|
||||
RGUI_SETTINGS_BIND_DOWN,
|
||||
RGUI_SETTINGS_BIND_LEFT,
|
||||
RGUI_SETTINGS_BIND_RIGHT,
|
||||
RGUI_SETTINGS_BIND_A,
|
||||
RGUI_SETTINGS_BIND_X,
|
||||
RGUI_SETTINGS_BIND_L,
|
||||
RGUI_SETTINGS_BIND_R,
|
||||
RGUI_SETTINGS_BIND_L2,
|
||||
RGUI_SETTINGS_BIND_R2,
|
||||
RGUI_SETTINGS_BIND_L3,
|
||||
RGUI_SETTINGS_BIND_R3,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_X_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_X_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_Y_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_LEFT_Y_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_X_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_X_MINUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_PLUS,
|
||||
RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
|
||||
|
||||
RGUI_SETTINGS_BIND_TURBO_ENABLE,
|
||||
RGUI_SETTINGS_BIND_FAST_FORWARD_KEY,
|
||||
RGUI_SETTINGS_BIND_FAST_FORWARD_HOLD_KEY,
|
||||
RGUI_SETTINGS_BIND_LOAD_STATE_KEY,
|
||||
RGUI_SETTINGS_BIND_SAVE_STATE_KEY,
|
||||
RGUI_SETTINGS_BIND_FULLSCREEN_TOGGLE_KEY,
|
||||
RGUI_SETTINGS_BIND_QUIT_KEY,
|
||||
RGUI_SETTINGS_BIND_STATE_SLOT_PLUS,
|
||||
RGUI_SETTINGS_BIND_STATE_SLOT_MINUS,
|
||||
RGUI_SETTINGS_BIND_REWIND,
|
||||
RGUI_SETTINGS_BIND_MOVIE_RECORD_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_PAUSE_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_FRAMEADVANCE,
|
||||
RGUI_SETTINGS_BIND_RESET,
|
||||
RGUI_SETTINGS_BIND_SHADER_NEXT,
|
||||
RGUI_SETTINGS_BIND_SHADER_PREV,
|
||||
RGUI_SETTINGS_BIND_CHEAT_INDEX_PLUS,
|
||||
RGUI_SETTINGS_BIND_CHEAT_INDEX_MINUS,
|
||||
RGUI_SETTINGS_BIND_CHEAT_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_SCREENSHOT,
|
||||
RGUI_SETTINGS_BIND_DSP_CONFIG,
|
||||
RGUI_SETTINGS_BIND_MUTE,
|
||||
RGUI_SETTINGS_BIND_NETPLAY_FLIP,
|
||||
RGUI_SETTINGS_BIND_SLOWMOTION,
|
||||
RGUI_SETTINGS_BIND_ENABLE_HOTKEY,
|
||||
RGUI_SETTINGS_BIND_VOLUME_UP,
|
||||
RGUI_SETTINGS_BIND_VOLUME_DOWN,
|
||||
RGUI_SETTINGS_BIND_OVERLAY_NEXT,
|
||||
RGUI_SETTINGS_BIND_DISK_EJECT_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_DISK_NEXT,
|
||||
RGUI_SETTINGS_BIND_GRAB_MOUSE_TOGGLE,
|
||||
RGUI_SETTINGS_BIND_MENU_TOGGLE,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_MODE,
|
||||
RGUI_SETTINGS_CUSTOM_BIND,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_KEYBOARD,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_ALL,
|
||||
RGUI_SETTINGS_CUSTOM_BIND_DEFAULT_ALL,
|
||||
RGUI_SETTINGS_ONSCREEN_KEYBOARD_ENABLE,
|
||||
RGUI_SETTINGS_BIND_LAST = RGUI_SETTINGS_BIND_ANALOG_RIGHT_Y_MINUS,
|
||||
RGUI_SETTINGS_CORE_INFO_NONE = 0xffff,
|
||||
RGUI_SETTINGS_CORE_OPTION_NONE = 0xffff,
|
||||
RGUI_SETTINGS_CORE_OPTION_START = 0x10000
|
||||
} rgui_file_type_t;
|
||||
|
||||
typedef enum
|
||||
@ -317,49 +115,6 @@ void menu_poll_bind_state(struct rgui_bind_state *state);
|
||||
bool menu_poll_find_trigger(struct rgui_bind_state *state, struct rgui_bind_state *new_state);
|
||||
bool menu_custom_bind_keyboard_cb(void *data, unsigned code);
|
||||
|
||||
#ifdef GEKKO
|
||||
enum
|
||||
{
|
||||
GX_RESOLUTIONS_512_192 = 0,
|
||||
GX_RESOLUTIONS_598_200,
|
||||
GX_RESOLUTIONS_640_200,
|
||||
GX_RESOLUTIONS_384_224,
|
||||
GX_RESOLUTIONS_448_224,
|
||||
GX_RESOLUTIONS_480_224,
|
||||
GX_RESOLUTIONS_512_224,
|
||||
GX_RESOLUTIONS_576_224,
|
||||
GX_RESOLUTIONS_608_224,
|
||||
GX_RESOLUTIONS_640_224,
|
||||
GX_RESOLUTIONS_340_232,
|
||||
GX_RESOLUTIONS_512_232,
|
||||
GX_RESOLUTIONS_512_236,
|
||||
GX_RESOLUTIONS_336_240,
|
||||
GX_RESOLUTIONS_384_240,
|
||||
GX_RESOLUTIONS_512_240,
|
||||
GX_RESOLUTIONS_530_240,
|
||||
GX_RESOLUTIONS_640_240,
|
||||
GX_RESOLUTIONS_512_384,
|
||||
GX_RESOLUTIONS_598_400,
|
||||
GX_RESOLUTIONS_640_400,
|
||||
GX_RESOLUTIONS_384_448,
|
||||
GX_RESOLUTIONS_448_448,
|
||||
GX_RESOLUTIONS_480_448,
|
||||
GX_RESOLUTIONS_512_448,
|
||||
GX_RESOLUTIONS_576_448,
|
||||
GX_RESOLUTIONS_608_448,
|
||||
GX_RESOLUTIONS_640_448,
|
||||
GX_RESOLUTIONS_340_464,
|
||||
GX_RESOLUTIONS_512_464,
|
||||
GX_RESOLUTIONS_512_472,
|
||||
GX_RESOLUTIONS_384_480,
|
||||
GX_RESOLUTIONS_512_480,
|
||||
GX_RESOLUTIONS_530_480,
|
||||
GX_RESOLUTIONS_640_480,
|
||||
GX_RESOLUTIONS_LAST,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t old_input_state;
|
||||
@ -429,15 +184,6 @@ void menu_init(void);
|
||||
bool menu_iterate(void);
|
||||
void menu_free(void);
|
||||
|
||||
#ifdef HAVE_SHADER_MANAGER
|
||||
void shader_manager_init(void *data);
|
||||
void shader_manager_get_str(struct gfx_shader *shader,
|
||||
char *type_str, size_t type_str_size, unsigned type);
|
||||
void shader_manager_set_preset(struct gfx_shader *shader,
|
||||
enum rarch_shader_type type, const char *path);
|
||||
void shader_manager_save_preset(void *data, const char *basename, bool apply);
|
||||
#endif
|
||||
|
||||
void menu_ticker_line(char *buf, size_t len, unsigned tick, const char *str, bool selected);
|
||||
|
||||
void menu_init_core_info(void *data);
|
||||
|
@ -94,7 +94,8 @@ void preset_filename_callback(void *userdata, const char *str)
|
||||
{
|
||||
rgui_handle_t *rgui = (rgui_handle_t*)userdata;
|
||||
|
||||
shader_manager_save_preset(rgui, str && *str ? str : NULL, false);
|
||||
if (driver.menu_ctx && driver.menu_ctx->backend && driver.menu_ctx->backend->shader_manager_save_preset)
|
||||
driver.menu_ctx->backend->shader_manager_save_preset(rgui, str && *str ? str : NULL, false);
|
||||
menu_key_end_line(rgui);
|
||||
}
|
||||
#endif
|
||||
|
@ -596,12 +596,12 @@ MENU
|
||||
#include "../frontend/menu/menu_input_line_cb.c"
|
||||
#include "../frontend/menu/menu_common.c"
|
||||
#include "../frontend/menu/menu_navigation.c"
|
||||
#include "../frontend/menu/menu_settings.c"
|
||||
#include "../frontend/menu/history.c"
|
||||
#include "../frontend/menu/file_list.c"
|
||||
|
||||
#if defined(HAVE_RMENU) || defined(HAVE_RGUI) || defined(HAVE_RMENU_XUI)
|
||||
#include "../frontend/menu/backend/menu_common_backend.c"
|
||||
#include "../frontend/menu/backend/menu_common_settings.c"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RMENU
|
||||
|
Loading…
Reference in New Issue
Block a user