Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ec-/Quake3e into urt
Browse files Browse the repository at this point in the history
  • Loading branch information
travmon committed Oct 7, 2019
2 parents 2711c81 + ea783bc commit a8b8941
Show file tree
Hide file tree
Showing 44 changed files with 2,346 additions and 1,503 deletions.
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ ifdef MINGW
endif

BASE_CFLAGS += -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON
-DUSE_ICON -DMINGW=1

# OPTIMIZE = -O3 -march=i586 -fomit-frame-pointer -ffast-math -falign-loops=2 \
# -funroll-loops -falign-jumps=2 -falign-functions=2 -fstrength-reduce
Expand Down Expand Up @@ -438,7 +438,7 @@ ifeq ($(PLATFORM),openbsd)

BASE_CFLAGS += -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-I/usr/X11R6/include -I/usr/local/include \
-I/usr/local/include/SDL -fvisibility=hidden
-fvisibility=hidden

DEBUG_CFLAGS=$(BASE_CFLAGS) -g

Expand All @@ -460,9 +460,16 @@ ifeq ($(PLATFORM),openbsd)

THREAD_LDFLAGS=-lpthread
# don't need -ldl (FreeBSD)
LDFLAGS=-lm -lSDL -lGL -lX11 -L/usr/local/lib -L/usr/X11R6/lib -lX11 -lXext
LDFLAGS=-lm

ifeq ($(USE_SDL),1)
BASE_CFLAGS += -I/usr/local/include/SDL2
CLIENT_LDFLAGS = -L/usr/X11R6/lib -L/usr/local/lib -lSDL2
else
CLIENT_LDFLAGS = -L/usr/X11R6/lib -L/usr/lib -lX11
endif

CLIENT_LDFLAGS =-lm -lSDL -lGL -lX11 -L/usr/local/lib -L/usr/X11R6/lib -lX11 -lXext
CLIENT_LDFLAGS += -lm -lGL -L/usr/local/lib

ifeq ($(USE_CODEC_VORBIS),1)
CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
Expand Down
26 changes: 14 additions & 12 deletions code/client/snd_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ static char s_backgroundLoop[MAX_QPATH];

static byte buffer2[ 0x10000 ]; // for muted painting

byte *dma_buffer2;

// =======================================================================
// Internal sound data & structures
// =======================================================================
Expand Down Expand Up @@ -103,16 +105,19 @@ portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];


static void S_Base_SoundInfo( void ) {
Com_Printf("----- Sound Info -----\n" );
Com_Printf( "----- Sound Info -----\n" );
if ( !s_soundStarted ) {
Com_Printf("sound system not started\n");
Com_Printf( "sound system not started\n" );
} else {
Com_Printf("%5d channels\n", dma.channels);
Com_Printf("%5d samples\n", dma.samples);
Com_Printf("%5d samplebits (%s)\n", dma.samplebits, dma.isfloat ? "float" : "int");
Com_Printf("%5d submission_chunk\n", dma.submission_chunk);
Com_Printf("%5d speed\n", dma.speed);
Com_Printf("%p dma buffer\n", dma.buffer);
if ( dma.driver ) {
Com_Printf( "Using %s subsystem\n", dma.driver );
}
if ( s_backgroundStream ) {
Com_Printf("Background file: %s\n", s_backgroundLoop );
} else {
Expand Down Expand Up @@ -1142,7 +1147,7 @@ static void S_GetSoundtime( void )
float frameDuration;
int msec;

if( CL_VideoRecording( ) )
if ( CL_VideoRecording() )
{
fps = MIN( cl_aviFrameRate->value, 1000.0f );
frameDuration = MAX( dma.speed / fps, 1.0f ) + clc.aviSoundFrameRemainder;
Expand Down Expand Up @@ -1439,14 +1444,11 @@ void S_FreeOldestSound( void ) {
// =======================================================================

static void S_Base_Shutdown( void ) {
byte *p;

if ( !s_soundStarted ) {
return;
}

p = dma.buffer2;

SNDDMA_Shutdown();

// release sound buffers only when switching to dedicated
Expand All @@ -1458,9 +1460,9 @@ static void S_Base_Shutdown( void ) {

s_numSfx = 0; // clean up sound cache -EC-

if ( p && p != buffer2 )
free( p );
dma.buffer2 = NULL;
if ( dma_buffer2 != buffer2 )
free( dma_buffer2 );
dma_buffer2 = NULL;

Cmd_RemoveCommand( "s_info" );
}
Expand Down Expand Up @@ -1507,10 +1509,10 @@ qboolean S_Base_Init( soundInterface_t *si ) {

// setup(likely) or allocate (unlikely) buffer for muted painting
if ( dma.samples * dma.samplebits/8 <= sizeof( buffer2 ) ) {
dma.buffer2 = buffer2;
dma_buffer2 = buffer2;
} else {
dma.buffer2 = malloc( dma.samples * dma.samplebits/8 );
memset( dma.buffer2, 0, dma.samples * dma.samplebits/8 );
dma_buffer2 = malloc( dma.samples * dma.samplebits/8 );
memset( dma_buffer2, 0, dma.samples * dma.samplebits/8 );
}
} else {
return qfalse;
Expand Down
4 changes: 3 additions & 1 deletion code/client/snd_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ typedef struct {
int isfloat;
int speed;
byte *buffer;
byte *buffer2;
const char *driver;
} dma_t;

extern byte *dma_buffer2;

#define START_SAMPLE_IMMEDIATE 0x7fffffff

#define MAX_DOPPLER_SCALE 50.0f //arbitrary
Expand Down
10 changes: 5 additions & 5 deletions code/client/snd_mix.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ static portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
static int snd_vol;

// bk001119 - these not static, required by unix/snd_mixa.s
int* snd_p;
int snd_linear_count;
short* snd_out;
int *snd_p;
int snd_linear_count;
short *snd_out;

void S_WriteLinearBlastStereo16( void )
{
Expand Down Expand Up @@ -651,7 +651,7 @@ void S_PaintChannels( int endtime ) {
snd_vol = s_volume->value * 255;

if ( (!gw_active && !gw_minimized && s_muteWhenUnfocused->integer) || (gw_minimized && s_muteWhenMinimized->integer) ) {
buffer = dma.buffer2;
buffer = dma_buffer2;
if ( !muted ) {
// switching to muted, clear hardware buffer
Com_Memset( dma.buffer, 0, dma.samples * dma.samplebits/8 );
Expand All @@ -662,7 +662,7 @@ void S_PaintChannels( int endtime ) {
// switching to unmuted, clear both buffers
if ( muted ) {
Com_Memset( dma.buffer, 0, dma.samples * dma.samplebits/8 );
Com_Memset( dma.buffer2, 0, dma.samples * dma.samplebits/8 );
Com_Memset( dma_buffer2, 0, dma.samples * dma.samplebits/8 );
}
muted = qfalse;
}
Expand Down
34 changes: 21 additions & 13 deletions code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ cvar_t *com_maxfpsUnfocused;
cvar_t *com_yieldCPU;
cvar_t *com_timedemo;
#endif
#if !defined(__FreeBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
cvar_t *com_affinityMask;
#endif
cvar_t *com_logfile; // 1 = buffer log, 2 = flush after each print
Expand Down Expand Up @@ -3342,13 +3342,20 @@ int Sys_GetProcessorId( char *vendor )
CPU_Flags |= CPU_SSE2;

// bit 0 of ECX denotes SSE3 existence
if ( regs[2] & ( 1 << 0 ) )
CPU_Flags |= CPU_SSE3;
//if ( regs[2] & ( 1 << 0 ) )
// CPU_Flags |= CPU_SSE3;

// bit 19 of ECX denotes SSE41 existence
if ( regs[ 2 ] & ( 1 << 19 ) )
CPU_Flags |= CPU_SSE41;

if ( vendor ) {
int print_flags = CPU_Flags;
#if idx64
strcpy( vendor, "64-bit " );
vendor += strlen( vendor );
// do not print default 64-bit features in 32-bit mode
print_flags &= ~(CPU_FCOM | CPU_MMX | CPU_SSE | CPU_SSE2);
#else
vendor[0] = '\0';
#endif
Expand All @@ -3358,21 +3365,22 @@ int Sys_GetProcessorId( char *vendor )
memcpy( vendor+4, (char*) &regs[3], 4 );
memcpy( vendor+8, (char*) &regs[2], 4 );
vendor[12] = '\0'; vendor += 12;
if ( CPU_Flags ) {

if ( print_flags ) {
// print features
#if !idx64 // do not print default 64-bit features in 32-bit mode
strcat( vendor, " w/" );
if ( CPU_Flags & CPU_FCOM )
if ( print_flags & CPU_FCOM )
strcat( vendor, " CMOV" );
if ( CPU_Flags & CPU_MMX )
if ( print_flags & CPU_MMX )
strcat( vendor, " MMX" );
if ( CPU_Flags & CPU_SSE )
if ( print_flags & CPU_SSE )
strcat( vendor, " SSE" );
if ( CPU_Flags & CPU_SSE2 )
if ( print_flags & CPU_SSE2 )
strcat( vendor, " SSE2" );
#endif
//if ( CPU_Flags & CPU_SSE3 )
// strcat( vendor, " SSE3" );
if ( print_flags & CPU_SSE41 )
strcat( vendor, " SSE4.1" );
}
}
return 1;
Expand Down Expand Up @@ -3577,7 +3585,7 @@ void Com_Init( char *commandLine ) {
com_yieldCPU = Cvar_Get( "com_yieldCPU", "1", CVAR_ARCHIVE_ND );
Cvar_CheckRange( com_yieldCPU, "0", "4", CV_INTEGER );
#endif
#if !defined(__FreeBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
com_affinityMask = Cvar_Get( "com_affinityMask", "0", CVAR_ARCHIVE_ND );
com_affinityMask->modified = qfalse;
#endif
Expand Down Expand Up @@ -3662,7 +3670,7 @@ void Com_Init( char *commandLine ) {
}
Com_Printf( "%s\n", Cvar_VariableString( "sys_cpustring" ) );
#endif
#if !defined(__FreeBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
if ( com_affinityMask->integer )
Sys_SetAffinityMask( com_affinityMask->integer );
#endif
Expand Down Expand Up @@ -3926,7 +3934,7 @@ void Com_Frame( qboolean noDelay ) {
}
com_viewlog->modified = qfalse;
}
#if !defined(__FreeBSD__)
#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
if ( com_affinityMask->modified ) {
Cvar_Get( "com_affinityMask", "0", CVAR_ARCHIVE );
com_affinityMask->modified = qfalse;
Expand Down
Loading

0 comments on commit a8b8941

Please sign in to comment.