Fixes for big endian machines (thanks locust)

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 255
This commit is contained in:
Simon Howard 2006-01-05 02:48:03 +00:00
parent a78ddf0eca
commit 3fcdb6dc18
5 changed files with 24 additions and 15 deletions

2
NEWS
View file

@ -1,4 +1,6 @@
Fixes for big endian machines (thanks locust)
0.1.2 (2005-10-29):
Silence sounds at odd sample rates (rather than bombing out); this

View file

@ -45,6 +45,8 @@ AC_SUBST(SDLNET_LIBS)
AC_SUBST(ac_aux_dir)
AC_C_BIGENDIAN
AC_OUTPUT([
Makefile
textscreen/Makefile

View file

@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_swap.c 18 2005-07-23 18:56:07Z fraggle $
// $Id: m_swap.c 255 2006-01-05 02:48:03Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
// Revision 1.4 2006/01/05 02:48:03 fraggle
// Fixes for big endian machines (thanks locust)
//
// Revision 1.3 2005/07/23 18:56:07 fraggle
// Remove unneccessary pragmas
//
@ -38,14 +41,14 @@
//-----------------------------------------------------------------------------
static const char
rcsid[] = "$Id: m_swap.c 18 2005-07-23 18:56:07Z fraggle $";
rcsid[] = "$Id: m_swap.c 255 2006-01-05 02:48:03Z fraggle $";
#include "m_swap.h"
// Not needed with big endian.
#ifndef __BIG_ENDIAN__
#ifndef WORDS_BIGENDIAN
// Swap 16bit, that is, MSB and LSB byte.
unsigned short SwapSHORT(unsigned short x)

View file

@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: m_swap.h 75 2005-09-05 22:50:56Z fraggle $
// $Id: m_swap.h 255 2006-01-05 02:48:03Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@ -35,7 +35,7 @@
// Endianess handling.
// WAD files are stored little endian.
#ifdef __BIG_ENDIAN__
#ifdef WORDS_BIGENDIAN
short SwapSHORT(short);
long SwapLONG(long);
#define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
@ -43,10 +43,6 @@ long SwapLONG(long);
#else
#define SHORT(x) (x)
#define LONG(x) (x)
#define doom_wtohs(x) ((short int) (x))
#define doom_htows(x) ((short int) (x))
#define doom_wtohl(x) ((long int) (x))
#define doom_htowl(x) ((long int) (x))
#endif
@ -56,6 +52,9 @@ long SwapLONG(long);
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.5 2006/01/05 02:48:03 fraggle
// Fixes for big endian machines (thanks locust)
//
// Revision 1.4 2005/09/05 22:50:56 fraggle
// Add mmus2mid code from prboom. Use 'void *' for music handles. Pass
// length of data when registering music.

View file

@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: mmus2mid.c 76 2005-09-06 21:06:45Z fraggle $
// $Id: mmus2mid.c 255 2006-01-05 02:48:03Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright (C) 1999 by
@ -27,6 +27,9 @@
// 02111-1307, USA.
//
// $Log$
// Revision 1.3 2006/01/05 02:48:03 fraggle
// Fixes for big endian machines (thanks locust)
//
// Revision 1.2 2005/09/06 21:06:45 fraggle
// Newer versions of mmus2mid.c,h from prboom
//
@ -340,11 +343,11 @@ int mmus2mid(const UBYTE *mus, MIDI *mididata, UWORD division, int nocomp)
// copy the MUS header from the MUS buffer to the MUSh header structure
memcpy(&MUSh,mus,sizeof(MUSheader));
MUSh.ScoreLength = doom_wtohs(MUSh.ScoreLength);
MUSh.ScoreStart = doom_wtohs(MUSh.ScoreStart);
MUSh.channels = doom_wtohs(MUSh.channels);
MUSh.SecChannels = doom_wtohs(MUSh.SecChannels);
MUSh.InstrCnt = doom_wtohs(MUSh.InstrCnt);
MUSh.ScoreLength = SHORT(MUSh.ScoreLength);
MUSh.ScoreStart = SHORT(MUSh.ScoreStart);
MUSh.channels = SHORT(MUSh.channels);
MUSh.SecChannels = SHORT(MUSh.SecChannels);
MUSh.InstrCnt = SHORT(MUSh.InstrCnt);
// check some things and set length of MUS buffer from internal data