From 2f8efd73601a89de454d9b64cda85751bc69f120 Mon Sep 17 00:00:00 2001 From: Chris Ison Date: Sun, 7 Oct 2001 12:45:47 +0000 Subject: [PATCH] changes to get mingw32 sw clients to compile under cygwin --- configure.ac | 5 +- libs/audio/targets/snd_win.c | 7 ++ nq/source/Makefile.am | 7 +- nq/source/sys_wind.c | 153 +++++++---------------------------- 4 files changed, 42 insertions(+), 130 deletions(-) diff --git a/configure.ac b/configure.ac index 36db617af..fa89f7dda 100644 --- a/configure.ac +++ b/configure.ac @@ -70,11 +70,10 @@ case "$host_os" in case "$target_os" in mingw32*) mingw=yes - CPPFLAGS="$CPPFLAGS -mno-cygwin -mwindows" + CPPFLAGS="$CPPFLAGS -mno-cygwin -mconsole" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32/resources" - LDFLAGS="$LDFLAGS -mno-cygwin -mwindows" - endian="little" + LDFLAGS="$LDFLAGS -mno-cygwin -mconsole" endian="little" ;; esac fi diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index 5901a139a..5324a8a8a 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -34,6 +34,7 @@ static const char rcsid[] = #define CINTERFACE #include "winquake.h" +#include "QF/plugin.h" #include "QF/qargs.h" #include "QF/sound.h" #include "QF/sys.h" @@ -99,6 +100,12 @@ static snd_output_data_t plugin_info_snd_output_data; static snd_output_funcs_t plugin_info_snd_output_funcs; + +static void +SNDDMA_Init_Cvars (void) +{ +} + void SNDDMA_BlockSound (void) { diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index c8294a9ff..2ecf7912a 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -208,8 +208,11 @@ nq_wgl_DEPENDENCIES= $(top_builddir)/libs/video/renderer/libQFrenderer_gl.la \ $(client_LIB_DEPS) # Dedicated Server -ded_sources= sys_unixd.c sv_ded.c sv_model.c - +if SYSTYPE_WIN32 + ded_sources= sys_wind.c sv_ded.c sv_model.c +else + ded_sources= sys_unixd.c sv_ded.c sv_model.c +endif nq_server_LDFLAGS= $(common_ldflags) nq_server_SOURCES= $(common_sources) $(server_sources) $(ded_sources) nq_server_LDADD= $(server_LIBS) diff --git a/nq/source/sys_wind.c b/nq/source/sys_wind.c index f37afe6ac..c4eb04207 100644 --- a/nq/source/sys_wind.c +++ b/nq/source/sys_wind.c @@ -34,120 +34,24 @@ static const char rcsid[] = #include #include +#include "QF/cvar.h" +#include "QF/qargs.h" +#include "QF/sys.h" +// #include "client.h" +#include "game.h" +#include "host.h" #include "winquake.h" -#include "errno.h" + +qboolean isDedicated = true; + +#if 0 // FILE IO ==================================================================== #define MAX_HANDLES 10 VFile *sys_handles[MAX_HANDLES]; -int -findhandle (void) -{ - int i; - - for (i = 1; i < MAX_HANDLES; i++) - if (!sys_handles[i]) - return i; - Sys_Error ("out of handles"); - return -1; -} - -int -filelength (VFile *f) -{ - int pos; - int end; - - pos = ftell (f); - fseek (f, 0, SEEK_END); - end = ftell (f); - fseek (f, pos, SEEK_SET); - - return end; -} - -int -Sys_FileOpenRead (char *path, int *hndl) -{ - VFile *f; - int i; - - i = findhandle (); - - f = Qopen (path, "rb"); - if (!f) { - *hndl = -1; - return -1; - } - sys_handles[i] = f; - *hndl = i; - - return filelength (f); -} - -int -Sys_FileOpenWrite (char *path) -{ - VFile *f; - int i; - - i = findhandle (); - - f = Qopen (path, "wb"); - if (!f) - Sys_Error ("Error opening %s: %s", path, strerror (errno)); - sys_handles[i] = f; - - return i; -} - -void -Sys_FileClose (int handle) -{ - Qclose (sys_handles[handle]); - sys_handles[handle] = NULL; -} - -void -Sys_FileSeek (int handle, int position) -{ - fseek (sys_handles[handle], position, SEEK_SET); -} - -int -Sys_FileRead (int handle, void *dest, int count) -{ - return fread (dest, 1, count, sys_handles[handle]); -} - -int -Sys_FileWrite (int handle, void *data, int count) -{ - return fwrite (data, 1, count, sys_handles[handle]); -} - -int -Sys_FileTime (char *path) -{ - VFile *f; - - f = Qopen (path, "rb"); - if (f) { - Qclose (f); - return 1; - } - - return -1; -} - -void -Sys_mkdir (char *path) -{ -} - // SYSTEM IO ================================================================== void @@ -155,16 +59,6 @@ Sys_DebugLog (char *file, char *fmt, ...) { } -void -Sys_Printf (char *fmt, ...) -{ - va_list argptr; - - va_start (argptr, fmt); - vprintf (fmt, argptr); - va_end (argptr); -} - void IN_SendKeyEvents (void) { @@ -179,8 +73,9 @@ void Sys_LowFPPrecision (void) { } +#endif -char * +const char * Sys_ConsoleInput (void) { static char text[256]; @@ -217,25 +112,33 @@ Sys_ConsoleInput (void) return NULL; } -char *newargv[256]; +static void +shutdown (void) +{ +} + +static void +Sys_Init (void) +{ +} + +const char *newargv[256]; int -main (int argc, char **argv) +main (int argc, const char **argv) { - MSG msg; quakeparms_t parms; double time, oldtime; - static char cwd[1024]; memset (&parms, 0, sizeof (parms)); parms.memsize = 16384 * 1024; parms.membase = malloc (parms.memsize); - +#if 0 _getcwd (cwd, sizeof (cwd)); if (cwd[Q_strlen (cwd) - 1] == '\\') cwd[Q_strlen (cwd) - 1] = 0; - +#endif COM_InitArgv (argc, argv); // dedicated server ONLY! @@ -247,8 +150,8 @@ main (int argc, char **argv) COM_InitArgv (argc, argv); } - parms.argc = argc; - parms.argv = argv; + parms.argc = com_argc; + parms.argv = com_argv; Sys_RegisterShutdown (Host_Shutdown); Sys_RegisterShutdown (shutdown);