Compare commits

..

18 Commits

Author SHA1 Message Date
c3247070c1
Merge pull request #8 from maciejpedzich/dependabot/cargo/patch-updates-4056f24cdb
chore(deps): bump proc-macro2 from 1.0.94 to 1.0.95 in the patch-updates group
2025-04-18 13:56:32 +02:00
dependabot[bot]
7e03c5d443
chore(deps): bump proc-macro2 in the patch-updates group
Bumps the patch-updates group with 1 update: [proc-macro2](https://github.com/dtolnay/proc-macro2).


Updates `proc-macro2` from 1.0.94 to 1.0.95
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.94...1.0.95)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-version: 1.0.95
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 11:06:26 +00:00
321836e0e4
Merge pull request #7 from maciejpedzich/release-plz-2025-03-16T06-33-19Z
chore: release v1.0.3
2025-03-16 18:58:29 +01:00
github-actions[bot]
f7f044a01e
chore: release v1.0.3 2025-03-16 06:33:20 +00:00
fa723f11be
Merge pull request #6 from maciejpedzich/dependabot/cargo/patch-updates-bae5829fda
chore(deps): bump the patch-updates group with 3 updates
2025-03-16 07:32:48 +01:00
dependabot[bot]
ed54f36f9a
chore(deps): bump the patch-updates group with 3 updates
Bumps the patch-updates group with 3 updates: [serde](https://github.com/serde-rs/serde), [quote](https://github.com/dtolnay/quote) and [serde_derive](https://github.com/serde-rs/serde).


Updates `serde` from 1.0.218 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.218...v1.0.219)

Updates `quote` from 1.0.39 to 1.0.40
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.39...1.0.40)

Updates `serde_derive` from 1.0.218 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.218...v1.0.219)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: quote
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-14 11:50:05 +00:00
498acdf3b5
Merge pull request #5 from maciejpedzich/dependabot/cargo/minor-updates-2b3b5ac829
chore(deps): bump the minor-updates group with 2 updates
2025-03-09 20:38:05 +01:00
a2d5b70837
Merge pull request #4 from maciejpedzich/dependabot/cargo/patch-updates-c54969e8dd
chore(deps): bump the patch-updates group with 3 updates
2025-03-09 20:37:27 +01:00
dependabot[bot]
0067d80c9e
chore(deps): bump the minor-updates group with 2 updates
Bumps the minor-updates group with 2 updates: [bytemuck](https://github.com/Lokathor/bytemuck) and [either](https://github.com/rayon-rs/either).


Updates `bytemuck` from 1.21.0 to 1.22.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.21.0...v1.22.0)

Updates `either` from 1.13.0 to 1.15.0
- [Commits](https://github.com/rayon-rs/either/compare/1.13.0...1.15.0)

---
updated-dependencies:
- dependency-name: bytemuck
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: minor-updates
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: minor-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-07 11:54:25 +00:00
dependabot[bot]
4a2da3ebfb
chore(deps): bump the patch-updates group with 3 updates
Bumps the patch-updates group with 3 updates: [proc-macro2](https://github.com/dtolnay/proc-macro2), [quote](https://github.com/dtolnay/quote) and [unicode-ident](https://github.com/dtolnay/unicode-ident).


Updates `proc-macro2` from 1.0.93 to 1.0.94
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.93...1.0.94)

Updates `quote` from 1.0.38 to 1.0.39
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.38...1.0.39)

Updates `unicode-ident` from 1.0.17 to 1.0.18
- [Release notes](https://github.com/dtolnay/unicode-ident/releases)
- [Commits](https://github.com/dtolnay/unicode-ident/compare/1.0.17...1.0.18)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: quote
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: unicode-ident
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-07 11:54:19 +00:00
5c8f1dbcce
Merge pull request #3 from maciejpedzich/dev
Version 1.0.2 release
2025-03-04 23:23:07 +01:00
12c4a3f68e
chore: update bitflags and bump this crate's version to 1.0.2 2025-03-04 23:19:43 +01:00
3915dc62d5
docs: fix various typos in doc comments 2025-03-04 23:17:06 +01:00
b20a90706f
ci: bump crate version to 1.0.1 2025-02-28 23:11:27 +01:00
5b593478f3
fix: correct wrong InfringementType variant values and add some missing ones. 2025-02-28 23:10:57 +01:00
53af241949
fix: offset f32 assert range ends by a tenth 2025-02-28 23:09:56 +01:00
a93b93cfb5
fix: remove player_car_index assert due to the possibility of player being a spectator 2025-02-28 23:08:20 +01:00
6c24f65cd0
Merge pull request #1 from maciejpedzich/release-plz-2025-02-28T14-51-53Z
chore: release v1.0.0
2025-02-28 15:53:20 +01:00
6 changed files with 55 additions and 48 deletions

View File

@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [1.0.3](https://github.com/maciejpedzich/f1-game-packet-parser/compare/v1.0.2...v1.0.3) - 2025-03-16
### Other
- *(deps)* bump the patch-updates group with 3 updates
## [1.0.0](https://github.com/maciejpedzich/f1-game-packet-parser/releases/tag/v1.0.0) - 2025-02-28
### Added

34
Cargo.lock generated
View File

@ -34,25 +34,25 @@ dependencies = [
[[package]]
name = "bitflags"
version = "2.8.0"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "bytemuck"
version = "1.21.0"
version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540"
[[package]]
name = "either"
version = "1.13.0"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "f1-game-packet-parser"
version = "1.0.0"
version = "1.0.3"
dependencies = [
"binrw",
"bitflags",
@ -67,36 +67,36 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "proc-macro2"
version = "1.0.93"
version = "1.0.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.38"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.218"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.218"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
@ -127,6 +127,6 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"

View File

@ -1,7 +1,7 @@
[package]
name = "f1-game-packet-parser"
description = "Convert binary data from F1 24, F1 23, and F1 22 UDP telemetry into organised structs."
version = "1.0.0"
version = "1.0.3"
edition = "2021"
rust-version = "1.78"
readme = "README.md"
@ -14,9 +14,10 @@ license = "MIT"
exclude = [
".github/*",
".idea/*",
"tests/*"
]
[dependencies]
binrw = "0.14.1"
bitflags = "2.8.0"
serde = { version = "1.0.218", features = ["derive"] }
bitflags = "2.9.0"
serde = { version = "1.0.219", features = ["derive"] }

View File

@ -105,7 +105,7 @@ pub enum Weather {
Storm = 5,
}
/// Temperature change direction. Represents a [`u8`].
/// Temperature change direction. Represents an [`i8`].
#[non_exhaustive]
#[derive(
BinRead,
@ -666,18 +666,20 @@ pub enum InfringementType {
SafetyCarExceedingAllowedPace = 37,
VirtualSafetyCarExceedingAllowedPace = 38,
FormationLapBelowAllowedSpeed = 39,
RetiredMechanicalFailure = 40,
RetiredTerminallyDamaged = 41,
SafetyCarFallingTooFarBack = 42,
BlackFlagTimer = 43,
UnservedStopGoPenalty = 44,
UnservedDriveThroughPenalty = 45,
EngineComponentChange = 46,
GearboxChange = 47,
LeagueGridPenalty = 48,
RetryPenalty = 49,
IllegalTimeGain = 50,
MandatoryPitStop = 51,
FormationLapParking = 40,
RetiredMechanicalFailure = 41,
RetiredTerminallyDamaged = 42,
SafetyCarFallingTooFarBack = 43,
BlackFlagTimer = 44,
UnservedStopGoPenalty = 45,
UnservedDriveThroughPenalty = 46,
EngineComponentChange = 47,
GearboxChange = 48,
ParcFermeChange = 49,
LeagueGridPenalty = 50,
RetryPenalty = 51,
IllegalTimeGain = 52,
MandatoryPitStop = 53,
AttributeAssigned = 54,
}
@ -1065,7 +1067,7 @@ pub enum ErsDeployMode {
Hotlap = 3,
}
/// Flag the driver is currently being shown. Represents a [`u8`].
/// Flag the driver is currently being shown. Represents an [`i8`].
#[non_exhaustive]
#[derive(
BinRead,

View File

@ -1,7 +1,7 @@
//! Convert binary data from F1 24, F1 23, and F1 22 UDP telemetry into organised structs.
//! ## Getting started
//!
//! Add `f1_game_packet_parser` to your project by running the following command:
//! Add `f1-game-packet-parser` to your project by running the following command:
//!
//! ```sh
//! cargo add f1-game-packet-parser
@ -186,7 +186,7 @@ pub mod constants;
/// and submodules for packet-specific structs.
pub mod packets;
use crate::constants::{PacketId, MAX_NUM_CARS};
use crate::constants::PacketId;
use crate::packets::{
u8_to_usize, F1PacketCarDamage, F1PacketCarSetups, F1PacketCarStatus,
F1PacketCarTelemetry, F1PacketEvent, F1PacketFinalClassification, F1PacketLaps,
@ -361,15 +361,8 @@ pub struct F1PacketHeader {
/// Available from the 2023 format onwards.
#[br(if(packet_format >= 2023))]
pub overall_frame_identifier: u32,
/// Index of player 1's car.
#[br(
map(u8_to_usize),
assert(
player_car_index < MAX_NUM_CARS,
"Header has an invalid player 1 car index: {}",
player_car_index
)
)]
/// Index of player 1's car (255 if in spectator mode).
#[br(map(u8_to_usize))]
pub player_car_index: usize,
/// Index of player 2's car in splitscreen mode.
/// Set to 255 if not in splitscreen mode.

View File

@ -4,6 +4,11 @@ use crate::constants::{RevLights, Surface};
use binrw::BinRead;
use serde::{Deserialize, Serialize};
// f32 range ends were offset by a tenth to account for values ever so slightly
// greater or lower than the respective extreme.
// There's probably a better way of going about handling this,
// but this will do for now.
#[non_exhaustive]
#[derive(BinRead, PartialEq, PartialOrd, Copy, Clone, Debug, Serialize, Deserialize)]
#[br(little, import(_packet_format: u16))]
@ -13,7 +18,7 @@ pub struct CarTelemetryData {
/// Amount of throttle applied. Value in range `(0.0..=1.0)`.
#[br(
assert(
(0.0..=1.0).contains(&throttle),
(-0.1..=1.1).contains(&throttle),
"Car telemetry entry has an invalid throttle value: {}",
throttle
),
@ -22,7 +27,7 @@ pub struct CarTelemetryData {
/// Steering lock. Value in range `(-1.0..=1.0)`.
#[br(
assert(
(-1.0..=1.0).contains(&steer),
(-1.1..=1.1).contains(&steer),
"Car telemetry entry has an invalid steering lock value: {}",
steer
),
@ -31,7 +36,7 @@ pub struct CarTelemetryData {
/// Amount of brake applied. Value in range `(0.0..=1.0)`.
#[br(
assert(
(0.0..=1.0).contains(&brake),
(-0.1..=1.1).contains(&brake),
"Car telemetry entry has an invalid brake value: {}",
brake
),