// we're fucking sick of this

Why hasn't SRB2 already done this themselves YEARS ago...
This commit is contained in:
TehRealSalt 2018-09-09 18:24:09 -04:00
parent 03e1ed179e
commit 76033a51d7
1 changed files with 18 additions and 0 deletions

View File

@ -769,6 +769,24 @@ static size_t W_RawReadLumpHeader(UINT16 wad, UINT16 lump, void *dest, size_t si
fseek(handle, (long)(l->position + offset), SEEK_SET);
bytesread = fread(dest, 1, size, handle);
#if 1 // we're fucking sick of this
if (bytesread < 67) // http://garethrees.org/2007/11/14/pngcrush/
return bytesread;
#define sigcheck ((UINT8 *)dest)
if (sigcheck[0] == 0x89
&& sigcheck[1] == 0x50
&& sigcheck[2] == 0x4e
&& sigcheck[3] == 0x47
&& sigcheck[4] == 0x0d
&& sigcheck[5] == 0x0a
&& sigcheck[6] == 0x1a
&& sigcheck[7] == 0x0a)
I_Error("W_Wad: Tried to cache a .PNG - have you tried converting to Doom or Flat (raw) image formats?");
#undef sigcheck
#endif
return bytesread;
}