Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stringtable wasm bug #78

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/parser/src/parser_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use EDemoCommands::*;
impl ParserThread {
pub fn start(&mut self) -> Result<(), DemoParserError> {
let started_at = self.ptr;

loop {
let cmd = self.read_varint()?;
let tick = self.read_varint()?;
Expand Down Expand Up @@ -50,10 +51,12 @@ impl ParserThread {
DEM_Packet => self.parse_packet(&bytes),
DEM_FullPacket => {
match self.parse_all_packets {
true => {}
true => {
self.parse_full_packet(&bytes, false)?;
}
false => {
if self.fullpackets_parsed == 0 && started_at != 16 {
self.parse_full_packet(&bytes)?;
self.parse_full_packet(&bytes, true)?;
self.fullpackets_parsed += 1;
} else {
break;
Expand Down Expand Up @@ -138,7 +141,9 @@ impl ParserThread {
self.net_tick = message.tick();
Ok(())
}
pub fn parse_full_packet(&mut self, bytes: &[u8]) -> Result<(), DemoParserError> {
pub fn parse_full_packet(&mut self, bytes: &[u8], should_parse_entities: bool) -> Result<(), DemoParserError> {
self.string_tables = vec![];

let full_packet: CDemoFullPacket = match Message::parse_from_bytes(bytes) {
Err(_e) => return Err(DemoParserError::MalformedMessage),
Ok(p) => p,
Expand Down Expand Up @@ -169,7 +174,12 @@ impl ParserThread {
let msg_bytes = bitreader.read_n_bytes(size as usize)?;

let ok = match netmessage_type_from_int(msg_type as i32) {
svc_PacketEntities => self.parse_packet_ents(&msg_bytes),
svc_PacketEntities => {
if should_parse_entities {
self.parse_packet_ents(&msg_bytes)?;
}
Ok(())
}
svc_CreateStringTable => self.parse_create_stringtable(&msg_bytes),
svc_UpdateStringTable => self.update_string_table(&msg_bytes),
CS_UM_SendPlayerItemDrops => self.parse_item_drops(&msg_bytes),
Expand Down
Loading