mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
* Build dedicated server binary on Windows
This commit is contained in:
parent
e56a151a97
commit
54ba74964a
6 changed files with 156 additions and 68 deletions
22
Makefile
22
Makefile
|
@ -429,8 +429,8 @@ endif
|
|||
|
||||
BINEXT=.exe
|
||||
|
||||
LDFLAGS= -mwindows -lwsock32 -lgdi32 -lwinmm -lole32 -lopengl32
|
||||
CLIENT_LDFLAGS=
|
||||
LDFLAGS= -mwindows -lwsock32 -lwinmm
|
||||
CLIENT_LDFLAGS = -lgdi32 -lole32 -lopengl32
|
||||
|
||||
ifeq ($(USE_CURL),1)
|
||||
ifneq ($(USE_CURL_DLOPEN),1)
|
||||
|
@ -456,7 +456,6 @@ endif
|
|||
$(LIBSDIR)/win32/libSDLmain.a \
|
||||
$(LIBSDIR)/win32/libSDL.dll.a
|
||||
|
||||
BUILD_SERVER = 0
|
||||
BUILD_CLIENT_SMP = 0
|
||||
|
||||
else # ifeq mingw32
|
||||
|
@ -1181,9 +1180,6 @@ Q3DOBJ = \
|
|||
$(B)/ded/null_input.o \
|
||||
$(B)/ded/null_snddma.o \
|
||||
\
|
||||
$(B)/ded/tty_console.o \
|
||||
$(B)/ded/sys_unix.o \
|
||||
\
|
||||
$(B)/ded/sys_main.o
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
|
@ -1214,6 +1210,17 @@ ifeq ($(HAVE_VM_COMPILED),true)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(PLATFORM),mingw32)
|
||||
Q3DOBJ += \
|
||||
$(B)/ded/win_resource.o \
|
||||
$(B)/ded/sys_win32.o \
|
||||
$(B)/ded/con_win32.o
|
||||
else
|
||||
Q3DOBJ += \
|
||||
$(B)/ded/sys_unix.o \
|
||||
$(B)/ded/con_tty.o
|
||||
endif
|
||||
|
||||
$(B)/ioq3ded.$(ARCH)$(BINEXT): $(Q3DOBJ)
|
||||
$(echo_cmd) "LD $@"
|
||||
$(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
|
||||
|
@ -1550,6 +1557,9 @@ $(B)/ded/%.o: $(BLIBDIR)/%.c
|
|||
$(B)/ded/%.o: $(SYSDIR)/%.c
|
||||
$(DO_DED_CC)
|
||||
|
||||
$(B)/ded/%.o: $(SYSDIR)/%.rc
|
||||
$(DO_WINDRES)
|
||||
|
||||
$(B)/ded/%.o: $(NDIR)/%.c
|
||||
$(DO_DED_CC)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
tty console routines
|
||||
|
||||
NOTE: if the user is editing a line when something gets printed to the early
|
||||
console then it won't look good so we provide TTY_Hide and TTY_Show to be
|
||||
console then it won't look good so we provide CON_Hide and CON_Show to be
|
||||
called before and after a stdout or stderr output
|
||||
=============================================================
|
||||
*/
|
||||
|
@ -52,19 +52,19 @@ static field_t TTY_con;
|
|||
|
||||
// This is somewhat of aduplicate of the graphical console history
|
||||
// but it's safer more modular to have our own here
|
||||
#define TTY_HISTORY 32
|
||||
static field_t ttyEditLines[ TTY_HISTORY ];
|
||||
#define CON_HISTORY 32
|
||||
static field_t ttyEditLines[ CON_HISTORY ];
|
||||
static int hist_current = -1, hist_count = 0;
|
||||
|
||||
/*
|
||||
==================
|
||||
TTY_FlushIn
|
||||
CON_FlushIn
|
||||
|
||||
Flush stdin, I suspect some terminals are sending a LOT of shit
|
||||
FIXME relevant?
|
||||
==================
|
||||
*/
|
||||
static void TTY_FlushIn( void )
|
||||
static void CON_FlushIn( void )
|
||||
{
|
||||
char key;
|
||||
while (read(0, &key, 1)!=-1);
|
||||
|
@ -72,7 +72,7 @@ static void TTY_FlushIn( void )
|
|||
|
||||
/*
|
||||
==================
|
||||
TTY_Back
|
||||
CON_Back
|
||||
|
||||
Output a backspace
|
||||
|
||||
|
@ -81,7 +81,7 @@ send "\b \b"
|
|||
(FIXME there may be a way to find out if '\b' alone would work though)
|
||||
==================
|
||||
*/
|
||||
static void TTY_Back( void )
|
||||
static void CON_Back( void )
|
||||
{
|
||||
char key;
|
||||
key = '\b';
|
||||
|
@ -94,13 +94,13 @@ static void TTY_Back( void )
|
|||
|
||||
/*
|
||||
==================
|
||||
TTY_Hide
|
||||
CON_Hide
|
||||
|
||||
Clear the display of the line currently edited
|
||||
bring cursor back to beginning of line
|
||||
==================
|
||||
*/
|
||||
void TTY_Hide( void )
|
||||
void CON_Hide( void )
|
||||
{
|
||||
if( ttycon_on )
|
||||
{
|
||||
|
@ -114,23 +114,23 @@ void TTY_Hide( void )
|
|||
{
|
||||
for (i=0; i<TTY_con.cursor; i++)
|
||||
{
|
||||
TTY_Back();
|
||||
CON_Back();
|
||||
}
|
||||
}
|
||||
TTY_Back(); // Delete "]"
|
||||
CON_Back(); // Delete "]"
|
||||
ttycon_hide++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
TTY_Show
|
||||
CON_Show
|
||||
|
||||
Show the current line
|
||||
FIXME need to position the cursor if needed?
|
||||
==================
|
||||
*/
|
||||
void TTY_Show( void )
|
||||
void CON_Show( void )
|
||||
{
|
||||
if( ttycon_on )
|
||||
{
|
||||
|
@ -154,21 +154,21 @@ void TTY_Show( void )
|
|||
|
||||
/*
|
||||
==================
|
||||
TTY_Shutdown
|
||||
CON_Shutdown
|
||||
|
||||
Never exit without calling this, or your terminal will be left in a pretty bad state
|
||||
==================
|
||||
*/
|
||||
void TTY_Shutdown( void )
|
||||
void CON_Shutdown( void )
|
||||
{
|
||||
if (ttycon_on)
|
||||
{
|
||||
TTY_Back(); // Delete "]"
|
||||
CON_Back(); // Delete "]"
|
||||
tcsetattr (0, TCSADRAIN, &TTY_tc);
|
||||
|
||||
// Restore blocking to stdin reads
|
||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) & ~O_NDELAY );
|
||||
}
|
||||
|
||||
// Restore blocking to stdin reads
|
||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) & ~O_NDELAY );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -179,17 +179,17 @@ Hist_Add
|
|||
void Hist_Add(field_t *field)
|
||||
{
|
||||
int i;
|
||||
assert(hist_count <= TTY_HISTORY);
|
||||
assert(hist_count <= CON_HISTORY);
|
||||
assert(hist_count >= 0);
|
||||
assert(hist_current >= -1);
|
||||
assert(hist_current <= hist_count);
|
||||
// make some room
|
||||
for (i=TTY_HISTORY-1; i>0; i--)
|
||||
for (i=CON_HISTORY-1; i>0; i--)
|
||||
{
|
||||
ttyEditLines[i] = ttyEditLines[i-1];
|
||||
}
|
||||
ttyEditLines[0] = *field;
|
||||
if (hist_count<TTY_HISTORY)
|
||||
if (hist_count<CON_HISTORY)
|
||||
{
|
||||
hist_count++;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ Hist_Prev
|
|||
field_t *Hist_Prev( void )
|
||||
{
|
||||
int hist_prev;
|
||||
assert(hist_count <= TTY_HISTORY);
|
||||
assert(hist_count <= CON_HISTORY);
|
||||
assert(hist_count >= 0);
|
||||
assert(hist_current >= -1);
|
||||
assert(hist_current <= hist_count);
|
||||
|
@ -224,7 +224,7 @@ Hist_Next
|
|||
*/
|
||||
field_t *Hist_Next( void )
|
||||
{
|
||||
assert(hist_count <= TTY_HISTORY);
|
||||
assert(hist_count <= CON_HISTORY);
|
||||
assert(hist_count >= 0);
|
||||
assert(hist_current >= -1);
|
||||
assert(hist_current <= hist_count);
|
||||
|
@ -241,12 +241,12 @@ field_t *Hist_Next( void )
|
|||
|
||||
/*
|
||||
==================
|
||||
TTY_Init
|
||||
CON_Init
|
||||
|
||||
Initialize the console input (tty mode if possible)
|
||||
==================
|
||||
*/
|
||||
void TTY_Init( void )
|
||||
void CON_Init( void )
|
||||
{
|
||||
struct termios tc;
|
||||
|
||||
|
@ -295,10 +295,10 @@ void TTY_Init( void )
|
|||
|
||||
/*
|
||||
==================
|
||||
TTY_ConsoleInput
|
||||
CON_ConsoleInput
|
||||
==================
|
||||
*/
|
||||
char *TTY_ConsoleInput( void )
|
||||
char *CON_ConsoleInput( void )
|
||||
{
|
||||
// we use this when sending back commands
|
||||
static char text[256];
|
||||
|
@ -320,7 +320,7 @@ char *TTY_ConsoleInput( void )
|
|||
{
|
||||
TTY_con.cursor--;
|
||||
TTY_con.buffer[TTY_con.cursor] = '\0';
|
||||
TTY_Back();
|
||||
CON_Back();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -340,9 +340,9 @@ char *TTY_ConsoleInput( void )
|
|||
}
|
||||
if (key == '\t')
|
||||
{
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
Field_AutoComplete( &TTY_con );
|
||||
TTY_Show();
|
||||
CON_Show();
|
||||
return NULL;
|
||||
}
|
||||
avail = read(0, &key, 1);
|
||||
|
@ -360,16 +360,16 @@ char *TTY_ConsoleInput( void )
|
|||
history = Hist_Prev();
|
||||
if (history)
|
||||
{
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
TTY_con = *history;
|
||||
TTY_Show();
|
||||
CON_Show();
|
||||
}
|
||||
TTY_FlushIn();
|
||||
CON_FlushIn();
|
||||
return NULL;
|
||||
break;
|
||||
case 'B':
|
||||
history = Hist_Next();
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
if (history)
|
||||
{
|
||||
TTY_con = *history;
|
||||
|
@ -377,8 +377,8 @@ char *TTY_ConsoleInput( void )
|
|||
{
|
||||
Field_Clear(&TTY_con);
|
||||
}
|
||||
TTY_Show();
|
||||
TTY_FlushIn();
|
||||
CON_Show();
|
||||
CON_FlushIn();
|
||||
return NULL;
|
||||
break;
|
||||
case 'C':
|
||||
|
@ -390,7 +390,7 @@ char *TTY_ConsoleInput( void )
|
|||
}
|
||||
}
|
||||
Com_DPrintf("droping ISCTL sequence: %d, TTY_erase: %d\n", key, TTY_erase);
|
||||
TTY_FlushIn();
|
||||
CON_FlushIn();
|
||||
return NULL;
|
||||
}
|
||||
// push regular character
|
70
code/sys/con_win32.c
Normal file
70
code/sys/con_win32.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
/*
|
||||
==================
|
||||
CON_Hide
|
||||
==================
|
||||
*/
|
||||
void CON_Hide( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CON_Show
|
||||
==================
|
||||
*/
|
||||
void CON_Show( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CON_Shutdown
|
||||
==================
|
||||
*/
|
||||
void CON_Shutdown( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CON_Init
|
||||
==================
|
||||
*/
|
||||
void CON_Init( void )
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CON_ConsoleInput
|
||||
==================
|
||||
*/
|
||||
char *CON_ConsoleInput( void )
|
||||
{
|
||||
return NULL;
|
||||
}
|
|
@ -21,11 +21,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
*/
|
||||
|
||||
#ifdef DEDICATED
|
||||
# ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# define Sys_LoadLibrary(f) (void*)LoadLibrary(f)
|
||||
# define Sys_UnloadLibrary(h) FreeLibrary((HMODULE)h)
|
||||
# define Sys_LoadFunction(h,fn) (void*)GetProcAddress((HMODULE)h,fn)
|
||||
# define Sys_LibraryError() "unknown"
|
||||
# else
|
||||
# include <dlfcn.h>
|
||||
# define Sys_LoadLibrary(f) dlopen(f,RTLD_NOW)
|
||||
# define Sys_UnloadLibrary(h) dlclose(h)
|
||||
# define Sys_LoadFunction(h,fn) dlsym(h,fn)
|
||||
# define Sys_LibraryError() dlerror()
|
||||
# define Sys_LoadLibrary(f) dlopen(f,RTLD_NOW)
|
||||
# define Sys_UnloadLibrary(h) dlclose(h)
|
||||
# define Sys_LoadFunction(h,fn) dlsym(h,fn)
|
||||
# define Sys_LibraryError() dlerror()
|
||||
#endif
|
||||
#else
|
||||
# include "SDL.h"
|
||||
# include "SDL_loadso.h"
|
||||
|
|
|
@ -28,12 +28,12 @@ void IN_Init (void);
|
|||
void IN_Frame (void);
|
||||
void IN_Shutdown (void);
|
||||
|
||||
// TTY console
|
||||
void TTY_Hide( void );
|
||||
void TTY_Show( void );
|
||||
void TTY_Shutdown( void );
|
||||
void TTY_Init( void );
|
||||
char *TTY_ConsoleInput(void);
|
||||
// Console
|
||||
void CON_Hide( void );
|
||||
void CON_Show( void );
|
||||
void CON_Shutdown( void );
|
||||
void CON_Init( void );
|
||||
char *CON_ConsoleInput(void);
|
||||
|
||||
#ifdef MACOS_X
|
||||
char *Sys_StripAppBundle( char *pwd );
|
||||
|
|
|
@ -113,7 +113,7 @@ Start the console input subsystem
|
|||
void Sys_ConsoleInputInit( void )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
TTY_Init( );
|
||||
CON_Init( );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ Shutdown the console input subsystem
|
|||
void Sys_ConsoleInputShutdown( void )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
TTY_Shutdown( );
|
||||
CON_Shutdown( );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ Handle new console input
|
|||
char *Sys_ConsoleInput(void)
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
return TTY_ConsoleInput( );
|
||||
return CON_ConsoleInput( );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
@ -224,7 +224,7 @@ static struct Q3ToAnsiColorTable_s
|
|||
{
|
||||
char Q3color;
|
||||
char *ANSIcolor;
|
||||
} TTY_colorTable[ ] =
|
||||
} CON_colorTable[ ] =
|
||||
{
|
||||
{ COLOR_BLACK, "30" },
|
||||
{ COLOR_RED, "31" },
|
||||
|
@ -236,8 +236,8 @@ static struct Q3ToAnsiColorTable_s
|
|||
{ COLOR_WHITE, "0" }
|
||||
};
|
||||
|
||||
static int TTY_colorTableSize =
|
||||
sizeof( TTY_colorTable ) / sizeof( TTY_colorTable[ 0 ] );
|
||||
static int CON_colorTableSize =
|
||||
sizeof( CON_colorTable ) / sizeof( CON_colorTable[ 0 ] );
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -276,11 +276,11 @@ static void Sys_ANSIColorify( const char *msg, char *buffer, int bufferSize )
|
|||
if( i < msgLength )
|
||||
{
|
||||
escapeCode = NULL;
|
||||
for( j = 0; j < TTY_colorTableSize; j++ )
|
||||
for( j = 0; j < CON_colorTableSize; j++ )
|
||||
{
|
||||
if( msg[ i ] == TTY_colorTable[ j ].Q3color )
|
||||
if( msg[ i ] == CON_colorTable[ j ].Q3color )
|
||||
{
|
||||
escapeCode = TTY_colorTable[ j ].ANSIcolor;
|
||||
escapeCode = CON_colorTable[ j ].ANSIcolor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ Sys_Print
|
|||
void Sys_Print( const char *msg )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
if( com_ansiColor && com_ansiColor->integer )
|
||||
|
@ -323,7 +323,7 @@ void Sys_Print( const char *msg )
|
|||
fputs(msg, stderr);
|
||||
|
||||
#ifdef DEDICATED
|
||||
TTY_Show();
|
||||
CON_Show();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ void Sys_Error( const char *error, ... )
|
|||
char string[1024];
|
||||
|
||||
#ifdef DEDICATED
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
CL_Shutdown ();
|
||||
|
@ -366,13 +366,13 @@ void Sys_Warn( char *warning, ... )
|
|||
va_end (argptr);
|
||||
|
||||
#ifdef DEDICATED
|
||||
TTY_Hide();
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "Warning: %s", string);
|
||||
|
||||
#ifdef DEDICATED
|
||||
TTY_Show();
|
||||
CON_Show();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue