From: Toni Wilen Date: Mon, 6 Jun 2022 15:46:34 +0000 (+0300) Subject: Statusline-only resync indicator. Detect non-toggling LOF change as resync. X-Git-Tag: 41000~220 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=290c2a23658b1ab00a6a50e65b09c670ddc7721f;p=francis%2Fwinuae.git Statusline-only resync indicator. Detect non-toggling LOF change as resync. --- diff --git a/custom.cpp b/custom.cpp index 4fc75236..1e5296ff 100644 --- a/custom.cpp +++ b/custom.cpp @@ -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); } } diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index f328978b..59daa8a2 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -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); diff --git a/statusline.cpp b/statusline.cpp index 664b82c6..1bd3a60a 100644 --- a/statusline.cpp +++ b/statusline.cpp @@ -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) {