Skip to content

Commit

Permalink
Add catch for compressed H2 MCC maps
Browse files Browse the repository at this point in the history
instead of waiting for it to fail at the tags header and muddying things, the compressed flag is now checked to simply tell the user that the map is compressed. #366
  • Loading branch information
Lord-Zedd committed Jul 1, 2024
1 parent b2b9192 commit 73d2575
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Blamite/Blam/SecondGen/Structures/SecondGenHeader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Blamite.Serialization;
using Blamite.IO;
using System;

namespace Blamite.Blam.SecondGen.Structures
{
Expand Down Expand Up @@ -98,6 +99,13 @@ public StructureValueCollection Serialize()

private void Load(StructureValueCollection values, FileSegmenter segmenter)
{
if (values.HasInteger("flags"))
{
int flags = (int)values.GetInteger("flags");
if ((flags & 1) > 0)
throw new ArgumentException("Map claims to be compressed. Please decompress it using the Tools menu before trying to load it again.");
}

uint filesize = (uint)values.GetInteger("file size");

uint metaOffset = (uint)values.GetInteger("meta offset");
Expand Down

0 comments on commit 73d2575

Please sign in to comment.