From: Toni Wilen Date: Sun, 24 Apr 2016 12:29:51 +0000 (+0300) Subject: Adaptive sync configurable black frame insertion timing. X-Git-Tag: 3300~50 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6ce7a6462fcdac86b79c67070769a3d1654255b0;p=francis%2Fwinuae.git Adaptive sync configurable black frame insertion timing. --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 9a22e2d2..62226869 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1588,7 +1588,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_bool(f, _T("gfx_blacker_than_black"), p->gfx_blackerthanblack); cfgfile_dwrite_bool(f, _T("gfx_monochrome"), p->gfx_grayscale); cfgfile_dwrite_str(f, _T("gfx_atari_palette_fix"), threebitcolors[p->gfx_threebitcolors]); - cfgfile_dwrite_bool (f, _T("gfx_black_frame_insertion"), p->lightboost_strobo); + cfgfile_dwrite_bool(f, _T("gfx_black_frame_insertion"), p->lightboost_strobo); + cfgfile_dwrite(f, _T("gfx_black_frame_insertion_ratio"), _T("%d"), p->lightboost_strobo_ratio); cfgfile_write_str (f, _T("gfx_api"), filterapi[p->gfx_api]); cfgfile_dwrite (f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth); @@ -2570,7 +2571,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value) || cfgfile_intval (option, value, _T("gfx_backbuffers_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_backbuffers, 1) || cfgfile_yesno (option, value, _T("gfx_interlace"), &p->gfx_apmode[APMODE_NATIVE].gfx_interlaced) || cfgfile_yesno (option, value, _T("gfx_interlace_rtg"), &p->gfx_apmode[APMODE_RTG].gfx_interlaced) - + || cfgfile_intval(option, value, _T("gfx_black_frame_insertion_ratio"), &p->lightboost_strobo_ratio, 1) + || cfgfile_intval (option, value, _T("gfx_center_horizontal_position"), &p->gfx_xcenter_pos, 1) || cfgfile_intval (option, value, _T("gfx_center_vertical_position"), &p->gfx_ycenter_pos, 1) || cfgfile_intval (option, value, _T("gfx_center_horizontal_size"), &p->gfx_xcenter_size, 1) @@ -6441,6 +6443,9 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) cr->locked = false; _tcscpy (cr->label, _T("NTSC")); + p->lightboost_strobo = false; + p->lightboost_strobo_ratio = 50; + savestate_state = 0; target_default_options (p, type); diff --git a/include/options.h b/include/options.h index e3ff87eb..1100ad20 100644 --- a/include/options.h +++ b/include/options.h @@ -453,6 +453,7 @@ struct uae_prefs { int color_mode; int gfx_extrawidth; bool lightboost_strobo; + int lightboost_strobo_ratio; bool gfx_grayscale; struct gfx_filterdata gf[2]; diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 86a72372..7bb4a04e 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -1203,9 +1203,11 @@ void show_screen (int mode) struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0]; if (isfullscreen() > 0 && isvsync() == 0 && ap->gfx_strobo && ap->gfx_refreshrate > 80) { //if (isvsync() == 0 && ap->gfx_strobo) { - int ms = (int)((1000 / 2) / vblank_hz) - 1; - strobo_time = read_processor_time() + vsynctimebase / 2; - timeSetEvent(ms, 0, blackinsertion_cb, NULL, TIME_ONESHOT | TIME_CALLBACK_FUNCTION); + int ratio = currprefs.lightboost_strobo_ratio; + int ms = 1000 / vblank_hz; + int waitms = ms * ratio / 100 - 1; + strobo_time = read_processor_time() + vsynctimebase * ratio / 100; + timeSetEvent(waitms, 0, blackinsertion_cb, NULL, TIME_ONESHOT | TIME_CALLBACK_FUNCTION); } D3D_showframe(); #ifdef GFXFILTER