mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
move default_shader_preste code to paths.c
This commit is contained in:
parent
4fc66e4100
commit
8e6d9a6978
@ -1403,8 +1403,7 @@ static void command_event_restore_default_shader_preset(void)
|
||||
|
||||
char *preset = NULL;
|
||||
|
||||
if (runloop_ctl(RUNLOOP_CTL_GET_DEFAULT_SHADER_PRESET, &preset) &&
|
||||
!string_is_empty(preset))
|
||||
if (path_get_default_shader_preset(&preset) && !string_is_empty(preset))
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
@ -1413,7 +1412,7 @@ static void command_event_restore_default_shader_preset(void)
|
||||
strlcpy(settings->path.shader, preset, sizeof(settings->path.shader));
|
||||
}
|
||||
|
||||
runloop_ctl(RUNLOOP_CTL_CLEAR_DEFAULT_SHADER_PRESET, NULL);
|
||||
path_clear_default_shader_preset();
|
||||
}
|
||||
|
||||
static bool command_event_save_auto_state(void)
|
||||
|
@ -2523,7 +2523,8 @@ bool config_load_shader_preset(void)
|
||||
|
||||
/* Game shader preset exists, load it. */
|
||||
RARCH_LOG("Shaders: game-specific shader preset found at %s.\n", game_path);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_DEFAULT_SHADER_PRESET, settings->path.shader);
|
||||
|
||||
path_set_default_shader_preset(settings->path.shader);
|
||||
strlcpy(settings->path.shader, game_path, sizeof(settings->path.shader));
|
||||
config_file_free(new_conf);
|
||||
return true;
|
||||
@ -2553,7 +2554,7 @@ bool config_load_shader_preset(void)
|
||||
|
||||
/* Core shader preset exists, load it. */
|
||||
RARCH_LOG("Shaders: core-specific shader preset found at %s.\n", core_path);
|
||||
runloop_ctl(RUNLOOP_CTL_SET_DEFAULT_SHADER_PRESET, settings->path.shader);
|
||||
path_set_default_shader_preset(settings->path.shader);
|
||||
strlcpy(settings->path.shader, core_path, sizeof(settings->path.shader));
|
||||
config_file_free(new_conf);
|
||||
return true;
|
||||
|
23
paths.c
23
paths.c
@ -48,6 +48,7 @@
|
||||
|
||||
#define MENU_VALUE_NO_CORE 0x7d5472cbU
|
||||
|
||||
static char runloop_default_shader_preset[PATH_MAX_LENGTH] = {0};
|
||||
static char path_main_basename[PATH_MAX_LENGTH] = {0}
|
||||
;
|
||||
static char path_content[PATH_MAX_LENGTH] = {0};
|
||||
@ -486,6 +487,11 @@ void path_clear_core(void)
|
||||
*path_libretro = '\0';
|
||||
}
|
||||
|
||||
void path_clear_default_shader_preset(void)
|
||||
{
|
||||
*runloop_default_shader_preset = '\0';
|
||||
}
|
||||
|
||||
/* Config file path */
|
||||
|
||||
bool path_is_config_empty(void)
|
||||
@ -509,6 +515,14 @@ const char *path_get_config(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool path_get_default_shader_preset(char **preset)
|
||||
{
|
||||
if (!preset)
|
||||
return false;
|
||||
*preset = (char*)runloop_default_shader_preset;
|
||||
return true;
|
||||
}
|
||||
|
||||
void path_clear_config(void)
|
||||
{
|
||||
*path_config_file = '\0';
|
||||
@ -534,6 +548,15 @@ void path_clear_core_options(void)
|
||||
*path_core_options_file = '\0';
|
||||
}
|
||||
|
||||
bool path_set_default_shader_preset(const char *preset)
|
||||
{
|
||||
if (!preset)
|
||||
return false;
|
||||
strlcpy(runloop_default_shader_preset, preset,
|
||||
sizeof(runloop_default_shader_preset));
|
||||
return true;
|
||||
}
|
||||
|
||||
void path_set_core_options(const char *path)
|
||||
{
|
||||
strlcpy(path_core_options_file, path, sizeof(path_core_options_file));
|
||||
|
6
paths.h
6
paths.h
@ -57,6 +57,8 @@ void path_set_config(const char *path);
|
||||
|
||||
void path_set_config_append(const char *path);
|
||||
|
||||
bool path_set_default_shader_preset(const char *preset);
|
||||
|
||||
/* get size functions */
|
||||
|
||||
size_t path_get_core_size(void);
|
||||
@ -81,8 +83,12 @@ const char *path_get_config(void);
|
||||
|
||||
const char *path_get_config_append(void);
|
||||
|
||||
bool path_get_default_shader_preset(char **preset);
|
||||
|
||||
/* clear functions */
|
||||
|
||||
void path_clear_default_shader_preset(void);
|
||||
|
||||
void path_clear_basename(void);
|
||||
|
||||
void path_clear_content(void);
|
||||
|
21
runloop.c
21
runloop.c
@ -106,7 +106,6 @@ typedef struct event_cmd_state
|
||||
|
||||
static rarch_system_info_t runloop_system;
|
||||
static struct retro_frame_time_callback runloop_frame_time;
|
||||
static char runloop_default_shader_preset[PATH_MAX_LENGTH] = {0};
|
||||
static retro_keyboard_event_t runloop_key_event = NULL;
|
||||
static retro_keyboard_event_t runloop_frontend_key_event = NULL;
|
||||
static core_option_manager_t *runloop_core_options = NULL;
|
||||
@ -716,26 +715,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
||||
path_set_core(fullpath);
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_CLEAR_DEFAULT_SHADER_PRESET:
|
||||
*runloop_default_shader_preset = '\0';
|
||||
break;
|
||||
case RUNLOOP_CTL_GET_DEFAULT_SHADER_PRESET:
|
||||
{
|
||||
char **preset = (char**)data;
|
||||
if (!preset)
|
||||
return false;
|
||||
*preset = (char*)runloop_default_shader_preset;
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_SET_DEFAULT_SHADER_PRESET:
|
||||
{
|
||||
const char *preset = (const char*)data;
|
||||
if (!preset)
|
||||
return false;
|
||||
strlcpy(runloop_default_shader_preset, preset,
|
||||
sizeof(runloop_default_shader_preset));
|
||||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_FRAME_TIME_FREE:
|
||||
memset(&runloop_frame_time, 0,
|
||||
sizeof(struct retro_frame_time_callback));
|
||||
|
@ -62,10 +62,6 @@ enum runloop_ctl_state
|
||||
RUNLOOP_CTL_SET_NONBLOCK_FORCED,
|
||||
RUNLOOP_CTL_UNSET_NONBLOCK_FORCED,
|
||||
|
||||
RUNLOOP_CTL_GET_DEFAULT_SHADER_PRESET,
|
||||
RUNLOOP_CTL_SET_DEFAULT_SHADER_PRESET,
|
||||
RUNLOOP_CTL_CLEAR_DEFAULT_SHADER_PRESET,
|
||||
|
||||
RUNLOOP_CTL_SET_LIBRETRO_PATH,
|
||||
|
||||
RUNLOOP_CTL_IS_SLOWMOTION,
|
||||
|
Loading…
x
Reference in New Issue
Block a user