diff --git a/command.c b/command.c index 85bbfaeadc..f7e6439851 100644 --- a/command.c +++ b/command.c @@ -1129,7 +1129,7 @@ bool command_event_resize_windowed_scale(settings_t *settings, if (window_scale == 0) return false; - configuration_set_float(settings, settings->floats.video_scale, (float)window_scale); + configuration_set_uint(settings, settings->uints.video_scale, window_scale); if (!video_fullscreen) command_event(CMD_EVENT_REINIT, NULL); diff --git a/config.def.h b/config.def.h index ebb5eae7a3..25024c4137 100644 --- a/config.def.h +++ b/config.def.h @@ -202,7 +202,7 @@ * Real x resolution = aspect * base_size * x scale * Real y resolution = base_size * y scale */ -#define DEFAULT_SCALE (3.0) +#define DEFAULT_SCALE 3 /* Fullscreen */ diff --git a/configuration.c b/configuration.c index a839d83255..d9397d2357 100644 --- a/configuration.c +++ b/configuration.c @@ -2054,7 +2054,6 @@ static struct config_float_setting *populate_settings_float( return NULL; SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, DEFAULT_ASPECT_RATIO, false); - SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false); SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, DEFAULT_CRT_REFRESH_RATE, false); SETTING_FLOAT("video_refresh_rate", &settings->floats.video_refresh_rate, true, DEFAULT_REFRESH_RATE, false); SETTING_FLOAT("audio_rate_control_delta", audio_get_float_ptr(AUDIO_ACTION_RATE_CONTROL_DELTA), true, DEFAULT_RATE_CONTROL_DELTA, false); @@ -2174,6 +2173,7 @@ static struct config_uint_setting *populate_settings_uint( SETTING_UINT("video_fullscreen_x", &settings->uints.video_fullscreen_x, true, DEFAULT_FULLSCREEN_X, false); SETTING_UINT("video_fullscreen_y", &settings->uints.video_fullscreen_y, true, DEFAULT_FULLSCREEN_Y, false); #endif + SETTING_UINT("video_scale", &settings->uints.video_scale, true, DEFAULT_SCALE, false); SETTING_UINT("video_window_opacity", &settings->uints.video_window_opacity, true, DEFAULT_WINDOW_OPACITY, false); #ifdef HAVE_VIDEO_LAYOUT SETTING_UINT("video_layout_selected_view", &settings->uints.video_layout_selected_view, true, 0, false); @@ -2618,7 +2618,7 @@ void config_set_defaults(void *data) #endif #endif - settings->floats.video_scale = DEFAULT_SCALE; + settings->uints.video_scale = DEFAULT_SCALE; video_driver_set_threaded(DEFAULT_VIDEO_THREADED); diff --git a/configuration.h b/configuration.h index d40c49c3e8..e7e8b342fc 100644 --- a/configuration.h +++ b/configuration.h @@ -210,6 +210,7 @@ typedef struct settings unsigned video_monitor_index; unsigned video_fullscreen_x; unsigned video_fullscreen_y; + unsigned video_scale; unsigned video_max_swapchain_images; unsigned video_max_frame_latency; unsigned video_swap_interval; @@ -336,7 +337,6 @@ typedef struct settings struct { float placeholder; - float video_scale; float video_aspect_ratio; float video_refresh_rate; float crt_video_refresh_rate; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index f8285ea67e..1222dec4e3 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3362,7 +3362,7 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled) } else { - float video_scale = settings->floats.video_scale; + unsigned video_scale = settings->uints.video_scale; /* Determine maximum allowed window dimensions * NOTE: We cannot read the actual display * metrics here, because the context driver @@ -3397,12 +3397,12 @@ bool video_driver_init_internal(bool *video_is_threaded, bool verbosity_enabled) * scale correctness. */ unsigned base_width = roundf(geom->base_height * video_st->aspect_ratio); - width = roundf(base_width * video_scale); + width = base_width * video_scale; } else - width = roundf(geom->base_width * video_scale); + width = geom->base_width * video_scale; - height = roundf(geom->base_height * video_scale); + height = geom->base_height * video_scale; /* Cap window size to maximum allowed values */ if ((width > max_win_width) || (height > max_win_height)) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 10712b42e2..71073ce73a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -8451,7 +8451,7 @@ unsigned menu_displaylist_build_list( #else {MENU_ENUM_LABEL_VIDEO_WINDOW_CUSTOM_SIZE_ENABLE, PARSE_ONLY_BOOL, true }, #endif - {MENU_ENUM_LABEL_VIDEO_SCALE, PARSE_ONLY_FLOAT, false}, + {MENU_ENUM_LABEL_VIDEO_SCALE, PARSE_ONLY_UINT, false}, {MENU_ENUM_LABEL_VIDEO_WINDOW_WIDTH, PARSE_ONLY_UINT, false}, {MENU_ENUM_LABEL_VIDEO_WINDOW_HEIGHT, PARSE_ONLY_UINT, false}, {MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX, PARSE_ONLY_UINT, false}, diff --git a/menu/menu_setting.c b/menu/menu_setting.c index e0ac6b56f3..7b8f899f4a 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -8019,7 +8019,7 @@ static void general_write_handler(rarch_setting_t *setting) { settings_t *settings = config_get_ptr(); settings->modified = true; - settings->floats.video_scale = roundf(*setting->value.target.fraction); + settings->uints.video_scale = *setting->value.target.unsigned_integer; if (!settings->bools.video_fullscreen) rarch_cmd = CMD_EVENT_REINIT; @@ -8065,7 +8065,7 @@ static void general_write_handler(rarch_setting_t *setting) { settings_t *settings = config_get_ptr(); settings->modified = true; - settings->bools.video_hdr_expand_gamut = *setting->value.target.boolean;; + settings->bools.video_hdr_expand_gamut = *setting->value.target.boolean; video_driver_set_hdr_expand_gamut(settings->bools.video_hdr_expand_gamut); } @@ -12009,20 +12009,19 @@ static bool setting_append_list( if (video_driver_has_windowed()) { - CONFIG_FLOAT( + CONFIG_UINT( list, list_info, - &settings->floats.video_scale, + &settings->uints.video_scale, MENU_ENUM_LABEL_VIDEO_SCALE, MENU_ENUM_LABEL_VALUE_VIDEO_SCALE, DEFAULT_SCALE, - "%.1fx", &group_info, &subgroup_info, parent_group, general_write_handler, general_read_handler); (*list)[list_info->index - 1].action_ok = &setting_action_ok_uint; - menu_settings_list_current_add_range(list, list_info, 1.0, 10.0, 1.0, true, true); + menu_settings_list_current_add_range(list, list_info, 1, 10, 1, true, true); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_LAKKA_ADVANCED); CONFIG_UINT( diff --git a/ui/drivers/qt/qt_options.cpp b/ui/drivers/qt/qt_options.cpp index c29bda2f48..9f84e66722 100644 --- a/ui/drivers/qt/qt_options.cpp +++ b/ui/drivers/qt/qt_options.cpp @@ -1299,7 +1299,7 @@ QWidget *VideoPage::widget() aspectGroup->add(MENU_ENUM_LABEL_VIDEO_SCALE_INTEGER); aspectGroup->addRow(new AspectRatioGroup("Aspect Ratio")); - leftWindowedSizeForm->addRow("Scale:", new FloatSpinBox(MENU_ENUM_LABEL_VIDEO_SCALE)); + leftWindowedSizeForm->addRow("Scale:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_SCALE)); leftWindowedSizeForm->addRow("Max Width:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_WINDOW_AUTO_WIDTH_MAX)); rightWindowedSizeForm->addRow("Opacity:", new UIntSpinBox(MENU_ENUM_LABEL_VIDEO_WINDOW_OPACITY));