]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2410b12
authorToni Wilen <twilen@winuae.net>
Tue, 1 May 2012 14:02:22 +0000 (17:02 +0300)
committerToni Wilen <twilen@winuae.net>
Tue, 1 May 2012 14:02:22 +0000 (17:02 +0300)
17 files changed:
custom.cpp
drawing.cpp
events.cpp
main.cpp
od-win32/direct3d.cpp
od-win32/hardfile_win32.cpp
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/rp.cpp
od-win32/sounddep/sound.cpp
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
od-win32/winuae_msvc10/winuae_msvc.vcxproj
od-win32/winuae_msvc10/winuae_msvc.vcxproj.filters
od-win32/winuaechangelog.txt

index 259a3436887d82d976d34d2c886311c9c88ff9d4..7c38035c2cf4b66b9308e1d022027a668862058b 100644 (file)
@@ -2452,7 +2452,7 @@ static void decide_sprites (int hpos)
                record_sprite (next_lineno, nr, posns[i], sprdata[nr], sprdatb[nr], sprctl[nr]);
                /* get left and right sprite edge if brdsprt enabled */
 #if AUTOSCALE_SPRITES
-               if (dmaen (DMA_SPRITE) && (bplcon0 & 1) && (bplcon3 & 0x02) && !(bplcon3 & 0x20)) {
+               if (dmaen (DMA_SPRITE) && (bplcon0 & 1) && (bplcon3 & 0x02) && !(bplcon3 & 0x20) && nr > 0) {
                        int j, jj;
                        for (j = 0, jj = 0; j < sprite_width; j+= 16, jj++) {
                                int nx = fromspritexdiw (posns[i] + j);
@@ -5235,42 +5235,54 @@ static void framewait (void)
 
                        // fastest possible
                        int max, adjust;
+                       frame_time_t now;
 
-                       adjust = 0;
-                       curr_time = read_processor_time ();
-                       start = vsync_busywait_end ();
-                       if ((int)curr_time - (int)vsyncwaittime < 0)
-                               curr_time = start;
-
+                       curr_time = vsync_busywait_end (); // vsync time
                        vsync_busywait_do (NULL, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
                        vsync_busywait_start ();
 
-                       max = vsynctimebase * (1000 + currprefs.m68k_speed_throttle) / 1000;
-                       if ((int)curr_time - (int)vsyncwaittime > 0 && (int)curr_time - (int)vsyncwaittime < vsynctimebase / 2)
-                               adjust = curr_time - vsyncwaittime;
-                       max -= adjust;
+                       now = read_processor_time (); // current time
+                       adjust = (int)now - (int)curr_time;
+                       if (adjust < 0)
+                               adjust = 0;
+                       if (adjust > vsynctimebase / 3)
+                               adjust = vsynctimebase / 3;
 
-                       vsyncmintime = curr_time;
+                       max = (vsynctimebase - (adjust * 3 / 2)) * (1000 + currprefs.m68k_speed_throttle) / 1000;
+                       vsyncmintime = now;
                        vsyncwaittime = curr_time + vsynctimebase;
 
                        vsynctimeperline = max / (maxvpos_nom + 1);
-                       vsyncmaxtime = curr_time + max;
+                       vsyncmaxtime = now + max;
 
                } else {
 
+                       int max, adjust;
+                       frame_time_t now;
+
                        render_screen ();
                        bool show = show_screen_maybe (false);
                        vsync_busywait_do (&freetime, (bplcon0 & 4) != 0 && !lof_changed && !lof_changing, lof_store != 0);
                        curr_time = read_processor_time ();
-                       vsyncmintime = curr_time;
-                       vsyncwaittime = curr_time + vsynctimebase;
-                       vsyncmaxtime = curr_time + vsynctimebase;
-                       vsynctimeperline = vsynctimebase / (maxvpos_nom + 1);
                        if (!show) {    
                                show_screen ();
                                if (extraframewait)
                                        sleep_millis_main (extraframewait);
                        }
+                       now = read_processor_time ();
+                       adjust = (int)now - (int)curr_time;
+                       if (adjust < 0)
+                               adjust = 0;
+                       if (adjust > vsynctimebase / 3)
+                               adjust = vsynctimebase / 3;
+                       max = vsynctimebase - (adjust * 3 / 2);
+
+                       vsyncmintime = now;
+                       vsyncwaittime = curr_time + vsynctimebase;
+
+                       vsynctimeperline = max / 3;
+                       vsyncmaxtime = now + max;
+
                        frame_shown = true;
 
                }
@@ -5813,6 +5825,11 @@ static void hsync_handler_pre (bool onvsync)
 #endif
 }
 
+STATIC_INLINE bool is_last_line (void)
+{
+       return vpos + 1 == maxvpos + lof_store;
+}
+
 // this prepares for new line
 static void hsync_handler_post (bool onvsync)
 {
@@ -5931,12 +5948,13 @@ static void hsync_handler_post (bool onvsync)
        }
 #endif
        if (currprefs.m68k_speed < 0) {
-               if (vpos + 1 == maxvpos + lof_store) {
+               if (is_last_line ()) {
                        /* really last line, just run the cpu emulation until whole vsync time has been used */
                        if (currprefs.m68k_speed_throttle) {
                                vsyncmintime = read_processor_time (); /* end of CPU emulation time */
                        } else {
                                vsyncmintime = vsyncmaxtime; /* emulate if still time left */
+                               is_syncline_end = read_processor_time () + vsynctimebase;
                                is_syncline = 1;
                        }
                } else {
@@ -5957,19 +5975,23 @@ static void hsync_handler_post (bool onvsync)
                                                        linecounter = 0;
                                                }
                                        }
-                                       // extra cpu emulation time if previous 8 lines without extra time.
-                                       if (!is_syncline && linecounter >= 8) {
-                                               is_syncline = -1;
-                                               is_syncline_end = read_processor_time () + vsynctimeperline;
-                                               linecounter = 0;
+                                       if (!isvsync ()) {
+                                               // extra cpu emulation time if previous 10 lines without extra time.
+                                               if (!is_syncline && linecounter >= 10) {
+                                                       is_syncline = -1;
+                                                       is_syncline_end = read_processor_time () + vsynctimeperline;
+                                                       linecounter = 0;
+                                               }
                                        }
                                }
+                       } else {
+                               ;//write_log (L"%d ", vpos);
                        }
                }
        } else {
                if (vpos + 1 < maxvpos + lof_store && (vpos == maxvpos_nom * 1 / 3 || vpos == maxvpos_nom * 2 / 3)) {
                        frame_time_t rpt = read_processor_time ();
-                       vsyncmintime += vsynctimebase / 3;
+                       vsyncmintime += vsynctimeperline;
                        // sleep if more than 2ms "free" time
                        if (!vblank_found_chipset && (int)vsyncmintime - (int)(rpt + vsynctimebase / 10) > 0) {
                                sleep_millis_main (1);
@@ -6079,7 +6101,7 @@ static void hsync_handler_post (bool onvsync)
        if (diw_change > 0)
                diw_change--;
 
-       if (is_syncline > 0 && isvsync_chipset () == -2 && !vsync_rendered && currprefs.gfx_apmode[0].gfx_vflip == 0) {
+       if (is_last_line () && isvsync_chipset () == -2 && !vsync_rendered && currprefs.gfx_apmode[0].gfx_vflip == 0) {
                frame_time_t start, end;
                start = read_processor_time ();
                /* fastest possible + last line and no vflip wait: render the frame as early as possible */
index 113c9d4985996583685c0a18eeb05f9ce0ff44a5..e083800d522fd67114506a22eb145cc80864557b 100644 (file)
@@ -384,11 +384,14 @@ int get_custom_limits (int *pw, int *ph, int *pdx, int *pdy)
                // interlace = only use long frames
                if (!lof_store)
                        return ret;
-               last_planes_vpos++;
-               plflastline_total++;
+               /* program may have set last visible line as last possible line (CD32 boot screen) */
+               if (last_planes_vpos < maxvpos)
+                       last_planes_vpos++;
+               if (plflastline_total < maxvpos)
+                       plflastline_total++;
        }
 
-       if (!plflastline_total)
+       if (plflastline_total < 4)
                plflastline_total = last_planes_vpos;
 
        ddffirstword_total = coord_hw_to_window_x (ddffirstword_total * 2 + DIW_DDF_OFFSET);
@@ -2939,6 +2942,12 @@ static void clearbuffer (struct vidbuffer *dst)
        }
 }
 
+void reset_decision_table (void)
+{
+       for (int i = 0; i < sizeof linestate / sizeof *linestate; i++)
+               linestate[i] = LINE_UNDECIDED;
+}
+
 void reset_drawing (void)
 {
        unsigned int i;
index d4fe194ee67dcf8c7c05d42fcb4d919cfab3c046..a587f7ab249c13b49f337b3beca2b556d626c665 100644 (file)
@@ -50,24 +50,27 @@ void do_cycles_slow (unsigned long cycles_to_add)
                int i;
 
                /* Keep only CPU emulation running while waiting for sync point. */
-               if (is_syncline > 0) {
-                       int rpt = read_processor_time ();
-                       int v = rpt - vsyncmintime;
-                       int v2 = rpt - is_syncline_end;
-                       if (v > (int)vsynctimebase || v < -((int)vsynctimebase)) {
-                               v = 0;
-                       }
-                       if (v < 0 && v2 < 0 && !vblank_found_chipset) {
-                               pissoff = pissoff_value;
-                               return;
-                       }
-                       is_syncline = 0;
-               } else if (is_syncline < 0) {
-                       int rpt = read_processor_time ();
-                       int v = rpt - is_syncline_end;
-                       if (v < 0 && !vblank_found_chipset) {
-                               pissoff = pissoff_value;
-                               return;
+               if (is_syncline) {
+                       if (!vblank_found_chipset) {
+                               if (is_syncline > 0) {
+                                       int rpt = read_processor_time ();
+                                       int v = rpt - vsyncmintime;
+                                       int v2 = rpt - is_syncline_end;
+                                       if (v > (int)vsynctimebase || v < -((int)vsynctimebase)) {
+                                               v = 0;
+                                       }
+                                       if (v < 0 && v2 < 0) {
+                                               pissoff = pissoff_value;
+                                               return;
+                                       }
+                               } else if (is_syncline < 0) {
+                                       int rpt = read_processor_time ();
+                                       int v = rpt - is_syncline_end;
+                                       if (v < 0) {
+                                               pissoff = pissoff_value;
+                                               return;
+                                       }
+                               }
                        }
                        is_syncline = 0;
                }
index e885b28be6c28ff27da0a58626df15946a49527f..20274428fddfd3f15c8944450bbc92660b3a8aaa 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -169,7 +169,7 @@ void fixup_prefs_dimensions (struct uae_prefs *prefs)
                        if (ap->gfx_vsyncmode) {
                                // low latency vsync: no flip only if no-buffer
                                if (ap->gfx_backbuffers >= 1)
-                                       ap->gfx_vflip = -1;
+                                       ap->gfx_vflip = 1;
                                if (!i && ap->gfx_backbuffers == 2)
                                        ap->gfx_vflip = 1;
                        } else {
index acfa043cda5cf0f02ae2f0d031136d63b9c53417..b0c66dc600d7907c58b49f37e9da566d1469f044 100644 (file)
@@ -1673,8 +1673,8 @@ static void setupscenecoords (void)
        //write_log (_T("%.1fx%.1f %.1fx%.1f %.1fx%.1f\n"), dw, dh, w, h, sw, sh);
 
        // ratio between Amiga texture and overlay mask texture
-       float sw2 = dw * tin_w / window_w - 0.5f;
-       float sh2 = dh * tin_h / window_h + 0.5f;
+       float sw2 = dw * tin_w / window_w;
+       float sh2 = dh * tin_h / window_h;
 
        maskmult.x = sw2 * maskmult_x / w;
        maskmult.y = sh2 * maskmult_y / h;
index d885340e6d7df13abe03fb7438a9fb24bc0ac76a..3cadbecfdd3dde0827bf235972df72c8f10b8a91 100644 (file)
@@ -1030,17 +1030,23 @@ static int getstorageproperty (PUCHAR outBuf, int returnedLength, struct uae_dri
        udi->removablemedia = devDesc->RemovableMedia;
        write_log (_T("device id string: '%s'\n"), udi->device_name);
        if (ignoreduplicates) {
-               _stprintf (orgname, _T(":%s"), udi->device_name);
-               if (isharddrive (orgname) >= 0) {
-                       write_log (_T("duplicate device, ignored\n"));
-                       return 1;
-               }
                if (!udi->removablemedia) {
                        write_log (_T("drive letter not removable, ignored\n"));
-                       return 1;
+                       return -2;
+               }
+               _stprintf (orgname, _T(":%s"), udi->device_name);
+               for (i = 0; i < hdf_getnumharddrives (); i++) {
+                       if (!_tcscmp (uae_drives[i].device_name, orgname)) {
+                               if (uae_drives[i].dangerous == -10) {
+                                       write_log (_T("replaced old '%s'\n"), uae_drives[i].device_name);
+                                       return i;
+                               }
+                               write_log (_T("duplicate device, ignored\n"));
+                               return -2;
+                       }
                }
        }
-       return 0;
+       return -1;
 }
 
 static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWORD *index2, uae_u8 *buffer, int ignoreduplicates)
@@ -1060,13 +1066,15 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR
        BOOL                                status;
        ULONG                               length = 0, returned = 0, returnedLength;
        BOOL showonly = FALSE;
+       struct uae_driveinfo tmpudi = { 0 };
+
+       udi = &tmpudi;
+       int udiindex = *index2;
 
        //
        // Now we have the device path. Open the device interface
        // to send Pass Through command
 
-       udi = &uae_drives[*index2];
-       memset (udi, 0, sizeof (struct uae_driveinfo));
        _tcscpy (udi->device_path, DevicePath);
        write_log (_T("opening device '%s'\n"), udi->device_path);
        hDevice = CreateFile(
@@ -1143,15 +1151,19 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR
                }
                nosp = 1;
                generatestorageproperty (udi, ignoreduplicates);
+               udiindex = -1;
        } else {
-               int r;
                nosp = 0;
-               r = getstorageproperty (outBuf, returnedLength, udi, ignoreduplicates);
-               if (r) {
-                       ret = r;
+               udiindex = getstorageproperty (outBuf, returnedLength, udi, ignoreduplicates);
+               if (udiindex == -2) {
+                       ret = 1;
                        goto end;
                }
        }
+       udi = &uae_drives[udiindex < 0 ? *index2 : udiindex];
+       memcpy (udi, &tmpudi, sizeof (struct uae_driveinfo));
+
+
        _tcscpy (orgname, udi->device_name);
        udi->bytespersector = 512;
        geom_ok = 1;
@@ -1277,7 +1289,7 @@ static BOOL GetDevicePropertyFromName(const TCHAR *DevicePath, DWORD Index, DWOR
        }
 amipartfound:
        _stprintf (udi->device_name, _T(":%s"), orgname);
-       {
+       if (udiindex < 0) {
                int cnt = 1;
                int off = _tcslen (udi->device_name);
                while (isharddrive (udi->device_name) >= 0) {
@@ -1286,8 +1298,8 @@ amipartfound:
                        udi->device_name[off + 2] = 0;
                        cnt++;
                }
-       }       
-       (*index2)++;
+               (*index2)++;
+       }
 end:
        if (hDevice != INVALID_HANDLE_VALUE)
                CloseHandle (hDevice);
index cd29145de11bbf7395263e43e87732e692c3dcaf..465d454e25711662846b188901688aa01a287760 100644 (file)
 #define IDS_SCREEN_VSYNC2_AUTOSWITCH    376
 #define IDS_SCREEN_VSYNC2               377
 #define IDS_SCREEN_VSYNC_NONE           378
+#define IDS_FILTEROVERLAYTYPE_MASKS     379
+#define IDS_STRING380                   380
+#define IDS_FILTEROVERLAYTYPE_OVERLAYS  380
 #define IDS_QS_MODELS                   1000
 #define IDS_QS_MODEL_A500               1001
 #define IDS_QS_MODEL_A500P              1002
index a9b183d1cb26ec65cc109e84feb3ddc1cdd2be2f..af7b3862128b8e65173857befcacc55385690899 100644 (file)
@@ -1707,6 +1707,8 @@ BEGIN
     IDS_SCREEN_VSYNC2_AUTOSWITCH "Low latency VS, 50/60Hz"\r
     IDS_SCREEN_VSYNC2       "Low latency VSync"\r
     IDS_SCREEN_VSYNC_NONE   "-"\r
+    IDS_FILTEROVERLAYTYPE_MASKS "Masks"\r
+    IDS_FILTEROVERLAYTYPE_OVERLAYS "Overlays"\r
 END\r
 \r
 STRINGTABLE\r
index bbf6909b22b37f64908c6eea2a2849c8811e4baf..236376071a71ac45ea65effbdd49c1c071ad2cd2 100644 (file)
@@ -259,7 +259,7 @@ bool port_get_custom (int inputmap_port, TCHAR *out)
                        }
                }
        }
-       write_log (L"********* -> %s\n",  out);
+       write_log (_T("port_get_custom: %s\n"),  out);
        return true;
 }
 
@@ -345,7 +345,7 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC
                                }
                        }
                        if (wdnum >= 0) {
-                               write_log (_T("kb=%d (%s) wdnum=%d\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), wdnum);
+                               //write_log (_T("kb=%d (%s) wdnum=%d\n"), j, inputdevicefunc_keyboard.get_friendlyname (j), wdnum);
                                inputdevice_set_gameports_mapping (&changed_prefs, kb + j, wdnum, evtnum, flags, inputmap_port);
                                inputdevice_set_gameports_mapping (&currprefs, kb + j, wdnum, evtnum, flags, inputmap_port);
                        } else {
index 0ba617e2e66ea80f3269afaf5061d829fe50ffcb..dfcc933f4badd3fa3e0c87398f70ec2b75a63c7d 100644 (file)
@@ -250,7 +250,7 @@ static void docorrection (struct sound_dp *s, int sndbuf, double sync, int granu
                double skipmode, avgskipmode;
                double avg = s->avg_correct / s->cnt_correct;
 
-               skipmode = sync / 10.0;
+               skipmode = sync / 100.0;
                avgskipmode = avg / (10000.0 / granulaty);
 
                if ((0 || sound_debug) && (tfprev % 10) == 0) {
index d4501178291402141be7bea39a5e211fe82f7249..4d2d33f8160fa6ce820f5053705a7a73d31f78b0 100644 (file)
@@ -99,7 +99,7 @@ int log_scsi;
 int log_net;
 int log_vsync;
 int uaelib_debug;
-int pissoff_value = 20000 * CYCLE_UNIT;
+int pissoff_value = 15000 * CYCLE_UNIT;
 unsigned int fpucontrol;
 int extraframewait = 0;
 
@@ -2276,7 +2276,7 @@ void logging_init (void)
        int wow64 = 0;
        static int started;
        static int first;
-       TCHAR tmp[MAX_DPATH];
+       TCHAR tmp[MAX_DPATH], filedate[256];
 
        if (first > 1) {
                write_log (_T("** RESTART **\n"));
@@ -2292,6 +2292,7 @@ void logging_init (void)
        logging_open (first ? 0 : 1, 0);
        logging_started = 1;
        first++;
+
 #ifdef _WIN64
        wow64 = 1;
 #else
@@ -2299,13 +2300,29 @@ void logging_init (void)
        if (fnIsWow64Process)
                fnIsWow64Process (GetCurrentProcess (), &wow64);
 #endif
+
+       _tcscpy (filedate, _T("?"));
+       if (GetModuleFileName (NULL, tmp, sizeof tmp / sizeof (TCHAR))) {
+               HANDLE h = CreateFile (tmp, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+               if (h != INVALID_HANDLE_VALUE) {
+                       FILETIME ft;
+                       if (GetFileTime (h, &ft, NULL, NULL)) {
+                               SYSTEMTIME st;
+                               if (FileTimeToSystemTime(&ft, &st)) {
+                                       _stprintf (filedate, _T("%02d:%02d"), st.wHour, st.wMinute);
+                               }
+                       }
+                       CloseHandle (h);
+               }
+       }
+
        write_log (_T("%s (%d.%d %s%s[%d])"), VersionStr,
                osVersion.dwMajorVersion, osVersion.dwMinorVersion, osVersion.szCSDVersion,
                _tcslen (osVersion.szCSDVersion) > 0 ? _T(" ") : _T(""), os_winnt_admin);
-       write_log (_T(" %d-bit %X.%X.%X %d"),
+       write_log (_T(" %d-bit %X.%X.%X %d %s"),
                wow64 ? 64 : 32,
                SystemInfo.wProcessorArchitecture, SystemInfo.wProcessorLevel, SystemInfo.wProcessorRevision,
-               SystemInfo.dwNumberOfProcessors);
+               SystemInfo.dwNumberOfProcessors, filedate);
        write_log (_T("\n(c) 1995-2001 Bernd Schmidt   - Core UAE concept and implementation.")
                _T("\n(c) 1998-2012 Toni Wilen      - Win32 port, core code updates.")
                _T("\n(c) 1996-2001 Brian King      - Win32 port, Picasso96 RTG, and GUI.")
index 78eec3eefcd261e6d9ca5b4aed5b1593b2457654..ab75413ad9f5b735f651ef805120c2fe3aef51fb 100644 (file)
@@ -19,8 +19,8 @@
 #define LANG_DLL 1
 
 //#define WINUAEBETA _T("")
-#define WINUAEBETA _T("Beta 11")
-#define WINUAEDATE MAKEBD(2012, 4, 27)
+#define WINUAEBETA _T("12")
+#define WINUAEDATE MAKEBD(2012, 5, 1)
 #define WINUAEEXTRA _T("")
 //#define WINUAEEXTRA _T("AmiKit Preview")
 #define WINUAEREV _T("")
index 57dfec44c1f4d2549f1d093911fba0c534f9a6b4..223d304b7f0e1366efc822514cbbc3d298311749 100644 (file)
@@ -147,6 +147,7 @@ static void vsync_sleep (bool preferbusy)
 
        if (vsync_busy_wait_mode == 0) {
                dowait = ap->gfx_vflip || !preferbusy;
+               //dowait = !preferbusy;
        } else if (vsync_busy_wait_mode < 0) {
                dowait = true;
        } else {
@@ -2451,18 +2452,18 @@ static bool waitvblankstate (bool state, int *maxvpos, int *flags)
        }
 }
 
-static bool vblank_wait (void)
+static int vblank_wait (void)
 {
        int vp;
 
        for (;;) {
                int opos = prevvblankpos;
                if (!getvblankpos (&vp))
-                       return false;
+                       return -2;
                if (opos > maxscanline / 2 && vp < maxscanline / 3)
-                       return true;
+                       return vp;
                if (vp <= 0)
-                       return true;
+                       return vp;
                vsync_sleep (true);
        }
 }
@@ -2522,7 +2523,6 @@ static int frame_usage, frame_usage_avg, frame_usage_total;
 extern int log_vsync;
 static bool dooddevenskip;
 static volatile bool vblank_skipeveryother;
-static volatile bool vblank_first_time;
 
 static bool vblanklaceskip (void)
 {
@@ -2537,105 +2537,135 @@ static bool vblanklaceskip (void)
 
 static unsigned int __stdcall vblankthread (void *dummy)
 {
-       static bool firstvblankbasewait2;
+       bool vblank_first_time = false;
+       bool firstvblankbasewait2;
+       frame_time_t vblank_prev_time2;
+       bool doflipped;
+
        while (vblankthread_mode > VBLANKTH_KILL) {
                struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];
                vblankthread_counter++;
-               if (vblankthread_mode == VBLANKTH_CALIBRATE) {
+               int mode = vblankthread_mode;
+               if (mode == VBLANKTH_CALIBRATE) {
                        // calibrate mode, try to keep CPU power saving inactive
                        SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_LOWEST);
                        while (vblankthread_mode == 0)
                                vblankthread_counter++;
                        SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
-               } else if (vblankthread_mode == VBLANKTH_IDLE) {
+               } else if (mode == VBLANKTH_IDLE) {
                        // idle mode
                        Sleep (100);
-               } else if (vblankthread_mode == VBLANKTH_ACTIVE_WAIT) {
-                       sleep_millis (ap->gfx_vflip && currprefs.m68k_speed >= 0 ? 2 : 1);
-               } else if (vblankthread_mode == VBLANKTH_ACTIVE_START) {
+               } else if (mode == VBLANKTH_ACTIVE_WAIT) {
+                       sleep_millis (1);
+               } else if (mode == VBLANKTH_ACTIVE_START) {
                        // do not start until vblank has been passed
                        int vp;
-                       firstvblankbasewait2 = false;
                        getvblankpos (&vp);
-                       if (vp <= 0) {
-                               if (!vblank_first_time) {
-                                       // set prevtime now if we are still at vsync to improve timing
-                                       vblank_prev_time = read_processor_time ();
-                                       vblank_first_time = true;
-                               }
+                       if (vp > maxscanline / 2) {
                                sleep_millis (1);
                                continue;
                        }
-                       if (vp > maxscanline / 2) {
+                       if (!vblank_first_time) {
+                               frame_time_t rpt = read_processor_time ();
+                               if (vp <= 0) {
+                                       vblank_prev_time2 = rpt;
+                               } else {
+                                       vblank_prev_time2 = rpt - (vblankbasefull * vp / maxscanline) / (vblank_skipeveryother ? 2 : 1 );
+                               }
+                               vblank_first_time = true;
+                       }
+                       if (vp <= 0) {
                                sleep_millis (1);
                                continue;
                        }
+                       vblank_prev_time = vblank_prev_time2;
+                       vblank_first_time = false;
+                       firstvblankbasewait2 = false;
                        prevvblankpos = 0;
+                       doflipped = false;
                        if (vblank_skipeveryother) // wait for first vblank in skip frame mode (100Hz+)
                                vblankthread_mode = VBLANKTH_ACTIVE_SKIPFRAME;
                        else
                                vblankthread_mode = VBLANKTH_ACTIVE;
-               } else if (vblankthread_mode == VBLANKTH_ACTIVE_SKIPFRAME) {
+               } else if (mode == VBLANKTH_ACTIVE_SKIPFRAME) {
                        int vp;
                        sleep_millis (1);
                        getvblankpos (&vp);
                        if (vp >= maxscanline / 2)
                                vblankthread_mode = VBLANKTH_ACTIVE_SKIPFRAME2;
-               } else if (vblankthread_mode == VBLANKTH_ACTIVE_SKIPFRAME2) {
+                       if (read_processor_time () - vblank_prev_time2 > vblankbasefull * 2)
+                               vblankthread_mode = VBLANKTH_ACTIVE;
+               } else if (mode == VBLANKTH_ACTIVE_SKIPFRAME2) {
                        int vp;
                        sleep_millis (1);
                        getvblankpos (&vp);
-                       if (vp < maxscanline / 2)
+                       if (vp > 0 && vp < maxscanline / 2) {
+                               prevvblankpos = 0;
                                vblankthread_mode = VBLANKTH_ACTIVE;
-               } else if (vblankthread_mode == VBLANKTH_ACTIVE) {
+                       }
+                       if (read_processor_time () - vblank_prev_time2 > vblankbasefull * 2)
+                               vblankthread_mode = VBLANKTH_ACTIVE;
+               } else if (mode == VBLANKTH_ACTIVE) {
                        // busy wait mode
                        frame_time_t t = read_processor_time ();
                        bool donotwait = false;
                        bool end = false;
+                       bool vblank_found_rtg2 = false;
+                       bool vblank_found2 = false;
+                       frame_time_t thread_vblank_time2 = 0;
                        int vs = isvsync_chipset ();
                        // immediate vblank if mismatched frame type 
                        if (vs < 0 && vblanklaceskip ()) {
-                               vblank_found = true;
+                               vblank_found2 = true;
                                vblank_found_chipset = true;
                                end = true;
-                       } else if (t - vblank_prev_time > vblankbasewait2) {
+                       } else if (t - vblank_prev_time2 > vblankbasewait2) {
                                int vp = 0;
                                bool vb = false;
                                bool ok;
                                if (firstvblankbasewait2 == false) {
                                        firstvblankbasewait2 = true;
                                        vblank_getstate (&vb, &vp);
-                                       if (!dooddevenskip && ap->gfx_vflip > 0) {
-                                               doflipevent ();
-                                       }
+                               }
+                               if (!doflipped && !dooddevenskip && ap->gfx_vflip > 0) {
+                                       doflipevent ();
+                                       doflipped = true;
                                }
                                ok = vblank_getstate (&vb, &vp);
                                if (!ok || vb) {
-                                       thread_vblank_time = t;
+                                       thread_vblank_time2 = t;
                                        if (vs < 0) {
                                                vblank_found_chipset = true;
                                                if (!ap->gfx_vflip) {
                                                        show_screen ();
                                                }
                                        }
-                                       vblank_found_rtg = true;
-                                       vblank_found = true;
+                                       vblank_found_rtg2 = true;
+                                       vblank_found2 = true;
                                        end = true;
                                }
-                               if (t - vblank_prev_time > vblankbasewait3)
+                               if (t - vblank_prev_time2 > vblankbasewait3)
                                        donotwait = true;
                        }
-                       if (t - vblank_prev_time > vblankbasefull * 2) {
-                               thread_vblank_time = t;
-                               vblank_found = true;
-                               vblank_found_rtg = true;
+                       if (!end && t - vblank_prev_time2 > vblankbasefull * 2) {
+                               thread_vblank_time2 = t;
+                               vblank_found2 = true;
+                               vblank_found_rtg2 = true;
                                vblank_found_chipset = true;
                                end = true;
                        }
                        if (end) {
+                               if (!dooddevenskip && ap->gfx_vflip > 0 && !doflipped) {
+                                       doflipevent ();
+                                       doflipped = true;
+                               }
+                               thread_vblank_time = thread_vblank_time2;
+                               vblank_found_rtg = vblank_found_rtg2;
+                               vblank_found = vblank_found2;
                                vblankthread_mode = VBLANKTH_ACTIVE_WAIT;
                        } else if (!donotwait || ap->gfx_vflip || picasso_on) {
-                               sleep_millis (ap->gfx_vflip && currprefs.m68k_speed >= 0 ? 2 : 1);
+//                     } else if (!donotwait || picasso_on) {
+                               sleep_millis (1);
                        }
                } else {
                        break;
@@ -2645,48 +2675,29 @@ static unsigned int __stdcall vblankthread (void *dummy)
        return 0;
 }
 
-#if 0
-static void vsync_notvblank (void)
+frame_time_t vsync_busywait_end (void)
 {
+       frame_time_t prev;
        for (;;) {
-               int vp;
-               if (!getvblankpos (&vp))
-                       return;
-               if (vp > 0) {
-                       //write_log (_T("%d "), vpos);
+               int v = vblankthread_mode;
+               if (v != VBLANKTH_ACTIVE_START && v != VBLANKTH_ACTIVE_SKIPFRAME && v != VBLANKTH_ACTIVE_SKIPFRAME2)
                        break;
-               }
-               vsync_sleep (true);
-       }
-}
-#endif
-frame_time_t vsync_busywait_end (void)
-{
-       while (vblankthread_mode == VBLANKTH_ACTIVE_START || vblankthread_mode == VBLANKTH_ACTIVE_SKIPFRAME || vblankthread_mode == VBLANKTH_ACTIVE_SKIPFRAME2) {
                sleep_millis_main (1);
        }
+       prev = vblank_prev_time;
        if (!dooddevenskip) {
-               while (!vblank_found && vblankthread_mode == VBLANKTH_ACTIVE) {
-                       vsync_sleep (currprefs.m68k_speed < 0 && currprefs.m68k_speed_throttle == 0);
+               while (vblankthread_mode == VBLANKTH_ACTIVE) {
+                       vsync_sleep (currprefs.m68k_speed < 0 || currprefs.m68k_speed_throttle < 0);
                }
        }
        changevblankthreadmode_fast (VBLANKTH_ACTIVE_WAIT);
-       return thread_vblank_time;
+       return prev + vblankbasefull;
 }
 
 void vsync_busywait_start (void)
 {
-#if 0
-       struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];
-       if (!dooddevenskip) {
-               vsync_notvblank ();
-               if (ap->gfx_vflip > 0) {
-                       doflipevent ();
-               }
-       }
-#endif
-       vblank_prev_time = thread_vblank_time;
-       vblank_first_time = false;
+       if (vblankthread_mode != VBLANKTH_ACTIVE_WAIT)
+               write_log (L"low latency vsync state mismatch %d\n", vblankthread_mode);
        changevblankthreadmode_fast (VBLANKTH_ACTIVE_START);
 }
 
@@ -2768,16 +2779,21 @@ bool vsync_busywait_do (int *freetime, bool lace, bool oddeven)
                        while (!framelost && read_processor_time () - prevtime < vblankbasewait1) {
                                vsync_sleep (false);
                        }
-                       v = vblank_wait ();
+                       int vp = vblank_wait ();
+                       if (vp >= -1) {
+                               vblank_prev_time = read_processor_time ();
+                               if (vp > 0)
+                                       vblank_prev_time -= (vblankbasefull * vp / maxscanline) / (vblank_skipeveryother ? 2 : 1 );
+                               v = true;
+                       }
                } else {
                        v = true;
+                       vblank_prev_time = read_processor_time ();
                }
                framelost = false;
-
        }
 
        if (v) {
-               vblank_prev_time = read_processor_time ();
                frame_counted++;
                return true;
        }
@@ -2826,7 +2842,7 @@ double vblank_calibrate (double approx_vblank, bool waitonly)
        while (rv) {
                if (rv->width == width && rv->height == height && rv->depth == depth && rv->rate == rate && rv->mode == mode && rv->rtg == picasso_on) {
                        approx_vblank = rv->remembered_rate2;
-                       rval = rv->remembered_rate;
+                       tsum = rval = rv->remembered_rate;
                        maxscanline = rv->maxscanline;
                        maxvpos = rv->maxvpos;
                        lace = rv->lace;
@@ -2917,9 +2933,9 @@ double vblank_calibrate (double approx_vblank, bool waitonly)
                tsum /= total;
        }
 
-skip:
        if (waitonly)
                tsum = approx_vblank;
+skip:
 
        vblank_skipeveryother = false;
        getvsyncrate (tsum, &mult);
@@ -2936,7 +2952,7 @@ skip:
        vblankbasefull = (syncbase / tsum2);
        vblankbasewait1 = (syncbase / tsum2) * 75 / 100;
        vblankbasewait2 = (syncbase / tsum2) * 55 / 100;
-       vblankbasewait3 = (syncbase / tsum2) * 99 / 100 - syncbase / 500; // at least 2ms before vblank
+       vblankbasewait3 = (syncbase / tsum2) * 99 / 100 - syncbase / (250 * (vblank_skipeveryother ? 1 : 2)); // at least 2ms before vblank
        vblankbaselace = lace;
        write_log (_T("VSync %s: %.6fHz/%.1f=%.6fHz. MinV=%d MaxV=%d%s Units=%d %.1f%%\n"),
                waitonly ? _T("remembered") : _T("calibrated"), tsum, div, tsum2,
index acb5933098d71d40782fd3f0d4b47355c12155a6..de4336afda5d21a1911069c4d78e2f5cafdeb5d3 100644 (file)
@@ -11700,7 +11700,7 @@ static void values_from_inputdlg (HWND hDlg, int inputchange)
                bool iscustom = false;
                TCHAR custom[MAX_DPATH];
 
-               if (!_tcscmp (inputdevice_get_eventinfo (INPUTEVENT_SPC_CUSTOM_EVENT)->name, eventnames[input_selected_event])) {
+               if (eventnames[input_selected_event] && !_tcscmp (inputdevice_get_eventinfo (INPUTEVENT_SPC_CUSTOM_EVENT)->name, eventnames[input_selected_event])) {
                        doinputcustom (hDlg, 1);
                        iscustom = true;
                }
@@ -12998,7 +12998,7 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
        LRESULT item;
        TCHAR tmp[100];
        int i;
-       static int filteroverlaypos;
+       static int filteroverlaypos = -1;
 
        switch (msg)
        {
@@ -13030,8 +13030,16 @@ static INT_PTR CALLBACK hw3dDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM
                }
 
                SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_RESETCONTENT, 0, 0L);
-               SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Overlays"));
-               SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_ADDSTRING, 0, (LPARAM)_T("Masks"));
+               WIN32GUI_LoadUIString (IDS_FILTEROVERLAYTYPE_OVERLAYS, tmp, sizeof tmp / sizeof (TCHAR));
+               SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
+               WIN32GUI_LoadUIString (IDS_FILTEROVERLAYTYPE_MASKS, tmp, sizeof tmp / sizeof (TCHAR));
+               SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_ADDSTRING, 0, (LPARAM)tmp);
+               if (filteroverlaypos < 0) {
+                       if (!workprefs.gfx_filteroverlay[0])
+                               filteroverlaypos = 1;
+                       else
+                               filteroverlaypos = 0;
+               }
                SendDlgItemMessage (hDlg, IDC_FILTEROVERLAYTYPE, CB_SETCURSEL, filteroverlaypos, 0);
 
                enable_for_hw3ddlg (hDlg);
index 1c8fb9e905f2a301882ead9c37ad657f3cd47ba8..22e4c2dcd1f47af26e9991624443a4142bbc7949 100644 (file)
     <ClCompile Include="..\..\moduleripper.cpp" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="..\..\..\..\..\Users\Toni\Desktop\winuaebootlog.txt" />
     <None Include="..\resources\35floppy.ico" />
     <None Include="..\resources\amigainfo.ico" />
     <None Include="..\resources\avioutput.ico" />
index 34fb1b370e4cdd9ac2b045b7bf0607f29c4c1c5c..0f75a87b0c66b127f0f9e6d68c7ddc032c093f7c 100644 (file)
     <None Include="..\resources\drive_spinnd.wav" />
     <None Include="..\resources\drive_startup.wav" />
     <None Include="..\resources\resource" />
-    <None Include="..\..\..\..\..\Users\Toni\Desktop\winuaebootlog.txt">
-      <Filter>common</Filter>
-    </None>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\resources\winuae.rc">
index 573f34c07716692b6354f5cf58b145178f8790f6..9691d29443731155733bfcd632cb2a08d42807e4 100644 (file)
@@ -2,6 +2,18 @@
 - restore only single input target to default.
 - hdd from command line
 
+Beta 12: (RC1)
+
+- Ignore sprite 0 (normally mouse pointer) when calculating autoscale position and size.
+- Custom Input event editor usually crashed.
+- CD32 boot screen autoscale improved.
+- b10 "show drives that require admin privileges" hide drives that also have drive letter.
+  Background info: for some strange reason USB memory card adapters have two devices, one (without drive letter) that can't
+  be accessed without admin privileges and drive letter device that can be accessed.
+- Fastest possible CPU + low latency vsync and double frame mode (85Hz+) jitter fixed.
+- "Masks" in filter panel is selected by default, "Overlays" is only selected if overlay image is already configured.
+- Possible fix for D3D mask alignment errors in some scaling settings.
+
 Beta 11:
 
 - Adjusted Fastest Possible timing a bit more..