mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-24 03:39:49 +02:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f63ba599ec | ||
|
|
f619ffd93e | ||
|
|
7d99456aaa | ||
|
|
be4a6c21b5 |
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Pavel Perestoronin
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -11,9 +11,11 @@ use crate::{Error, Result};
|
|||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct BattleResultsDat(
|
pub struct BattleResultsDat(
|
||||||
/// No idea what this is.
|
/// No idea what this is.
|
||||||
u64,
|
/// 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,
|
||||||
/// Protobuf-serialized battle results.
|
/// Protobuf-serialized battle results.
|
||||||
ByteBuf,
|
pub ByteBuf,
|
||||||
);
|
);
|
||||||
|
|
||||||
impl BattleResultsDat {
|
impl BattleResultsDat {
|
||||||
|
|||||||
+6
-1
@@ -19,10 +19,15 @@ impl<R: Read + Seek> Replay<R> {
|
|||||||
|
|
||||||
/// Reads and parses the battle results from the replay.
|
/// Reads and parses the battle results from the replay.
|
||||||
pub fn read_battle_results(&mut self) -> Result<BattleResults> {
|
pub fn read_battle_results(&mut self) -> Result<BattleResults> {
|
||||||
|
self.read_battle_results_dat()?.decode_battle_results()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Reads and parses the included `battle_results.dat`.
|
||||||
|
pub fn read_battle_results_dat(&mut self) -> Result<BattleResultsDat> {
|
||||||
let pickled_battle_results = self
|
let pickled_battle_results = self
|
||||||
.0
|
.0
|
||||||
.by_name("battle_results.dat")
|
.by_name("battle_results.dat")
|
||||||
.map_err(Error::OpenBattleResultsFailed)?;
|
.map_err(Error::OpenBattleResultsFailed)?;
|
||||||
BattleResultsDat::from_reader(pickled_battle_results)?.decode_battle_results()
|
BattleResultsDat::from_reader(pickled_battle_results)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user