Skip to content

Commit

Permalink
Merge branch 'develop' into steam-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphiiko committed Oct 27, 2024
2 parents bdf87b1 + 1ce980d commit 728da80
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- GPU acceleration for SteamVR overlays (Community contribution by [BenjaminZehowlt](https://github.com/BenjaminZehowlt))

## [1.14.4]

### Fixed

- OyasumiVR crashing when parsing VRChat logs produced during the two hours of DST ending.

## [1.14.3]

### Changed
Expand Down
31 changes: 24 additions & 7 deletions src-core/src/vrc_log_parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,15 @@ fn get_latest_log_path() -> Option<String> {
.map(|entry| String::from(entry.path.to_str().unwrap()))
}

fn parse_datetime_from_line(line: String) -> u64 {
fn parse_datetime_from_line(line: String) -> Option<u64> {
let localtime = NaiveDateTime::parse_from_str(&line[0..19], "%Y.%m.%d %H:%M:%S").unwrap();
let time = Local.from_local_datetime(&localtime).unwrap();
time.timestamp_millis() as u64
// In the case of a DST rollback, we pick the latest possible time
// During this hour, the logs will still be parsed in order, but their timestamps will be out of order.
let time = Local.from_local_datetime(&localtime).latest();
match time {
Some(v) => Some(v.timestamp_millis() as u64),
None => return None,
}
}

async fn process_log_line(line: String, initial_load: bool) {
Expand All @@ -81,8 +86,12 @@ async fn parse_on_player_joined(line: String, initial_load: bool) -> bool {
return true;
}
let display_name = line[offset..].to_string();
let time = match parse_datetime_from_line(line) {
Some(v) => v,
None => return true,
};
let event = VRCLogEvent {
time: parse_datetime_from_line(line),
time: time,
event: String::from("OnPlayerJoined"),
data: display_name,
initial_load,
Expand Down Expand Up @@ -112,8 +121,12 @@ async fn parse_on_player_left(line: String, initial_load: bool) -> bool {
return true;
}
let display_name = line[offset..].to_string();
let time = match parse_datetime_from_line(line) {
Some(v) => v,
None => return true,
};
let event = VRCLogEvent {
time: parse_datetime_from_line(line),
time: time,
event: String::from("OnPlayerLeft"),
data: display_name,
initial_load,
Expand Down Expand Up @@ -143,8 +156,12 @@ async fn parse_on_location_change(line: String, initial_load: bool) -> bool {
return true;
}
let instance_id = line[offset..].to_string();
let time = match parse_datetime_from_line(line) {
Some(v) => v,
None => return true,
};
let event = VRCLogEvent {
time: parse_datetime_from_line(line),
time: time,
event: String::from("OnLocationChange"),
data: instance_id,
initial_load,
Expand Down Expand Up @@ -203,7 +220,7 @@ fn start_log_watch_task(path: String) -> CancellationToken {
initial_load: true,
},
)
.await;
.await;
first_run = false;
}
}
Expand Down

0 comments on commit 728da80

Please sign in to comment.