]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
PAL/NTSC pixel aspect ratio updates
authorToni Wilen <twilen@winuae.net>
Thu, 14 May 2026 07:35:05 +0000 (10:35 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 14 May 2026 07:35:05 +0000 (10:35 +0300)
cfgfile.cpp
include/options.h
od-win32/resources/winuae.rc
od-win32/rp.cpp
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp

index 4ff05717f906d290d7e0639085dd1d14a9bcc756..48dbc4d31d45d33567e6900db342f101e0aa4fe0 100644 (file)
@@ -210,7 +210,7 @@ static const TCHAR *joyportmodes[] = { _T(""), _T("mouse"), _T("mousenowheel"),
 static const TCHAR *joyportsubmodes_lightpen[] = { _T(""), _T("trojan"), 0 };
 static const TCHAR *joyaf[] = { _T("none"), _T("normal"), _T("toggle"), _T("always"), _T("togglebutton"), 0 };
 static const TCHAR *epsonprinter[] = { _T("none"), _T("ascii"), _T("epson_matrix_9pin"), _T("epson_matrix_24pin"), _T("epson_matrix_48pin"), 0 };
-static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), };
+static const TCHAR *aspects[] = { _T("none"), _T("vga"), _T("tv"), _T("tv_pal"), _T("tv_ntsc"), 0};
 static const TCHAR *vsyncmodes[] = { _T("false"), _T("true"), _T("autoswitch"), 0 };
 static const TCHAR *vsyncmodes2[] = { _T("normal"), _T("busywait"), 0 };
 static const TCHAR *filterapi[] = { _T("directdraw"), _T("direct3d"), _T("direct3d11"), _T("direct3d11"), 0};
@@ -2569,7 +2569,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
                cfgfile_dwrite_bool(f, _T("gfx_filter_bilinear"), ext, gf->gfx_filter_bilinear != 0);
                
                cfgfile_dwrite_ext(f, _T("gfx_filter_keep_autoscale_aspect"), ext, _T("%d"), gf->gfx_filter_keep_autoscale_aspect);
-               cfgfile_dwrite_strarr(f, _T("gfx_filter_keep_aspect"), ext, aspects, gf->gfx_filter_keep_aspect);
+               cfgfile_dwrite_strarr(f, _T("gfx_filter_keep_aspect"), ext, aspects, gf->gfx_filter_aspect_type);
                cfgfile_dwrite_strarr(f, _T("gfx_filter_autoscale"), ext, j != GF_RTG ? autoscale : autoscale_rtg, gf->gfx_filter_autoscale);
                cfgfile_dwrite_strarr(f, _T("gfx_filter_autoscale_limit"), ext, autoscalelimit, gf->gfx_filter_integerscalelimit);
                cfgfile_dwrite_ext(f, _T("gfx_filter_aspect_ratio"), ext, _T("%d:%d"),
@@ -3885,8 +3885,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                struct gfx_filterdata *gf = &p->gf[j];
                const TCHAR *ext = j == 0 ? NULL : (j == 1 ? _T("_rtg") : _T("_lace"));
                if (cfgfile_strval (option, value, _T("gfx_filter_autoscale"), ext, &gf->gfx_filter_autoscale, j != GF_RTG ? autoscale : autoscale_rtg, 0)
-                       || cfgfile_strval (option, value, _T("gfx_filter_keep_aspect"), ext, &gf->gfx_filter_keep_aspect, aspects, 0)
-                       || cfgfile_strval (option, value, _T("gfx_filter_autoscale_limit"), ext, &gf->gfx_filter_integerscalelimit, autoscalelimit, 0)
+                       || cfgfile_strval(option, value, _T("gfx_filter_keep_aspect"), ext, &gf->gfx_filter_aspect_type, aspects, 0)
+                       || cfgfile_strval(option, value, _T("gfx_filter_autoscale_limit"), ext, &gf->gfx_filter_integerscalelimit, autoscalelimit, 0)
                        || cfgfile_floatval(option, value, _T("gfx_filter_vert_zoomf"), ext, &gf->gfx_filter_vert_zoom)
                        || cfgfile_floatval(option, value, _T("gfx_filter_horiz_zoomf"), ext, &gf->gfx_filter_horiz_zoom)
                        || cfgfile_floatval(option, value, _T("gfx_filter_vert_zoom_multf"), ext, &gf->gfx_filter_vert_zoom_mult)
@@ -8682,7 +8682,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
                f->gfx_filter_bilinear = 0;
                f->gfx_filter_filtermodeh = 0;
                f->gfx_filter_filtermodev = 0;
-               f->gfx_filter_keep_aspect = 0;
+               f->gfx_filter_aspect_type = 0;
                f->gfx_filter_autoscale = AUTOSCALE_STATIC_AUTO;
                f->gfx_filter_keep_autoscale_aspect = false;
                f->gfx_filteroverlay_overscan = 0;
index 8a3105cef9c180e1755abbd410f78952cd6800bd..573ff07f505cd77e69090a4ba0bf32ec9b2bc30d 100644 (file)
@@ -369,6 +369,11 @@ struct apmode
 
 #define MAX_LUA_STATES 16
 
+#define ASPECT_TYPE_NONE 0
+#define ASPECT_TYPE_VGA 1
+#define ASPECT_TYPE_TV_AUTO 2
+#define ASPECT_TYPE_TV_PAL 3
+#define ASPECT_TYPE_TV_NTSC 4
 
 #define MAX_FILTERDATA 3
 #define GF_NORMAL 0
@@ -397,7 +402,7 @@ struct gfx_filterdata
        int gfx_filter_noise, gfx_filter_blur;
        int gfx_filter_saturation, gfx_filter_luminance, gfx_filter_contrast;
        int gfx_filter_gamma, gfx_filter_gamma_ch[3];
-       int gfx_filter_keep_aspect, gfx_filter_aspect;
+       int gfx_filter_aspect_type, gfx_filter_aspect;
        int gfx_filter_autoscale;
        int gfx_filter_integerscalelimit;
        int gfx_filter_keep_autoscale_aspect;
index 9341b6dad66e34de6a9e98524f839f2fe63df5c5..713b421d5ca48cc044db6a725db71a6c3123547b 100644 (file)
@@ -980,7 +980,8 @@ BEGIN
     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,205,126,11
-    CONTROL         "Keep aspect ratio",IDC_FILTERKEEPASPECT,"Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,218,126,11
+    CONTROL         "Pixel aspect ratio adjustment",IDC_FILTERKEEPASPECT,
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,14,231,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
@@ -993,7 +994,7 @@ BEGIN
     PUSHBUTTON      "Save",IDC_FILTERPRESETSAVE,265,280,55,14
     PUSHBUTTON      "Delete",IDC_FILTERPRESETDELETE,325,280,55,14
     CONTROL         "Always stretch NTSC mode [] NTSC modes are strecthed to match PAL mode",IDC_SCALENTSC,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,231,125,10
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,219,125,10
 END
 
 IDD_HARDDRIVE DIALOGEX 0, 0, 397, 208
index a1fee52a2b12ff982188f25f104d2d5d3057a02c..4fcc1f7f4d67933a5a3640883222ad361fb9be4b 100644 (file)
@@ -1194,11 +1194,11 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                if (keepaspect) {
                        p->gf[0].gfx_filter_aspect = ntsc_extended ? 0 : -1;
                        p->gf[0].gfx_filter_keep_autoscale_aspect = ntsc_extended || fs ? 0 : 1;
-                       p->gf[0].gfx_filter_keep_aspect = 0;
+                       p->gf[0].gfx_filter_aspect_type = 0;
                } 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_aspect_type = 0;
                }
 
                p->gf[0].gfx_filter_horiz_zoom_mult = hmult;
@@ -1243,7 +1243,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                                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_aspect_type,
                                gfx_height_original, p->gfx_ntscpixels);
                }
        }
@@ -1258,7 +1258,7 @@ static void set_screenmode (struct RPScreenMode *sm, struct uae_prefs *p)
                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_aspect_type);
        write_log (_T("AFTER W=%d (%d) H=%d (%d)\n"), gm->gfx_size.width, currprefs.gfx_size.width, gm->gfx_size.height, currprefs.gfx_size.height);
 #endif
 }
index a593b2f0413a7592cae53fce8e83d4d5fbdd33cd..6d45babbc7d5857a9951240993c5f93911a335c7 100644 (file)
@@ -16,6 +16,9 @@
 #define AUTORESIZE_FRAME_DELAY 4
 
 static float filteroffsetx, filteroffsety, filterxmult = 1.0, filterymult = 1.0;
+static const float palpar = 944.0f / 908.0f;
+static const float ntscpar = 780.0f / 910.0f;
+static const float palntscmult = (3546895.0f / 3579545.0f);
 
 void getfilteroffset(int monid, float *dx, float *dy, float *mx, float *my)
 {
@@ -116,45 +119,46 @@ static bool get_auto_aspect_ratio(int monid, int cw, int ch, int crealh, int sca
        return false;
 }
 
-static float getpalntscratio(float dstratio, int keep_aspect, int palntscadjust)
+static float getpalntscratio(float dstratio, int aspect_type, int palntscadjust)
 {
        int lh = 0;
        bool isp = ispal(&lh);
        float palntscratio = dstratio;
        if (lh > 1) {
-               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;
-               }
                if (currprefs.ntscmode) {
-                       if (palntscadjust && !isp) {
-                               palntscratio = palntscratio * palh / ll;
-                       }
-                       if (keep_aspect == 2 && isp) {
-                               palntscratio = palntscratio * 0.93f;
-                       } else if (keep_aspect == 1 && !isp) {
-                               palntscratio = palntscratio * 0.98f;
+                       if (palntscadjust) {
+                               if (!isp) {
+                                       palntscratio = palntscratio / ntscpar;
+                               }
+                       } else {
+                               if ((aspect_type == ASPECT_TYPE_TV_AUTO && !isp) || aspect_type == ASPECT_TYPE_TV_NTSC) {
+                                       palntscratio = palntscratio / ntscpar;
+                               } else if (aspect_type == ASPECT_TYPE_TV_PAL) {
+                                       palntscratio = palntscratio / palpar / palntscmult;
+                               } else if (aspect_type == ASPECT_TYPE_VGA && !isp) {
+                                       palntscratio = palntscratio * 0.98f;
+                               }
                        }
                } else {
-                       if (palntscadjust && !isp) {
-                               palntscratio = palntscratio * palh / ll;
-                       }
-                       if (keep_aspect == 2 && isp) {
-                               palntscratio = palntscratio * 0.95f;
-                       } else if (keep_aspect == 1 && !isp) {
-                               palntscratio = palntscratio * 0.95f;
+                       if (palntscadjust) {
+                               if (!isp) {
+                                       palntscratio = palntscratio / ntscpar * palntscmult;
+                               }
+                       } else {
+                               if ((aspect_type == ASPECT_TYPE_TV_AUTO && isp) || aspect_type == ASPECT_TYPE_TV_PAL) {
+                                       palntscratio = palntscratio / palpar;
+                               } else if (aspect_type == ASPECT_TYPE_TV_NTSC) {
+                                       palntscratio = palntscratio / ntscpar * palntscmult;
+                               } else if (aspect_type == ASPECT_TYPE_VGA && !isp) {
+                                       palntscratio = palntscratio * 0.95f;
+                               }
                        }
                }
        }
        return palntscratio;
 }
 
-static bool get_aspect(int monid, float *dstratiop, float *srcratiop, float *xmultp, float *ymultp, bool doautoaspect, float autoaspectratio, int keep_aspect, int filter_aspect)
+static bool get_aspect(int monid, float *dstratiop, float *srcratiop, float *xmultp, float *ymultp, bool doautoaspect, float autoaspectratio, int aspect_type, int filter_aspect)
 {
        struct amigadisplay *ad = &adisplays[monid];
        bool aspect = false;
@@ -164,24 +168,31 @@ static bool get_aspect(int monid, float *dstratiop, float *srcratiop, float *xmu
        *xmultp = 1.0;
        *ymultp = 1.0;
 
-       if (keep_aspect || filter_aspect != 0) {
+       if (aspect_type || filter_aspect != 0) {
 
-               if (keep_aspect) {
+               if (aspect_type) {
                        if (isvga()) {
-                               if (keep_aspect == 1)
+                               if (aspect_type == ASPECT_TYPE_VGA) {
                                        dstratio = dstratio * 0.93f;
+                               }
                        } else {
                                bool isp = ispal(NULL);
                                if (currprefs.ntscmode) {
-                                       if (keep_aspect == 2 && !isp)
-                                               dstratio = dstratio * 0.93f;
-                                       else if (keep_aspect == 1 && isp)
+                                       if ((aspect_type == ASPECT_TYPE_TV_AUTO && !isp) || aspect_type == ASPECT_TYPE_TV_NTSC) {
+                                               dstratio = dstratio / ntscpar;
+                                       } else if (aspect_type == ASPECT_TYPE_TV_PAL) {
+                                               dstratio = dstratio / palpar / palntscmult;
+                                       } else if (aspect_type == ASPECT_TYPE_VGA && isp) {
                                                dstratio = dstratio * 0.98f;
+                                       }
                                } else {
-                                       if (keep_aspect == 2 && isp)
-                                               dstratio = dstratio * 0.95f;
-                                       else if (keep_aspect == 1 && !isp)
+                                       if ((aspect_type == ASPECT_TYPE_TV_AUTO && isp) || aspect_type == ASPECT_TYPE_TV_PAL) {
+                                               dstratio = dstratio / palpar;
+                                       } else if (aspect_type == ASPECT_TYPE_TV_NTSC) {
+                                               dstratio = dstratio / ntscpar * palntscmult;
+                                       } else if (aspect_type == ASPECT_TYPE_VGA && !isp) {
                                                dstratio = dstratio * 0.95f;
+                                       }
                                }
                        }
                }
@@ -228,7 +239,7 @@ void getfilterdata(int monid, struct displayscale *ds)
        bool doautoaspect = false;
        float autoaspectratio;
        int idx = ad->gf_index;
-       int keep_aspect = currprefs.gf[idx].gfx_filter_keep_aspect;
+       int aspect_type = currprefs.gf[idx].gfx_filter_aspect_type;
        int filter_aspect = currprefs.gf[idx].gfx_filter_aspect;
        int palntscadjust = currprefs.gfx_ntscpixels;
        int autoselect = 0;
@@ -298,7 +309,7 @@ void getfilterdata(int monid, struct displayscale *ds)
 
        if (!specialmode && scalemode == AUTOSCALE_STATIC_AUTO) {
                filter_aspect = 0;
-               keep_aspect = 0;
+               aspect_type = 0;
                if (ds->dstwidth >= 640 && ds->dstwidth <= 800 && ds->dstheight >= 480 && ds->dstheight <= 600) {
                        int hres = currprefs.gfx_resolution + doublescan2x;
                        autoselect = 1;
@@ -424,7 +435,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                                doautoaspect = get_auto_aspect_ratio(cw, ch, crealh, scalemode, &autoaspectratio);
                                autoaspect_done = true;
 
-                               if (get_aspect(&dstratio, &srcratio, &xmult, &ymult, doautoaspect, autoaspectratio, keep_aspect, filter_aspect)) {
+                               if (get_aspect(&dstratio, &srcratio, &xmult, &ymult, doautoaspect, autoaspectratio, aspect_type, filter_aspect)) {
                                        cw += cw - cw * xmult;
                                        ch += ch - ch * ymult;
                                }
@@ -603,7 +614,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                                float scalex = currprefs.gf[idx].gfx_filter_horiz_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_horiz_zoom_mult : 1.0f;
                                float scaley = currprefs.gf[idx].gfx_filter_vert_zoom_mult > 0 ? currprefs.gf[idx].gfx_filter_vert_zoom_mult : 1.0f;
 
-                               float palntscratio = getpalntscratio(dstratio, keep_aspect, palntscadjust);
+                               float palntscratio = getpalntscratio(dstratio, aspect_type, palntscadjust);
                                scaley = scaley * palntscratio / dstratio;
 
                                if (doublescan2x > 0) {
@@ -673,7 +684,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                                diffy = ds->outheight;
                        }
 
-                       if (get_aspect(monid, &dstratio, &srcratio, &xmult, &ymult, doautoaspect, autoaspectratio, keep_aspect, filter_aspect)) {
+                       if (get_aspect(monid, &dstratio, &srcratio, &xmult, &ymult, doautoaspect, autoaspectratio, aspect_type, filter_aspect)) {
                                diff = diffx - (int)(diffx * xmult);
                                sizeoffset(ds, diff, 0);
                                filteroffsetx += -diff / 2;
@@ -714,7 +725,7 @@ cont:
 
                sizeoffset(ds, extraw, extrah);
 
-               if (keep_aspect) {
+               if (aspect_type) {
                        float xm, ym, m;
 
                        xm = (float)aws / ds->dstwidth;
@@ -750,7 +761,7 @@ cont:
        }
 
        {
-               float palntscratio = getpalntscratio(dstratio, keep_aspect, palntscadjust);
+               float palntscratio = getpalntscratio(dstratio, aspect_type, palntscadjust);
                ymult = ymult * palntscratio / dstratio;
        }
 
index bcc9c8bfa499182994b71928a4444ed2f7e9dac1..6e1a04a5d2ca74a7f4fa1397d3ed57c4608ce84a 100644 (file)
@@ -2096,7 +2096,7 @@ int check_prefs_changed_gfx(void)
 
                c |= gf->gfx_filter_aspect != gfc->gfx_filter_aspect ? (1) : 0;
                c |= gf->gfx_filter_rotation != gfc->gfx_filter_rotation ? (1) : 0;
-               c |= gf->gfx_filter_keep_aspect != gfc->gfx_filter_keep_aspect ? (1) : 0;
+               c |= gf->gfx_filter_aspect_type != gfc->gfx_filter_aspect_type ? (1) : 0;
                c |= gf->gfx_filter_keep_autoscale_aspect != gfc->gfx_filter_keep_autoscale_aspect ? (1) : 0;
                c |= gf->gfx_filter_luminance != gfc->gfx_filter_luminance ? (1) : 0;
                c |= gf->gfx_filter_contrast != gfc->gfx_filter_contrast ? (1) : 0;
index 2d99e28e13dddf5dd3d0eed06fa9f8e24a808ecb..6fe6262d9c7e14a649a84c1782f15f2e853983b7 100644 (file)
@@ -20489,9 +20489,9 @@ static void enable_for_hw3ddlg (HWND hDlg)
        ew(hDlg, IDC_FILTERFILTERH, TRUE);
        ew(hDlg, IDC_FILTERFILTERV, TRUE);
        ew(hDlg, IDC_FILTERSTACK, workprefs.gfx_api);
-       ew(hDlg, IDC_FILTERKEEPASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO);
-       ew(hDlg, IDC_FILTERASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO);
-       ew(hDlg, IDC_FILTERASPECT2, v && workprefs.gf[filter_nativertg].gfx_filter_keep_aspect && scalemode != AUTOSCALE_STATIC_AUTO);
+       ew(hDlg, IDC_FILTERKEEPASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO && !workprefs.gfx_ntscpixels);
+       ew(hDlg, IDC_FILTERASPECT, v && scalemode != AUTOSCALE_STATIC_AUTO && !workprefs.gfx_ntscpixels);
+       ew(hDlg, IDC_FILTERASPECT2, v && workprefs.gf[filter_nativertg].gfx_filter_aspect_type && scalemode != AUTOSCALE_STATIC_AUTO && !workprefs.gfx_ntscpixels);
        ew(hDlg, IDC_FILTERKEEPAUTOSCALEASPECT, scalemode == AUTOSCALE_NORMAL || scalemode == AUTOSCALE_INTEGER_AUTOSCALE);
        ew(hDlg, IDC_FILTEROVERLAY, workprefs.gfx_api);
        ew(hDlg, IDC_FILTEROVERLAYTYPE, workprefs.gfx_api);
@@ -20592,7 +20592,7 @@ static void *filtervars_wp[] = {
        &workprefs.gfx_xcenter, &workprefs.gfx_ycenter,
        &workprefs.gf[0].gfx_filter_luminance, &workprefs.gf[0].gfx_filter_contrast, &workprefs.gf[0].gfx_filter_saturation,
        &workprefs.gf[0].gfx_filter_gamma, &workprefs.gf[0].gfx_filter_blur, &workprefs.gf[0].gfx_filter_noise,
-       &workprefs.gf[0].gfx_filter_keep_aspect, &workprefs.gf[0].gfx_filter_aspect,
+       &workprefs.gf[0].gfx_filter_aspect_type, &workprefs.gf[0].gfx_filter_aspect,
        &workprefs.gf[0].gfx_filter_autoscale, &workprefs.gf[0].gfx_filter_bilinear,
        &workprefs.gf[0].gfx_filter_keep_autoscale_aspect,
        &workprefs.gf[0].gfx_filter_integerscalelimit,
@@ -20611,7 +20611,7 @@ static void *filtervars_cp[] = {
        &currprefs.gfx_xcenter, &currprefs.gfx_ycenter,
        &currprefs.gf[0].gfx_filter_luminance, &currprefs.gf[0].gfx_filter_contrast, &currprefs.gf[0].gfx_filter_saturation,
        &currprefs.gf[0].gfx_filter_gamma, &currprefs.gf[0].gfx_filter_blur, &currprefs.gf[0].gfx_filter_noise,
-       &currprefs.gf[0].gfx_filter_keep_aspect, &currprefs.gf[0].gfx_filter_aspect,
+       &currprefs.gf[0].gfx_filter_aspect_type, &currprefs.gf[0].gfx_filter_aspect,
        &currprefs.gf[0].gfx_filter_autoscale, &currprefs.gf[0].gfx_filter_bilinear,
        &currprefs.gf[0].gfx_filter_keep_autoscale_aspect,
        &currprefs.gf[0].gfx_filter_integerscalelimit,
@@ -20691,12 +20691,12 @@ 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_FILTERKEEPASPECT, workprefs.gf[filter_nativertg].gfx_filter_aspect_type);
        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,
-               workprefs.gf[filter_nativertg].gfx_filter_keep_aspect, 0);
+               workprefs.gf[filter_nativertg].gfx_filter_aspect_type, 0);
 
        xSendDlgItemMessage (hDlg, IDC_FILTERINTEGER, CB_RESETCONTENT, 0, 0L);
        xSendDlgItemMessage (hDlg, IDC_FILTERINTEGER, CB_ADDSTRING, 0, (LPARAM)_T("1/1"));
@@ -21255,11 +21255,13 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                xSendDlgItemMessage (hDlg, IDC_FILTERASPECT, CB_ADDSTRING, 0, (LPARAM)tmp);
                addaspectratios (hDlg, IDC_FILTERASPECT);
 
-               xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_RESETCONTENT, 0, 0);
-               WIN32GUI_LoadUIString (IDS_DISABLED, tmp, sizeof tmp / sizeof (TCHAR));
-               xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)tmp);
-               xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("VGA"));
-               xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("TV"));
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_RESETCONTENT, 0, 0);
+               WIN32GUI_LoadUIString(IDS_DISABLED, tmp, sizeof tmp / sizeof (TCHAR));
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)tmp);
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("VGA"));
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("TV (Auto)"));
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("TV (PAL)"));
+               xSendDlgItemMessage(hDlg, IDC_FILTERASPECT2, CB_ADDSTRING, 0, (LPARAM)_T("TV (NTSC)"));
 
                xSendDlgItemMessage (hDlg, IDC_FILTER_NATIVERTG, CB_RESETCONTENT, 0, 0L);
                WIN32GUI_LoadUIString (IDS_SCREEN_NATIVE, tmp, sizeof tmp / sizeof (TCHAR));
@@ -21349,9 +21351,9 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                case IDC_FILTERKEEPASPECT:
                        {
                                if (ischecked (hDlg, IDC_FILTERKEEPASPECT))
-                                       currprefs.gf[filter_nativertg].gfx_filter_keep_aspect = workprefs.gf[filter_nativertg].gfx_filter_keep_aspect = 1;
+                                       currprefs.gf[filter_nativertg].gfx_filter_aspect_type = workprefs.gf[filter_nativertg].gfx_filter_aspect_type = 1;
                                else
-                                       currprefs.gf[filter_nativertg].gfx_filter_keep_aspect = workprefs.gf[filter_nativertg].gfx_filter_keep_aspect = 0;
+                                       currprefs.gf[filter_nativertg].gfx_filter_aspect_type = workprefs.gf[filter_nativertg].gfx_filter_aspect_type = 0;
                                enable_for_hw3ddlg (hDlg);
                                values_to_hw3ddlg (hDlg, false);
                                updatedisplayarea(-1);
@@ -21390,7 +21392,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                        if (getdlgnumber(hz, &val, -99, 99)) {
                                                fd->gfx_filter_horiz_zoom = (float)val;
                                                xSendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, val);
-                                               if (fdwp->gfx_filter_keep_aspect) {
+                                               if (fdwp->gfx_filter_aspect_type) {
                                                        fd->gfx_filter_vert_zoom = currprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
                                                        xSendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_vert_zoom);
                                                }
@@ -21399,7 +21401,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                        if (getdlgnumber(vz, &val, -99, 99)) {
                                                fd->gfx_filter_vert_zoom = (float)val;
                                                xSendDlgItemMessage(hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, val);
-                                               if (fdwp->gfx_filter_keep_aspect) {
+                                               if (fdwp->gfx_filter_aspect_type) {
                                                        fd->gfx_filter_horiz_zoom = currprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
                                                        xSendDlgItemMessage(hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_horiz_zoom);
                                                }
@@ -21576,7 +21578,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                                        {
                                                int v = xSendDlgItemMessage (hDlg, IDC_FILTERASPECT2, CB_GETCURSEL, 0, 0L);
                                                if (v != CB_ERR)
-                                                       currprefs.gf[filter_nativertg].gfx_filter_keep_aspect = workprefs.gf[filter_nativertg].gfx_filter_keep_aspect = v;
+                                                       currprefs.gf[filter_nativertg].gfx_filter_aspect_type = workprefs.gf[filter_nativertg].gfx_filter_aspect_type = v;
                                                updatedisplayarea(-1);
                                        }
                                        break;
@@ -21620,13 +21622,13 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                        } else {
                                if (h == hz) {
                                        fd->gfx_filter_horiz_zoom = (float)SendMessage (hz, TBM_GETPOS, 0, 0);
-                                       if (fdwp->gfx_filter_keep_aspect) {
+                                       if (fdwp->gfx_filter_aspect_type) {
                                                fd->gfx_filter_vert_zoom = currprefs.gf[filter_nativertg].gfx_filter_horiz_zoom;
                                                xSendDlgItemMessage (hDlg, IDC_FILTERVZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_vert_zoom);
                                        }
                                } else if (h == vz) {
                                        fd->gfx_filter_vert_zoom = (float)SendMessage (vz, TBM_GETPOS, 0, 0);
-                                       if (fdwp->gfx_filter_keep_aspect) {
+                                       if (fdwp->gfx_filter_aspect_type) {
                                                fd->gfx_filter_horiz_zoom = currprefs.gf[filter_nativertg].gfx_filter_vert_zoom;
                                                xSendDlgItemMessage (hDlg, IDC_FILTERHZ, TBM_SETPOS, TRUE, (int)fdwp->gfx_filter_horiz_zoom);
                                        }