mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-13 06:01:19 +00:00
- Fixed up make install target, so that the dynamic modules
are installed into the correct places. - Added libltdl, the libtool dynamic loader to the code, as the libraries are now under libtool control. Libtool and libltdl are evil. - Fixed various paths inside the code to point to PKGLIBDIR for the game and refresher modules, and PKGDATADIR for the game data. - updated .gitignore
This commit is contained in:
parent
0974879e67
commit
3973c870cc
13 changed files with 365 additions and 398 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -15,3 +15,5 @@ missing
|
||||||
mkinstalldirs
|
mkinstalldirs
|
||||||
stamp-*
|
stamp-*
|
||||||
compile
|
compile
|
||||||
|
libltdl
|
||||||
|
ltmain.sh
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
SUBDIRS = src
|
SUBDIRS = libltdl src
|
||||||
|
|
17
bootstrap
17
bootstrap
|
@ -17,16 +17,25 @@ if [ "$1" = "clean" ]; then
|
||||||
fi
|
fi
|
||||||
find . -name Makefile.in -print0 | xargs -r0 rm -f
|
find . -name Makefile.in -print0 | xargs -r0 rm -f
|
||||||
rm -f aclocal.m4 install-sh missing mkinstalldirs \
|
rm -f aclocal.m4 install-sh missing mkinstalldirs \
|
||||||
stamp-h.in tags configure config.* \
|
stamp-* tags configure config.* \
|
||||||
compile depcomp stamp-h
|
compile depcomp ltmain.sh
|
||||||
rm -rf autom4te.cache
|
rm -rf autom4te.cache libltdl
|
||||||
find . -name '*~' -print0 | xargs -r0 rm -f
|
find . -name '*~' -print0 | xargs -r0 rm -f
|
||||||
|
find . -name '*.rej' -print0 | xargs -r0 rm -f
|
||||||
|
find . -name '*.orig' -print0 | xargs -r0 rm -f
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
VERSION=`automake --version |head| sed 's/automake (GNU automake) //'`
|
||||||
|
MAJOR=`echo $VERSION | cut -f1 -d.`
|
||||||
|
MINOR=`echo $VERSION | cut -f2 -d.`
|
||||||
|
if test "$MAJOR" -ge "1" -a "$MINOR" -ge "6"; then
|
||||||
aclocal
|
aclocal
|
||||||
autoheader
|
autoheader
|
||||||
|
libtoolize --copy --ltdl --automake
|
||||||
automake --foreign --add-missing --copy
|
automake --foreign --add-missing --copy
|
||||||
autoconf
|
autoconf
|
||||||
|
else
|
||||||
|
echo "Need automake version 1.6 or higher"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
58
configure.in
58
configure.in
|
@ -1,10 +1,11 @@
|
||||||
dnl $Id$
|
dnl $Id$
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
dnl usual stuff
|
dnl stick the revision info into the resulting configure script
|
||||||
AC_PREREQ(2.50)
|
|
||||||
AC_INIT(src/main.c)
|
|
||||||
AC_REVISION($Revision$) dnl
|
AC_REVISION($Revision$) dnl
|
||||||
|
AC_PREREQ(2.50)
|
||||||
|
|
||||||
|
AC_INIT(src/main.c)
|
||||||
AM_CONFIG_HEADER(config.h)
|
AM_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
dnl get the build and target hosts
|
dnl get the build and target hosts
|
||||||
|
@ -23,8 +24,14 @@ dnl Checks for programs
|
||||||
dnl -------------------
|
dnl -------------------
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
#AC_PROG_RANLIB
|
|
||||||
#AC_PROG_LIBTOOL
|
dnl libtool is evil
|
||||||
|
AC_LIBTOOL_DLOPEN
|
||||||
|
AC_LIBLTDL_CONVENIENCE
|
||||||
|
AC_PROG_LIBTOOL
|
||||||
|
AC_CONFIG_SUBDIRS(libltdl)
|
||||||
|
AC_SUBST(INCLTDL)
|
||||||
|
AC_SUBST(LIBLTDL)
|
||||||
|
|
||||||
HAVE_MASM=""
|
HAVE_MASM=""
|
||||||
AC_SUBST(HAVE_MASM)
|
AC_SUBST(HAVE_MASM)
|
||||||
|
@ -271,8 +278,9 @@ dnl -----------------------------
|
||||||
#AC_CHECK_FUNCS([bzero floor getcwd gethostbyname getmntent getpagesize gettimeofday memmove memset mkdir munmap pow putenv select socket sqrt strcasecmp strchr strdup strerror strrchr strstr])
|
#AC_CHECK_FUNCS([bzero floor getcwd gethostbyname getmntent getpagesize gettimeofday memmove memset mkdir munmap pow putenv select socket sqrt strcasecmp strchr strdup strerror strrchr strstr])
|
||||||
AC_FUNC_VA_COPY
|
AC_FUNC_VA_COPY
|
||||||
AC_FUNC__VA_COPY
|
AC_FUNC__VA_COPY
|
||||||
AC_CHECK_FUNCS(dlopen)
|
|
||||||
|
|
||||||
|
dnl Check for dynamic loader -- needed for the GL refreshers
|
||||||
|
AC_CHECK_FUNCS(dlopen)
|
||||||
DL_LIBS=""
|
DL_LIBS=""
|
||||||
if test "x$ac_cv_func_dlopen" != "xyes"; then
|
if test "x$ac_cv_func_dlopen" != "xyes"; then
|
||||||
AC_CHECK_LIB(dl,
|
AC_CHECK_LIB(dl,
|
||||||
|
@ -331,6 +339,25 @@ fi
|
||||||
AM_CONDITIONAL(DO_XATRIX, test "$DO_XATRIX" = "yes")
|
AM_CONDITIONAL(DO_XATRIX, test "$DO_XATRIX" = "yes")
|
||||||
AM_CONDITIONAL(DO_ROGUE, test "$DO_ROGUE" = "yes")
|
AM_CONDITIONAL(DO_ROGUE, test "$DO_ROGUE" = "yes")
|
||||||
|
|
||||||
|
dnl ----------------------
|
||||||
|
dnl Fill in path variables
|
||||||
|
dnl ----------------------
|
||||||
|
|
||||||
|
dnl $libdir usually gets set to ${exec_prefix}/lib,
|
||||||
|
dnl $exec_prefix is likely to be "NONE"
|
||||||
|
dnl Autoconf usually sets pkglibdir correctly in the Makefile, but not in
|
||||||
|
dnl the configure script :(
|
||||||
|
eval tmp_libdir="$libdir"
|
||||||
|
if test "x$tmp_libdir" != "xNONE/lib"; then
|
||||||
|
eval PKGLIBDIR="$libdir/$PACKAGE"
|
||||||
|
else
|
||||||
|
eval PKGLIBDIR="$prefix/lib/$PACKAGE"
|
||||||
|
fi
|
||||||
|
AC_DEFINE_UNQUOTED(PKGLIBDIR, "$PKGLIBDIR", [Define this to the path containing the dynamic modules (\${exec-prefix}/lib/quake2/)])
|
||||||
|
|
||||||
|
eval PKGDATADIR="$datadir/$PACKAGE"
|
||||||
|
AC_DEFINE_UNQUOTED(PKGDATADIR, "$PKGDATADIR", [Define this to the path containing the game data (\${prefix}/share/quake2/)])
|
||||||
|
|
||||||
dnl ---------------------------------
|
dnl ---------------------------------
|
||||||
dnl Work out what refreshers to build
|
dnl Work out what refreshers to build
|
||||||
dnl ---------------------------------
|
dnl ---------------------------------
|
||||||
|
@ -338,32 +365,32 @@ dnl ---------------------------------
|
||||||
VID_REFS=""
|
VID_REFS=""
|
||||||
|
|
||||||
if test "x$HAVE_SVGALIB" = xyes; then
|
if test "x$HAVE_SVGALIB" = xyes; then
|
||||||
VID_REFS="$VID_REFS ref_soft.so"
|
VID_REFS="$VID_REFS ref_soft.la"
|
||||||
BUILD_SOFT="yes"
|
BUILD_SOFT="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$HAVE_X" = xyes; then
|
if test "x$HAVE_X" = xyes; then
|
||||||
VID_REFS="$VID_REFS ref_softx.so"
|
VID_REFS="$VID_REFS ref_softx.la"
|
||||||
BUILD_SOFTX="yes"
|
BUILD_SOFTX="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$HAVE_SDL" = xyes; then
|
if test "x$HAVE_SDL" = xyes; then
|
||||||
VID_REFS="$VID_REFS ref_softsdl.so"
|
VID_REFS="$VID_REFS ref_softsdl.la"
|
||||||
BUILD_SOFTSDL="yes"
|
BUILD_SOFTSDL="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$HAVE_X" = xyes -a "x$HAVE_OPENGL" = xyes; then
|
if test "x$HAVE_X" = xyes -a "x$HAVE_OPENGL" = xyes; then
|
||||||
VID_REFS="$VID_REFS ref_glx.so"
|
VID_REFS="$VID_REFS ref_glx.la"
|
||||||
BUILD_GLX="yes"
|
BUILD_GLX="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$HAVE_X" = xyes -a "x$HAVE_GLIDE" = xyes -a "x$HAVE_SVGALIB" = xyes; then
|
if test "x$HAVE_X" = xyes -a "x$HAVE_GLIDE" = xyes -a "x$HAVE_SVGALIB" = xyes; then
|
||||||
VIDREFS="$VID_REFS ref_fxgl.so"
|
VID_REFS="$VID_REFS ref_tdfx.la"
|
||||||
BUILD_FXGL="yes"
|
BUILD_TDFX="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$HAVE_X" = xyes -a "x$HAVE_OPENGL" = xyes -a "x$HAVE_SDL" = xyes; then
|
if test "x$HAVE_X" = xyes -a "x$HAVE_OPENGL" = xyes -a "x$HAVE_SDL" = xyes; then
|
||||||
VID_REFS="$VID_REFS ref_sdlgl.so"
|
VID_REFS="$VID_REFS ref_sdlgl.la"
|
||||||
BUILD_SDLGL="yes"
|
BUILD_SDLGL="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -371,7 +398,7 @@ AM_CONDITIONAL(BUILD_SOFT, test "x$BUILD_SOFT" = xyes)
|
||||||
AM_CONDITIONAL(BUILD_SOFTX, test "x$BUILD_SOFTX" = xyes)
|
AM_CONDITIONAL(BUILD_SOFTX, test "x$BUILD_SOFTX" = xyes)
|
||||||
AM_CONDITIONAL(BUILD_SOFTSDL, test "x$BUILD_SOFTSDL" = xyes)
|
AM_CONDITIONAL(BUILD_SOFTSDL, test "x$BUILD_SOFTSDL" = xyes)
|
||||||
AM_CONDITIONAL(BUILD_GLX, test "x$BUILD_GLX" = xyes)
|
AM_CONDITIONAL(BUILD_GLX, test "x$BUILD_GLX" = xyes)
|
||||||
AM_CONDITIONAL(BUILD_FXGL, test "x$BUILD_FXGL" = xyes)
|
AM_CONDITIONAL(BUILD_TDFX, test "x$BUILD_TDFX" = xyes)
|
||||||
AM_CONDITIONAL(BUILD_SDLGL, test "x$BUILD_SDLGL" = xyes)
|
AM_CONDITIONAL(BUILD_SDLGL, test "x$BUILD_SDLGL" = xyes)
|
||||||
|
|
||||||
AC_SUBST(VID_REFS)
|
AC_SUBST(VID_REFS)
|
||||||
|
@ -390,6 +417,7 @@ AC_CONFIG_FILES([
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
VID_REFS=`echo $VID_REFS | sed -e 's/ref_//g' -e 's/\.la//g'`
|
||||||
AC_MSG_RESULT([
|
AC_MSG_RESULT([
|
||||||
Video refreshers: ${VID_REFS- no}
|
Video refreshers: ${VID_REFS- none}
|
||||||
])
|
])
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
|
|
||||||
SUBDIRS = . baseq2 ctf xatrix rogue
|
SUBDIRS = . baseq2 ctf xatrix rogue
|
||||||
|
|
||||||
bin_PROGRAMS = quake2 @VID_REFS@
|
ALL_CFLAGS = -Wall -Werror -pipe
|
||||||
|
AM_LDFLAGS = -module -avoid-version -rpath $(pkglibdir)
|
||||||
|
#AM_LDFLAGS = -shared
|
||||||
|
|
||||||
EXTRA_PROGRAMS = ref_soft.so ref_softx.so ref_softsdl.so \
|
bin_PROGRAMS = quake2
|
||||||
ref_glx.so ref_sdlgl.so ref_fxgl.so
|
pkglib_PROGRAMS = @VID_REFS@
|
||||||
|
EXTRA_PROGRAMS = ref_soft.la ref_softx.la ref_softsdl.la \
|
||||||
|
ref_glx.la ref_sdlgl.la ref_tdfx.la
|
||||||
|
|
||||||
# Common source files
|
# Common source files
|
||||||
REF_GL_COMMON = q_sh.c q_shared.c glob.c qgl.c \
|
REF_GL_COMMON = q_sh.c q_shared.c glob.c qgl.c \
|
||||||
|
@ -48,66 +52,54 @@ quake2_SOURCES = main.c q_sh.c vid_menu.c vid_so.c glob.c net_udp.c \
|
||||||
m_flash.c
|
m_flash.c
|
||||||
# \
|
# \
|
||||||
# #snd_mixa.S
|
# #snd_mixa.S
|
||||||
|
quake2_CFLAGS = $(ALL_CFLAGS) @INCLTDL@
|
||||||
quake2_LDFLAGS = -lm -pthread @DL_LIBS@
|
quake2_LDFLAGS = -lm -pthread
|
||||||
|
quake2_LDADD = @LIBLTDL@
|
||||||
#AM_CFLAGS = -Wall -Werror -pipe -I/usr/X11R6/include $(shell sdl-config --cflags) -DOPENGL -fPIC
|
|
||||||
AM_CFLAGS = -Wall -Werror -pipe
|
|
||||||
|
|
||||||
# ref_glx
|
# ref_glx
|
||||||
if BUILD_GLX
|
if BUILD_GLX
|
||||||
ref_glx_so_SOURCES = $(REF_GL_COMMON) gl_glx.c
|
ref_glx_la_SOURCES = $(REF_GL_COMMON) gl_glx.c
|
||||||
ref_glx_so_CFLAGS = -fPIC @X_CFLAGS@ @OPENGL_CFLAGS@
|
ref_glx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @X_CFLAGS@ @OPENGL_CFLAGS@
|
||||||
ref_glx_so_LDFLAGS = -shared
|
ref_glx_la_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@ @OPENGL_LIBS@ @DL_LIBS@
|
||||||
#ref_glx_so_LDADD = -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm -lGL
|
|
||||||
ref_glx_so_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@ @OPENGL_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ref_fxgl
|
# ref_tdfx
|
||||||
if BUILD_FXGL
|
if BUILD_TDFX
|
||||||
ref_fxgl_so_SOURCES = $(REF_GL_COMMON) rw_in_svgalib.c gl_fxmesa.c
|
ref_tdfx_la_SOURCES = $(REF_GL_COMMON) rw_in_svgalib.c gl_fxmesa.c
|
||||||
ref_fxgl_so_CFLAGS = -fPIC @GLIDE_CFLAGS@ @X_CFLAGS@ @SVGALIB_CFLAGS@
|
ref_tdfx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @GLIDE_CFLAGS@ @X_CFLAGS@ @SVGALIB_CFLAGS@
|
||||||
#ref_fxgl_so_LDFLAGS = -shared -L/usr/local/glide/lib -L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXext -lGL -lvga
|
ref_tdfx_la_LDADD = @GLIDE_LIBS@ @X_LIBS@ @SVGALIB_LIBS@
|
||||||
#ref_fxgl_so_LDFADD = -L/usr/local/glide/lib -L/usr/X11R6/lib -L/usr/local/lib -lX11 -lXext -lGL -lvga
|
|
||||||
ref_fxgl_so_LDFLAGS = -shared
|
|
||||||
ref_fxgl_so_LDADD = @GLIDE_LIBS@ @X_LIBS@ @SVGALIB_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ref_sdlgl
|
# ref_sdlgl
|
||||||
if BUILD_SDLGL
|
if BUILD_SDLGL
|
||||||
ref_sdlgl_so_SOURCES = $(REF_GL_COMMON) rw_sdl.c
|
ref_sdlgl_la_SOURCES = $(REF_GL_COMMON) rw_sdl.c
|
||||||
ref_sdlgl_so_CFLAGS = -fPIC -DOPENGL @SDL_CFLAGS@ @OPENGL_CFLAGS@
|
ref_sdlgl_la_CFLAGS = $(ALL_CFLAGS) -fPIC -DOPENGL @SDL_CFLAGS@ @OPENGL_CFLAGS@
|
||||||
ref_sdlgl_so_LDFLAGS = -shared
|
ref_sdlgl_la_LDADD = @SDL_LIBS@ @OPENGL_LIBS@
|
||||||
ref_sdlgl_so_LDADD = @SDL_LIBS@ @OPENGL_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ref_soft
|
# ref_soft
|
||||||
if BUILD_SOFT
|
if BUILD_SOFT
|
||||||
if ASM_ARCH
|
if ASM_ARCH
|
||||||
SOFT_ASM=$(REF_SOFT_ASM) d_copy.S
|
DCOPY_S = d_copy.S
|
||||||
else
|
else
|
||||||
SOFT_ASM=$(REF_SOFT_ASM)
|
DCOPY_S =
|
||||||
endif
|
endif
|
||||||
ref_soft_so_SOURCES = $(REF_SOFT_COMMON) $(SOFT_ASM) \
|
ref_soft_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) $(DCOPY_S) \
|
||||||
rw_svgalib.c rw_in_svgalib.c
|
rw_svgalib.c rw_in_svgalib.c
|
||||||
ref_soft_so_CFLAGS = -fPIC @SVGALIB_CFLAGS@
|
ref_soft_la_CFLAGS = $(ALL_CFLAGS) -fPIC @SVGALIB_CFLAGS@
|
||||||
ref_soft_so_LDFLAGS = -shared
|
ref_soft_la_LDADD = @SVGALIB_LIBS@
|
||||||
ref_soft_so_LDADD = @SVGALIB_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ref_softx
|
# ref_softx
|
||||||
if BUILD_SOFTX
|
if BUILD_SOFTX
|
||||||
ref_softx_so_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_x11.c
|
ref_softx_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_x11.c
|
||||||
ref_softx_so_CFLAGS = -fPIC @X_CFLAGS@
|
ref_softx_la_CFLAGS = $(ALL_CFLAGS) -fPIC @X_CFLAGS@
|
||||||
ref_softx_so_LDFLAGS = -shared
|
ref_softx_la_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@
|
||||||
#ref_softx_so_LDADD = -L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
|
|
||||||
ref_softx_so_LDADD = @X_PRE_LIBS@ @X_LIBS@ @XTRA_LIBS@ @X_EXTRA_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ref_softsdl
|
# ref_softsdl
|
||||||
if BUILD_SOFTSDL
|
if BUILD_SOFTSDL
|
||||||
ref_softsdl_so_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_sdl.c
|
ref_softsdl_la_SOURCES = $(REF_SOFT_COMMON) $(REF_SOFT_ASM) rw_sdl.c
|
||||||
ref_softsdl_so_CFLAGS = -fPIC @SDL_CFLAGS@
|
ref_softsdl_la_CFLAGS = $(ALL_CFLAGS) -fPIC @SDL_CFLAGS@
|
||||||
ref_softsdl_so_LDFLAGS = -shared
|
ref_softsdl_la_LDADD = @SDL_LIBS@
|
||||||
ref_softsdl_so_LDADD = @SDL_LIBS@
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
# Process this file with automake to create Makefile.in
|
# Process this file with automake to create Makefile.in
|
||||||
|
|
||||||
bin_PROGRAMS = game.so
|
pkglibdir=$(libdir)/@PACKAGE@/baseq2
|
||||||
|
pkglib_PROGRAMS = game.so
|
||||||
game_so_SOURCES = g_ai.c \
|
game_so_SOURCES = g_ai.c \
|
||||||
p_client.c \
|
p_client.c \
|
||||||
g_chase.c \
|
g_chase.c \
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
bin_PROGRAMS = game.so
|
pkglibdir=$(libdir)/@PACKAGE@/ctf
|
||||||
|
pkglib_PROGRAMS = game.so
|
||||||
game_so_SOURCES = \
|
game_so_SOURCES = \
|
||||||
g_ai.c \
|
g_ai.c \
|
||||||
g_chase.c \
|
g_chase.c \
|
||||||
|
|
56
src/files.c
56
src/files.c
|
@ -1,22 +1,30 @@
|
||||||
/*
|
/* $Id$
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
*
|
||||||
|
* quake filesystem
|
||||||
|
*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (c) 2002 The Quakeforge Project.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
#ifdef HAVE_CONFIG_H
|
||||||
modify it under the terms of the GNU General Public License
|
# include "config.h"
|
||||||
as published by the Free Software Foundation; either version 2
|
#endif
|
||||||
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 "qcommon.h"
|
#include "qcommon.h"
|
||||||
|
|
||||||
|
@ -31,15 +39,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// OEM
|
// OEM
|
||||||
//#define PAK0_CHECKSUM 0x78e135c
|
//#define PAK0_CHECKSUM 0x78e135c
|
||||||
|
|
||||||
/*
|
|
||||||
=============================================================================
|
|
||||||
|
|
||||||
QUAKE FILESYSTEM
|
|
||||||
|
|
||||||
=============================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// in memory
|
// in memory
|
||||||
//
|
//
|
||||||
|
@ -907,7 +906,8 @@ void FS_InitFilesystem (void)
|
||||||
//
|
//
|
||||||
// add baseq2 to search path
|
// add baseq2 to search path
|
||||||
//
|
//
|
||||||
FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
|
/*FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );*/
|
||||||
|
FS_AddGameDirectory(PKGDATADIR"/"BASEDIRNAME);
|
||||||
|
|
||||||
//
|
//
|
||||||
// then add a '.quake2/baseq2' directory in home directory by default
|
// then add a '.quake2/baseq2' directory in home directory by default
|
||||||
|
|
192
src/main.c
192
src/main.c
|
@ -53,9 +53,8 @@
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
/* libtool dynamic loader */
|
||||||
# include <dlfcn.h>
|
#include <ltdl.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
/* merged from sys_bsd.c -- jaq */
|
/* merged from sys_bsd.c -- jaq */
|
||||||
#ifndef RTLD_NOW
|
#ifndef RTLD_NOW
|
||||||
|
@ -119,12 +118,12 @@ void Sys_Printf (char *fmt, ...) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Quit (void)
|
void Sys_Quit (void) {
|
||||||
{
|
CL_Shutdown();
|
||||||
CL_Shutdown ();
|
Qcommon_Shutdown();
|
||||||
Qcommon_Shutdown ();
|
lt_dlexit();
|
||||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sys_Init(void)
|
void Sys_Init(void)
|
||||||
|
@ -223,89 +222,61 @@ char *Sys_ConsoleInput(void)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void *game_library;
|
static lt_dlhandle game_library = NULL;
|
||||||
|
typedef game_export_t * gameapi_t(game_import_t *);
|
||||||
|
|
||||||
/*
|
void Sys_UnloadGame(void) {
|
||||||
=================
|
if (game_library)
|
||||||
Sys_UnloadGame
|
lt_dlclose(game_library);
|
||||||
=================
|
game_library = NULL;
|
||||||
*/
|
|
||||||
void Sys_UnloadGame (void)
|
|
||||||
{
|
|
||||||
if (game_library)
|
|
||||||
dlclose (game_library);
|
|
||||||
game_library = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Loads the game dll */
|
||||||
=================
|
void *Sys_GetGameAPI (void *parms) {
|
||||||
Sys_GetGameAPI
|
gameapi_t * GetGameAPI;
|
||||||
|
cvar_t * gamename;
|
||||||
|
char path[MAX_OSPATH];
|
||||||
|
char * str_p;
|
||||||
|
|
||||||
|
setreuid(getuid(), getuid());
|
||||||
|
setegid(getgid());
|
||||||
|
|
||||||
|
if (game_library)
|
||||||
|
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
|
||||||
|
|
||||||
Loads the game dll
|
gamename = Cvar_Get("gamedir", BASEDIRNAME, CVAR_LATCH|CVAR_SERVERINFO);
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void *Sys_GetGameAPI (void *parms)
|
|
||||||
{
|
|
||||||
game_export_t *(*GetGameAPI) (game_import_t *);
|
|
||||||
|
|
||||||
char name[MAX_OSPATH];
|
Com_Printf("------- Loading %s -------\n", gamename->string);
|
||||||
char *path;
|
|
||||||
char *str_p;
|
/* set the module search path */
|
||||||
|
snprintf(path, MAX_OSPATH, ".:"PKGLIBDIR"/%s", gamename->string);
|
||||||
/* relnev 0.9 added -- jaq */
|
lt_dlsetsearchpath(path);
|
||||||
FILE * fp;
|
|
||||||
|
/* load the module */
|
||||||
const char * gamename = "game.so";
|
game_library = lt_dlopenext("game.so");
|
||||||
|
|
||||||
setreuid(getuid(), getuid());
|
if (game_library) {
|
||||||
setegid(getgid());
|
Com_MDPrintf("LoadLibrary (%s)\n", gamename->string);
|
||||||
|
} else {
|
||||||
if (game_library)
|
Com_MDPrintf("LoadLibrary (%s)\n", gamename->string);
|
||||||
Com_Error (ERR_FATAL, "Sys_GetGameAPI without Sys_UnloadingGame");
|
//str_p = strchr(lt_dlerror(), ':'); // skip the path (already shown)
|
||||||
|
str_p = (char *) lt_dlerror();
|
||||||
Com_Printf("------- Loading %s -------\n", gamename);
|
if (str_p != NULL) {
|
||||||
|
Com_MDPrintf (" **");
|
||||||
// now run through the search paths
|
while (*str_p)
|
||||||
path = NULL;
|
Com_MDPrintf ("%c", *(++str_p));
|
||||||
while (1)
|
Com_MDPrintf ("\n");
|
||||||
{
|
|
||||||
path = FS_NextPath (path);
|
|
||||||
if (!path)
|
|
||||||
return NULL; // couldn't find one anywhere
|
|
||||||
snprintf (name, MAX_OSPATH, "%s/%s", path, gamename);
|
|
||||||
|
|
||||||
/* relnev 0.9 added -- jaq */
|
|
||||||
/* skip it if it just doesn't exist */
|
|
||||||
fp = fopen(name, "rb");
|
|
||||||
if (fp == NULL)
|
|
||||||
continue;
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
game_library = dlopen(name, RTLD_NOW);
|
|
||||||
if (game_library) {
|
|
||||||
Com_MDPrintf ("LoadLibrary (%s)\n",name);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
Com_MDPrintf ("LoadLibrary (%s)\n", name);
|
|
||||||
str_p = strchr(dlerror(), ':'); // skip the path (already shown)
|
|
||||||
if (str_p != NULL) {
|
|
||||||
Com_MDPrintf (" **");
|
|
||||||
while (*str_p)
|
|
||||||
Com_MDPrintf ("%c", *(++str_p));
|
|
||||||
Com_MDPrintf ("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
GetGameAPI = (game_export_t * (*)(game_import_t *)) dlsym(game_library, "GetGameAPI");
|
|
||||||
|
GetGameAPI = (gameapi_t *) lt_dlsym(game_library, "GetGameAPI");
|
||||||
if (!GetGameAPI)
|
|
||||||
{
|
if (!GetGameAPI) {
|
||||||
Sys_UnloadGame ();
|
Sys_UnloadGame ();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetGameAPI (parms);
|
return GetGameAPI(parms);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -327,38 +298,37 @@ void Sys_SendKeyEvents (void)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv) {
|
||||||
{
|
int time, oldtime, newtime;
|
||||||
int time, oldtime, newtime;
|
|
||||||
|
|
||||||
// go back to real user for config loads
|
/* go back to real user for config loads */
|
||||||
saved_euid = geteuid();
|
saved_euid = geteuid();
|
||||||
seteuid(getuid());
|
seteuid(getuid());
|
||||||
|
|
||||||
/* relnev 0.9 added -- jaq */
|
printf("QuakeIIForge %s\n", VERSION);
|
||||||
printf("QuakeIIForge %s\n", VERSION);
|
|
||||||
|
|
||||||
Qcommon_Init(argc, argv);
|
/* initialiase libltdl */
|
||||||
|
lt_dlinit();
|
||||||
|
|
||||||
|
Qcommon_Init(argc, argv);
|
||||||
|
|
||||||
/* sys_irix.c had this and the fcntl line 3 lines down commented out */
|
/* sys_irix.c had this and the fcntl line 3 lines down commented out */
|
||||||
|
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||||
|
|
||||||
|
nostdout = Cvar_Get("nostdout", "0", 0);
|
||||||
|
if (!nostdout->value)
|
||||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||||
|
|
||||||
nostdout = Cvar_Get("nostdout", "0", 0);
|
/* main loop */
|
||||||
if (!nostdout->value) {
|
|
||||||
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
|
||||||
// printf ("Linux Quake -- Version %0.3f\n", LINUX_VERSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
oldtime = Sys_Milliseconds ();
|
oldtime = Sys_Milliseconds ();
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
/* find time spent rendering last frame */
|
||||||
// find time spent rendering last frame
|
do {
|
||||||
do {
|
newtime = Sys_Milliseconds();
|
||||||
newtime = Sys_Milliseconds ();
|
time = newtime - oldtime;
|
||||||
time = newtime - oldtime;
|
} while (time < 1);
|
||||||
} while (time < 1);
|
Qcommon_Frame(time);
|
||||||
Qcommon_Frame (time);
|
oldtime = newtime;
|
||||||
oldtime = newtime;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
/*
|
/* $Id$
|
||||||
Copyright (C) 1997-2001 Id Software, Inc.
|
*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
This program is free software; you can redistribute it and/or
|
* Copyright (c) 2002 The Quakeforge Project.
|
||||||
modify it under the terms of the GNU General Public License
|
*
|
||||||
as published by the Free Software Foundation; either version 2
|
* This program is free software; you can redistribute it and/or
|
||||||
of the License, or (at your option) any later version.
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
This program is distributed in the hope that it will be useful,
|
* of the License, or (at your option) any later version.
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
See the GNU General Public License for more details.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
You should have received a copy of the GNU General Public License
|
* See the GNU General Public License for more details.
|
||||||
along with this program; if not, write to the Free Software
|
*
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 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 "r_local.h"
|
#include "r_local.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
if DO_ROGUE
|
if DO_ROGUE
|
||||||
bin_PROGRAMS = game.so
|
pkglibdir=$(libdir)/@PACKAGE@/rogue
|
||||||
|
pkglib_PROGRAMS = game.so
|
||||||
|
|
||||||
game_so_SOURCES = dm_ball.c dm_tag.c \
|
game_so_SOURCES = dm_ball.c dm_tag.c \
|
||||||
g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
|
g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
|
||||||
|
|
312
src/vid_so.c
312
src/vid_so.c
|
@ -42,7 +42,11 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
/* libtool dynamic loader */
|
||||||
|
#include <ltdl.h>
|
||||||
|
|
||||||
/* merged in from bsd -- jaq */
|
/* merged in from bsd -- jaq */
|
||||||
|
/*
|
||||||
#ifndef RTLD_NOW
|
#ifndef RTLD_NOW
|
||||||
#define RTLD_NOW RTLD_LAZY
|
#define RTLD_NOW RTLD_LAZY
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,6 +58,7 @@
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
#define dlsym(X, Y) dlsym(X, "_"##Y)
|
#define dlsym(X, Y) dlsym(X, "_"##Y)
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "rw.h"
|
#include "rw.h"
|
||||||
|
@ -62,9 +67,11 @@
|
||||||
refexport_t re;
|
refexport_t re;
|
||||||
|
|
||||||
/* merged from irix/vid_so.c -- jaq */
|
/* merged from irix/vid_so.c -- jaq */
|
||||||
|
/*
|
||||||
#ifdef REF_HARD_LINKED
|
#ifdef REF_HARD_LINKED
|
||||||
refexport_t GetRefAPI(refimport_t rimp);
|
refexport_t GetRefAPI(refimport_t rimp);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
// Console variables that we need to access from this module
|
// Console variables that we need to access from this module
|
||||||
cvar_t *vid_gamma;
|
cvar_t *vid_gamma;
|
||||||
|
@ -75,7 +82,7 @@ cvar_t *vid_fullscreen;
|
||||||
|
|
||||||
// Global variables used internally by this module
|
// Global variables used internally by this module
|
||||||
viddef_t viddef; // global video state; used by other modules
|
viddef_t viddef; // global video state; used by other modules
|
||||||
void *reflib_library; // Handle to refresh DLL
|
lt_dlhandle reflib_library = NULL; // Handle to refresh DLL
|
||||||
qboolean reflib_active = 0;
|
qboolean reflib_active = 0;
|
||||||
|
|
||||||
#define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
|
#define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
|
||||||
|
@ -213,9 +220,13 @@ void VID_FreeReflib (void)
|
||||||
if (RW_IN_Shutdown_fp)
|
if (RW_IN_Shutdown_fp)
|
||||||
RW_IN_Shutdown_fp();
|
RW_IN_Shutdown_fp();
|
||||||
/* merged from irix/vid_so.c -- jaq */
|
/* merged from irix/vid_so.c -- jaq */
|
||||||
|
/*
|
||||||
#ifndef REF_HARD_LINKED
|
#ifndef REF_HARD_LINKED
|
||||||
dlclose(reflib_library);
|
*/
|
||||||
|
lt_dlclose(reflib_library);
|
||||||
|
/*
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
KBD_Init_fp = NULL;
|
KBD_Init_fp = NULL;
|
||||||
|
@ -239,193 +250,142 @@ void VID_FreeReflib (void)
|
||||||
VID_LoadRefresh
|
VID_LoadRefresh
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
qboolean VID_LoadRefresh( char *name )
|
qboolean VID_LoadRefresh(char * name) {
|
||||||
{
|
refimport_t ri;
|
||||||
refimport_t ri;
|
GetRefAPI_t GetRefAPI;
|
||||||
/* from irix/vid_so.c -- jaq */
|
extern uid_t saved_euid;
|
||||||
#ifndef REF_HARD_LINKED
|
|
||||||
GetRefAPI_t GetRefAPI;
|
|
||||||
#endif
|
|
||||||
char fn[MAX_OSPATH];
|
|
||||||
char *path;
|
|
||||||
struct stat st;
|
|
||||||
extern uid_t saved_euid;
|
|
||||||
|
|
||||||
if ( reflib_active )
|
/* clean up a previous reflib */
|
||||||
{
|
if (reflib_active) {
|
||||||
if (KBD_Close_fp)
|
if (KBD_Close_fp)
|
||||||
KBD_Close_fp();
|
KBD_Close_fp();
|
||||||
if (RW_IN_Shutdown_fp)
|
if (RW_IN_Shutdown_fp)
|
||||||
RW_IN_Shutdown_fp();
|
RW_IN_Shutdown_fp();
|
||||||
KBD_Close_fp = NULL;
|
KBD_Close_fp = NULL;
|
||||||
RW_IN_Shutdown_fp = NULL;
|
RW_IN_Shutdown_fp = NULL;
|
||||||
re.Shutdown();
|
re.Shutdown();
|
||||||
VID_FreeReflib ();
|
VID_FreeReflib ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from irix/vid_so.c -- jaq */
|
Com_Printf( "------- Loading %s -------\n", name );
|
||||||
#ifndef REF_HARD_LINKED
|
|
||||||
|
|
||||||
Com_Printf( "------- Loading %s -------\n", name );
|
//regain root
|
||||||
|
seteuid(saved_euid);
|
||||||
|
|
||||||
//regain root
|
lt_dlsetsearchpath(".:"PKGLIBDIR);
|
||||||
seteuid(saved_euid);
|
|
||||||
|
|
||||||
path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
|
// permission checking
|
||||||
|
if (strstr(name, "softx") == NULL &&
|
||||||
|
strstr(name, "glx") == NULL &&
|
||||||
|
strstr(name, "softsdl") == NULL &&
|
||||||
|
strstr(name, "sdlgl") == NULL &&
|
||||||
|
strstr(name, "fxgl") == NULL) { /* ref_soft doesn't require root */
|
||||||
|
/*
|
||||||
|
if (st.st_uid != 0) {
|
||||||
|
Com_Printf( "LoadLibrary(\"%s\") failed: ref is not owned by root\n", name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((st.st_mode & 0777) & ~0700) {
|
||||||
|
Com_Printf( "LoadLibrary(\"%s\") failed: invalid permissions, must be 700 for security considerations\n", name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
/* ref_soft requires we give up root now */
|
||||||
|
setreuid(getuid(), getuid());
|
||||||
|
setegid(getgid());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((reflib_library = lt_dlopenext(name)) == 0) {
|
||||||
|
Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name , lt_dlerror());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Com_Printf( "LoadLibrary(\"%s\")\n", name );
|
||||||
|
|
||||||
|
ri.Cmd_AddCommand = Cmd_AddCommand;
|
||||||
|
ri.Cmd_RemoveCommand = Cmd_RemoveCommand;
|
||||||
|
ri.Cmd_Argc = Cmd_Argc;
|
||||||
|
ri.Cmd_Argv = Cmd_Argv;
|
||||||
|
ri.Cmd_ExecuteText = Cbuf_ExecuteText;
|
||||||
|
ri.Con_Printf = VID_Printf;
|
||||||
|
ri.Sys_Error = VID_Error;
|
||||||
|
ri.FS_LoadFile = FS_LoadFile;
|
||||||
|
ri.FS_FreeFile = FS_FreeFile;
|
||||||
|
ri.FS_Gamedir = FS_Gamedir;
|
||||||
|
ri.Cvar_Get = Cvar_Get;
|
||||||
|
ri.Cvar_Set = Cvar_Set;
|
||||||
|
ri.Cvar_SetValue = Cvar_SetValue;
|
||||||
|
ri.Vid_GetModeInfo = VID_GetModeInfo;
|
||||||
|
ri.Vid_MenuInit = VID_MenuInit;
|
||||||
|
ri.Vid_NewWindow = VID_NewWindow;
|
||||||
|
|
||||||
|
if ((GetRefAPI = (GetRefAPI_t) lt_dlsym(reflib_library, "GetRefAPI")) == 0)
|
||||||
|
Com_Error(ERR_FATAL, "dlsym failed on %s", name);
|
||||||
|
|
||||||
|
re = GetRefAPI( ri );
|
||||||
|
|
||||||
|
if (re.api_version != API_VERSION) {
|
||||||
|
VID_FreeReflib ();
|
||||||
|
Com_Error (ERR_FATAL, "%s has incompatible api_version", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Init IN (Mouse) */
|
||||||
|
in_state.IN_CenterView_fp = IN_CenterView;
|
||||||
|
in_state.Key_Event_fp = Do_Key_Event;
|
||||||
|
in_state.viewangles = cl.viewangles;
|
||||||
|
in_state.in_strafe_state = &in_strafe.state;
|
||||||
|
|
||||||
snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
|
if ((RW_IN_Init_fp = (void (*)(in_state_t *)) lt_dlsym(reflib_library, "RW_IN_Init")) == NULL ||
|
||||||
|
(RW_IN_Shutdown_fp = (void(*)(void)) lt_dlsym(reflib_library, "RW_IN_Shutdown")) == NULL ||
|
||||||
if (stat(fn, &st) == -1) {
|
(RW_IN_Activate_fp = (void(*)(qboolean)) lt_dlsym(reflib_library, "RW_IN_Activate")) == NULL ||
|
||||||
Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno));
|
(RW_IN_Commands_fp = (void(*)(void)) lt_dlsym(reflib_library, "RW_IN_Commands")) == NULL ||
|
||||||
return false;
|
(RW_IN_Move_fp = (void(*)(usercmd_t *)) lt_dlsym(reflib_library, "RW_IN_Move")) == NULL ||
|
||||||
}
|
(RW_IN_Frame_fp = (void(*)(void)) lt_dlsym(reflib_library, "RW_IN_Frame")) == NULL)
|
||||||
|
Sys_Error("No RW_IN functions in REF.\n");
|
||||||
// permission checking
|
|
||||||
if (strstr(fn, "softx") == NULL &&
|
/* this one is optional */
|
||||||
strstr(fn, "glx") == NULL &&
|
RW_Sys_GetClipboardData_fp = (char*(*)(void)) lt_dlsym(reflib_library, "RW_Sys_GetClipboardData");
|
||||||
strstr(fn, "softsdl") == NULL &&
|
|
||||||
strstr(fn, "sdlgl") == NULL &&
|
Real_IN_Init();
|
||||||
strstr(fn, "fxgl") == NULL) { // softx doesn't require root
|
|
||||||
#if 0
|
|
||||||
if (st.st_uid != 0) {
|
|
||||||
Com_Printf( "LoadLibrary(\"%s\") failed: ref is not owned by root\n", name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((st.st_mode & 0777) & ~0700) {
|
|
||||||
Com_Printf( "LoadLibrary(\"%s\") failed: invalid permissions, must be 700 for security considerations\n", name);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
// softx requires we give up root now
|
|
||||||
setreuid(getuid(), getuid());
|
|
||||||
setegid(getgid());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ( reflib_library = dlopen( fn, RTLD_LAZY | RTLD_GLOBAL ) ) == 0 )
|
if (re.Init(0, 0) == -1) {
|
||||||
{
|
re.Shutdown();
|
||||||
Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name , dlerror());
|
VID_FreeReflib ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Com_Printf( "LoadLibrary(\"%s\")\n", fn );
|
|
||||||
#endif /* REF_HARD_LINKED */
|
|
||||||
|
|
||||||
ri.Cmd_AddCommand = Cmd_AddCommand;
|
|
||||||
ri.Cmd_RemoveCommand = Cmd_RemoveCommand;
|
|
||||||
ri.Cmd_Argc = Cmd_Argc;
|
|
||||||
ri.Cmd_Argv = Cmd_Argv;
|
|
||||||
ri.Cmd_ExecuteText = Cbuf_ExecuteText;
|
|
||||||
ri.Con_Printf = VID_Printf;
|
|
||||||
ri.Sys_Error = VID_Error;
|
|
||||||
ri.FS_LoadFile = FS_LoadFile;
|
|
||||||
ri.FS_FreeFile = FS_FreeFile;
|
|
||||||
ri.FS_Gamedir = FS_Gamedir;
|
|
||||||
ri.Cvar_Get = Cvar_Get;
|
|
||||||
ri.Cvar_Set = Cvar_Set;
|
|
||||||
ri.Cvar_SetValue = Cvar_SetValue;
|
|
||||||
ri.Vid_GetModeInfo = VID_GetModeInfo;
|
|
||||||
ri.Vid_MenuInit = VID_MenuInit;
|
|
||||||
ri.Vid_NewWindow = VID_NewWindow;
|
|
||||||
|
|
||||||
#ifndef REF_HARD_LINKED
|
|
||||||
if ( ( GetRefAPI = (GetRefAPI_t) dlsym( reflib_library, "GetRefAPI" ) ) == 0 )
|
|
||||||
Com_Error( ERR_FATAL, "dlsym failed on %s", name );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
re = GetRefAPI( ri );
|
|
||||||
|
|
||||||
if (re.api_version != API_VERSION)
|
|
||||||
{
|
|
||||||
VID_FreeReflib ();
|
|
||||||
Com_Error (ERR_FATAL, "%s has incompatible api_version", name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Init IN (Mouse) */
|
|
||||||
in_state.IN_CenterView_fp = IN_CenterView;
|
|
||||||
in_state.Key_Event_fp = Do_Key_Event;
|
|
||||||
in_state.viewangles = cl.viewangles;
|
|
||||||
in_state.in_strafe_state = &in_strafe.state;
|
|
||||||
|
|
||||||
#ifndef REF_HARD_LINKED
|
|
||||||
if ((RW_IN_Init_fp = (void (*)(in_state_t *)) dlsym(reflib_library, "RW_IN_Init")) == NULL ||
|
|
||||||
(RW_IN_Shutdown_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Shutdown")) == NULL ||
|
|
||||||
(RW_IN_Activate_fp = (void(*)(qboolean)) dlsym(reflib_library, "RW_IN_Activate")) == NULL ||
|
|
||||||
(RW_IN_Commands_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Commands")) == NULL ||
|
|
||||||
(RW_IN_Move_fp = (void(*)(usercmd_t *)) dlsym(reflib_library, "RW_IN_Move")) == NULL ||
|
|
||||||
(RW_IN_Frame_fp = (void(*)(void)) dlsym(reflib_library, "RW_IN_Frame")) == NULL)
|
|
||||||
Sys_Error("No RW_IN functions in REF.\n");
|
|
||||||
|
|
||||||
/* this one is optional */
|
|
||||||
RW_Sys_GetClipboardData_fp = (char*(*)(void)) dlsym(reflib_library, "RW_Sys_GetClipboardData");
|
|
||||||
|
|
||||||
Real_IN_Init();
|
|
||||||
#else /* ref-hard-linked */
|
|
||||||
{
|
|
||||||
void RW_IN_Init(in_state_t *in_state_p);
|
|
||||||
void RW_IN_Shutdown(void);
|
|
||||||
void RW_IN_Commands (void);
|
|
||||||
void RW_IN_Move (usercmd_t *cmd);
|
|
||||||
void RW_IN_Frame (void);
|
|
||||||
void RW_IN_Activate(void);
|
|
||||||
|
|
||||||
RW_IN_Init_fp = RW_IN_Init;
|
|
||||||
RW_IN_Shutdown_fp = RW_IN_Shutdown;
|
|
||||||
RW_IN_Activate_fp = (void(*)(qboolean))RW_IN_Activate;
|
|
||||||
RW_IN_Commands_fp = RW_IN_Commands;
|
|
||||||
RW_IN_Move_fp = RW_IN_Move;
|
|
||||||
RW_IN_Frame_fp = RW_IN_Frame;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( re.Init( 0, 0 ) == -1 )
|
|
||||||
{
|
|
||||||
re.Shutdown();
|
|
||||||
VID_FreeReflib ();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* merged in from irix/vid_so.c */
|
/* merged in from irix/vid_so.c */
|
||||||
|
/*
|
||||||
#ifdef __sgi
|
#ifdef __sgi
|
||||||
/* give up root now */
|
give up root now
|
||||||
setreuid(getuid(), getuid());
|
setreuid(getuid(), getuid());
|
||||||
setegid(getgid());
|
setegid(getgid());
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
/* Init KBD */
|
/* Init KBD */
|
||||||
#ifndef REF_HARD_LINKED
|
if ((KBD_Init_fp = (void(*)(Key_Event_fp_t)) lt_dlsym(reflib_library, "KBD_Init")) == NULL ||
|
||||||
if ((KBD_Init_fp = (void(*)(Key_Event_fp_t)) dlsym(reflib_library, "KBD_Init")) == NULL ||
|
(KBD_Update_fp = (void(*)(void)) lt_dlsym(reflib_library, "KBD_Update")) == NULL ||
|
||||||
(KBD_Update_fp = (void(*)(void)) dlsym(reflib_library, "KBD_Update")) == NULL ||
|
(KBD_Close_fp = (void(*)(void)) lt_dlsym(reflib_library, "KBD_Close")) == NULL)
|
||||||
(KBD_Close_fp = (void(*)(void)) dlsym(reflib_library, "KBD_Close")) == NULL)
|
Sys_Error("No KBD functions in REF.\n");
|
||||||
Sys_Error("No KBD functions in REF.\n");
|
|
||||||
#else
|
|
||||||
{
|
|
||||||
void KBD_Init(void);
|
|
||||||
void KBD_Update(void);
|
|
||||||
void KBD_Close(void);
|
|
||||||
|
|
||||||
KBD_Init_fp = (void(*)(Key_Event_fp_t))KBD_Init;
|
KBD_Init_fp(Do_Key_Event);
|
||||||
KBD_Update_fp = KBD_Update;
|
|
||||||
KBD_Close_fp = KBD_Close;
|
/* for some reason irix has this swapped with elsewhere, kinda dodgy, needs
|
||||||
}
|
* cleaning */
|
||||||
#endif
|
Key_ClearStates();
|
||||||
KBD_Init_fp(Do_Key_Event);
|
|
||||||
|
// give up root now
|
||||||
/* for some reason irix has this swapped with elsewhere, kinda dodgy, needs
|
setreuid(getuid(), getuid());
|
||||||
* cleaning */
|
setegid(getgid());
|
||||||
#ifndef __sgi
|
/* sgi
|
||||||
Key_ClearStates();
|
Real_IN_Init();
|
||||||
|
*/
|
||||||
// give up root now
|
|
||||||
setreuid(getuid(), getuid());
|
Com_Printf( "------------------------------------\n");
|
||||||
setegid(getgid());
|
reflib_active = true;
|
||||||
#else
|
return true;
|
||||||
Real_IN_Init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Com_Printf( "------------------------------------\n");
|
|
||||||
reflib_active = true;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
if DO_XATRIX
|
if DO_XATRIX
|
||||||
bin_PROGRAMS = game.so
|
pkglibdir=$(libdir)/@PACKAGE@/xatrix
|
||||||
|
pkglib_PROGRAMS = game.so
|
||||||
|
|
||||||
game_so_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
|
game_so_SOURCES = g_ai.c g_chase.c g_cmds.c g_combat.c g_func.c \
|
||||||
g_items.c g_main.c g_misc.c g_monster.c g_phys.c \
|
g_items.c g_main.c g_misc.c g_monster.c g_phys.c \
|
||||||
|
|
Loading…
Reference in a new issue