From 46ee5efbca65ef610e2b52299f3156ddc14437e2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 7 Sep 2015 21:22:19 +0200 Subject: [PATCH] Fix shader parameter left/right toggle --- menu/cbs/menu_cbs_left.c | 19 ++++++++++--------- menu/cbs/menu_cbs_right.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 2b7836e9e7..4af850e5eb 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -26,13 +26,11 @@ #include "../../general.h" #include "../../retroarch.h" -static int generic_shader_action_parameter_left(unsigned type, const char *label, - bool wraparound, unsigned param_id) +static int generic_shader_action_parameter_left( + struct video_shader *shader, struct video_shader_parameter *param, + unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER - struct video_shader *shader = video_shader_driver_get_current_shader(); - struct video_shader_parameter *param = &shader->parameters[type - param_id]; - if (shader) { param->current -= param->step; @@ -45,15 +43,18 @@ static int generic_shader_action_parameter_left(unsigned type, const char *label static int shader_action_parameter_left(unsigned type, const char *label, bool wraparound) { - return generic_shader_action_parameter_left(type, label, wraparound, - MENU_SETTINGS_SHADER_PARAMETER_0); + struct video_shader *shader = video_shader_driver_get_current_shader(); + struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; + return generic_shader_action_parameter_left(shader, param, type, label, wraparound); } static int shader_action_parameter_preset_left(unsigned type, const char *label, bool wraparound) { - return generic_shader_action_parameter_left(type, label, wraparound, - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0); + menu_handle_t *menu = menu_driver_get_ptr(); + struct video_shader *shader = menu ? menu->shader : NULL; + struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0]; + return generic_shader_action_parameter_left(shader, param, type, label, wraparound); } static int action_left_cheat(unsigned type, const char *label, diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index cd10626a72..4c798dc8dc 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -27,14 +27,13 @@ #include "../../retroarch.h" -static int generic_shader_action_parameter_right(unsigned type, const char *label, - bool wraparound, unsigned param_id) +static int generic_shader_action_parameter_right( + struct video_shader *shader, struct video_shader_parameter *param, + unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER driver_t *driver = driver_get_ptr(); const ui_companion_driver_t *ui = ui_companion_get_ptr(); - struct video_shader *shader = video_shader_driver_get_current_shader(); - struct video_shader_parameter *param = &shader->parameters[type - param_id]; if (!shader) return -1; @@ -51,8 +50,9 @@ static int generic_shader_action_parameter_right(unsigned type, const char *labe int shader_action_parameter_right(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER - return generic_shader_action_parameter_right(type, label, wraparound, - MENU_SETTINGS_SHADER_PARAMETER_0); + struct video_shader *shader = video_shader_driver_get_current_shader(); + struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PARAMETER_0]; + return generic_shader_action_parameter_right(shader, param, type, label, wraparound); #else return 0; #endif @@ -62,8 +62,10 @@ int shader_action_parameter_preset_right(unsigned type, const char *label, bool wraparound) { #ifdef HAVE_SHADER_MANAGER - return generic_shader_action_parameter_right(type, label, wraparound, - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0); + menu_handle_t *menu = menu_driver_get_ptr(); + struct video_shader *shader = menu ? menu->shader : NULL; + struct video_shader_parameter *param = &shader->parameters[type - MENU_SETTINGS_SHADER_PRESET_PARAMETER_0]; + return generic_shader_action_parameter_right(shader, param, type, label, wraparound); #else return 0; #endif