summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2006-01-05 02:48:03 +0000
committerSimon Howard2006-01-05 02:48:03 +0000
commit3fcdb6dc1835c87655ae45a1d362dc8b09f6849c (patch)
tree3eeb27342ce69b2f55b6c6b1b7a0a19b17ec80fb
parenta78ddf0ecadb3580f5f09b09a931abc5734b7f33 (diff)
downloadchocolate-doom-3fcdb6dc1835c87655ae45a1d362dc8b09f6849c.tar.gz
chocolate-doom-3fcdb6dc1835c87655ae45a1d362dc8b09f6849c.tar.bz2
chocolate-doom-3fcdb6dc1835c87655ae45a1d362dc8b09f6849c.zip
Fixes for big endian machines (thanks locust)
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 255
-rw-r--r--NEWS2
-rw-r--r--configure.in2
-rw-r--r--src/m_swap.c9
-rw-r--r--src/m_swap.h11
-rw-r--r--src/mmus2mid.c15
5 files changed, 24 insertions, 15 deletions
diff --git a/NEWS b/NEWS
index 3631bd06..511e1366 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/configure.in b/configure.in
index 222013b1..bced9955 100644
--- a/configure.in
+++ b/configure.in
@@ -45,6 +45,8 @@ AC_SUBST(SDLNET_LIBS)
AC_SUBST(ac_aux_dir)
+AC_C_BIGENDIAN
+
AC_OUTPUT([
Makefile
textscreen/Makefile
diff --git a/src/m_swap.c b/src/m_swap.c
index 599908f9..0a3cab6d 100644
--- a/src/m_swap.c
+++ b/src/m_swap.c
@@ -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)
diff --git a/src/m_swap.h b/src/m_swap.h
index 881574ea..9774e723 100644
--- a/src/m_swap.h
+++ b/src/m_swap.h
@@ -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.
diff --git a/src/mmus2mid.c b/src/mmus2mid.c
index 59dadcad..5e6cb5e8 100644
--- a/src/mmus2mid.c
+++ b/src/mmus2mid.c
@@ -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