diff --git a/Heroes.ReplayParser/DataParser.cs b/Heroes.ReplayParser/DataParser.cs index e0d5689..cf6af40 100644 --- a/Heroes.ReplayParser/DataParser.cs +++ b/Heroes.ReplayParser/DataParser.cs @@ -166,7 +166,7 @@ private static void ParseReplayArchive(Replay replay, MpqArchive archive, ParseO player.Talents = talentGameEventsDictionary[player]; } // Replay Server Battlelobby - if (!parseOptions.IgnoreErrors && archive.Any(i => i.Filename == ReplayServerBattlelobby.FileName)) + if (archive.Any(i => i.Filename == ReplayServerBattlelobby.FileName)) { if (parseOptions.ShouldParseDetailedBattleLobby) ReplayServerBattlelobby.Parse(replay, GetMpqFile(archive, ReplayServerBattlelobby.FileName)); diff --git a/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs b/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs index d66bac9..205fea2 100644 --- a/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs +++ b/Heroes.ReplayParser/MPQFiles/ReplayInitData.cs @@ -93,18 +93,22 @@ public static void Parse(Replay replay, byte[] buffer) if (replay.ReplayBuild >= 43905 && reader.ReadBoolean()) switch (reader.ReadInt32()) { - case 50021: // Versus AI (Cooperative) - case 50041: // Practice - break; - case 50001: replay.GameMode = GameMode.QuickMatch; break; + case 50021: + replay.GameMode = GameMode.Cooperative; + break; + case 50031: replay.GameMode = GameMode.Brawl; break; + case 50041: + replay.GameMode = GameMode.TryMe; + break; + case 50051: replay.GameMode = GameMode.UnrankedDraft; break; diff --git a/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs b/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs index b36c07f..adddc31 100644 --- a/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs +++ b/Heroes.ReplayParser/MPQFiles/ReplayServerBattlelobby.cs @@ -181,7 +181,8 @@ private static void DetailedParse(BitReader bitReader, Replay replay, uint s2maC bitReader.ReadBytes(25); bitReader.Read(24); - // bitReader.ReadBytes(8); ai games have 8 more bytes somewhere around here + if (replay.GameMode == GameMode.Cooperative) + bitReader.ReadBytes(8); // ai games have 8 more bytes somewhere around here bitReader.Read(7); @@ -190,24 +191,19 @@ private static void DetailedParse(BitReader bitReader, Replay replay, uint s2maC // repeat of the collection section above if (replay.ReplayBuild >= 51609 || replay.ReplayBuild == 47903 || replay.ReplayBuild == 47479) { - uint size = bitReader.Read(12); - - int bytesSize = (int)(size / 8); - int bitsSize = (int)(size % 8); - - bitReader.ReadBytes(bytesSize); - bitReader.Read(bitsSize); - - bitReader.ReadBoolean(); + bitReader.ReadBitArray(bitReader.Read(12)); } - else + else if (replay.ReplayBuild > 47219) { - bitReader.Read(1); - uint size = bitReader.Read(15); - // each byte has a max value of 0x7F (127) - bitReader.ReadBytes((int)size * 2); + bitReader.ReadBytes((int)bitReader.Read(15) * 2); } + else + { + bitReader.ReadBitArray(bitReader.Read(9)); + } + + bitReader.ReadBoolean(); } bitReader.ReadBoolean(); // m_hasSilencePenalty