mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 02:24:12 +02:00
track spawns
This commit is contained in:
parent
f335dc2163
commit
6a47c91636
6 changed files with 176 additions and 58 deletions
|
|
@ -2,9 +2,9 @@ use std::fmt;
|
|||
|
||||
use bitstream_reader::{BitRead, LittleEndian};
|
||||
|
||||
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||
use crate::demo::message::stringtable::StringTableMeta;
|
||||
use crate::demo::sendprop::SendPropFlag::Exclude;
|
||||
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
|
||||
|
||||
#[derive(BitRead, Clone, Copy, Debug)]
|
||||
pub struct FixedUserdataSize {
|
||||
|
|
@ -57,14 +57,24 @@ impl BitRead<LittleEndian> for StringTable {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(BitRead, Clone)]
|
||||
#[derive(BitRead, Clone, Debug)]
|
||||
#[endianness = "LittleEndian"]
|
||||
pub struct ExtraData {
|
||||
pub len: u16,
|
||||
#[size = "len * 8"]
|
||||
pub byte_len: u16,
|
||||
#[size = "byte_len * 8"]
|
||||
pub data: Stream,
|
||||
}
|
||||
|
||||
impl ExtraData {
|
||||
pub fn new(data: Stream) -> Self {
|
||||
let byte_len = (data.bit_len() / 8) as u16;
|
||||
ExtraData {
|
||||
byte_len,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BitRead, Clone, Default)]
|
||||
#[endianness = "LittleEndian"]
|
||||
pub struct StringTableEntry {
|
||||
|
|
@ -78,8 +88,8 @@ impl fmt::Debug for StringTableEntry {
|
|||
None => write!(f, "StringTableEntry {{ text: \"{}\" }}", self.text),
|
||||
Some(extra_data) => write!(
|
||||
f,
|
||||
"StringTableEntry{{ text: \"{}\" extra_data: {} bits }}",
|
||||
self.text, extra_data.len
|
||||
"StringTableEntry{{ text: \"{}\" extra_data: {} bytes }}",
|
||||
self.text, extra_data.byte_len
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue