From b3638266114f1e37274d34a103348d4d88e36bed Mon Sep 17 00:00:00 2001 From: Khang Le Date: Fri, 17 Feb 2023 21:29:53 -0500 Subject: [PATCH] resolve conflict --- src/hooks/engine.rs | 3 --- src/modules/capture/mod.rs | 19 ++++++------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/hooks/engine.rs b/src/hooks/engine.rs index 41d828c2..c8998941 100644 --- a/src/hooks/engine.rs +++ b/src/hooks/engine.rs @@ -1668,8 +1668,6 @@ use exported::*; pub mod exported { #![allow(clippy::missing_safety_doc)] - use std::ffi::CStr; - use super::*; #[export_name = "Memory_Init"] @@ -2123,7 +2121,6 @@ pub mod exported { pub unsafe extern "C" fn my_CL_PlayDemo_f() { abort_on_panic(move || { let marker = MainThreadMarker::new(); - capture_video_per_demo::on_before_cl_playdemo_f(marker); CL_PlayDemo_f.get(marker)(); capture_video_per_demo::on_after_cl_playdemo_f(marker); diff --git a/src/modules/capture/mod.rs b/src/modules/capture/mod.rs index f413a1aa..8abc83b8 100644 --- a/src/modules/capture/mod.rs +++ b/src/modules/capture/mod.rs @@ -99,12 +99,12 @@ Especially useful for TASes.", ); static BXT_CAP_SKIP_NON_GAMEPLAY_FRAMES: CVar = CVar::new( b"_bxt_cap_skip_non_gameplay_frames\0", - b"2\0", + b"0\0", "\ Skipping recording non-gameplay frames such as main menu, loading screen, or demo load. Set to `0` to disable. Set to `1` to enable. Default is `2`. \ Any values higher than `1` will be the extra 'gameplay' frames being skipped. \ -For example, `2` means one extra gameplay frame skipped during capture.", +For example, `2` means ''1'' extra gameplay frame skipped during capture.", ); static BXT_CAP_SAMPLING_MIN_FPS: CVar = CVar::new( b"_bxt_cap_sampling_min_fps\0", @@ -226,7 +226,7 @@ fn cap_start(marker: MainThreadMarker) { cap_start_with_filename(marker, "output.mp4".to_string()); } -fn cap_start_with_filename(marker: MainThreadMarker, filename: String) { +pub fn cap_start_with_filename(marker: MainThreadMarker, filename: String) { if !Capture.is_enabled(marker) { return; } @@ -536,20 +536,14 @@ pub unsafe fn time_passed(marker: MainThreadMarker) { if BXT_CAP_SKIP_NON_GAMEPLAY_FRAMES.as_bool(marker) { if (&*engine::cls.get(marker)).state != 5 { - // ca_dedicated=0, - // ca_disconnected=1, - // ca_connecting=2, - // ca_connected=3, - // ca_uninitialized=4, - // ca_active=5 return; } // demoplayback is updated to 1 after state 4 is done. // The current implementation will skip all the frames until some viewmodel values are set. if (&*engine::cls_demos.get(marker)).demoplayback == 1 { - // For some reasons, the "true" first frame is in this true condition... - // That's a good thing because it technically captures all non-loading frames. - // Broken frames before that in a demo are counted as normal frames. + // For some reasons, the "true" first frame will be catched in this condition + // despite having no viewmodel shown in demo. + // So it does technically capture all non-loading frames. if (*engine::cl_stats.get(marker))[2] == 0 { // Fallback when there is no viewmodel assigned ever. Happens when no weapons are picked up. // Frame 7 is guaranteed to be the "start" frame most of the time. @@ -558,7 +552,6 @@ pub unsafe fn time_passed(marker: MainThreadMarker) { } } // Alternative use of the cvar. - // Recording FPS must not be below demo FPS so the skip can work properly. Eg: recording 60fps of 250fps demo will be iffy. if FRAME_SKIP.get(marker) + 1 < BXT_CAP_SKIP_NON_GAMEPLAY_FRAMES.as_f32(marker) as u32 { FRAME_SKIP.set(marker, FRAME_SKIP.get(marker) + 1); return;