]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Manual filter negative positioning values support.
authorToni Wilen <twilen@winuae.net>
Sun, 28 Sep 2025 08:22:03 +0000 (11:22 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 28 Sep 2025 08:22:03 +0000 (11:22 +0300)
cfgfile.cpp
include/options.h
od-win32/resources/winuae.rc
od-win32/rp.cpp
od-win32/win32_scaler.cpp
od-win32/win32gui.cpp

index 4500935385337480b21a142156eaf0c96d8efe02..ee953513760bc5e9e301b2eb2a4c01d1d04d2f99 100644 (file)
@@ -2569,8 +2569,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_dwrite (f, _T("gfx_gamma_g"), _T("%d"), p->gfx_gamma_ch[1]);
        cfgfile_dwrite (f, _T("gfx_gamma_b"), _T("%d"), p->gfx_gamma_ch[2]);
 
-       cfgfile_dwrite (f, _T("gfx_center_horizontal_position"), _T("%d"), p->gfx_xcenter_pos);
-       cfgfile_dwrite (f, _T("gfx_center_vertical_position"), _T("%d"), p->gfx_ycenter_pos);
+       cfgfile_dwrite (f, _T("gfx_center_horizontal_position"), _T("%d"), p->gfx_xcenter_pos < MANUAL_SCALE_MIN_RANGE ? -1 : (p->gfx_xcenter_pos < 0 ? p->gfx_xcenter_pos - 1 : p->gfx_xcenter_pos));
+       cfgfile_dwrite (f, _T("gfx_center_vertical_position"), _T("%d"), p->gfx_ycenter_pos < MANUAL_SCALE_MIN_RANGE ? -1 : (p->gfx_ycenter_pos < 0 ? p->gfx_ycenter_pos - 1 : p->gfx_ycenter_pos));
        cfgfile_dwrite (f, _T("gfx_center_horizontal_size"), _T("%d"), p->gfx_xcenter_size);
        cfgfile_dwrite (f, _T("gfx_center_vertical_size"), _T("%d"), p->gfx_ycenter_size);
 
@@ -3692,8 +3692,6 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_yesno(option, value, _T("gfx_resize_windowed"), &p->gfx_windowed_resize)
                || cfgfile_intval(option, value, _T("gfx_black_frame_insertion_ratio"), &p->lightboost_strobo_ratio, 1)
 
-               || cfgfile_intval (option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1)
-               || cfgfile_intval (option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1)
                || cfgfile_intval (option, value, _T("gfx_center_horizontal_size"), &p->gfx_xcenter_size, 1)
                || cfgfile_intval (option, value, _T("gfx_center_vertical_size"), &p->gfx_ycenter_size, 1)
 
@@ -3802,6 +3800,25 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_strval (option, value, _T("absolute_mouse"), &p->input_tablet, abspointers, 0))
                return 1;
 
+       if (cfgfile_intval(option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1)) {
+               // -1 = old "null" position.
+               if (p->gfx_xcenter_pos == -1) {
+                       p->gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+               } else if (p->gfx_xcenter_pos < 0 && p->gfx_xcenter_pos >= MANUAL_SCALE_MIN_RANGE) {
+                       p->gfx_xcenter_pos++;
+               }
+               return 1;
+       }
+       if (cfgfile_intval(option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1)) {
+               if (p->gfx_ycenter_pos == -1) {
+                       p->gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+               } else if (p->gfx_ycenter_pos < 0 && p->gfx_ycenter_pos >= MANUAL_SCALE_MIN_RANGE) {
+                       p->gfx_ycenter_pos++;
+               }
+               return 1;
+       }
+
+
        if (cfgfile_string(option, value, _T("gfx_colour_mode"), tmpbuf, sizeof tmpbuf / sizeof(TCHAR))) {
                return 1;
        }
@@ -8533,8 +8550,8 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
        p->gfx_apmode[0].gfx_fullscreen = GFX_WINDOW;
        p->gfx_apmode[1].gfx_fullscreen = GFX_WINDOW;
        p->gfx_xcenter = 0; p->gfx_ycenter = 0;
-       p->gfx_xcenter_pos = -1;
-       p->gfx_ycenter_pos = -1;
+       p->gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+       p->gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
        p->gfx_xcenter_size = -1;
        p->gfx_ycenter_size = -1;
        p->gfx_max_horizontal = RES_HIRES;
index 2dabbb52019d20ed28bce4535f419f658fc83855..40bf99838d4e8a4c36f3edea04a197a8951a0c8f 100644 (file)
@@ -276,6 +276,9 @@ enum { CP_GENERIC = 1, CP_CDTV, CP_CDTVCR, CP_CD32, CP_A500, CP_A500P, CP_A600,
 #define AUTOSCALE_SEPARATOR 10
 #define AUTOSCALE_OVERSCAN_BLANK 11
 
+#define MANUAL_SCALE_MIN_RANGE -1999
+#define MANUAL_SCALE_MAX_RANGE 1999
+
 #define MONITOREMU_NONE 0
 #define MONITOREMU_AUTO 1
 #define MONITOREMU_A2024 2
index 637973f7e819623730e4e5e744d83f9657640b2f..0255348de30ca5a2808b134277492c70e2784d11 100644 (file)
@@ -176,15 +176,15 @@ BEGIN
     COMBOBOX        IDC_SCREENMODE_RTG,54,122,71,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_SCREENMODE_RTG2,131,122,107,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     CONTROL         "Blacker than black [] Borderblanked black is blacker than display area black.",IDC_BLACKER_THAN_BLACK,
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,144,139,10
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_TABSTOP,11,142,139,10
     CONTROL         "Remove interlace artifacts [] Emulates interlace mode internally as progressive, removing all interlace artifacts. Not compatible with all software.",IDC_FLICKERFIXER,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,158,139,10
-    CONTROL         "Monochrome video out",IDC_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,171,139,10
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,155,139,10
+    CONTROL         "Monochrome video out",IDC_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,167,139,10
     CONTROL         "Filtered low resolution [] When scaling hires to lores or superhires to hires, show average color of pixel instead of dropping every other pixel.",IDC_LORES_SMOOTHED,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,144,123,10
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,142,123,10
     CONTROL         "VGA mode resolution autoswitch [] Automatically selects between hires and superhires in programmed display modes, keeping correct aspect ratio.",IDC_AUTORESOLUTIONVGA,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,158,124,10
-    CONTROL         "Display resync blanking",IDC_RESYNCBLANK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,172,122,10
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,155,124,10
+    CONTROL         "Display resync blanking",IDC_RESYNCBLANK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,155,168,122,10
     RTEXT           "Resolution:",IDC_STATIC,6,196,44,8,SS_CENTERIMAGE
     COMBOBOX        IDC_LORES,57,195,77,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     RTEXT           "Overscan:",IDC_STATIC,145,196,43,8,SS_CENTERIMAGE
@@ -970,11 +970,11 @@ BEGIN
     CONTROL         "Slider1",IDC_FILTERVO,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,147,143,151,19
     EDITTEXT        IDC_FILTERVOV,316,145,42,12,ES_CENTER
     GROUPBOX        "Aspect Ratio Correction",-1,1,173,144,89
-    COMBOBOX        IDC_FILTERASPECT,14,190,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_FILTERASPECT,14,187,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     CONTROL         "Keep autoscale aspect",IDC_FILTERKEEPAUTOSCALEASPECT,
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,210,126,11
-    CONTROL         "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,225,126,11
-    COMBOBOX        IDC_FILTERASPECT2,14,241,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,205,126,11
+    CONTROL         "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,218,126,11
+    COMBOBOX        IDC_FILTERASPECT2,14,244,99,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     GROUPBOX        "Extra Settings",-1,154,173,240,89
     COMBOBOX        IDC_FILTERXTRA,177,193,138,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
     COMBOBOX        IDC_FILTERSLR,327,193,41,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP
index fa8e55a50431e60fde276c309c8faa800d4ac97c..129e0bf82d33bc032026e2446c4443df203c2be1 100644 (file)
@@ -741,6 +741,9 @@ static int shift (int val, int shift)
        return val;
 }
 
+static int gfx_height_original;
+static bool ntsc_extended;
+
 static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool getclip)
 {
        struct AmigaMonitor *mon = &AMonitors[0];
@@ -831,8 +834,8 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g
                        sm->lClipWidth = rw;
                        sm->lClipHeight = rh;
                } else {
-                       sm->lClipLeft = p->gfx_xcenter_pos < 0 ? -1 : p->gfx_xcenter_pos;
-                       sm->lClipTop = p->gfx_ycenter_pos < 0 ? -1 : p->gfx_ycenter_pos;
+                       sm->lClipLeft = p->gfx_xcenter_pos < MANUAL_SCALE_MIN_RANGE ? -32768 : p->gfx_xcenter_pos;
+                       sm->lClipTop = p->gfx_ycenter_pos < MANUAL_SCALE_MIN_RANGE ? -32768 : p->gfx_ycenter_pos;
                        sm->lClipWidth = p->gfx_xcenter_size <= 0 ? -1 : p->gfx_xcenter_size;
                        sm->lClipHeight = p->gfx_ycenter_size <= 0 ? -1 : p->gfx_ycenter_size;
                }
@@ -870,7 +873,7 @@ static void get_screenmode (struct RPScreenMode *sm, struct uae_prefs *p, bool g
                sm->dwScreenMode &= ~RP_SCREENMODE_SCALEMASK;
                sm->dwScreenMode = RP_SCREENMODE_SCALE_TARGET;
                sm->lTargetWidth = gm->gfx_size_win.width;
-               sm->lTargetHeight = gm->gfx_size_win.height;
+               sm->lTargetHeight = ntsc_extended && p->gfx_ntscpixels ? gfx_height_original : gm->gfx_size_win.height;
        }
        sm->dwClipFlags = cf;
 
@@ -914,6 +917,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
        int width, height;
        bool half;
 
+       gfx_height_original = gm->gfx_size_win.height;
        storeflags = sm->dwScreenMode;
        minimized = 0;
        if (display) {
@@ -1110,8 +1114,8 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        p->gf[0].gfx_filter_integerscalelimit = 0;
                        if (sm->dwClipFlags & RP_CLIPFLAGS_AUTOCLIP) {
                                p->gf[0].gfx_filter_autoscale = AUTOSCALE_INTEGER_AUTOSCALE;
-                               p->gfx_xcenter_pos = -1;
-                               p->gfx_ycenter_pos = -1;
+                               p->gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                               p->gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
                                p->gfx_xcenter_size = -1;
                                p->gfx_ycenter_size = -1;
                        } else {
@@ -1131,48 +1135,75 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        
                }
 
-               if (keepaspect) {
-                       p->gf[0].gfx_filter_aspect = -1;
-                       p->gf[0].gfx_filter_keep_autoscale_aspect = integerscale ? 0 : 1;
-                       p->gf[0].gfx_filter_keep_aspect = 1;
-               } else {
-                       p->gf[0].gfx_filter_aspect = 0;
-                       p->gf[0].gfx_filter_keep_autoscale_aspect = 0;
-                       p->gf[0].gfx_filter_keep_aspect = 0;
-               }
-
                if (!integerscale) {
                        if (sm->dwClipFlags & RP_CLIPFLAGS_AUTOCLIP) {
-                               if (!forcesize)
+                               if (!forcesize) {
                                        p->gf[0].gfx_filter_autoscale = AUTOSCALE_RESIZE;
-                               else
+                                       if (sm->dwScreenMode & RP_SCREENMODE_PIXEL_ORIGINAL_RATIO) {
+                                               p->gfx_ntscpixels = true;
+                                       }
+                               } else {
                                        p->gf[0].gfx_filter_autoscale = AUTOSCALE_NORMAL;
-                               p->gfx_xcenter_pos = -1;
-                               p->gfx_ycenter_pos = -1;
+                               }
+                               p->gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                               p->gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
                                p->gfx_xcenter_size = -1;
                                p->gfx_ycenter_size = -1;
                        } else if (sm->dwClipFlags & RP_CLIPFLAGS_NOCLIP) {
                                p->gf[0].gfx_filter_autoscale = AUTOSCALE_STATIC_MAX;
-                               p->gfx_xcenter_pos = -1;
-                               p->gfx_ycenter_pos = -1;
+                               p->gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                               p->gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
                                p->gfx_xcenter_size = -1;
                                p->gfx_ycenter_size = -1;
                                if (!forcesize) {
                                        gm->gfx_size_win.width = AMIGA_WIDTH_MAX << currprefs.gfx_resolution;
-                                       gm->gfx_size_win.height = AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution;;
+                                       gm->gfx_size_win.height = AMIGA_HEIGHT_MAX << currprefs.gfx_vresolution;
                                }
                        }
 
-                       if (sm->lClipWidth > 0)
+                       if (sm->lClipWidth > 0) {
                                p->gfx_xcenter_size = sm->lClipWidth;
-                       if (sm->lClipHeight > 0)
+                       }
+                       if (sm->lClipHeight > 0) {
                                p->gfx_ycenter_size = sm->lClipHeight;
+                       }
+
+                       gfx_height_original = gm->gfx_size_win.height;
 
-                       if ((p->gfx_xcenter_pos >= 0 && p->gfx_ycenter_pos >= 0) || (p->gfx_xcenter_size > 0 && p->gfx_ycenter_size > 0)) {
+                       if ((p->gfx_xcenter_pos >= MANUAL_SCALE_MIN_RANGE && p->gfx_ycenter_pos >= MANUAL_SCALE_MIN_RANGE) || (p->gfx_xcenter_size > 0 && p->gfx_ycenter_size > 0)) {
                                p->gf[0].gfx_filter_autoscale = AUTOSCALE_MANUAL;
+                               if ((sm->dwScreenMode & RP_SCREENMODE_PIXEL_ORIGINAL_RATIO) && currprefs.ntscmode) {
+                                       int lh;
+                                       bool isp = ispal(&lh);
+                                       if (!isp) {
+                                               float palh = (313 - 25) * 2 + 1.0f;
+                                               float ntsch = (263 - 20) * 2 + 1.0f;
+                                               float ll = lh * 2 + 1.0f;
+                                               if (abs(lh - (263 - 20)) <= 22) {
+                                                       ll = ntsch;
+                                               }
+                                               if (abs(lh - (313 - 25)) <= 22) {
+                                                       ll = palh;
+                                               }
+                                               gm->gfx_size_win.height = (int)(gm->gfx_size_win.height * palh / ll + 0.5f);
+                                               p->gfx_ntscpixels = true;
+                                               ntsc_extended = true;
+                                       }
+                               }
                        }
                }
 
+               if (keepaspect) {
+                       bool type = p->gf[0].gfx_filter_autoscale == AUTOSCALE_MANUAL && !ntsc_extended;
+                       p->gf[0].gfx_filter_aspect = type ? -1 : 0;
+                       p->gf[0].gfx_filter_keep_autoscale_aspect = ntsc_extended ? 0 : 1;
+                       p->gf[0].gfx_filter_keep_aspect = 1;
+               } else {
+                       p->gf[0].gfx_filter_aspect = 0;
+                       p->gf[0].gfx_filter_keep_autoscale_aspect = 0;
+                       p->gf[0].gfx_filter_keep_aspect = 0;
+               }
+
                p->gf[0].gfx_filter_horiz_zoom_mult = hmult;
                p->gf[0].gfx_filter_vert_zoom_mult = vmult;
 
@@ -1198,33 +1229,31 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                        p->gf[0].gfx_filter_bilinear = interpolation_old(sm->dwScreenMode);
                }
 
-               if (sm->dwScreenMode & RP_SCREENMODE_PIXEL_ORIGINAL_RATIO) {
-                       p->gfx_ntscpixels = true;
-               }
        }
 
        if (log_rp & 2) {
                write_log(_T("%dx%d %dx%d %dx%d %08x HM=%.1f VM=%.1f\n"),
                        sm->lClipLeft, sm->lClipTop, sm->lClipWidth, sm->lClipHeight, sm->lTargetWidth, sm->lTargetHeight, sm->dwClipFlags, hmult, vmult);
                if (WIN32GFX_IsPicassoScreen(mon)) {
-                       write_log (_T("RTG WW=%d WH=%d FW=%d FH=%d HM=%.1f VM=%.1f\n"),
+                       write_log(_T("RTG WW=%d WH=%d FW=%d FH=%d HM=%.1f VM=%.1f\n"),
                                gm->gfx_size_win.width, gm->gfx_size_win.height,
                                gm->gfx_size_fs.width, gm->gfx_size_fs.height,
                                p->rtg_horiz_zoom_mult, p->rtg_vert_zoom_mult);
                } else {
-                       write_log (_T("WW=%d (%d) WH=%d (%d) FW=%d (%d) FH=%d (%d) HM=%.1f VM=%.1f XP=%d YP=%d XS=%d YS=%d AS=%d AR=%d,%d\n"),
+                       write_log(_T("WW=%d (%d) WH=%d (%d) FW=%d (%d) FH=%d (%d) HM=%.1f VM=%.1f XP=%d YP=%d XS=%d YS=%d AS=%d AR=%d,%d, N=%d (%d)\n"),
                                gm->gfx_size_win.width, gmc->gfx_size_win.width, gm->gfx_size_win.height, gmc->gfx_size.height,
                                gm->gfx_size_fs.width, gmc->gfx_size_fs.width, gm->gfx_size_fs.height, gmc->gfx_size_fs.height,
                                p->gf[0].gfx_filter_horiz_zoom_mult, p->gf[0].gfx_filter_vert_zoom_mult,
                                p->gfx_xcenter_pos, p->gfx_ycenter_pos,
                                p->gfx_xcenter_size, p->gfx_ycenter_size,
-                               p->gf[0].gfx_filter_autoscale, p->gf[0].gfx_filter_aspect, p->gf[0].gfx_filter_keep_aspect);
+                               p->gf[0].gfx_filter_autoscale, p->gf[0].gfx_filter_aspect, p->gf[0].gfx_filter_keep_aspect,
+                               gfx_height_original, p->gfx_ntscpixels);
                }
        }
 
        updatewinfsmode(0, p);
        hwndset = 0;
-       set_config_changed ();
+       set_config_changed();
 #if 0
        write_log (_T("AFTER WW=%d (%d) WH=%d (%d) FW=%d (%d) FH=%d (%d) HM=%.1f VM=%.1f XP=%d YP=%d XS=%d YS=%d AS=%d AR=%d,%d\n"),
                gm->gfx_size_win.width, currprefs.gfx_size_win.width, gm->gfx_size_win.height, currprefs.gfx_size.height,
index 05a090715f740ec6eed16ad7212cf75e31ed5877..a503ce55bdf2e42ecd409699eb695baa38d50667 100644 (file)
@@ -45,12 +45,12 @@ static bool getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp)
        cx = *cxp;
        cy = *cyp;
        v = currprefs.gfx_xcenter_pos;
-       if (v >= 0) {
+       if (v >= MANUAL_SCALE_MIN_RANGE) {
                cx = (v >> (RES_MAX - currprefs.gfx_resolution)) - cx;
        }
 
        v = currprefs.gfx_ycenter_pos;
-       if (v >= 0) {
+       if (v >= MANUAL_SCALE_MIN_RANGE) {
                cy = (v >> (VRES_MAX - currprefs.gfx_vresolution)) - cy;
        }
 
@@ -91,7 +91,7 @@ static bool getmanualpos(int monid, int *cxp, int *cyp, int *cwp, int *chp)
        *cwp = cw;
        *chp = ch;
 
-       return currprefs.gfx_xcenter_pos >= 0 || currprefs.gfx_ycenter_pos >= 0 || currprefs.gfx_xcenter_size > 0 || currprefs.gfx_ycenter_size > 0;
+       return currprefs.gfx_xcenter_pos >= MANUAL_SCALE_MIN_RANGE || currprefs.gfx_ycenter_pos >= MANUAL_SCALE_MIN_RANGE || currprefs.gfx_xcenter_size > 0 || currprefs.gfx_ycenter_size > 0;
 }
 
 static bool get_auto_aspect_ratio(int monid, int cw, int ch, int crealh, int scalemode, float *autoaspectratio, int idx)
@@ -330,7 +330,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                if (scalemode == AUTOSCALE_STATIC_MAX || scalemode == AUTOSCALE_STATIC_NOMINAL ||
                        scalemode == AUTOSCALE_INTEGER || scalemode == AUTOSCALE_INTEGER_AUTOSCALE) {
 
-                       if (scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_STATIC_MAX) {
+                       if (scalemode == AUTOSCALE_STATIC_NOMINAL || scalemode == AUTOSCALE_STATIC_MAX) {
                                // do not default/TV scale programmed modes
                                if (programmedmode) {
                                        goto skipcont;
@@ -349,7 +349,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                                cw = avidinfo->drawbuffer.inwidth;
                                ch = avidinfo->drawbuffer.inheight;
                                cv = 1;
-                               if (scalemode == AUTOSCALE_STATIC_NOMINAL) { // || scalemode == AUTOSCALE_INTEGER)) {
+                               if (scalemode == AUTOSCALE_STATIC_NOMINAL) {
                                        if (currprefs.gfx_overscanmode < OVERSCANMODE_ULTRA) {
                                                cx = 28 << currprefs.gfx_resolution;
                                                cy = 10 << currprefs.gfx_vresolution;
@@ -382,7 +382,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                                bool ok = true;
                                bool manual = false;
 
-                               if (currprefs.gfx_xcenter_pos >= 0 || currprefs.gfx_ycenter_pos >= 0) {
+                               if (currprefs.gfx_xcenter_pos >= MANUAL_SCALE_MIN_RANGE || currprefs.gfx_ycenter_pos >= MANUAL_SCALE_MIN_RANGE) {
                                        changed_prefs.gf[idx].gfx_filter_horiz_offset = currprefs.gf[idx].gfx_filter_horiz_offset = 0.0;
                                        changed_prefs.gf[idx].gfx_filter_vert_offset = currprefs.gf[idx].gfx_filter_vert_offset = 0.0;
                                        filter_horiz_offset = 0.0;
@@ -477,7 +477,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                        filter_horiz_offset = 0.0;
                        filter_vert_offset = 0.0;
 
-                       get_custom_topedge (&cx, &cy, currprefs.gfx_xcenter_pos < 0 && currprefs.gfx_ycenter_pos < 0);
+                       get_custom_topedge (&cx, &cy, currprefs.gfx_xcenter_pos < MANUAL_SCALE_MIN_RANGE && currprefs.gfx_ycenter_pos < MANUAL_SCALE_MIN_RANGE);
                        //write_log (_T("%dx%d %dx%d\n"), cx, cy, currprefs.gfx_resolution, currprefs.gfx_vresolution);
 
                        getmanualpos(monid, &cx, &cy, &cw, &ch);
@@ -597,10 +597,12 @@ void getfilterdata(int monid, struct displayscale *ds)
 
                                int ww = (int)(ds->outwidth * scalex);
                                int hh = (int)(ds->outheight * scaley);
-                               if (currprefs.gfx_xcenter_size >= 0)
+                               if (currprefs.gfx_xcenter_size >= 0) {
                                        ww = currprefs.gfx_xcenter_size;
-                               if (currprefs.gfx_ycenter_size >= 0)
+                               }
+                               if (currprefs.gfx_ycenter_size >= 0) {
                                        hh = currprefs.gfx_ycenter_size;
+                               }
                                if (scalemode == oscalemode && !useold) {
                                        int oldwinw = gmc->gfx_size_win.width;
                                        int oldwinh = gmc->gfx_size_win.height;
index 3223b9fc4a4043b8e9a57ef8b99161d36a7e389c..e549300a61f52d6f68204119adafb05a78ad36dc 100644 (file)
@@ -20576,8 +20576,8 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
                (workprefs.gf[filter_nativertg].gfx_filter_aspect < 0) ? 1 :
                getaspectratioindex (workprefs.gf[filter_nativertg].gfx_filter_aspect) + 2, 0);
 
-       CheckDlgButton (hDlg, IDC_FILTERKEEPASPECT, workprefs.gf[filter_nativertg].gfx_filter_keep_aspect);
-       CheckDlgButton (hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, workprefs.gf[filter_nativertg].gfx_filter_keep_autoscale_aspect != 0);
+       CheckDlgButton(hDlg, IDC_FILTERKEEPASPECT, workprefs.gf[filter_nativertg].gfx_filter_keep_aspect);
+       CheckDlgButton(hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, workprefs.gf[filter_nativertg].gfx_filter_keep_autoscale_aspect != 0);
        CheckDlgButton(hDlg, IDC_SCALENTSC, workprefs.gfx_ntscpixels);
 
        xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_SETCURSEL,
@@ -20648,13 +20648,13 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
        int yrange1, yrange2;
        
        if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_MANUAL) {
-               xrange1 = -1;
-               xrange2 = 1900;
+               xrange1 = MANUAL_SCALE_MIN_RANGE - 1;
+               xrange2 = MANUAL_SCALE_MAX_RANGE;
                yrange1 = xrange1;
                yrange2 = xrange2;
        } else if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_OVERSCAN_BLANK) {
                xrange1 = 0;
-               xrange2 = 1900;
+               xrange2 = MANUAL_SCALE_MAX_RANGE - 1;
                yrange1 = 0;
                yrange2 = 700;
        } else if (workprefs.gf[filter_nativertg].gfx_filter_autoscale == AUTOSCALE_INTEGER ||
@@ -21208,10 +21208,10 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                        fd->gfx_filter_top_border = fdw->gfx_filter_top_border = -1;
                        fd->gfx_filter_right_border = fdw->gfx_filter_right_border = 0;
                        fd->gfx_filter_bottom_border = fdw->gfx_filter_bottom_border = 0;
-                       currprefs.gfx_xcenter_pos = -1;
-                       workprefs.gfx_xcenter_pos = -1;
-                       currprefs.gfx_ycenter_pos = -1;
-                       workprefs.gfx_ycenter_pos = -1;
+                       currprefs.gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                       workprefs.gfx_xcenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                       currprefs.gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
+                       workprefs.gfx_ycenter_pos = MANUAL_SCALE_MIN_RANGE - 1;
                        currprefs.gfx_xcenter_size = -1;
                        workprefs.gfx_xcenter_size = -1;
                        currprefs.gfx_ycenter_size = -1;