From a4eb0c1069a266a3837c60d066c967f78f68df5c Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Tue, 1 May 2018 17:46:37 +0300 Subject: [PATCH] 4000b7 --- custom.cpp | 51 ++++++++++++++++++++++++++------------- od-win32/direct3d11.cpp | 4 +-- od-win32/win32.h | 4 +-- od-win32/win32_scaler.cpp | 16 ++++++++++++ 4 files changed, 54 insertions(+), 21 deletions(-) diff --git a/custom.cpp b/custom.cpp index a2e80ab6..d84aba1c 100644 --- a/custom.cpp +++ b/custom.cpp @@ -4054,7 +4054,7 @@ void compute_vsynctime (void) if (fabs (currprefs.chipset_refreshrate) > 0.1) { syncadjust = currprefs.chipset_refreshrate / vblank_hz_nom; vblank_hz = currprefs.chipset_refreshrate; - if (isvsync_chipset ()) { + if (isvsync_chipset() && !currprefs.gfx_variable_sync) { int mult = 0; if (getvsyncrate(0, vblank_hz, &mult) != vblank_hz) { vblank_hz = getvsyncrate(0, vblank_hz, &vblank_hz_mult); @@ -4217,20 +4217,22 @@ void compute_framesync(void) double v = -1; if (!ad->picasso_on && !ad->picasso_requested_on) { if (isvsync_chipset ()) { - if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) { - if ((fabs (vblank_hz - 50) < 1 || fabs (vblank_hz - 60) < 1 || fabs (vblank_hz - 100) < 1 || fabs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) { - vsync_switchmode(0, (int)vblank_hz); + if (!currprefs.gfx_variable_sync) { + if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) { + if ((fabs(vblank_hz - 50) < 1 || fabs(vblank_hz - 60) < 1 || fabs(vblank_hz - 100) < 1 || fabs(vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) { + vsync_switchmode(0, (int)vblank_hz); + } + } + if (isvsync_chipset() < 0) { + + double v2; + v2 = target_getcurrentvblankrate(0); + if (!cr->locked) + v = v2; + } else if (isvsync_chipset() > 0) { + if (currprefs.gfx_apmode[0].gfx_refreshrate) + v = abs(currprefs.gfx_apmode[0].gfx_refreshrate); } - } - if (isvsync_chipset () < 0) { - - double v2; - v2 = target_getcurrentvblankrate(0); - if (!cr->locked) - v = v2; - } else if (isvsync_chipset () > 0) { - if (currprefs.gfx_apmode[0].gfx_refreshrate) - v = abs (currprefs.gfx_apmode[0].gfx_refreshrate); } } else { if (cr->locked == false) { @@ -8463,7 +8465,7 @@ static bool linesync_beam_multi_single(void) display_rendered = true; } // if 2 slices: make sure we are out of vblank. - if (display_slices <= 2) { + if (display_slices <= 2 && !currprefs.gfx_variable_sync) { while (!currprefs.turbo_emulation && sync_timeout_check(maxtime)) { int vp = target_get_display_scanline(-1); if (vp != -1) @@ -8501,15 +8503,29 @@ static bool linesync_beam_multi_single(void) // topmost/first slice? if (display_slice_cnt == 0) { + // variable sync: use read_processor_time() for vblank timing if (currprefs.gfx_variable_sync) { if (!currprefs.turbo_emulation) { + + frame_time_t rpt; + for (;;) { + rpt = read_processor_time(); + if ((int)rpt - (int)(vsyncmintime - vsynctimebase / 2) >= 0 || (int)rpt - (int)vsyncmintime < -2 * vsynctimebase) + break; + maybe_process_pull_audio(); + if (currprefs.m68k_speed < 0 && !was_syncline) { + is_syncline = -1; + return 0; + } + target_spin(0); + } + if (!was_syncline) { do_render_slice(2, display_slice_cnt, vpos - 1); display_rendered = true; } - frame_time_t rpt; for(;;) { rpt = read_processor_time(); if ((int)rpt - (int)vsyncmintime >= 0 || (int)rpt - (int)vsyncmintime < -2 * vsynctimebase) @@ -8521,18 +8537,19 @@ static bool linesync_beam_multi_single(void) } target_spin(0); } - do_display_slice(); if ((int)rpt - (int)vsyncmintime < vsynctimebase && (int)rpt - (int)vsyncmintime > -vsynctimebase) { vsyncmintime += vsynctimebase; } else { vsyncmintime = rpt + vsynctimebase; } + do_display_slice(); display_rendered = false; input_read_done = true; } } else { + // non-variable: poll vblank if (!currprefs.turbo_emulation) { if (!was_syncline) { do_render_slice(2, display_slice_cnt, vpos - 1); diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 705a771f..da148f31 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -4678,7 +4678,7 @@ static void xD3D11_guimode(int monid, int guion) write_log(_T("fs guimode end\n")); } -static int xD3D_isenabled(int monid) +static int xD3D11_isenabled(int monid) { struct d3d11struct *d3d = &d3d11data[monid]; return d3d->m_device != NULL ? 2 : 0; @@ -4862,7 +4862,7 @@ void d3d11_select(void) D3D_showframe_special = NULL; D3D_guimode = xD3D11_guimode; D3D_getDC = xD3D_getDC; - D3D_isenabled = xD3D_isenabled; + D3D_isenabled = xD3D11_isenabled; D3D_clear = xD3D11_clear; D3D_canshaders = xD3D11_canshaders; D3D_goodenough = xD3D11_goodenough; diff --git a/od-win32/win32.h b/od-win32/win32.h index 18e5170b..8dafd1ec 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -20,12 +20,12 @@ #define LANG_DLL_FULL_VERSION_MATCH 1 #if WINUAEPUBLICBETA -#define WINUAEBETA _T("6") +#define WINUAEBETA _T("7") #else #define WINUAEBETA _T("") #endif -#define WINUAEDATE MAKEBD(2018, 4, 28) +#define WINUAEDATE MAKEBD(2018, 5, 1) //#define WINUAEEXTRA _T("AmiKit Preview") //#define WINUAEEXTRA _T("Amiga Forever Edition") diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index d57d806c..ab75a72c 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -805,6 +805,8 @@ static void statusline(int monid) void S2X_configure(int monid, int rb, int gb, int bb, int rs, int gs, int bs) { + if (monid) + return; Init_2xSaI(rb, gb, bb, rs, gs, bs); hq_init(rb, gb, bb, rs, gs, bs); PAL_init(monid); @@ -813,6 +815,8 @@ void S2X_configure(int monid, int rb, int gb, int bb, int rs, int gs, int bs) void S2X_reset(int monid) { + if (monid) + return; if (!inited) return; S2X_init(monid, dst_width2, dst_height2, amiga_depth2); @@ -820,6 +824,9 @@ void S2X_reset(int monid) void S2X_free(int monid) { + if (monid) + return; + changed_prefs.leds_on_screen &= ~STATUSLINE_TARGET; currprefs.leds_on_screen &= ~STATUSLINE_TARGET; @@ -839,6 +846,9 @@ void S2X_free(int monid) bool S2X_init(int monid, int dw, int dh, int dd) { + if (monid) + return false; + struct vidbuf_description *avidinfo = &adisplays[monid].gfxvidinfo; struct amigadisplay *ad = &adisplays[monid]; struct vidbuffer *vb = avidinfo->outbuffer; @@ -955,6 +965,8 @@ bool S2X_init(int monid, int dw, int dh, int dd) void S2X_render(int monid, int y_start, int y_end) { + if (monid) + return; struct AmigaMonitor *mon = &AMonitors[monid]; struct amigadisplay *ad = &adisplays[monid]; struct uae_filter *usedfilter = mon->usedfilter; @@ -1177,12 +1189,16 @@ end: void S2X_refresh(int monid) { + if (monid) + return; DirectDraw_ClearSurface(NULL); S2X_render(monid, -1, -1); } int S2X_getmult(int monid) { + if (monid) + return 1; struct AmigaMonitor *mon = &AMonitors[monid]; struct uae_filter *usedfilter = mon->usedfilter; if (!usedfilter) -- 2.47.3