diff options
author | Daniel Schadt <kingdread@gmx.de> | 2020-12-11 22:02:53 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2020-12-11 22:02:53 +0100 |
commit | 7bf28dc7b3df4d8663c97bedadbfb09f48e9db39 (patch) | |
tree | b2511862af5d5b758ff69f230a3fad45858de72b /src/raw/parser.rs | |
parent | 172c17db58f6a57d0867778e98a7d69430e0d3d0 (diff) | |
download | evtclib-7bf28dc7b3df4d8663c97bedadbfb09f48e9db39.tar.gz evtclib-7bf28dc7b3df4d8663c97bedadbfb09f48e9db39.tar.bz2 evtclib-7bf28dc7b3df4d8663c97bedadbfb09f48e9db39.zip |
add StackActive and StackReset events
As it turns out, the padding bytes are not just padding, but for some
events they contain useful information. Therefore, we've adjusted the
parser to save those bytes (if available).
Diffstat (limited to 'src/raw/parser.rs')
-rw-r--r-- | src/raw/parser.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/raw/parser.rs b/src/raw/parser.rs index cac803e..4622473 100644 --- a/src/raw/parser.rs +++ b/src/raw/parser.rs @@ -388,6 +388,7 @@ pub fn parse_event_rev0<R: Read>(mut input: R) -> ParseResult<CbtEvent> { is_flanking, is_shields, is_offcycle: false, + padding_end: 0, }) } @@ -424,8 +425,9 @@ pub fn parse_event_rev1<R: Read>(mut input: R) -> ParseResult<CbtEvent> { let is_shields = input.read_u8()? != 0; let is_offcycle = input.read_u8()? != 0; - // Four more bytes of internal tracking garbage. - input.read_u32::<LE>()?; + // Should only be padding in most cases, but could also be useful for some events (like + // STACKRESET). + let padding_end = input.read_u32::<LE>()?; Ok(CbtEvent { time, @@ -451,6 +453,7 @@ pub fn parse_event_rev1<R: Read>(mut input: R) -> ParseResult<CbtEvent> { is_flanking, is_shields, is_offcycle, + padding_end, }) } |