Added 21:9 as an option to RGUI (#15572)

* added 21:9 as an option to RGUI

* reverted files that weren't supposed to be changed

* fixed issue with 21:9 not showing in the menu and corrected buffer width
This commit is contained in:
Cpod12 2023-08-12 05:51:12 -07:00 committed by GitHub
parent 6dee7225f3
commit 904e9fbe1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 4 deletions

View File

@ -86,6 +86,10 @@ void libretro_dummy_retro_init(void)
case RGUI_ASPECT_RATIO_16_10_CENTRE:
frame_buf_width = 384;
break;
case RGUI_ASPECT_RATIO_21_9:
case RGUI_ASPECT_RATIO_21_9_CENTRE:
frame_buf_width = 560;
break;
default:
/* 4:3 */
frame_buf_width = 320;

View File

@ -526,6 +526,13 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
else
new_fb_width = (unsigned)((16.0f / 10.0f) * (float)new_fb_height) & ~3;
break;
case RGUI_ASPECT_RATIO_21_9:
case RGUI_ASPECT_RATIO_21_9_CENTRE:
if (new_fb_height == 240)
new_fb_width = 560;
else
new_fb_width = (unsigned)((21.0f / 9.0f) * (float)new_fb_height) & ~3;
break;
default:
/* 4:3 */
if (new_fb_height == 240)
@ -534,8 +541,8 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
new_fb_width = (unsigned)((4.0f / 3.0f) * (float)new_fb_height) & ~3;
break;
}
if (new_fb_width > 424)
new_fb_width = 424;
if (new_fb_width > 560)
new_fb_width = 560;
new_fb_pitch = new_fb_width * 2;

View File

@ -10970,6 +10970,14 @@ MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
"16:10 (Centered)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9,
"21:9"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9_CENTRE,
"21:9 (Centered)"
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_3_2,
"3:2"

View File

@ -83,7 +83,7 @@
#define RGUI_MIN_FB_HEIGHT 192
#define RGUI_MIN_FB_WIDTH 256
#define RGUI_MAX_FB_WIDTH 426
#define RGUI_MAX_FB_WIDTH 560
#if defined(DINGUX)
#if defined(RS90) && !defined(MIYOO)
@ -3083,6 +3083,10 @@ static void rgui_load_custom_theme(
case RGUI_ASPECT_RATIO_16_10_CENTRE:
wallpaper_key = "rgui_wallpaper_16_10";
break;
case RGUI_ASPECT_RATIO_21_9:
case RGUI_ASPECT_RATIO_21_9_CENTRE:
wallpaper_key = "rgui_wallpaper_21_9";
break;
case RGUI_ASPECT_RATIO_3_2:
case RGUI_ASPECT_RATIO_3_2_CENTRE:
wallpaper_key = "rgui_wallpaper_3_2";
@ -6131,6 +6135,28 @@ static bool rgui_set_aspect_ratio(
( 4.0f / 3.0f) * (float)rgui->frame_buf.height);
}
break;
case RGUI_ASPECT_RATIO_21_9:
if (rgui->frame_buf.height == 240)
rgui->frame_buf.width = max_frame_buf_width;
else
rgui->frame_buf.width = RGUI_ROUND_FB_WIDTH(
(21.0f / 9.0f) * (float)rgui->frame_buf.height);
base_term_width = rgui->frame_buf.width;
break;
case RGUI_ASPECT_RATIO_21_9_CENTRE:
if (rgui->frame_buf.height == 240)
{
rgui->frame_buf.width = max_frame_buf_width;
base_term_width = 320;
}
else
{
rgui->frame_buf.width = RGUI_ROUND_FB_WIDTH(
(21.0f / 9.0f) * (float)rgui->frame_buf.height);
base_term_width = RGUI_ROUND_FB_WIDTH(
( 4.0f / 3.0f) * (float)rgui->frame_buf.height);
}
break;
case RGUI_ASPECT_RATIO_3_2:
if (rgui->frame_buf.height == 240)
rgui->frame_buf.width = 360;
@ -6262,6 +6288,19 @@ static bool rgui_set_aspect_ratio(
base_term_width = (base_term_width < RGUI_MIN_FB_WIDTH) ?
RGUI_MIN_FB_WIDTH : base_term_width;
break;
case RGUI_ASPECT_RATIO_21_9:
rgui->frame_buf.height = (unsigned)(
( 9.0f / 21.0f) * (float)rgui->frame_buf.width);
base_term_width = rgui->frame_buf.width;
break;
case RGUI_ASPECT_RATIO_21_9_CENTRE:
rgui->frame_buf.height = (unsigned)(
( 9.0f / 21.0f) * (float)rgui->frame_buf.width);
base_term_width = RGUI_ROUND_FB_WIDTH(
( 4.0f / 3.0f) * (float)rgui->frame_buf.height);
base_term_width = (base_term_width < RGUI_MIN_FB_WIDTH) ?
RGUI_MIN_FB_WIDTH : base_term_width;
break;
case RGUI_ASPECT_RATIO_3_2:
rgui->frame_buf.height = (unsigned)(
(3.0f / 2.0f) * (float)rgui->frame_buf.width);
@ -7685,12 +7724,16 @@ static void rgui_frame(void *data, video_frame_info_t *video_info)
{
case RGUI_ASPECT_RATIO_16_9:
case RGUI_ASPECT_RATIO_16_9_CENTRE:
default_fb_width = RGUI_MAX_FB_WIDTH;
default_fb_width = 426;
break;
case RGUI_ASPECT_RATIO_16_10:
case RGUI_ASPECT_RATIO_16_10_CENTRE:
default_fb_width = 384;
break;
case RGUI_ASPECT_RATIO_21_9:
case RGUI_ASPECT_RATIO_21_9_CENTRE:
default_fb_width = RGUI_MAX_FB_WIDTH;
break;
case RGUI_ASPECT_RATIO_3_2:
case RGUI_ASPECT_RATIO_3_2_CENTRE:
default_fb_width = 360;

View File

@ -342,6 +342,8 @@ enum rgui_aspect_ratio
RGUI_ASPECT_RATIO_16_9_CENTRE,
RGUI_ASPECT_RATIO_16_10,
RGUI_ASPECT_RATIO_16_10_CENTRE,
RGUI_ASPECT_RATIO_21_9,
RGUI_ASPECT_RATIO_21_9_CENTRE,
RGUI_ASPECT_RATIO_3_2,
RGUI_ASPECT_RATIO_3_2_CENTRE,
RGUI_ASPECT_RATIO_5_3,

View File

@ -3923,6 +3923,18 @@ static void setting_get_string_representation_uint_rgui_aspect_ratio(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE),
len);
break;
case RGUI_ASPECT_RATIO_21_9:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9),
len);
break;
case RGUI_ASPECT_RATIO_21_9_CENTRE:
strlcpy(s,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9_CENTRE),
len);
break;
case RGUI_ASPECT_RATIO_3_2:
strlcpy(s,
msg_hash_to_str(

View File

@ -3517,6 +3517,8 @@ enum msg_hash_enums
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_9_CENTRE,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_16_10_CENTRE,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_21_9_CENTRE,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_3_2,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_3_2_CENTRE,
MENU_ENUM_LABEL_VALUE_RGUI_ASPECT_RATIO_5_3,