]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Stretch NTSC to PAL height option
authorToni Wilen <twilen@winuae.net>
Sun, 28 Sep 2025 08:19:27 +0000 (11:19 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 28 Sep 2025 08:19:27 +0000 (11:19 +0300)
cfgfile.cpp
custom.cpp
include/options.h
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp

index 46208d1da4cc25f0fdcbb4e6ff68d3d72dcb6d9b..4500935385337480b21a142156eaf0c96d8efe02 100644 (file)
@@ -2485,7 +2485,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_dwrite_strarr(f, _T("gfx_overscanmode"), overscanmodes, p->gfx_overscanmode);
        cfgfile_dwrite(f, _T("gfx_monitorblankdelay"), _T("%d"), p->gfx_monitorblankdelay);
        cfgfile_dwrite(f, _T("gfx_rotation"), _T("%d"), p->gfx_rotation);
-       cfgfile_dwrite (f, _T("gfx_bordercolor"), _T("0x%08x"), p->gfx_bordercolor);
+       cfgfile_dwrite(f, _T("gfx_bordercolor"), _T("0x%08x"), p->gfx_bordercolor);
+       cfgfile_dwrite_bool(f, _T("gfx_ntscpixels"), p->gfx_ntscpixels);
 
 #ifdef GFXFILTER
        for (int j = 0; j < MAX_FILTERDATA; j++) {
@@ -3716,6 +3717,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                || cfgfile_intval(option, value, _T("gfx_vertical_extra"), &p->gfx_extraheight, 1)
                || cfgfile_intval(option, value, _T("gfx_monitorblankdelay"), &p->gfx_monitorblankdelay, 1)
                || cfgfile_intval(option, value, _T("gfx_bordercolor"), &p->gfx_bordercolor, 1)
+               || cfgfile_yesno(option, value, _T("gfx_ntscpixels"), &p->gfx_ntscpixels)
 
                || cfgfile_intval (option, value, _T("floppy0sound"), &p->floppyslots[0].dfxclick, 1)
                || cfgfile_intval (option, value, _T("floppy1sound"), &p->floppyslots[1].dfxclick, 1)
@@ -8629,6 +8631,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
                f->enable = true;
        }
        p->gf[2].enable = false;
+       p->gfx_ntscpixels = 1;
 
        p->rtg_horiz_zoom_mult = 1.0;
        p->rtg_vert_zoom_mult = 1.0;
index 41dbe5af7703de24064114b07e580b177981ef9e..bc82373df26ea4a10eeb51cf20c16f5e3818274c 100644 (file)
@@ -12764,12 +12764,19 @@ bool isvga(void)
 bool ispal(int *lines)
 {
        if (lines) {
-               *lines = current_linear_vpos_visible;
+               if (current_linear_vpos_visible) {
+                       *lines = current_linear_vpos_visible;
+               } else {
+                       *lines = currprefs.ntscmode ? (MAXVPOS_NTSC + 1) - (VBLANK_ENDLINE_NTSC - 1) : (MAXVPOS_PAL + 1) - (VBLANK_ENDLINE_PAL - 1);
+               }
        }
        if (programmedmode == 1) {
                return currprefs.ntscmode == 0;
        }
-       return current_linear_vpos_nom >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2;
+       if (current_linear_vpos_nom) {
+               return current_linear_vpos_nom >= MAXVPOS_NTSC + (MAXVPOS_PAL - MAXVPOS_NTSC) / 2;
+       }
+       return currprefs.ntscmode == 0;
 }
 
 void custom_end_drawing(void)
index b3a1dd7305517e4b5fbe70022aa314c1f5633665..2dabbb52019d20ed28bce4535f419f658fc83855 100644 (file)
@@ -625,7 +625,7 @@ struct uae_prefs {
        int gfx_overscanmode;
        int gfx_monitorblankdelay;
        int gfx_rotation;
-       int gfx_ntscpixels;
+       bool gfx_ntscpixels;
        uae_u32 gfx_bordercolor;
 
        struct gfx_filterdata gf[3];
index c14e5fbcbaaf46d8fc8744039ff1a0e3a57812fe..6b3489f20e97d26bfc8659327d82d07c5b12acd6 100644 (file)
 #define IDC_LM_IDOUBLED3                1200
 #define IDC_CPU0                        1200
 #define IDC_CPU1                        1201
+#define IDC_SCALENTSC                   1201
 #define IDC_CPU2                        1202
 #define IDC_CPU3                        1203
 #define IDC_CPU4                        1204
index 4780e2800cca4abae6f08840fda4635c4b1b0f47..637973f7e819623730e4e5e744d83f9657640b2f 100644 (file)
@@ -985,6 +985,8 @@ BEGIN
     PUSHBUTTON      "Load",IDC_FILTERPRESETLOAD,205,280,55,14
     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
 END
 
 IDD_HARDDRIVE DIALOGEX 0, 0, 397, 208
index b0e7052f7ce9e6e6b51b9bd68fa517bce5ddc71c..05a090715f740ec6eed16ad7212cf75e31ed5877 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <float.h>
 
-#define AUTORESIZE_FRAME_DELAY 10
+#define AUTORESIZE_FRAME_DELAY 4
 
 static float filteroffsetx, filteroffsety, filterxmult = 1.0, filterymult = 1.0;
 
@@ -113,6 +113,44 @@ 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)
+{
+       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;
+                       }
+               } 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;
+                       }
+               }
+       }
+       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)
 {
        struct amigadisplay *ad = &adisplays[monid];
@@ -189,7 +227,7 @@ void getfilterdata(int monid, struct displayscale *ds)
        int idx = ad->gf_index;
        int keep_aspect = currprefs.gf[idx].gfx_filter_keep_aspect;
        int filter_aspect = currprefs.gf[idx].gfx_filter_aspect;
-       int palntscadjust = 1;
+       int palntscadjust = currprefs.gfx_ntscpixels;
        int autoselect = 0;
 
        float filter_horiz_zoom = currprefs.gf[idx].gfx_filter_horiz_zoom / 1000.0f;
@@ -242,7 +280,6 @@ void getfilterdata(int monid, struct displayscale *ds)
        if (!specialmode && scalemode == AUTOSCALE_STATIC_AUTO) {
                filter_aspect = 0;
                keep_aspect = 0;
-               palntscadjust = 1;
                if (ds->dstwidth >= 640 && ds->dstwidth <= 800 && ds->dstheight >= 480 && ds->dstheight <= 600 && !programmedmode) {
                        autoselect = 1;
                        scalemode = AUTOSCALE_NONE;
@@ -493,8 +530,11 @@ void getfilterdata(int monid, struct displayscale *ds)
 
                        if (scalemode == AUTOSCALE_CENTER) {
 
-                               int ww = cw * ds->scale;
-                               int hh = ch * ds->scale;
+                               int scalex = ds->scale;
+                               int scaley = ds->scale;
+
+                               int ww = cw * scalex;
+                               int hh = ch * scaley;
 
                                ds->outwidth = ds->dstwidth * ds->scale;
                                ds->outheight = ds->dstheight * ds->scale;
@@ -547,6 +587,9 @@ 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);
+                               scaley = scaley * palntscratio / dstratio;
+
                                ds->outwidth = (int)(cw * ds->scale);
                                ds->outheight = (int)(ch * ds->scale);
                                ds->xoffset += cx * ds->scale;
@@ -564,8 +607,9 @@ void getfilterdata(int monid, struct displayscale *ds)
                                        gmh->gfx_size_win.width = ww;
                                        gmh->gfx_size_win.height = hh;
                                        fixup_prefs_dimensions (&changed_prefs);
-                                       if (oldwinw != gmh->gfx_size_win.width || oldwinh != gmh->gfx_size_win.height)
+                                       if (oldwinw != gmh->gfx_size_win.width || oldwinh != gmh->gfx_size_win.height) {
                                                set_config_changed ();
+                                       }
                                }
                                ds->xoffset += -(gmh->gfx_size_win.width - ww + 1) / 2;
                                ds->yoffset += -(gmh->gfx_size_win.height - hh + 1) / 2;
@@ -674,63 +718,8 @@ cont:
        }
 
        {
-               int lh = 0;
-               bool isp = ispal(&lh);
-               if (lh > 1) {
-                       float palntscratio = dstratio;
-                       float palh = (312 - 25) * 2 + 1.0f;
-                       float ntsch = (262 - 20) * 2 + 1.0f;
-                       float ll = (lh - 23) * 2 + 1.0f;
-                       if (abs(lh - (262 - 20)) <= 22) {
-                               ll = ntsch;
-                       }
-                       if (abs(lh - (312 - 25)) <= 22) {
-                               ll = palh;
-                       }
-                       if (currprefs.gfx_ntscpixels) {
-                               if (!isp) {
-                                       palntscratio = palntscratio * palh / ll;
-                               }
-                               if (currprefs.ntscmode) {
-                                       if (keep_aspect == 2 && isp) {
-                                               palntscratio = palntscratio * 0.93f;
-                                       }
-                                       else if (keep_aspect == 1 && !isp) {
-                                               palntscratio = palntscratio * 0.98f;
-                                       }
-                               } else {
-                                       if (keep_aspect == 2 && isp) {
-                                               palntscratio = palntscratio * 0.95f;
-                                       }
-                                       else if (keep_aspect == 1 && !isp) {
-                                               palntscratio = palntscratio * 0.95f;
-                                       }
-                               }
-                       } else {
-                               if (currprefs.ntscmode) {
-                                       if (palntscadjust && isp) {
-                                               palntscratio = palntscratio * ntsch / ll;
-                                       }
-                                       if (keep_aspect == 2 && isp) {
-                                               palntscratio = palntscratio * 0.93f;
-                                       } else if (keep_aspect == 1 && !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 (palntscratio != dstratio) {
-                               ymult = ymult * palntscratio / dstratio;
-                       }
-               }
+               float palntscratio = getpalntscratio(dstratio, keep_aspect, palntscadjust);
+               ymult = ymult * palntscratio / dstratio;
        }
 
        if (srcratio > dstratio) {
index 60baa72b08e0965fe4b459e179dd145fd15b2e35..71f8526773588deefaff10fa1d2e22c1fea455cb 100644 (file)
@@ -2137,6 +2137,7 @@ int check_prefs_changed_gfx(void)
        c |= currprefs.gfx_scandoubler != changed_prefs.gfx_scandoubler ? (2 | 8) : 0;
        c |= currprefs.gfx_threebitcolors != changed_prefs.gfx_threebitcolors ? (256) : 0;
        c |= currprefs.gfx_grayscale != changed_prefs.gfx_grayscale ? (512) : 0;
+       c |= currprefs.gfx_ntscpixels != changed_prefs.gfx_ntscpixels ? (512) : 0;
        c |= currprefs.gfx_monitorblankdelay != changed_prefs.gfx_monitorblankdelay ? (512) : 0;
 
        c |= currprefs.gfx_display_sections != changed_prefs.gfx_display_sections ? (512) : 0;
@@ -2240,6 +2241,7 @@ int check_prefs_changed_gfx(void)
                currprefs.gfx_scandoubler = changed_prefs.gfx_scandoubler;
                currprefs.gfx_threebitcolors = changed_prefs.gfx_threebitcolors;
                currprefs.gfx_grayscale = changed_prefs.gfx_grayscale;
+               currprefs.gfx_ntscpixels = changed_prefs.gfx_ntscpixels;
                currprefs.gfx_monitorblankdelay = changed_prefs.gfx_monitorblankdelay;
 
                currprefs.gfx_display_sections = changed_prefs.gfx_display_sections;
index 7da2e7543e976ae07203bc23c67506ef54ede028..3223b9fc4a4043b8e9a57ef8b99161d36a7e389c 100644 (file)
@@ -15640,7 +15640,7 @@ static INT_PTR CALLBACK HardfileSettingsProc (HWND hDlg, UINT msg, WPARAM wParam
                case IDC_HF_TYPE:
                        res = xSendDlgItemMessage (hDlg, IDC_HF_TYPE, CB_GETCURSEL, 0, 0);
                        sethfdostype (hDlg, (int)res);
-                       ew (hDlg, IDC_HF_DOSTYPE, res >= 4);
+                       ew (hDlg, IDC_HF_DOSTYPE, res >= 5);
                        break;
                case IDC_HF_CREATE:
                        {
@@ -20578,6 +20578,7 @@ static void values_to_hw3ddlg (HWND hDlg, bool initdialog)
 
        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,
                workprefs.gf[filter_nativertg].gfx_filter_keep_aspect, 0);
@@ -21224,6 +21225,12 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                case IDC_FILTERPRESETDELETE:
                        filter_preset (hDlg, wParam);
                        break;
+               case IDC_SCALENTSC:
+                       currprefs.gfx_ntscpixels = workprefs.gfx_ntscpixels = ischecked(hDlg, IDC_SCALENTSC);
+                       enable_for_hw3ddlg(hDlg);
+                       values_to_hw3ddlg(hDlg, false);
+                       updatedisplayarea(-1);
+                       break;
                case IDC_FILTERKEEPASPECT:
                        {
                                if (ischecked (hDlg, IDC_FILTERKEEPASPECT))