]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Adaptive sync configurable black frame insertion timing.
authorToni Wilen <twilen@winuae.net>
Sun, 24 Apr 2016 12:29:51 +0000 (15:29 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 24 Apr 2016 12:29:51 +0000 (15:29 +0300)
cfgfile.cpp
include/options.h
od-win32/win32gfx.cpp

index 9a22e2d218932beea64a904bc519e62af982357d..6222686928019d3265a81639b09dbb8b5c9612a9 100644 (file)
@@ -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);
index e3ff87eb55d6384837d9c25cebb6a8184d473f94..1100ad20985c49c725217317c732f3e92054c80b 100644 (file)
@@ -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];
index 86a723729fa2b8e6a83ce7d11747a445930ba2e3..7bb4a04e1e6bb72e0887279646b5e9c8a837c8c5 100644 (file)
@@ -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