Fixed some bugs with servers using gnutls.

Attempted to clean up build configs slightly, now ALWAYS using a build config.
Now enabling wayland renderer by default on linux (activates by default only when x11 fails).
Given linux servers the ability to chroot (will be used by default if run as suid-root).
Fixed a couple of vulkan warnings.
Makefile now treats speex like any other library.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5227 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-03-24 04:02:09 +00:00
parent 93624e9d62
commit 7f2c356133
48 changed files with 1946 additions and 586 deletions

View File

@ -33,8 +33,8 @@ ANDROID_ZIPALIGN=$ANDROIDROOT/build-tools/$ANDROIDBUILDTOOLS/zipalign #relative
THREADS="-j 4"
TARGETS_LINUX=qcc-rel rel dbg vk-rel plugins-rel plugins-dbg
TARGETS_WINDOWS=sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel
TARGETS_LINUX="qcc-rel rel dbg vk-rel plugins-rel plugins-dbg"
TARGETS_WINDOWS="sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel"
@ -242,7 +242,7 @@ debianpackages subversion make automake libtool p7zip-full zip || otherpackages
if [ "$BUILD_LINUXx86" == "y" ]; then
#for building linux targets
debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev libvorbis-dev || otherpackages gcc || exit
debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev || otherpackages gcc || exit
jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit
if [[ "$PLUGINS_LINUXx86" =~ "ffmpeg" ]]; then
debianpackages libswscale-dev libavcodec-dev || otherpackages || exit

View File

@ -32,6 +32,9 @@ VORBISVER=1.3.5
SDL2VER=2.0.7
SCINTILLAVER=373
OPUSVER=1.2.1
SPEEXVER=1.2.0
SPEEXDSPVER=1.2rc3
FREETYPEVER=2.9
#only limited forms of cross-making is supported
#only the following 3 are supported
@ -90,6 +93,9 @@ endif
ifeq (,$(findstring DNO_VORBISFILE,$(FTE_CONFIG_EXTRA)))
USE_VORBISFILE=1
endif
#ifeq (,$(findstring DNO_FREETYPE,$(FTE_CONFIG_EXTRA)))
# USE_FREETYPE=1
#endif
ifneq (,$(findstring -Os,$(FTE_CONFIG_EXTRA)))
CPUOPTIMIZATIONS+=-Os
BRANDFLAGS:=$(filter-out -O%,$(BRANDFLAGS))
@ -518,7 +524,7 @@ endif
SDL_INCLUDES=
#-I$(LIBS_DIR)/sdl/include -I/usr/include/SDL -I$(LIBS_DIR)/sdl/include/SDL
BASE_CFLAGS=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D_DIR) -I$(PROGS_DIR) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex $(BOTLIB_CFLAGS) $(SVNREVISION)
BASE_CFLAGS=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(CLIENT_DIR) -I$(SERVER_DIR) -I$(COMMON_DIR) -I$(GL_DIR) -I$(D3D_DIR) -I$(PROGS_DIR) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) -I./libs/freetype2/include -I./libs/freetype2/include/freetype $(BOTLIB_CFLAGS) $(SVNREVISION)
CLIENT_ONLY_CFLAGS=-DCLIENTONLY
SERVER_ONLY_CFLAGS=-DSERVERONLY
JOINT_CFLAGS=
@ -561,53 +567,6 @@ D3DCFLAGS?=-DD3D9QUAKE -DD3D11QUAKE
VKCFLAGS?=-DVKQUAKE
NPFTECFLAGS=-DNPFTE
ifeq (1,$(USE_SPEEX))
SPEEXCFLAGS=-DSPEEX_STATIC -I$(BASE_DIR)/libs/speex/include -DFIXED_POINT -DUSE_KISS_FFT -DEXPORT=""
SPEEX_OBJS = \
bits.o \
buffer.o \
cb_search.o \
exc_10_16_table.o \
exc_10_32_table.o \
exc_20_32_table.o \
exc_5_256_table.o \
exc_5_64_table.o \
exc_8_128_table.o \
fftwrap.o \
filterbank.o \
filters.o \
gain_table.o \
gain_table_lbr.o \
hexc_10_32_table.o \
hexc_table.o \
high_lsp_tables.o \
jitter.o \
kiss_fft.o \
kiss_fftr.o \
lpc.o \
lsp.o \
lsp_tables_nb.o \
ltp.o \
mdf.o \
modes.o \
modes_wb.o \
nb_celp.o \
preprocess.o \
quant_lsp.o \
resample.o \
sb_celp.o \
scal.o \
smallft.o \
speex.o \
speex_callbacks.o \
speex_header.o \
stereo.o \
vbr.o \
vq.o \
window.o
endif
CLIENT_OBJS = \
textedit.o \
fragstats.o \
@ -869,6 +828,10 @@ ifeq (1,$(USE_OPUS))
LIBOPUS_STATIC=-DOPUS_STATIC
LIBOPUS_LDFLAGS=-lopus
endif
ifeq (1,$(USE_SPEEX))
LIBSPEEX_STATIC=-DSPEEX_STATIC
LIBSPEEX_LDFLAGS=-lspeex -lspeexdsp
endif
ifeq (1,$(USE_VORBISFILE))
OGGVORBISFILE_STATIC=-DLIBVORBISFILE_STATIC
@ -876,12 +839,16 @@ else
OGGVORBISLDFLAGS=
OGGVORBISFILE_STATIC=
endif
ifeq (1,$(USE_FREETYPE))
LIBFREETYPE_STATIC=-DFREETYPE_STATIC
LIBFREETYPE_LDFLAGS=-lfreetype
endif
COMMONLIBFLAGS=
CLIENTLIBFLAGS=$(COMMONLIBFLAGS) $(LIBOPUS_STATIC) $(OGGVORBISFILE_STATIC)
CLIENTLIBFLAGS=$(COMMONLIBFLAGS) $(LIBOPUS_STATIC) $(LIBSPEEX_STATIC) $(OGGVORBISFILE_STATIC) $(LIBFREETYPE_STATIC)
SERVERLIBFLAGS=$(COMMONLIBFLAGS)
COMMONLDDEPS=
CLIENTLDDEPS=$(COMMONLDDEPS) $(LIBOPUS_LDFLAGS) $(OGGVORBISLDFLAGS)
CLIENTLDDEPS=$(COMMONLDDEPS) $(LIBOPUS_LDFLAGS) $(LIBSPEEX_LDFLAGS) $(OGGVORBISLDFLAGS) $(LIBFREETYPE_LDFLAGS)
SERVERLDDEPS=$(COMMONLDDEPS)
#the defaults for sdl come first
@ -921,7 +888,7 @@ GLB_DIR=gl_$(FTE_FULLTARGET)
GLCL_DIR=glcl_$(FTE_FULLTARGET)
SV_DIR?=sv_$(FTE_FULLTARGET)
VKCL_OBJS=$(VKQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END)
VKCL_OBJS=$(VKQUAKE_OBJS) $(BOTLIB_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END)
VK_CFLAGS=-DFTE_SDL $(VKCFLAGS) `$(SDLCONFIG) --cflags`
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(SERVERONLY_OBJS) $(BOTLIB_OBJS)
@ -993,11 +960,10 @@ ifeq ($(FTE_TARGET),nacl)
IMAGELDFLAGS =
GL_CFLAGS=$(GLCFLAGS)
GL_CFLAGS+=$(SPEEXCFLAGS)
GL_CFLAGS+=-I$(realpath $(NACL_SDK_ROOT)/include)
BASELDFLAGS+=-L$(realpath $(NACL_SDK_ROOT)/lib/$(NACLLIBS))
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o fs_ppapi.o snd_ppapi.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o fs_ppapi.o snd_ppapi.o
GL_LDFLAGS=$(GLLDFLAGS) $(CLIENTLDDEPS)
M_LDFLAGS=$(GLLDFLAGS) $(CLIENTLDDEPS)
@ -1031,7 +997,7 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
ARCH_CFLAGS=`$(SDLCONFIG) --cflags`
#the defaults for sdl come first
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
GL_EXE_NAME=../$(EXE_NAME)-sdl-gl$(BITS)$(EXEPOSTFIX)
GLCL_EXE_NAME=../$(EXE_NAME)-sdl-glcl$(BITS)$(EXEPOSTFIX)
ifdef windir
@ -1048,7 +1014,7 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
QCC_LDFLAGS=$(MINGW_LIBS_DIR)/libz.a
endif
GL_CFLAGS=-DFTE_SDL -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -I$(LIBS_DIR) $(GLCFLAGS) $(CLIENTLIBFLAGS) $(DX7SDK) $(SPEEXCFLAGS)
GL_CFLAGS=-DFTE_SDL -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) -I$(LIBS_DIR) $(GLCFLAGS) $(CLIENTLIBFLAGS) $(DX7SDK)
GLB_DIR=gl_mgw_sdl$(BITS)
GLCL_DIR=glcl_mgw_sdl$(BITS)
@ -1063,25 +1029,25 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../$(EXE_NAME)-sdl$(BITS)$(EXEPOSTFIX)
#with d3d...
#MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
#M_CFLAGS=$(D3DCFLAGS) $(VKCFLAGS) $(GLCFLAGS) -DFTE_SDL -I$(LIBS_DIR) -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK) $(SPEEXCFLAGS)
#MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
#M_CFLAGS=$(D3DCFLAGS) $(VKCFLAGS) $(GLCFLAGS) -DFTE_SDL -I$(LIBS_DIR) -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK)
#without d3d...
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS=$(VKCFLAGS) $(GLCFLAGS) -DFTE_SDL -I$(LIBS_DIR) -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK) $(SPEEXCFLAGS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(LTO_END) resources.o $(LTO_START)
M_CFLAGS=$(VKCFLAGS) $(GLCFLAGS) -DFTE_SDL -I$(LIBS_DIR) -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(BOTLIB_OBJS) snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
D3D_EXE_NAME=../$(EXE_NAME)-sdl-d3d$(BITS)$(EXEPOSTFIX)
D3DCL_EXE_NAME=../$(EXE_NAME)-sdl-d3dcl$(BITS)$(EXEPOSTFIX)
D3D_LDFLAGS=$(IMAGELDFLAGS) $(CLIENTLDDEPS) -lws2_32 -lmingw32 $(SDL_LDFLAGS) -mwindows -ldxguid -lwinmm -lole32
D3D_CFLAGS=$(D3DCFLAGS) -DFTE_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK) $(SPEEXCFLAGS)
D3D_CFLAGS=$(D3DCFLAGS) -DFTE_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK)
D3DB_DIR=sdl_d3d_mgw$(BITS)
D3DCL_DIR=sdl_d3dcl_mgw$(BITS)
VKCL_OBJS=$(VKQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_bloom.o gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
VKCL_OBJS=$(VKQUAKE_OBJS) $(BOTLIB_OBJS) gl_bloom.o gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o $(D3DGL_OBJS) $(LTO_END) resources.o $(LTO_START)
VK_EXE_NAME=../$(EXE_NAME)-sdl-vk$(BITS)$(EXEPOSTFIX)
VKCL_EXE_NAME=../$(EXE_NAME)-sdl-vkcl$(BITS)$(EXEPOSTFIX)
VK_CFLAGS=$(VKCFLAGS) -DFTE_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK) $(SPEEXCFLAGS)
VK_CFLAGS=$(VKCFLAGS) -DFTE_SDL -DNO_XFLIP -I$(LIBS_DIR) -I$(MINGW_LIBS_DIR)/ -I$(MINGW_LIBS_DIR) $(CLIENTLIBFLAGS) $(DX7SDK)
VKB_DIR=sdl_vk_mgw$(BITS)
VKCL_DIR=sdl_vkcl_mgw$(BITS)
@ -1156,9 +1122,7 @@ ifeq ($(FTE_TARGET),vc)
LIBS_DIR=./libs/
SPEEXCFLAGS+= -Dinline=_inline -D_USE_MATH_DEFINES
BASE_CFLAGS:=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(shell cygpath -m $(CLIENT_DIR)) -I$(shell cygpath -m $(SERVER_DIR)) -I$(shell cygpath -m $(COMMON_DIR)) -I$(shell cygpath -m $(GL_DIR)) -I$(shell cygpath -m $(D3D_DIR)) -I$(shell cygpath -m $(PROGS_DIR)) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) -I./libs/freetype2/include -I./libs/freetype2/include/freetype -I./libs/speex $(BOTLIB_CFLAGS) $(SVNREVISION)
BASE_CFLAGS:=$(WARNINGFLAGS) $(GNUC_FUNCS) -I$(shell cygpath -m $(CLIENT_DIR)) -I$(shell cygpath -m $(SERVER_DIR)) -I$(shell cygpath -m $(COMMON_DIR)) -I$(shell cygpath -m $(GL_DIR)) -I$(shell cygpath -m $(D3D_DIR)) -I$(shell cygpath -m $(PROGS_DIR)) -I. -I$(LIBS_DIR) -I$(LIBS_DIR)/dxsdk9/include -I$(LIBS_DIR)/dxsdk7/include $(SDL_INCLUDES) -I./libs/freetype2/include -I./libs/freetype2/include/freetype $(BOTLIB_CFLAGS) $(SVNREVISION)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS) -DMULTITHREAD -DMSVCLIBPATH=libs/
SV_EXE_NAME=../$(EXE_NAME)-sv$(BITS)$(EXEPOSTFIX)
@ -1171,24 +1135,24 @@ ifeq ($(FTE_TARGET),vc)
GLB_DIR=gl_vc$(BITS)
GLCL_DIR=glcl_vc$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(JPEGLIB) libs/libpng$(BITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) -DMULTITHREAD $(SPEEXCFLAGS) -DMSVCLIBPATH=libs/
GLCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidnt.o $(WINDOWS_OBJS)
GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) -DMULTITHREAD -DMSVCLIBPATH=libs/
GLCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidnt.o $(WINDOWS_OBJS)
GL_OBJS=
MINGL_DIR=mingl_vc$(BITS)
MINGL_EXE_NAME=../$(EXE_NAME)-mingl$(BITS)$(EXEPOSTFIX)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) $(WINDOWS_OBJS)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(WINDOWS_OBJS)
D3D_EXE_NAME=../$(EXE_NAME)-d3d$(BITS)$(EXEPOSTFIX)
D3DCL_EXE_NAME=../$(EXE_NAME)-d3dcl$(BITS)$(EXEPOSTFIX)
D3D_LDFLAGS=$(JPEGLIB) libs/libpng$(BITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(SPEEXCFLAGS) -DMSVCLIBPATH=libs/
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD -DMSVCLIBPATH=libs/
D3DB_DIR=d3d_vc$(BITS)
D3DCL_DIR=d3dcl_vc$(BITS)
M_EXE_NAME=../$(EXE_NAME)$(BITS)$(EXEPOSTFIX)
MCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(D3DQUAKE_OBJS) $(GLQUAKE_OBJS) gl_vidnt.o $(BOTLIB_OBJS) $(SPEEX_OBJS) $(WINDOWS_OBJS)
M_CFLAGS=$(D3DCFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) -DMULTITHREAD $(SPEEXCFLAGS) -DMSVCLIBPATH=libs/
MCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(D3DQUAKE_OBJS) $(GLQUAKE_OBJS) gl_vidnt.o $(BOTLIB_OBJS) $(WINDOWS_OBJS)
M_CFLAGS=$(D3DCFLAGS) $(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) -DMULTITHREAD -DMSVCLIBPATH=libs/
MB_DIR=m_vc$(BITS)
M_LDFLAGS=$(GLLDFLAGS) $(JPEGLIB) libs/libpng$(BITS).lib uuid.lib gdi32.lib ole32.lib /subsystem:windows
endif
@ -1227,11 +1191,11 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) $(W32_CFLAGS)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidnt.o $(WINDOWS_OBJS)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidnt.o $(WINDOWS_OBJS)
GL_EXE_NAME=../fteglqw$(BITS)$(EXEPOSTFIX)
GLCL_EXE_NAME=../fteglqwcl$(BITS)$(EXEPOSTFIX)
GL_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(CLIENTLDDEPS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -Wl,--subsystem,windows
GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS) $(SPEEXCFLAGS)
GL_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS)
GLB_DIR=gl_mgw$(BITS)
GLCL_DIR=glcl_mgw$(BITS)
@ -1241,27 +1205,27 @@ ifeq (win,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD
NPFTEB_DIR=npfte_mgw$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidnt.o gl_videgl.o $(WINDOWS_OBJS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidnt.o gl_videgl.o $(WINDOWS_OBJS)
M_EXE_NAME=../$(EXE_NAME)$(BITS)$(EXEPOSTFIX)
MCL_EXE_NAME=../$(EXE_NAME)cl$(BITS)$(EXEPOSTFIX)
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) $(CLIENTLDDEPS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -Wl,--subsystem,windows
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) $(DX7SDK) $(VKCFLAGS) -DMULTITHREAD $(CLIENTLIBFLAGS) $(SPEEXCFLAGS)
M_CFLAGS=$(GLCFLAGS) $(W32_CFLAGS) $(D3DCFLAGS) $(DX7SDK) $(VKCFLAGS) -DMULTITHREAD $(CLIENTLIBFLAGS)
MB_DIR=m_mgw$(BITS)
MCL_DIR=mcl_mgw$(BITS)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) $(WINDOWS_OBJS)
D3DCL_OBJS=$(D3DQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(WINDOWS_OBJS)
D3D_EXE_NAME=../fted3dqw$(BITS)$(EXEPOSTFIX)
D3DCL_EXE_NAME=../fted3dclqw$(BITS)$(EXEPOSTFIX)
D3D_LDFLAGS=$(IMAGELDFLAGS) $(CLIENTLDDEPS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -Wl,--subsystem,windows
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS) $(SPEEXCFLAGS)
D3D_CFLAGS=$(D3DCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS)
D3DB_DIR=d3d_mgw$(BITS)
D3DCL_DIR=d3dcl_mgw$(BITS)
VKCL_OBJS=$(GLQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) $(WINDOWS_OBJS) gl_vidnt.o
VKCL_OBJS=$(GLQUAKE_OBJS) $(D3DGL_OBJS) $(BOTLIB_OBJS) $(WINDOWS_OBJS) gl_vidnt.o
VK_EXE_NAME=../ftevkqw$(BITS)$(EXEPOSTFIX)
VKCL_EXE_NAME=../ftevkclqw$(BITS)$(EXEPOSTFIX)
VK_LDFLAGS=$(IMAGELDFLAGS) $(CLIENTLDDEPS) -ldxguid -lws2_32 -lwinmm -lgdi32 -lole32 -Wl,--subsystem,windows
VK_CFLAGS=$(VKCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS) $(SPEEXCFLAGS)
VK_CFLAGS=$(VKCFLAGS) $(W32_CFLAGS) $(DX7SDK) -DMULTITHREAD $(CLIENTLIBFLAGS)
VKB_DIR=vk_mgw$(BITS)
VKCL_DIR=vkcl_mgw$(BITS)
@ -1306,19 +1270,13 @@ ifeq ($(FTE_TARGET),bsd)
MINGL_DIR=mingl_bsd
endif
ifneq (,$(findstring linux,$(FTE_TARGET)))
CLIENTLDDEPS=
SV_DIR=sv_linux$(BITS)
SV_EXE_NAME=../$(EXE_NAME)-sv$(BITS)
SV_LDFLAGS=
SV_CFLAGS=$(SERVER_ONLY_CFLAGS) -DMULTITHREAD
CL_CFLAGS=$(SPEEXCFLAGS) -DMULTITHREAD -DDYNAMIC_SDL
CL_CFLAGS=-DMULTITHREAD -DDYNAMIC_SDL -DUSE_EGL -DWAYLANDQUAKE -DX11QUAKE
#one of these two
IMAGELDFLAGS=-lpng -ljpeg
#CL_CFLAGS+= -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
QCC_DIR=linqcc$(BITS)
NPFTE_OBJS=httpclient.o image.o sys_linux_threads.o sys_npfte.o sys_axfte.o sys_plugfte.o
@ -1327,27 +1285,27 @@ ifneq (,$(findstring linux,$(FTE_TARGET)))
NPFTE_CFLAGS=$(NPFTECFLAGS) $(W32_CFLAGS) -DMULTITHREAD -fPIC -DDYNAMIC_LIBPNG -DDYNAMIC_LIBJPEG
NPFTEB_DIR=npfte_linux$(BITS)
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
GL_EXE_NAME=../$(EXE_NAME)-gl$(BITS)
GLCL_EXE_NAME=../$(EXE_NAME)-glcl$(BITS)
GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(CLIENTLDDEPS)
GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS)
GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS) $(CLIENTLIBFLAGS)
GLB_DIR=gl_linux$(BITS)
GLCL_DIR=glcl_linux$(BITS)
VKCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
VKCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_alsa.o snd_linux.o snd_sdl.o cd_linux.o sys_linux.o sys_linux_threads.o
VK_EXE_NAME=../$(EXE_NAME)-vk$(BITS)
VKCL_EXE_NAME=../$(EXE_NAME)-vkcl$(BITS)
VK_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(CLIENTLDDEPS)
VK_CFLAGS=$(VKCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS)
VK_CFLAGS=$(VKCFLAGS) -I/usr/X11R6/include $(CL_CFLAGS) $(CLIENTLIBFLAGS)
VKB_DIR=vk_linux$(BITS)
VKCL_DIR=vkcl_linux$(BITS)
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o gl_videgl.o snd_linux.o snd_sdl.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o gl_vidwayland.o gl_videgl.o snd_linux.o snd_sdl.o snd_alsa.o cd_linux.o sys_linux.o sys_linux_threads.o
M_EXE_NAME=../$(EXE_NAME)$(BITS)
MCL_EXE_NAME=../$(EXE_NAME)-cl$(BITS)
M_LDFLAGS=$(GL_LDFLAGS)
M_CFLAGS=$(VKCFLAGS) $(GL_CFLAGS)
M_CFLAGS=$(VKCFLAGS) $(GL_CFLAGS) $(CLIENTLIBFLAGS)
MB_DIR=m_linux$(BITS)
MCL_DIR=mcl_linux$(BITS)
@ -1380,14 +1338,10 @@ ifneq (,$(findstring rpi,$(FTE_TARGET)))
GL_LDFLAGS+= -L$(RPI_SYSROOT)/opt/vc/lib -Wl,--sysroot=$(RPI_SYSROOT),-rpath=/opt/vc/lib,-rpath-link=$(RPI_SYSROOT)/opt/vc/lib -lbcm_host
GLCL_OBJS+=gl_vidrpi.o
endif
ifneq (,$(findstring wayland,$(FTE_TARGET)))
GL_CFLAGS+=-DUSE_EGL
GLCL_OBJS+=gl_vidwayland.o
GL_LDFLAGS+=-lwayland-client -lwayland-egl
endif
ifneq (,$(findstring fbdev,$(FTE_TARGET)))
GL_CFLAGS+=-DUSE_EGL
GLCL_OBJS+=gl_vidfbdev.o
MCL_OBJS+=gl_vidfbdev.o
endif
ifneq ($(shell echo $(FTE_TARGET)|grep macosx),)
SV_DIR=sv_macosx$(EXTENSION)$(BITS)
@ -1434,7 +1388,7 @@ ifeq ($(FTE_TARGET),morphos)
GL_EXE_NAME=../$(EXE_NAME)-morphos-gl
GLCL_EXE_NAME=../$(EXE_NAME)-morphos-glcl
GL_LDFLAGS=$(GLLDFLAGS) -ldl $(IMAGELDFLAGS) -lz
GL_CFLAGS=$(GLCFLAGS) -noixemul -I./libs/speex -I./
GL_CFLAGS=$(GLCFLAGS) -noixemul -I./
GLB_DIR=gl_morphos
GLCL_DIR=glcl_morphos
@ -1485,19 +1439,19 @@ ifeq ($(FTE_TARGET),cyg)
SV_CFLAGS=$(SERVER_ONLY_CFLAGS)
EXEPOSTFIX=.exe
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_linux_threads.o
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_linux_threads.o
GL_EXE_NAME=../$(EXE_NAME)-cyg-gl$(EXEPOSTFIX)
GLCL_EXE_NAME=../$(EXE_NAME)-cyg-glcl$(EXEPOSTFIX)
GL_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(CLIENTLDDEPS) -lz -lltdl
GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(SPEEXCFLAGS) $(CLIENTLIBFLAGS) -DUSE_LIBTOOL
GL_CFLAGS=$(GLCFLAGS) -I/usr/X11R6/include $(CLIENTLIBFLAGS) -DUSE_LIBTOOL
GLB_DIR=gl_cygwin
GLCL_DIR=glcl_cygwin
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) $(SPEEX_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_linux_threads.o
MCL_OBJS=$(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(BOTLIB_OBJS) gl_vidlinuxglx.o snd_linux.o cd_null.o sys_linux.o sys_linux_threads.o
M_EXE_NAME=../$(EXE_NAME)-cyg$(EXEPOSTFIX)
MCL_EXE_NAME=../$(EXE_NAME)-cyg-cl$(EXEPOSTFIX)
M_LDFLAGS=$(GLLDFLAGS) $(XLDFLAGS) $(CLIENTLDDEPS) -lz -lltdl
M_CFLAGS=$(GLCFLAGS) $(SPEEXCFLAGS) $(CLIENTLIBFLAGS) -DUSE_LIBTOOL
M_CFLAGS=$(GLCFLAGS) $(CLIENTLIBFLAGS) -DUSE_LIBTOOL
MB_DIR=m_cygwin
MCL_DIR=mcl_cygwin
@ -1567,8 +1521,6 @@ ifeq ($(FTE_TARGET),web)
#SV_LDFLAGS=
STRIP=echo
SPEEXCFLAGS=
SPEEX_OBS=
#GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) cd_null.o
#GL_LDFLAGS=$(GLLDFLAGS)
GLB_DIR=gl_web
@ -1628,13 +1580,7 @@ ifneq ($(OUT_DIR),)
endif
VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(SW_DIR) : $(COMMON_DIR) : $(SERVER_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(NACL_DIR) : $(D3D_DIR) : $(VK_DIR) : $(BOTLIB_DIR) : $(BASE_DIR)/libs/speex/libspeex : $(BASE_DIR)/web
ifneq ($(findstring -DSPEEX_STATIC, $(CFLAGS)),)
#add these to statically link libspeex
BASE_CFLAGS += $(SPEEXCFLAGS)
CLIENT_OBJS += $(SPEEX_OBJS)
endif
VPATH = $(BASE_DIR) : $(CLIENT_DIR) : $(GL_DIR) : $(SW_DIR) : $(COMMON_DIR) : $(SERVER_DIR) : $(HTTP_DIR) : $(BASE_DIR)/irc : $(BASE_DIR)/email : $(QUX_DIR) : $(PROGS_DIR) : $(NACL_DIR) : $(D3D_DIR) : $(VK_DIR) : $(BOTLIB_DIR) : $(BASE_DIR)/web
# This is for linking the FTE icon to the MinGW target
$(OUT_DIR)/resources.o : winquake.rc
@ -2155,8 +2101,19 @@ libs-$(ARCH)/libopus.a:
test -f opus-$(OPUSVER).tar.gz || wget https://archive.mozilla.org/pub/opus/opus-$(OPUSVER).tar.gz
-test -f libs-$(ARCH)/libopus.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../opus-$(OPUSVER).tar.gz && cd opus-$(OPUSVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp .libs/libopus.a ../ && cp include/opus*.h ../)
libs-$(ARCH)/libspeex.a:
test -f speex-$(SPEEXVER).tar.gz || wget http://downloads.us.xiph.org/releases/speex/speex-$(SPEEXVER).tar.gz
-test -f libs-$(ARCH)/libspeex.a || (mkdir -p libs-$(ARCH)/speex && cd libs-$(ARCH) && tar -xvzf ../speex-$(SPEEXVER).tar.gz && cd speex-$(SPEEXVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp libspeex/.libs/libspeex.a ../ && cp -r include/speex/*.h ../speex/)
makelibs: libs-$(ARCH)/libjpeg.a libs-$(ARCH)/libz.a libs-$(ARCH)/libpng.a libs-$(ARCH)/libogg.a libs-$(ARCH)/libvorbis.a libs-$(ARCH)/libopus.a
libs-$(ARCH)/libspeexdsp.a:
test -f speexdsp-$(SPEEXDSPVER).tar.gz || wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSPVER).tar.gz
-test -f libs-$(ARCH)/libspeexdsp.a || (mkdir -p libs-$(ARCH)/speex && cd libs-$(ARCH) && tar -xvzf ../speexdsp-$(SPEEXDSPVER).tar.gz && cd speexdsp-$(SPEEXDSPVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp libspeexdsp/.libs/libspeexdsp.a ../ && cp -r include/speex/*.h ../speex/)
libs-$(ARCH)/libfreetype.a:
test -f freetype-$(FREETYPEVER).tar.gz || wget https://download.savannah.gnu.org/releases/freetype/freetype-$(FREETYPEVER).tar.gz
-test -f libs-$(ARCH)/libfreetype.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../freetype-$(FREETYPEVER).tar.gz && cd freetype-$(FREETYPEVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) && $(TOOLOVERRIDES) $(MAKE) && cp objs/.libs/libfreetype.a ../ && cp -r include/ ../)
makelibs: libs-$(ARCH)/libjpeg.a libs-$(ARCH)/libz.a libs-$(ARCH)/libpng.a libs-$(ARCH)/libogg.a libs-$(ARCH)/libvorbis.a libs-$(ARCH)/libopus.a libs-$(ARCH)/libspeex.a libs-$(ARCH)/libspeexdsp.a libs-$(ARCH)/libfreetype.a
HTTP_OBJECTS=http/httpserver.c http/iwebiface.c common/fs_stdio.c http/ftpserver.c
$(RELEASE_DIR)/httpserver$(BITS): $(HTTP_OBJECTS)

View File

@ -4082,10 +4082,8 @@ void CL_Status_f(void)
Con_Printf("\textended coords\n");
if (cls.fteprotocolextensions & PEXT_SPLITSCREEN)
Con_Printf("\tsplit screen\n");
#ifdef PEXT_CSQC
if (cls.fteprotocolextensions & PEXT_CSQC)
Con_Printf("\tcsqc info\n");
#endif
if (cls.fteprotocolextensions2 & PEXT2_VOICECHAT)
Con_Printf("\tvoice chat\n");
if (cls.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS)

View File

@ -1190,7 +1190,7 @@ static int CL_LoadModels(int stage, qboolean dontactuallyload)
pmove.numphysent = 0;
pmove.physents[0].model = NULL;
/*#ifdef PEXT_CSQC
/*#ifdef CSQC_DAT
if (atstage())
{
extern cvar_t cl_nocsqc;
@ -1228,7 +1228,7 @@ static int CL_LoadModels(int stage, qboolean dontactuallyload)
}
#endif
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
if (atstage())
{
char *s;
@ -3771,7 +3771,7 @@ static void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caut
S_Voip_MapChange();
#endif
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
CSQC_Shutdown();
#endif
}
@ -4638,7 +4638,7 @@ static void CLQW_ParseStartSoundPacket(void)
if (ent > MAX_EDICTS)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, 1, 0, 0))
#endif
{
@ -4834,7 +4834,7 @@ static void CLNQ_ParseStartSoundPacket(void)
for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord ();
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation, pitchadj, timeofs, flags))
#endif
{
@ -7064,7 +7064,7 @@ void CLQW_ParseServerMessage (void)
CL_ParseEffect(true);
break;
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
case svcfte_csqcentities:
csqcpacket = true;
CSQC_ParseEntities();
@ -8070,7 +8070,7 @@ void CLNQ_ParseServerMessage (void)
CL_ParseStaticSound(true);
break;
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
case svcdp_csqcentities:
CSQC_ParseEntities();
break;

View File

@ -578,7 +578,7 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
int mfwt;
qboolean strafe_x, strafe_y;
int wpnum;
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
#ifdef MULTITHREAD
extern qboolean runningindepphys;
#else
@ -711,7 +711,7 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
my = 0;
}
#endif
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
if (!runningindepphys && CSQC_MousePosition(mouse->oldpos[0], mouse->oldpos[1], mouse->qdeviceid))
{
mx = 0;
@ -732,7 +732,7 @@ void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum, float frame
}
#endif
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
if (mx || my)
if (!runningindepphys && CSQC_MouseMove(mx, my, mouse->qdeviceid))
{

View File

@ -1868,7 +1868,7 @@ void M_Menu_Singleplayer_Cheats_Quake (void)
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 170, 0, cursorpositionY, NULL, false);
}
#ifdef Q2CLIENT
#ifdef Q2SERVER
// Quake 2
typedef struct {
@ -2353,7 +2353,7 @@ void M_Menu_Singleplayer_Cheats_f (void)
case MGT_QUAKE1:
M_Menu_Singleplayer_Cheats_Quake();
break;
#ifdef Q2CLIENT
#ifdef Q2SERVER
case MGT_QUAKE2:
M_Menu_Singleplayer_Cheats_Quake2();
break;
@ -2933,7 +2933,9 @@ typedef struct
world_t ragworld;
wedict_t ragworldedict;
comentvars_t ragworldvars;
#ifdef VM_Q1
comextentvars_t ragworldextvars;
#endif
pubprogfuncs_t ragfuncs;
qboolean flop; //ragdoll flopping enabled.
float fixedrate;
@ -3123,7 +3125,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
mods->fixedrate = 1;
while (mods->fixedrate >= rate)
{
sv.world.rbe->RunFrame(&mods->ragworld, rate, 800);
mods->ragworld.rbe->RunFrame(&mods->ragworld, rate, 800);
mods->fixedrate -= rate;
}
@ -3594,7 +3596,9 @@ void M_Menu_ModelViewer_f(void)
mv->ragfuncs.edicttable = (edict_t**)&mv->ragworld.edicts;
mv->ragworld.edicts = &mv->ragworldedict;
mv->ragworld.edicts->v = &mv->ragworldvars;
#ifdef VM_Q1
mv->ragworld.edicts->xv = &mv->ragworldextvars;
#endif
mv->ragworld.num_edicts = 1;
mv->ragworld.edicts->v->solid = SOLID_BBOX;
VectorSet(mv->ragworld.edicts->v->mins, -1000, -1000, -101);
@ -3824,4 +3828,4 @@ void M_Menu_Installer(void)
menu->remove = Installer_Remove;
}
#endif
#endif
#endif

View File

@ -389,6 +389,7 @@ typedef struct rendererinfo_s {
r_qrenderer_t rtype;
//FIXME: all but the vid stuff really should be filled in by the video code, simplifying system-specific stuff.
//FIXME: remove these...
void (*Draw_Init) (void);
void (*Draw_Shutdown) (void);
@ -400,6 +401,7 @@ typedef struct rendererinfo_s {
void (*R_DeInit) (void); //FIXME - merge implementations
void (*R_RenderView) (void); // must set r_refdef first
//FIXME: keep these...
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void);
void (*VID_SwapBuffers) (void); //force a buffer swap, regardless of what's displayed.
@ -410,6 +412,8 @@ typedef struct rendererinfo_s {
void (*VID_DestroyCursor) (void *cursor); //may be null
void (*VID_SetWindowCaption) (const char *msg);
//FIXME: remove these...
char *(*VID_GetRGBInfo) (int *bytestride, int *truevidwidth, int *truevidheight, enum uploadfmt *fmt);
qboolean (*SCR_UpdateScreen) (void);
@ -445,6 +449,12 @@ typedef struct rendererinfo_s {
void (*BE_RenderToTextureUpdate2d)(qboolean destchanged);
char *alignment; //just to make sure that added functions cause compile warnings.
//FIXME: keep this...
int (*VID_GetPriority) (void); //so that eg x11 or wayland can be prioritised depending on environment settings
//FIXME: add getdestopres
//FIXME: add clipboard handling
} rendererinfo_t;
#define rf currentrendererstate.renderer

View File

@ -838,7 +838,9 @@ static float CSQC_PitchScaleForModelIndex(int index)
return 1;
}
#ifdef SKELETALOBJECTS
wedict_t *skel_gettaginfo_args (pubprogfuncs_t *prinst, vec3_t axis[3], vec3_t origin, int tagent, int tagnum);
#endif
static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
{
@ -921,9 +923,11 @@ static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
if (csqc_isdarkplaces && in->xv->tag_entity)
{
#ifdef SKELETALOBJECTS
csqcedict_t *p = (csqcedict_t*)skel_gettaginfo_args(csqcprogs, out->axis, out->origin, in->xv->tag_entity, in->xv->tag_index);
if (p && (int)p->xv->renderflags & CSQCRF_VIEWMODEL)
out->flags |= RF_DEPTHHACK|RF_WEAPONMODEL;
#endif
}
ival = in->v->colormap;
@ -7782,7 +7786,7 @@ qboolean CSQC_DrawView(void)
if (csqc_world.rbe)
{
#ifdef RAGDOLL
rag_doallanimations(&sv.world);
rag_doallanimations(&csqc_world);
#endif
csqc_world.rbe->RunFrame(&csqc_world, host_frametime, 800);
}

View File

@ -466,7 +466,7 @@ cvar_t vk_busywait = CVARD ("vk_busywait", "", "Force busy waiting unt
cvar_t vk_waitfence = CVARD ("vk_waitfence", "", "Waits on fences, instead of semaphores. This is more likely to result in gpu stalls while the cpu waits.");
cvar_t vk_nv_glsl_shader = CVARD ("vk_loadglsl", "", "Enable direct loading of glsl, where supported by drivers. Do not use in combination with vk_debug 2 (vk_debug should be 1 if you want to see any glsl compile errors). Don't forget to do a vid_restart after.");
cvar_t vk_nv_dedicated_allocation = CVARD ("vk_nv_dedicated_allocation", "", "Flag vulkan memory allocations as dedicated, where applicable.");
//cvar_t vk_khr_dedicated_allocation = CVARD ("vk_khr_dedicated_allocation", "", "Flag vulkan memory allocations as dedicated, where applicable.");
cvar_t vk_khr_dedicated_allocation = CVARD ("vk_khr_dedicated_allocation", "", "Flag vulkan memory allocations as dedicated, where applicable.");
cvar_t vk_khr_push_descriptor = CVARD ("vk_khr_push_descriptor", "", "Enables better descriptor streaming.");
#endif
@ -999,7 +999,7 @@ void Renderer_Init(void)
Cvar_Register (&vk_nv_glsl_shader, VKRENDEREROPTIONS);
Cvar_Register (&vk_nv_dedicated_allocation, VKRENDEREROPTIONS);
// Cvar_Register (&vk_khr_dedicated_allocation,VKRENDEREROPTIONS);
Cvar_Register (&vk_khr_dedicated_allocation,VKRENDEREROPTIONS);
Cvar_Register (&vk_khr_push_descriptor, VKRENDEREROPTIONS);
#endif
@ -1123,76 +1123,90 @@ rendererinfo_t dedicatedrendererinfo = {
};
#ifdef GLQUAKE
extern rendererinfo_t openglrendererinfo;
#ifdef USE_EGL
extern rendererinfo_t eglrendererinfo;
#endif
extern rendererinfo_t rpirendererinfo;
rendererinfo_t waylandrendererinfo;
rendererinfo_t fbdevrendererinfo;
extern rendererinfo_t openglrendererinfo;
#ifdef USE_EGL
extern rendererinfo_t eglrendererinfo;
#endif
extern rendererinfo_t rpirendererinfo;
#ifdef WAYLANDQUAKE
extern rendererinfo_t rendererinfo_wayland_gl;
#endif
rendererinfo_t fbdevrendererinfo;
#endif
#ifdef D3D8QUAKE
extern rendererinfo_t d3d8rendererinfo;
extern rendererinfo_t d3d8rendererinfo;
#endif
#ifdef D3D9QUAKE
extern rendererinfo_t d3d9rendererinfo;
extern rendererinfo_t d3d9rendererinfo;
#endif
#ifdef D3D11QUAKE
extern rendererinfo_t d3d11rendererinfo;
extern rendererinfo_t d3d11rendererinfo;
#endif
#ifdef SWQUAKE
extern rendererinfo_t swrendererinfo;
extern rendererinfo_t swrendererinfo;
#endif
#ifdef VKQUAKE
extern rendererinfo_t vkrendererinfo;
//rendererinfo_t headlessvkrendererinfo;
#if defined(_WIN32) && defined(GLQUAKE) && !defined(FTE_SDL)
extern rendererinfo_t nvvkrendererinfo;
#endif
extern rendererinfo_t vkrendererinfo;
//rendererinfo_t headlessvkrendererinfo;
#if defined(_WIN32) && defined(GLQUAKE) && !defined(FTE_SDL)
extern rendererinfo_t nvvkrendererinfo;
#endif
#ifdef WAYLANDQUAKE
extern rendererinfo_t rendererinfo_wayland_vk;
#endif
#endif
#ifdef HEADLESSQUAKE
extern rendererinfo_t headlessrenderer;
extern rendererinfo_t headlessrenderer;
#endif
rendererinfo_t *rendererinfo[16] =
{
#ifdef GLQUAKE
#ifdef FTE_RPI
&rpirendererinfo,
#endif
#ifdef FTE_RPI
&rpirendererinfo,
#endif
&openglrendererinfo,
#ifdef USE_EGL
&eglrendererinfo,
#endif
&waylandrendererinfo,
&fbdevrendererinfo,
#ifdef USE_EGL
&eglrendererinfo,
#endif
#endif
#ifdef D3D9QUAKE
&d3d9rendererinfo,
#endif
#ifdef D3D11QUAKE
&d3d11rendererinfo,
#endif
#ifdef SWQUAKE
&swrendererinfo,
#endif
#ifdef VKQUAKE
&vkrendererinfo,
#if defined(_WIN32) && defined(GLQUAKE) && !defined(FTE_SDL)
&nvvkrendererinfo,
#endif
#endif
#ifdef D3D11QUAKE
&d3d11rendererinfo,
#endif
#ifdef SWQUAKE
&swrendererinfo,
#endif
#ifdef D3D8QUAKE
&d3d8rendererinfo,
#endif
#ifdef WAYLANDQUAKE
#ifdef GLQUAKE
&rendererinfo_wayland_gl,
#endif
#ifdef VKQUAKE
&rendererinfo_wayland_vk,
#endif
#endif
#ifdef GLQUAKE
&fbdevrendererinfo, //direct stuff that doesn't interact well with the system should always be low priority
#endif
#ifndef NPQTV
&dedicatedrendererinfo,
#endif
#ifdef HEADLESSQUAKE
&headlessrenderer,
#ifdef VKQUAKE
//&headlessvkrendererinfo,
#endif
#ifdef VKQUAKE
//&headlessvkrendererinfo,
#endif
#endif
};
@ -1960,6 +1974,7 @@ void R_RestartRenderer (rendererstate_t *newr)
failed = !R_ApplyRenderer(newr);
}
//FIXME: query renderers for their priority and then use that. then we can favour X11 when DISPLAY is set and wayland when WAYLAND_DISPLAY is set, etc.
for (i = 0; failed && i < sizeof(rendererinfo)/sizeof(rendererinfo[0]); i++)
{
newr->renderer = rendererinfo[i];

View File

@ -251,8 +251,8 @@ void S_SoundInfo_f(void)
#ifdef VOICECHAT
#ifdef SPEEX_STATIC
#include <speex.h>
#include <speex_preprocess.h>
#include <speex/speex.h>
#include <speex/speex_preprocess.h>
#else
typedef struct {int stuff[15];} SpeexBits;
typedef struct SpeexMode SpeexMode;

View File

@ -888,10 +888,6 @@ int main (int c, const char **v)
memset(&parms, 0, sizeof(parms));
#ifdef USE_LIBTOOL
lt_dlinit();
#endif
parms.argc = c;
parms.argv = v;
#ifdef CONFIG_MANIFEST_TEXT
@ -899,6 +895,17 @@ int main (int c, const char **v)
#endif
COM_InitArgv(parms.argc, parms.argv);
#ifdef USE_LIBTOOL
lt_dlinit();
#endif
#ifdef __linux__
uid_t ruid, euid, suid;
getresuid(&ruid, &euid, &suid);
if (!ruid || !euid || !suid)
printf("WARNING: you should NOT be running this as root!\n");
#endif
#ifdef __linux__
if (!COM_CheckParm("-nodumpstack"))
{

View File

@ -1016,7 +1016,11 @@ int QCLibEditor(pubprogfuncs_t *prfncs, const char *filename, int *line, int *st
IN_Commands ();
S_ExtraUpdate();
#ifdef CLIENTONLY
Sys_Sleep(20/1000.0);
#else
NET_Sleep(20/1000.0, false); //any os.
#endif
}
realtime = oldrealtime;

View File

@ -84,7 +84,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
#ifdef CONFIG_FILE_NAME
#if defined(BRANDING_ICON) && defined(QUAKETC)
IDI_ICON1 ICON BRANDING_ICON
#elif defined(BRANDING_ICON)
IDI_ICON1 ICON BRANDING_ICON

View File

@ -60,7 +60,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#ifndef MULTITHREAD
#define NO_MULTITHREAD
#if !defined(_WIN32) || defined(FTE_SDL) //win32 is annoying
#define NO_MULTITHREAD
#endif
#endif
#ifdef FTE_TARGET_WEB
@ -73,29 +75,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#ifdef D3DQUAKE
#define D3D9QUAKE
//#define D3D11QUAKE
#undef D3DQUAKE
#define D3D9QUAKE
//#define D3D11QUAKE
#undef D3DQUAKE
#endif
#define STRINGIFY2(s) #s
#define STRINGIFY(s) STRINGIFY2(s)
#define QWSKINS //disables qw .pcx skins, as well as enemy/team colour forcing.
#ifndef CONFIG_FILE_NAME
#ifdef HAVE_CONFIG_H
#define CONFIG_FILE_NAME config.h
#elif defined(NOLEGACY)
#define CONFIG_FILE_NAME config_nolegacy.h
#elif defined(MINIMAL)
#define CONFIG_FILE_NAME config_minimal.h
#else
#define CONFIG_FILE_NAME config_fteqw.h
#endif
#endif
#ifdef CONFIG_FILE_NAME
#undef MULTITHREAD
#undef BOTLIB_STATIC
#define HEADLESSQUAKE //usable renderers are normally specified via the makefile, but HEADLESS is considered a feature rather than an actual renderer, so usually gets forgotten about...
//yup, C89 allows this (doesn't like C's token concat though).
#include STRINGIFY(CONFIG_FILE_NAME)
#elif defined(HAVE_CONFIG_H) //if it was configured properly, then we have a more correct list of features we want to use.
#include "config.h"
#else
#ifdef NO_LIBRARIES
#define NO_DIRECTX
#define NO_PNG
#define NO_JPEG
#define NO_ZLIB
#define NO_OGG
#else
#define QWSKINS //disables qw .pcx skins, as well as enemy/team colour forcing.
#ifndef NO_LIBRARIES
#define AVAIL_OPENAL
#define AVAIL_FREETYPE
#endif
@ -110,61 +120,44 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_OGGVORBIS
#endif
#ifdef WINRT
#define AVAIL_XAUDIO2
#define AVAIL_WASAPI
#elif !defined(NO_DIRECTX) && !defined(NODIRECTX) && defined(_WIN32)
#define AVAIL_DINPUT
#define AVAIL_DSOUND
#define AVAIL_WASAPI
//#define AVAIL_XAUDIO2 //gcc doesn't provide any headers
#endif
#define AVAIL_XZDEC
#if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV)
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) && !defined(_XBOX)
#if !defined(_MSC_VER) || _MSC_VER > 1200
#define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc.
#ifdef WINRT
#define AVAIL_XAUDIO2
#define AVAIL_WASAPI
#elif !defined(NO_DIRECTX) && !defined(NODIRECTX) && defined(_WIN32)
#define AVAIL_DINPUT
#define AVAIL_DSOUND
#define AVAIL_WASAPI
//#define AVAIL_XAUDIO2 //gcc doesn't provide any headers
#endif
#elif (defined(__linux__) || defined(__CYGWIN__)) && !defined(ANDROID)
#define HAVE_GNUTLS //currently disabled as it does not validate the server's certificate, beware the mitm attack.
#endif
#endif
#define AVAIL_XZDEC
//#define DYNAMIC_ZLIB
//#define DYNAMIC_LIBPNG
//#define DYNAMIC_LIBJPEG
//#define LIBVORBISFILE_STATIC
//#define SPEEX_STATIC
#if !defined(MINIMAL) && !defined(NPFTE) && !defined(NPQTV)
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(WINRT) && !defined(_XBOX)
#if !defined(_MSC_VER) || _MSC_VER > 1200
#define HAVE_WINSSPI //built in component, checks against windows' root ca database and revocations etc.
#endif
#elif (defined(__linux__) || defined(__CYGWIN__)) && !defined(ANDROID)
#define HAVE_GNUTLS //currently disabled as it does not validate the server's certificate, beware the mitm attack.
#endif
#endif
#if defined(_WIN32) && defined(GLQUAKE)
//#define USE_EGL
#endif
//#define DYNAMIC_ZLIB
//#define DYNAMIC_LIBPNG
//#define DYNAMIC_LIBJPEG
//#define LIBVORBISFILE_STATIC
//#define SPEEX_STATIC
#if defined(_MSC_VER) && !defined(BOTLIB_STATIC) //too lazy to fix up the makefile
#define BOTLIB_STATIC
#endif
#if defined(_WIN32) && defined(GLQUAKE)
//#define USE_EGL
#endif
#ifdef NO_OPENAL
#undef AVAIL_OPENAL
#endif
#if defined(_MSC_VER) && !defined(BOTLIB_STATIC) //too lazy to fix up the makefile
#define BOTLIB_STATIC
#endif
#ifdef NO_PNG
#undef AVAIL_PNGLIB
#endif
#ifdef NO_JPEG
#undef AVAIL_JPEGLIB
#endif
#ifdef NO_OGG
#undef AVAIL_OGGVORBIS
#endif
#if defined(NO_FREETYPE)
#undef AVAIL_FREETYPE
#endif
#if (defined(_MSC_VER) && (_MSC_VER < 1500)) || defined(FTE_SDL)
#undef AVAIL_WASAPI //wasapi is available in the vista sdk, while that's compatible with earlier versions, its not really expected until 2008
#endif
#if (defined(_MSC_VER) && (_MSC_VER < 1500)) || defined(FTE_SDL)
#undef AVAIL_WASAPI //wasapi is available in the vista sdk, while that's compatible with earlier versions, its not really expected until 2008
#endif
#define HAVE_TCP //says we can use tcp too (either ipv4 or ipv6)
#define HAVE_PACKET //if we have the socket api at all...
@ -204,9 +197,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_JPEGLIB
#undef AVAIL_XZDEC
#if defined(_WIN32) && !defined(FTE_SDL) && !defined(MULTITHREAD) && !defined(_XBOX) //always thread on win32 non-minimal builds
#define MULTITHREAD
#endif
#elif defined(MINIMAL)
#define QUAKESTATS
#define QUAKEHUD
@ -302,9 +292,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// #define DECOMPRESS_S3TC //allows bc1-3 to work even when drivers don't support it. This is probably only an issue on mobile chips. WARNING: not entirely sure if all patents expired yet...
#define DECOMPRESS_RGTC //bc4+bc5
//would be nice to have BPTC decompression too, for gl<4.2, d3d9, or d3d11_level10, but frankly its overcomplicated. I'm not going to bother with ASTC either.
#ifndef RTLIGHTS
#define RTLIGHTS //realtime lighting
#endif
#ifndef RTLIGHTS
#define RTLIGHTS //realtime lighting
#endif
//#define SHADOWDBG_COLOURNOTDEPTH //for debugging. renders shadowmaps to a colour buffer instead of a depth buffer. resulting in projected textures instead of actual shadows (the glsl only picks up the red component, but whatever)
// #define QWOVERQ3 //allows qw servers with q3 clients. requires specific cgame.
@ -368,14 +358,53 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#endif
//software rendering is just too glitchy, don't use it.
#if defined(SERVERONLY) && defined(CLIENTONLY)
#undef CLIENTONLY //impossible build. assume the config had CLIENTONLY and they tried building a dedicated server
#endif
//software rendering is just too glitchy, don't use it - unless its the only choice.
#if defined(SWQUAKE) && !defined(_DEBUG) && !defined(__DJGPP__)
#undef SWQUAKE
#endif
#if (defined(D3D8QUAKE) || defined(D3D9QUAKE) || defined(D3D11QUAKE)) && !defined(D3DQUAKE)
#define D3DQUAKE
#if defined(USE_EGL) && !defined(GLQUAKE)
#undef USE_EGL
#endif
#if defined(WAYLANDQUAKE) && !(defined(__linux__) && (defined(VKQUAKE) || (defined(GLQUAKE) && defined(USE_EGL))))
#undef WAYLANDQUAKE
#endif
#ifdef NO_MULTITHREAD
#undef MULTITHREAD
#endif
#ifdef NO_LIBRARIES //catch-all...
#define NO_DIRECTX
#define NO_PNG
#define NO_JPEG
#define NO_ZLIB
#define NO_OGG
#define NO_FREETYPE
#endif
#ifdef NO_OPENAL
#undef AVAIL_OPENAL
#endif
#ifdef NO_PNG
#undef AVAIL_PNGLIB
#endif
#ifdef NO_JPEG
#undef AVAIL_JPEGLIB
#endif
#ifdef NO_OGG
#undef AVAIL_OGGVORBIS
#endif
#ifdef NO_FREETYPE
#undef AVAIL_FREETYPE
#endif
#ifdef NO_ZLIB
#undef AVAIL_ZLIB
#undef AVAIL_PNGLIB
#undef AVAIL_XZDEC
#undef AVAIL_GZDEC
#endif
//include a file to update the various configurations for game-specific configs (hopefully just names)
#ifdef BRANDING_INC
@ -394,18 +423,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ENGINEWEBSITE "http://fte.triptohell.info" //url for program
#endif
//#define QUAKESPYAPI //define this if you want the engine to be usable via gamespy/quakespy, which has been dead for a long time now.
#ifdef NO_ZLIB //compile-time option.
#undef AVAIL_ZLIB
#undef AVAIL_PNGLIB
#undef AVAIL_XZDEC
#undef AVAIL_GZDEC
#endif
#if !defined(_WIN32) || defined(WINRT)
#undef HAVE_SPEECHTOTEXT
#undef AVAIL_MP3_ACM
#undef AVAIL_DSOUND
#undef AVAIL_XAUDIO2
#undef AVAIL_WASAPI
#endif
#if !(defined(__linux__) || defined(__CYGWIN__)) || defined(ANDROID)
#undef HAVE_GNUTLS
#endif
#if !defined(_WIN32) || (defined(_MSC_VER) && (_MSC_VER < 1300)) || defined(FTE_SDL)
#undef HAVE_WINSSPI
#endif
#ifndef HAVE_MIXER
@ -415,6 +445,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef AVAIL_WASAPI
#endif
#ifdef NOMEDIA
#undef HAVE_CDPLAYER //includes cd playback. actual cds. faketracks are supported regardless.
#undef HAVE_JUKEBOX //includes built-in jukebox crap
@ -425,7 +456,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#if defined(_XBOX)
#define D3DQUAKE
#define D3D8QUAKE
#undef HAVE_TCP //FIXME
#undef HAVE_PACKET //FIXME
@ -519,7 +549,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// #undef PSET_SCRIPT //bss+size
#define GLSLONLY //pointless having the junk
#define GLESONLY //should reduce the conditions a little
#define R_MAX_RECURSE 2 //less bss
#ifndef R_MAX_RECURSE
#define R_MAX_RECURSE 2 //less bss
#endif
// #undef RTLIGHTS
#undef HEADLESSQUAKE
#define NO_FREETYPE
@ -679,6 +711,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef HLSERVER
#undef WEBSERVER
#undef FTPSERVER
#undef SUBSERVERS
#undef VM_Q1
#undef SQL
#endif
@ -709,6 +742,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef Q3CLIENT //reconsider this (later)
#undef Q3SERVER //reconsider this (later)
#endif
#ifdef DEBUG
#undef NOQCDESCRIPTIONS //don't disable writing fteextensions.qc in debug builds, otherwise how would you ever build one? :o
#endif
#ifndef Q3CLIENT
#undef VM_CG // :(
@ -722,6 +759,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VM_ANY
#endif
#if (defined(D3D8QUAKE) || defined(D3D9QUAKE) || defined(D3D11QUAKE)) && !defined(D3DQUAKE)
#define D3DQUAKE //shouldn't still matter
#endif
#define PROTOCOLEXTENSIONS
#ifdef MINIMAL

View File

@ -10,6 +10,11 @@
#endif
#endif
//small helper to aid compiling.
#if defined(SKELETALMODELS) || defined(MD3MODELS)
#define SKELORTAGS
#endif
qboolean r_loadbumpmapping;
extern cvar_t dpcompat_psa_ungroup;
extern cvar_t r_noframegrouplerp;
@ -4225,10 +4230,10 @@ qboolean QDECL Mod_LoadQ2Model (model_t *mod, void *buffer, size_t fsize)
int Mod_GetNumBones(model_t *model, qboolean allowtags)
{
#ifdef SKELORTAGS
if (model && model->type == mod_alias)
{
galiasinfo_t *inf = Mod_Extradata(model);
#ifdef SKELETALMODELS
if (inf->numbones)
return inf->numbones;
@ -4240,6 +4245,7 @@ int Mod_GetNumBones(model_t *model, qboolean allowtags)
#endif
return 0;
}
#endif
#ifdef HALFLIFEMODELS
if (model && model->type == mod_halflife)
return HLMDL_GetNumBones(model, allowtags);
@ -4390,6 +4396,7 @@ qboolean Mod_GetTag(model_t *model, int tagnum, framestate_t *fstate, float *res
}
#endif
#ifdef SKELORTAGS
if (model && model->type == mod_alias)
{
galiasinfo_t *inf = Mod_Extradata(model);
@ -4558,11 +4565,13 @@ qboolean Mod_GetTag(model_t *model, int tagnum, framestate_t *fstate, float *res
}
#endif
}
#endif
return false;
}
int Mod_TagNumForName(model_t *model, const char *name)
{
#ifdef SKELORTAGS
int i;
galiasinfo_t *inf;
@ -4611,6 +4620,7 @@ int Mod_TagNumForName(model_t *model, const char *name)
#endif
return 0;
}
#endif
return 0;
}

View File

@ -454,6 +454,7 @@ extern char com_configdir[MAX_OSPATH]; //dir to put cfg_save configs in
#endif
#endif
#ifdef FS_64BIT
//we should probably use off_t here, but then we have fun as to whether its actually 64bit or not, which results in warnings and problems with printf etc.
typedef quint64_t qofs_t; //type to use for a file offset
#define qofs_Make(low,high) (low | (((qofs_t)(high))<<32))
#define qofs_Low(ofs) ((ofs)&0xffffffffu)

View File

@ -0,0 +1,178 @@
// Build-Config file for FTE's standard builds, the default settings.
// to use: make FTE_CONFIG=fteqw
// Features should either be commented or not. If you change undefs to defines or vice versa then expect problems.
// Later code will disable any features if they're not supported on the current platform, so don't worry about win/lin/mac/android/web/etc here - any such issues should be fixed elsewhere.
//general rebranding
//#define DISTRIBUTION "FTE" //should be kept short. 3 or 4 letters is good, with no spaces.
//#define DISTRIBUTIONLONG "Forethought Entertainment" //think of this as your company name. It isn't shown too often, so can be quite long.
//#define FULLENGINENAME "FTE Quake" //nominally user-visible name.
//#define ENGINEWEBSITE "http://fte.triptohell.info" //for shameless self-promotion purposes.
//#define BRANDING_ICON "fte_eukara.ico" //The file to use in windows' resource files - for linux your game should include an icon.[png|ico] file in the game's data.
//filesystem rebranding
//#define GAME_SHORTNAME "wastes" //short alphanumeric description
//#define GAME_FULLNAME FULLENGINENAME //full name of the game we're playing
//#define GAME_BASEGAMES GAME_SHORTNAME //comma-separate list of basegame strings to use
//#define GAME_PROTOCOL "FTE-Wastes" //so other games won't show up in the server browser
//#define GAME_IDENTIFYINGFILES NULL //with multiple games, this string-list gives verification that the basedir is actually valid. if null, will just be assumed correct.
//#define GAME_DOWNLOADSURL NULL //url for the package manger to update from
//#define GAME_DEFAULTCMDS NULL //a string containing the things you want to exec in order to override default.cfg
// Allowed renderers... There should ONLY be undefs here (other C files won't be pulled in automatically)
//#undef GLQUAKE
//#undef D3D8QUAKE
//#undef D3D9QUAKE
//#undef D3D11QUAKE
//#undef VKQUAKE
//#undef HEADLESSQUAKE //no-op renderer...
//#undef WAYLANDQUAKE //linux only
//Misc Renderer stuff
#define PSET_CLASSIC //support the 'classic' particle system, for that classic quake feel.
#define PSET_SCRIPT //scriptable particles (both fte's and importing effectinfo)
#define RTLIGHTS
#define RUNTIMELIGHTING //automatic generation of .lit files
#define R_XFLIP //old silly thing
//Extra misc features.
//#define CLIENTONLY //
#define MULTITHREAD //misc basic multithreading - dsound, downloads, basic stuff that's unlikely to have race conditions.
#define LOADERTHREAD //worker threads for loading misc stuff. falls back on main thread if not supported.
#define AVAIL_DINPUT
#define SIDEVIEWS 4 //enable secondary/reverse views.
#define TEXTEDITOR //my funky text editor! its awesome!
#define PLUGINS //support for external plugins (like huds or fancy menus or whatever)
#define USE_SQLITE //sql-database-as-file support
//Filesystem formats
#define PACKAGE_PK3
#define PACKAGE_Q1PAK //also q2
//#define PACKAGE_DOOMWAD //doom wad support (generates various file names, and adds support for doom's audio, sprites, etc)
#define AVAIL_XZDEC //.xz decompression
#define AVAIL_GZDEC //.gz decompression
#define AVAIL_ZLIB //whether pk3s can be compressed or not.
#define AVAIL_DZIP //.dzip support for smaller demos (which are actually more like pak files and can store ANY type of file)
//Map formats
#define Q1BSPS //Quake1
#define Q2BSPS //Quake2
#define Q3BSPS //Quake3, as well as a load of other games too...
#define RFBSPS //qfusion's bsp format / jk2o etc.
#define TERRAIN //FTE's terrain, as well as .map support
//#define DOOMWADS //map support, filesystem support is separate.
//#define MAP_PROC //doom3...
//Model formats
#define SPRMODELS //Quake's sprites
#define SP2MODELS //Quake2's models
#define DSPMODELS //Doom sprites!
#define MD1MODELS //Quake's models.
#define MD2MODELS //Quake2's models
#define MD3MODELS //Quake3's models, also often used for q1 etc too.
#define MD5MODELS //Doom3 models.
#define ZYMOTICMODELS //nexuiz uses these, for some reason.
#define DPMMODELS //these keep popping up, despite being a weak format.
#define PSKMODELS //unreal's interchange format. Undesirable in terms of load times.
#define HALFLIFEMODELS //horrible format that doesn't interact well with the rest of FTE's code. Unusable tools (due to license reasons).
#define INTERQUAKEMODELS //Preferred model format, at least from an idealism perspective.
#define RAGDOLL //ragdoll support. requires RBE support (via a plugin...).
//Image formats
#define IMAGEFMT_KTX //Khronos TeXture. common on gles3 devices for etc2 compression
#define IMAGEFMT_PKM //file format generally written by etcpack or android's etc1tool. doesn't support mips.
#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
#define IMAGEFMT_BLP //legacy crap
#define PACKAGE_TEXWAD //quake's image wad support
#define AVAIL_PNGLIB //.png image format support (read+screenshots)
#define AVAIL_JPEGLIB //.jpeg image format support (read+screenshots)
#define AVAIL_FREETYPE //for truetype font rendering
#define DECOMPRESS_ETC2 //decompress etc2(core in gles3/gl4.3) if the graphics driver doesn't support it (eg d3d or crappy gpus with vulkan).
//#define DECOMPRESS_S3TC //allows bc1-3 to work even when drivers don't support it. This is probably only an issue on mobile chips. WARNING: not entirely sure if all patents expired yet...
#define DECOMPRESS_RGTC //bc4+bc5
// Game/Gamecode Support
#define CSQC_DAT
#define MENU_DAT
#define VM_Q1 //q1qvm implementation, to support ktx.
//#define VM_LUA //optionally supports lua instead of ssqc.
#define Q2SERVER //q2 server+gamecode.
#define Q2CLIENT //q2 client. file formats enabled separately.
#define Q3CLIENT //q3 client stuff.
#define Q3SERVER //q3 server stuff.
#define BOTLIB_STATIC //q3 botlib
#define HEXEN2 //runs hexen2 gamecode, supports hexen2 file formats.
#define HUFFNETWORK //crappy network compression. probably needs reseeding.
#define NETPREPARSE //allows for running both nq+qw on the same server (if not, protocol used must match gamecode).
#define SUBSERVERS //Allows the server to fork itself, each acting as an MMO-style server instance of a single 'realm'.
//#define HLCLIENT 7 //we can run HL gamecode (not protocol compatible, set to 6 or 7)
//#define HLSERVER 140 //we can run HL gamecode (not protocol compatible, set to 138 or 140)
// Networking options
#define NQPROT //act as an nq client/server, with nq gamecode.
#define HAVE_PACKET //we can send unreliable messages!
#define HAVE_TCP //we can create/accept TCP connections.
#define HAVE_GNUTLS //on linux
#define HAVE_WINSSPI //on windows
#define FTPSERVER //sv_ftp cvar.
#define WEBCLIENT //uri_get+any internal downloads etc
#define TCPCONNECT //support for playing over tcp sockets, instead of just udp. compatible with qizmo.
//#define IRCCONNECT //lame support for routing game packets via irc server. not a good idea.
#define SUPPORT_ICE //Internet Connectivity Establishment, for use by plugins to establish voice or game connections.
#define CL_MASTER //Clientside Server Browser functionality.
// Audio Drivers
#define AVAIL_OPENAL
#define AVAIL_WASAPI //windows advanced sound api
#define HAVE_MIXER //support non-openal audio drivers
// Audio Formats
#define AVAIL_OGGVORBIS //.ogg support
#define AVAIL_MP3_ACM //.mp3 support (windows only).
// Other Audio Options
#define VOICECHAT
#define HAVE_MEDIA_DECODER //can play cin/roq, more with plugins
#define HAVE_MEDIA_ENCODER //capture/capturedemo work.
#define HAVE_CDPLAYER //includes cd playback. actual cds. named/numbered tracks are supported regardless (though you need to use the 'music' command to play them without this).
#define HAVE_JUKEBOX //includes built-in jukebox crap
#define HAVE_SPEECHTOTEXT //windows speech-to-text thing
// Features required by vanilla quake/quakeworld...
//#define QUAKETC
#define QUAKESTATS //defines STAT_HEALTH etc. if omitted, you'll need to provide that functionality yourself.
#define QUAKEHUD //support for drawing the vanilla hud.
#define QWSKINS //disabling this means no qw .pcx skins nor enemy/team skin/colour forcing
//#define NOBUILTINMENUS
//#define NOLEGACY //just spike trying to kill off crappy crap...
#define USEAREAGRID //world collision optimisation. REQUIRED for performance with xonotic. hopefully it helps a few other mods too.
//#define NOQCDESCRIPTIONS 2 //if 2, disables writing fteextensions.qc completely. 1 just omits the text. (ignored in debug builds.)
// Outdated stuff
#define SVRANKING //legacy server-side ranking system.
////#define QTERM //qterm... adds a console command that allows running programs from within quake - bit like xterm.
#define SVCHAT //ancient lame builtin to support NPC-style chat...
////#define SV_MASTER //Support running the server as a master server. Should probably not be used.
////#define WEBSERVER //outdated sv_http cvar. new stuff acts via sv_port_tcp instead (which also gives https).
////#define QUAKESPYAPI //define this if you want the engine to be usable via gamespy/quakespy, which has been dead for a long time now. forces the client to use a single port for all outgoing connections, which hurts reconnects.
#ifdef COMPILE_OPTS
//things to configure qclib, which annoyingly doesn't include this file itself
//-DOMIT_QCC //disable the built-in qcc
//-DSIMPLE_QCVM //disable qc debugging and 32bit opcodes
#ifndef AVAIL_ZLIB
//-DNO_ZLIB //disable zlib
#endif
//-DNO_OPUS
//-DNO_SPEEX //disable static speex
#ifndef BOTLIB_STATIC
-DNO_BOTLIB //disable static botlib
#endif
//-DNO_VORBISFILE //disable static vorbisfile
//-Os //optimise for size instead of speed. less cpu cache needed means that its sometimes faster anyway.
#endif

View File

@ -0,0 +1,177 @@
// Build-Config file for FTE's minimal builds.
// to use: make FTE_CONFIG=minimal
// Features should either be commented or not. If you change undefs to defines or vice versa then expect problems.
// Later code will disable any features if they're not supported on the current platform, so don't worry about win/lin/mac/android/web/etc here - any such issues should be fixed elsewhere.
//general rebranding
//#define DISTRIBUTION "FTE" //should be kept short. 3 or 4 letters is good, with no spaces.
//#define DISTRIBUTIONLONG "Forethought Entertainment" //think of this as your company name. It isn't shown too often, so can be quite long.
//#define FULLENGINENAME "FTE Quake" //nominally user-visible name.
//#define ENGINEWEBSITE "http://fte.triptohell.info" //for shameless self-promotion purposes.
//#define BRANDING_ICON "fte_eukara.ico" //The file to use in windows' resource files - for linux your game should include an icon.[png|ico] file in the game's data.
//filesystem rebranding
//#define GAME_SHORTNAME "wastes" //short alphanumeric description
//#define GAME_FULLNAME FULLENGINENAME //full name of the game we're playing
//#define GAME_BASEGAMES GAME_SHORTNAME //comma-separate list of basegame strings to use
//#define GAME_PROTOCOL "FTE-Wastes" //so other games won't show up in the server browser
//#define GAME_IDENTIFYINGFILES NULL //with multiple games, this string-list gives verification that the basedir is actually valid. if null, will just be assumed correct.
//#define GAME_DOWNLOADSURL NULL //url for the package manger to update from
//#define GAME_DEFAULTCMDS NULL //a string containing the things you want to exec in order to override default.cfg
// Allowed renderers... There should ONLY be undefs here (other C files won't be pulled in automatically)
//#undef GLQUAKE
//#undef D3D8QUAKE
//#undef D3D9QUAKE
//#undef D3D11QUAKE
//#undef VKQUAKE
//#undef HEADLESSQUAKE //no-op renderer...
//#undef WAYLANDQUAKE //linux only
//Misc Renderer stuff
#define PSET_CLASSIC //support the 'classic' particle system, for that classic quake feel.
//#define PSET_SCRIPT //scriptable particles (both fte's and importing effectinfo)
//#define RTLIGHTS
//#define RUNTIMELIGHTING //automatic generation of .lit files
//#define R_XFLIP //old silly thing
//Extra misc features.
//#define CLIENTONLY //
#define MULTITHREAD //misc basic multithreading - dsound, downloads, basic stuff that's unlikely to have race conditions.
#define LOADERTHREAD //worker threads for loading misc stuff. falls back on main thread if not supported.
#define AVAIL_DINPUT
//#define SIDEVIEWS 4 //enable secondary/reverse views.
//#define TEXTEDITOR //my funky text editor! its awesome!
//#define PLUGINS //support for external plugins (like huds or fancy menus or whatever)
//#define USE_SQLITE //sql-database-as-file support
//Filesystem formats
//#define PACKAGE_PK3
#define PACKAGE_Q1PAK //also q2
//#define PACKAGE_DOOMWAD //doom wad support (generates various file names, and adds support for doom's audio, sprites, etc)
//#define AVAIL_XZDEC //.xz decompression
//#define AVAIL_GZDEC //.gz decompression
//#define AVAIL_ZLIB //whether pk3s can be compressed or not.
//#define AVAIL_DZIP //.dzip support for smaller demos (which are actually more like pak files and can store ANY type of file)
//Map formats
#define Q1BSPS //Quake1
//#define Q2BSPS //Quake2
//#define Q3BSPS //Quake3, as well as a load of other games too...
//#define RFBSPS //qfusion's bsp format / jk2o etc.
//#define TERRAIN //FTE's terrain, as well as .map support
//#define DOOMWADS //map support, filesystem support is separate.
//#define MAP_PROC //doom3...
//Model formats
#define SPRMODELS //Quake's sprites
//#define SP2MODELS //Quake2's models
#define DSPMODELS //Doom sprites!
#define MD1MODELS //Quake's models.
//#define MD2MODELS //Quake2's models
//#define MD3MODELS //Quake3's models, also often used for q1 etc too.
//#define MD5MODELS //Doom3 models.
//#define ZYMOTICMODELS //nexuiz uses these, for some reason.
//#define DPMMODELS //these keep popping up, despite being a weak format.
//#define PSKMODELS //unreal's interchange format. Undesirable in terms of load times.
//#define HALFLIFEMODELS //horrible format that doesn't interact well with the rest of FTE's code. Unusable tools (due to license reasons).
//#define INTERQUAKEMODELS //Preferred model format, at least from an idealism perspective.
//#define RAGDOLL //ragdoll support. requires RBE support (via a plugin...).
//Image formats
//#define IMAGEFMT_KTX //Khronos TeXture. common on gles3 devices for etc2 compression
//#define IMAGEFMT_PKM //file format generally written by etcpack or android's etc1tool. doesn't support mips.
//#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
//#define IMAGEFMT_BLP //legacy crap
#define PACKAGE_TEXWAD //quake's image wad support
//#define AVAIL_PNGLIB //.png image format support (read+screenshots)
//#define AVAIL_JPEGLIB //.jpeg image format support (read+screenshots)
//#define AVAIL_FREETYPE //for truetype font rendering
//#define DECOMPRESS_ETC2 //decompress etc2(core in gles3/gl4.3) if the graphics driver doesn't support it (eg d3d or crappy gpus with vulkan).
////#define DECOMPRESS_S3TC //allows bc1-3 to work even when drivers don't support it. This is probably only an issue on mobile chips. WARNING: not entirely sure if all patents expired yet...
//#define DECOMPRESS_RGTC //bc4+bc5
// Game/Gamecode Support
//#define CSQC_DAT
//#define MENU_DAT
//#define VM_Q1 //q1qvm implementation, to support ktx.
////#define VM_LUA //optionally supports lua instead of ssqc.
//#define Q2SERVER //q2 server+gamecode.
//#define Q2CLIENT //q2 client. file formats enabled separately.
//#define Q3CLIENT //q3 client stuff.
//#define Q3SERVER //q3 server stuff.
//#define BOTLIB_STATIC //q3 botlib
//#define HEXEN2 //runs hexen2 gamecode, supports hexen2 file formats.
//#define HUFFNETWORK //crappy network compression. probably needs reseeding.
#define NETPREPARSE //allows for running both nq+qw on the same server (if not, protocol used must match gamecode).
//#define SUBSERVERS //Allows the server to fork itself, each acting as an MMO-style server instance of a single 'realm'.
////#define HLCLIENT 7 //we can run HL gamecode (not protocol compatible, set to 6 or 7)
////#define HLSERVER 140 //we can run HL gamecode (not protocol compatible, set to 138 or 140)
// Networking options
//#define NQPROT //act as an nq client/server, with nq gamecode.
#define HAVE_PACKET //we can send unreliable messages!
//#define HAVE_TCP //we can create/accept TCP connections.
//#define HAVE_GNUTLS //on linux
//#define HAVE_WINSSPI //on windows
//#define FTPSERVER //sv_ftp cvar.
//#define WEBCLIENT //uri_get+any internal downloads etc
//#define TCPCONNECT //support for playing over tcp sockets, instead of just udp. compatible with qizmo.
//#define IRCCONNECT //lame support for routing game packets via irc server. not a good idea.
//#define SUPPORT_ICE //Internet Connectivity Establishment, for use by plugins to establish voice or game connections.
//#define CL_MASTER //Clientside Server Browser functionality.
// Audio Drivers
//#define AVAIL_OPENAL
//#define AVAIL_WASAPI //windows advanced sound api
//#define HAVE_MIXER //support non-openal audio drivers
// Audio Formats
//#define AVAIL_OGGVORBIS //.ogg support
//#define AVAIL_MP3_ACM //.mp3 support (windows only).
// Other Audio Options
//#define VOICECHAT
//#define HAVE_MEDIA_DECODER //can play cin/roq, more with plugins
//#define HAVE_MEDIA_ENCODER //capture/capturedemo work.
//#define HAVE_CDPLAYER //includes cd playback. actual cds. named/numbered tracks are supported regardless (though you need to use the 'music' command to play them without this).
//#define HAVE_JUKEBOX //includes built-in jukebox crap
//#define HAVE_SPEECHTOTEXT //windows speech-to-text thing
// Features required by vanilla quake/quakeworld...
//#define QUAKETC
#define QUAKESTATS //defines STAT_HEALTH etc. if omitted, you'll need to provide that functionality yourself.
#define QUAKEHUD //support for drawing the vanilla hud.
#define QWSKINS //disabling this means no qw .pcx skins nor enemy/team skin/colour forcing
//#define NOBUILTINMENUS
//#define NOLEGACY //just spike trying to kill off crappy crap...
//#define USEAREAGRID //world collision optimisation. REQUIRED for performance with xonotic. hopefully it helps a few other mods too.
#define NOQCDESCRIPTIONS 2 //if 2, disables writing fteextensions.qc completely. 1 just omits the text. (ignored in debug builds.)
// Outdated stuff
//#define SVRANKING //legacy server-side ranking system.
////#define QTERM //qterm... adds a console command that allows running programs from within quake - bit like xterm.
////#define SVCHAT //ancient lame builtin to support NPC-style chat...
////#define SV_MASTER //Support running the server as a master server. Should probably not be used.
////#define WEBSERVER //outdated sv_http cvar. new stuff acts via sv_port_tcp instead (which also gives https).
////#define QUAKESPYAPI //define this if you want the engine to be usable via gamespy/quakespy, which has been dead for a long time now. forces the client to use a single port for all outgoing connections, which hurts reconnects.
#ifdef COMPILE_OPTS
//things to configure qclib, which annoyingly doesn't include this file itself
-DOMIT_QCC //disable the built-in qcc
-DSIMPLE_QCVM //disable qc debugging and 32bit opcodes
#ifndef AVAIL_ZLIB
-DNO_ZLIB //disable zlib
#endif
-DNO_OPUS
-DNO_SPEEX //disable static speex
#ifndef BOTLIB_STATIC
-DNO_BOTLIB //disable static botlib
#endif
-DNO_VORBISFILE //disable static vorbisfile
-Os //optimise for size instead of speed. less cpu cache needed means that its sometimes faster anyway.
#endif

View File

@ -0,0 +1,178 @@
// Build-Config file for FTE's standard builds, the default settings.
// to use: make FTE_CONFIG=fteqw
// Features should either be commented or not. If you change undefs to defines or vice versa then expect problems.
// Later code will disable any features if they're not supported on the current platform, so don't worry about win/lin/mac/android/web/etc here - any such issues should be fixed elsewhere.
//general rebranding
//#define DISTRIBUTION "FTE" //should be kept short. 3 or 4 letters is good, with no spaces.
//#define DISTRIBUTIONLONG "Forethought Entertainment" //think of this as your company name. It isn't shown too often, so can be quite long.
//#define FULLENGINENAME "FTE Engine" //nominally user-visible name.
//#define ENGINEWEBSITE "http://fte.triptohell.info" //for shameless self-promotion purposes.
//#define BRANDING_ICON "fte_eukara.ico" //The file to use in windows' resource files - for linux your game should include an icon.[png|ico] file in the game's data.
//filesystem rebranding
//#define GAME_SHORTNAME "fte" //short alphanumeric description
//#define GAME_FULLNAME FULLENGINENAME //full name of the game we're playing
//#define GAME_BASEGAMES GAME_SHORTNAME //comma-separate list of basegame strings to use
//#define GAME_PROTOCOL "FTE-Generic" //so other games won't show up in the server browser
//#define GAME_IDENTIFYINGFILES NULL //with multiple games, this string-list gives verification that the basedir is actually valid. if null, will just be assumed correct.
//#define GAME_DOWNLOADSURL NULL //url for the package manger to update from
//#define GAME_DEFAULTCMDS NULL //a string containing the things you want to exec in order to override default.cfg
// Allowed renderers... There should ONLY be undefs here (other C files won't be pulled in automatically)
//#undef GLQUAKE
//#undef D3D8QUAKE
//#undef D3D9QUAKE
//#undef D3D11QUAKE
//#undef VKQUAKE
//#undef HEADLESSQUAKE //no-op renderer...
//#undef WAYLANDQUAKE //linux only
//Misc Renderer stuff
//#define PSET_CLASSIC //support the 'classic' particle system, for that classic quake feel.
#define PSET_SCRIPT //scriptable particles (both fte's and importing effectinfo)
#define RTLIGHTS
//#define RUNTIMELIGHTING //automatic generation of .lit files
//#define R_XFLIP //old silly thing
//Extra misc features.
//#define CLIENTONLY //
#define MULTITHREAD //misc basic multithreading - dsound, downloads, basic stuff that's unlikely to have race conditions.
#define LOADERTHREAD //worker threads for loading misc stuff. falls back on main thread if not supported.
#define AVAIL_DINPUT
//#define SIDEVIEWS 4 //enable secondary/reverse views.
//#define TEXTEDITOR //my funky text editor! its awesome!
#define PLUGINS //support for external plugins (like huds or fancy menus or whatever)
//#define USE_SQLITE //sql-database-as-file support
//Filesystem formats
#define PACKAGE_PK3
//#define PACKAGE_Q1PAK //also q2
//#define PACKAGE_DOOMWAD //doom wad support (generates various file names, and adds support for doom's audio, sprites, etc)
//#define AVAIL_XZDEC //.xz decompression
#define AVAIL_GZDEC //.gz decompression
#define AVAIL_ZLIB //whether pk3s can be compressed or not.
//#define AVAIL_DZIP //.dzip support for smaller demos (which are actually more like pak files and can store ANY type of file)
//Map formats
#define Q1BSPS //Quake1
#define Q2BSPS //Quake2
#define Q3BSPS //Quake3, as well as a load of other games too...
#define RFBSPS //qfusion's bsp format / jk2o etc.
//#define TERRAIN //FTE's terrain, as well as .map support
//#define DOOMWADS //map support, filesystem support is separate.
//#define MAP_PROC //doom3...
//Model formats
#define SPRMODELS //Quake's sprites
//#define SP2MODELS //Quake2's models
//#define DSPMODELS //Doom sprites!
//#define MD1MODELS //Quake's models.
//#define MD2MODELS //Quake2's models
//#define MD3MODELS //Quake3's models, also often used for q1 etc too.
//#define MD5MODELS //Doom3 models.
//#define ZYMOTICMODELS //nexuiz uses these, for some reason.
//#define DPMMODELS //these keep popping up, despite being a weak format.
//#define PSKMODELS //unreal's interchange format. Undesirable in terms of load times.
//#define HALFLIFEMODELS //horrible format that doesn't interact well with the rest of FTE's code. Unusable tools (due to license reasons).
#define INTERQUAKEMODELS //Preferred model format, at least from an idealism perspective.
#define RAGDOLL //ragdoll support. requires RBE support (via a plugin...).
//Image formats
#define IMAGEFMT_KTX //Khronos TeXture. common on gles3 devices for etc2 compression
//#define IMAGEFMT_PKM //file format generally written by etcpack or android's etc1tool. doesn't support mips.
#define IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
//#define IMAGEFMT_BLP //legacy crap
//#define PACKAGE_TEXWAD //quake's image wad support
#define AVAIL_PNGLIB //.png image format support (read+screenshots)
//#define AVAIL_JPEGLIB //.jpeg image format support (read+screenshots)
#define AVAIL_FREETYPE //for truetype font rendering
#define DECOMPRESS_ETC2 //decompress etc2(core in gles3/gl4.3) if the graphics driver doesn't support it (eg d3d or crappy gpus with vulkan).
//#define DECOMPRESS_S3TC //allows bc1-3 to work even when drivers don't support it. This is probably only an issue on mobile chips. WARNING: not entirely sure if all patents expired yet...
#define DECOMPRESS_RGTC //bc4+bc5
// Game/Gamecode Support
#define CSQC_DAT
#define MENU_DAT
//#define VM_Q1 //q1qvm implementation, to support ktx.
//#define VM_LUA //optionally supports lua instead of ssqc.
//#define Q2SERVER //q2 server+gamecode.
//#define Q2CLIENT //q2 client. file formats enabled separately.
//#define Q3CLIENT //q3 client stuff.
//#define Q3SERVER //q3 server stuff.
//#define BOTLIB_STATIC //q3 botlib
//#define HEXEN2 //runs hexen2 gamecode, supports hexen2 file formats.
//#define HUFFNETWORK //crappy network compression. probably needs reseeding.
//#define NETPREPARSE //allows for running both nq+qw on the same server (if not, protocol used must match gamecode).
//#define SUBSERVERS //Allows the server to fork itself, each acting as an MMO-style server instance of a single 'realm'.
//#define HLCLIENT 7 //we can run HL gamecode (not protocol compatible, set to 6 or 7)
//#define HLSERVER 140 //we can run HL gamecode (not protocol compatible, set to 138 or 140)
// Networking options
//#define NQPROT //act as an nq client/server, with nq gamecode.
#define HAVE_PACKET //we can send unreliable messages!
#define HAVE_TCP //we can create/accept TCP connections.
#define HAVE_GNUTLS //on linux
#define HAVE_WINSSPI //on windows
//#define FTPSERVER //sv_ftp cvar.
#define WEBCLIENT //uri_get+any internal downloads etc
//#define TCPCONNECT //support for playing over tcp sockets, instead of just udp. compatible with qizmo.
//#define IRCCONNECT //lame support for routing game packets via irc server. not a good idea.
#define SUPPORT_ICE //Internet Connectivity Establishment, for use by plugins to establish voice or game connections.
#define CL_MASTER //Clientside Server Browser functionality.
// Audio Drivers
#define AVAIL_OPENAL
#define AVAIL_WASAPI //windows advanced sound api
#define HAVE_MIXER //support non-openal audio drivers
// Audio Formats
#define AVAIL_OGGVORBIS //.ogg support
//#define AVAIL_MP3_ACM //.mp3 support (windows only).
// Other Audio Options
#define VOICECHAT
#define HAVE_MEDIA_DECODER //can play cin/roq, more with plugins
#define HAVE_MEDIA_ENCODER //capture/capturedemo work.
//#define HAVE_CDPLAYER //includes cd playback. actual cds. named/numbered tracks are supported regardless (though you need to use the 'music' command to play them without this).
//#define HAVE_JUKEBOX //includes built-in jukebox crap
//#define HAVE_SPEECHTOTEXT //windows speech-to-text thing
// Features required by vanilla quake/quakeworld...
#define QUAKETC
//#define QUAKESTATS //defines STAT_HEALTH etc. if omitted, you'll need to provide that functionality yourself.
//#define QUAKEHUD //support for drawing the vanilla hud.
#define QWSKINS //disabling this means no qw .pcx skins nor enemy/team skin/colour forcing
#define NOBUILTINMENUS
#define NOLEGACY //just spike trying to kill off crappy crap...
#define USEAREAGRID //world collision optimisation. REQUIRED for performance with xonotic. hopefully it helps a few other mods too.
//#define NOQCDESCRIPTIONS 2 //if 2, disables writing fteextensions.qc completely. 1 just omits the text. (ignored in debug builds.)
// Outdated stuff
//#define SVRANKING //legacy server-side ranking system.
////#define QTERM //qterm... adds a console command that allows running programs from within quake - bit like xterm.
//#define SVCHAT //ancient lame builtin to support NPC-style chat...
////#define SV_MASTER //Support running the server as a master server. Should probably not be used.
////#define WEBSERVER //outdated sv_http cvar. new stuff acts via sv_port_tcp instead (which also gives https).
////#define QUAKESPYAPI //define this if you want the engine to be usable via gamespy/quakespy, which has been dead for a long time now. forces the client to use a single port for all outgoing connections, which hurts reconnects.
#ifdef COMPILE_OPTS
//things to configure qclib, which annoyingly doesn't include this file itself
//-DOMIT_QCC //disable the built-in qcc
//-DSIMPLE_QCVM //disable qc debugging and 32bit opcodes
#ifndef AVAIL_ZLIB
//-DNO_ZLIB //disable zlib
#endif
//-DNO_OPUS
//-DNO_SPEEX //disable static speex
#ifndef BOTLIB_STATIC
-DNO_BOTLIB //disable static botlib
#endif
//-DNO_VORBISFILE //disable static vorbisfile
//-Os //optimise for size instead of speed. less cpu cache needed means that its sometimes faster anyway.
#endif

View File

@ -29,6 +29,7 @@
#endif
#undef VKQUAKE
#undef HEADLESSQUAKE
#undef WAYLANDQUAKE
#define HAVE_PACKET
#define QUAKETC
@ -75,6 +76,7 @@
#define INTERQUAKEMODELS
#undef SPRMODELS
#undef SP2MODELS
#undef DSPMODELS
#undef MD1MODELS
#undef MD2MODELS
#undef MD3MODELS
@ -90,11 +92,17 @@
#undef BOTLIB_STATIC //q3 botlib
#undef AVAIL_XZDEC //.xz decompression
#undef AVAIL_GZDEC //.gz decompression
#undef AVAIL_DZIP //.dzip special-case archive support
#undef AVAIL_PNGLIB //.png image format support (read+screenshots)
#undef AVAIL_JPEGLIB //.jpeg image format support (read+screenshots)
#undef AVAIL_MP3_ACM //.mp3 support (in windows).
#undef IMAGEFMT_KTX
#undef IMAGEFMT_PKM
#undef IMAGEFMT_DDS //.dds files embed mipmaps and texture compression. faster to load.
#undef IMAGEFMT_BLP //legacy crap
#undef DECOMPRESS_ETC2
#undef DECOMPRESS_RGTC
#undef DECOMPRESS_S3TC
#undef NETPREPARSE //allows for running both nq+qw on the same server (if not, protocol used must match gamecode).
#undef USE_SQLITE //sql-database-as-file support
#undef QUAKESTATS //defines STAT_HEALTH etc. if omitted, you'll need to provide that functionality yourself.
@ -122,6 +130,19 @@
#undef SUPPORT_ICE //Internet Connectivity Establishment, for use by plugins to establish voice or game connections.
#undef PSET_CLASSIC //support the 'classic' particle system, for that classic quake feel.
#undef HAVE_CDPLAYER //includes cd playback. actual cds. named/numbered tracks are supported regardless (though you need to use the 'music' command to play them without this).
#undef QTERM
#undef SIDEVIEWS
#undef SUBSERVERS
#undef SV_MASTER
#undef HAVE_MIXER //openal only
#undef VM_LUA
#undef HLCLIENT
#undef HLSERVER
#undef FTPSERVER
//undef CLIENTONLY //leave this up to the makefiles.
#undef HAVE_TCP
#undef HAVE_GNUTLS //linux tls/dtls support
#undef HAVE_WINSSPI //windows tls/dtls support
#undef HAVE_JUKEBOX //includes built-in jukebox crap
#undef HAVE_MEDIA_DECODER //can play cin/roq, more with plugins
#undef HAVE_MEDIA_ENCODER //capture/capturedemo work.

View File

@ -718,6 +718,19 @@ void COM_Path_f (void)
{
searchpath_t *s;
if (!com_searchpaths && !com_purepaths)
{
Con_Printf("File system not initialised\n");
Con_Printf("gamedirfile: \"%s\"\n", gamedirfile);
Con_Printf("pubgamedirfile: \"%s\"\n", pubgamedirfile);
Con_Printf("com_gamepath: \"%s\"\n", com_gamepath);
Con_Printf("com_homepath: \"%s\" (enabled: %s, usable: %s)\n", com_homepath, com_homepathenabled?"yes":"no", com_homepathusable?"yes":"no");
Con_Printf("com_configdir: \"%s\"\n", com_configdir);
if (fs_manifest)
FS_Manifest_Print(fs_manifest);
return;
}
Con_TPrintf ("Current search path:\n");
if (com_purepaths || fs_puremode)

View File

@ -37,12 +37,20 @@ static int QDECL VFSSTDIO_WriteBytes (struct vfsfile_s *file, const void *buffer
static qboolean QDECL VFSSTDIO_Seek (struct vfsfile_s *file, qofs_t pos)
{
vfsstdiofile_t *intfile = (vfsstdiofile_t*)file;
#if _POSIX_C_SOURCE >= 200112L
return fseeko(intfile->handle, (off_t)pos, SEEK_SET) == 0;
#else
return fseek(intfile->handle, pos, SEEK_SET) == 0;
#endif
}
static qofs_t QDECL VFSSTDIO_Tell (struct vfsfile_s *file)
{
vfsstdiofile_t *intfile = (vfsstdiofile_t*)file;
#if _POSIX_C_SOURCE >= 200112L
return (qofs_t)ftello(intfile->handle);
#else
return ftell(intfile->handle);
#endif
}
static void QDECL VFSSTDIO_Flush(struct vfsfile_s *file)
{
@ -53,12 +61,21 @@ static qofs_t QDECL VFSSTDIO_GetSize (struct vfsfile_s *file)
{
vfsstdiofile_t *intfile = (vfsstdiofile_t*)file;
#if _POSIX_C_SOURCE >= 200112L
off_t curpos;
qofs_t maxlen;
curpos = ftello(intfile->handle);
fseeko(intfile->handle, 0, SEEK_END);
maxlen = (qofs_t)ftello(intfile->handle);
fseeko(intfile->handle, curpos, SEEK_SET);
#else
unsigned int curpos;
unsigned int maxlen;
curpos = ftell(intfile->handle);
fseek(intfile->handle, 0, SEEK_END);
maxlen = ftell(intfile->handle);
fseek(intfile->handle, curpos, SEEK_SET);
#endif
return maxlen;
}
@ -139,6 +156,7 @@ vfsfile_t *VFSSTDIO_Open(const char *osname, const char *mode, qboolean *needsfl
qboolean write = !!strchr(mode, 'w');
qboolean append = !!strchr(mode, 'a');
qboolean text = !!strchr(mode, 't');
// qboolean dolock = !!strchr(mode, 'l');
char newmode[5];
int modec = 0;

View File

@ -164,7 +164,7 @@ unsigned int Net_PextMask(int maskset, qboolean fornq)
#ifdef PEXT_CHUNKEDDOWNLOADS
mask |= PEXT_CHUNKEDDOWNLOADS;
#endif
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
mask |= PEXT_CSQC;
#endif
#ifdef PEXT_DPFLAGS
@ -175,7 +175,7 @@ unsigned int Net_PextMask(int maskset, qboolean fornq)
{
//only ones that are tested
mask &=
#ifdef PEXT_CSQC
#ifdef CSQC_DAT
PEXT_CSQC |
#endif
#ifdef PEXT_Q2BSP

View File

@ -178,8 +178,8 @@ static int (VARGS *qgnutls_x509_crt_import)(gnutls_x509_crt_t cert, const gnutls
#endif
static const gnutls_datum_t *(VARGS *qgnutls_certificate_get_peers)(gnutls_session_t session, unsigned int * list_size);
static gnutls_certificate_type_t (VARGS *qgnutls_certificate_type_get)(gnutls_session_t session);
static void *(VARGS *qgnutls_malloc)(size_t);
static void (VARGS *qgnutls_free)(void * ptr);
static void *(VARGS **qgnutls_malloc)(size_t);
static void (VARGS **qgnutls_free)(void * ptr);
static int (VARGS *qgnutls_server_name_set)(gnutls_session_t session, gnutls_server_name_type_t type, const void * name, size_t name_length);
#ifdef HAVE_DTLS
@ -259,7 +259,7 @@ static qboolean Init_GNUTLS(void)
GNUTLS_FUNC(gnutls_x509_crt_export2) \
GNUTLS_FUNC(gnutls_x509_privkey_init) \
GNUTLS_FUNC(gnutls_x509_privkey_deinit) \
GNUTLS_FUNC(gnutls_x509_privkey_generate2) \
GNUTLS_FUNC(gnutls_x509_privkey_generate) \
GNUTLS_FUNC(gnutls_x509_privkey_export2) \
GNUTLS_FUNC(gnutls_x509_crt_privkey_sign) \
GNUTLS_FUNC(gnutls_privkey_init) \
@ -853,7 +853,7 @@ qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred)
qgnutls_x509_privkey_init(&key);
ret = qgnutls_x509_privkey_generate(key, privalgo, qgnutls_sec_param_to_pk_bits(privalgo, GNUTLS_SEC_PARAM_HIGH), 0);
if (ret < 0)
Con_Printf("gnutls_x509_privkey_generate2 failed: %i\n", ret);
Con_Printf("gnutls_x509_privkey_generate failed: %i\n", ret);
ret = qgnutls_x509_privkey_export2(key, GNUTLS_X509_FMT_PEM, &priv);
if (ret < 0)
Con_Printf("gnutls_x509_privkey_export2 failed: %i\n", ret);
@ -886,32 +886,35 @@ qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred)
qgnutls_privkey_deinit(akey);
}
ret = qgnutls_x509_crt_export2(cert, GNUTLS_X509_FMT_PEM, &pub);
if (ret < 0)
Con_Printf("gnutls_x509_crt_export2 failed: %i\n", ret);
qgnutls_x509_crt_deinit(cert);
qgnutls_x509_privkey_deinit(key);
if (ret < 0)
Con_Printf("gnutls_x509_crt_export2 failed: %i\n", ret);
if (priv.size && pub.size)
{
char fullname[MAX_OSPATH];
privf = FS_OpenVFS(privname, "wb", FS_ROOT);
if (privf)
{
Con_Printf("Wrote %s\n", privname);
VFS_WRITE(privf, priv.data, priv.size);
VFS_CLOSE(privf);
FS_NativePath(privname, FS_ROOT, fullname, sizeof(fullname));
Con_Printf("Wrote %s\n", fullname);
}
memset(priv.data, 0, priv.size);
qgnutls_free(priv.data);
// memset(priv.data, 0, priv.size);
(*qgnutls_free)(priv.data);
memset(&priv, 0, sizeof(priv));
pubf = FS_OpenVFS(pubname, "wb", FS_ROOT);
if (pubf)
{
Con_Printf("Wrote %s\n", pubname);
VFS_WRITE(pubf, pub.data, pub.size);
VFS_CLOSE(pubf);
FS_NativePath(pubname, FS_ROOT, fullname, sizeof(fullname));
Con_Printf("Wrote %s\n", fullname);
}
qgnutls_free(pub.data);
(*qgnutls_free)(pub.data);
memset(&pub, 0, sizeof(pub));
privf = FS_OpenVFS(privname, "rb", FS_ROOT);
@ -925,13 +928,13 @@ qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred)
{
//read the two files now
priv.size = VFS_GETLEN(privf);
priv.data = qgnutls_malloc(priv.size+1);
priv.data = (*qgnutls_malloc)(priv.size+1);
if (priv.size != VFS_READ(privf, priv.data, priv.size))
priv.size = 0;
priv.data[priv.size] = 0;
pub.size = VFS_GETLEN(pubf);
pub.data = qgnutls_malloc(pub.size+1);
pub.data = (*qgnutls_malloc)(pub.size+1);
if (pub.size != VFS_READ(pubf, pub.data, pub.size))
pub.size = 0;
pub.data[pub.size] = 0;
@ -949,8 +952,10 @@ qboolean SSL_LoadPrivateCert(gnutls_certificate_credentials_t cred)
Con_Printf("Unable to read/generate cert\n");
memset(priv.data, 0, priv.size);//just in case. FIXME: we didn't scrub the filesystem code. libc has its own caches etc. lets hope that noone comes up with some way to scrape memory remotely (although if they can inject code then we've lost either way so w/e)
qgnutls_free(priv.data);
qgnutls_free(pub.data);
if (priv.data)
(*qgnutls_free)(priv.data);
if (pub.data)
(*qgnutls_free)(pub.data);
return ret>=0;
}
@ -961,12 +966,14 @@ qboolean SSL_InitGlobal(qboolean isserver)
isserver = !!isserver;
if (COM_CheckParm("-notls"))
return false;
Sys_LockMutex(com_resourcemutex);
if (com_resourcemutex)
Sys_LockMutex(com_resourcemutex);
if (!initstatus[isserver])
{
if (!Init_GNUTLS())
{
Sys_UnlockMutex(com_resourcemutex);
if (com_resourcemutex)
Sys_UnlockMutex(com_resourcemutex);
Con_Printf("GnuTLS "GNUTLS_VERSION" library not available.\n");
return false;
}
@ -991,7 +998,8 @@ qboolean SSL_InitGlobal(qboolean isserver)
qgnutls_certificate_set_x509_trust_file (xcred[isserver], CAFILE, GNUTLS_X509_FMT_PEM);
#endif
Sys_UnlockMutex(com_resourcemutex);
if (com_resourcemutex)
Sys_UnlockMutex(com_resourcemutex);
if (isserver)
{
#if 1
@ -1017,7 +1025,10 @@ qboolean SSL_InitGlobal(qboolean isserver)
#endif
}
else
Sys_UnlockMutex(com_resourcemutex);
{
if (com_resourcemutex)
Sys_UnlockMutex(com_resourcemutex);
}
if (initstatus[isserver] < 0)
return false;

View File

@ -102,6 +102,27 @@ cvar_t net_enable_http = CVARD("net_enable_http", "1", "If enabled, tcp port
cvar_t net_enable_websockets = CVARD("net_enable_websockets", "1", "If enabled, tcp ports will accept websocket game clients.");
cvar_t net_enable_webrtcbroker = CVARD("net_enable_webrtcbroker", "1", "If 1, tcp ports will accept websocket connections from clients trying to broker direct webrtc connections. This should be low traffic, but might involve a lot of mostly-idle connections.");
#endif
#if defined(HAVE_DTLS) && !defined(CLIENTONLY)
static void QDECL NET_Enable_DTLS_Changed(struct cvar_s *var, char *oldvalue)
{
//set up the default value
if (!*var->string)
var->ival = 0; //FIXME: change to 1 then 2 when better tested.
if (var->ival && svs.sockets)
{
if (!svs.sockets->dtlsfuncs)
svs.sockets->dtlsfuncs = DTLS_InitServer();
if (!svs.sockets->dtlsfuncs)
{
if (var->ival >= 2)
Con_Printf("%sUnable to set %s to \"%s\", no DTLS certificate available.\n", (var->ival >= 2)?CON_ERROR:CON_WARNING, var->name, var->string);
var->ival = 0; //disable the cvar (internally) if we don't have a usable certificate. this allows us to default the cvar to enabled without it breaking otherwise.
}
}
}
cvar_t net_enable_dtls = CVARAFCD("net_enable_dtls", "", "sv_listen_dtls", 0, NET_Enable_DTLS_Changed, "Controls serverside dtls support.\n0: dtls blocked, not advertised.\n1: available in desired.\n2: used where possible (recommended setting).\n3: disallow non-dtls clients (sv_port_tcp should be eg tls://[::]:27500 to also disallow unencrypted tcp connections).");
#endif
#ifndef SERVERONLY
static void QDECL cl_delay_packets_Announce(cvar_t *var, char *oldval)
@ -4360,7 +4381,7 @@ closesvstream:
if (st->inlen < 6)
continue;
#ifdef HAVE_SSL //if its non-ascii, then try and upgrade the connection to tls
#if defined(HAVE_SSL) && !defined(CLIENTONLY) //if its non-ascii, then try and upgrade the connection to tls
if (net_enable_tls.ival && con->generic.islisten && st->remoteaddr.prot == NP_STREAM && st->clientstream && !((st->inbuffer[0] >= 'a' && st->inbuffer[0] <= 'z') || (st->inbuffer[0] >= 'A' && st->inbuffer[0] <= 'Z')))
{
//copy off our buffer so we can read it into the tls stream's buffer instead.
@ -7509,6 +7530,9 @@ void SVNET_RegisterCvars(void)
Cvar_Register (&net_enable_websockets, "networking");
Cvar_Register (&net_enable_webrtcbroker, "networking");
#endif
#if defined(HAVE_DTLS) && !defined(CLIENTONLY)
Cvar_Register (&net_enable_dtls, "networking");
#endif
}
void NET_CloseServer(void)
@ -7556,6 +7580,9 @@ void NET_InitServer(void)
#endif
#ifdef HAVE_NATPMP
Cvar_ForceCallback(&sv_port_natpmp);
#endif
#ifdef HAVE_DTLS
Cvar_ForceCallback(&net_enable_dtls);
#endif
}
else

View File

@ -4541,7 +4541,7 @@ static void PR_uri_get_callback(struct dl_download *dl)
int selfnum = dl->user_num;
func_t func;
if (!prinst || dl->user_sequence != svs.spawncount)
if (!prinst || dl->user_sequence != w->spawncount)
return;
func = PR_FindFunction(prinst, "URI_Get_Callback", PR_ANY);
@ -4672,7 +4672,7 @@ void QCBUILTIN PF_uri_get (pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
dl->user_ctx = w;
dl->user_float = id;
dl->user_num = *w->g.self;
dl->user_sequence = svs.spawncount;
dl->user_sequence = w->spawncount;
dl->isquery = true;
#ifdef MULTITHREAD
@ -6073,8 +6073,10 @@ void QCBUILTIN PF_getentityfieldstring (pubprogfuncs_t *prinst, struct globalvar
return;
}
#ifndef CLIENTONLY
#ifdef HEXEN2
else if (isserver && (float*)eval == &((edict_t*)ent)->xv->drawflags && eval->_float == 96)
return;
#endif
else if (isserver && (float*)eval == &((edict_t*)ent)->xv->uniquespawnid)
return;
#endif

View File

@ -235,6 +235,7 @@ void QCBUILTIN PF_setattachment(pubprogfuncs_t *prinst, struct globalvars_s *pr_
#define PF_skel_get_bonename PF_Fixme
#define PF_skel_get_numbones PF_Fixme
#define PF_skel_build PF_Fixme
#define PF_skel_build_ptr PF_Fixme
#define PF_skel_create PF_Fixme
#define PF_skinforname PF_Fixme

View File

@ -57,15 +57,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PEXT_SETATTACHMENT 0x08000000 //md3 tags (needs networking, they need to lerp).
//#define PEXT_NEVERUSED 0x10000000 //reserved for a future multicastmask
#define PEXT_CHUNKEDDOWNLOADS 0x20000000 //alternate file download method. Hopefully it'll give quadroupled download speed, especially on higher pings.
#ifdef CSQC_DAT
#define PEXT_CSQC 0x40000000 //csqc additions
#endif
#define PEXT_DPFLAGS 0x80000000 //extra flags for viewmodel/externalmodel and possible other persistant style flags.
#ifdef CSQC_DAT
#define PEXT_BIGUSERINFOS PEXT_CSQC
#define PEXT_BIGUSERINFOS PEXT_CSQC //FIXME: while useful for csqc, we should include something else that isn't so often stripped, or is available in ezquake, or something.
#else
#define PEXT_BIGUSERINFOS 0xffffffff
#endif
@ -287,9 +283,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcfte_effect 74 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
#define svcfte_effect2 75 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
#ifdef PEXT_CSQC
#define svcfte_csqcentities 76 //entity lump for csqc
#endif
#define svcfte_precache 77

View File

@ -210,6 +210,7 @@ struct world_s
struct pubprogfuncs_s *progs;
qboolean usesolidcorpse; //to disable SOLID_CORPSE when running hexen2 due to conflict.
model_t *worldmodel;
unsigned int spawncount; //number of times it got restarted, so we can stop events from happening after vm restarts
#ifdef USEAREAGRID
vec2_t gridbias;

View File

@ -45,7 +45,16 @@ extern unsigned int r2d_be_flags;
static FT_Library fontlib;
#ifdef FREETYPE_STATIC
#define pFT_Init_FreeType FT_Init_FreeType
#define pFT_Load_Char FT_Load_Char
#define pFT_Get_Char_Index FT_Get_Char_Index
#define pFT_Set_Pixel_Sizes FT_Set_Pixel_Sizes
#define pFT_Select_Size FT_Select_Size
#define pFT_New_Face FT_New_Face
#define pFT_New_Memory_Face FT_New_Memory_Face
#define pFT_Done_Face FT_Done_Face
#else
qboolean triedtoloadfreetype;
dllhandle_t *fontmodule;
FT_Error (VARGS *pFT_Init_FreeType) (FT_Library *alibrary);
@ -56,6 +65,7 @@ FT_Error (VARGS *pFT_Select_Size) (FT_Face face, FT_Int strike_index);
FT_Error (VARGS *pFT_New_Face) (FT_Library library, const char *pathname, FT_Long face_index, FT_Face *aface);
FT_Error (VARGS *pFT_New_Memory_Face) (FT_Library library, const FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface);
FT_Error (VARGS *pFT_Done_Face) (FT_Face face);
#endif
#else
typedef unsigned int FT_Pixel_Mode; //for consistency even without freetype support.
#endif
@ -1363,17 +1373,7 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, const char *fontfil
if (!fontlib)
{
#if 0
pFT_Init_FreeType = FT_Init_FreeType;
pFT_Load_Char = FT_Load_Char;
pFT_Get_Char_Index = FT_Get_Char_Index;
pFT_Set_Pixel_Sizes = FT_Set_Pixel_Sizes;
pFT_Select_Size = FT_Select_Size;
pFT_New_Face = FT_New_Face;
pFT_New_Memory_Face = FT_New_Memory_Face;
pFT_Init_FreeType = FT_Init_FreeType;
pFT_Done_Face = FT_Done_Face;
#else
#ifndef FREETYPE_STATIC
dllfunction_t ft2funcs[] =
{
{(void**)&pFT_Init_FreeType, "FT_Init_FreeType"},
@ -1408,7 +1408,9 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, const char *fontfil
if (error)
{
Con_Printf("FT_Init_FreeType failed.\n");
#ifndef FREETYPE_STATIC
Sys_CloseLibrary(fontmodule);
#endif
return false;
}
/*any other errors leave freetype open*/

View File

@ -1441,7 +1441,7 @@ static void Terr_LoadSection(heightmap_t *hm, hmsection_t *s, int sx, int sy, un
{
//when using networked terrain, the client will never load a section from disk, but will only load it from the server
//one section at a time.
if (mod_terrain_networked.ival && !sv.state)
if (mod_terrain_networked.ival && !sv_state)
{
char fname[MAX_QPATH];
if (flags & TGS_NODOWNLOAD)
@ -1792,7 +1792,7 @@ static hmsection_t *QDECL Terr_GetSection(heightmap_t *hm, int x, int y, unsigne
//when using networked terrain, the client will never load a section from disk, but only loading it from the server
//this means we need to send a new request to download the section if it was flagged as modified.
if (!(flags & TGS_NODOWNLOAD))
if (section && (section->flags & TSF_NOTIFY) && mod_terrain_networked.ival && !sv.state)
if (section && (section->flags & TSF_NOTIFY) && mod_terrain_networked.ival && !sv_state)
{
//try to download it now...
if (!cl.downloadlist)
@ -1987,12 +1987,13 @@ void Terr_DestroySection(heightmap_t *hm, hmsection_t *s, qboolean lightmapreusa
//so the clients know to re-download the section.
static void Terr_DoEditNotify(heightmap_t *hm)
{
#ifndef CLIENTONLY
int i;
char *cmd;
hmsection_t *s;
link_t *ln = &hm->recycle;
if (!sv.state)
if (!sv_state)
return;
for (i = 0; i < sv.allocated_client_slots; i++)
@ -2021,9 +2022,9 @@ static void Terr_DoEditNotify(heightmap_t *hm)
return;
}
}
#endif
}
#ifndef SERVERONLY
//garbage collect the oldest section, to make space for another
static qboolean Terr_Collect(heightmap_t *hm)
{
@ -2067,7 +2068,6 @@ static qboolean Terr_Collect(heightmap_t *hm)
return false;
}
#endif
#endif
/*purge all sections, but not root
lightmaps only are purged whenever the client rudely kills lightmaps (purges all lightmaps on map changes, to cope with models/maps potentially being unloaded)
@ -4933,7 +4933,7 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
}
#ifndef CLIENTONLY
if (sv.state && modelindex > 0)
if (sv_state && modelindex > 0)
{
MSG_WriteByte(&sv.multicast, svcfte_brushedit);
MSG_WriteShort(&sv.multicast, modelindex);
@ -6257,7 +6257,7 @@ void CL_Parse_BrushEdit(void)
#ifdef CLIENTONLY
const qboolean ignore = false;
#else
const qboolean ignore = (sv.state>=ss_loading); //if we're the server then we already have this info. don't break anything (this info is present for demos).
const qboolean ignore = (sv_state>=ss_loading); //if we're the server then we already have this info. don't break anything (this info is present for demos).
#endif
if (cmd == hmcmd_brush_delete)

View File

@ -13,6 +13,7 @@ static dllhandle_t *eslibrary;
static EGLint (EGLAPIENTRY *qeglGetError)(void);
static EGLDisplay (EGLAPIENTRY *qeglGetPlatformDisplay)(EGLenum platform, void *native_display, const EGLint *attrib_list);
static EGLDisplay (EGLAPIENTRY *qeglGetDisplay)(EGLNativeDisplayType display_id);
static EGLBoolean (EGLAPIENTRY *qeglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor);
static EGLBoolean (EGLAPIENTRY *qeglTerminate)(EGLDisplay dpy);
@ -20,6 +21,7 @@ static EGLBoolean (EGLAPIENTRY *qeglTerminate)(EGLDisplay dpy);
static EGLBoolean (EGLAPIENTRY *qeglGetConfigs)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
static EGLBoolean (EGLAPIENTRY *qeglChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
static EGLSurface (EGLAPIENTRY *qeglCreatePlatformWindowSurface)(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
static EGLSurface (EGLAPIENTRY *qeglCreateWindowSurface)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
static EGLBoolean (EGLAPIENTRY *qeglDestroySurface)(EGLDisplay dpy, EGLSurface surface);
static EGLBoolean (EGLAPIENTRY *qeglQuerySurface)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
@ -87,6 +89,26 @@ void *EGL_Proc(char *f)
return proc;
}
const char *EGL_GetErrorString(int error)
{
switch(error)
{
case EGL_BAD_ACCESS: return "BAD_ACCESS";
case EGL_BAD_ALLOC: return "BAD_ALLOC";
case EGL_BAD_ATTRIBUTE: return "BAD_ATTRIBUTE";
case EGL_BAD_CONFIG: return "BAD_CONFIG";
case EGL_BAD_CONTEXT: return "BAD_CONEXT";
case EGL_BAD_CURRENT_SURFACE: return "BAD_CURRENT_SURFACE";
case EGL_BAD_DISPLAY: return "BAD_DISPLAY";
case EGL_BAD_MATCH: return "BAD_MATCH";
case EGL_BAD_NATIVE_PIXMAP: return "BAD_NATIVE_PIXMAP";
case EGL_BAD_NATIVE_WINDOW: return "BAD_NATIVE_WINDOW";
case EGL_BAD_PARAMETER: return "BAD_PARAMETER";
case EGL_BAD_SURFACE: return "BAD_SURFACE";
default: return va("EGL:%#x", error);
}
}
void EGL_UnloadLibrary(void)
{
if (egllibrary)
@ -116,11 +138,6 @@ qboolean EGL_LoadLibrary(char *driver)
else
Sys_Printf("success\n");
#ifndef _WIN32
if (!eslibrary)
{
eslibrary = dlopen("libGL", RTLD_NOW|RTLD_GLOBAL);
if (eslibrary) Sys_Printf("Loaded libGL\n");
}
if (!eslibrary)
{
eslibrary = dlopen("libGL.so.1.2", RTLD_NOW|RTLD_GLOBAL);
@ -131,6 +148,11 @@ qboolean EGL_LoadLibrary(char *driver)
eslibrary = dlopen("libGL.so.1", RTLD_NOW|RTLD_GLOBAL);
if (eslibrary) Sys_Printf("Loaded libGL.so.1\n");
}
if (!eslibrary)
{
eslibrary = dlopen("libGL", RTLD_NOW|RTLD_GLOBAL);
if (eslibrary) Sys_Printf("Loaded libGL\n");
}
#endif
if (!eslibrary)
Sys_Printf("unable to load some libGL\n");
@ -147,6 +169,13 @@ qboolean EGL_LoadLibrary(char *driver)
}
Sys_Printf("success\n");
//these are from egl1.5
qeglGetPlatformDisplay = EGL_Proc("eglGetPlatformDisplay");
qeglCreatePlatformWindowSurface = EGL_Proc("eglCreatePlatformWindowSurface");
//and in case they arn't defined...
if (!qeglGetPlatformDisplay) qeglGetPlatformDisplay = EGL_Proc("eglGetPlatformDisplayEXT");
if (!qeglCreatePlatformWindowSurface) qeglCreatePlatformWindowSurface = EGL_Proc("eglCreatePlatformWindowSurfaceEXT");
return true;
}
@ -168,19 +197,23 @@ void EGL_Shutdown(void)
eglsurf = EGL_NO_SURFACE;
}
static void EGL_UpdateSwapInterval(void)
{
int interval;
vid_vsync.modified = false;
if (*vid_vsync.string)
interval = vid_vsync.ival;
else
interval = 1; //default is to always vsync, according to EGL docs, so lets just do that.
if (qeglSwapInterval)
qeglSwapInterval(egldpy, interval);
}
void EGL_SwapBuffers (void)
{
if (vid_vsync.modified)
{
int interval;
vid_vsync.modified = false;
if (*vid_vsync.string)
interval = vid_vsync.ival;
else
interval = 1; //default is to always vsync, according to EGL docs, so lets just do that.
if (qeglSwapInterval)
qeglSwapInterval(egldpy, interval);
}
EGL_UpdateSwapInterval();
TRACE(("EGL_SwapBuffers\n"));
TRACE(("swapping buffers\n"));
@ -189,7 +222,7 @@ void EGL_SwapBuffers (void)
TRACE(("EGL_SwapBuffers done\n"));
}
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindowType window, EGLNativeDisplayType dpy)
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, int eglplat, void *nwindow, void *ndpy, EGLNativeWindowType windowid, EGLNativeDisplayType dpyid)
{
EGLint numconfig;
EGLConfig cfg;
@ -226,9 +259,16 @@ qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindo
return false;
}
*/
egldpy = qeglGetDisplay(dpy);
if (qeglGetPlatformDisplay && eglplat)
egldpy = qeglGetPlatformDisplay(eglplat, ndpy, NULL/*attribs*/);
else
egldpy = qeglGetDisplay(dpyid);
if (egldpy == EGL_NO_DISPLAY)
{
Con_Printf(CON_WARNING "EGL: creating default display\n");
egldpy = qeglGetDisplay(EGL_DEFAULT_DISPLAY);
}
if (egldpy == EGL_NO_DISPLAY)
{
Con_Printf(CON_ERROR "EGL: can't get display!\n");
@ -262,13 +302,20 @@ qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindo
return false;
}
eglsurf = qeglCreateWindowSurface(egldpy, cfg, window, info->srgb?wndattrib:NULL);
if (qeglCreatePlatformWindowSurface)
eglsurf = qeglCreatePlatformWindowSurface(egldpy, cfg, nwindow, info->srgb?wndattrib:NULL);
else
eglsurf = qeglCreateWindowSurface(egldpy, cfg, windowid, info->srgb?wndattrib:NULL);
if (eglsurf == EGL_NO_SURFACE)
{
Con_Printf(CON_ERROR "EGL: eglCreateWindowSurface failed: %x\n", qeglGetError());
int err = qeglGetError();
if (eglplat == EGL_PLATFORM_WAYLAND_KHR && err == EGL_BAD_CONTEXT) //slightly more friendly error that slags off nvidia for their refusal to implement existing standards, as is apparently appropriate.
Con_Printf(CON_ERROR "EGL: eglCreateWindowSurface failed: Bad Display. This often happens with nvidia... Try different drivers...\n");
else
Con_Printf(CON_ERROR "EGL: eglCreateWindowSurface failed: %s\n", EGL_GetErrorString(err));
return false;
}
eglctx = qeglCreateContext(egldpy, cfg, EGL_NO_SURFACE, contextattr);
if (eglctx == EGL_NO_CONTEXT)
{
@ -281,9 +328,14 @@ qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindo
Con_Printf(CON_ERROR "EGL: can't make current!\n");
return false;
}
if (eglplat == EGL_PLATFORM_WAYLAND_KHR)
{ //if we don't do this, only the first frame will get displayed, and we'll lock up
qeglSwapInterval = NULL;
Con_DPrintf(CON_WARNING"Wayland: Disabling vsync controls to work around wayland bug\n");
}
vid_vsync.modified = true;
EGL_UpdateSwapInterval();
return true;
}

View File

@ -2,17 +2,26 @@
#define __GL_VIDEGL_H__
#include "quakedef.h"
#define NativeWindowType EGLNativeWindowType
#define NativeWindowType EGLNativeWindowType //for old egl versions
#include <EGL/egl.h>
#ifndef _WIN32
#include <dlfcn.h>
#endif
#ifndef EGL_PLATFORM_X11_KHR
#define EGL_PLATFORM_X11_KHR 0x31D5 //EGL_KHR_platform_x11
#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 //an attrib
#endif
#ifndef EGL_PLATFORM_WAYLAND_KHR
#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 //EGL_KHR_platform_wayland
#endif
void *EGL_Proc(char *f);
void EGL_UnloadLibrary(void);
qboolean EGL_LoadLibrary(char *driver);
void EGL_Shutdown(void);
void EGL_SwapBuffers (void);
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, EGLNativeWindowType window, EGLNativeDisplayType dpy);
qboolean EGL_Init (rendererstate_t *info, unsigned char *palette, int eglplatform, void *nwindow, void *ndpy, EGLNativeWindowType owindow, EGLNativeDisplayType odpy);
#endif

View File

@ -103,7 +103,7 @@ static enum
#endif
} currentpsl;
extern cvar_t vid_conautoscale;
extern cvar_t vid_conautoscale, vid_vsync;
extern int sys_parentleft;
extern int sys_parenttop;
@ -442,7 +442,7 @@ static qboolean VMODE_Init(void)
if (vm.lib)
{
if (vm.pXF86VidModeQueryVersion(vid_dpy, &vm.vmajor, &vm.vminor))
Con_Printf("Using XF86-VidModeExtension Ver. %d.%d\n", vm.vmajor, vm.vminor);
Con_DPrintf("Using XF86-VidModeExtension Ver. %d.%d\n", vm.vmajor, vm.vminor);
else
{
Con_Printf("No XF86-VidModeExtension support\n");
@ -468,7 +468,7 @@ static void VMODE_SelectMode(int *width, int *height, float rate)
if ((!*width || *width == DisplayWidth(vid_dpy, scrnum)) && (!*height || *height == DisplayHeight(vid_dpy, scrnum)) && !rate)
{
Con_Printf("XF86VM: mode change not needed\n");
Con_DPrintf("XF86VM: mode change not needed\n");
fullscreenflags |= FULLSCREEN_DESKTOP;
return;
}
@ -1285,11 +1285,14 @@ static struct
const char * (*QueryExtensionsString)(Display * dpy, int screen);
void *(*GetProcAddress) (char *name);
void (*SwapInterval) (Display *dpy, GLXDrawable drawable, int interval);
GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attrib_list, int *nelements);
int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int * value);
XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
GLXContext (*CreateContextAttribs)(Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
int swapint;
} glx;
void GLX_CloseLibrary(void)
@ -1349,6 +1352,7 @@ qboolean GLX_InitLibrary(char *driver)
glx.GetFBConfigAttrib = GLX_GetSymbol("glXGetFBConfigAttrib");
glx.GetVisualFromFBConfig = GLX_GetSymbol("glXGetVisualFromFBConfig");
glx.CreateContextAttribs = GLX_GetSymbol("glXCreateContextAttribsARB");
glx.SwapInterval = GLX_GetSymbol("glXSwapIntervalEXT");
return true;
}
@ -2719,10 +2723,25 @@ void GLVID_SwapBuffers (void)
#ifdef GLQUAKE
#ifdef USE_EGL
case PSL_EGL:
EGL_BeginRendering();
EGL_SwapBuffers();
break;
#endif
case PSL_GLX:
{
int n = vid_vsync.ival;
if (cls.timedemo && cls.demoplayback)
n = 0;
if (glx.swapint != n)
{
glx.swapint = n;
if (glx.SwapInterval)
{
glx.SwapInterval(vid_dpy, vid_window, glx.swapint);
Con_Printf("Swap interval %i\n", glx.swapint);
}
}
}
//we don't need to flush, XSawpBuffers does it for us.
//chances are, it's version is more suitable anyway. At least there's the chance that it might be.
glx.SwapBuffers(vid_dpy, vid_window);
@ -3205,10 +3224,13 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
if (visinfo != &vinfodef)
#endif
x11.pXFree(visinfo);
glx.swapint = vid_vsync.ival;
if (glx.SwapInterval)
glx.SwapInterval(vid_dpy, vid_window, glx.swapint);
break;
#ifdef USE_EGL
case PSL_EGL:
if (!EGL_Init(info, palette, (EGLNativeWindowType)vid_window, (EGLNativeDisplayType)vid_dpy))
if (!EGL_Init(info, palette, EGL_PLATFORM_X11_KHR, &vid_window, vid_dpy, (EGLNativeWindowType)vid_window, (EGLNativeDisplayType)vid_dpy))
{
Con_Printf("Failed to create EGL context.\n");
GLVID_Shutdown();
@ -3477,7 +3499,7 @@ void GLVID_SetCaption(const char *text)
#include "gl_draw.h"
rendererinfo_t eglrendererinfo =
{
"EGL(X11)",
"OpenGL (X11 EGL)",
{
"egl"
},
@ -3563,10 +3585,10 @@ static qboolean XVK_SetupSurface_XCB(void)
#endif
rendererinfo_t vkrendererinfo =
{
"Vulkan(X11)",
"Vulkan (X11)",
{
"vk",
"xvk",
"vk",
"vulkan"
},
QR_VULKAN,
@ -3625,20 +3647,23 @@ rendererinfo_t vkrendererinfo =
#if 1
char *Sys_GetClipboard(void)
{
Atom xa_clipboard = x11.pXInternAtom(vid_dpy, "PRIMARY", false);
Atom xa_string = x11.pXInternAtom(vid_dpy, "UTF8_STRING", false);
Window clipboardowner = x11.pXGetSelectionOwner(vid_dpy, xa_clipboard);
if (clipboardowner != None && clipboardowner != vid_window)
if(vid_dpy)
{
int fmt;
Atom type;
unsigned long nitems, bytesleft;
unsigned char *data;
x11.pXConvertSelection(vid_dpy, xa_clipboard, xa_string, None, vid_window, CurrentTime);
x11.pXFlush(vid_dpy);
x11.pXGetWindowProperty(vid_dpy, vid_window, xa_string, 0, 0, False, AnyPropertyType, &type, &fmt, &nitems, &bytesleft, &data);
return data;
Atom xa_clipboard = x11.pXInternAtom(vid_dpy, "PRIMARY", false);
Atom xa_string = x11.pXInternAtom(vid_dpy, "UTF8_STRING", false);
Window clipboardowner = x11.pXGetSelectionOwner(vid_dpy, xa_clipboard);
if (clipboardowner != None && clipboardowner != vid_window)
{
int fmt;
Atom type;
unsigned long nitems, bytesleft;
unsigned char *data;
x11.pXConvertSelection(vid_dpy, xa_clipboard, xa_string, None, vid_window, CurrentTime);
x11.pXFlush(vid_dpy);
x11.pXGetWindowProperty(vid_dpy, vid_window, xa_string, 0, 0, False, AnyPropertyType, &type, &fmt, &nitems, &bytesleft, &data);
return data;
}
}
return clipboard_buffer;
}
@ -3648,14 +3673,18 @@ void Sys_CloseClipboard(char *bf)
if (bf == clipboard_buffer)
return;
x11.pXFree(bf);
if(vid_dpy)
x11.pXFree(bf);
}
void Sys_SaveClipboard(char *text)
{
Atom xa_clipboard = x11.pXInternAtom(vid_dpy, "PRIMARY", false);
Q_strncpyz(clipboard_buffer, text, SYS_CLIPBOARD_SIZE);
x11.pXSetSelectionOwner(vid_dpy, xa_clipboard, vid_window, CurrentTime);
if(vid_dpy)
{
Atom xa_clipboard = x11.pXInternAtom(vid_dpy, "PRIMARY", false);
x11.pXSetSelectionOwner(vid_dpy, xa_clipboard, vid_window, CurrentTime);
}
}
#endif

View File

@ -1,9 +1,29 @@
//This is my attempt at wayland support for both opengl and vulkan.
//Note that this is sorely under-tested - I haven't tested vulkan-on-wayland at all as none of the drivers for nvidia support it.
//in no particular order...
//TODO: leaks on shutdown
//TODO: hardware cursors
//TODO: mouse grabs
//TODO: window decorations...
//TODO: kb autorepeat
//TODO: generic keymap (and not just UK)
//TODO: system clipboard
//TODO: drag+drop
#include "bothdefs.h"
#if defined(GLQUAKE) && defined(USE_EGL)
#ifdef WAYLANDQUAKE
#include <wayland-client.h>
#include <wayland-egl.h>
#include <linux/input.h> //this is shite.
#include "quakedef.h"
#if defined(GLQUAKE) && defined(USE_EGL)
#include "gl_draw.h"
#include "gl_videgl.h"
#endif
#if defined(VKQUAKE)
#include "vk/vkrenderer.h"
#endif
#if WAYLAND_VERSION_MAJOR < 1
#error "wayland headers are too old"
@ -12,6 +32,112 @@
#include "glquake.h"
#include "shader.h"
#if 1
static struct wl_display *(*pwl_display_connect)(const char *name);
static int (*pwl_display_dispatch)(struct wl_display *display);
static int (*pwl_display_dispatch_pending)(struct wl_display *display);
static int (*pwl_display_roundtrip)(struct wl_display *display);
static struct wl_proxy *(*pwl_proxy_marshal_constructor)(struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, ...);
static struct wl_proxy *(*pwl_proxy_marshal_constructor_versioned)(struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...);
static void (*pwl_proxy_destroy)(struct wl_proxy *proxy);
static void (*pwl_proxy_marshal)(struct wl_proxy *p, uint32_t opcode, ...);
static int (*pwl_proxy_add_listener)(struct wl_proxy *proxy, void (**implementation)(void), void *data);
static const struct wl_interface *pwl_keyboard_interface;
static const struct wl_interface *pwl_pointer_interface;
static const struct wl_interface *pwl_compositor_interface;
static const struct wl_interface *pwl_region_interface;
static const struct wl_interface *pwl_surface_interface;
static const struct wl_interface *pwl_shell_surface_interface;
static const struct wl_interface *pwl_shell_interface;
static const struct wl_interface *pwl_seat_interface;
static const struct wl_interface *pwl_registry_interface;
static dllfunction_t waylandexports_wl[] =
{
{(void**)&pwl_display_connect, "wl_display_connect"},
{(void**)&pwl_display_dispatch, "wl_display_dispatch"},
{(void**)&pwl_display_dispatch_pending, "wl_display_dispatch_pending"},
{(void**)&pwl_display_roundtrip, "wl_display_roundtrip"},
{(void**)&pwl_proxy_marshal_constructor, "wl_proxy_marshal_constructor"},
{(void**)&pwl_proxy_marshal_constructor_versioned,"wl_proxy_marshal_constructor_versioned"},
{(void**)&pwl_proxy_destroy, "wl_proxy_destroy"},
{(void**)&pwl_proxy_marshal, "wl_proxy_marshal"},
{(void**)&pwl_proxy_add_listener, "wl_proxy_add_listener"},
{(void**)&pwl_keyboard_interface, "wl_keyboard_interface"},
{(void**)&pwl_pointer_interface, "wl_pointer_interface"},
{(void**)&pwl_compositor_interface, "wl_compositor_interface"},
{(void**)&pwl_region_interface, "wl_region_interface"},
{(void**)&pwl_surface_interface, "wl_surface_interface"},
{(void**)&pwl_shell_surface_interface, "wl_shell_surface_interface"},
{(void**)&pwl_shell_interface, "wl_shell_interface"},
{(void**)&pwl_seat_interface, "wl_seat_interface"},
{(void**)&pwl_registry_interface, "wl_registry_interface"},
{NULL, NULL}
};
static dllhandle_t *lib_wayland_wl;
static qboolean WL_InitLibrary(void)
{
lib_wayland_wl = Sys_LoadLibrary("libwayland-client.so.0", waylandexports_wl);
if (!lib_wayland_wl)
return false;
return true;
}
#if defined(GLQUAKE) && defined(USE_EGL)
static struct wl_egl_window *(*pwl_egl_window_create)(struct wl_surface *surface, int width, int height);
static void (*pwl_egl_window_destroy)(struct wl_egl_window *egl_window);
static void (*pwl_egl_window_resize)(struct wl_egl_window *egl_window, int width, int height, int dx, int dy);
//static void (*pwl_egl_window_get_attached_size(struct wl_egl_window *egl_window, int *width, int *height);
static dllfunction_t waylandexports_egl[] =
{
{(void**)&pwl_egl_window_create, "wl_egl_window_create"},
{(void**)&pwl_egl_window_destroy, "wl_egl_window_destroy"},
{(void**)&pwl_egl_window_resize, "wl_egl_window_resize"},
// {(void**)&pwl_egl_window_get_attached_size, "wl_egl_window_get_attached_size"},
{NULL, NULL}
};
static dllhandle_t *lib_wayland_egl;
#endif
//I hate wayland.
static inline struct wl_region *pwl_compositor_create_region(struct wl_compositor *wl_compositor) {return (struct wl_region*)(struct wl_proxy *) pwl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor, WL_COMPOSITOR_CREATE_REGION, pwl_region_interface, NULL);}
static inline struct wl_surface *pwl_compositor_create_surface(struct wl_compositor *wl_compositor) {return (struct wl_surface *)(struct wl_proxy *) pwl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor, WL_COMPOSITOR_CREATE_SURFACE, pwl_surface_interface, NULL);}
static inline void pwl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region) {pwl_proxy_marshal((struct wl_proxy *) wl_surface, WL_SURFACE_SET_OPAQUE_REGION, region);}
static inline void pwl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height) {pwl_proxy_marshal((struct wl_proxy *) wl_region, WL_REGION_ADD, x, y, width, height);}
static inline struct wl_shell_surface *pwl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface) {return (struct wl_shell_surface *)(struct wl_proxy *) pwl_proxy_marshal_constructor((struct wl_proxy *) wl_shell, WL_SHELL_GET_SHELL_SURFACE, pwl_shell_surface_interface, NULL, surface);}
static inline void pwl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface) {pwl_proxy_marshal((struct wl_proxy *) wl_shell_surface, WL_SHELL_SURFACE_SET_TOPLEVEL);}
static inline void pwl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output) {pwl_proxy_marshal((struct wl_proxy *) wl_shell_surface, WL_SHELL_SURFACE_SET_FULLSCREEN, method, framerate, output);}
static inline int pwl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface, const struct wl_shell_surface_listener *listener, void *data) {return pwl_proxy_add_listener((struct wl_proxy *) wl_shell_surface, (void (**)(void)) listener, data);}
static inline void pwl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial) {pwl_proxy_marshal((struct wl_proxy *) wl_shell_surface, WL_SHELL_SURFACE_PONG, serial);}
static inline void pwl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title) {pwl_proxy_marshal((struct wl_proxy *) wl_shell_surface, WL_SHELL_SURFACE_SET_TITLE, title);}
static inline struct wl_registry *pwl_display_get_registry(struct wl_display *wl_display) {return (struct wl_registry *)pwl_proxy_marshal_constructor((struct wl_proxy *) wl_display, WL_DISPLAY_GET_REGISTRY, pwl_registry_interface, NULL);}
static inline void *pwl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version) {return (void*)pwl_proxy_marshal_constructor_versioned((struct wl_proxy *) wl_registry, WL_REGISTRY_BIND, interface, version, name, interface->name, version, NULL);}
static inline int pwl_registry_add_listener(struct wl_registry *wl_registry, const struct wl_registry_listener *listener, void *data) {return pwl_proxy_add_listener((struct wl_proxy *) wl_registry, (void (**)(void)) listener, data);}
static inline void pwl_keyboard_destroy(struct wl_keyboard *wl_keyboard) {pwl_proxy_destroy((struct wl_proxy *) wl_keyboard);}
static inline int pwl_keyboard_add_listener(struct wl_keyboard *wl_keyboard, const struct wl_keyboard_listener *listener, void *data) {return pwl_proxy_add_listener((struct wl_proxy *) wl_keyboard, (void (**)(void)) listener, data);}
static inline void pwl_pointer_destroy(struct wl_pointer *wl_pointer) {pwl_proxy_destroy((struct wl_proxy *) wl_pointer);}
static inline int pwl_pointer_add_listener(struct wl_pointer *wl_pointer, const struct wl_pointer_listener *listener, void *data) {return pwl_proxy_add_listener((struct wl_proxy *) wl_pointer, (void (**)(void)) listener, data);}
static inline struct wl_pointer *pwl_seat_get_pointer(struct wl_seat *wl_seat) {return (struct wl_pointer *)(struct wl_proxy *) pwl_proxy_marshal_constructor((struct wl_proxy *) wl_seat, WL_SEAT_GET_POINTER, pwl_pointer_interface, NULL);}
static inline struct wl_keyboard *pwl_seat_get_keyboard(struct wl_seat *wl_seat) {return (struct wl_keyboard *)(struct wl_proxy *) pwl_proxy_marshal_constructor((struct wl_proxy *) wl_seat, WL_SEAT_GET_KEYBOARD, pwl_keyboard_interface, NULL);}
static inline int pwl_seat_add_listener(struct wl_seat *wl_seat, const struct wl_seat_listener *listener, void *data) {return pwl_proxy_add_listener((struct wl_proxy *) wl_seat, (void (**)(void)) listener, data);}
#else
#define pwl_keyboard_interface &wl_keyboard_interface
#define pwl_pointer_interface &wl_pointer_interface
#define pwl_compositor_interface &wl_compositor_interface
#define pwl_registry_interface &wl_registry_interface
#define pwl_region_interface &wl_region_interface
#define pwl_surface_interface &wl_surface_interface
#define pwl_shell_surface_interface &wl_shell_surface_interface
#define pwl_shell_interface &wl_shell_interface
#define pwl_seat_interface &wl_seat_interface
#endif
static const struct wl_interface *pzwp_relative_pointer_v1_interface;
static struct wdisplay_s
{
//display stuff
@ -25,19 +151,27 @@ static struct wdisplay_s
void *keyboard;
void *seat;
qboolean absmouse;
struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
struct zwp_relative_pointer_v1 *relative_pointer;
//window stuff
#if defined(GLQUAKE) && defined(USE_EGL)
struct wl_egl_window *enwindow;
#endif
struct wl_surface *surface;
struct wl_shell_surface *ssurface;
} w;
static void WL_shell_handle_ping(void *data, struct wl_shell_surface *shell_surface, uint32_t serial)
{
wl_shell_surface_pong(shell_surface, serial);
pwl_shell_surface_pong(shell_surface, serial);
}
static void WL_shell_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width, int32_t height)
{
#if defined(GLQUAKE) && defined(USE_EGL)
if (w.enwindow)
wl_egl_window_resize(w.enwindow, width, height, 0, 0);
pwl_egl_window_resize(w.enwindow, width, height, 0, 0);
#endif
vid.pixelwidth = width;
vid.pixelheight = height;
@ -54,7 +188,7 @@ static const struct wl_shell_surface_listener shell_surface_listener =
};
//qkeys are ascii-compatible for the most part.
qbyte waylandinputsucksbighairydonkeyballs[] =
static qbyte waylandinputsucksbighairydonkeyballs[] =
{
0, K_ESCAPE,'1','2','3','4','5','6', //0x
'7','8','9','0','-','=',K_BACKSPACE,K_TAB,
@ -73,7 +207,7 @@ qbyte waylandinputsucksbighairydonkeyballs[] =
0,0,0,0,0,0,0,K_PAUSE, //7x
0,0,0,0,0,K_LWIN,K_RWIN,K_APP
};
qbyte waylandinputsucksbighairydonkeyballsshift[] =
static qbyte waylandinputsucksbighairydonkeyballsshift[] =
{
0, K_ESCAPE,'!','\"','3','$','%','^', //0x
'&','*','(',')','_','+',K_BACKSPACE,K_TAB,
@ -101,18 +235,18 @@ static void WL_pointer_handle_enter(void *data, struct wl_pointer *pointer, uint
struct wl_cursor_image *image;
if (display->window->fullscreen)
wl_pointer_set_cursor(pointer, serial, NULL, 0, 0);
pwl_pointer_set_cursor(pointer, serial, NULL, 0, 0);
else if (cursor) {
image = display->default_cursor->images[0];
buffer = wl_cursor_image_get_buffer(image);
wl_pointer_set_cursor(pointer, serial,
buffer = pwl_cursor_image_get_buffer(image);
pwl_pointer_set_cursor(pointer, serial,
display->cursor_surface,
image->hotspot_x,
image->hotspot_y);
wl_surface_attach(display->cursor_surface, buffer, 0, 0);
wl_surface_damage(display->cursor_surface, 0, 0,
pwl_surface_attach(display->cursor_surface, buffer, 0, 0);
pwl_surface_damage(display->cursor_surface, 0, 0,
image->width, image->height);
wl_surface_commit(display->cursor_surface);
pwl_surface_commit(display->cursor_surface);
}
*/
}
@ -124,12 +258,13 @@ static void WL_pointer_handle_motion(void *data, struct wl_pointer *pointer, uin
{
//wayland is shite shite shite.
//1.4 still has no relative mouse motion.
IN_MouseMove(0, true, wl_fixed_to_double(sx), wl_fixed_to_double(sy), 0, 0);
if (w.absmouse)
IN_MouseMove(0, true, wl_fixed_to_double(sx), wl_fixed_to_double(sy), 0, 0);
}
static void WL_pointer_handle_button(void *data, struct wl_pointer *wl_pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
{
struct wdisplay *display = data;
// struct wdisplay *display = data;
int qkey;
switch(button)
@ -162,7 +297,7 @@ static void WL_pointer_handle_button(void *data, struct wl_pointer *wl_pointer,
break;
}
IN_KeyEvent(0, !!state, qkey, 0);
// wl_shell_surface_move(display->window->shell_surface, display->seat, serial);
// pwl_shell_surface_move(display->window->shell_surface, display->seat, serial);
}
static void WL_pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
@ -188,25 +323,100 @@ static const struct wl_pointer_listener pointer_listener =
WL_pointer_handle_axis,
};
struct zwp_relative_pointer_v1;
#define ZWP_RELATIVE_POINTER_MANAGER_V1_DESTROY 0
#define ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER 1
#define ZWP_RELATIVE_POINTER_V1_DESTROY 0
static void WL_pointer_handle_delta(void *data, struct zwp_relative_pointer_v1 *pointer, uint32_t time_hi, uint32_t time_lo, wl_fixed_t dx_w, wl_fixed_t dy_w, wl_fixed_t dx_raw_w, wl_fixed_t dy_raw_w)
{
if (!w.absmouse)
IN_MouseMove(0, false, wl_fixed_to_double(dx_raw_w), wl_fixed_to_double(dy_raw_w), 0, 0);
}
struct zwp_relative_pointer_v1_listener
{
void (*delta)(void *data, struct zwp_relative_pointer_v1 *pointer, uint32_t time_hi, uint32_t time_lo, wl_fixed_t dx_w, wl_fixed_t dy_w, wl_fixed_t dx_raw_w, wl_fixed_t dy_raw_w);
};
static const struct zwp_relative_pointer_v1_listener relative_pointer_listener =
{
WL_pointer_handle_delta,
};
static void WL_BindRelativePointerManager(struct wl_registry *registry, uint32_t id)
{ /*oh hey, I wrote lots of code! pay me more! fuck that shit.*/
static const struct wl_interface *types[8];
static const struct wl_message zwp_relative_pointer_manager_v1_requests[] = {
{ "destroy", "", types + 0 },
{ "get_relative_pointer", "no", types + 6 },
};
static const struct wl_interface zwp_relative_pointer_manager_v1_interface = {
"zwp_relative_pointer_manager_v1", 1,
2, zwp_relative_pointer_manager_v1_requests,
0, NULL,
};
static const struct wl_message zwp_relative_pointer_v1_requests[] = {
{ "destroy", "", types + 0 },
};
static const struct wl_message zwp_relative_pointer_v1_events[] = {
{ "relative_motion", "uuffff", types + 0 },
};
static const struct wl_interface zwp_relative_pointer_v1_interface = {
"zwp_relative_pointer_v1", 1,
1, zwp_relative_pointer_v1_requests,
1, zwp_relative_pointer_v1_events,
};
//fix up types...
types[6] = &zwp_relative_pointer_v1_interface;
types[7] = pwl_pointer_interface;
pzwp_relative_pointer_v1_interface = &zwp_relative_pointer_v1_interface;
w.relative_pointer_manager = pwl_registry_bind(registry, id, &zwp_relative_pointer_manager_v1_interface, 1);
}
/*
struct zwp_locked_pointer_v1;
static void WL_locked_pointer_locked(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
{
}
static void WL_locked_pointer_unlocked(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
{
}
struct zwp_locked_pointer_v1_listener
{
void (*pointer_locked)(void *data, struct zwp_locked_pointer_v1 *locked_pointer);
void (*pointer_unlocked)(void *data, struct zwp_locked_pointer_v1 *locked_pointer);
};
static const struct zwp_locked_pointer_v1_listener locked_pointer_listener =
{
WL_locked_pointer_locked,
WL_locked_pointer_unlocked,
};
*/
static void WL_keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size)
{
}
static void WL_keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
{
vid.activeapp = true;
}
static void WL_keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
{
vid.activeapp = false;
}
static void WL_keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
{
extern int shift_down;
struct display *d = data;
// struct display *d = data;
uint32_t qkey;
uint32_t ukey;
//FIXME: this stuff is fucked, especially the ukey stuff.
if (key < sizeof(waylandinputsucksbighairydonkeyballs)/sizeof(waylandinputsucksbighairydonkeyballs[0]))
{
qkey = waylandinputsucksbighairydonkeyballs[key];
@ -243,23 +453,35 @@ static void WL_seat_handle_capabilities(void *data, struct wl_seat *seat, enum w
struct wdisplay_s *s = data;
if ((caps & WL_SEAT_CAPABILITY_POINTER) && !s->pointer)
{
s->pointer = wl_seat_get_pointer(seat);
wl_pointer_add_listener(s->pointer, &pointer_listener, s);
s->pointer = pwl_seat_get_pointer(seat);
pwl_pointer_add_listener(s->pointer, &pointer_listener, s);
if (w.relative_pointer_manager)
{ //and try and get relative pointer events too. so much fucking boilerplate.
w.relative_pointer = (struct zwp_relative_pointer_v1 *)pwl_proxy_marshal_constructor((struct wl_proxy *) w.relative_pointer_manager, ZWP_RELATIVE_POINTER_MANAGER_V1_GET_RELATIVE_POINTER, pzwp_relative_pointer_v1_interface, NULL, w.pointer);
pwl_proxy_add_listener((struct wl_proxy *) w.relative_pointer, (void (**)(void)) &relative_pointer_listener, &w);
}
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && s->pointer)
{
wl_pointer_destroy(s->pointer);
pwl_pointer_destroy(s->pointer);
s->pointer = NULL;
if (w.relative_pointer)
{
pwl_proxy_marshal((struct wl_proxy *) w.relative_pointer, ZWP_RELATIVE_POINTER_V1_DESTROY);
pwl_proxy_destroy((struct wl_proxy *) w.relative_pointer);
}
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !s->keyboard)
{
s->keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_add_listener(s->keyboard, &keyboard_listener, s);
s->keyboard = pwl_seat_get_keyboard(seat);
pwl_keyboard_add_listener(s->keyboard, &keyboard_listener, s);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && s->keyboard)
{
wl_keyboard_destroy(s->keyboard);
pwl_keyboard_destroy(s->keyboard);
s->keyboard = NULL;
}
}
@ -268,20 +490,23 @@ static const struct wl_seat_listener seat_listener =
WL_seat_handle_capabilities
};
static void WL_handle_global(void *data, struct wl_registry *registry,
uint32_t id, const char *interface, uint32_t version)
static void WL_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version)
{
struct wdisplay_s *d = data;
//Sys_Printf("Interface %s id %u\n", interface, id);
if (strcmp(interface, "wl_compositor") == 0)
d->compositor = wl_registry_bind(registry, id, &wl_compositor_interface, 1);
d->compositor = pwl_registry_bind(registry, id, pwl_compositor_interface, 1);
else if (strcmp(interface, "wl_shell") == 0)
d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
d->shell = pwl_registry_bind(registry, id, pwl_shell_interface, 1);
else if (strcmp(interface, "wl_seat") == 0 && !d->seat)
{
d->seat = wl_registry_bind(registry, id, &wl_seat_interface, 1);
wl_seat_add_listener(d->seat, &seat_listener, d);
d->seat = pwl_registry_bind(registry, id, pwl_seat_interface, 1);
pwl_seat_add_listener(d->seat, &seat_listener, d);
}
else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0)
WL_BindRelativePointerManager(registry, id);
// else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0)
// d->shell = pwl_registry_bind(registry, id, pwl_shell_interface, 1);
/* else if (!strcmp(interface, "input_device"))
display_add_input(id);
*/
@ -291,175 +516,320 @@ static const struct wl_registry_listener WL_registry_listener = {
WL_handle_global
};
static void WL_waitabit(void)
{
wl_display_roundtrip(w.display);
}
static void WL_SwapBuffers(void)
{
float r;
TRACE(("WL_SwapBuffers\n"));
wl_surface_set_opaque_region(w.surface, NULL);
switch(qrenderer)
{
#if defined(GLQUAKE) && defined(USE_EGL)
case QR_OPENGL:
EGL_SwapBuffers();
//wl_surface_damage(w.surface, 0, 0, vid.pixelwidth, vid.pixelheight);
pwl_display_dispatch_pending(w.display);
break;
#endif
case QR_VULKAN: //the vulkan stuff handles this itself. FIXME: are we still receiving inputs? no idea!
default:
break;
}
EGL_SwapBuffers();
//wl_surface_damage(w.surface, 0, 0, vid.pixelwidth, vid.pixelheight);
wl_display_dispatch_pending(w.display);
w.absmouse = Key_MouseShouldBeFree() || !w.relative_pointer;
}
#ifdef VKQUAKE
static qboolean WLVK_SetupSurface()
{
VkWaylandSurfaceCreateInfoKHR inf = {VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR};
inf.flags = 0;
inf.display = w.display;
inf.surface = w.surface;
if (VK_SUCCESS == vkCreateWaylandSurfaceKHR(vk.instance, &inf, vkallocationcb, &vk.surface))
return true;
return false;
}
#endif
static qboolean WL_Init (rendererstate_t *info, unsigned char *palette)
{
cvar_t *v;
w.display = wl_display_connect(NULL);
if (!WL_InitLibrary())
{
Con_Printf("couldn't load wayland client libraries\n");
return false;
}
switch(qrenderer)
{
#if defined(GLQUAKE) && defined(USE_EGL)
case QR_OPENGL:
lib_wayland_egl = Sys_LoadLibrary("libwayland-egl.so.1", waylandexports_egl);
if (!lib_wayland_egl)
{
Con_Printf("couldn't load libwayland-egl.so.1 library\n");
return false;
}
// setenv("EGL_PLATFORM", "wayland", 1); //if this actually matters then we're kinda screwed
if (!EGL_LoadLibrary(info->subrenderer))
{
Con_Printf("couldn't load EGL library\n");
return false;
}
break;
#endif
#ifdef VKQUAKE
case QR_VULKAN:
#ifdef VK_NO_PROTOTYPES
{ //vulkan requires that vkGetInstanceProcAddr is set in advance.
dllfunction_t func[] =
{
{(void*)&vkGetInstanceProcAddr, "vkGetInstanceProcAddr"},
{NULL, NULL}
};
if (!Sys_LoadLibrary("libvulkan.so.1", func))
{
if (!Sys_LoadLibrary("libvulkan.so", func))
{
Con_Printf("Couldn't intialise libvulkan.so\nvulkan loader is not installed\n");
return false;
}
}
}
#endif
break;
#endif
default:
return false; //not supported dude...
}
memset(&w, 0, sizeof(w));
w.display = pwl_display_connect(NULL);
if (!w.display)
{
Con_Printf("couldn't connect to wayland server\n");
return false;
}
w.registry = wl_display_get_registry(w.display);
wl_registry_add_listener(w.registry, &WL_registry_listener, &w); //w.compositor =
v = Cvar_FindVar("gl_menutint_shader");
if (v && v->ival)
{
Con_Printf("Disabling gl_menutint_shader to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 0);
}
v = Cvar_FindVar("r_waterstyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_waterstyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
v = Cvar_FindVar("r_slimestyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_slimestyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
v = Cvar_FindVar("r_lavastyle");
if (v && v->ival>1)
{
Con_Printf("Disabling r_lavastyle to avoid wayland/mesa EGL bugs.\n");
Cvar_SetValue(v, 1);
}
WL_waitabit();
w.registry = pwl_display_get_registry(w.display);
pwl_registry_add_listener(w.registry, &WL_registry_listener, &w); //w.compositor =
pwl_display_dispatch(w.display);
pwl_display_roundtrip(w.display);
if (!w.compositor)
{
Con_Printf("no compositor running, apparently\n");
return false;
}
w.surface = wl_compositor_create_surface(w.compositor);
w.ssurface = wl_shell_get_shell_surface(w.shell, w.surface);
wl_shell_surface_add_listener(w.ssurface, &shell_surface_listener, &w);
w.enwindow = wl_egl_window_create(w.surface, info->width, info->height);
w.surface = pwl_compositor_create_surface(w.compositor);
if (!w.surface)
{
Con_Printf("no compositor running, apparently\n");
return false;
}
w.ssurface = pwl_shell_get_shell_surface(w.shell, w.surface);
if (info->fullscreen)
pwl_shell_surface_set_fullscreen(w.ssurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 60, NULL);
else
pwl_shell_surface_set_toplevel(w.ssurface);
{
struct wl_region *region = pwl_compositor_create_region(w.compositor);
pwl_region_add(region, 0, 0, info->width, info->height);
pwl_surface_set_opaque_region(w.surface, region);
//FIXME: leaks region?
}
pwl_shell_surface_add_listener(w.ssurface, &shell_surface_listener, &w);
vid.pixelwidth = info->width;
vid.pixelheight = info->height;
setenv("EGL_PLATFORM", "wayland", 1);
if (!EGL_LoadLibrary(info->subrenderer))
{
Con_Printf("couldn't load EGL library\n");
return false;
}
if (!EGL_Init(info, palette, (EGLNativeWindowType)w.enwindow, (EGLNativeDisplayType) w.display))
{
Con_Printf("couldn't initialise EGL context\n");
return false;
}
if (info->fullscreen)
wl_shell_surface_set_fullscreen(w.ssurface, WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, 60, NULL);
else
wl_shell_surface_set_toplevel(w.ssurface);
vid.activeapp = true;
//window_set_keyboard_focus_handler(window, WL_handler_keyfocus);
//window_set_resize_handler(w.surface, WL_handler_resize);
wl_display_dispatch_pending(w.display);
switch(qrenderer)
{
default:
return false;
#ifdef VKQUAKE
case QR_VULKAN:
{
const char *extnames[] = {VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, NULL};
return VK_Init(info, extnames, WLVK_SetupSurface, NULL);
}
break;
#endif
#if defined(GLQUAKE) && defined(USE_EGL)
case QR_OPENGL:
w.enwindow = pwl_egl_window_create(w.surface, info->width, info->height);
if (!EGL_Init(info, palette, EGL_PLATFORM_WAYLAND_KHR, w.enwindow, w.display, (EGLNativeWindowType)w.enwindow, (EGLNativeDisplayType)w.display))
{
Con_Printf("couldn't initialise EGL context\n");
return false;
}
GL_Init(&EGL_Proc);
pwl_display_dispatch_pending(w.display);
// while(1)
// WL_SwapBuffers();
return GL_Init(info, &EGL_Proc);
break;
#endif
}
return true;
}
static void WL_DeInit(void)
{
#if defined(GLQUAKE) && defined(USE_EGL)
EGL_Shutdown();
wl_egl_window_destroy(w.enwindow);
if (w.enwindow)
pwl_egl_window_destroy(w.enwindow);
#endif
}
static qboolean WL_ApplyGammaRamps(unsigned int gammarampsize, unsigned short *ramps)
{
//not supported
return false;
}
static void WL_SetCaption(char *text)
static void WL_SetCaption(const char *text)
{
wl_shell_surface_set_title(w.ssurface, text);
pwl_shell_surface_set_title(w.ssurface, text);
}
#include "gl_draw.h"
rendererinfo_t waylandrendererinfo =
static int WL_GetPriority(void)
{
"Wayland",
{
"wayland"
},
QR_OPENGL,
char *dpyname = getenv("WAYLAND_DISPLAY");
if (dpyname && *dpyname)
return 2; //something above X11.
return 0; //default.
}
GLDraw_Init,
GLDraw_DeInit,
#if defined(GLQUAKE) && defined(USE_EGL)
rendererinfo_t rendererinfo_wayland_gl =
{
"OpenGL (Wayland)",
{
"wlgl",
"wayland",
},
QR_OPENGL,
GL_UpdateFiltering,
GL_LoadTextureMips,
GLDraw_Init,
GLDraw_DeInit,
GL_UpdateFiltering,
GL_LoadTextureMips,
GL_DestroyTexture,
GLR_Init,
GLR_DeInit,
GLR_RenderView,
GLR_Init,
GLR_DeInit,
GLR_RenderView,
WL_Init,
WL_DeInit,
WL_SwapBuffers,
WL_ApplyGammaRamps,
NULL, //CreateCursor
NULL, //SetCursor
NULL, //DestroyCursor
WL_SetCaption, //setcaption
GLVID_GetRGBInfo,
GLSCR_UpdateScreen,
GLBE_SelectMode,
GLBE_DrawMesh_List,
GLBE_DrawMesh_Single,
GLBE_SubmitBatch,
GLBE_GetTempBatch,
GLBE_DrawWorld,
GLBE_Init,
GLBE_GenBrushModelVBO,
GLBE_ClearVBO,
GLBE_UploadAllLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,
GLBE_LightCullModel,
GLBE_VBO_Begin,
GLBE_VBO_Data,
GLBE_VBO_Finish,
GLBE_VBO_Destroy,
GLBE_RenderToTextureUpdate2d,
"",
WL_GetPriority
};
#endif
#ifdef VKQUAKE
rendererinfo_t rendererinfo_wayland_vk =
{
"Vulkan (Wayland)",
{
"wlvk",
"vk",
"vulkan",
"wayland"
},
QR_VULKAN,
VK_Draw_Init,
VK_Draw_Shutdown,
VK_UpdateFiltering,
VK_LoadTextureMips,
VK_DestroyTexture,
VK_R_Init,
VK_R_DeInit,
VK_R_RenderView,
WL_Init,
WL_DeInit,
WL_SwapBuffers,
WL_SwapBuffers,
WL_ApplyGammaRamps,
NULL,
NULL,
NULL,
WL_SetCaption, //setcaption
GLVID_GetRGBInfo,
VKVID_GetRGBInfo,
GLSCR_UpdateScreen,
VK_SCR_UpdateScreen,
GLBE_SelectMode,
GLBE_DrawMesh_List,
GLBE_DrawMesh_Single,
GLBE_SubmitBatch,
GLBE_GetTempBatch,
GLBE_DrawWorld,
GLBE_Init,
GLBE_GenBrushModelVBO,
GLBE_ClearVBO,
GLBE_UploadAllLightmaps,
GLBE_SelectEntity,
GLBE_SelectDLight,
GLBE_Scissor,
GLBE_LightCullModel,
VKBE_SelectMode,
VKBE_DrawMesh_List,
VKBE_DrawMesh_Single,
VKBE_SubmitBatch,
VKBE_GetTempBatch,
VKBE_DrawWorld,
VKBE_Init,
VKBE_GenBrushModelVBO,
VKBE_ClearVBO,
VKBE_UploadAllLightmaps,
VKBE_SelectEntity,
VKBE_SelectDLight,
VKBE_Scissor,
VKBE_LightCullModel,
GLBE_VBO_Begin,
GLBE_VBO_Data,
GLBE_VBO_Finish,
GLBE_VBO_Destroy,
VKBE_VBO_Begin,
VKBE_VBO_Data,
VKBE_VBO_Finish,
VKBE_VBO_Destroy,
GLBE_RenderToTextureUpdate2d,
VKBE_RenderToTextureUpdate2d,
""
"",
WL_GetPriority
};
#endif
#endif

View File

@ -526,7 +526,7 @@ int IWebGetSafeListeningPort(void)
char *e;
int base, range;
static int sequence;
if (!*sv_ftp_port_range.string)
if (!sv_ftp_port_range.string || !*sv_ftp_port_range.string)
return 0; //lets the OS pick.
base = strtol(sv_ftp_port_range.string, &e, 0);
while(*e == ' ')

View File

@ -13162,7 +13162,7 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
if (name)
QC_snprintfz(newname, sizeof(newname), "%s%s", name, array);
else
*newname = *"";
QC_snprintfz(newname, sizeof(newname), "%s", array);
// allocate a new def
def = (void *)qccHunkAlloc (sizeof(QCC_def_t));
@ -13250,14 +13250,14 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
switch (parttype->type)
{
case ev_vector:
QC_snprintfz(newname, sizeof(newname), "%s%s.%s", name, array, type->params[partnum].paramname);
QC_snprintfz(newname, sizeof(newname), "%s.%s", def->name, type->params[partnum].paramname);
QCC_PR_DummyDef(parttype, newname, scope, type->params[partnum].arraysize, rootsymbol, def->ofs+type->params[partnum].ofs, false, flags);
// QC_snprintfz(newname, sizeof(newname), "%s%s.%s_x", name, array, type->params[partnum].paramname);
// QC_snprintfz(newname, sizeof(newname), "%s.%s_x", def->name, type->params[partnum].paramname);
// QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, type->params[partnum].ofs - rootsymbol->ofs, false, flags | GDF_CONST);
// QC_snprintfz(newname, sizeof(newname), "%s%s.%s_y", name, array, type->params[partnum].paramname);
// QC_snprintfz(newname, sizeof(newname), "%s.%s_y", def->name, type->params[partnum].paramname);
// QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, type->params[partnum].ofs+1 - rootsymbol->ofs, false, flags | GDF_CONST);
// QC_snprintfz(newname, sizeof(newname), "%s%s.%s_z", name, array, type->params[partnum].paramname);
// QC_snprintfz(newname, sizeof(newname), "%s.%s_z", def->name, type->params[partnum].paramname);
// QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, type->params[partnum].ofs+2 - rootsymbol->ofs, false, flags | GDF_CONST);
break;
@ -13271,12 +13271,12 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
case ev_struct:
case ev_union:
case ev_variant: //for lack of any better alternative
QC_snprintfz(newname, sizeof(newname), "%s%s.%s", name, array, type->params[partnum].paramname);
QC_snprintfz(newname, sizeof(newname), "%s.%s", def->name, type->params[partnum].paramname);
QCC_PR_DummyDef(parttype, newname, scope, type->params[partnum].arraysize, rootsymbol, def->ofs+type->params[partnum].ofs, false, flags);
break;
case ev_function:
QC_snprintfz(newname, sizeof(newname), "%s%s.%s", name, array, parttype->name);
QC_snprintfz(newname, sizeof(newname), "%s.%s", def->name, parttype->name);
QCC_PR_DummyDef(parttype, newname, scope, type->params[partnum].arraysize, rootsymbol, def->ofs+type->params[partnum].ofs, false, flags)->initialized = true;
break;
case ev_void:
@ -13286,11 +13286,11 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
}
else if (type->type == ev_vector && !arraysize)
{ //do the vector thing.
QC_snprintfz(newname, sizeof(newname), "%s%s_x", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_x", def->name);
QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, def->ofs+0, referable, (flags&~GDF_SAVED) | GDF_STRIP);
QC_snprintfz(newname, sizeof(newname), "%s%s_y", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_y", def->name);
QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, def->ofs+1, referable, (flags&~GDF_SAVED) | GDF_STRIP);
QC_snprintfz(newname, sizeof(newname), "%s%s_z", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_z", def->name);
QCC_PR_DummyDef(type_float, newname, scope, 0, rootsymbol, def->ofs+2, referable, (flags&~GDF_SAVED) | GDF_STRIP);
}
else if (type->type == ev_field)
@ -13298,11 +13298,11 @@ QCC_def_t *QCC_PR_DummyDef(QCC_type_t *type, const char *name, QCC_function_t *s
if (type->aux_type->type == ev_vector && !arraysize)
{
//do the vector thing.
QC_snprintfz(newname, sizeof(newname), "%s%s_x", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_x", def->name);
QCC_PR_DummyDef(type_floatfield, newname, scope, 0, rootsymbol, def->ofs+0, referable, flags);
QC_snprintfz(newname, sizeof(newname), "%s%s_y", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_y", def->name);
QCC_PR_DummyDef(type_floatfield, newname, scope, 0, rootsymbol, def->ofs+1, referable, flags);
QC_snprintfz(newname, sizeof(newname), "%s%s_z", name, array);
QC_snprintfz(newname, sizeof(newname), "%s_z", def->name);
QCC_PR_DummyDef(type_floatfield, newname, scope, 0, rootsymbol, def->ofs+2, referable, flags);
}
}

View File

@ -1105,6 +1105,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case svc_centerprint:
nullterms = 1;
break;
#ifdef HEXEN2
case svch2_clearviewflags:
if (progstype == PROG_H2)
{
@ -1129,6 +1130,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
protocollen = sizeof(buffer);
}
break;
#endif
case svc_cutscene:
nullterms = 1;
break;
@ -1162,6 +1164,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
switch(majortype)
{
case 128:
#ifdef NQPROT
{
unsigned int bits = buffer[0];
protocollen = 1;
@ -1207,6 +1210,9 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
if (bits & DPU_EXTEND1)
Con_DPrintf("NQWriteByte: fast update with extension bits is not supported\n");
}
#else
ignoreprotocol = true;
#endif
break;
case svc_sound:
protocollen = 5+destprim->coordsize*3;

View File

@ -5421,7 +5421,7 @@ static void QCBUILTIN PF_WriteString2 (pubprogfuncs_t *prinst, struct globalvars
G_FLOAT(OFS_PARM1) = old;
}
#ifndef QUAKETC
#if !defined(QUAKETC) && defined(NETPREPARSE)
//qtest-only builtins.
static void QCBUILTIN PF_qtSingle_WriteByte (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -10049,7 +10049,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"WriteString", PF_WriteString, 58, 58, 58, 0, "void(float to, string val)"}, //58
{"WriteEntity", PF_WriteEntity, 59, 59, 59, 0, "void(float to, entity val)"}, //59
#ifndef QUAKETC
#if !defined(QUAKETC) && defined(NETPREPARSE)
{"swritebyte", PF_qtSingle_WriteByte, 0, 0, 0, 0, D("void(float val)", "A legacy of qtest - like WriteByte, except writes explicitly to the MSG_ONE target."), true}, //52
{"swritechar", PF_qtSingle_WriteChar, 0, 0, 0, 0, D("void(float val)", NULL), true}, //53
{"swriteshort", PF_qtSingle_WriteShort, 0, 0, 0, 0, D("void(float val)", NULL), true}, //54
@ -11013,7 +11013,7 @@ void PR_ResetBuiltins(progstype_t type) //fix all nulls to PF_FIXME and add any
builtincount[i]=100;
}
#ifndef QUAKETC
#if !defined(QUAKETC) && defined(NETPREPARSE)
if (type == PROG_PREREL)
{
pr_builtin[52] = PF_qtSingle_WriteByte;

View File

@ -1837,7 +1837,7 @@ static void SV_Status_f (void)
extern cvar_t sv_listen_q3;
#endif
#ifdef HAVE_DTLS
extern cvar_t sv_listen_dtls;
extern cvar_t net_enable_dtls;
#endif
#ifndef SERVERONLY
@ -1898,9 +1898,9 @@ static void SV_Status_f (void)
if (sv_listen_q3.ival) Con_Printf(" Q3");
#endif
#ifdef HAVE_DTLS
if (sv_listen_dtls.ival >= 3)
if (net_enable_dtls.ival >= 3)
Con_Printf(" DTLS-only");
else if (sv_listen_dtls.ival)
else if (net_enable_dtls.ival)
Con_Printf(" DTLS");
#endif
/*if (net_enable_tls.ival)

View File

@ -3208,6 +3208,7 @@ void SV_Snapshot_BuildStateQ1(entity_state_t *state, edict_t *ent, client_t *cli
if (ent->xv->basebone < 0)
{
#ifdef SKELETALMODELS
if (ent->xv->skeletonindex && pack)
{
framestate_t fs;
@ -3220,6 +3221,7 @@ void SV_Snapshot_BuildStateQ1(entity_state_t *state, edict_t *ent, client_t *cli
//state->dpflags |= RENDER_COMPLEXANIMATION;
}
}
#endif
}
else
{

View File

@ -826,8 +826,8 @@ void SV_SpawnServer (const char *server, const char *startspot, qboolean noents,
Con_DPrintf ("SpawnServer: %s\n",server);
svs.spawncount++; // any partially connected client will be
// restarted
svs.spawncount++; // any partially connected client will be restarted
sv.world.spawncount = svs.spawncount;
#ifndef SERVERONLY
total_loading_size = 100;

View File

@ -41,26 +41,6 @@ void SV_Tcpport6_Callback(struct cvar_s *var, char *oldvalue);
void SV_Port_Callback(struct cvar_s *var, char *oldvalue);
void SV_PortIPv6_Callback(struct cvar_s *var, char *oldvalue);
void SV_PortIPX_Callback(struct cvar_s *var, char *oldvalue);
#ifdef HAVE_DTLS
void QDECL SV_Listen_Dtls_Changed(struct cvar_s *var, char *oldvalue)
{
//set up the default value
if (!*var->string)
var->ival = 1; //FIXME: change to 2 when better tested.
if (var->ival)
{
if (!svs.sockets->dtlsfuncs)
svs.sockets->dtlsfuncs = DTLS_InitServer();
if (!svs.sockets->dtlsfuncs)
{
if (var->ival >= 2)
Con_Printf("Unable to set %s to \"%s\", no DTLS certificate available.\n", var->name, var->string);
var->ival = 0; //disable the cvar (internally) if we don't have a usable certificate. this allows us to default the cvar to enabled without it breaking otherwise.
}
}
}
#endif
client_t *host_client; // current client
@ -124,9 +104,7 @@ cvar_t sv_listen_dp = CVARD("sv_listen_dp", "0", "Allows the server to respond
#ifdef QWOVERQ3
cvar_t sv_listen_q3 = CVAR("sv_listen_q3", "0");
#endif
#ifdef HAVE_DTLS
cvar_t sv_listen_dtls = CVARCD("net_enable_dtls", "", SV_Listen_Dtls_Changed, "Controls serverside dtls support.\n0: dtls blocked, not advertised.\n1: available in desired.\n2: used where possible (recommended setting).\n3: disallow non-dtls clients (sv_port_tcp should be eg tls://[::]:27500 to also disallow unencrypted tcp connections).");
#endif
extern cvar_t net_enable_dtls;
cvar_t sv_reportheartbeats = CVARD("sv_reportheartbeats", "2", "Print a notice each time a heartbeat is sent to a master server. When set to 2, the message will be displayed once.");
cvar_t sv_highchars = CVAR("sv_highchars", "1");
cvar_t sv_maxrate = CVAR("sv_maxrate", "30000");
@ -1328,7 +1306,7 @@ static void SVC_GetInfo (char *challenge, int fullstatus)
#ifdef Q2SERVER
static void SVC_InfoQ2 (void)
{
char string[64];
char string[128];
int i, count;
int version;
@ -1648,13 +1626,13 @@ qboolean SVC_GetChallenge (qboolean respond_dp)
#endif
#ifdef HAVE_DTLS
if (sv_listen_dtls.ival/* || !*sv_listen_dtls.string*/)
if (net_enable_dtls.ival/* || !*net_enable_dtls.string*/)
{
lng = LittleLong(PROTOCOL_VERSION_DTLSUPGRADE);
memcpy(over, &lng, sizeof(lng));
over+=sizeof(lng);
if (sv_listen_dtls.ival >= 2)
if (net_enable_dtls.ival >= 2)
lng = LittleLong(2); //required
else
lng = LittleLong(1); //supported
@ -1664,7 +1642,7 @@ qboolean SVC_GetChallenge (qboolean respond_dp)
#endif
if (*sv_guidhash.string
#ifdef HAVE_DTLS
&& (sv_listen_dtls.ival < 3 || net_from.prot == NP_DTLS)
&& (net_enable_dtls.ival < 3 || net_from.prot == NP_DTLS)
#endif
)
{
@ -2539,7 +2517,7 @@ client_t *SVC_DirectConnect(void)
}
#ifdef HAVE_DTLS
if (sv_listen_dtls.ival > 2 && (net_from.prot == NP_DGRAM || net_from.prot == NP_STREAM || net_from.prot == NP_WS))
if (net_enable_dtls.ival > 2 && (net_from.prot == NP_DGRAM || net_from.prot == NP_STREAM || net_from.prot == NP_WS))
{
SV_RejectMessage (protocol, "This server requires the use of DTLS/TLS/WSS.\n");
return NULL;
@ -3707,7 +3685,7 @@ qboolean SV_ConnectionlessPacket (void)
else if (!strcmp(c,"dtlsconnect"))
{
#ifdef HAVE_DTLS
if (net_from.prot == NP_DGRAM && (sv_listen_dtls.ival /*|| !*sv_listen_dtls.ival*/))
if (net_from.prot == NP_DGRAM && (net_enable_dtls.ival /*|| !*net_enable_dtls.ival*/))
{
if (SV_ChallengePasses(atoi(Cmd_Argv(1))))
{
@ -5140,9 +5118,6 @@ void SV_InitLocal (void)
Cvar_Register (&sv_listen_dp, cvargroup_servercontrol);
#ifdef QWOVERQ3
Cvar_Register (&sv_listen_q3, cvargroup_servercontrol);
#endif
#ifdef HAVE_DTLS
Cvar_Register (&sv_listen_dtls, cvargroup_servercontrol);
#endif
sv_listen_qw.restriction = RESTRICT_MAX; //no disabling this over rcon.
Cvar_Register (&fraglog_public, cvargroup_servercontrol);

View File

@ -2194,6 +2194,7 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent)
break;
case MOVETYPE_FLY_WORLDONLY:
case MOVETYPE_FLY:
#ifndef CLIENTONLY
if (svent)
{ //NQ players with movetype_fly are not like non-players.
if (!WPhys_RunThink (w, ent))
@ -2206,6 +2207,7 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent)
WPhys_WalkMove (w, ent, gravitydir);
break;
}
#endif
//fallthrough
case MOVETYPE_H2SWIM:
case MOVETYPE_TOSS:

View File

@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef __i386__
#ifdef __linux__
#ifndef _GNU_SOURCE
#define _GNU_SOURCE //we need this in order to fix up broken backtraces. make sure its defined only where needed so we still some posixy conformance test on one plat.
#endif
@ -48,6 +48,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <pthread.h>
#endif
#if defined(__linux__)
//if we're chrooting, then we need to poke a few other systems to ensure libraries are loaded
#include "netinc.h"
#endif
// callbacks
void Sys_Linebuffer_Callback (struct cvar_s *var, char *oldvalue);
@ -704,6 +710,112 @@ static void Friendly_Crash_Handler(int sig, siginfo_t *info, void *vcontext)
}
#endif
#ifdef HAVE_GNUTLS
qboolean SSL_InitGlobal(qboolean isserver);
#endif
static int Sys_CheckChRoot(void)
{ //also warns if run as root.
int ret = false;
#ifdef __linux__
//three ways to use this:
//nonroot-with-SUID-root -- chroots+drops to a fixed path when run as a regular user. the homedir mechanism can be used for writing files.
//root -chroot foo -uid bar -- requires root, changes the filesystem and then switches user rights before starting the game itself.
//root -chroot foo -- requires root,changes the filesystem and
uid_t ruid, euid, suid;
int arg = COM_CheckParm("-chroot");
const char *newroot = arg?com_argv[arg+1]:NULL;
const char *newhome;
getresuid(&ruid, &euid, &suid);
printf("ruid %u, euid %u, suid %u\n", ruid, euid, suid);
if (!euid && ruid != euid)
{ //if we're running SUID-root then assume the admin set it up that way in order to use chroot without making any libraries available inside the jail.
//however, chroot needs a certain level of sandboxing to prevent somehow running suid programs with eg a custom /etc/passwd, etc.
//this means we can't allow
//FIXME other games. should use the list in fs.c
if (COM_CheckParm("-quake"))
newroot = "/usr/share/quake";
else if (COM_CheckParm("-quake2"))
newroot = "/usr/share/quake2";
else if (COM_CheckParm("-quake3"))
newroot = "/usr/share/quake3";
else if (COM_CheckParm("-hexen2") || COM_CheckParm("-portals"))
newroot = "/usr/share/hexen2";
else
#ifdef GAME_SHORTNAME
newroot = "/usr/share/" GAME_SHORTNAME;
#else
newroot = "/usr/share/quake";
#endif
//just read the environment name
newhome = getenv("USER");
}
else
{
newhome = NULL;
arg = COM_CheckParm("-uid");
if (arg)
ruid = strtol(com_argv[arg+1], NULL, 0);
}
if (newroot)
{ //chroot requires running as root, which sucks.
//make sure there's no suid programs in the new root dir that might get confused by /etc/ being something else.
//this binary MUST NOT be inside the new root.
//FIXME: should we temporarily try swapping uid+euid so we don't have any more access than a non-suid binary for this initial init stuff?
struct addrinfo *info;
if (getaddrinfo("localhost", NULL, NULL, &info) == 0) //make sure we've loaded /etc/resolv.conf etc, otherwise any dns requests are going to fail.
freeaddrinfo(info);
#ifdef HAVE_GNUTLS
SSL_InitGlobal(false); //we need to load the known CA certs while we still can, as well as any shared objects
//SSL_InitGlobal(true); //make sure we load our public cert from outside the sandbox. an exploit might still be able to find it in memory though. FIXME: disabled in case this reads from somewhere bad - we're still root.
#endif
printf("Changing to root: \"%s\"\n", newroot);
if (chroot(newroot))
{
printf("chroot call failed\n");
return -1;
}
chdir("/"); //chroot does NOT change the working directory, so we need to make sure that happens otherwise still a way out.
if (newhome)
setenv("HOME", va("/user/%s", newhome), true);
else
setenv("HOME", va("/user/%i", ruid), true);
setenv("PWD", "/", true);
ret = true;
}
if (ruid != euid || newroot)
{
if (setresuid(ruid, ruid, ruid)) //go back to our original user, assuming we were SUIDed
{
printf("error dropping priveledges\n");
return -1;
}
getresuid(&ruid, &euid, &suid);
if (setuid(0) != -1 || errno != EPERM)
{
printf("priveledges were not dropped...\n");
return -1;
}
getresuid(&ruid, &euid, &suid);
}
if (!ruid || !euid || !suid)
printf("WARNING: you should NOT be running this as root!\n");
#endif
return ret;
}
/*
=============
main
@ -715,6 +827,7 @@ int main(int argc, char *argv[])
quakeparms_t parms;
// fd_set fdset;
// extern int net_socket;
char bindir[MAX_OSPATH];
signal(SIGPIPE, SIG_IGN);
tcgetattr(STDIN_FILENO, &orig);
@ -729,6 +842,42 @@ int main(int argc, char *argv[])
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
switch(Sys_CheckChRoot())
{
case true:
parms.basedir = "/";
break;
case false:
parms.basedir = "./";
#ifdef __linux__
//attempt to figure out where the exe is located
int l = readlink("/proc/self/exe", bindir, sizeof(bindir)-1);
if (l > 0)
{
bindir[l] = 0;
*COM_SkipPath(bindir) = 0;
printf("Binary is located at \"%s\"\n", bindir);
parms.binarydir = bindir;
}
/*#elif defined(__bsd__)
//attempt to figure out where the exe is located
int l = readlink("/proc/self/exe", bindir, sizeof(bindir)-1);
if (l > 0)
{
bindir[l] = 0;
*COM_SkipPath(bindir) = 0;
printf("Binary is located at "%s"\n", bindir);
parms.binarydir = bindir;
}
*/
#endif
break;
default:
return -1;
}
#ifdef __linux__
if (!COM_CheckParm("-nodumpstack"))
{
@ -750,7 +899,6 @@ int main(int argc, char *argv[])
isClusterSlave = true;
#endif
parms.basedir = "./";
TL_InitLanguages(parms.basedir);
SV_Init (&parms);

View File

@ -1782,11 +1782,19 @@ static void T_Gen_CurrentRender(void)
region.extent.height = vid.fbpheight;
region.extent.depth = 1;
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
set_image_layout(vk.rendertarg->cbuf, img->image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
set_image_layout(vk.rendertarg->cbuf, img->image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
vkCmdCopyImage(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, img->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
set_image_layout(vk.rendertarg->cbuf, img->image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
set_image_layout(vk.rendertarg->cbuf, img->image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
}
@ -6330,7 +6338,7 @@ void VKBE_VBO_Finish(vbobctx_t *ctx, void *edata, size_t esize, vboarray_t *earr
struct stagingbuf *n;
struct stagingbuf ebo;
VkDeviceMemory *retarded;
index_t *map = VKBE_CreateStagingBuffer(&ebo, esize, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT);
index_t *map = VKBE_CreateStagingBuffer(&ebo, esize, VK_BUFFER_USAGE_INDEX_BUFFER_BIT);
memcpy(map, edata, esize);
*ebomem = retarded = Z_Malloc(sizeof(*retarded));
earray->vk.buff = VKBE_FinishStaging(&ebo, retarded);

View File

@ -77,6 +77,23 @@ static struct vk_rendertarg_cube vk_rt_cubemap;
qboolean VK_SCR_GrabBackBuffer(void);
#ifdef __linux__
#include <execinfo.h>
#define DOBACKTRACE() \
do { \
void *bt[16]; \
int i, fr = backtrace(bt, countof(bt)); \
char **strings = backtrace_symbols(bt, fr); \
for (i = 0; i < fr; i++) \
if (strings) \
Con_Printf("\t%s\n", strings[i]); \
else \
Con_Printf("\t%p\n", bt[i]); \
free(strings); \
} while(0)
#else
#define DOBACKTRACE()
#endif
static VkDebugReportCallbackEXT vk_debugcallback;
static VkBool32 VKAPI_PTR mydebugreportcallback(
@ -90,26 +107,41 @@ static VkBool32 VKAPI_PTR mydebugreportcallback(
void* pUserData)
{
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
{
Con_Printf("ERR: %s: %s\n", pLayerPrefix, pMessage);
// DOBACKTRACE();
}
else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT)
{
if (!strncmp(pMessage, "Additional bits in Source accessMask", 36) && strstr(pMessage, "VK_IMAGE_LAYOUT_UNDEFINED"))
return false; //I don't give a fuck. undefined can be used to change layouts on a texture that already exists too.
Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
Con_Printf("WARN: %s: %s\n", pLayerPrefix, pMessage);
DOBACKTRACE();
}
else if (flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT)
Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
{
Con_DPrintf("DBG: %s: %s\n", pLayerPrefix, pMessage);
// DOBACKTRACE();
}
else if (flags & VK_DEBUG_REPORT_INFORMATION_BIT_EXT)
{
#ifdef _WIN32
// OutputDebugString(va("%s\n", pMessage));
// OutputDebugString(va("INF: %s\n", pMessage));
#else
Con_Printf("INF: %s: %s\n", pLayerPrefix, pMessage);
// DOBACKTRACE();
#endif
// Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
}
else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)
Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
{
Con_Printf("PERF: %s: %s\n", pLayerPrefix, pMessage);
DOBACKTRACE();
}
else
Con_Printf("%s: %s\n", pLayerPrefix, pMessage);
{
Con_Printf("OTHER: %s: %s\n", pLayerPrefix, pMessage);
DOBACKTRACE();
}
return false;
}
@ -332,6 +364,7 @@ static qboolean VK_CreateSwapChain(void)
{
VkMemoryRequirements mem_reqs;
VkMemoryAllocateInfo memAllocInfo = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
VkMemoryDedicatedAllocateInfoKHR khr_mdai = {VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR};
VkDedicatedAllocationMemoryAllocateInfoNV nv_damai = {VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV};
VkImageCreateInfo ici = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
VkDedicatedAllocationImageCreateInfoNV nv_daici = {VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV};
@ -378,6 +411,12 @@ static qboolean VK_CreateSwapChain(void)
nv_damai.image = images[i];
memAllocInfo.pNext = &nv_damai;
}
if (vk.khr_dedicated_allocation)
{
khr_mdai.pNext = memAllocInfo.pNext;
khr_mdai.image = images[i];
memAllocInfo.pNext = &khr_mdai;
}
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &memories[i]));
VkAssert(vkBindImageMemory(vk.device, images[i], memories[i], 0));
@ -602,6 +641,7 @@ static qboolean VK_CreateSwapChain(void)
free(presentmode);
free(surffmts);
newvkswapchain = VK_NULL_HANDLE;
VkAssert(vkCreateSwapchainKHR(vk.device, &swapinfo, vkallocationcb, &newvkswapchain));
if (!newvkswapchain)
return false;
@ -743,6 +783,7 @@ static qboolean VK_CreateSwapChain(void)
{
VkMemoryRequirements mem_reqs;
VkMemoryAllocateInfo memAllocInfo = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
VkMemoryDedicatedAllocateInfoKHR khr_mdai = {VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR};
VkDedicatedAllocationMemoryAllocateInfoNV nv_damai = {VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV};
vkGetImageMemoryRequirements(vk.device, vk.backbufs[i].depth.image, &mem_reqs);
memAllocInfo.allocationSize = mem_reqs.size;
@ -753,6 +794,12 @@ static qboolean VK_CreateSwapChain(void)
nv_damai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &nv_damai;
}
if (vk.khr_dedicated_allocation)
{
khr_mdai.image = vk.backbufs[i].depth.image;
khr_mdai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &khr_mdai;
}
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &vk.backbufs[i].depth.memory));
VkAssert(vkBindImageMemory(vk.device, vk.backbufs[i].depth.image, vk.backbufs[i].depth.memory, 0));
}
@ -813,6 +860,7 @@ static qboolean VK_CreateSwapChain(void)
{
VkMemoryRequirements mem_reqs;
VkMemoryAllocateInfo memAllocInfo = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
VkMemoryDedicatedAllocateInfoKHR khr_mdai = {VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR};
VkDedicatedAllocationMemoryAllocateInfoNV nv_damai = {VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV};
vkGetImageMemoryRequirements(vk.device, vk.backbufs[i].mscolour.image, &mem_reqs);
memAllocInfo.allocationSize = mem_reqs.size;
@ -823,6 +871,13 @@ static qboolean VK_CreateSwapChain(void)
nv_damai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &nv_damai;
}
if (vk.khr_dedicated_allocation)
{
khr_mdai.image = vk.backbufs[i].mscolour.image;
khr_mdai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &khr_mdai;
}
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &vk.backbufs[i].mscolour.memory));
VkAssert(vkBindImageMemory(vk.device, vk.backbufs[i].mscolour.image, vk.backbufs[i].mscolour.memory, 0));
}
@ -970,6 +1025,7 @@ vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t lay
#endif
VkMemoryRequirements mem_reqs;
VkMemoryAllocateInfo memAllocInfo = {VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO};
VkMemoryDedicatedAllocateInfoKHR khr_mdai = {VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR};
VkDedicatedAllocationMemoryAllocateInfoNV nv_damai = {VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV};
VkImageCreateInfo ici = {VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO};
@ -1141,6 +1197,12 @@ vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t lay
nv_damai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &nv_damai;
}
if (vk.khr_dedicated_allocation)
{
khr_mdai.image = ret.image;
khr_mdai.pNext = memAllocInfo.pNext;
memAllocInfo.pNext = &khr_mdai;
}
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &ret.memory));
VkAssert(vkBindImageMemory(vk.device, ret.image, ret.memory, 0));
@ -1196,7 +1258,9 @@ vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t lay
}
return ret;
}
void set_image_layout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlags aspectMask, VkImageLayout old_image_layout, VkAccessFlags srcaccess, VkImageLayout new_image_layout, VkAccessFlags dstaccess)
void set_image_layout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlags aspectMask,
VkImageLayout old_image_layout, VkAccessFlags srcaccess, VkPipelineStageFlagBits srcstagemask,
VkImageLayout new_image_layout, VkAccessFlags dstaccess, VkPipelineStageFlagBits dststagemask)
{
//images have weird layout representations.
//we need to use a side-effect of memory barriers in order to convert from one layout to another, so that we can actually use the image.
@ -1233,7 +1297,7 @@ void set_image_layout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlags asp
else if (old_image_layout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL)
imgbarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
*/
vkCmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vkCmdPipelineBarrier(cmd, srcstagemask, dststagemask, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
}
void VK_FencedCheck(void)
@ -1474,7 +1538,7 @@ qboolean VK_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips)
imgbarrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT;
imgbarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
}
}
else
@ -1498,7 +1562,7 @@ qboolean VK_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips)
imgbarrier.srcAccessMask = 0;
imgbarrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
}
}
@ -1617,7 +1681,9 @@ qboolean VK_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips)
region.extent.height = mips->mip[i].height;
region.extent.depth = 1;
set_image_layout(vkloadcmd, fence->staging[i].image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_PREINITIALIZED, VK_ACCESS_HOST_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
set_image_layout(vkloadcmd, fence->staging[i].image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_PREINITIALIZED, VK_ACCESS_HOST_WRITE_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
vkCmdCopyImage(vkloadcmd, fence->staging[i].image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, target.image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &region);
}
}
@ -1641,7 +1707,7 @@ qboolean VK_LoadTextureMips (texid_t tex, const struct pendingtextureinfo *mips)
imgbarrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
imgbarrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vkCmdPipelineBarrier(vkloadcmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
}
VK_FencedSubmit(fence);
@ -2552,7 +2618,9 @@ void VKVID_QueueGetRGBData (void (*gotrgbdata) (void *rgbdata, intptr_t bytest
VkAssert(vkAllocateMemory(vk.device, &memAllocInfo, vkallocationcb, &capt->memory));
VkAssert(vkBindBufferMemory(vk.device, capt->buffer, capt->memory, 0));
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
icpy.bufferOffset = 0;
icpy.bufferRowLength = 0; //packed
@ -2570,7 +2638,9 @@ void VKVID_QueueGetRGBData (void (*gotrgbdata) (void *rgbdata, intptr_t bytest
vkCmdCopyImageToBuffer(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, capt->buffer, 1, &icpy);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
set_image_layout(vk.rendertarg->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
}
char *VKVID_GetRGBInfo (int *bytestride, int *truevidwidth, int *truevidheight, enum uploadfmt *fmt)
@ -2651,8 +2721,12 @@ char *VKVID_GetRGBInfo (int *bytestride, int *truevidwidth, int *truevidheight
VkAssert(vkBindBufferMemory(vk.device, tempbuffer, tempbufmemory, 0));
set_image_layout(fence->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, framebufferlayout, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
set_image_layout(fence->cbuf, tempimage, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT);
set_image_layout(fence->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
framebufferlayout, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
set_image_layout(fence->cbuf, tempimage, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_UNDEFINED, 0, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
{
VkImageBlit iblt;
iblt.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
@ -2678,8 +2752,12 @@ char *VKVID_GetRGBInfo (int *bytestride, int *truevidwidth, int *truevidheight
vkCmdBlitImage(fence->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, tempimage, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &iblt, VK_FILTER_LINEAR);
}
set_image_layout(fence->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, framebufferlayout, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT);
set_image_layout(fence->cbuf, tempimage, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT);
set_image_layout(fence->cbuf, vk.frame->backbuf->colour.image, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
framebufferlayout, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
set_image_layout(fence->cbuf, tempimage, VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
{
VkBufferImageCopy icpy;
@ -2994,9 +3072,9 @@ qboolean VK_SCR_GrabBackBuffer(void)
{
VkImageMemoryBarrier imgbarrier = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
imgbarrier.pNext = NULL;
imgbarrier.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT;
imgbarrier.srcAccessMask = 0;//VK_ACCESS_MEMORY_READ_BIT;
imgbarrier.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
imgbarrier.oldLayout = vk.rendertarg->colour.layout; //'Alternately, oldLayout can be VK_IMAGE_LAYOUT_UNDEFINED, if the images contents need not be preserved.'
imgbarrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;//vk.rendertarg->colour.layout; //'Alternately, oldLayout can be VK_IMAGE_LAYOUT_UNDEFINED, if the images contents need not be preserved.'
imgbarrier.newLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
imgbarrier.image = vk.frame->backbuf->colour.image;
imgbarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
@ -3020,7 +3098,7 @@ qboolean VK_SCR_GrabBackBuffer(void)
VkImageMemoryBarrier imgbarrier = {VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER};
imgbarrier.pNext = NULL;
imgbarrier.srcAccessMask = 0;
imgbarrier.dstAccessMask = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
imgbarrier.dstAccessMask = 0;//VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
imgbarrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
imgbarrier.newLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
imgbarrier.image = vk.frame->backbuf->depth.image;
@ -3251,7 +3329,7 @@ qboolean VK_SCR_UpdateScreen (void)
imgbarrier.subresourceRange.layerCount = 1;
imgbarrier.srcQueueFamilyIndex = vk.queuefam[0];
imgbarrier.dstQueueFamilyIndex = vk.queuefam[1];
vkCmdPipelineBarrier(vk.rendertarg->cbuf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vkCmdPipelineBarrier(vk.rendertarg->cbuf, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &imgbarrier);
vk.rendertarg->colour.layout = imgbarrier.newLayout;
}
@ -3717,6 +3795,7 @@ qboolean VK_Init(rendererstate_t *info, const char **sysextnames, qboolean (*cre
uint32_t extensions_count = 0;
//device extensions that want to enable
//initialised in reverse order, so superseeded should name later extensions.
struct
{
qboolean *flag;
@ -3731,7 +3810,7 @@ qboolean VK_Init(rendererstate_t *info, const char **sysextnames, qboolean (*cre
{&vk.khr_swapchain, VK_KHR_SWAPCHAIN_EXTENSION_NAME, NULL, true, NULL, " Nothing will be drawn!"},
{&vk.nv_glsl_shader, VK_NV_GLSL_SHADER_EXTENSION_NAME, &vk_nv_glsl_shader, false, NULL, " Direct use of glsl is not supported."},
{&vk.nv_dedicated_allocation, VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME, &vk_nv_dedicated_allocation, true, &vk.khr_dedicated_allocation, ""},
// {&vk.khr_dedicated_allocation, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, &vk_khr_dedicated_allocation, true, NULL, ""},
{&vk.khr_dedicated_allocation, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME, &vk_khr_dedicated_allocation, true, NULL, ""},
{&vk.khr_push_descriptor, VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, &vk_khr_push_descriptor, true, NULL, ""},
};
size_t e;

View File

@ -7,14 +7,17 @@
#endif
#ifdef ANDROID
#define VK_USE_PLATFORM_ANDROID_KHR
#define VKInstXLibFuncs VKFunc(CreateAndroidSurfaceKHR)
#define VK_USE_PLATFORM_ANDROID_KHR
#define VKInstXLibFuncs VKFunc(CreateAndroidSurfaceKHR)
#elif defined(__linux__)
#define VK_USE_PLATFORM_XLIB_KHR
#define VKInstXLibFuncs VKFunc(CreateXlibSurfaceKHR)
#define VK_USE_PLATFORM_XLIB_KHR
#define VKInstXLibFuncs VKFunc(CreateXlibSurfaceKHR)
#define VK_USE_PLATFORM_XCB_KHR
#define VKInstXCBFuncs VKFunc(CreateXcbSurfaceKHR)
#define VK_USE_PLATFORM_XCB_KHR
#define VKInstXCBFuncs VKFunc(CreateXcbSurfaceKHR)
#define VK_USE_PLATFORM_WAYLAND_KHR
#define VKInstWaylandFuncs VKFunc(CreateWaylandSurfaceKHR)
#endif
#define VK_NO_PROTOTYPES
@ -36,7 +39,10 @@
#ifndef VKInstXCBFuncs
#define VKInstXCBFuncs
#endif
#define VKInstArchFuncs VKInstWin32Funcs VKInstXLibFuncs VKInstXCBFuncs
#ifndef VKInstWaylandFuncs
#define VKInstWaylandFuncs
#endif
#define VKInstArchFuncs VKInstWin32Funcs VKInstXLibFuncs VKInstXCBFuncs VKInstWaylandFuncs
//funcs needed for creating an instance
@ -448,7 +454,7 @@ struct stagingbuf
VkBufferUsageFlags usage;
};
vk_image_t VK_CreateTexture2DArray(uint32_t width, uint32_t height, uint32_t layers, uint32_t mips, uploadfmt_t encoding, unsigned int type, qboolean rendertarget);
void set_image_layout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlags aspectMask, VkImageLayout old_image_layout, VkAccessFlags srcaccess, VkImageLayout new_image_layout, VkAccessFlags dstaccess);
void set_image_layout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlags aspectMask, VkImageLayout old_image_layout, VkAccessFlags srcaccess, VkPipelineStageFlagBits srcstagemask, VkImageLayout new_image_layout, VkAccessFlags dstaccess, VkPipelineStageFlagBits dststagemask);
void VK_CreateSampler(unsigned int flags, vk_image_t *img);
void *VKBE_CreateStagingBuffer(struct stagingbuf *n, size_t size, VkBufferUsageFlags usage);
VkBuffer VKBE_FinishStaging(struct stagingbuf *n, VkDeviceMemory *memptr);