mirror of
https://github.com/libretro/RetroArch
synced 2025-02-07 12:39:54 +00:00
Fixing Integer Scaling for Custom Viewport (when rotating)
This commit is contained in:
parent
7088281b52
commit
a28e57e42d
@ -4254,10 +4254,14 @@ static void setting_get_string_representation_uint_custom_viewport_width(rarch_s
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
geom = (struct retro_game_geometry*)&av_info->geometry;
|
||||
|
||||
if (*setting->value.target.unsigned_integer%geom->base_width == 0)
|
||||
if (!(get_rotation() % 2) && (*setting->value.target.unsigned_integer%geom->base_width == 0))
|
||||
snprintf(s, len, "%u (%ux)",
|
||||
*setting->value.target.unsigned_integer,
|
||||
*setting->value.target.unsigned_integer / geom->base_width);
|
||||
else if ((get_rotation() % 2) && (*setting->value.target.unsigned_integer%geom->base_height == 0))
|
||||
snprintf(s, len, "%u (%ux)",
|
||||
*setting->value.target.unsigned_integer,
|
||||
*setting->value.target.unsigned_integer / geom->base_height);
|
||||
else
|
||||
snprintf(s, len, "%u",
|
||||
*setting->value.target.unsigned_integer);
|
||||
@ -4274,10 +4278,14 @@ static void setting_get_string_representation_uint_custom_viewport_height(rarch_
|
||||
av_info = video_viewport_get_system_av_info();
|
||||
geom = (struct retro_game_geometry*)&av_info->geometry;
|
||||
|
||||
if (*setting->value.target.unsigned_integer%geom->base_height == 0)
|
||||
if (!(get_rotation() % 2) && (*setting->value.target.unsigned_integer%geom->base_height == 0))
|
||||
snprintf(s, len, "%u (%ux)",
|
||||
*setting->value.target.unsigned_integer,
|
||||
*setting->value.target.unsigned_integer / geom->base_height);
|
||||
else if ((get_rotation() % 2) && (*setting->value.target.unsigned_integer%geom->base_width == 0))
|
||||
snprintf(s, len, "%u (%ux)",
|
||||
*setting->value.target.unsigned_integer,
|
||||
*setting->value.target.unsigned_integer / geom->base_width);
|
||||
else
|
||||
snprintf(s, len, "%u",
|
||||
*setting->value.target.unsigned_integer);
|
||||
@ -4683,9 +4691,15 @@ static int setting_uint_action_left_custom_viewport_width(
|
||||
custom->width = 1;
|
||||
else if (settings->bools.video_scale_integer)
|
||||
{
|
||||
if (get_rotation() % 2)
|
||||
{
|
||||
if (custom->width > geom->base_height)
|
||||
custom->width -= geom->base_height;
|
||||
} else {
|
||||
if (custom->width > geom->base_width)
|
||||
custom->width -= geom->base_width;
|
||||
}
|
||||
}
|
||||
else
|
||||
custom->width -= 1;
|
||||
|
||||
@ -4714,9 +4728,15 @@ static int setting_uint_action_left_custom_viewport_height(
|
||||
custom->height = 1;
|
||||
else if (settings->bools.video_scale_integer)
|
||||
{
|
||||
if (get_rotation() % 2)
|
||||
{
|
||||
if (custom->height > geom->base_width)
|
||||
custom->height -= geom->base_width;
|
||||
} else {
|
||||
if (custom->height > geom->base_height)
|
||||
custom->height -= geom->base_height;
|
||||
}
|
||||
}
|
||||
else
|
||||
custom->height -= 1;
|
||||
|
||||
@ -4912,9 +4932,13 @@ static int setting_uint_action_right_custom_viewport_width(
|
||||
|
||||
video_driver_get_viewport_info(&vp);
|
||||
|
||||
if (settings->bools.video_scale_integer)
|
||||
if (settings->bools.video_scale_integer) {
|
||||
if (get_rotation() % 2){
|
||||
custom->width += geom->base_height;
|
||||
} else {
|
||||
custom->width += geom->base_width;
|
||||
else
|
||||
}
|
||||
} else
|
||||
custom->width += 1;
|
||||
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
@ -4938,9 +4962,13 @@ static int setting_uint_action_right_custom_viewport_height(
|
||||
|
||||
video_driver_get_viewport_info(&vp);
|
||||
|
||||
if (settings->bools.video_scale_integer)
|
||||
if (settings->bools.video_scale_integer){
|
||||
if (get_rotation() % 2){
|
||||
custom->height += geom->base_width;
|
||||
} else {
|
||||
custom->height += geom->base_height;
|
||||
else
|
||||
}
|
||||
} else
|
||||
custom->height += 1;
|
||||
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
@ -5868,10 +5896,14 @@ static int setting_action_start_custom_viewport_width(rarch_setting_t *setting)
|
||||
|
||||
video_driver_get_viewport_info(&vp);
|
||||
|
||||
if (settings->bools.video_scale_integer)
|
||||
if (settings->bools.video_scale_integer){
|
||||
if (get_rotation() % 2){
|
||||
custom->width = ((custom->width + geom->base_height - 1) /
|
||||
geom->base_height) * geom->base_height;
|
||||
} else
|
||||
custom->width = ((custom->width + geom->base_width - 1) /
|
||||
geom->base_width) * geom->base_width;
|
||||
else
|
||||
} else
|
||||
custom->width = vp.full_width - custom->x;
|
||||
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
@ -5893,11 +5925,14 @@ static int setting_action_start_custom_viewport_height(rarch_setting_t *setting)
|
||||
return -1;
|
||||
|
||||
video_driver_get_viewport_info(&vp);
|
||||
|
||||
if (settings->bools.video_scale_integer)
|
||||
if (settings->bools.video_scale_integer){
|
||||
if (get_rotation() % 2){
|
||||
custom->height = ((custom->height + geom->base_width - 1) /
|
||||
geom->base_width) * geom->base_width;
|
||||
} else
|
||||
custom->height = ((custom->height + geom->base_height - 1) /
|
||||
geom->base_height) * geom->base_height;
|
||||
else
|
||||
} else
|
||||
custom->height = vp.full_height - custom->y;
|
||||
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
@ -6289,8 +6324,13 @@ void general_write_handler(rarch_setting_t *setting)
|
||||
{
|
||||
custom->x = 0;
|
||||
custom->y = 0;
|
||||
if (get_rotation() %2){
|
||||
custom->width = ((custom->width + geom->base_height - 1) / geom->base_height) * geom->base_height;
|
||||
custom->height = ((custom->height + geom->base_width - 1) / geom->base_width) * geom->base_width;
|
||||
} else {
|
||||
custom->width = ((custom->width + geom->base_width - 1) / geom->base_width) * geom->base_width;
|
||||
custom->height = ((custom->height + geom->base_height - 1) / geom->base_height) * geom->base_height;
|
||||
}
|
||||
aspectratio_lut[ASPECT_RATIO_CUSTOM].value =
|
||||
(float)custom->width / custom->height;
|
||||
}
|
||||
@ -16635,6 +16675,10 @@ bool menu_setting_ctl(enum menu_setting_ctl_state state, void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned get_rotation(){
|
||||
return config_get_ptr()->uints.video_rotation + runloop_get_system_info()->rotation;
|
||||
}
|
||||
|
||||
void video_driver_menu_settings(void **list_data, void *list_info_data,
|
||||
void *group_data, void *subgroup_data, const char *parent_group)
|
||||
{
|
||||
|
@ -136,6 +136,8 @@ void menu_setting_free(rarch_setting_t *setting);
|
||||
bool menu_setting_ctl(
|
||||
enum menu_setting_ctl_state state, void *data);
|
||||
|
||||
unsigned get_rotation();
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -27442,8 +27442,3 @@ static void core_free_retro_game_info(struct retro_game_info *dest)
|
||||
dest->data = NULL;
|
||||
dest->meta = NULL;
|
||||
}
|
||||
|
||||
unsigned get_rotation()
|
||||
{
|
||||
return configuration_settings->uints.video_rotation + runloop_system.rotation;
|
||||
}
|
||||
|
@ -2133,8 +2133,6 @@ bool menu_driver_is_toggled(void);
|
||||
|
||||
bool menu_widgets_ready(void);
|
||||
|
||||
unsigned get_rotation();
|
||||
|
||||
RETRO_END_DECLS
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user