From 18785a56d8468cae8b3a10409c6dec508d8e8df7 Mon Sep 17 00:00:00 2001 From: Sorgelig Date: Mon, 23 May 2022 03:18:49 +0800 Subject: [PATCH] video: revert vscale_mode=4 and add vscale_mode=6. --- MiSTer.ini | 5 +++-- cfg.cpp | 2 +- video.cpp | 23 +++++++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/MiSTer.ini b/MiSTer.ini index 5b48060..44aaf06 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -10,8 +10,9 @@ vscale_mode=0 ; 0 - scale to fit the screen height. ; 1 - use integer scale only. ; 2 - use 0.5 steps of scale. ; 3 - use 0.25 steps of scale. - ; 4 - integer resolution scaling, both axes - ; 5 - integer resolution scaling, vertical only + ; 4 - integer resolution scaling, vertical only (option 1) + ; 5 - integer resolution scaling, vertical only (option 2) + ; 6 - integer resolution scaling, both axes vscale_border=0 ; set vertical border for TVs cutting the upper/bottom parts of screen (1-399) ;bootscreen=0 ; uncomment to disable boot screen of some cores like Minimig. ;mouse_throttle=10 ; 1-100 mouse speed divider. Useful for very sensitive mice diff --git a/cfg.cpp b/cfg.cpp index 6a5c9f0..5464c7e 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -50,7 +50,7 @@ static const ini_var_t ini_vars[] = { "KBD_NOMOUSE", (void*)(&(cfg.kbd_nomouse)), UINT8, 0, 1 }, { "MOUSE_THROTTLE", (void*)(&(cfg.mouse_throttle)), UINT8, 1, 100 }, { "BOOTSCREEN", (void*)(&(cfg.bootscreen)), UINT8, 0, 1 }, - { "VSCALE_MODE", (void*)(&(cfg.vscale_mode)), UINT8, 0, 5 }, + { "VSCALE_MODE", (void*)(&(cfg.vscale_mode)), UINT8, 0, 6 }, { "VSCALE_BORDER", (void*)(&(cfg.vscale_border)), UINT16, 0, 399 }, { "RBF_HIDE_DATECODE", (void*)(&(cfg.rbf_hide_datecode)), UINT8, 0, 1 }, { "MENU_PAL", (void*)(&(cfg.menu_pal)), UINT8, 0, 1 }, diff --git a/video.cpp b/video.cpp index 9d98ffe..e8ea9d2 100644 --- a/video.cpp +++ b/video.cpp @@ -1614,15 +1614,26 @@ static void video_resolution_adjust(const VideoInfo *vi, vmode_custom_t *vm) if (w == 0 || h == 0 || core_height == 0) return; - int scale = h / core_height; - if (scale == 0) return; + int scale_h = h / core_height; + int scale_w = w / core_width; + if (!scale_h) return; - int disp_h = core_height * scale; - int disp_w = w; + int disp_h, disp_w; if (cfg.vscale_mode == 4) { - scale = w / core_width; - if (scale == 0) return; + disp_h = core_height * scale_h; + disp_w = (disp_h * w) / h; + } + else if(cfg.vscale_mode == 5) + { + disp_h = core_height * scale_h; + disp_w = w; + } + else + { + if (!scale_w) return; + int scale = (scale_h < scale_w) ? scale_h : scale_w; + disp_h = core_height * scale; disp_w = core_width * scale; }