mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-23 16:09:47 +00:00
Integer overscale option
This commit is contained in:
parent
55afe18872
commit
b483f233d2
@ -380,8 +380,10 @@
|
|||||||
/* Only scale in integer steps.
|
/* Only scale in integer steps.
|
||||||
* The base size depends on system-reported geometry and aspect ratio.
|
* The base size depends on system-reported geometry and aspect ratio.
|
||||||
* If video_force_aspect is not set, X/Y will be integer scaled independently.
|
* If video_force_aspect is not set, X/Y will be integer scaled independently.
|
||||||
|
* Overscale rounds up instead of down, default is downscale.
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_SCALE_INTEGER false
|
#define DEFAULT_SCALE_INTEGER false
|
||||||
|
#define DEFAULT_SCALE_INTEGER_OVERSCALE false
|
||||||
|
|
||||||
/* Controls aspect ratio handling. */
|
/* Controls aspect ratio handling. */
|
||||||
|
|
||||||
|
@ -1530,6 +1530,7 @@ static struct config_bool_setting *populate_settings_bool(
|
|||||||
SETTING_BOOL("video_windowed_fullscreen", &settings->bools.video_windowed_fullscreen, true, DEFAULT_WINDOWED_FULLSCREEN, false);
|
SETTING_BOOL("video_windowed_fullscreen", &settings->bools.video_windowed_fullscreen, true, DEFAULT_WINDOWED_FULLSCREEN, false);
|
||||||
SETTING_BOOL("video_crop_overscan", &settings->bools.video_crop_overscan, true, DEFAULT_CROP_OVERSCAN, false);
|
SETTING_BOOL("video_crop_overscan", &settings->bools.video_crop_overscan, true, DEFAULT_CROP_OVERSCAN, false);
|
||||||
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, DEFAULT_SCALE_INTEGER, false);
|
SETTING_BOOL("video_scale_integer", &settings->bools.video_scale_integer, true, DEFAULT_SCALE_INTEGER, false);
|
||||||
|
SETTING_BOOL("video_scale_integer_overscale", &settings->bools.video_scale_integer_overscale, true, DEFAULT_SCALE_INTEGER_OVERSCALE, false);
|
||||||
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, DEFAULT_VIDEO_SMOOTH, false);
|
SETTING_BOOL("video_smooth", &settings->bools.video_smooth, true, DEFAULT_VIDEO_SMOOTH, false);
|
||||||
SETTING_BOOL("video_ctx_scaling", &settings->bools.video_ctx_scaling, true, DEFAULT_VIDEO_CTX_SCALING, false);
|
SETTING_BOOL("video_ctx_scaling", &settings->bools.video_ctx_scaling, true, DEFAULT_VIDEO_CTX_SCALING, false);
|
||||||
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, DEFAULT_FORCE_ASPECT, false);
|
SETTING_BOOL("video_force_aspect", &settings->bools.video_force_aspect, true, DEFAULT_FORCE_ASPECT, false);
|
||||||
|
@ -497,6 +497,7 @@ typedef struct settings
|
|||||||
bool video_aspect_ratio_auto;
|
bool video_aspect_ratio_auto;
|
||||||
bool video_dingux_ipu_keep_aspect;
|
bool video_dingux_ipu_keep_aspect;
|
||||||
bool video_scale_integer;
|
bool video_scale_integer;
|
||||||
|
bool video_scale_integer_overscale;
|
||||||
bool video_shader_enable;
|
bool video_shader_enable;
|
||||||
bool video_shader_watch_files;
|
bool video_shader_watch_files;
|
||||||
bool video_shader_remember_last_dir;
|
bool video_shader_remember_last_dir;
|
||||||
|
@ -3314,6 +3314,10 @@ MSG_HASH(
|
|||||||
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
||||||
"video_scale_integer"
|
"video_scale_integer"
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
"video_scale_integer_overscale"
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VIDEO_SETTINGS,
|
MENU_ENUM_LABEL_VIDEO_SETTINGS,
|
||||||
"video_settings"
|
"video_settings"
|
||||||
|
@ -1365,9 +1365,14 @@ int msg_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len)
|
|||||||
"The base size depends on system-reported \n"
|
"The base size depends on system-reported \n"
|
||||||
"geometry and aspect ratio.\n"
|
"geometry and aspect ratio.\n"
|
||||||
" \n"
|
" \n"
|
||||||
"If Force Aspect is not set, X/Y will be \n"
|
"If 'Force Aspect Ratio' is not set, X/Y will be \n"
|
||||||
"integer scaled independently.");
|
"integer scaled independently.");
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE:
|
||||||
|
snprintf(s, len,
|
||||||
|
"Force integer scaling to round up \n"
|
||||||
|
" to the next larger integer instead of rounding down.");
|
||||||
|
break;
|
||||||
case MENU_ENUM_LABEL_AUDIO_VOLUME:
|
case MENU_ENUM_LABEL_AUDIO_VOLUME:
|
||||||
snprintf(s, len,
|
snprintf(s, len,
|
||||||
"Audio volume, expressed in dB.\n"
|
"Audio volume, expressed in dB.\n"
|
||||||
|
@ -1631,6 +1631,14 @@ MSG_HASH(
|
|||||||
MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER,
|
MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER,
|
||||||
"Scale video in integer steps only. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect Ratio' is not set, X/Y will be integer scaled independently."
|
"Scale video in integer steps only. The base size depends on system-reported geometry and aspect ratio. If 'Force Aspect Ratio' is not set, X/Y will be integer scaled independently."
|
||||||
)
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
"Integer Scale Overscale"
|
||||||
|
)
|
||||||
|
MSG_HASH(
|
||||||
|
MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
"Force integer scaling to round up to the next larger integer instead of rounding down."
|
||||||
|
)
|
||||||
MSG_HASH(
|
MSG_HASH(
|
||||||
MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX,
|
MENU_ENUM_LABEL_VALUE_VIDEO_ASPECT_RATIO_INDEX,
|
||||||
"Aspect Ratio"
|
"Aspect Ratio"
|
||||||
|
@ -451,6 +451,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_auto_rotate, MENU_
|
|||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_auto_scale, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_AUTO_SCALE)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_overlay_auto_scale, MENU_ENUM_SUBLABEL_INPUT_OVERLAY_AUTO_SCALE)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_content_collection_list, MENU_ENUM_SUBLABEL_PLAYLISTS_TAB)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_content_collection_list, MENU_ENUM_SUBLABEL_PLAYLISTS_TAB)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_scale_integer, MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_scale_integer, MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER)
|
||||||
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_scale_integer_overscale, MENU_ENUM_SUBLABEL_VIDEO_SCALE_INTEGER_OVERSCALE)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_gpu_screenshot, MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_gpu_screenshot, MENU_ENUM_SUBLABEL_VIDEO_GPU_SCREENSHOT)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_rotation, MENU_ENUM_SUBLABEL_VIDEO_ROTATION)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_rotation, MENU_ENUM_SUBLABEL_VIDEO_ROTATION)
|
||||||
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_screen_orientation, MENU_ENUM_SUBLABEL_SCREEN_ORIENTATION)
|
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_screen_orientation, MENU_ENUM_SUBLABEL_SCREEN_ORIENTATION)
|
||||||
@ -3278,6 +3279,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
|||||||
case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER:
|
case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_scale_integer);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_scale_integer);
|
||||||
break;
|
break;
|
||||||
|
case MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE:
|
||||||
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_scale_integer_overscale);
|
||||||
|
break;
|
||||||
case MENU_ENUM_LABEL_PLAYLISTS_TAB:
|
case MENU_ENUM_LABEL_PLAYLISTS_TAB:
|
||||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_collection_list);
|
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_content_collection_list);
|
||||||
break;
|
break;
|
||||||
|
@ -7765,6 +7765,11 @@ unsigned menu_displaylist_build_list(
|
|||||||
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER,
|
||||||
PARSE_ONLY_BOOL, false) == 0)
|
PARSE_ONLY_BOOL, false) == 0)
|
||||||
count++;
|
count++;
|
||||||
|
if (settings->bools.video_scale_integer)
|
||||||
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
PARSE_ONLY_BOOL, false) == 0)
|
||||||
|
count++;
|
||||||
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
|
||||||
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
MENU_ENUM_LABEL_VIDEO_ASPECT_RATIO_INDEX,
|
||||||
PARSE_ONLY_UINT, false) == 0)
|
PARSE_ONLY_UINT, false) == 0)
|
||||||
|
@ -11366,6 +11366,28 @@ static bool setting_append_list(
|
|||||||
list_info,
|
list_info,
|
||||||
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
|
||||||
|
CONFIG_BOOL(
|
||||||
|
list, list_info,
|
||||||
|
&settings->bools.video_scale_integer_overscale,
|
||||||
|
MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
MENU_ENUM_LABEL_VALUE_VIDEO_SCALE_INTEGER_OVERSCALE,
|
||||||
|
DEFAULT_SCALE_INTEGER_OVERSCALE,
|
||||||
|
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);
|
||||||
|
(*list)[list_info->index - 1].action_ok = setting_bool_action_left_with_refresh;
|
||||||
|
(*list)[list_info->index - 1].action_left = setting_bool_action_left_with_refresh;
|
||||||
|
(*list)[list_info->index - 1].action_right = setting_bool_action_right_with_refresh;
|
||||||
|
MENU_SETTINGS_LIST_CURRENT_ADD_CMD(
|
||||||
|
list,
|
||||||
|
list_info,
|
||||||
|
CMD_EVENT_VIDEO_APPLY_STATE_CHANGES);
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
CONFIG_UINT(
|
CONFIG_UINT(
|
||||||
list, list_info,
|
list, list_info,
|
||||||
|
@ -1072,6 +1072,7 @@ enum msg_hash_enums
|
|||||||
MENU_LABEL(VIDEO_NOTCH_WRITE_OVER),
|
MENU_LABEL(VIDEO_NOTCH_WRITE_OVER),
|
||||||
|
|
||||||
MENU_LABEL(VIDEO_SCALE_INTEGER),
|
MENU_LABEL(VIDEO_SCALE_INTEGER),
|
||||||
|
MENU_LABEL(VIDEO_SCALE_INTEGER_OVERSCALE),
|
||||||
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_X),
|
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_X),
|
||||||
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_Y),
|
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_Y),
|
||||||
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_WIDTH),
|
MENU_LABEL(VIDEO_VIEWPORT_CUSTOM_WIDTH),
|
||||||
|
12
retroarch.c
12
retroarch.c
@ -31819,6 +31819,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||||||
struct rarch_state *p_rarch = &rarch_st;
|
struct rarch_state *p_rarch = &rarch_st;
|
||||||
settings_t *settings = p_rarch->configuration_settings;
|
settings_t *settings = p_rarch->configuration_settings;
|
||||||
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
|
||||||
|
bool overscale = settings->bools.video_scale_integer_overscale;
|
||||||
|
|
||||||
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||||
{
|
{
|
||||||
@ -31861,8 +31862,15 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
|||||||
if (keep_aspect)
|
if (keep_aspect)
|
||||||
{
|
{
|
||||||
/* X/Y scale must be same. */
|
/* X/Y scale must be same. */
|
||||||
unsigned max_scale = MIN(width / base_width,
|
unsigned max_scale = 1;
|
||||||
height / base_height);
|
|
||||||
|
if (overscale)
|
||||||
|
max_scale = MIN((width / base_width) + !!(width % base_width),
|
||||||
|
(height / base_height) + !!(height % base_height));
|
||||||
|
else
|
||||||
|
max_scale = MIN(width / base_width,
|
||||||
|
height / base_height);
|
||||||
|
|
||||||
padding_x = width - base_width * max_scale;
|
padding_x = width - base_width * max_scale;
|
||||||
padding_y = height - base_height * max_scale;
|
padding_y = height - base_height * max_scale;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user