Fixes loading maps for some extractors using v2.0 header. Map file is the same just different header versionMagic.

This commit is contained in:
hondacrx
2020-12-17 16:54:08 -05:00
parent 634a0cd65c
commit d6cfdce061
3 changed files with 3 additions and 2 deletions
+1
View File
@@ -65,6 +65,7 @@ namespace Framework.Constants
public const uint MapMagic = 0x5350414D; //"MAPS";
public const uint MapVersionMagic = 0x392E3176; //"v1.9";
public const uint MapVersionMagic2 = 0x302E3276; //"v2.0"; // Hack for some different extractors using v2.0 header
public const uint MapAreaMagic = 0x41455241; //"AREA";
public const uint MapHeightMagic = 0x5447484D; //"MHGT";
public const uint MapLiquidMagic = 0x51494C4D; //"MLIQ";
+1 -1
View File
@@ -46,7 +46,7 @@ namespace Game.Maps
using (BinaryReader reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read)))
{
MapFileHeader header = reader.Read<MapFileHeader>();
if (header.mapMagic != MapConst.MapMagic || header.versionMagic != MapConst.MapVersionMagic)
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
{
Log.outError(LogFilter.Maps, $"Map file '{filename}' is from an incompatible map version. Please recreate using the mapextractor.");
return LoadResult.ReadFromFileFailed;
+1 -1
View File
@@ -141,7 +141,7 @@ namespace Game.Maps
using (var reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
{
var header = reader.Read<MapFileHeader>();
if (header.mapMagic != MapConst.MapMagic || header.versionMagic != MapConst.MapVersionMagic)
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
{
Log.outError(LogFilter.Maps, "Map file '{0}' is from an incompatible map version ({1}), {2} is expected. Please recreate using the mapextractor.",
fileName, header.versionMagic, MapConst.MapVersionMagic);