mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 00:20:01 +00:00
Refactor video_xscale/video_yscale into video_scale - scales
both X and Y according to same value
This commit is contained in:
parent
f1b1326905
commit
9df8cda62c
@ -267,8 +267,9 @@ enum
|
||||
static const unsigned int def_user_language = 0;
|
||||
|
||||
// Windowed
|
||||
static const float xscale = 3.0; // Real x res = aspect * base_size * xscale
|
||||
static const float yscale = 3.0; // Real y res = base_size * yscale
|
||||
// Real x resolution = aspect * base_size * x scale
|
||||
// Real y resolution = base_size * y scale
|
||||
static const float scale = 3.0;
|
||||
|
||||
// Fullscreen
|
||||
static const bool fullscreen = false; // To start in Fullscreen or not.
|
||||
|
8
driver.c
8
driver.c
@ -1068,13 +1068,13 @@ void init_video_input(void)
|
||||
{
|
||||
// Do rounding here to simplify integer scale correctness.
|
||||
unsigned base_width = roundf(geom->base_height * g_extern.system.aspect_ratio);
|
||||
width = roundf(base_width * g_settings.video.xscale);
|
||||
height = roundf(geom->base_height * g_settings.video.yscale);
|
||||
width = roundf(base_width * g_settings.video.scale);
|
||||
height = roundf(geom->base_height * g_settings.video.scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = roundf(geom->base_width * g_settings.video.xscale);
|
||||
height = roundf(geom->base_height * g_settings.video.yscale);
|
||||
width = roundf(geom->base_width * g_settings.video.scale);
|
||||
height = roundf(geom->base_height * g_settings.video.scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,8 +187,7 @@ static void menu_common_entries_init(menu_handle_t *menu, unsigned menu_type)
|
||||
file_list_push(menu->selection_buf, "", "video_threaded", MENU_SETTINGS_VIDEO_THREADED, 0);
|
||||
#endif
|
||||
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
|
||||
file_list_push(menu->selection_buf, "", "video_xscale", MENU_SETTINGS_VIDEO_WINDOW_SCALE_X, 0);
|
||||
file_list_push(menu->selection_buf, "", "video_yscale", MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y, 0);
|
||||
file_list_push(menu->selection_buf, "", "video_scale", MENU_SETTINGS_VIDEO_WINDOW_SCALE, 0);
|
||||
#endif
|
||||
file_list_push(menu->selection_buf, "", "video_crop_overscan", MENU_SETTINGS_VIDEO_CROP_OVERSCAN, 0);
|
||||
file_list_push(menu->selection_buf, "", "video_monitor_index", MENU_SETTINGS_VIDEO_MONITOR_INDEX, 0);
|
||||
@ -570,10 +569,8 @@ static int menu_info_screen_iterate(unsigned action, rarch_setting_t *setting)
|
||||
if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "core_specific_config")))
|
||||
setting_data_get_description(current_setting, msg, sizeof(msg));
|
||||
break;
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_X:
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y:
|
||||
if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "video_xscale")) ||
|
||||
(current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "video_xscale")) )
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE:
|
||||
if ((current_setting = (rarch_setting_t*)setting_data_find_setting(setting_data, "video_scale")))
|
||||
setting_data_get_description(current_setting, msg, sizeof(msg));
|
||||
break;
|
||||
case MENU_SETTINGS_VIDEO_VSYNC:
|
||||
@ -4277,11 +4274,8 @@ static void menu_common_setting_set_label(char *type_str, size_t type_str_size,
|
||||
case MENU_SETTINGS_VIDEO_THREADED:
|
||||
strlcpy(type_str, g_settings.video.threaded ? "ON" : "OFF", type_str_size);
|
||||
break;
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_X:
|
||||
snprintf(type_str, type_str_size, "%.1fx", g_settings.video.xscale);
|
||||
break;
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y:
|
||||
snprintf(type_str, type_str_size, "%.1fx", g_settings.video.yscale);
|
||||
case MENU_SETTINGS_VIDEO_WINDOW_SCALE:
|
||||
snprintf(type_str, type_str_size, "%.1fx", g_settings.video.scale);
|
||||
break;
|
||||
case MENU_SETTINGS_VIDEO_CROP_OVERSCAN:
|
||||
strlcpy(type_str, g_settings.video.crop_overscan ? "ON" : "OFF", type_str_size);
|
||||
|
@ -54,8 +54,7 @@ typedef enum
|
||||
MENU_SETTINGS_VIDEO_HARD_SYNC_FRAMES,
|
||||
MENU_SETTINGS_VIDEO_BLACK_FRAME_INSERTION,
|
||||
MENU_SETTINGS_VIDEO_SWAP_INTERVAL,
|
||||
MENU_SETTINGS_VIDEO_WINDOW_SCALE_X,
|
||||
MENU_SETTINGS_VIDEO_WINDOW_SCALE_Y,
|
||||
MENU_SETTINGS_VIDEO_WINDOW_SCALE,
|
||||
MENU_SETTINGS_VIDEO_CROP_OVERSCAN,
|
||||
MENU_SETTINGS_VIDEO_REFRESH_RATE,
|
||||
MENU_SETTINGS_VIDEO_REFRESH_RATE_AUTO,
|
||||
|
@ -182,8 +182,7 @@ struct settings
|
||||
{
|
||||
char driver[32];
|
||||
char gl_context[32];
|
||||
float xscale;
|
||||
float yscale;
|
||||
float scale;
|
||||
bool fullscreen;
|
||||
bool windowed_fullscreen;
|
||||
unsigned monitor_index;
|
||||
|
@ -43,10 +43,9 @@ video_driver = "sdl"
|
||||
# Path to external video driver using the RetroArch driver API.
|
||||
# video_external_driver =
|
||||
|
||||
# Windowed xscale and yscale
|
||||
# Windowed x resolution scale and y resolution scale
|
||||
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
|
||||
video_xscale = 1.0
|
||||
video_yscale = 1.0
|
||||
video_scale = 1.0
|
||||
|
||||
# Fullscreen resolution. Resolution of 0 uses the resolution of the desktop.
|
||||
# video_fullscreen_x = 0
|
||||
|
@ -96,10 +96,9 @@
|
||||
# By default, tries to use first suitable driver.
|
||||
# video_gl_context =
|
||||
|
||||
# Windowed xscale and yscale
|
||||
# Windowed x resolution scale and y resolution scale
|
||||
# (Real x res: base_size * xscale * aspect_ratio, real y res: base_size * yscale)
|
||||
# video_xscale = 3.0
|
||||
# video_yscale = 3.0
|
||||
# video_scale = 3.0
|
||||
|
||||
# Fullscreen resolution. Resolution of 0 uses the resolution of the desktop.
|
||||
# video_fullscreen_x = 0
|
||||
|
@ -284,8 +284,7 @@ void config_set_defaults(void)
|
||||
|
||||
g_settings.load_dummy_on_core_shutdown = load_dummy_on_core_shutdown;
|
||||
|
||||
g_settings.video.xscale = xscale;
|
||||
g_settings.video.yscale = yscale;
|
||||
g_settings.video.scale = scale;
|
||||
g_settings.video.fullscreen = g_extern.force_fullscreen ? true : fullscreen;
|
||||
g_settings.video.windowed_fullscreen = windowed_fullscreen;
|
||||
g_settings.video.monitor_index = monitor_index;
|
||||
@ -808,8 +807,7 @@ bool config_load_file(const char *path, bool set_defaults)
|
||||
|
||||
char tmp_str[PATH_MAX];
|
||||
|
||||
CONFIG_GET_FLOAT(video.xscale, "video_xscale");
|
||||
CONFIG_GET_FLOAT(video.yscale, "video_yscale");
|
||||
CONFIG_GET_FLOAT(video.scale, "video_scale");
|
||||
CONFIG_GET_INT(video.fullscreen_x, "video_fullscreen_x");
|
||||
CONFIG_GET_INT(video.fullscreen_y, "video_fullscreen_y");
|
||||
|
||||
@ -1368,9 +1366,8 @@ bool config_save_file(const char *path)
|
||||
config_set_bool(conf, "video_shader_enable", g_settings.video.shader_enable);
|
||||
config_set_float(conf, "video_aspect_ratio", g_settings.video.aspect_ratio);
|
||||
config_set_bool(conf, "video_windowed_fullscreen", g_settings.video.windowed_fullscreen);
|
||||
config_set_float(conf, "video_xscale", g_settings.video.xscale);
|
||||
config_set_float(conf, "video_scale", g_settings.video.scale);
|
||||
config_set_int(conf, "autosave_interval", g_settings.autosave_interval);
|
||||
config_set_float(conf, "video_yscale", g_settings.video.yscale);
|
||||
config_set_bool(conf, "video_crop_overscan", g_settings.video.crop_overscan);
|
||||
config_set_bool(conf, "video_scale_integer", g_settings.video.scale_integer);
|
||||
#ifdef GEKKO
|
||||
|
@ -546,8 +546,7 @@ void setting_data_get_description(const void *data, char *msg, size_t sizeof_msg
|
||||
snprintf(msg, sizeof_msg,
|
||||
" -- Load up a specific config file \n"
|
||||
"based on the core being used.\n");
|
||||
else if (!strcmp(setting->name, "video_xscale") ||
|
||||
!strcmp(setting->name, "video_yscale"))
|
||||
else if (!strcmp(setting->name, "video_scale"))
|
||||
snprintf(msg, sizeof_msg,
|
||||
" -- Fullscreen resolution.\n"
|
||||
" \n"
|
||||
@ -920,10 +919,8 @@ static void general_read_handler(const void *data)
|
||||
*setting->value.fraction = g_settings.video.refresh_rate;
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio"))
|
||||
*setting->value.fraction = g_settings.video.aspect_ratio;
|
||||
else if (!strcmp(setting->name, "video_xscale"))
|
||||
*setting->value.fraction = g_settings.video.xscale;
|
||||
else if (!strcmp(setting->name, "video_yscale"))
|
||||
*setting->value.fraction = g_settings.video.yscale;
|
||||
else if (!strcmp(setting->name, "video_scale"))
|
||||
*setting->value.fraction = g_settings.video.scale;
|
||||
else if (!strcmp(setting->name, "video_force_aspect"))
|
||||
*setting->value.boolean = g_settings.video.force_aspect;
|
||||
else if (!strcmp(setting->name, "aspect_ratio_index"))
|
||||
@ -1259,22 +1256,9 @@ static void general_write_handler(const void *data)
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_aspect_ratio"))
|
||||
g_settings.video.aspect_ratio = *setting->value.fraction;
|
||||
else if (!strcmp(setting->name, "video_xscale"))
|
||||
else if (!strcmp(setting->name, "video_scale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.xscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
has_set_reinit = true;
|
||||
}
|
||||
else if (!strcmp(setting->name, "video_yscale"))
|
||||
{
|
||||
float *scale = (float*)&g_settings.video.yscale;
|
||||
|
||||
*scale = roundf(*setting->value.fraction);
|
||||
*scale = max(*scale, 1.0f);
|
||||
g_settings.video.scale = roundf(*setting->value.fraction);
|
||||
|
||||
if (!g_settings.video.fullscreen)
|
||||
has_set_reinit = true;
|
||||
@ -1576,8 +1560,7 @@ rarch_setting_t* setting_data_get_list(void)
|
||||
|
||||
START_SUB_GROUP("Scaling")
|
||||
#if !defined(RARCH_CONSOLE) && !defined(RARCH_MOBILE)
|
||||
CONFIG_FLOAT(g_settings.video.xscale, "video_xscale", "Windowed Scale (X)", xscale, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_FLOAT(g_settings.video.yscale, "video_yscale", "Windowed Scale (Y)", yscale, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
CONFIG_FLOAT(g_settings.video.scale, "video_scale", "Windowed Scale", scale, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler) WITH_RANGE(1.0, 10.0, 1.0, true, true)
|
||||
#endif
|
||||
CONFIG_BOOL(g_settings.video.scale_integer, "video_scale_integer", "Integer Scale", scale_integer, GROUP_NAME, SUBGROUP_NAME, general_write_handler, general_read_handler)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user