Skip to content

Commit

Permalink
add bxt_cap_seemless
Browse files Browse the repository at this point in the history
  • Loading branch information
khanghugo committed Dec 4, 2022
1 parent d7163d8 commit a262d84
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/modules/capture/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit a262d84

Please sign in to comment.