mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-28 14:01:23 +00:00
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
from DMX sounds. SVN r1792 (trunk)
This commit is contained in:
parent
45dde7aa2f
commit
6214177f1f
6 changed files with 48 additions and 30 deletions
|
@ -1,6 +1,13 @@
|
||||||
September 5, 2009 (Changes by Graf Zahl)
|
September 5, 2009 (Changes by Graf Zahl)
|
||||||
- made menu dimming a mapping option but kept the CVARS as user override.
|
- made menu dimming a mapping option but kept the CVARS as user override.
|
||||||
|
|
||||||
|
September 4, 2009
|
||||||
|
- Fixed: S_LoadSound() did not byte-swap the frequency and length it reads
|
||||||
|
from DMX sounds.
|
||||||
|
- Fixed: PNGTexture must not use the FArchive >> operator as a short hand
|
||||||
|
for reading 4-byte integers, because that operator works with little
|
||||||
|
endian numbers--a no-op on Intel processors, but bad joojoo on PowerPCs.
|
||||||
|
|
||||||
September 3, 2009 (Changes by Graf Zahl)
|
September 3, 2009 (Changes by Graf Zahl)
|
||||||
- fixed: Weapons must first check if they can be switched and afterwards
|
- fixed: Weapons must first check if they can be switched and afterwards
|
||||||
if they can be fired. These checks were reversed.
|
if they can be fired. These checks were reversed.
|
||||||
|
|
|
@ -181,7 +181,7 @@ bool M_CreatePNG (FILE *file, const BYTE *buffer, const PalEntry *palette,
|
||||||
//
|
//
|
||||||
// M_CreateDummyPNG
|
// M_CreateDummyPNG
|
||||||
//
|
//
|
||||||
// Like M_CreatePNG, but the image is always a grayscale 1x1 blacksquare.
|
// Like M_CreatePNG, but the image is always a grayscale 1x1 black square.
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
|
|
@ -1255,7 +1255,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
|
||||||
FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum);
|
FWadLump wlump = Wads.OpenLumpNum(sfx->lumpnum);
|
||||||
sfxstart = sfxdata = new BYTE[size];
|
sfxstart = sfxdata = new BYTE[size];
|
||||||
wlump.Read(sfxdata, size);
|
wlump.Read(sfxdata, size);
|
||||||
SDWORD len = ((SDWORD *)sfxdata)[1];
|
SDWORD len = LittleLong(((SDWORD *)sfxdata)[1]);
|
||||||
|
|
||||||
// If the sound is raw, just load it as such.
|
// If the sound is raw, just load it as such.
|
||||||
// Otherwise, try the sound as DMX format.
|
// Otherwise, try the sound as DMX format.
|
||||||
|
@ -1272,7 +1272,7 @@ sfxinfo_t *S_LoadSound(sfxinfo_t *sfx)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
frequency = ((WORD *)sfxdata)[1];
|
frequency = LittleShort(((WORD *)sfxdata)[1]);
|
||||||
if (frequency == 0)
|
if (frequency == 0)
|
||||||
{
|
{
|
||||||
frequency = 11025;
|
frequency = 11025;
|
||||||
|
|
|
@ -131,7 +131,7 @@ void iCopyColors(BYTE *pout, const BYTE *pin, int count, int step, FCopyInfo *in
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLEND_GREENMAP:
|
case BLEND_GREENMAP:
|
||||||
// Skulltags's Guardsphere map
|
// Skulltag's Guardsphere map
|
||||||
for(i=0;i<count;i++)
|
for(i=0;i<count;i++)
|
||||||
{
|
{
|
||||||
a = TSrc::A(pin);
|
a = TSrc::A(pin);
|
||||||
|
|
|
@ -81,7 +81,7 @@ static bool CheckIfPatch(FileReader & file)
|
||||||
file.Seek(0, SEEK_SET);
|
file.Seek(0, SEEK_SET);
|
||||||
file.Read(data, file.GetLength());
|
file.Read(data, file.GetLength());
|
||||||
|
|
||||||
const patch_t * foo = (const patch_t *)data;
|
const patch_t *foo = (const patch_t *)data;
|
||||||
|
|
||||||
int height = LittleShort(foo->height);
|
int height = LittleShort(foo->height);
|
||||||
int width = LittleShort(foo->width);
|
int width = LittleShort(foo->width);
|
||||||
|
|
|
@ -115,8 +115,9 @@ FTexture *PNGTexture_TryCreate(FileReader & data, int lumpnum)
|
||||||
|
|
||||||
// The PNG looks valid so far. Check the IHDR to make sure it's a
|
// The PNG looks valid so far. Check the IHDR to make sure it's a
|
||||||
// type of PNG we support.
|
// type of PNG we support.
|
||||||
data >> width >> height
|
data.Read(&width, 4);
|
||||||
>> bitdepth >> colortype >> compression >> filter >> interlace;
|
data.Read(&height, 4);
|
||||||
|
data >> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||||
|
|
||||||
if (compression != 0 || filter != 0 || interlace > 1)
|
if (compression != 0 || filter != 0 || interlace > 1)
|
||||||
{
|
{
|
||||||
|
@ -164,8 +165,9 @@ FTexture *PNGTexture_CreateFromFile(PNGHandle *png, const FString &filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the IHDR to make sure it's a type of PNG we support.
|
// Check the IHDR to make sure it's a type of PNG we support.
|
||||||
(*png->File) >> width >> height
|
png->File->Read(&width, 4);
|
||||||
>> bitdepth >> colortype >> compression >> filter >> interlace;
|
png->File->Read(&height, 4);
|
||||||
|
(*png->File) >> bitdepth >> colortype >> compression >> filter >> interlace;
|
||||||
|
|
||||||
if (compression != 0 || filter != 0 || interlace > 1)
|
if (compression != 0 || filter != 0 || interlace > 1)
|
||||||
{
|
{
|
||||||
|
@ -215,12 +217,13 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
||||||
Height = height;
|
Height = height;
|
||||||
CalcBitSize ();
|
CalcBitSize ();
|
||||||
|
|
||||||
memset (trans, 255, 256);
|
memset(trans, 255, 256);
|
||||||
|
|
||||||
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
|
// Parse pre-IDAT chunks. I skip the CRCs. Is that bad?
|
||||||
lump.Seek (33, SEEK_SET);
|
lump.Seek(33, SEEK_SET);
|
||||||
|
|
||||||
lump >> len >> id;
|
lump.Read(&len, 4);
|
||||||
|
lump.Read(&id, 4);
|
||||||
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
||||||
{
|
{
|
||||||
len = BigLong((unsigned int)len);
|
len = BigLong((unsigned int)len);
|
||||||
|
@ -236,7 +239,8 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
||||||
DWORD hotx, hoty;
|
DWORD hotx, hoty;
|
||||||
int ihotx, ihoty;
|
int ihotx, ihoty;
|
||||||
|
|
||||||
lump >> hotx >> hoty;
|
lump.Read(&hotx, 4);
|
||||||
|
lump.Read(&hoty, 4);
|
||||||
ihotx = BigLong((int)hotx);
|
ihotx = BigLong((int)hotx);
|
||||||
ihoty = BigLong((int)hoty);
|
ihoty = BigLong((int)hoty);
|
||||||
if (ihotx < -32768 || ihotx > 32767)
|
if (ihotx < -32768 || ihotx > 32767)
|
||||||
|
@ -249,8 +253,8 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
||||||
Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", Wads.GetLumpFullName (lumpnum), ihoty, ihoty);
|
Printf ("Y-Offset for PNG texture %s is bad: %d (0x%08x)\n", Wads.GetLumpFullName (lumpnum), ihoty, ihoty);
|
||||||
ihoty = 0;
|
ihoty = 0;
|
||||||
}
|
}
|
||||||
LeftOffset = (int)ihotx;
|
LeftOffset = ihotx;
|
||||||
TopOffset = (int)ihoty;
|
TopOffset = ihoty;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -277,9 +281,10 @@ FPNGTexture::FPNGTexture (FileReader &lump, int lumpnum, const FString &filename
|
||||||
bMasked = true;
|
bMasked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lump >> len >> len; // Skip CRC
|
lump.Seek(4, SEEK_CUR); // Skip CRC
|
||||||
|
lump.Read(&len, 4);
|
||||||
id = MAKE_ID('I','E','N','D');
|
id = MAKE_ID('I','E','N','D');
|
||||||
lump >> id;
|
lump.Read(&id, 4);
|
||||||
}
|
}
|
||||||
StartOfIDAT = lump.Tell() - 8;
|
StartOfIDAT = lump.Tell() - 8;
|
||||||
|
|
||||||
|
@ -460,7 +465,8 @@ void FPNGTexture::MakeTexture ()
|
||||||
{
|
{
|
||||||
DWORD len, id;
|
DWORD len, id;
|
||||||
lump->Seek (StartOfIDAT, SEEK_SET);
|
lump->Seek (StartOfIDAT, SEEK_SET);
|
||||||
(*lump) >> len >> id;
|
lump->Read(&len, 4);
|
||||||
|
lump->Read(&id, 4);
|
||||||
|
|
||||||
if (ColorType == 0 || ColorType == 3) /* Grayscale and paletted */
|
if (ColorType == 0 || ColorType == 3) /* Grayscale and paletted */
|
||||||
{
|
{
|
||||||
|
@ -583,9 +589,9 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
||||||
PalEntry pe[256];
|
PalEntry pe[256];
|
||||||
DWORD len, id;
|
DWORD len, id;
|
||||||
FileReader *lump;
|
FileReader *lump;
|
||||||
static char bpp[]={1, 0, 3, 1, 2, 0, 4};
|
static char bpp[] = {1, 0, 3, 1, 2, 0, 4};
|
||||||
int pixwidth = Width * bpp[ColorType];
|
int pixwidth = Width * bpp[ColorType];
|
||||||
int transpal=false;
|
int transpal = false;
|
||||||
|
|
||||||
if (w < 0 || w > Width) w = Width;
|
if (w < 0 || w > Width) w = Width;
|
||||||
if (h < 0 || h > Height) h = Height;
|
if (h < 0 || h > Height) h = Height;
|
||||||
|
@ -599,10 +605,12 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
||||||
lump = new FileReader(SourceFile.GetChars());
|
lump = new FileReader(SourceFile.GetChars());
|
||||||
}
|
}
|
||||||
|
|
||||||
lump->Seek (33, SEEK_SET);
|
lump->Seek(33, SEEK_SET);
|
||||||
for(int i=0;i<256;i++) pe[i]=PalEntry(255,i,i,i); // default to a gray map
|
for(int i = 0; i < 256; i++) // default to a gray map
|
||||||
|
pe[i] = PalEntry(255,i,i,i);
|
||||||
|
|
||||||
(*lump) >> len >> id;
|
lump->Read(&len, 4);
|
||||||
|
lump->Read(&id, 4);
|
||||||
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
while (id != MAKE_ID('I','D','A','T') && id != MAKE_ID('I','E','N','D'))
|
||||||
{
|
{
|
||||||
len = BigLong((unsigned int)len);
|
len = BigLong((unsigned int)len);
|
||||||
|
@ -613,29 +621,32 @@ int FPNGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAKE_ID('P','L','T','E'):
|
case MAKE_ID('P','L','T','E'):
|
||||||
for(int i=0;i<PaletteSize;i++)
|
for(int i = 0; i < PaletteSize; i++)
|
||||||
{
|
{
|
||||||
(*lump) >> pe[i].r >> pe[i].g >> pe[i].b;
|
(*lump) >> pe[i].r >> pe[i].g >> pe[i].b;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MAKE_ID('t','R','N','S'):
|
case MAKE_ID('t','R','N','S'):
|
||||||
for(DWORD i=0;i<len;i++)
|
for(DWORD i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
(*lump) >> pe[i].a;
|
(*lump) >> pe[i].a;
|
||||||
if (pe[i].a!=0 && pe[i].a!=255) transpal = true;
|
if (pe[i].a != 0 && pe[i].a != 255)
|
||||||
|
transpal = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(*lump) >> len >> len; // Skip CRC
|
lump->Seek(4, SEEK_CUR); // Skip CRC
|
||||||
|
lump->Read(&len, 4);
|
||||||
id = MAKE_ID('I','E','N','D');
|
id = MAKE_ID('I','E','N','D');
|
||||||
(*lump) >> id;
|
lump->Read(&id, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
BYTE * Pixels = new BYTE[pixwidth * Height];
|
BYTE * Pixels = new BYTE[pixwidth * Height];
|
||||||
|
|
||||||
lump->Seek (StartOfIDAT, SEEK_SET);
|
lump->Seek (StartOfIDAT, SEEK_SET);
|
||||||
(*lump) >> len >> id;
|
lump->Read(&len, 4);
|
||||||
|
lump->Read(&len, 4);
|
||||||
M_ReadIDAT (lump, Pixels, Width, Height, pixwidth, BitDepth, ColorType, Interlace, BigLong((unsigned int)len));
|
M_ReadIDAT (lump, Pixels, Width, Height, pixwidth, BitDepth, ColorType, Interlace, BigLong((unsigned int)len));
|
||||||
delete lump;
|
delete lump;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue