Con_Printf("%i = S_RawSamples_QueueWantsMore()\n", samples);
// calculate how much source data we need to fill the output...
- s = samples * cl_videosoundrate / shm->speed;
+ s = samples * cl_videosoundrate / S_RawSamples_SampleRate();
// reallocate processing buffer if needed
if (cl_videosoundresamplelength < samples)
{
int i, numplayers;
- numplayers = 1;
-
- i = COM_CheckParm ("-dedicated");
- if (i)
+ if (cl_available)
{
- cls.state = ca_dedicated;
- numplayers = 0;
- if (i != (com_argc - 1))
- numplayers = atoi (com_argv[i+1]);
+ // client exists, check what mode the user wants
+ i = COM_CheckParm ("-dedicated");
+ if (i)
+ {
+ cls.state = ca_dedicated;
+ numplayers = 8;
+ if (i != (com_argc - 1))
+ numplayers = atoi (com_argv[i+1]);
+ if (COM_CheckParm ("-listen"))
+ Sys_Error ("Only one of -dedicated or -listen can be specified");
+ }
+ else
+ {
+ numplayers = 1;
+ cls.state = ca_disconnected;
+ i = COM_CheckParm ("-listen");
+ if (i)
+ {
+ numplayers = 8;
+ if (i != (com_argc - 1))
+ numplayers = atoi (com_argv[i+1]);
+ }
+ }
}
else
- cls.state = ca_disconnected;
-
- i = COM_CheckParm ("-listen");
- if (i)
{
- if (cls.state == ca_dedicated)
- Sys_Error ("Only one of -dedicated or -listen can be specified");
- numplayers = 0;
- if (i != (com_argc - 1))
+ // no client in the executable, start dedicated server
+ if (COM_CheckParm ("-listen"))
+ Sys_Error ("-listen not available in a dedicated server executable");
+ numplayers = 8;
+ cls.state = ca_dedicated;
+ // check for -dedicated specifying how many players
+ i = COM_CheckParm ("-dedicated");
+ if (i && i != (com_argc - 1))
numplayers = atoi (com_argv[i+1]);
}
#if you want no CD audio
CD=cd_null.o
-OBJECTS= builddate.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o r_sky.o gl_rmain.o gl_rsurf.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_explosion.o sbar.o sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o protocol.o quakeio.o ui.o portals.o sys_shared.o cl_light.o gl_backend.o cl_particles.o cl_screen.o cgamevm.o cgame.o filematch.o collision.o cl_collision.o matrixlib.o cl_video.o dpvsimpledecode.o wavefile.o meshqueue.o
+CLIENTOBJECTS= cgame.o cgamevm.o chase.o cl_collision.o cl_demo.o cl_input.o cl_light.o cl_main.o cl_parse.o cl_particles.o cl_screen.o cl_tent.o cl_video.o console.o dpvsimpledecode.o fractalnoise.o gl_backend.o gl_draw.o gl_models.o gl_rmain.o gl_rsurf.o gl_textures.o keys.o menu.o meshqueue.o r_crosshairs.o r_explosion.o r_explosion.o r_lerpanim.o r_light.o r_modules.o r_sky.o r_sprites.o sbar.o ui.o vid_shared.o view.o wavefile.o
+SERVEROBJECTS= pr_cmds.o pr_edict.o pr_exec.o sv_light.o sv_main.o sv_move.o sv_phys.o sv_user.o
+SHAREDOBJECTS= builddate.o cmd.o collision.o common.o crc.o cvar.o filematch.o host.o host_cmd.o image.o mathlib.o matrixlib.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_dgrm.o net_loop.o net_main.o net_udp.o palette.o portals.o protocol.o quakeio.o sys_linux.o sys_shared.o transform.o world.o wad.o zone.o $(NETOBJECTS) $(SERVEROBJECTS)
+
#K6/athlon optimizations
#CPUOPTIMIZATIONS=-march=k6
#use this line for profiling
PROFILEOPTION=-pg -g
-NOPROFILEOPTIMIZATIONS=
#use this line for no profiling
#PROFILEOPTION=
-#NOPROFILEOPTIMIZATIONS=-fomit-frame-pointer
-#use these lines for debugging without profiling
-#PROFILEOPTION=
-#NOPROFILEOPTIMIZATIONS=
#note:
#the -Werror can be removed to compile even if there are warnings,
#this is used to ensure that all released versions are free of warnings.
#normal compile
-OPTIMIZATIONS= -O6 -fno-strict-aliasing -ffast-math -funroll-loops $(NOPROFILEOPTIMIZATIONS) -fexpensive-optimizations $(CPUOPTIMIZATIONS)
-CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include $(OPTIMIZATIONS) $(PROFILEOPTION)
+OPTIMIZATIONS= -O6 -fno-strict-aliasing -ffast-math -funroll-loops -fexpensive-optimizations $(CPUOPTIMIZATIONS)
+CFLAGS= -MD -Wall -Werror $(OPTIMIZATIONS) $(PROFILEOPTION)
#debug compile
#OPTIMIZATIONS=
-#CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
+#CFLAGS= -MD -Wall -Werror -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
-LDFLAGS= -L/usr/X11R6/lib -lm -lX11 -lXext -lXxf86dga -lXxf86vm -ldl $(SOUNDLIB) $(PROFILEOPTION)
+LDFLAGS= $(PROFILEOPTION) -lm -ldl
-all: builddate darkplaces-glx
+all: builddate darkplaces-dedicated darkplaces-glx
builddate:
touch builddate.c
+vid_glx.o: vid_glx.c
+ gcc $(CFLAGS) -c vid_glx.c -I/usr/X11R6/include
+
.c.o:
gcc $(CFLAGS) -c $*.c
-darkplaces-glx: vid_glx.o $(CD) $(SND) $(OBJECTS)
+darkplaces-glx: $(SHAREDOBJECTS) $(CLIENTOBJECTS) $(SERVEROBJECTS) vid_glx.o $(CD) $(SND)
+ gcc -o $@ $^ $(LDFLAGS) -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm $(SOUNDLIB)
+
+darkplaces-dedicated: $(SHAREDOBJECTS) $(CLIENTOBJECTS) $(SERVEROBJECTS) vid_null.o cd_null.o snd_null.o
gcc -o $@ $^ $(LDFLAGS)
clean:
- -rm -f darkplaces-glx *.o *.d
+ -rm -f darkplaces-glx darkplaces-dedicated *.o *.d
.PHONY: clean builddate
else
memcpy(output, input, inputlength * sizeof(short[2]));
}
+
+int S_RawSamples_SampleRate(void)
+{
+ return shm != NULL ? shm->speed : 0;
+}
{
}
+void S_RawSamples_Enqueue(short *samples, unsigned int length)
+{
+}
+
+void S_RawSamples_Dequeue(int *samples, unsigned int length)
+{
+}
+
+void S_RawSamples_ClearQueue(void)
+{
+}
+
+int S_RawSamples_QueueWantsMore(void)
+{
+ return 0;
+}
+
+void S_ResampleBuffer16Stereo(short *input, int inputlength, short *output, int outputlength)
+{
+}
+
+int S_RawSamples_SampleRate(void)
+{
+ return 0;
+}
// resamples one sound buffer into another, while changing the length
void S_ResampleBuffer16Stereo(short *input, int inputlength, short *output, int outputlength);
+// returns the rate that the rawsamples system is running at
+int S_RawSamples_SampleRate(void);
+
#endif
#ifndef VID_H
#define VID_H
+extern int cl_available;
+
typedef struct
{
// these are set with VID_GetWindowSize and can change from frame to frame
#include "quakedef.h"
+int cl_available = true;
+
//GLX prototypes
XVisualInfo *(GLAPIENTRY *qglXChooseVisual)(Display *dpy, int screen, int *attribList);
GLXContext (GLAPIENTRY *qglXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
--- /dev/null
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include <signal.h>
+#include <dlfcn.h>
+#include "quakedef.h"
+
+int cl_available = false;
+
+// global video state
+viddef_t vid;
+
+void VID_Shutdown(void)
+{
+}
+
+void signal_handler(int sig)
+{
+ printf("Received signal %d, exiting...\n", sig);
+ Sys_Quit();
+ exit(0);
+}
+
+void InitSig(void)
+{
+ signal(SIGHUP, signal_handler);
+ signal(SIGINT, signal_handler);
+ signal(SIGQUIT, signal_handler);
+ signal(SIGILL, signal_handler);
+ signal(SIGTRAP, signal_handler);
+ signal(SIGIOT, signal_handler);
+ signal(SIGBUS, signal_handler);
+ signal(SIGFPE, signal_handler);
+ signal(SIGSEGV, signal_handler);
+ signal(SIGTERM, signal_handler);
+}
+
+void VID_GetWindowSize (int *x, int *y, int *width, int *height)
+{
+ *x = *y = 0;
+ *width = 1;
+ *height = 1;
+}
+
+void VID_Finish (void)
+{
+}
+
+int VID_SetGamma(float prescale, float gamma, float scale, float base)
+{
+ return FALSE;
+}
+
+void VID_Init(int fullscreen, int width, int height)
+{
+ InitSig(); // trap evil signals
+}
+
+int GL_OpenLibrary(const char *name)
+{
+ return false;
+}
+
+void GL_CloseLibrary(void)
+{
+}
+
+void *GL_GetProcAddress(const char *name)
+{
+ return NULL;
+}
+
+void Sys_SendKeyEvents(void)
+{
+}
+
+void IN_Commands(void)
+{
+}
+
+void IN_Init(void)
+{
+}
+
+void IN_Shutdown(void)
+{
+}
+
+void IN_Move(usercmd_t *cmd)
+{
+}
#include "resource.h"
#include <commctrl.h>
+int cl_available = true;
+
int (WINAPI *qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *);
int (WINAPI *qwglDescribePixelFormat)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
//int (WINAPI *qwglGetPixelFormat)(HDC);