1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-04 02:24:12 +02:00

generated code for parsing game events

This commit is contained in:
Robin Appelman 2019-03-02 00:39:22 +01:00
commit cc7f9a48cd
18 changed files with 8518 additions and 64 deletions

View file

@ -47,16 +47,4 @@ impl Parse for MessagePacket {
};
Ok(packet)
}
fn skip(stream: &mut Stream) -> Result<()> {
let _ = stream.skip(32 * 2)?;
for i in 0..6 {
Vector::skip(stream)?;
}
let _ = stream.skip(32 * 2)?;
let length: usize = stream.read_int::<usize>(32)?;
stream.skip(length * 8).map_err(ParseError::from)
}
}

View file

@ -2,8 +2,9 @@ use std::fmt;
use bitstream_reader::{BitRead, LittleEndian};
use crate::demo::sendprop::SendPropFlag::Exclude;
use crate::{Parse, ParseError, ParserState, ReadResult, Result, Stream};
use crate::demo::message::stringtable::StringTableMeta;
use crate::demo::sendprop::SendPropFlag::Exclude;
#[derive(BitRead, Clone, Copy, Debug)]
pub struct FixedUserdataSize {
@ -23,6 +24,15 @@ pub struct StringTable {
pub compressed: bool,
}
impl StringTable {
pub fn get_table_meta(&self) -> StringTableMeta {
StringTableMeta {
fixed_userdata_size: self.fixed_userdata_size,
max_entries: self.max_entries,
}
}
}
impl BitRead<LittleEndian> for StringTable {
fn read(stream: &mut Stream) -> ReadResult<Self> {
let name = stream.read()?;