mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
a little syncing with uhexen2.
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@460 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
2806d26412
commit
9800cf9d15
5 changed files with 25 additions and 28 deletions
|
@ -470,7 +470,7 @@ float Q_atof (const char *str)
|
|||
============================================================================
|
||||
*/
|
||||
|
||||
qboolean bigendien;
|
||||
qboolean host_bigendian;
|
||||
|
||||
short (*BigShort) (short l);
|
||||
short (*LittleShort) (short l);
|
||||
|
@ -1229,22 +1229,13 @@ void COM_Init (void)
|
|||
N U X I
|
||||
*/
|
||||
if ( *(char *)&i == 0x12 )
|
||||
bigendien = true;
|
||||
host_bigendian = true;
|
||||
else if ( *(char *)&i == 0x78 )
|
||||
bigendien = false;
|
||||
host_bigendian = false;
|
||||
else /* if ( *(char *)&i == 0x34 ) */
|
||||
Sys_Error ("Unsupported endianism.");
|
||||
|
||||
if (bigendien == false)
|
||||
{
|
||||
BigShort = ShortSwap;
|
||||
LittleShort = ShortNoSwap;
|
||||
BigLong = LongSwap;
|
||||
LittleLong = LongNoSwap;
|
||||
BigFloat = FloatSwap;
|
||||
LittleFloat = FloatNoSwap;
|
||||
}
|
||||
else /* we are big endian: */
|
||||
if (host_bigendian)
|
||||
{
|
||||
BigShort = ShortNoSwap;
|
||||
LittleShort = ShortSwap;
|
||||
|
@ -1253,6 +1244,15 @@ void COM_Init (void)
|
|||
BigFloat = FloatNoSwap;
|
||||
LittleFloat = FloatSwap;
|
||||
}
|
||||
else /* assumed LITTLE_ENDIAN. */
|
||||
{
|
||||
BigShort = ShortSwap;
|
||||
LittleShort = ShortNoSwap;
|
||||
BigLong = LongSwap;
|
||||
LittleLong = LongNoSwap;
|
||||
BigFloat = FloatSwap;
|
||||
LittleFloat = FloatNoSwap;
|
||||
}
|
||||
|
||||
if (COM_CheckParm("-fitz"))
|
||||
fitzmode = true;
|
||||
|
|
|
@ -85,7 +85,7 @@ void InsertLinkAfter (link_t *l, link_t *after);
|
|||
|
||||
//============================================================================
|
||||
|
||||
extern qboolean bigendien;
|
||||
extern qboolean host_bigendian;
|
||||
|
||||
extern short (*BigShort) (short l);
|
||||
extern short (*LittleShort) (short l);
|
||||
|
|
|
@ -295,13 +295,13 @@ static int mp3_decode(snd_stream_t *stream, byte *buf, int len)
|
|||
sample = 0x7FFF;
|
||||
else
|
||||
sample >>= (MAD_F_FRACBITS + 1 - 16);
|
||||
if (bigendien)
|
||||
if (host_bigendian)
|
||||
{
|
||||
*buf++ = (sample >> 8) & 0xFF;
|
||||
*buf++ = sample & 0xFF;
|
||||
}
|
||||
else
|
||||
{ /* LITTLE_ENDIAN */
|
||||
else /* assumed LITTLE_ENDIAN. */
|
||||
{
|
||||
*buf++ = sample & 0xFF;
|
||||
*buf++ = (sample >> 8) & 0xFF;
|
||||
}
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/wait.h>
|
||||
// FIXME: <sys/soundcard.h> is "by the book" but we should take care of
|
||||
// <soundcard.h>, <linux/soundcard.h> and <machine/soundcard.h> someday.
|
||||
/* FIXME: <sys/soundcard.h> is by the book, but we might
|
||||
* have to take care of <soundcard.h>, <linux/soundcard.h>
|
||||
* and <machine/soundcard.h> someday. */
|
||||
#include <sys/soundcard.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -53,8 +54,8 @@ qboolean SNDDMA_Init (dma_t *dma)
|
|||
unsigned long sz;
|
||||
struct audio_buf_info info;
|
||||
|
||||
if (bigendien) FORMAT_S16 = AFMT_S16_BE;
|
||||
else FORMAT_S16 = AFMT_S16_LE;
|
||||
if (host_bigendian) FORMAT_S16 = AFMT_S16_BE;
|
||||
else FORMAT_S16 = AFMT_S16_LE;
|
||||
|
||||
tmp = COM_CheckParm("-ossdev");
|
||||
if (tmp != 0 && tmp < com_argc - 1)
|
||||
|
|
|
@ -35,8 +35,6 @@
|
|||
#define OGG_SAMPLEWIDTH 2
|
||||
#define OGG_SIGNED_DATA 1
|
||||
|
||||
static int ogg_bigendian = 0;
|
||||
|
||||
/* CALLBACK FUNCTIONS: */
|
||||
|
||||
static int ovc_fclose (void *f)
|
||||
|
@ -60,8 +58,6 @@ static const ov_callbacks ovc_qfs =
|
|||
|
||||
static qboolean S_OGG_CodecInitialize (void)
|
||||
{
|
||||
ogg_bigendian = (bigendien == true) ? 1 : 0;
|
||||
ogg_codec.initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -120,7 +116,7 @@ static snd_stream_t *S_OGG_CodecOpenStream (const char *filename)
|
|||
|
||||
static int S_OGG_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
||||
{
|
||||
int section; /* FIXME: handle section changes! */
|
||||
int section; /* FIXME: handle section changes */
|
||||
int cnt, res, rem;
|
||||
char * ptr;
|
||||
|
||||
|
@ -128,7 +124,7 @@ static int S_OGG_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
|
|||
ptr = (char *) buffer;
|
||||
while (1)
|
||||
{
|
||||
res = ov_read((OggVorbis_File *) stream->priv, ptr, rem, ogg_bigendian,
|
||||
res = ov_read((OggVorbis_File *) stream->priv, ptr, rem, host_bigendian,
|
||||
OGG_SAMPLEWIDTH, OGG_SIGNED_DATA, §ion);
|
||||
if (res <= 0)
|
||||
break;
|
||||
|
@ -156,7 +152,7 @@ static int S_OGG_CodecRewindStream (snd_stream_t *stream)
|
|||
snd_codec_t ogg_codec =
|
||||
{
|
||||
CODECTYPE_OGG,
|
||||
false,
|
||||
true, /* always available. */
|
||||
"ogg",
|
||||
S_OGG_CodecInitialize,
|
||||
S_OGG_CodecShutdown,
|
||||
|
|
Loading…
Reference in a new issue