Merge pull request #11053 from Ryunam/screenshot-adjustments

Adjustments to Screenshot Notification options
This commit is contained in:
Autechre 2020-07-20 20:23:38 +02:00 committed by GitHub
commit 80763e0376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 113 additions and 24 deletions

View File

@ -773,9 +773,9 @@ static const bool audio_enable_menu_bgm = false;
/*Desired duration of the screenshot notification*/
#define DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_DURATION 0
/* Display a white flashing effect when
* taking a screenshot*/
#define DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH true
/* Display a white flashing effect with the desired
* duration when taking a screenshot*/
#define DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH 0
/* Output samplerate. */
#ifdef GEKKO

View File

@ -1481,7 +1481,6 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("notification_show_fast_forward", &settings->bools.notification_show_fast_forward, true, DEFAULT_NOTIFICATION_SHOW_FAST_FORWARD, false);
#ifdef HAVE_SCREENSHOTS
SETTING_BOOL("notification_show_screenshot", &settings->bools.notification_show_screenshot, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT, false);
SETTING_BOOL("notification_show_screenshot_flash", &settings->bools.notification_show_screenshot_flash, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH, false);
#endif
SETTING_BOOL("menu_widget_scale_auto", &settings->bools.menu_widget_scale_auto, true, DEFAULT_MENU_WIDGET_SCALE_AUTO, false);
SETTING_BOOL("audio_enable_menu", &settings->bools.audio_enable_menu, true, audio_enable_menu, false);
@ -1923,6 +1922,7 @@ static struct config_uint_setting *populate_settings_uint(
SETTING_UINT("aspect_ratio_index", &settings->uints.video_aspect_ratio_idx, true, DEFAULT_ASPECT_RATIO_IDX, false);
#ifdef HAVE_SCREENSHOTS
SETTING_UINT("notification_show_screenshot_duration", &settings->uints.notification_show_screenshot_duration, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_DURATION, false);
SETTING_UINT("notification_show_screenshot_flash", &settings->uints.notification_show_screenshot_flash, true, DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH, false);
#endif
#ifdef HAVE_NETWORKING
SETTING_UINT("netplay_ip_port", &settings->uints.netplay_port, true, RARCH_DEFAULT_PORT, false);

View File

@ -166,7 +166,6 @@ typedef struct settings
bool notification_show_set_initial_disk;
bool notification_show_fast_forward;
bool notification_show_screenshot;
bool notification_show_screenshot_flash;
bool menu_widget_scale_auto;
bool menu_show_start_screen;
bool menu_pause_libretro;
@ -563,6 +562,7 @@ typedef struct settings
#endif
unsigned video_shader_delay;
unsigned notification_show_screenshot_duration;
unsigned notification_show_screenshot_flash;
/* Accessibility */
unsigned accessibility_narrator_speech_speed;

View File

@ -77,6 +77,14 @@ enum notification_show_screenshot_duration
NOTIFICATION_SHOW_SCREENSHOT_DURATION_LAST
};
enum notification_show_screenshot_flash
{
NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL = 0,
NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST,
NOTIFICATION_SHOW_SCREENSHOT_FLASH_OFF,
NOTIFICATION_SHOW_SCREENSHOT_FLASH_LAST
};
/* This structure holds all objects + metadata
* corresponding to a particular font */
typedef struct

View File

@ -74,35 +74,57 @@ static gfx_widget_screenshot_state_t* gfx_widget_screenshot_get_ptr(void)
static void gfx_widget_screenshot_fadeout(void *userdata)
{
settings_t *settings = config_get_ptr();
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)userdata;
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
gfx_animation_ctx_entry_t entry;
entry.cb = NULL;
entry.duration = SCREENSHOT_DURATION_OUT;
entry.easing_enum = EASING_OUT_QUAD;
entry.subject = &state->alpha;
entry.tag = gfx_widgets_get_generic_tag(p_dispwidget);
entry.target_value = 0.0f;
entry.userdata = NULL;
switch (settings->uints.notification_show_screenshot_flash)
{
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST:
entry.duration = SCREENSHOT_DURATION_OUT/2;
break;
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL:
default:
entry.duration = SCREENSHOT_DURATION_OUT;
break;
}
gfx_animation_push(&entry);
}
static void gfx_widgets_play_screenshot_flash(void *data)
{
settings_t *settings = config_get_ptr();
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data;
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
gfx_animation_ctx_entry_t entry;
entry.cb = gfx_widget_screenshot_fadeout;
entry.duration = SCREENSHOT_DURATION_IN;
entry.easing_enum = EASING_IN_QUAD;
entry.subject = &state->alpha;
entry.tag = gfx_widgets_get_generic_tag(p_dispwidget);
entry.target_value = 1.0f;
entry.userdata = p_dispwidget;
switch (settings->uints.notification_show_screenshot_flash)
{
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST:
entry.duration = SCREENSHOT_DURATION_IN/2;
break;
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL:
default:
entry.duration = SCREENSHOT_DURATION_IN;
break;
}
gfx_animation_push(&entry);
}
@ -110,11 +132,11 @@ void gfx_widget_screenshot_taken(
void *data,
const char *shotname, const char *filename)
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)data;
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
if (settings->bools.notification_show_screenshot_flash)
if (settings->uints.notification_show_screenshot_flash != NOTIFICATION_SHOW_SCREENSHOT_FLASH_OFF)
gfx_widgets_play_screenshot_flash(p_dispwidget);
if (settings->bools.notification_show_screenshot)
@ -135,18 +157,33 @@ static void gfx_widget_screenshot_dispose(void *userdata)
static void gfx_widget_screenshot_end(void *userdata)
{
gfx_animation_ctx_entry_t entry;
settings_t *settings = config_get_ptr();
dispgfx_widget_t *p_dispwidget = (dispgfx_widget_t*)userdata;
gfx_widget_screenshot_state_t* state = gfx_widget_screenshot_get_ptr();
gfx_animation_ctx_entry_t entry;
entry.cb = gfx_widget_screenshot_dispose;
entry.duration = MSG_QUEUE_ANIMATION_DURATION;
entry.easing_enum = EASING_OUT_QUAD;
entry.subject = &state->y;
entry.tag = gfx_widgets_get_generic_tag(p_dispwidget);
entry.target_value = -((float)state->height);
entry.userdata = NULL;
switch (settings->uints.notification_show_screenshot_duration)
{
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST:
entry.duration = MSG_QUEUE_ANIMATION_DURATION/1.25;
break;
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST:
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT:
entry.duration = MSG_QUEUE_ANIMATION_DURATION/1.5;
break;
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL:
default:
entry.duration = MSG_QUEUE_ANIMATION_DURATION;
break;
}
gfx_animation_push(&entry);
}
@ -285,9 +322,6 @@ static void gfx_widget_screenshot_iterate(
switch (settings->uints.notification_show_screenshot_duration)
{
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL:
timer.duration = 6000;
break;
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_FAST:
timer.duration = 2000;
break;
@ -297,6 +331,10 @@ static void gfx_widget_screenshot_iterate(
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT:
timer.duration = 1;
break;
case NOTIFICATION_SHOW_SCREENSHOT_DURATION_NORMAL:
default:
timer.duration = 6000;
break;
}
timer.userdata = p_dispwidget;

View File

@ -3490,7 +3490,15 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH,
"Display a white flashing effect on-screen when taking a screenshot."
"Display a white flashing effect on-screen with the desired duration when taking a screenshot."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL,
"ON (Normal)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST,
"ON (Fast)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_FONT_PATH,

View File

@ -7574,7 +7574,7 @@ unsigned menu_displaylist_build_list(
#ifdef HAVE_SCREENSHOTS
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION, PARSE_ONLY_UINT, false },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, PARSE_ONLY_BOOL, true },
{MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH, PARSE_ONLY_UINT, false },
#endif
};
@ -7600,15 +7600,20 @@ unsigned menu_displaylist_build_list(
menu_enable_widgets)
build_list[i].checked = true;
break;
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION:
#ifdef HAVE_SCREENSHOTS
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_DURATION:
if ( widgets_supported &&
menu_enable_widgets &&
notification_show_screenshot
)
build_list[i].checked = true;
#endif
break;
case MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH:
if ( widgets_supported &&
menu_enable_widgets)
build_list[i].checked = true;
break;
#endif
#endif
default:
break;

View File

@ -4537,6 +4537,31 @@ static void setting_get_string_representation_uint_notification_show_screenshot_
#endif
#endif
#ifdef HAVE_SCREENSHOTS
#ifdef HAVE_GFX_WIDGETS
static void setting_get_string_representation_uint_notification_show_screenshot_flash(
rarch_setting_t *setting,
char *s, size_t len)
{
if (!setting)
return;
switch (*setting->value.target.unsigned_integer)
{
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL), len);
break;
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST), len);
break;
case NOTIFICATION_SHOW_SCREENSHOT_FLASH_OFF:
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF), len);
break;
}
}
#endif
#endif
static void setting_get_string_representation_uint_video_monitor_index(rarch_setting_t *setting,
char *s, size_t len)
{
@ -12749,20 +12774,22 @@ static bool setting_append_list(
menu_settings_list_current_add_range(list, list_info, 0, NOTIFICATION_SHOW_SCREENSHOT_DURATION_LAST-1, 1, true, true);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
CONFIG_BOOL(
CONFIG_UINT(
list, list_info,
&settings->bools.notification_show_screenshot_flash,
&settings->uints.notification_show_screenshot_flash,
MENU_ENUM_LABEL_NOTIFICATION_SHOW_SCREENSHOT_FLASH,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH,
DEFAULT_NOTIFICATION_SHOW_SCREENSHOT_FLASH,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
general_read_handler);
(*list)[list_info->index - 1].action_ok = &setting_action_ok_uint;
(*list)[list_info->index - 1].get_string_representation =
&setting_get_string_representation_uint_notification_show_screenshot_flash;
menu_settings_list_current_add_range(list, list_info, 0, NOTIFICATION_SHOW_SCREENSHOT_FLASH_LAST-1, 1, true, true);
(*list)[list_info->index - 1].ui_type = ST_UI_TYPE_UINT_COMBOBOX;
#endif
#endif

View File

@ -2579,6 +2579,9 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_VERY_FAST,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_DURATION_INSTANT,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_NORMAL,
MENU_ENUM_LABEL_VALUE_NOTIFICATION_SHOW_SCREENSHOT_FLASH_FAST,
MENU_LABEL(SELECT_FILE),
MENU_LABEL(SELECT_FROM_PLAYLIST),