mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
(Menu) Cleanups - rewrite code dependent on settings pointer
grabbing
This commit is contained in:
parent
0b0ac03bed
commit
42c3072ff9
2 changed files with 55 additions and 52 deletions
|
@ -852,6 +852,9 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||||
size_t list_size = playlist_size(playlist);
|
size_t list_size = playlist_size(playlist);
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool show_inline_core_name = false;
|
bool show_inline_core_name = false;
|
||||||
|
const char *menu_driver = settings->arrays.menu_driver;
|
||||||
|
unsigned pl_show_inline_core_name = settings->uints.playlist_show_inline_core_name;
|
||||||
|
bool pl_show_sublabels = settings->bools.playlist_show_sublabels;
|
||||||
void (*sanitization)(char*);
|
void (*sanitization)(char*);
|
||||||
|
|
||||||
label_spacer[0] = '\0';
|
label_spacer[0] = '\0';
|
||||||
|
@ -860,16 +863,16 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* Check whether core name should be added to playlist entries */
|
/* Check whether core name should be added to playlist entries */
|
||||||
if (!string_is_equal(settings->arrays.menu_driver, "ozone") &&
|
if (!string_is_equal(menu_driver, "ozone") &&
|
||||||
!settings->bools.playlist_show_sublabels &&
|
!pl_show_sublabels &&
|
||||||
((settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS) ||
|
((pl_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_ALWAYS) ||
|
||||||
(!is_collection && !(settings->uints.playlist_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_NEVER))))
|
(!is_collection && !(pl_show_inline_core_name == PLAYLIST_INLINE_CORE_DISPLAY_NEVER))))
|
||||||
{
|
{
|
||||||
show_inline_core_name = true;
|
show_inline_core_name = true;
|
||||||
|
|
||||||
/* Get spacer for menu entry labels (<content><spacer><core>)
|
/* Get spacer for menu entry labels (<content><spacer><core>)
|
||||||
* > Note: Only required when showing inline core names */
|
* > Note: Only required when showing inline core names */
|
||||||
if (string_is_equal(settings->arrays.menu_driver, "rgui"))
|
if (string_is_equal(menu_driver, "rgui"))
|
||||||
strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer));
|
strlcpy(label_spacer, PL_LABEL_SPACER_RGUI, sizeof(label_spacer));
|
||||||
else
|
else
|
||||||
strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer));
|
strlcpy(label_spacer, PL_LABEL_SPACER_DEFAULT, sizeof(label_spacer));
|
||||||
|
|
|
@ -334,27 +334,27 @@ static bool menu_shader_manager_operate_auto_preset(enum auto_shader_operation o
|
||||||
char tmp[PATH_MAX_LENGTH];
|
char tmp[PATH_MAX_LENGTH];
|
||||||
char directory[PATH_MAX_LENGTH];
|
char directory[PATH_MAX_LENGTH];
|
||||||
char file[PATH_MAX_LENGTH];
|
char file[PATH_MAX_LENGTH];
|
||||||
settings_t *settings = config_get_ptr();
|
bool success = false;
|
||||||
struct retro_system_info *system = runloop_get_libretro_system_info();
|
settings_t *settings = config_get_ptr();
|
||||||
const char *core_name = system ? system->library_name : NULL;
|
struct retro_system_info *system = runloop_get_libretro_system_info();
|
||||||
|
const char *core_name = system ? system->library_name : NULL;
|
||||||
|
const char *path_dir_video_shader = settings->paths.directory_video_shader;
|
||||||
|
|
||||||
tmp[0] = directory[0] = file[0] = '\0';
|
tmp[0] = directory[0] = file[0] = '\0';
|
||||||
|
|
||||||
if (type == SHADER_PRESET_GLOBAL)
|
if (type == SHADER_PRESET_GLOBAL)
|
||||||
{
|
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
directory,
|
directory,
|
||||||
settings->paths.directory_video_shader,
|
path_dir_video_shader,
|
||||||
"presets",
|
"presets",
|
||||||
sizeof(directory));
|
sizeof(directory));
|
||||||
}
|
|
||||||
else if (string_is_empty(core_name))
|
else if (string_is_empty(core_name))
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
tmp,
|
tmp,
|
||||||
settings->paths.directory_video_shader,
|
path_dir_video_shader,
|
||||||
"presets",
|
"presets",
|
||||||
sizeof(tmp));
|
sizeof(tmp));
|
||||||
fill_pathname_join(
|
fill_pathname_join(
|
||||||
|
@ -390,55 +390,55 @@ static bool menu_shader_manager_operate_auto_preset(enum auto_shader_operation o
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == AUTO_SHADER_OP_SAVE)
|
switch (op)
|
||||||
{
|
{
|
||||||
if (!path_is_directory(directory))
|
case AUTO_SHADER_OP_SAVE:
|
||||||
path_mkdir(directory);
|
if (!path_is_directory(directory))
|
||||||
|
path_mkdir(directory);
|
||||||
|
|
||||||
return menu_shader_manager_save_preset_internal(
|
return menu_shader_manager_save_preset_internal(
|
||||||
shader, file, apply, true);
|
shader, file, apply, true);
|
||||||
}
|
case AUTO_SHADER_OP_REMOVE:
|
||||||
else if (op == AUTO_SHADER_OP_REMOVE)
|
{
|
||||||
{
|
/* remove all supported auto-shaders of given type */
|
||||||
/* remove all supported auto-shaders of given type */
|
char *end = file + strlen(file);
|
||||||
char *end = file + strlen(file);
|
size_t i;
|
||||||
size_t i;
|
for (i = 0; i < ARRAY_SIZE(shader_types); i++)
|
||||||
bool success = false;
|
{
|
||||||
|
const char *preset_ext;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(shader_types); i++)
|
if (!video_shader_is_supported(shader_types[i]))
|
||||||
{
|
continue;
|
||||||
const char *preset_ext;
|
|
||||||
|
|
||||||
if (!video_shader_is_supported(shader_types[i]))
|
preset_ext = video_shader_get_preset_extension(shader_types[i]);
|
||||||
continue;
|
strlcpy(end, preset_ext, sizeof(file) - (end-file));
|
||||||
|
|
||||||
preset_ext = video_shader_get_preset_extension(shader_types[i]);
|
if (!filestream_delete(file))
|
||||||
strlcpy(end, preset_ext, sizeof(file) - (end-file));
|
success = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
case AUTO_SHADER_OP_EXISTS:
|
||||||
|
{
|
||||||
|
/* test if any supported auto-shaders of given type exists */
|
||||||
|
char *end = file + strlen(file);
|
||||||
|
size_t i;
|
||||||
|
|
||||||
if (!filestream_delete(file))
|
for (i = 0; i < ARRAY_SIZE(shader_types); i++)
|
||||||
success = true;
|
{
|
||||||
}
|
const char *preset_ext;
|
||||||
return success;
|
|
||||||
}
|
|
||||||
else if (op == AUTO_SHADER_OP_EXISTS)
|
|
||||||
{
|
|
||||||
/* test if any supported auto-shaders of given type exists */
|
|
||||||
char *end = file + strlen(file);
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(shader_types); i++)
|
if (!video_shader_is_supported(shader_types[i]))
|
||||||
{
|
continue;
|
||||||
const char *preset_ext;
|
|
||||||
|
|
||||||
if (!video_shader_is_supported(shader_types[i]))
|
preset_ext = video_shader_get_preset_extension(shader_types[i]);
|
||||||
continue;
|
strlcpy(end, preset_ext, sizeof(file) - (end-file));
|
||||||
|
|
||||||
preset_ext = video_shader_get_preset_extension(shader_types[i]);
|
if (path_is_valid(file))
|
||||||
strlcpy(end, preset_ext, sizeof(file) - (end-file));
|
return true;
|
||||||
|
}
|
||||||
if (path_is_valid(file))
|
}
|
||||||
return true;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue