mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Start using video_viewport_get_custom everywhere
This commit is contained in:
parent
d33cad3381
commit
2f62cd65e2
@ -633,10 +633,7 @@ static void config_set_defaults(void)
|
||||
|
||||
settings->core.set_supports_no_game_enable = true;
|
||||
|
||||
global->console.screen.viewports.custom_vp.width = 0;
|
||||
global->console.screen.viewports.custom_vp.height = 0;
|
||||
global->console.screen.viewports.custom_vp.x = 0;
|
||||
global->console.screen.viewports.custom_vp.y = 0;
|
||||
video_viewport_reset_custom();
|
||||
|
||||
/* Make sure settings from other configs carry over into defaults
|
||||
* for another config. */
|
||||
@ -2232,6 +2229,7 @@ bool config_save_file(const char *path)
|
||||
config_file_t *conf = config_file_new(path);
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
video_viewport_t *custom_vp = video_viewport_get_custom();
|
||||
|
||||
if (!conf)
|
||||
conf = config_file_new(NULL);
|
||||
@ -2473,13 +2471,13 @@ bool config_save_file(const char *path)
|
||||
config_set_int(conf, "current_resolution_id",
|
||||
global->console.screen.resolutions.current.id);
|
||||
config_set_int(conf, "custom_viewport_width",
|
||||
global->console.screen.viewports.custom_vp.width);
|
||||
custom_vp->width);
|
||||
config_set_int(conf, "custom_viewport_height",
|
||||
global->console.screen.viewports.custom_vp.height);
|
||||
custom_vp->height);
|
||||
config_set_int(conf, "custom_viewport_x",
|
||||
global->console.screen.viewports.custom_vp.x);
|
||||
custom_vp->x);
|
||||
config_set_int(conf, "custom_viewport_y",
|
||||
global->console.screen.viewports.custom_vp.y);
|
||||
custom_vp->y);
|
||||
config_set_float(conf, "video_font_size", settings->video.font_size);
|
||||
|
||||
config_set_bool(conf, "block_sram_overwrite",
|
||||
|
@ -431,10 +431,9 @@ static void d3d_calculate_rect(d3d_video_t *d3d,
|
||||
{
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const video_viewport_t *custom =
|
||||
&global->console.screen.viewports.custom_vp;
|
||||
video_viewport_t *custom = video_viewport_get_custom();
|
||||
|
||||
if (custom)
|
||||
if (custom)
|
||||
d3d_set_viewport(d3d, custom->x, custom->y,
|
||||
custom->width, custom->height);
|
||||
}
|
||||
|
@ -424,10 +424,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
||||
}
|
||||
|
||||
/* custom viewports for older resolutions will most likely be corrupted, reset them */
|
||||
global->console.screen.viewports.custom_vp.x = 0;
|
||||
global->console.screen.viewports.custom_vp.y = 0;
|
||||
global->console.screen.viewports.custom_vp.width = 0;
|
||||
global->console.screen.viewports.custom_vp.height = 0;
|
||||
video_viewport_reset_custom();
|
||||
|
||||
g_current_framebuf = 0;
|
||||
}
|
||||
@ -838,6 +835,7 @@ static void gx_resize(void *data)
|
||||
unsigned width = gx->vp.full_width, height = gx->vp.full_height;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
struct video_viewport *custom_vp = video_viewport_get_custom();
|
||||
|
||||
#ifdef HW_RVL
|
||||
VIDEO_SetTrapFilter(global->console.softfilter_enable);
|
||||
@ -863,19 +861,18 @@ static void gx_resize(void *data)
|
||||
#ifdef RARCH_CONSOLE
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
if (!global->console.screen.viewports.custom_vp.width ||
|
||||
!global->console.screen.viewports.custom_vp.height)
|
||||
if (!custom_vp->width || !custom_vp->height)
|
||||
{
|
||||
global->console.screen.viewports.custom_vp.x = 0;
|
||||
global->console.screen.viewports.custom_vp.y = 0;
|
||||
global->console.screen.viewports.custom_vp.width = gx->vp.full_width;
|
||||
global->console.screen.viewports.custom_vp.height = gx->vp.full_height;
|
||||
custom_vp->x = 0;
|
||||
custom_vp->y = 0;
|
||||
custom_vp->width = gx->vp.full_width;
|
||||
custom_vp->height = gx->vp.full_height;
|
||||
}
|
||||
|
||||
x = global->console.screen.viewports.custom_vp.x;
|
||||
y = global->console.screen.viewports.custom_vp.y;
|
||||
width = global->console.screen.viewports.custom_vp.width;
|
||||
height = global->console.screen.viewports.custom_vp.height;
|
||||
x = custom_vp->x;
|
||||
y = custom_vp->y;
|
||||
width = custom_vp->width;
|
||||
height = custom_vp->height;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -715,8 +715,7 @@ static void psp_update_viewport(psp1_video_t* psp)
|
||||
#if defined(HAVE_MENU)
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom =
|
||||
&global->console.screen.viewports.custom_vp;
|
||||
struct video_viewport *custom = video_viewport_get_custom();
|
||||
|
||||
if (custom)
|
||||
{
|
||||
|
@ -278,7 +278,7 @@ static void sdl_refresh_viewport(sdl2_video_t *vid)
|
||||
vid->video.force_aspect);
|
||||
else if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
const struct video_viewport *custom = &global->console.screen.viewports.custom_vp;
|
||||
const struct video_viewport *custom = (const struct video_viewport*)video_viewport_get_custom();
|
||||
|
||||
if (custom)
|
||||
{
|
||||
|
@ -497,7 +497,7 @@ void init_video(void)
|
||||
video_viewport_set_config();
|
||||
|
||||
/* Update CUSTOM viewport. */
|
||||
custom_vp = &global->console.screen.viewports.custom_vp;
|
||||
custom_vp = video_viewport_get_custom();
|
||||
|
||||
if (settings->video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
||||
{
|
||||
|
@ -234,3 +234,15 @@ struct video_viewport *video_viewport_get_custom(void)
|
||||
return NULL;
|
||||
return &global->console.screen.viewports.custom_vp;
|
||||
}
|
||||
|
||||
void video_viewport_reset_custom(void)
|
||||
{
|
||||
struct video_viewport *custom_vp = video_viewport_get_custom();
|
||||
if (!custom_vp)
|
||||
return;
|
||||
|
||||
custom_vp->width = 0;
|
||||
custom_vp->height = 0;
|
||||
custom_vp->x = 0;
|
||||
custom_vp->y = 0;
|
||||
}
|
||||
|
@ -139,6 +139,8 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|
||||
|
||||
struct retro_system_av_info *video_viewport_get_system_av_info(void);
|
||||
|
||||
void video_viewport_reset_custom(void);
|
||||
|
||||
struct video_viewport *video_viewport_get_custom(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1037,8 +1037,7 @@ static int action_ok_custom_viewport(const char *path,
|
||||
{
|
||||
menu_displaylist_info_t info = {0};
|
||||
int ret = 0;
|
||||
global_t *global = global_get_ptr();
|
||||
video_viewport_t *custom = &global->console.screen.viewports.custom_vp;
|
||||
video_viewport_t *custom = video_viewport_get_custom();
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
|
@ -4022,6 +4022,7 @@ static bool setting_append_list_video_options(
|
||||
rarch_setting_group_info_t subgroup_info;
|
||||
settings_t *settings = config_get_ptr();
|
||||
global_t *global = global_get_ptr();
|
||||
video_viewport_t *custom_vp = video_viewport_get_custom();
|
||||
|
||||
START_GROUP(group_info, "Video Settings");
|
||||
START_SUB_GROUP(list, list_info, "State", group_info.name, subgroup_info);
|
||||
@ -4254,7 +4255,7 @@ static bool setting_append_list_video_options(
|
||||
general_read_handler);
|
||||
|
||||
CONFIG_INT(
|
||||
global->console.screen.viewports.custom_vp.x,
|
||||
custom_vp->x,
|
||||
"custom_viewport_x",
|
||||
"Custom Viewport X",
|
||||
0,
|
||||
@ -4265,7 +4266,7 @@ static bool setting_append_list_video_options(
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
|
||||
CONFIG_INT(
|
||||
global->console.screen.viewports.custom_vp.y,
|
||||
custom_vp->y,
|
||||
"custom_viewport_y",
|
||||
"Custom Viewport Y",
|
||||
0,
|
||||
@ -4276,7 +4277,7 @@ static bool setting_append_list_video_options(
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
|
||||
CONFIG_UINT(
|
||||
global->console.screen.viewports.custom_vp.width,
|
||||
custom_vp->width,
|
||||
"custom_viewport_width",
|
||||
"Custom Viewport Width",
|
||||
0,
|
||||
@ -4287,7 +4288,7 @@ static bool setting_append_list_video_options(
|
||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_ADVANCED);
|
||||
|
||||
CONFIG_UINT(
|
||||
global->console.screen.viewports.custom_vp.height,
|
||||
custom_vp->height,
|
||||
"custom_viewport_height",
|
||||
"Custom Viewport Height",
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user