SGD decoding and encoding fully implemented and tested

This commit is contained in:
mykola2312 2023-08-30 21:58:38 +03:00
parent 3765844efb
commit 2868f90a77
2 changed files with 4 additions and 2 deletions

View file

@ -38,7 +38,7 @@ impl Decoder for SGD {
lines.push(rd.read::<FString>(0)?); lines.push(rd.read::<FString>(0)?);
} }
dialogs.insert(names.remove(m), lines); dialogs.insert(names.remove(0), lines);
} }
let enc_size = rd.offset() - offset; let enc_size = rd.offset() - offset;

View file

@ -27,7 +27,9 @@ impl World {
let sgd_start: usize = 0x4E; let sgd_start: usize = 0x4E;
let sgd = SGD::decode(&self.data, sgd_start, 0)?; let sgd = SGD::decode(&self.data, sgd_start, 0)?;
dbg!(&sgd); dbg!(&sgd);
let sgd2 = sgd.encode()?;
assert_ne!(self.data.mem[sgd_start..sgd.get_enc_size()], sgd2.mem, "SGD encoding failed");
Ok(()) Ok(())
} }
} }