From: Toni Wilen Date: Sun, 28 Sep 2025 08:19:27 +0000 (+0300) Subject: Stretch NTSC to PAL height option X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=eea5ccab47265d49dcde071e3df5fe02755ac4ee;p=francis%2Fwinuae.git Stretch NTSC to PAL height option --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 46208d1d..45009353 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -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; diff --git a/custom.cpp b/custom.cpp index 41dbe5af..bc82373d 100644 --- a/custom.cpp +++ b/custom.cpp @@ -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) diff --git a/include/options.h b/include/options.h index b3a1dd73..2dabbb52 100644 --- a/include/options.h +++ b/include/options.h @@ -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]; diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index c14e5fbc..6b3489f2 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -564,6 +564,7 @@ #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 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 4780e280..637973f7 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -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 diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index b0e7052f..05a09071 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -15,7 +15,7 @@ #include -#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) { diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 60baa72b..71f85267 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -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; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 7da2e754..3223b9fc 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -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))