From 3fcdb6dc1835c87655ae45a1d362dc8b09f6849c Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 5 Jan 2006 02:48:03 +0000 Subject: Fixes for big endian machines (thanks locust) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 255 --- src/m_swap.c | 9 ++++++--- src/m_swap.h | 11 +++++------ src/mmus2mid.c | 15 +++++++++------ 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') 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 -- cgit v1.2.3