mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(RGUI) Add 'Auto' aspect ratio (#15538)
This commit is contained in:
parent
dbdcf1482e
commit
5004e38fb9
@ -10930,6 +10930,10 @@ MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_5_3_CENTRE,
|
||||
"5:3 (Centered)"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_AUTO,
|
||||
"Auto"
|
||||
)
|
||||
MSG_HASH(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_NONE,
|
||||
"OFF"
|
||||
|
@ -5954,7 +5954,7 @@ static void rgui_update_menu_viewport(
|
||||
else
|
||||
{
|
||||
delta = (device_aspect / desired_aspect - 1.0f) / 2.0f + 0.5f;
|
||||
rgui->menu_video_settings.viewport.height = (unsigned)(2.0 * vp.full_height * delta);
|
||||
rgui->menu_video_settings.viewport.height = (unsigned)(2.0f * (float)vp.full_height * delta);
|
||||
rgui->menu_video_settings.viewport.width = vp.full_width;
|
||||
}
|
||||
#else
|
||||
@ -6175,6 +6175,23 @@ static bool rgui_set_aspect_ratio(
|
||||
( 4.0f / 3.0f) * (float)rgui->frame_buf.height);
|
||||
}
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_AUTO:
|
||||
{
|
||||
/* Use 4:3 as base, and adjust width according to core geometry */
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
|
||||
if (rgui->frame_buf.height == 240)
|
||||
rgui->frame_buf.width = 320;
|
||||
else
|
||||
rgui->frame_buf.width = RGUI_ROUND_FB_WIDTH(
|
||||
(4.0f / 3.0f) * (float)rgui->frame_buf.height);
|
||||
base_term_width = rgui->frame_buf.width;
|
||||
|
||||
if (video_st && video_st->av_info.geometry.aspect_ratio > 0)
|
||||
rgui->frame_buf.width = RGUI_ROUND_FB_WIDTH(
|
||||
rgui->frame_buf.height * video_st->av_info.geometry.aspect_ratio);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* 4:3 */
|
||||
if (rgui->frame_buf.height == 240)
|
||||
@ -7777,6 +7794,10 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||
/* Apply menu video settings */
|
||||
rgui_set_video_config(rgui, settings, &rgui->menu_video_settings, false);
|
||||
}
|
||||
else if (rgui->menu_aspect_ratio == RGUI_ASPECT_RATIO_AUTO)
|
||||
{
|
||||
rgui_set_aspect_ratio(rgui, p_disp, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -346,7 +346,7 @@ enum rgui_aspect_ratio
|
||||
RGUI_ASPECT_RATIO_3_2_CENTRE,
|
||||
RGUI_ASPECT_RATIO_5_3,
|
||||
RGUI_ASPECT_RATIO_5_3_CENTRE,
|
||||
|
||||
RGUI_ASPECT_RATIO_AUTO,
|
||||
RGUI_ASPECT_RATIO_LAST
|
||||
};
|
||||
|
||||
|
@ -3945,6 +3945,12 @@ static void setting_get_string_representation_uint_rgui_aspect_ratio(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_5_3_CENTRE),
|
||||
len);
|
||||
break;
|
||||
case RGUI_ASPECT_RATIO_AUTO:
|
||||
strlcpy(s,
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_AUTO),
|
||||
len);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ enum msg_hash_enums
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_3_2_CENTRE,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_5_3,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_5_3_CENTRE,
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_AUTO,
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_NONE,
|
||||
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_LOCK_FIT_SCREEN,
|
||||
|
Loading…
x
Reference in New Issue
Block a user