mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
(menu_shader.c) Remove configuration.h dependency
This commit is contained in:
parent
699a21fa87
commit
b7a17442d9
@ -2731,6 +2731,7 @@ static void menu_input_st_string_cb_save_preset(void *userdata,
|
||||
if (!string_is_empty(str))
|
||||
{
|
||||
rarch_setting_t *setting = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool ret = false;
|
||||
const char *label = menu_input_dialog_get_label_buffer();
|
||||
|
||||
@ -2744,7 +2745,10 @@ static void menu_input_st_string_cb_save_preset(void *userdata,
|
||||
}
|
||||
else if (!string_is_empty(label))
|
||||
ret = menu_shader_manager_save_preset(menu_shader_get(),
|
||||
str, true);
|
||||
str,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
true);
|
||||
|
||||
if (ret)
|
||||
runloop_msg_queue_push(
|
||||
@ -2849,6 +2853,8 @@ static int generic_action_ok_shader_preset_remove(const char *path,
|
||||
unsigned action_type)
|
||||
{
|
||||
enum auto_shader_type preset_type;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (action_type)
|
||||
{
|
||||
case ACTION_OK_SHADER_PRESET_REMOVE_GLOBAL:
|
||||
@ -2867,7 +2873,9 @@ static int generic_action_ok_shader_preset_remove(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (menu_shader_manager_remove_auto_preset(preset_type))
|
||||
if (menu_shader_manager_remove_auto_preset(preset_type,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config))
|
||||
{
|
||||
bool refresh = false;
|
||||
|
||||
@ -2892,6 +2900,8 @@ static int generic_action_ok_shader_preset_save(const char *path,
|
||||
unsigned action_type)
|
||||
{
|
||||
enum auto_shader_type preset_type;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (action_type)
|
||||
{
|
||||
case ACTION_OK_SHADER_PRESET_SAVE_GLOBAL:
|
||||
@ -2910,7 +2920,10 @@ static int generic_action_ok_shader_preset_save(const char *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type, true))
|
||||
if (menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
true))
|
||||
runloop_msg_queue_push(
|
||||
msg_hash_to_str(MSG_SHADER_PRESET_SAVED_SUCCESSFULLY),
|
||||
1, 100, true,
|
||||
|
@ -4239,7 +4239,11 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||
case DISPLAYLIST_SHADER_PRESET_REMOVE:
|
||||
{
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL))
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
))
|
||||
if (menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GLOBAL),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GLOBAL),
|
||||
@ -4247,7 +4251,10 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE))
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
))
|
||||
if (menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_CORE),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_CORE),
|
||||
@ -4255,7 +4262,10 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT))
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
))
|
||||
if (menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_PARENT),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_PARENT),
|
||||
@ -4263,7 +4273,10 @@ unsigned menu_displaylist_build_list(file_list_t *list, enum menu_displaylist_ct
|
||||
MENU_SETTING_ACTION, 0, 0))
|
||||
count++;
|
||||
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME))
|
||||
if (menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
))
|
||||
if (menu_entries_append_enum(list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_VIDEO_SHADER_PRESET_REMOVE_GAME),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VIDEO_SHADER_PRESET_REMOVE_GAME),
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "menu_driver.h"
|
||||
#include "menu_shader.h"
|
||||
#include "../file_path_special.h"
|
||||
#include "../configuration.h"
|
||||
#include "../paths.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../verbosity.h"
|
||||
@ -468,14 +467,17 @@ static bool menu_shader_manager_operate_auto_preset(
|
||||
* Needs to be consistent with retroarch_load_shader_preset()
|
||||
* Auto-shaders will be saved as a reference if possible
|
||||
**/
|
||||
bool menu_shader_manager_save_auto_preset(const struct video_shader *shader,
|
||||
enum auto_shader_type type, bool apply)
|
||||
bool menu_shader_manager_save_auto_preset(
|
||||
const struct video_shader *shader,
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config,
|
||||
bool apply)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return menu_shader_manager_operate_auto_preset(
|
||||
AUTO_SHADER_OP_SAVE, shader,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
dir_video_shader,
|
||||
dir_menu_config,
|
||||
type, apply);
|
||||
}
|
||||
|
||||
@ -489,13 +491,15 @@ bool menu_shader_manager_save_auto_preset(const struct video_shader *shader,
|
||||
* Save a shader preset to disk.
|
||||
**/
|
||||
bool menu_shader_manager_save_preset(const struct video_shader *shader,
|
||||
const char *basename, bool apply)
|
||||
const char *basename,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config,
|
||||
bool apply)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return menu_shader_manager_save_preset_internal(
|
||||
shader, basename,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
dir_video_shader,
|
||||
dir_menu_config,
|
||||
apply, false);
|
||||
}
|
||||
|
||||
@ -505,13 +509,15 @@ bool menu_shader_manager_save_preset(const struct video_shader *shader,
|
||||
*
|
||||
* Deletes an auto-shader.
|
||||
**/
|
||||
bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type)
|
||||
bool menu_shader_manager_remove_auto_preset(
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return menu_shader_manager_operate_auto_preset(
|
||||
AUTO_SHADER_OP_REMOVE, NULL,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
dir_video_shader,
|
||||
dir_menu_config,
|
||||
type, false);
|
||||
}
|
||||
|
||||
@ -521,13 +527,15 @@ bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type)
|
||||
*
|
||||
* Tests if an auto-shader of the given type exists.
|
||||
**/
|
||||
bool menu_shader_manager_auto_preset_exists(enum auto_shader_type type)
|
||||
bool menu_shader_manager_auto_preset_exists(
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
return menu_shader_manager_operate_auto_preset(
|
||||
AUTO_SHADER_OP_EXISTS, NULL,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
dir_video_shader,
|
||||
dir_menu_config,
|
||||
type, false);
|
||||
}
|
||||
|
||||
@ -668,7 +676,10 @@ enum rarch_shader_type menu_shader_manager_get_type(
|
||||
*
|
||||
* Apply shader state changes.
|
||||
**/
|
||||
void menu_shader_manager_apply_changes(struct video_shader *shader)
|
||||
void menu_shader_manager_apply_changes(
|
||||
struct video_shader *shader,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config)
|
||||
{
|
||||
enum rarch_shader_type type = RARCH_SHADER_NONE;
|
||||
|
||||
@ -679,7 +690,8 @@ void menu_shader_manager_apply_changes(struct video_shader *shader)
|
||||
|
||||
if (shader->passes && type != RARCH_SHADER_NONE)
|
||||
{
|
||||
menu_shader_manager_save_preset(shader, NULL, true);
|
||||
menu_shader_manager_save_preset(shader, NULL,
|
||||
dir_video_shader, dir_menu_config, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,12 @@ bool menu_shader_manager_set_preset(
|
||||
* Needs to be consistent with retroarch_load_shader_preset()
|
||||
* Auto-shaders will be saved as a reference if possible
|
||||
**/
|
||||
bool menu_shader_manager_save_auto_preset(const struct video_shader *shader,
|
||||
enum auto_shader_type type, bool apply);
|
||||
bool menu_shader_manager_save_auto_preset(
|
||||
const struct video_shader *shader,
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config,
|
||||
bool apply);
|
||||
|
||||
/**
|
||||
* menu_shader_manager_save_preset:
|
||||
@ -82,7 +86,10 @@ bool menu_shader_manager_save_auto_preset(const struct video_shader *shader,
|
||||
* Save a shader preset to disk.
|
||||
**/
|
||||
bool menu_shader_manager_save_preset(const struct video_shader *shader,
|
||||
const char *basename, bool apply);
|
||||
const char *basename,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config,
|
||||
bool apply);
|
||||
|
||||
/**
|
||||
* menu_shader_manager_get_type:
|
||||
@ -100,7 +107,10 @@ enum rarch_shader_type menu_shader_manager_get_type(
|
||||
*
|
||||
* Apply shader state changes.
|
||||
**/
|
||||
void menu_shader_manager_apply_changes(struct video_shader *shader);
|
||||
void menu_shader_manager_apply_changes(
|
||||
struct video_shader *shader,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config);
|
||||
|
||||
int menu_shader_manager_clear_num_passes(struct video_shader *shader);
|
||||
|
||||
@ -122,9 +132,15 @@ void menu_shader_manager_clear_pass_path(struct video_shader *shader,
|
||||
*
|
||||
* Deletes an auto-shader.
|
||||
**/
|
||||
bool menu_shader_manager_remove_auto_preset(enum auto_shader_type type);
|
||||
bool menu_shader_manager_remove_auto_preset(
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config);
|
||||
|
||||
bool menu_shader_manager_auto_preset_exists(enum auto_shader_type type);
|
||||
bool menu_shader_manager_auto_preset_exists(
|
||||
enum auto_shader_type type,
|
||||
const char *dir_video_shader,
|
||||
const char *dir_menu_config);
|
||||
|
||||
void menu_shader_set_modified(bool modified);
|
||||
|
||||
|
@ -7255,7 +7255,10 @@ TODO: Add a setting for these tweaks */
|
||||
case CMD_EVENT_SHADERS_APPLY_CHANGES:
|
||||
#ifdef HAVE_MENU
|
||||
#if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL)
|
||||
menu_shader_manager_apply_changes(menu_shader_get());
|
||||
menu_shader_manager_apply_changes(menu_shader_get(),
|
||||
configuration_settings->paths.directory_video_shader,
|
||||
configuration_settings->paths.directory_menu_config
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
ui_companion_event_command(cmd);
|
||||
|
@ -697,6 +697,7 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign
|
||||
{
|
||||
bool ret;
|
||||
enum auto_shader_type preset_type;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
switch (action_type)
|
||||
{
|
||||
@ -721,9 +722,16 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign
|
||||
if (save)
|
||||
{
|
||||
if (action_type == QT_SHADER_PRESET_NORMAL)
|
||||
ret = menu_shader_manager_save_preset(menu_shader_get(), path, true);
|
||||
ret = menu_shader_manager_save_preset(menu_shader_get(), path,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
true);
|
||||
else
|
||||
ret = menu_shader_manager_save_auto_preset(menu_shader_get(), preset_type, true);
|
||||
ret = menu_shader_manager_save_auto_preset(menu_shader_get(),
|
||||
preset_type,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config,
|
||||
true);
|
||||
|
||||
if (ret)
|
||||
runloop_msg_queue_push(
|
||||
@ -743,7 +751,9 @@ void ShaderParamsDialog::operateShaderPreset(bool save, const char *path, unsign
|
||||
else
|
||||
{
|
||||
if (action_type != QT_SHADER_PRESET_NORMAL &&
|
||||
menu_shader_manager_remove_auto_preset(preset_type))
|
||||
menu_shader_manager_remove_auto_preset(preset_type,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config))
|
||||
{
|
||||
#ifdef HAVE_MENU
|
||||
bool refresh = false;
|
||||
@ -881,14 +891,27 @@ void ShaderParamsDialog::onShaderApplyClicked()
|
||||
|
||||
void ShaderParamsDialog::updateRemovePresetButtonsState()
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (removeGlobalPresetAction)
|
||||
removeGlobalPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL));
|
||||
removeGlobalPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GLOBAL,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
));
|
||||
if (removeCorePresetAction)
|
||||
removeCorePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE));
|
||||
removeCorePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_CORE,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
));
|
||||
if (removeParentPresetAction)
|
||||
removeParentPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT));
|
||||
removeParentPresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_PARENT,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
));
|
||||
if (removeGamePresetAction)
|
||||
removeGamePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME));
|
||||
removeGamePresetAction->setEnabled(menu_shader_manager_auto_preset_exists(SHADER_PRESET_GAME,
|
||||
settings->paths.directory_video_shader,
|
||||
settings->paths.directory_menu_config
|
||||
));
|
||||
}
|
||||
|
||||
void ShaderParamsDialog::reload()
|
||||
|
Loading…
x
Reference in New Issue
Block a user