1
0
Fork 0
mirror of https://github.com/k4zmu2a/SpaceCadetPinball.git synced 2024-12-18 10:37:53 +01:00

partman: improved bad zMap skip.

This commit is contained in:
Muzychenko Andrey 2021-11-23 15:23:11 +03:00
parent 37198f1b99
commit 95007c9253

View file

@ -92,16 +92,18 @@ DatFile* partman::load_records(LPCSTR lpFileName, bool fullTiltMode)
fread(&zMapHeader, 1, sizeof(dat16BitBmpHeader), fileHandle);
auto length = fieldSize - sizeof(dat16BitBmpHeader);
auto zMap = new zmap_header_type(zMapHeader.Width, zMapHeader.Height, zMapHeader.Stride);
zMap->Resolution = zMapResolution;
zmap_header_type* zMap;
if (zMapHeader.Stride * zMapHeader.Height * 2u == length)
{
zMap = new zmap_header_type(zMapHeader.Width, zMapHeader.Height, zMapHeader.Stride);
zMap->Resolution = zMapResolution;
fread(zMap->ZPtr1, 1, length, fileHandle);
}
else
{
// 3DPB .dat has zeroed zMap headers, in groups 497 and 498, skip them.
fseek(fileHandle, static_cast<int>(length), SEEK_CUR);
zMap = new zmap_header_type(0, 0, 0);
}
entryData->Buffer = reinterpret_cast<char*>(zMap);
}