1 unstable release
0.2.0 | Dec 8, 2024 |
---|
#816 in Encoding
174 downloads per month
195KB
5.5K
SLoC
dem
A complete GoldSrc demo parser and writer library
Example
let mut demo = open_demo("./src/tests/demotest.dem").unwrap();
for entry in &mut demo.directory.entries {
for frame in &mut entry.frames {
if let FrameData::NetworkMessage(ref mut box_type) = &mut frame.frame_data {
let data = &mut box_type.as_mut().1;
if let MessageData::Parsed(messages) = &mut data.messages {
messages.push(NetMessage::EngineMessage(Box::new(EngineMessage::SvcBad)));
};
}
}
}
demo.write_to_file("./src/tests/demo2test.dem").unwrap();
Acknowledgement
lib.rs
:
GoldSrc demo parser and writer
Example
let mut demo = open_demo("./src/tests/demotest.dem").unwrap();
for entry in &mut demo.directory.entries {
for frame in &mut entry.frames {
if let FrameData::NetworkMessage(ref mut box_type) = &mut frame.frame_data {
let data = &mut box_type.as_mut().1;
if let MessageData::Parsed(messages) = &mut data.messages {
messages.push(NetMessage::EngineMessage(Box::new(EngineMessage::SvcBad)));
};
}
}
}
demo.write_to_file("./src/tests/demo2test.dem").unwrap();
Dependencies
~2MB
~44K SLoC