mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 10:27:01 +02:00
Break: support arena_unique_id
This commit is contained in:
1 parent
e0ce6a22b1
commit
903cd00f32
2 files changed
+20
-10
No files matched your search
@@ -10,14 +10,22 @@ use crate::result::Result;
|
||||
|
||||
/// Represents un-pickled `battle_results.dat`.
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct BattleResultsDat(
|
||||
/// No idea what this is.
|
||||
/// My best guess – some kind of checksum,
|
||||
/// but none of MD5, SHA1, SHA224, SHA256, SHA384, SHA512, nor CRC64 over the buffer have matched.
|
||||
pub u64,
|
||||
#[serde(from = "(u64, ByteBuf)")]
|
||||
pub struct BattleResultsDat {
|
||||
pub arena_unique_id: u64,
|
||||
|
||||
/// Protobuf-serialized battle results.
|
||||
pub ByteBuf,
|
||||
);
|
||||
pub buffer: ByteBuf,
|
||||
}
|
||||
|
||||
impl From<(u64, ByteBuf)> for BattleResultsDat {
|
||||
fn from((arena_unique_id, buffer): (u64, ByteBuf)) -> Self {
|
||||
Self {
|
||||
arena_unique_id,
|
||||
buffer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl BattleResultsDat {
|
||||
/// Parses the pickled structure from the reader which contains `battle_results.dat`.
|
||||
@@ -30,7 +38,7 @@ impl BattleResultsDat {
|
||||
|
||||
/// Decodes the battle results from the internal buffer.
|
||||
pub fn decode_battle_results(&self) -> Result<BattleResults> {
|
||||
BattleResults::decode(self.1.as_ref()).map_err(Error::DecodeFailed)
|
||||
BattleResults::decode(self.buffer.as_ref()).map_err(Error::DecodeFailed)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user