Skip to content

Commit 4d08918

Browse files
committed
fixup: timeline split logic
1 parent 3937a28 commit 4d08918

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/cvars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@
603603
|sar_time_demo|cmd|sar_time_demo \<demo_name> - parses a demo and prints some information about it|
604604
|sar_time_demo_dev|0|Printing mode when using sar_time_demo.<br>0 = Default,<br>1 = Console commands,<br>2 = Console commands & packets.|
605605
|sar_time_demos|cmd|sar_time_demos \<demo_name> [demo_name2]... - parses multiple demos and prints the total sum of them|
606-
|sar_timeline_show_completed|0|Only show speedrun starts with matching finishes.|
606+
|sar_timeline_show_completed|0|Only show speedrun starts and splits with matching finishes.|
607607
|sar_timeline_splits|1|Add split markers to the Steam Timeline.|
608608
|sar_timer_always_running|1|Timer will save current value when disconnecting.|
609609
|sar_timer_result|cmd|sar_timer_result - prints result of timer|

src/Features/SteamTimeline.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
/* Timeline can get cluttered up (especially at long recording lengths), nice to have an option to disable adding splits. */
99
Variable sar_timeline_splits("sar_timeline_splits", "1", "Add split markers to the Steam Timeline.\n");
10-
Variable sar_timeline_show_completed("sar_timeline_show_completed", "0", "Only show speedrun starts with matching finishes.\n");
10+
Variable sar_timeline_show_completed("sar_timeline_show_completed", "0", "Only show speedrun starts and splits with matching finishes.\n");
1111

1212
Timeline *timeline;
1313

@@ -31,12 +31,13 @@ void Timeline::Split(std::string name, std::string time) {
3131
if (!steam->hasLoaded) return;
3232
std::chrono::duration<float> currentOffset = std::chrono::system_clock::now() - g_speedrunStart;
3333
if (sar_timeline_splits.GetBool()) {
34-
steam->g_timeline->AddTimelineEvent("steam_bolt", name.c_str(), time.c_str(), 0, 0.0f, 0.0f, k_ETimelineEventClipPriority_None);
34+
if (sar_timeline_show_completed.GetBool()) {
35+
g_pendingSplits.push_back({name, time, currentOffset.count()});
36+
} else {
37+
steam->g_timeline->AddTimelineEvent("steam_bolt", name.c_str(), time.c_str(), 0, 0.0f, 0.0f, k_ETimelineEventClipPriority_None);
38+
}
3539
}
3640

37-
if (sar_timeline_show_completed.GetBool()) {
38-
g_pendingSplits.push_back({name, time, currentOffset.count()});
39-
}
4041
}
4142

4243
ON_EVENT(SESSION_START) {

0 commit comments

Comments
 (0)