]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
blank / sync monitor size/position detection
authorToni Wilen <twilen@winuae.net>
Fri, 27 Feb 2026 16:20:21 +0000 (18:20 +0200)
committerToni Wilen <twilen@winuae.net>
Fri, 27 Feb 2026 16:20:21 +0000 (18:20 +0200)
cfgfile.cpp
custom.cpp
include/options.h
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32_scaler.cpp
od-win32/win32gui.cpp

index 745eccf963315ba22bebc001603fc05c05ffa935..09e8ec66c559e70876bd5e0d1e42672177d58a96 100644 (file)
@@ -258,7 +258,7 @@ static const TCHAR *cycleexact[] = { _T("false"), _T("memory"), _T("true"), 0  }
 static const TCHAR *unmapped[] = { _T("floating"), _T("zero"), _T("one"), 0 };
 static const TCHAR *ciatype[] = { _T("default"), _T("391078-01"), 0 };
 static const TCHAR *debugfeatures[] = { _T("segtracker"), _T("fsdebug"), 0 };
-static const TCHAR *hvcsync[] = { _T("hvcsync"), _T("csync"), _T("hvsync"), 0 };
+static const TCHAR *hvcsync[] = { _T("hvcsync"), _T("csync"), _T("hvsync"), _T("hvcsync_s"), _T("csync_s"), _T("hvsync_s"), 0 };
 static const TCHAR *eclocksync[] = { _T("default"), _T("68000"), _T("Gayle"), _T("68000_opt"), 0 };
 static const TCHAR *agnusmodel[] = { _T("default"), _T("velvet"), _T("a1000"), _T("ocs"), _T("ecs"), _T("aga"), 0 };
 static const TCHAR *agnussize[] = { _T("default"), _T("512k"), _T("1m"), _T("2m"), 0 };
@@ -8629,7 +8629,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
        p->cs_ciatodbug = false;
        p->cs_unmapped_space = 0;
        p->cs_color_burst = false;
-       p->cs_hvcsync = false;
+       p->cs_hvcsync = 0;
        p->cs_ciatype[0] = 0;
        p->cs_ciatype[1] = 0;
        p->cs_memorypatternfill = true;
index 0f3a547fd86e2ab61323308f7937aa3a83a47b71..3e239fafea510aa3b8ebaab43955f4be3f386d83 100644 (file)
@@ -1682,10 +1682,11 @@ void compute_framesync(void)
        if (currprefs.gfx_extraheight > 0) {
                vb->extraheight = currprefs.gfx_extraheight << vres2;
        }
-       if (currprefs.gfx_overscanmode >= OVERSCANMODE_EXTREME) {
-               vb->extrawidth = -1;
+       int vblines = current_linear_vblank_lines;
+       if (currprefs.cs_hvcsync >= HVSYNC_SYNCPOS) {
+               vblines = LINES_AFTER_VSYNC;
        }
-       int maxv = current_linear_vpos - (current_linear_vblank_lines - display_vblankstart_skip) + display_vblankend_skip + 1;
+       int maxv = current_linear_vpos - (vblines - display_vblankstart_skip) + display_vblankend_skip + 1;
        linear_vpos_vb_end = current_linear_vpos_vb_end - display_vblankstart_skip - 1;
        if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) {
                maxv = current_linear_vpos;
@@ -1794,10 +1795,10 @@ static void init_beamcon0(void)
        }
        beamcon0_pal = !isntsc;
 
-       if (currprefs.cs_hvcsync == 0) {
+       if (currprefs.cs_hvcsync == HVSYNC_COMBINED || currprefs.cs_hvcsync == HVSYNC_COMBINED_SYNC) {
                bemcon0_hsync_mask = BEAMCON0_VARHSYEN | BEAMCON0_VARCSYEN;
                bemcon0_vsync_mask = BEAMCON0_VARVSYEN | BEAMCON0_VARCSYEN;
-       } else if (currprefs.cs_hvcsync == 1) {
+       } else if (currprefs.cs_hvcsync == HVSYNC_CSYNC || currprefs.cs_hvcsync == HVSYNC_CSYNC_SYNC) {
                bemcon0_hsync_mask = BEAMCON0_VARCSYEN;
                bemcon0_vsync_mask = BEAMCON0_VARCSYEN;
        } else {
@@ -1904,14 +1905,16 @@ static void init_beamcon0(void)
        maxvpos_nom = maxvpos;
        maxvpos_display = vsync_lines;
 
-       // get hblank start and end (relative to HSYNC start)
-       int hbs = 0, hbe = 0, hblen = 0, total = 0;
-       denise_get_hboffsets(&hbs, &hbe, &hblen, &total);
-       // convert to lores pixels
-       hblen /= 4;
-       hbs /= 4;
-       hbe /= 4;
-       total /= 4;
+       int hbs = -1, hbe = -1, hblen = 0, total = 0;
+       if (currprefs.cs_hvcsync < HVSYNC_SYNCPOS && currprefs.gfx_overscanmode < OVERSCANMODE_EXTREME) {
+               // get hblank start and end (relative to HSYNC start)
+               denise_get_hboffsets(&hbs, &hbe, &hblen, &total);
+               // convert to lores pixels
+               hblen /= 4;
+               hbs /= 4;
+               hbe /= 4;
+               total /= 4;
+       }
        int hsylen = current_agnus_hslen_cck;
        hsylen += CCKS_AFTER_HSYNC;
        hsylen *= 2;
@@ -1937,18 +1940,6 @@ static void init_beamcon0(void)
                } else {
                        maxvpos_display--;
                }
-       } else if (currprefs.gfx_overscanmode == OVERSCANMODE_EXTREME) {
-               int ev = 42;
-               int l = 0;
-               if (hbe > ev) {
-                       l = hbe - ev;
-                       hbe = ev;
-                       hblen -= l;
-               }
-               maxhpos_display = hsync_ccks * 2 - hblen;
-               hbs += 6 * 2;
-               display_hstart_cyclewait_start = hbe / 2;
-               display_hstart_cyclewait_end = -hbs / 2;
        } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) {
                maxhpos_display += 7;
        } else if (currprefs.gfx_overscanmode >= OVERSCANMODE_ULTRA) {
@@ -2107,7 +2098,13 @@ static void init_beamcon0(void)
                minfirstline = 0;
        }
 
-       minfirstline_linear = linear_vpos_vblank_end;
+       int vbstart = linear_vpos_vblank_end;
+       if (currprefs.cs_hvcsync >= HVSYNC_SYNCPOS) {
+               vbstart = LINES_AFTER_VSYNC;
+               minfirstline = vbstart;
+       }
+
+       minfirstline_linear = vbstart;
        maxvpos_display_vsync = 0;
        display_vblankstart_skip = 0;
        display_vblankend_skip = 0;
@@ -2120,7 +2117,7 @@ static void init_beamcon0(void)
        } else if (currprefs.gfx_overscanmode == OVERSCANMODE_EXTREME) {
                minfirstline_linear -= EXTRAHEIGHT_EXTREME / 2;
                minfirstline -= EXTRAHEIGHT_EXTREME / 2;
-               display_vblankstart_skip = linear_vpos_vblank_end;
+               display_vblankstart_skip = vbstart;
                display_vblankend_skip = 3;
                maxvpos_display_vsync += 2;
        } else if (currprefs.gfx_overscanmode == OVERSCANMODE_BROADCAST) {
@@ -4566,7 +4563,7 @@ static void cursorsprite(struct sprite *s)
 
 static int calculate_linetype(int vp)
 {
-       int lineno = vp - linear_vb_offset;
+       int lineno = vp - (currprefs.cs_hvcsync >= HVSYNC_SYNCPOS ? LINES_AFTER_VSYNC : linear_vb_offset);
        nextline_how = nln_normal;
        if (doflickerfix_active()) {
                lineno *= 2;
@@ -5289,14 +5286,14 @@ static void check_no_signal(void)
                nosignal_trigger = true;
        }
        // Inverted CSYNC
-       if ((beamcon0 & BEAMCON0_CSYTRUE) && currprefs.cs_hvcsync == 1) {
+       if ((beamcon0 & BEAMCON0_CSYTRUE) && (currprefs.cs_hvcsync == HVSYNC_CSYNC || currprefs.cs_hvcsync == HVSYNC_CSYNC_SYNC)) {
                nosignal_trigger = true;
        }
        // BLANKEN set: horizontal blanking is merged with CSYNC
-       if ((beamcon0 & BEAMCON0_BLANKEN) && currprefs.cs_hvcsync == 1) {
+       if ((beamcon0 & BEAMCON0_BLANKEN) && (currprefs.cs_hvcsync == HVSYNC_CSYNC || currprefs.cs_hvcsync == HVSYNC_CSYNC_SYNC)) {
                nosignal_trigger = true;
        }
-       if ((beamcon0 & BEAMCON0_CSCBEN) && currprefs.cs_hvcsync == 2) {
+       if ((beamcon0 & BEAMCON0_CSCBEN) && (currprefs.cs_hvcsync == HVSYNC_HVSYNC || currprefs.cs_hvcsync == HVSYNC_HVSYNC_SYNC)) {
                nosignal_trigger = true;
        }
        if (beamcon0 & BEAMCON0_VARBEAMEN) {
@@ -5308,7 +5305,7 @@ static void check_no_signal(void)
                }
                // CSY output is invalid (no vsync part included) if HTOTAL is too small + hardwired CSYNC.
                int csyh = (beamcon0 & 0x20) ? 0x8c : 0x8d;
-               if (htotal < csyh && !(beamcon0 & BEAMCON0_VARCSYEN) && currprefs.cs_hvcsync == 1) {
+               if (htotal < csyh && !(beamcon0 & BEAMCON0_VARCSYEN) && (currprefs.cs_hvcsync == HVSYNC_CSYNC || currprefs.cs_hvcsync == HVSYNC_CSYNC_SYNC)) {
                        nosignal_trigger = true;
                }
        }
@@ -6613,19 +6610,19 @@ static void hsync_handler(bool vs)
                inputdevice_read_msg(true);
                vsync_display_render();
                vsync_display_rendered = false;
-               if (currprefs.cs_hvcsync == 0) {
+               if ((currprefs.cs_hvcsync == HVSYNC_COMBINED || currprefs.cs_hvcsync == HVSYNC_COMBINED_SYNC)) {
                        if (beamcon0 & (BEAMCON0_VARVSYEN | BEAMCON0_VARCSYEN)) {
                                lof_display = lof_pdetect;
                        } else {
                                lof_display = lof_detect;
                        }
-               } else if (currprefs.cs_hvcsync == 1) {
+               } else if (currprefs.cs_hvcsync == HVSYNC_CSYNC || currprefs.cs_hvcsync == HVSYNC_CSYNC_SYNC) {
                        if (beamcon0 & BEAMCON0_VARCSYEN) {
                                lof_display = lof_pdetect;
                        } else {
                                lof_display = lof_detect;
                        }
-               } else if (currprefs.cs_hvcsync == 2) {
+               } else if (currprefs.cs_hvcsync == HVSYNC_HVSYNC || currprefs.cs_hvcsync == HVSYNC_HVSYNC_SYNC) {
                        if (beamcon0 & BEAMCON0_VARVSYEN) {
                                lof_display = lof_pdetect;
                        } else {
index b2ef2895455e6269b8fb48d6609e554b8120fcd6..e83cdede97c70f7f380448a7c4e37f07d417355f 100644 (file)
@@ -515,6 +515,14 @@ struct monconfig
 #define DISPLAY_OPTIMIZATIONS_PARTIAL 1
 #define DISPLAY_OPTIMIZATIONS_NONE 2
 
+#define HVSYNC_COMBINED 0
+#define HVSYNC_CSYNC 1
+#define HVSYNC_HVSYNC 2
+#define HVSYNC_SYNCPOS 3
+#define HVSYNC_COMBINED_SYNC 3
+#define HVSYNC_CSYNC_SYNC 4
+#define HVSYNC_HVSYNC_SYNC 5
+
 struct uae_prefs {
 
        struct strlist *all_lines;
index 1634fb17ca30f1f7d85c8070f653225488f98fe3..f77d59c9d886469c30d111fd5b9e7eb9a03d6653 100644 (file)
 #define IDS_DISPLAY_OPTIMIZATION_NONE   450
 #define IDS_KEYBOARD_DISCONNECTED       451
 #define IDS_KEYBOARD_HIGHLEVEL          452
+#define IDS_SYNCMODE_COMBINED2          453
+#define IDS_SYNCMODE_CSYNC2             454
+#define IDS_SYNCMODE_HVSYNC2            455
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
index c1ab679d47fb0513a92f4b440ff9d5bd306133d4..f96af3b87786ef3d3842133a2c3bdd1262226bfc 100644 (file)
@@ -779,7 +779,7 @@ BEGIN
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,23,150,10
     CONTROL         "Wait for Blitter [] Compatibility hack for programs that don't wait for the blitter correctly, causing graphics corruption if CPU is too fast.",IDC_BLITWAIT,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,234,35,150,10
-    LTEXT           "Monitor sync source:",IDC_STATIC,242,96,101,9
+    LTEXT           "Monitor sync / positioning mode:",IDC_STATIC,242,96,101,9
     COMBOBOX        IDC_CS_HVCSYNC,237,108,147,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     LTEXT           "Video port display hardware:",IDC_STATIC,241,123,117,15,SS_CENTERIMAGE
     COMBOBOX        IDC_MONITOREMU,237,141,147,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
@@ -2216,9 +2216,12 @@ BEGIN
     IDS_SCREEN_NATIVELACE   "Native (Interlaced)"
     IDS_PORT_AUTOFIRE_TOGGLENOAF "No autofire (toggle)"
     IDS_DEFAULT_WINUAECUSTOM "Custom"
-    IDS_SYNCMODE_COMBINED   "Combined"
-    IDS_SYNCMODE_CSYNC      "Composite Sync"
-    IDS_SYNCMODE_HVSYNC     "H/V Sync"
+    IDS_SYNCMODE_COMBINED   "Combined + Blanking"
+    IDS_SYNCMODE_CSYNC      "Composite Sync + Blanking"
+    IDS_SYNCMODE_HVSYNC     "H/V Sync + Blanking"
+    IDS_SYNCMODE_COMBINED2  "Combined + Sync"
+    IDS_SYNCMODE_CSYNC2     "Composite Sync + Sync"
+    IDS_SYNCMODE_HVSYNC2    "H/V Sync + Sync"
     IDS_MEMINFO             "Configured 32-bit address space: %dM, reserved: %dM, Z3 available: %dM (UAE), %dM (Real)"
     IDS_INPUTINVERT         "Invert"
     IDS_BOARDTYPE           "Type"
index 83839ce70a8ef58a9bae0e2b43043d1cdabf7cec..c97636d5a29881bd04728c5d4e5b1bbb04559757 100644 (file)
@@ -669,7 +669,7 @@ void getfilterdata(int monid, struct displayscale *ds)
                }
 
        } else {
-skipcont:
+
                int cw = avidinfo->drawbuffer.inwidth;
                int ch = avidinfo->drawbuffer.inheight;
                set_custom_limits(cw, ch, 0, 0, true);
index 5c048a252878d389751c40cb780ecc822e130ba4..4aa182e5145395bf1a665926780405b6726b8711 100644 (file)
@@ -9465,6 +9465,12 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR
                xSendDlgItemMessage(hDlg, IDC_CS_HVCSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
                WIN32GUI_LoadUIString(IDS_SYNCMODE_HVSYNC, buffer, sizeof buffer / sizeof(TCHAR));
                xSendDlgItemMessage(hDlg, IDC_CS_HVCSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
+               WIN32GUI_LoadUIString(IDS_SYNCMODE_COMBINED2, buffer, sizeof buffer / sizeof(TCHAR));
+               xSendDlgItemMessage(hDlg, IDC_CS_HVCSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
+               WIN32GUI_LoadUIString(IDS_SYNCMODE_CSYNC2, buffer, sizeof buffer / sizeof(TCHAR));
+               xSendDlgItemMessage(hDlg, IDC_CS_HVCSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
+               WIN32GUI_LoadUIString(IDS_SYNCMODE_HVSYNC2, buffer, sizeof buffer / sizeof(TCHAR));
+               xSendDlgItemMessage(hDlg, IDC_CS_HVCSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
 
 #ifndef        AGA
                ew(hDlg, IDC_AGA, FALSE);