2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-21 17:36:18 +01:00
Go to file
a1batross 808be9442f
Use filtered command buffer when string came from network (#241)
* cdll_int: add undocumented FilteredClientCmd function to client interface

* client: use filtered command buffer where we have to execute command from server

* client: use normal pfnClientCmd in place of pfnFilteredClientCmd in case of engine doesn't supports it

* client: don't read out of bounds if engine interface is old and don't have pfnFilteredClientCmd

* client: fix incorrect cvar pointer comparison
2022-04-24 03:43:45 +05:00
.github/workflows Update windows and visual studio version (#214) 2021-12-02 04:19:12 +05:00
cl_dll Use filtered command buffer when string came from network (#241) 2022-04-24 03:43:45 +05:00
cmake Add PowerPC support 2021-12-06 01:56:48 +03:00
common Get VGUI back (optionally) (#194) 2021-10-27 01:35:11 +00:00
contrib/iZarif premake5.lua: update (#196) 2021-11-03 22:53:42 +05:00
dlls Restore Hornetgun fire phase. (#238) 2021-12-31 22:03:05 +05:00
engine Use filtered command buffer when string came from network (#241) 2022-04-24 03:43:45 +05:00
game_shared Get VGUI back (optionally) (#194) 2021-10-27 01:35:11 +00:00
pm_shared #ifdef->#if. 2021-06-20 03:53:07 +05:00
public Add PowerPC support 2021-12-06 01:56:48 +03:00
scripts/waifulib waifulib: update xcompile from engine branch 2021-12-17 03:16:35 +03:00
utils Add custom makefont from #46 2018-01-20 17:04:06 +03:00
vgui-dev@93573075af Get VGUI back (optionally) (#194) 2021-10-27 01:35:11 +00:00
.gitignore gitignore: ignore cmake artifacts 2021-10-27 21:23:18 +03:00
.gitmodules Get VGUI back (optionally) (#194) 2021-10-27 01:35:11 +00:00
.travis.yml Fix addressing variables in travis 2018-04-04 17:31:26 +03:00
Android.mk Improve client 2016-03-01 20:18:42 +00:00
appveyor.yml Make msvc builds in release mode with static runtime (#185) 2021-08-27 13:04:15 +05:00
CMakeLists.txt Support cmake older than 3.7 (#203) 2021-10-28 22:23:12 +05:00
LICENSE replace gnu.txt with LICENSE from ValveSoftware/halflife (#84) 2019-06-12 23:58:48 +03:00
README.md Update README.md. 2021-09-13 01:13:23 +05:00
waf waf: upgrade to waifu 1.1.0 2021-02-28 15:38:09 +03:00
waf.bat add waf.bat 2019-06-11 23:19:48 +03:00
wscript waifulib: migrate to compiler_optimizations waf tool 2021-12-07 09:00:35 +03:00

Half-Life SDK for Xash3D Build Status Windows Build Status

Half-Life SDK for Xash3D & GoldSource with some fixes.

How to build

CMake as most universal way

mkdir build && cd build
cmake ../
make

Crosscompiling using mingw:

mkdir build-mingw && cd build-mingw
TOOLCHAIN_PREFIX=i686-w64-mingw32 # check up the actual mingw prefix of your mingw installation
cmake ../ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER="$TOOLCHAIN_PREFIX-gcc" -DCMAKE_CXX_COMPILER="$TOOLCHAIN_PREFIX-g++"

You may enable or disable some build options by -Dkey=value. All available build options are defined in CMakeLists.txt at root directory. See below if you want to build the GoldSource compatible libraries.

See below, if CMake is not suitable for you:

Windows

Using msvc

We use compilers provided with Microsoft Visual Studio 6. There're compile.bat scripts in both cl_dll and dlls directories. Before running any of those files you must define MSVCDir variable which is the path to your msvc installation.

set MSVCDir=C:\Program Files\Microsoft Visual Studio
compile.bat

These scripts also can be ran via wine:

MSVCDir="z:\home\$USER\.wine\drive_c\Program Files\Microsoft Visual Studio" wine cmd /c compile.bat

The libraries built this way are always GoldSource compatible.

Using mingw

TODO

Unix-like

To use waf, you need to install python (2.7 minimum)

(./waf configure -T release)
(./waf)

Android

Just typical ndk-build. TODO: describe what it is.

Building GoldSource-compatible libraries

To enable building the goldsource compatible client library add GOLDSOURCE_SUPPORT flag when calling cmake:

cmake .. -DGOLDSOURCE_SUPPORT=ON

or when using waf:

 ./waf configure -T release --enable-goldsrc-support

Unlike original client by Valve the resulting client library will not depend on vgui or SDL2 just like the one that's used in FWGS Xash3d.

Note for Windows: it's not possible to create GoldSource compatible libraries using mingw, only msvc builds will work.

Note for Linux: GoldSource requires libraries (both client and server) to be compiled with libstdc++ bundled with g++ of major version 4 (versions from 4.6 to 4.9 should work). If your Linux distribution does not provide compatible g++ version you have several options.

Method 1: Statically build with c++ library

This one is the most simple but has a drawback.

cmake ../ -DGOLDSOURCE_SUPPORT=ON -DCMAKE_C_FLAGS="-static-libstdc++ -static-libgcc"

The drawback is that the compiled libraries will be larger in size.

Method 2: Build in Steam Runtime chroot

This is the official way to build Steam compatible games for Linux.

Clone https://github.com/ValveSoftware/steam-runtime and follow instructions https://github.com/ValveSoftware/steam-runtime#building-in-the-runtime

sudo ./setup_chroot.sh --i386

Then use cmake and make as usual, but prepend the commands with schroot --chroot steamrt_scout_i386 --:

mkdir build-in-steamrt && cd build-in-steamrt
schroot --chroot steamrt_scout_i386 -- cmake ../ -DGOLDSOURCE_SUPPORT=ON
schroot --chroot steamrt_scout_i386 -- make

Method 3: Create your own chroot with older distro that includes g++ 4.

Use the most suitable way for you to create an old distro 32-bit chroot. E.g. on Debian (and similar) you can use debootstrap.

sudo debootstrap --arch=i386 jessie /var/chroot/jessie-debian-i386 # On Ubuntu type trusty instead of jessie
sudo chroot /var/chroot/jessie-debian-i386

Inside chroot install cmake, make, g++ and libsdl2-dev. Then exit the chroot.

On the host system install schroot. Then create and adapt the following config in /etc/schroot/chroot.d/jessie.conf (you can choose a different name):

[jessie]
type=directory
description=Debian jessie i386
directory=/var/chroot/debian-jessie-i386/
users=yourusername
groups=yourusername
root-groups=root
preserve-environment=true
personality=linux32

Insert your actual user name in place of yourusername. Then prepend any make or cmake call with schroot -c jessie --:

mkdir build-in-chroot && cd build-in-chroot
schroot --chroot jessie -- cmake ../ -DGOLDSOURCE_SUPPORT=ON
schroot --chroot jessie -- make

Method 4: Install the needed g++ version yourself

TODO: describe steps.

Configuring Qt Creator to use toolchain from chroot

Create a file with the following contents anywhere:

#!/bin/sh
schroot --chroot steamrt_scout_i386 -- cmake "$@"

Make it executable. In Qt Creator go to Tools -> Options -> Build & Run -> CMake. Add a new cmake tool and specify the path of previously created file. Go to Kits tab, clone your default configuration and choose your CMake tool there. Choose the new kit when opening CMakeLists.txt.