]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Statusline-only resync indicator. Detect non-toggling LOF change as resync.
authorToni Wilen <twilen@winuae.net>
Mon, 6 Jun 2022 15:46:34 +0000 (18:46 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 6 Jun 2022 15:46:34 +0000 (18:46 +0300)
custom.cpp
od-win32/win32gui.cpp
statusline.cpp

index 4fc75236777a8a95509c848785163485b5648c4e..1e5296ffc7805cab177bf478a19d7b4c0506e57c 100644 (file)
@@ -137,6 +137,7 @@ static int lof_changed = 0, lof_changing = 0, interlace_changed = 0;
 static int lof_changed_previous_field;
 static int vposw_change;
 static bool lof_lace;
+static bool prevlofs[3];
 static bool bplcon0_interlace_seen;
 static int scandoubled_line;
 static bool vsync_rendered, frame_rendered, frame_shown;
@@ -5600,7 +5601,7 @@ static void reset_decisions_hsync_start(void)
        if (currprefs.gfx_overscanmode == OVERSCANMODE_ULTRA) {
                thisline_decision.vb = VB_NOVB;
        }
-       if (nosignal_status > 0 || nosignal_status) {
+       if (nosignal_status == 1) {
                thisline_decision.vb = VB_XBLANK;
                MARK_LINE_CHANGED;
        } else if (nosignal_status < 0) {
@@ -7057,6 +7058,7 @@ static void VPOSW(uae_u16 v)
                lol = 0;
        }
        if (lof_changing) {
+               bool newlof = (v & 0x8000) != 0;
                return;
        }
        vpos &= 0x00ff;
@@ -10821,9 +10823,9 @@ static void fpscounter(bool frameok)
                        idle = 100 * 10;
                gui_data.fps = fps;
                gui_data.idle = (int)idle;
-               gui_data.fps_color = nosignal_status ? 2 : (frameok ? 0 : 1);
+               gui_data.fps_color = nosignal_status == 1 ? 2 : (nosignal_status == 2 ? 3 : (frameok ? 0 : 1));
                if ((timeframes & 15) == 0) {
-                       gui_fps (fps, (int)idle, gui_data.fps_color);
+                       gui_fps(fps, (int)idle, gui_data.fps_color);
                }
        }
 }
@@ -11065,6 +11067,12 @@ static void vsync_handler_post(void)
                }
        }
        if (lof_changing) {
+
+               if (lof_store != (prevlofs[0] ? 1 : 0) && prevlofs[0] == prevlofs[1] && prevlofs[1] == prevlofs[2]) {
+                       // resync if LOF was not toggling previously
+                       nosignal_trigger = true;
+               }
+
                // still same? Trigger change now.
                if ((!lof_store && lof_changing < 0) || (lof_store && lof_changing > 0)) {
                        lof_changed_previous_field++;
@@ -11088,6 +11096,10 @@ static void vsync_handler_post(void)
                lof_lace = false;
        }
 
+       prevlofs[2] = prevlofs[1];
+       prevlofs[1] = prevlofs[0];
+       prevlofs[0] = lof_store;
+
 #ifdef DEBUGGER
        if (debug_copper) {
                record_copper_reset();
@@ -11145,6 +11157,9 @@ static void vsync_handler_post(void)
                        if (nosignal_cnt <= 0) {
                                nosignal_cnt = 1;
                        }
+               } else {
+                       nosignal_status = 2;
+                       nosignal_cnt = (int)(vblank_hz / 2);
                }
        }
 
index f328978b5f390c34abfa02e7e8c1f08f33821935..59daa8a2e5d5023aa90ede0400856f4f2936c7c7 100644 (file)
@@ -22848,7 +22848,7 @@ void gui_led (int led, int on, int brightness)
                if (on > 1)
                        writing = 1;
        } else if (led == LED_FPS) {
-               double fps = (double)gui_data.fps / 10.0;
+               float fps = gui_data.fps / 10.0f;
                extern float p96vblank;
                pos = 2;
                ptr = drive_text + pos * LED_STRING_WIDTH;
@@ -22856,6 +22856,8 @@ void gui_led (int led, int on, int brightness)
                        fps = 9999.9;
                if (gui_data.fps_color == 2) {
                        _tcscpy(ptr, _T("No Sync"));
+               } else if (gui_data.fps_color == 3) {
+                       _tcscpy(ptr, _T("FPS: ----"));
                } else if (fps < 1000) {
                        if (ad->picasso_on)
                                _stprintf (ptr, _T("%.1f [%.1f]"), p96vblank, fps);
index 664b82c67ebbe6c6c831dd825a9dcd3c09c2fca6..1bd3a60a2700a19ba1d586257dfe0b4f454ec93f 100644 (file)
@@ -259,23 +259,30 @@ void draw_status_line_single(int monid, uae_u8 *buf, int bpp, int y, int totalwi
                                on_rgb = 0x000000;
                                off_rgb = gui_data.fps_color == 1 ? 0xcccc00 : (gui_data.fps_color == 2 ? 0x0000cc : 0x000000);
                                am = 3;
-                               if (fps > 999) {
-                                       fps += 50;
-                                       fps /= 10;
-                                       if (fps > 999)
-                                               fps = 999;
-                                       num1 = fps / 100;
-                                       num1 %= 10;
-                                       num2 = 18;
-                                       num3 = (fps - num1 * 100) / 10;
+                               if (gui_data.fps_color >= 2) {
+                                       num1 = -1;
+                                       num2 = 15;
+                                       num3 = 15;
+                                       am = 2;
                                } else {
-                                       num1 = fps / 100;
-                                       num2 = (fps - num1 * 100) / 10;
-                                       num3 = fps % 10;
-                                       num1 %= 10;
-                                       num2 %= 10;
-                                       if (num1 == 0)
-                                               am = 2;
+                                       if (fps > 999) {
+                                               fps += 50;
+                                               fps /= 10;
+                                               if (fps > 999)
+                                                       fps = 999;
+                                               num1 = fps / 100;
+                                               num1 %= 10;
+                                               num2 = 18;
+                                               num3 = (fps - num1 * 100) / 10;
+                                       } else {
+                                               num1 = fps / 100;
+                                               num2 = (fps - num1 * 100) / 10;
+                                               num3 = fps % 10;
+                                               num1 %= 10;
+                                               num2 %= 10;
+                                               if (num1 == 0)
+                                                       am = 2;
+                                       }
                                }
                        }
                } else if (led == LED_CPU) {