1 unstable release

0.2.0 Dec 8, 2024

#924 in Encoding

Download history 159/week @ 2024-12-04 16/week @ 2024-12-11 1/week @ 2024-12-18 9/week @ 2024-12-25 64/week @ 2025-01-08

75 downloads per month

Custom license

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

hlviewer.js

talent

coldemoplayer

hldemojs


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