diff --git a/src/modules/capture/mod.rs b/src/modules/capture/mod.rs index 2972a56e..2f8b1c83 100644 --- a/src/modules/capture/mod.rs +++ b/src/modules/capture/mod.rs @@ -32,6 +32,7 @@ impl Module for Capture { &BXT_CAP_VOLUME, &BXT_CAP_SOUND_EXTRA, &BXT_CAP_SLOWDOWN, + &BXT_CAP_SEEMLESS, &BXT_CAP_SAMPLING_EXPOSURE, &BXT_CAP_FORCE_FALLBACK, &BXT_CAP_OVERRIDE_FFMPEG_ARGS, @@ -96,6 +97,17 @@ Slowdown factor for the recording. For example, `2` means that the video will be two times slower than the realtime playback. \ Especially useful for TASes.", ); +static BXT_CAP_SEEMLESS: CVar = CVar::new( + b"bxt_cap_seemless\0", + b"1\0", + "\ +Skipping recording non-gameplay frames such as one frame in main menu or loading screen. + +Set to `0` to disable. Set to `1` to enable. \ +Any value greater than `1` will be the extra amount of frames skipped \ +as soon as a demo or a map is loaded. The recommended value for such situation \ +should be `7` (six first frames will not be captured).", +); static BXT_CAP_SAMPLING_MIN_FPS: CVar = CVar::new( b"_bxt_cap_sampling_min_fps\0", b"7200\0", @@ -517,19 +529,21 @@ pub unsafe fn time_passed(marker: MainThreadMarker) { let frame_count = *engine::cls_demoframecount.get(marker); let cls = &*engine::cls.get(marker); - if cls.state != 5 { - // ca_dedicated=0, - // ca_disconnected=1, - // ca_connecting=2, - // ca_connected=3, - // ca_uninitialized=4, - // ca_active=5 - return; - } else { - if cls_demos.demoplayback == 1 && frame_count == 0 { - // demoplayback is updated to 1 after state 4 is done - // not sure if frame 0 is that important + if BXT_CAP_SEEMLESS.as_bool(marker) { + if cls.state != 5 { + // ca_dedicated=0, + // ca_disconnected=1, + // ca_connecting=2, + // ca_connected=3, + // ca_uninitialized=4, + // ca_active=5 return; + } else { + if cls_demos.demoplayback == 1 && frame_count < BXT_CAP_SEEMLESS.as_f32(marker) as i32 { + // demoplayback is updated to 1 after state 4 is done + // frame 0 are skipped by default because they are non-frames + return; + } } }