2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-13 15:18:05 +03:00

Add workflows/build.yml

Preparing migration to workflows
Fixes warnings
Update badges README.md
This commit is contained in:
s1lentq 2021-03-16 00:41:38 +07:00
parent 3fc9ee2f55
commit 2e8bd9e1eb
93 changed files with 1863 additions and 842 deletions

183
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,183 @@
name: C/C++ CI
on:
push:
branches: [master]
pull_request:
types: [opened, reopened, synchronize]
release:
types: [published]
jobs:
windows:
name: 'Windows'
runs-on: windows-latest
env:
solution: 'msvc/ReHLDS.sln'
buildPlatform: 'Win32'
buildConfiguration: 'Release'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Nuget
uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x'
- run: nuget restore '${{ env.solution }}'
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
with:
vs-version: '16.8'
- name: Build ReHLDS
run:
msbuild ${{ env.solution }} /t:Clean,Build -p:Configuration="${{ env.buildConfiguration }}" /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
- name: Move files
run: |
mkdir publish\debug
mkdir publish\bin\win32\valve\dlls
move msvc\${{ env.buildConfiguration }}\hlds.exe publish\bin\win32\hlds.exe
move msvc\${{ env.buildConfiguration }}\hltv.exe publish\bin\win32\hltv.exe
move msvc\${{ env.buildConfiguration }}\swds.dll publish\bin\win32\swds.dll
move msvc\${{ env.buildConfiguration }}\core.dll publish\bin\win32\core.dll
move msvc\${{ env.buildConfiguration }}\proxy.dll publish\bin\win32\proxy.dll
move msvc\${{ env.buildConfiguration }}\demoplayer.dll publish\bin\win32\demoplayer.dll
move msvc\${{ env.buildConfiguration }}\filesystem_stdio.dll publish\bin\win32\filesystem_stdio.dll
move msvc\${{ env.buildConfiguration }}\director.dll publish\bin\win32\valve\dlls\director.dll
move msvc\${{ env.buildConfiguration }}\hlds.pdb publish\debug\hlds.pdb
move msvc\${{ env.buildConfiguration }}\hltv.pdb publish\debug\hltv.pdb
move msvc\${{ env.buildConfiguration }}\swds.pdb publish\debug\swds.pdb
move msvc\${{ env.buildConfiguration }}\core.pdb publish\debug\core.pdb
move msvc\${{ env.buildConfiguration }}\proxy.pdb publish\debug\proxy.pdb
move msvc\${{ env.buildConfiguration }}\demoplayer.pdb publish\debug\demoplayer.pdb
move msvc\${{ env.buildConfiguration }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb
move msvc\${{ env.buildConfiguration }}\director.pdb publish\debug\director.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v2
with:
name: win32
path: publish/*
linux:
name: 'Linux'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Check dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
sudo apt-get install -y build-essential
sudo apt-get install -y libc6-dev libc6-dev-i386
sudo apt-get install -y p7zip-full
- name: Build
run: |
mkdir build
cd build
cmake ../
make
- name: Prepare HLSDK
run: |
mkdir -p publish/hlsdk
rsync -a rehlds/common/ publish/hlsdk/common/
rsync -a rehlds/dlls/ publish/hlsdk/dlls/
rsync -a rehlds/pm_shared/ publish/hlsdk/pm_shared/
rsync -a rehlds/public/ publish/hlsdk/public/ --exclude rehlds/
rsync -a rehlds/public/rehlds/ publish/hlsdk/engine
- name: Move files
run: |
mkdir -p publish/bin/linux32/valve/dlls
mv build/rehlds/engine_i486.so publish/bin/linux32/engine_i486.so
mv rehlds/version/appversion.h publish/appversion.h
mv build/rehlds/dedicated/hlds_linux publish/bin/linux32/hlds_linux
mv build/rehlds/HLTV/Console/hltv publish/bin/linux32/hltv
mv build/rehlds/HLTV/Core/core.so publish/bin/linux32/core.so
mv build/rehlds/HLTV/Proxy/proxy.so publish/bin/linux32/proxy.so
mv build/rehlds/HLTV/DemoPlayer/demoplayer.so publish/bin/linux32/demoplayer.so
mv build/rehlds/HLTV/Director/director.so publish/bin/linux32/valve/dlls/director.so
mv build/rehlds/filesystem/FileSystem_Stdio/filesystem_stdio.so publish/bin/linux32/filesystem_stdio.so
- name: Deploy artifacts
uses: actions/upload-artifact@v2
id: upload-job
with:
name: linux32
path: publish/*
- name: Cleanup temporary artifacts
if: success() && steps.upload-job.outcome == 'success'
run: |
rm -rf hlsdk
rm -f appversion.h
publish:
needs: [windows, linux]
name: 'Publish'
runs-on: ubuntu-latest
steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v2
with:
name: linux32
- name: Deploying windows artifacts
uses: actions/download-artifact@v2
with:
name: win32
- name: Reading appversion.h
run: |
if [ -e appversion.h ]; then
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
APP_VERSION=""
else
# Remove quotes
APP_VERSION=$(echo $APP_VERSION | xargs)
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
fi
fi
rm -f appversion.h
- name: Packaging bin/dbg
id: packaging-job
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
run: |
7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
- name: Publish artifacts
uses: softprops/action-gh-release@v1
id: publish-job
if: |
startsWith(github.ref, 'refs/tags/') &&
steps.packaging-job.outcome == 'success'
with:
files: |
*.zip
*.7z
env:
GITHUB_TOKEN: ${{ secrets.API_TOKEN }}
- name: Cleanup temporary artifacts
if: success() && steps.publish-job.outcome == 'success'
run: |
rm -rf bin debug hlsdk
rm -f *.7z *.zip appversion.h

11
CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.1)
project(rehlds CXX)
if (WIN32)
message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/ReHLDS.sln instead it!")
endif()
add_subdirectory(rehlds)
add_subdirectory(rehlds/dedicated)
add_subdirectory(rehlds/filesystem)
add_subdirectory(rehlds/HLTV)

View File

@ -1,5 +1,4 @@
# Rehlds [![Build Status](http://teamcity.rehlds.org/app/rest/builds/buildType:(id:Rehlds_Publish)/statusIcon)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Rehlds_Publish&guest=1) [![Download](https://camo.githubusercontent.com/65c70643ec7b40eea50971003624c2fb04d8d375/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f7265686c64732e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Rehlds_Publish&buildId=lastSuccessful) <img align="right" src="https://cloud.githubusercontent.com/assets/5860435/25316344/add057d4-288f-11e7-93ab-84706a388c3c.png" alt="ReHLDS"/>
# ReHLDS [![C/C++ CI](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml/badge.svg)](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml) [![Download](https://camo.githubusercontent.com/7ab483250adb4037b26e9575331218ee51108190d0938b7836d32f1209ccf907/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f647265616d7374616c6b65722f7265686c64732e737667)](https://github.com/dreamstalker/rehlds/releases/latest) [![Downloads](https://camo.githubusercontent.com/d37654956d99bb9fb7a348fdac39b214d6ae14a7cfb9f96bf873c6b46cdf9ef6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f647265616d7374616c6b65722f7265686c64732f746f74616c3f636f6c6f723d696d706f7274616e74)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/dreamstalker/rehlds.svg)](http://isitmaintained.com/project/dreamstalker/rehlds "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) <img align="right" src="https://user-images.githubusercontent.com/5860435/111066129-040e5e00-84f0-11eb-9e1f-7a7e8611da2b.png" alt="ReHLDS" />
Reverse-engineered (and bugfixed) HLDS
## What is this?
@ -7,7 +6,7 @@ ReHLDS is a result of reverse engineering of original HLDS (build 6152/6153) usi
Along with reverse engineering, a lot of defects and (potential) bugs were found and fixed
You can try play on one of the servers that using rehlds: http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version
You can try play on one of the servers that using rehlds: [Game Tracker](http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version)
## Goals of the project
<ul>
@ -19,7 +18,7 @@ You can try play on one of the servers that using rehlds: http://www.gametracker
Rehlds is fully compatible with latest official HLDS downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.
<br /><b>Warning!</b> Rehlds is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.
Compiled binaries are available here: http://nexus.rehlds.org/nexus/content/repositories/rehlds-dev/rehlds/rehlds/
Compiled binaries are available here: [Artifact releases](https://github.com/dreamstalker/rehlds/releases)
Rehlds binaries require SSE, SSE2 and SSE3 instruction sets to run and can benefit from SSE4.1 and SSE4.2.

21
dep/bzip2/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.1)
project(bzip2 C)
set(BZIP2_SRCS
"src/blocksort.c"
"src/bzlib.c"
"src/compress.c"
"src/crctable.c"
"src/decompress.c"
"src/huffman.c"
"src/precompiled.c"
"src/randtable.c"
"src/bzlib_private.h"
)
include_directories(
"include"
)
add_library(bzip2 STATIC ${BZIP2_SRCS})
set_target_properties(bzip2 PROPERTIES COMPILE_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -39,16 +35,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -58,9 +44,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -97,25 +80,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeaderFile>bzlib_private.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
@ -129,7 +93,6 @@
<ClCompile Include="..\src\precompiled.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\randtable.c" />
</ItemGroup>

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -55,16 +51,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -74,9 +60,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -115,26 +98,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(ProjectDir)..\include\</AdditionalIncludeDirectories>
<TreatWarningAsError>false</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

148
rehlds/CMakeLists.txt Normal file
View File

@ -0,0 +1,148 @@
cmake_minimum_required(VERSION 3.1)
project(engine CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
option(USE_STATIC_LIBSTDC "Enables static linking libstdc++." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-rtti -fno-exceptions")
# Remove noxref code and data
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\
-fpermissive\
-Wno-unknown-pragmas -Wno-invalid-offsetof\
-Wno-unused-variable -Wno-unused-result -Wno-unused-function -Wno-delete-non-virtual-dtor\
-Wno-write-strings -Wno-format\
-Wno-sign-compare -Wno-strict-aliasing -Wno-ignored-attributes")
if (NOT USE_CLANG_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-format-truncation -Wno-unused-but-set-variable -Wno-class-memaccess")
endif()
endif()
if (NOT DEBUG AND USE_STATIC_LIBSTDC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-gc-sections -Wl,--version-script=\"${PROJECT_SOURCE_DIR}/../version_script.lds\"")
endif()
if (USE_STATIC_LIBSTDC)
add_definitions(-DBUILD_STATIC_LIBSTDC)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/engine"
"${PROJECT_SOURCE_DIR}/common"
"${PROJECT_SOURCE_DIR}/pm_shared"
"${PROJECT_SOURCE_DIR}/rehlds"
"${PROJECT_SOURCE_DIR}/testsuite"
)
set(PROJECT_BZIP2_DIR
"${PROJECT_SOURCE_DIR}/../dep/bzip2/include"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/public"
"${PROJECT_SOURCE_DIR}/public/rehlds"
)
file(GLOB ENGINE_SRCS
"engine/*.cpp"
"rehlds/*.cpp"
"version/*.cpp"
)
list(REMOVE_ITEM ENGINE_SRCS EXCLUDE
"${PROJECT_SOURCE_DIR}/rehlds/precompiled.cpp"
"${PROJECT_SOURCE_DIR}/rehlds/RehldsRuntimeConfig.cpp"
"${PROJECT_SOURCE_DIR}/rehlds/structSizeCheck.cpp"
)
file(GLOB COMMON_SRCS
"common/BaseSystemModule.cpp"
"common/ObjectList.cpp"
"common/TokenLine.cpp"
)
file(GLOB PUBLIC_SRCS
"public/tier0/dbg.cpp"
"public/registry.cpp"
"public/steamid.cpp"
"public/utlbuffer.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_BZIP2_DIR}
${PROJECT_PUBLIC_DIR}
)
link_directories(${PROJECT_SOURCE_DIR}/lib/linux32)
add_definitions(
-DSWDS
-DREHLDS_JIT
-DREHLDS_SSE
-DREHLDS_FIXES
-DREHLDS_CHECKS
-DREHLDS_API
-DREHLDS_SELF
-DREHLDS_OPT_PEDANTIC
-DHAVE_OPT_STRTOOLS
-DUSE_BREAKPAD_HANDLER
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_unlink=unlink
-D_vsnprintf=vsnprintf
-D_vsnwprintf=vswprintf
)
if (NOT TARGET bzip2)
add_subdirectory(../dep/bzip2 lib)
endif()
if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/version/appversion.sh" "${PROJECT_SOURCE_DIR}")
endif()
add_library(engine SHARED ${appversion.sh} ${ENGINE_SRCS} ${COMMON_SRCS} ${PUBLIC_SRCS})
set_property(TARGET engine PROPERTY LIBRARY_OUTPUT_NAME engine_i486)
set_target_properties(engine PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
target_link_libraries(engine dl rt m aelf32 bzip2 steam_api)
add_dependencies(engine appversion)

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(HLTV CXX)
add_subdirectory(Console)
add_subdirectory(Core)
add_subdirectory(Proxy)
add_subdirectory(DemoPlayer)
add_subdirectory(Director)

View File

@ -0,0 +1,100 @@
cmake_minimum_required(VERSION 3.1)
project(hltv CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result -Wno-unknown-pragmas -Wno-write-strings")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../.."
"${PROJECT_SOURCE_DIR}/../../engine"
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(HLTV_SRCS
"src/System.cpp"
"src/public_amalgamation.cpp"
)
set(COMMON_SRCS
"../../common/BaseSystemModule.cpp"
"../../common/TokenLine.cpp"
"../../common/ObjectList.cpp"
"../../common/textconsole.cpp"
"../../common/TextConsoleUnix.cpp"
"../../common/minidump.cpp"
"../../HLTV/common/random.cpp"
"../../HLTV/common/common.cpp"
"../../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-DLAUNCHER_FIXES
-D_CONSOLE
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
)
if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..")
endif()
add_executable(hltv ${appversion.sh} ${HLTV_SRCS} ${COMMON_SRCS})
target_link_libraries(hltv dl)
set_target_properties(hltv PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
add_dependencies(hltv appversion)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -34,62 +30,50 @@
<ClCompile Include="..\..\..\common\BaseSystemModule.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectList.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\textconsole.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TextConsoleUnix.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TextConsoleWin32.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\TokenLine.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\common\minidump.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\common\common.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\..\common\random.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\System.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
</ClCompile>
</ItemGroup>
@ -125,16 +109,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -146,9 +120,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -158,10 +129,6 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>hltv</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>hltv</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -190,6 +157,10 @@
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\")</Command>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@ -222,38 +193,10 @@
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>Disabled</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\..\..\version\" "$(ProjectDir)..\..\..\")</Command>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -0,0 +1,220 @@
@setlocal enableextensions enabledelayedexpansion
@echo on
::
:: Pre-build auto-versioning script
::
set srcdir=%~1
set repodir=%~2
set old_version=
set version_major=0
set version_minor=0
set version_maintenance=0
set version_modifed=
set commitSHA=
set commitURL=
set commitCount=0
set branch_name=master
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "hour=%dt:~8,2%"
set "min=%dt:~10,2%"
set "sec=%dt:~12,2%"
::
:: Remove leading zero from MM (e.g 09 > 9)
::
for /f "tokens=* delims=0" %%I in ("%MM%") do set MM=%%I
::
:: Index into array to get month name
::
for /f "tokens=%MM%" %%I in ("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") do set "month=%%I"
::
:: Check for git.exe presence
::
CALL git.exe describe >NUL 2>&1
set errlvl="%ERRORLEVEL%"
::
:: Read old appversion.h, if present
::
IF EXIST "%srcdir%\appversion.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\appversion.h") do (
IF %%i==#define (
IF %%j==APP_VERSION (
:: Remove quotes
set v=%%k
set old_version=!v:"=!
)
)
)
)
IF %errlvl% == "1" (
echo can't locate git.exe - auto-versioning step won't be performed
:: if we haven't appversion.h, we need to create it
IF NOT "%old_version%" == "" (
set commitCount=0
)
)
::
:: Read major, minor and maintenance version components from Version.h
::
IF EXIST "%srcdir%\version.h" (
FOR /F "usebackq tokens=1,2,3" %%i in ("%srcdir%\version.h") do (
IF %%i==#define (
IF %%j==VERSION_MAJOR set version_major=%%k
IF %%j==VERSION_MINOR set version_minor=%%k
IF %%j==VERSION_MAINTENANCE set version_maintenance=%%k
)
)
) ELSE (
FOR /F "usebackq tokens=1,2,3,* delims==" %%i in ("%repodir%..\gradle.properties") do (
IF NOT [%%j] == [] (
IF %%i==majorVersion set version_major=%%j
IF %%i==minorVersion set version_minor=%%j
IF %%i==maintenanceVersion set version_maintenance=%%j
)
)
)
::
:: Read revision and release date from it
::
IF NOT %errlvl% == "1" (
:: Get current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --abbrev-ref HEAD"') DO (
set branch_name=%%i
)
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-list --count !branch_name!"') DO (
IF NOT [%%i] == [] (
set commitCount=%%i
)
)
)
::
:: Get remote url repository
::
IF NOT %errlvl% == "1" (
set branch_remote=origin
:: Get remote name by current branch
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." config branch.!branch_name!.remote"') DO (
set branch_remote=%%i
)
:: Get remote url
FOR /F "tokens=2 delims=@" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: Get commit id
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." rev-parse --verify HEAD"') DO (
set shafull=%%i
set commitSHA=!shafull:~0,+7!
)
IF [!commitURL!] == [] (
FOR /F "tokens=1" %%i IN ('"git -C "%repodir%\." config remote.!branch_remote!.url"') DO (
set commitURL=%%i
)
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: append extra string
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=!commitURL!/commits/
) ELSE (
set commitURL=!commitURL!/commit/
)
) ELSE (
:: strip .git
if "x!commitURL:~-4!"=="x.git" (
set commitURL=!commitURL:~0,-4!
)
:: replace : to /
set commitURL=!commitURL::=/!
:: append extra string
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=https://!commitURL!/commits/
) ELSE (
set commitURL=https://!commitURL!/commit/
)
)
)
::
:: Detect local modifications
::
set localChanged=0
IF NOT %errlvl% == "1" (
FOR /F "tokens=*" %%i IN ('"git -C "%repodir%\." ls-files -m"') DO (
set localChanged=1
)
)
IF [%localChanged%]==[1] (
set version_modifed=+m
)
::
:: Now form full version string like 1.0.0.1
::
set new_version=%version_major%.%version_minor%.%version_maintenance%.%commitCount%-dev%version_modifed%
::
:: Update appversion.h if version has changed or modifications/mixed revisions detected
::
IF NOT "%new_version%"=="%old_version%" goto _update
goto _exit
:_update
echo Updating appversion.h, new version is "%new_version%", the old one was %old_version%
echo #ifndef __APPVERSION_H__>"%srcdir%\appversion.h"
echo #define __APPVERSION_H__>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo // >>"%srcdir%\appversion.h"
echo // This file is generated automatically.>>"%srcdir%\appversion.h"
echo // Don't edit it.>>"%srcdir%\appversion.h"
echo // >>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo // Version defines>>"%srcdir%\appversion.h"
echo #define APP_VERSION "%new_version%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_COMMIT_DATE "%month% %DD% %YYYY%">>"%srcdir%\appversion.h"
echo #define APP_COMMIT_TIME "%hour%:%min%:%sec%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #define APP_COMMIT_SHA "%commitSHA%">>"%srcdir%\appversion.h"
echo #define APP_COMMIT_URL "%commitURL%">>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
echo #endif //__APPVERSION_H__>>"%srcdir%\appversion.h"
echo.>>"%srcdir%\appversion.h"
::
:: Do update of version.cpp file last modify time to force it recompile
::
copy /b "%srcdir%\version.cpp"+,, "%srcdir%\version.cpp"
endlocal
:_exit
exit /B 0

View File

@ -48,7 +48,7 @@ char *System::GetBaseDir()
return COM_GetBaseDir();
}
void Sys_Printf(char *fmt, ...)
void Sys_Printf(const char *fmt, ...)
{
// Dump text to debugging console.
va_list argptr;
@ -151,49 +151,56 @@ bool System::RegisterCommand(char *name, ISystemModule *module, int commandID)
return true;
}
void System::ExecuteString(char *commands)
void System::ExecuteString(const char *commands)
{
if (!commands || !commands[0])
return;
int size = 0;
char singleCmd[256] = "";
bool quotes = false;
char *p = singleCmd;
char *c = commands;
// Remove format characters to block format string attacks
COM_RemoveEvilChars(const_cast<char *>(commands));
COM_RemoveEvilChars(c);
while (true)
{
*p = *c;
bool bInQuote = false;
if (++size >= sizeof(singleCmd))
char *pszDest;
char singleCmd[256] = {0};
const char *pszSource = commands;
while (*pszSource)
{
DPrintf("WARNING! System::ExecuteString: Command token too long.\n");
// Parse out single commands and execute them
pszDest = singleCmd;
unsigned int i;
for (i = 0; i < ARRAYSIZE(singleCmd); i++)
{
char c = *pszSource++;
*pszDest++ = c;
if (c == '"')
{
bInQuote = !bInQuote;
}
else if (c == ';' && !bInQuote)
{
// End of command and not in a quoted string
break;
}
if (*c == '"')
quotes = !quotes;
if ((*c != ';' || quotes) && *c)
{
++p;
}
else
{
*p = '\0';
char *cmd = singleCmd;
while (*cmd == ' ') { cmd++; }
DispatchCommand(cmd);
p = singleCmd;
size = 0;
}
if (!*c++)
break;
if (i >= ARRAYSIZE(singleCmd))
{
Printf("WARNING! System::ExecuteString: Command token too long.\n");
return;
}
*pszDest = '\0';
char *pszCmd = singleCmd;
while (*pszCmd == ' ')
pszCmd++; // skip leading whitespaces
DispatchCommand(pszCmd);
}
}
@ -887,7 +894,7 @@ void System::UpdateTime()
m_SystemTime = m_Counter.GetCurTime();
}
char *System::GetInput()
const char *System::GetInput()
{
return m_Console.GetLine();
}

View File

@ -57,7 +57,7 @@ public:
Panel *GetPanel();
bool RegisterCommand(char *name, ISystemModule *module, int commandID);
void GetCommandMatches(char *string, ObjectList *pMatchList);
void ExecuteString(char *commands);
void ExecuteString(const char *commands);
void ExecuteFile(char *filename);
void Errorf(char *fmt, ...);
char *CheckParam(char *param);
@ -102,7 +102,7 @@ protected:
bool DispatchCommand(char *command);
void ExecuteCommandLine();
void UpdateTime();
char *GetInput();
const char *GetInput();
bool StartVGUI();
void StopVGUI();
void SetName(char *newName);
@ -183,4 +183,4 @@ private:
extern System gSystem;
void Sys_Printf(char *fmt, ...);
void Sys_Printf(const char *fmt, ...);

View File

@ -0,0 +1,121 @@
cmake_minimum_required(VERSION 3.1)
project(core CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")
if (USE_CLANG_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
endif()
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
)
set(PROJECT_BZIP2_DIR
"${PROJECT_SOURCE_DIR}/../../../dep/bzip2/include"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../.."
"${PROJECT_SOURCE_DIR}/../../engine"
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../pm_shared"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(CORE_SRCS
"src/BSPModel.cpp"
"src/Delta.cpp"
"src/NetSocket.cpp"
"src/Network.cpp"
"src/Server.cpp"
"src/World.cpp"
"src/public_amalgamation.cpp"
)
set(COMMON_SRCS
"../../common/BaseSystemModule.cpp"
"../../common/ObjectDictionary.cpp"
"../../common/ObjectList.cpp"
"../../common/TokenLine.cpp"
"../../HLTV/common/BitBuffer.cpp"
"../../HLTV/common/byteorder.cpp"
"../../HLTV/common/common.cpp"
"../../HLTV/common/DemoFile.cpp"
"../../HLTV/common/DirectorCmd.cpp"
"../../HLTV/common/InfoString.cpp"
"../../HLTV/common/mathlib.cpp"
"../../HLTV/common/md5.cpp"
"../../HLTV/common/munge.cpp"
"../../HLTV/common/NetAddress.cpp"
"../../HLTV/common/NetChannel.cpp"
"../../HLTV/common/random.cpp"
"../../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_BZIP2_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-DHLTV
-DHLTV_FIXES
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
)
if (NOT TARGET bzip2)
add_subdirectory(../../../dep/bzip2 lib)
endif()
add_library(core SHARED ${CORE_SRCS} ${COMMON_SRCS})
target_link_libraries(core dl bzip2)
set_target_properties(core PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -39,16 +35,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -60,9 +46,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -71,9 +54,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -142,41 +122,6 @@
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;CORE_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\common\BaseSystemModule.cpp" />
<ClCompile Include="..\..\..\common\ObjectDictionary.cpp" />
@ -186,17 +131,14 @@
<ClCompile Include="..\..\..\hookers\HLTV\Core\DeltaEx.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Core\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Core\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp" />
<ClCompile Include="..\..\common\byteorder.cpp" />
@ -214,58 +156,44 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\Delta.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\NetSocket.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\Network.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
<ClCompile Include="..\src\Server.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="..\src\World.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">precompiled.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">precompiled.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -277,12 +205,10 @@
<ClInclude Include="..\..\..\hookers\HLTV\Core\DeltaEx.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\..\hookers\HLTV\Core\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BitBuffer.h" />
<ClInclude Include="..\..\common\byteorder.h" />

View File

@ -42,13 +42,13 @@ delta_t *Delta::m_CustomentityDelta = nullptr;
delta_description_t Delta::m_MetaDescription[] =
{
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} },
};
delta_t Delta::m_MetaDelta[] =
@ -453,7 +453,7 @@ void Delta::MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFie
st2 = (char *)&to[pTest->fieldOffset];
// Not sure why it is case insensitive, but it looks so
if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) {
if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) {
pTest->flags |= FDT_MARK;
}
break;
@ -972,7 +972,7 @@ int Delta::TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
st2 = (char *)&to[pTest->fieldOffset];
// Not sure why it is case insensitive, but it looks so
if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2)))
if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2))))
{
different = true;
length = Q_strlen(st2) * 8;

View File

@ -1208,11 +1208,12 @@ void World::ClearEntityCache()
{
if (m_DeltaCache)
{
for (int i = 0; i < m_MaxCacheIndex; i++) {
for (int i = 0; i < m_MaxCacheIndex; i++)
{
m_DeltaCache[i].seqNr = 0;
m_DeltaCache[i].deltaNr = 0;
m_DeltaCache[i].buffer.Free();
}
Q_memset(m_DeltaCache, 0, sizeof(deltaCache_t) * m_MaxCacheIndex);
}
if (m_FrameCache) {

View File

@ -0,0 +1,96 @@
cmake_minimum_required(VERSION 3.1)
project(demoplayer CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result -Wno-unknown-pragmas\
-Wno-sign-compare -Wno-write-strings -Wno-strict-aliasing")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../.."
"${PROJECT_SOURCE_DIR}/../../engine"
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../pm_shared"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(DEMOPLAYER_SRCS
"src/DemoPlayer.cpp"
"src/public_amalgamation.cpp"
)
set(COMMON_SRCS
"../../common/BaseSystemModule.cpp"
"../../common/ObjectDictionary.cpp"
"../../common/ObjectList.cpp"
"../../common/TokenLine.cpp"
"../../HLTV/common/BitBuffer.cpp"
"../../HLTV/common/byteorder.cpp"
"../../HLTV/common/common.cpp"
"../../HLTV/common/DirectorCmd.cpp"
"../../HLTV/common/mathlib.cpp"
"../../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-DHLTV
-DHLTV_FIXES
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
)
add_library(demoplayer SHARED ${DEMOPLAYER_SRCS} ${COMMON_SRCS})
target_link_libraries(demoplayer dl)
set_target_properties(demoplayer PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -22,12 +18,10 @@
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\..\hookers\HLTV\DemoPlayer\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\DemoPlayer\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp" />
@ -39,7 +33,6 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
</ItemGroup>
@ -51,7 +44,6 @@
<ClInclude Include="..\..\..\engine\mem.h" />
<ClInclude Include="..\..\..\hookers\HLTV\DemoPlayer\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BitBuffer.h" />
@ -88,16 +80,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -109,9 +91,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -119,9 +98,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -184,40 +160,6 @@
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HOOK_HLTV;HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DEMOPLAYER_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitiHOOons)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<FullProgramDatabaseFile>false</FullProgramDatabaseFile>
</Link>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -0,0 +1,103 @@
cmake_minimum_required(VERSION 3.1)
project(director CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result -Wno-unknown-pragmas\
-Wno-write-strings -Wno-strict-aliasing")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../.."
"${PROJECT_SOURCE_DIR}/../../engine"
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../pm_shared"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(DIRECTOR_SRCS
"src/Director.cpp"
"src/public_amalgamation.cpp"
)
set(COMMON_SRCS
"../../common/BaseSystemModule.cpp"
"../../common/ObjectDictionary.cpp"
"../../common/ObjectList.cpp"
"../../common/TokenLine.cpp"
"../../HLTV/common/BitBuffer.cpp"
"../../HLTV/common/byteorder.cpp"
"../../HLTV/common/common.cpp"
"../../HLTV/common/DirectorCmd.cpp"
"../../HLTV/common/mathlib.cpp"
"../../HLTV/common/random.cpp"
"../../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-DHLTV
-DHLTV_FIXES
-DDIRECTOR_MODULE
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
)
if (NOT TARGET appversion)
add_custom_target(appversion DEPENDS COMMAND "${PROJECT_SOURCE_DIR}/../../version/appversion.sh" "${PROJECT_SOURCE_DIR}/../..")
endif()
add_library(director SHARED ${appversion.sh} ${DIRECTOR_SRCS} ${COMMON_SRCS})
target_link_libraries(director dl)
set_target_properties(director PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
add_dependencies(director appversion)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -39,16 +35,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -60,9 +46,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -70,9 +53,6 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -135,39 +115,6 @@
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;DIRECTOR_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\..\;$(ProjectDir)\..\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\..\common\BaseSystemModule.cpp" />
<ClCompile Include="..\..\..\common\ObjectDictionary.cpp" />
@ -184,7 +131,6 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
</ItemGroup>

View File

@ -0,0 +1,126 @@
cmake_minimum_required(VERSION 3.1)
project(proxy CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result -Wno-unknown-pragmas -Wno-unused-variable\
-Wno-write-strings -Wno-strict-aliasing")
if (USE_CLANG_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
endif()
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
"${PROJECT_SOURCE_DIR}/../Director/src"
)
set(PROJECT_BZIP2_DIR
"${PROJECT_SOURCE_DIR}/../../../dep/bzip2/include"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../.."
"${PROJECT_SOURCE_DIR}/../../engine"
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../pm_shared"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(PROXY_SRCS
"src/Proxy.cpp"
"src/Status.cpp"
"src/Master.cpp"
"src/ProxyClient.cpp"
"src/DemoClient.cpp"
"src/FakeClient.cpp"
"src/public_amalgamation.cpp"
"../Director/src/Director.cpp"
)
set(COMMON_SRCS
"../../common/BaseSystemModule.cpp"
"../../common/ObjectDictionary.cpp"
"../../common/ObjectList.cpp"
"../../common/TokenLine.cpp"
"../../HLTV/common/BaseClient.cpp"
"../../HLTV/common/BitBuffer.cpp"
"../../HLTV/common/byteorder.cpp"
"../../HLTV/common/common.cpp"
"../../HLTV/common/DemoFile.cpp"
"../../HLTV/common/DirectorCmd.cpp"
"../../HLTV/common/InfoString.cpp"
"../../HLTV/common/mathlib.cpp"
"../../HLTV/common/md5.cpp"
"../../HLTV/common/munge.cpp"
"../../HLTV/common/NetAddress.cpp"
"../../HLTV/common/NetChannel.cpp"
"../../HLTV/common/random.cpp"
"../../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_BZIP2_DIR}
${PROJECT_PUBLIC_DIR}
)
link_directories(${PROJECT_SOURCE_DIR}/../../lib/linux32)
add_definitions(
-DHLTV
-DHLTV_FIXES
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
)
if (NOT TARGET bzip2)
add_subdirectory(../../../dep/bzip2 lib)
endif()
add_library(proxy SHARED ${PROXY_SRCS} ${COMMON_SRCS})
target_link_libraries(proxy dl bzip2 steam_api)
set_target_properties(proxy PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -20,264 +16,195 @@
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectDictionary.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\ObjectList.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\common\TokenLine.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\engine\mem.cpp" />
<ClCompile Include="..\..\..\hookers\HLTV\Proxy\hooklist.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\hookers\HLTV\Proxy\main.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BaseClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\BitBuffer.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\byteorder.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\common.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\DemoFile.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\DirectorCmd.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\InfoString.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\mathlib.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\md5.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\munge.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\NetAddress.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\NetChannel.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\random.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\Director\src\Director.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\DemoClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\FakeClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\Master.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\Proxy.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\ProxyClient.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\Status.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Use</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -289,7 +216,6 @@
<ClInclude Include="..\..\..\hookers\HLTV\Proxy\hooklist.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\BaseClient.h" />
<ClInclude Include="..\..\common\BitBuffer.h" />
@ -344,16 +270,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -365,9 +281,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -377,10 +290,6 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>proxy</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>proxy</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -456,49 +365,6 @@
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>HLTV;WIN32;NDEBUG;_WINDOWS;_USRDLL;PROXY_MODULE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)\..\src;$(ProjectDir)\..\..\;$(ProjectDir)\..\..\..\;$(ProjectDir)\..\..\Director\src;$(ProjectDir)\..\..\..\common;$(ProjectDir)\..\..\..\engine;$(ProjectDir)\..\..\..\public;$(ProjectDir)\..\..\..\public\rehlds;$(ProjectDir)\..\..\..\pm_shared;$(ProjectDir)\..\..\..\..\dep\bzip2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>psapi.lib;ws2_32.lib;steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(ProjectDir)../../../lib</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>
</Message>
</PreBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -210,7 +210,13 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name)
Q_memset(m_LastRconCommand, 0, sizeof(m_LastRconCommand));
Q_memset(m_OffLineText, 0, sizeof(m_OffLineText));
Q_memset(m_SignonCommands, 0, sizeof(m_SignonCommands));
Q_memset(m_Challenges, 0, sizeof(m_Challenges));
for (int i = 0; i < MAX_CHALLENGES; i++)
{
m_Challenges[i].adr.Clear();
m_Challenges[i].challenge = 0;
m_Challenges[i].time = 0.0f;
}
m_LoopCommands.Init();
m_BannList.Init();
@ -836,10 +842,10 @@ void Proxy::Broadcast(byte *data, int length, int groupType, bool isReliable)
while (client)
{
if (client->IsActive()
&& ((groupType & GROUP_CLIENT) && client->GetClientType() == TYPE_CLIENT)
&& (((groupType & GROUP_CLIENT) && client->GetClientType() == TYPE_CLIENT)
|| ((groupType & GROUP_PROXY) && client->GetClientType() == TYPE_PROXY)
|| ((groupType & GROUP_VOICE) && client->IsHearingVoices())
|| ((groupType & GROUP_CHAT) && client->HasChatEnabled()))
|| ((groupType & GROUP_CHAT) && client->HasChatEnabled())))
{
client->Send(data, length, isReliable);
}
@ -966,7 +972,7 @@ void Proxy::CMD_Name(char *cmdLine)
}
char name[MAX_NAME];
int len = Q_strlen(params.GetToken(1));
unsigned int len = Q_strlen(params.GetToken(1));
if (len > sizeof(name) - 1) {
m_System->Printf("Invalid name length.\n");
return;

View File

@ -67,15 +67,15 @@ const uint32 INVBITTABLE[] =
0xFFFFFFFF,
};
BitBuffer::BitBuffer() : m_Data(nullptr),
BitBuffer::BitBuffer() :
m_Overflowed(false),
m_Data(nullptr),
m_CurByte(nullptr),
m_CurBit(0),
m_MaxSize(0),
m_Overflowed(false),
m_LittleEndian(false),
m_OwnData(false)
{
;
}
BitBuffer::BitBuffer(void *newData, unsigned int size)
@ -345,7 +345,8 @@ void BitBuffer::WriteBuf(BitBuffer *buf, int length)
char *BitBuffer::ReadString()
{
int c = 0, l = 0;
int c = 0;
unsigned int l = 0;
static char string[8192];
while ((c = ReadChar(), c) && c != -1 && l < sizeof(string) - 1) {
@ -358,7 +359,8 @@ char *BitBuffer::ReadString()
char *BitBuffer::ReadStringLine()
{
int c = 0, l = 0;
int c = 0;
unsigned int l = 0;
static char string[2048];
while ((c = ReadChar(), c) && c != '\n' && c != -1 && l < sizeof(string) - 1) {

View File

@ -29,10 +29,10 @@
#include "precompiled.h"
DemoFile::DemoFile() :
m_FileSystem(nullptr),
m_FileHandle(FILESYSTEM_INVALID_HANDLE),
m_DemoChannel(nullptr),
m_Entries(nullptr)
m_Entries(nullptr),
m_FileSystem(nullptr)
{
Reset();
}
@ -545,6 +545,8 @@ void DemoFile::ReadDemoPacket(BitBuffer *demoData, demo_info_t *demoInfo)
case DemoCmd::PayLoad:
demoData->WriteLong(msglen);
break;
default:
break;
}
demoData->WriteBuf(msgbuf, msglen);

View File

@ -28,8 +28,9 @@
#include "precompiled.h"
InfoString::InfoString(char *string, unsigned int maxSize)
: m_String(nullptr), m_MaxSize(0)
InfoString::InfoString(char *string, unsigned int maxSize) :
m_MaxSize(0),
m_String(nullptr)
{
unsigned int len = Q_strlen(string) + 1;
if (len < maxSize) {
@ -40,19 +41,22 @@ InfoString::InfoString(char *string, unsigned int maxSize)
SetString(string);
}
InfoString::InfoString()
: m_String(nullptr), m_MaxSize(0)
InfoString::InfoString() :
m_MaxSize(0),
m_String(nullptr)
{
}
InfoString::InfoString(unsigned int maxSize)
: m_String(nullptr), m_MaxSize(0)
InfoString::InfoString(unsigned int maxSize) :
m_MaxSize(0),
m_String(nullptr)
{
SetMaxSize(maxSize);
}
InfoString::InfoString(char *string)
: m_String(nullptr), m_MaxSize(0)
InfoString::InfoString(char *string) :
m_MaxSize(0),
m_String(nullptr)
{
unsigned int len = Q_strlen(string) + 1;
if (len < MAX_INFO_LEN) {

View File

@ -28,9 +28,11 @@
#include "precompiled.h"
NetAddress::NetAddress() :
m_Port(0), m_IP(), m_String()
NetAddress::NetAddress()
{
m_Port = 0;
Q_memset(m_IP, 0, sizeof(m_IP));
Q_memset(m_String, 0, sizeof(m_String));
}
void NetAddress::SetPort(int16 port)

View File

@ -220,7 +220,7 @@ char *COM_FileExtension(char *in)
#else // #ifdef HLTV_FIXES
static char exten[MAX_PATH];
char *c, *d = nullptr;
int i;
unsigned int i;
// Search for the first dot after the last path separator
c = in;
@ -537,7 +537,7 @@ void NORETURN HLTV_SysError(const char *fmt, ...)
fprintf(fl, "%s\n", string);
fclose(fl);
int *null = 0;
volatile int *null = 0;
*null = 0;
exit(-1);
}

View File

@ -74,7 +74,7 @@ public:
virtual bool RegisterCommand(char *name, ISystemModule *module, int commandID) = 0;
virtual void GetCommandMatches(char *string, ObjectList *pMatchList) = 0;
virtual void ExecuteString(char *commands) = 0;
virtual void ExecuteString(const char *commands) = 0;
virtual void ExecuteFile(char *filename) = 0;
virtual void Errorf(char *fmt, ...) = 0;

View File

@ -133,7 +133,7 @@ int CTextConsoleUnix::kbhit()
return select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv) != -1 && FD_ISSET(STDIN_FILENO, &rfds);
}
char *CTextConsoleUnix::GetLine()
const char *CTextConsoleUnix::GetLine()
{
// early return for 99.999% case :)
if (!kbhit())
@ -273,7 +273,7 @@ char *CTextConsoleUnix::GetLine()
return NULL;
}
void CTextConsoleUnix::PrintRaw(char *pszMsg, int nChars)
void CTextConsoleUnix::PrintRaw(const char *pszMsg, int nChars)
{
if (nChars == 0)
{
@ -288,7 +288,7 @@ void CTextConsoleUnix::PrintRaw(char *pszMsg, int nChars)
}
}
void CTextConsoleUnix::Echo(char *pszMsg, int nChars)
void CTextConsoleUnix::Echo(const char *pszMsg, int nChars)
{
if (nChars == 0)
{

View File

@ -44,9 +44,9 @@ public:
bool Init(IBaseSystem *system = nullptr);
void ShutDown();
void PrintRaw(char *pszMsg, int nChars = 0);
void Echo(char *pszMsg, int nChars = 0);
char *GetLine();
void PrintRaw(const char *pszMsg, int nChars = 0);
void Echo(const char *pszMsg, int nChars = 0);
const char *GetLine();
int GetWidth();
private:

View File

@ -111,7 +111,7 @@ void CTextConsoleWin32::SetVisible(bool visible)
m_ConsoleVisible = visible;
}
char *CTextConsoleWin32::GetLine()
const char *CTextConsoleWin32::GetLine()
{
while (true)
{
@ -203,7 +203,7 @@ char *CTextConsoleWin32::GetLine()
return nullptr;
}
void CTextConsoleWin32::PrintRaw(char *pszMsg, int nChars)
void CTextConsoleWin32::PrintRaw(const char *pszMsg, int nChars)
{
#ifdef LAUNCHER_FIXES
char outputStr[2048];
@ -225,7 +225,7 @@ void CTextConsoleWin32::PrintRaw(char *pszMsg, int nChars)
#endif
}
void CTextConsoleWin32::Echo(char *pszMsg, int nChars)
void CTextConsoleWin32::Echo(const char *pszMsg, int nChars)
{
PrintRaw(pszMsg, nChars);
}
@ -245,7 +245,7 @@ int CTextConsoleWin32::GetWidth()
return nWidth;
}
void CTextConsoleWin32::SetStatusLine(char *pszStatus)
void CTextConsoleWin32::SetStatusLine(const char *pszStatus)
{
Q_strncpy(statusline, pszStatus, sizeof(statusline) - 1);
statusline[sizeof(statusline) - 2] = '\0';
@ -269,7 +269,7 @@ void CTextConsoleWin32::UpdateStatus()
WriteConsoleOutputCharacter(houtput, statusline, 80, coord, &dwWritten);
}
void CTextConsoleWin32::SetTitle(char *pszTitle)
void CTextConsoleWin32::SetTitle(const char *pszTitle)
{
SetConsoleTitle(pszTitle);
}

View File

@ -39,13 +39,13 @@ public:
bool Init(IBaseSystem *system = nullptr);
void ShutDown();
void SetTitle(char *pszTitle);
void SetStatusLine(char *pszStatus);
void SetTitle(const char *pszTitle);
void SetStatusLine(const char *pszStatus);
void UpdateStatus();
void PrintRaw(char * pszMsz, int nChars = 0);
void Echo(char * pszMsz, int nChars = 0);
char *GetLine();
void PrintRaw(const char *pszMsz, int nChars = 0);
void Echo(const char *pszMsz, int nChars = 0);
const char *GetLine();
int GetWidth();
void SetVisible(bool visible);

View File

@ -61,7 +61,6 @@ char *CopyString(const char *src)
void CCommandLine::CreateCmdLine(int argc, const char *argv[])
{
char cmdline[4096] = "";
const int MAX_CHARS = sizeof(cmdline) - 1;
for (int i = 0; i < argc; ++i)
{
@ -88,7 +87,10 @@ void CCommandLine::LoadParametersFromFile(const char *&pSrc, char *&pDst, int ma
// Suck out the file name
char szFileName[ MAX_PATH ];
char *pOut;
#if 0
char *pDestStart = pDst;
#endif
// Skip the @ sign
pSrc++;
@ -342,7 +344,7 @@ const char *CCommandLine::CheckParm(const char *psz, char **ppszValue) const
sz[i] = p2[i];
i++;
} while (i < sizeof(sz));
} while ((unsigned)i < sizeof(sz));
sz[i] = '\0';
*ppszValue = sz;

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#if !defined(_WIN32)
#if !defined(_WIN32) && !defined(BUILD_STATIC_LIBSTDC) // if build with static libstdc++ then ignore
void NORETURN Sys_Error(const char *error, ...);
// This file adds the necessary compatibility tricks to avoid symbols with

View File

@ -74,7 +74,7 @@ void CTextConsole::ShutDown()
;
}
void CTextConsole::Print(char *pszMsg)
void CTextConsole::Print(const char *pszMsg)
{
if (m_nConsoleTextLen)
{
@ -264,7 +264,7 @@ void CTextConsole::ReceiveStandardChar(const char ch)
int nCount;
// If the line buffer is maxed out, ignore this char
if (m_nConsoleTextLen >= (sizeof(m_szConsoleText) - 2))
if ((unsigned)m_nConsoleTextLen >= (sizeof(m_szConsoleText) - 2))
{
return;
}

View File

@ -39,16 +39,16 @@ public:
virtual bool Init(IBaseSystem *system = nullptr);
virtual void ShutDown();
virtual void Print(char *pszMsg);
virtual void Print(const char *pszMsg);
virtual void SetTitle(char *pszTitle) {}
virtual void SetStatusLine(char *pszStatus) {}
virtual void SetTitle(const char *pszTitle) {}
virtual void SetStatusLine(const char *pszStatus) {}
virtual void UpdateStatus() {}
// Must be provided by children
virtual void PrintRaw(char *pszMsg, int nChars = 0) = 0;
virtual void Echo(char *pszMsg, int nChars = 0) = 0;
virtual char *GetLine() = 0;
virtual void PrintRaw(const char *pszMsg, int nChars = 0) = 0;
virtual void Echo(const char *pszMsg, int nChars = 0) = 0;
virtual const char *GetLine() = 0;
virtual int GetWidth() = 0;
virtual void SetVisible(bool visible);
@ -92,4 +92,4 @@ protected:
#include "TextConsoleUnix.h"
#endif // defined(_WIN32)
void Sys_Printf(char *fmt, ...);
void Sys_Printf(const char *fmt, ...);

View File

@ -0,0 +1,95 @@
cmake_minimum_required(VERSION 3.1)
project(hlds CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-intel -no-intel-extensions")
if (NOT DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -ipo")
endif()
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3 -flto\
-fpermissive\
-Wno-unused-result")
endif()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../"
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../engine"
"${PROJECT_SOURCE_DIR}/../common"
"${PROJECT_SOURCE_DIR}/../public"
"${PROJECT_SOURCE_DIR}/../public/rehlds"
)
set(DEDICATED_SRCS
"src/dbg.cpp"
"src/dedicated_exports.cpp"
"src/public_amalgamation.cpp"
"src/sys_ded.cpp"
"src/sys_linux.cpp"
"src/vgui/vguihelpers.cpp"
)
set(COMMON_SRCS
"../common/textconsole.cpp"
"../common/TextConsoleUnix.cpp"
"../common/SteamAppStartUp.cpp"
"../common/ObjectList.cpp"
"../common/commandline.cpp"
"../common/minidump.cpp"
"../engine/mem.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-DLAUNCHER_FIXES
-D_CONSOLE
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_strdup=strdup
-D_vsnprintf=vsnprintf
)
add_executable(hlds ${DEDICATED_SRCS} ${COMMON_SRCS})
target_link_libraries(hlds dl)
set_target_properties(hlds PROPERTIES OUTPUT_NAME hlds_linux PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)

View File

@ -5,10 +5,6 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release Swds|Win32">
<Configuration>Release Swds</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -40,16 +36,6 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
@ -59,9 +45,6 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
@ -71,10 +54,6 @@
<LinkIncremental>false</LinkIncremental>
<TargetName>hlds</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>hlds</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -155,51 +134,6 @@
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;LAUNCHER_FIXES;NDEBUG;DEDICATED;_CRT_SECURE_NO_WARNINGS;USE_BREAKPAD_HANDLER;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\src;$(ProjectDir)..\..\;$(ProjectDir)..\..\common;$(ProjectDir)..\..\engine;$(ProjectDir)..\..\public;$(ProjectDir)..\..\public\rehlds;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
<FloatingPointModel>
</FloatingPointModel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<OmitFramePointers>true</OmitFramePointers>
<StringPooling>true</StringPooling>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>IF EXIST "$(ProjectDir)PreBuild.bat" (CALL "$(ProjectDir)PreBuild.bat" "$(ProjectDir)..\version\" "$(ProjectDir)..\")</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Setup version from Git revision</Message>
</PreBuildEvent>
<PostBuildEvent>
<Command>IF EXIST "$(ProjectDir)PostBuild.bat" (CALL "$(ProjectDir)PostBuild.bat" "$(TargetDir)" "$(TargetName)" "$(TargetExt)" "$(ProjectDir)")</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Automatic deployment script</Message>
</PostBuildEvent>
<CustomBuildStep>
<Command>echo Empty Action</Command>
<Message>Force build to run Pre-Build event</Message>
<Outputs>build.always.run</Outputs>
<Inputs>build.always.run</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\common\minidump.h" />
<ClInclude Include="..\..\common\ObjectList.h" />
@ -208,7 +142,6 @@
<ClInclude Include="..\..\common\TextConsoleUnix.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\..\common\TextConsoleWin32.h" />
<ClInclude Include="..\src\conproc.h" />
@ -230,7 +163,6 @@
<ClCompile Include="..\..\common\TextConsoleUnix.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\common\TextConsoleWin32.cpp" />
<ClCompile Include="..\..\engine\mem.cpp" />
@ -239,14 +171,12 @@
<ClCompile Include="..\src\precompiled.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="..\src\public_amalgamation.cpp" />
<ClCompile Include="..\src\sys_ded.cpp" />
<ClCompile Include="..\src\sys_linux.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Swds|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\src\sys_window.cpp" />
<ClCompile Include="..\src\vgui\vguihelpers.cpp" />

View File

@ -30,12 +30,12 @@
class CDedicatedExports: public IDedicatedExports {
public:
EXT_FUNC void Sys_Printf(char *text);
EXT_FUNC void Sys_Printf(const char *text);
};
EXPOSE_SINGLE_INTERFACE(CDedicatedExports, IDedicatedExports, VENGINE_DEDICATEDEXPORTS_API_VERSION);
void CDedicatedExports::Sys_Printf(char *text)
void CDedicatedExports::Sys_Printf(const char *text)
{
::Sys_Printf_Safe(text);
}

View File

@ -36,18 +36,18 @@ public:
virtual bool GetExecutableName(char *out) = 0;
virtual void ErrorMessage(int level, const char *msg) = 0;
virtual void WriteStatusText(char *szText) = 0;
virtual void WriteStatusText(const char *szText) = 0;
virtual void UpdateStatus(int force) = 0;
virtual long LoadLibrary(char *lib) = 0;
virtual long LoadLibrary(const char *lib) = 0;
virtual void FreeLibrary(long library) = 0;
virtual bool CreateConsoleWindow(void) = 0;
virtual void DestroyConsoleWindow(void) = 0;
virtual void ConsoleOutput(char *string) = 0;
virtual char *ConsoleInput(void) = 0;
virtual void Printf(char *fmt, ...) = 0;
virtual void ConsoleOutput(const char *string) = 0;
virtual const char *ConsoleInput(void) = 0;
virtual void Printf(const char *fmt, ...) = 0;
};
extern ISys *sys;

View File

@ -40,7 +40,7 @@ CSysModule *g_pFileSystemModule = nullptr;
CreateInterfaceFn g_FilesystemFactoryFn;
void Sys_Printf_Safe(char *text)
void Sys_Printf_Safe(const char *text)
{
if (sys)
{
@ -48,7 +48,7 @@ void Sys_Printf_Safe(char *text)
}
}
void Sys_Printf(char *fmt, ...)
void Sys_Printf(const char *fmt, ...)
{
// Dump text to debugging console.
va_list argptr;
@ -76,7 +76,7 @@ void ProcessConsoleInput()
if (!engineAPI)
return;
char *inputLine = console.GetLine();
const char *inputLine = console.GetLine();
if (inputLine)
{
char szBuf[256];
@ -85,7 +85,7 @@ void ProcessConsoleInput()
}
}
char *UTIL_GetBaseDir()
const char *UTIL_GetBaseDir()
{
return ".";
}

View File

@ -38,5 +38,5 @@ extern CreateInterfaceFn g_FilesystemFactoryFn;
int RunEngine();
int StartServer(char* cmdline);
void Sys_Printf_Safe(char *text);
void Sys_Printf(char *fmt, ...);
void Sys_Printf_Safe(const char *text);
void Sys_Printf(const char *fmt, ...);

View File

@ -37,18 +37,18 @@ public:
bool GetExecutableName(char *out) override;
NORETURN void ErrorMessage(int level, const char *msg) override;
void WriteStatusText(char *szText) override;
void WriteStatusText(const char *szText) override;
void UpdateStatus(int force) override;
long LoadLibrary(char *lib) override;
long LoadLibrary(const char *lib) override;
void FreeLibrary(long library) override;
bool CreateConsoleWindow() override;
void DestroyConsoleWindow() override;
void ConsoleOutput(char *string) override;
char *ConsoleInput() override;
void Printf(char *fmt, ...) override;
void ConsoleOutput(const char *string) override;
const char *ConsoleInput() override;
void Printf(const char *fmt, ...) override;
};
CSys g_Sys;
@ -206,7 +206,7 @@ void CSys::ErrorMessage(int level, const char *msg)
exit(-1);
}
void CSys::WriteStatusText(char *szText)
void CSys::WriteStatusText(const char *szText)
{
}
@ -214,7 +214,7 @@ void CSys::UpdateStatus(int force)
{
}
long CSys::LoadLibrary(char *lib)
long CSys::LoadLibrary(const char *lib)
{
char cwd[1024];
char absolute_lib[1024];
@ -258,18 +258,18 @@ void CSys::DestroyConsoleWindow()
}
// Print text to the dedicated console
void CSys::ConsoleOutput(char *string)
void CSys::ConsoleOutput(const char *string)
{
printf("%s", string);
fflush(stdout);
}
char *CSys::ConsoleInput()
const char *CSys::ConsoleInput()
{
return console.GetLine();
}
void CSys::Printf(char *fmt, ...)
void CSys::Printf(const char *fmt, ...)
{
// Dump text to debugging console.
va_list argptr;

View File

@ -37,18 +37,18 @@ public:
bool GetExecutableName(char *out) override;
void ErrorMessage(int level, const char *msg) override;
void WriteStatusText(char *szText) override;
void WriteStatusText(const char *szText) override;
void UpdateStatus(int force) override;
long LoadLibrary(char *lib) override;
long LoadLibrary(const char *lib) override;
void FreeLibrary(long library) override;
bool CreateConsoleWindow() override;
void DestroyConsoleWindow() override;
void ConsoleOutput(char *string) override;
char *ConsoleInput() override;
void Printf(char *fmt, ...) override;
void ConsoleOutput(const char *string) override;
const char *ConsoleInput() override;
void Printf(const char *fmt, ...) override;
};
CSys g_Sys;
@ -93,7 +93,7 @@ void CSys::ErrorMessage(int level, const char *msg)
PostQuitMessage(0);
}
void CSys::WriteStatusText(char *szText)
void CSys::WriteStatusText(const char *szText)
{
SetConsoleTitle(szText);
}
@ -125,7 +125,7 @@ void CSys::UpdateStatus(int force)
console.UpdateStatus();
}
long CSys::LoadLibrary(char *lib)
long CSys::LoadLibrary(const char *lib)
{
void *hDll = ::LoadLibrary(lib);
return (long)hDll;
@ -160,7 +160,7 @@ void CSys::DestroyConsoleWindow()
DeinitConProc();
}
void CSys::ConsoleOutput(char *string)
void CSys::ConsoleOutput(const char *string)
{
if (g_bVGui)
{
@ -172,12 +172,12 @@ void CSys::ConsoleOutput(char *string)
}
}
char *CSys::ConsoleInput()
const char *CSys::ConsoleInput()
{
return console.GetLine();
}
void CSys::Printf(char *fmt, ...)
void CSys::Printf(const char *fmt, ...)
{
// Dump text to debugging console.
va_list argptr;

View File

@ -54,7 +54,7 @@ BOOL SystemWrapper_LoadModule(char *interfacename, char *library, char *instance
return FALSE;
}
void SystemWrapper_ExecuteString(char *command)
void SystemWrapper_ExecuteString(const char *command)
{
gSystemWrapper.ExecuteString(command);
}
@ -234,7 +234,7 @@ void SystemWrapper::CMD_UnloadModule(char *cmdLine)
SystemWrapper::library_t *SystemWrapper::GetLibrary(char *name)
{
char fixedname[MAX_PATH];
char fixedname[MAX_PATH-4]; // reserve for extension so/dll
Q_strlcpy(fixedname, name);
COM_FixSlashes(fixedname);
@ -550,49 +550,56 @@ bool SystemWrapper::RemoveModule(ISystemModule *module)
return false;
}
void SystemWrapper::ExecuteString(char *commands)
void SystemWrapper::ExecuteString(const char *commands)
{
if (!commands || !commands[0])
return;
int size = 0;
char singleCmd[256] = "";
bool quotes = false;
char *p = singleCmd;
char *c = commands;
// Remove format characters to block format string attacks
COM_RemoveEvilChars(const_cast<char *>(commands));
COM_RemoveEvilChars(c);
while (true)
{
*p = *c;
bool bInQuote = false;
if (++size >= sizeof(singleCmd))
char *pszDest;
char singleCmd[256] = {0};
const char *pszSource = commands;
while (*pszSource)
{
DPrintf("WARNING! System::ExecuteString: Command token too long.\n");
// Parse out single commands and execute them
pszDest = singleCmd;
unsigned int i;
for (i = 0; i < ARRAYSIZE(singleCmd); i++)
{
char c = *pszSource++;
*pszDest++ = c;
if (c == '"')
{
bInQuote = !bInQuote;
}
else if (c == ';' && !bInQuote)
{
// End of command and not in a quoted string
break;
}
if (*c == '"')
quotes = !quotes;
if ((*c != ';' || quotes) && *c)
{
++p;
}
else
{
*p = '\0';
char *cmd = singleCmd;
while (*cmd == ' ') { cmd++; }
DispatchCommand(cmd);
p = singleCmd;
size = 0;
}
if (!*c++)
break;
if (i >= ARRAYSIZE(singleCmd))
{
Printf("WARNING! System::ExecuteString: Command token too long.\n");
return;
}
*pszDest = '\0';
char *pszCmd = singleCmd;
while (*pszCmd == ' ')
pszCmd++; // skip leading whitespaces
DispatchCommand(pszCmd);
}
}
@ -699,7 +706,7 @@ void EngineWrapper::DemoUpdateClientData(client_data_t *cdat)
void EngineWrapper::CL_QueueEvent(int flags, int index, float delay, event_args_t *pargs)
{
#ifndef SWDS
CL_QueueEvent(flags, index, delay, pargs);
::CL_QueueEvent(flags, index, delay, pargs);
#endif // SWDS
}
@ -713,14 +720,14 @@ void EngineWrapper::HudWeaponAnim(int iAnim, int body)
void EngineWrapper::CL_DemoPlaySound(int channel, char *sample, float attenuation, float volume, int flags, int pitch)
{
#ifndef SWDS
CL_DemoPlaySound(channel, sample, attenuation, volume, flags, pitch);
::CL_DemoPlaySound(channel, sample, attenuation, volume, flags, pitch);
#endif // SWDS
}
void EngineWrapper::ClientDLL_ReadDemoBuffer(int size, unsigned char *buffer)
{
#ifndef SWDS
ClientDLL_ReadDemoBuffer();
::ClientDLL_ReadDemoBuffer();
#endif // SWDS
}
@ -741,7 +748,7 @@ char *EngineWrapper::GetStatusLine()
void EngineWrapper::Cbuf_AddText(char *text)
{
Cbuf_AddText(text);
::Cbuf_AddText(text);
}
#ifdef REHLDS_FIXES

View File

@ -93,7 +93,7 @@ public:
EXT_FUNC Panel *GetPanel();
EXT_FUNC bool RegisterCommand(char *name, ISystemModule *module, int commandID);
EXT_FUNC void GetCommandMatches(char *string, ObjectList *pMatchList);
EXT_FUNC void ExecuteString(char *commands);
EXT_FUNC void ExecuteString(const char *commands);
EXT_FUNC void ExecuteFile(char *filename);
EXT_FUNC void Errorf(char *fmt, ...);
EXT_FUNC char *CheckParam(char *param);
@ -146,7 +146,7 @@ void SystemWrapper_Init();
void SystemWrapper_ShutDown();
void SystemWrapper_RunFrame(double time);
BOOL SystemWrapper_LoadModule(char *interfacename, char *library, char *instancename = nullptr);
void SystemWrapper_ExecuteString(char *command);
void SystemWrapper_ExecuteString(const char *command);
void SystemWrapper_CommandForwarder();
int COM_BuildNumber();

View File

@ -2393,7 +2393,7 @@ void EXT_FUNC COM_GetGameDir(char *szGameDir)
{
if (szGameDir)
{
Q_snprintf(szGameDir, MAX_PATH - 1 , "%s", com_gamedir);
Q_snprintf(szGameDir, MAX_PATH, "%s", com_gamedir);
}
}

View File

@ -430,11 +430,9 @@ NOXREF void Cvar_RemoveHudCvars(void)
const char *Cvar_IsMultipleTokens(const char *varname)
{
static char firstToken[516];
int tokens;
char *name;
firstToken[0] = 0;
tokens = 0;
name = (char *)varname;
name = COM_Parse(name);

View File

@ -538,15 +538,17 @@ void Decal_Init(void)
for (i = 0; i < ARRAYSIZE(pszPathID); i++)
{
hfile = FS_OpenPathID("decals.wad", "rb", pszPathID[i]);
#ifdef REHLDS_FIXES
if (!hfile)
{
#ifdef REHLDS_FIXES
if (found || i < ARRAYSIZE(pszPathID) - 1)
continue;
else
#else
if (i == 0 && !hfile)
if (i == 0)
#endif
Sys_Error("%s: Couldn't find '%s' in \"%s\" search path\n", __func__, "decals.wad", pszPathID[i]);
}
#ifdef REHLDS_FIXES
found = true;

View File

@ -82,13 +82,13 @@ static delta_definition_t g_DeltaDataDefinition[] =
static delta_description_t g_MetaDescription[] =
{
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} },
};
delta_t g_MetaDelta[] =
@ -463,7 +463,7 @@ int DELTA_TestDelta(unsigned char *from, unsigned char *to, delta_t *pFields)
case DT_STRING:
st1 = (char*)&from[pTest->fieldOffset];
st2 = (char*)&to[pTest->fieldOffset];
if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) // Not sure why it is case insensitive, but it looks so
if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) // Not sure why it is case insensitive, but it looks so
{
#ifndef REHLDS_FIXES
pTest->flags |= FDT_MARK;
@ -558,7 +558,7 @@ void DELTA_MarkSendFields(unsigned char *from, unsigned char *to, delta_t *pFiel
case DT_STRING:
st1 = (char*)&from[pTest->fieldOffset];
st2 = (char*)&to[pTest->fieldOffset];
if (!(!*st1 && !*st2 || *st1 && *st2 && !Q_stricmp(st1, st2))) // Not sure why it is case insensitive, but it looks so
if (!((!*st1 && !*st2) || (*st1 && *st2 && !Q_stricmp(st1, st2)))) // Not sure why it is case insensitive, but it looks so
pTest->flags |= FDT_MARK;
break;
default:
@ -1239,7 +1239,7 @@ qboolean DELTA_ParseField(int count, delta_definition_t *pdefinition, delta_link
Sys_Error("%s: Expecting fieldname\n", __func__);
}
Q_strncpy(pField->delta->fieldName, com_token, 31);
Q_strlcpy(pField->delta->fieldName, com_token);
pField->delta->fieldName[31] = 0;
pField->delta->fieldOffset = DELTA_FindOffset(count, pdefinition, com_token);
@ -1454,8 +1454,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
}
if (Q_stricmp(com_token, "none"))
{
Q_strncpy(source, com_token, sizeof(source)-1);
source[sizeof(source)-1] = 0;
Q_strlcpy(source, com_token);
// Parse custom encoder function name
pstream = COM_Parse(pstream);
@ -1464,8 +1463,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
Sys_Error("%s: Expecting encoder\n", __func__);
}
Q_strncpy(encoder, com_token, sizeof(encoder)-1);
encoder[sizeof(encoder)-1] = 0;
Q_strlcpy(encoder, com_token);
}
// Parse fields
@ -1496,7 +1494,7 @@ qboolean DELTA_ParseDescription(char *name, delta_t **ppdesc, char *pstream)
if (encoder[0] != 0)
{
Q_strncpy((*ppdesc)->conditionalencodename, encoder, sizeof((*ppdesc)->conditionalencodename) - 1);
Q_strlcpy((*ppdesc)->conditionalencodename, encoder);
(*ppdesc)->conditionalencodename[sizeof((*ppdesc)->conditionalencodename) - 1] = 0;
(*ppdesc)->conditionalencode = 0;
}

View File

@ -241,7 +241,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char
if (bLanguage && pLanguage)
{
char baseDir[4096];
char baseDir[MAX_PATH];
char *tempPtr;
Q_snprintf(szTemp, 511, "%s/%s_%s", GetBaseDirectory(), szFallback, pLanguage);
@ -283,7 +283,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char
if (Q_stricmp(szFallback, "valve"))
{
const int BufLen = 128;
const int BufLen = 256;
char *szFileName = new char[BufLen];
Q_snprintf(szFileName, BufLen - 1, "Resource/%s_%%language%%.txt", szFallback);
@ -298,7 +298,7 @@ void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char
int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir)
{
char temp[512];
char language[256];
char language[128];
const char *pchLang;
g_pFileSystem->RemoveAllSearchPaths();
@ -474,7 +474,7 @@ int FileSystem_AddFallbackGameDir(const char *pGameDir)
return 1;
}
int FileSystem_Init(char *basedir, void *voidfilesystemFactory)
int FileSystem_Init(const char *basedir, void *voidfilesystemFactory)
{
#ifdef REHLDS_CHECKS
Q_strncpy(s_pBaseDir, basedir, ARRAYSIZE(s_pBaseDir));

View File

@ -52,5 +52,5 @@ int Host_GetVideoLevel(void);
void CheckLiblistForFallbackDir(const char *pGameDir, bool bLanguage, const char *pLanguage, bool bLowViolenceBuild_);
int FileSystem_SetGameDirectory(const char *pDefaultDir, const char *pGameDir);
int FileSystem_AddFallbackGameDir(const char *pGameDir);
int FileSystem_Init(char *basedir, void *voidfilesystemFactory);
int FileSystem_Init(const char *basedir, void *voidfilesystemFactory);
void FileSystem_Shutdown(void);

View File

@ -1041,7 +1041,7 @@ void Host_Version(void)
gpszVersionString[sizeof(gpszVersionString) - 1] = 0;
if (COM_CheckParm("-steam"))
{
char szSteamVersionId[32];
char szSteamVersionId[16];
FS_GetInterfaceVersion(szSteamVersionId, sizeof(szSteamVersionId) - 1);
Q_snprintf(gpszVersionString, sizeof(gpszVersionString), "%s/%s", &com_token[Q_strlen("PatchVersion=")], szSteamVersionId);
gpszVersionString[sizeof(gpszVersionString) - 1] = 0;

View File

@ -377,7 +377,7 @@ void Host_UpdateStats(void)
fscanf(pFile, "%d %s %c %d %d %d %d %d %lu %lu \t\t\t%lu %lu %lu %ld %ld %ld %ld %ld %ld %lu \t\t\t%lu %ld %lu %lu %lu %lu %lu %lu %lu %lu \t\t\t%lu %lu %lu %lu %lu %lu",
&dummy,
statFile,
&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy,
(char *)&dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy,
&ctime,
&stime,
&dummy, &dummy, &dummy, &dummy, &dummy,
@ -423,7 +423,12 @@ void GetStatsString(char *buf, int bufSize)
for (int i = 0; i < g_psvs.maxclients; i++)
{
host_client = &g_psvs.clients[i];
if (!host_client->active && !host_client->connected && !host_client->spawned || host_client->fakeclient)
// Fake clients are ignored
if (host_client->fakeclient)
continue;
if (!host_client->active && !host_client->connected && !host_client->spawned)
continue;
players++;

View File

@ -42,7 +42,7 @@ public:
virtual ~IEngine() {}
virtual bool Load(bool dedicated, char *basedir, char *cmdline) = 0;
virtual bool Load(bool dedicated, const char *basedir, const char *cmdline) = 0;
virtual void Unload() = 0;
virtual void SetState(int iState) = 0;
virtual int GetState() = 0;

View File

@ -48,10 +48,10 @@ const avec4_t deg2rad =
const aivec4_t negmask[4] =
{
0x80000000,
0x80000000,
0x80000000,
0x80000000
{0x80000000},
{0x80000000},
{0x80000000},
{0x80000000}
};
const aivec4_t negmask_1001 =

View File

@ -152,7 +152,7 @@ model_t *Mod_FindName(qboolean trackCRC, const char *name)
if (mod->needload == NL_UNREFERENCED)
{
if (!avail || mod->type != mod_alias && mod->type != mod_studio)
if (!avail || (mod->type != mod_alias && mod->type != mod_studio))
avail = mod;
}
}
@ -1329,7 +1329,7 @@ void EXT_FUNC Mod_LoadBrushModel_internal(model_t *mod, void *buffer)
if (i < mod->numsubmodels - 1)
{
char name[10];
char name[12];
Q_snprintf(name, ARRAYSIZE(name), "*%i", i + 1);
loadmodel = Mod_FindName(0, name);

View File

@ -412,7 +412,7 @@ void Netchan_Transmit(netchan_t *chan, int length, byte *data)
// If it's not in-memory, then we'll need to copy it in frame the file handle.
if (pbuf->isfile && !pbuf->isbuffer) {
char compressedfilename[MAX_PATH];
char compressedfilename[MAX_PATH+5]; // room for extension string
FileHandle_t hfile;
if (pbuf->iscompressed)
{

View File

@ -873,7 +873,7 @@ qboolean NET_QueuePacket(netsrc_t sock)
for (int protocol = 0; protocol < 1; protocol++)
#endif // _WIN32
{
SOCKET net_socket;
SOCKET net_socket = INV_SOCK;
if (protocol == 0)
net_socket = ip_sockets[sock];

View File

@ -384,7 +384,7 @@ void EXT_FUNC TraceSphere(const float *v1, const float *v2, int fNoMonsters, flo
void EXT_FUNC TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr)
{
int oldMovetype, oldSolid;
int oldMovetype = MOVETYPE_NONE, oldSolid = SOLID_NOT;
if (hullNumber < 0 || hullNumber > 3)
hullNumber = 0;
@ -1280,7 +1280,10 @@ void EXT_FUNC EV_Playback(int flags, const edict_t *pInvoker, unsigned short eve
continue;
}
if (cl == host_client && (flags & FEV_NOTHOST) && cl->lw || (flags & FEV_HOSTONLY) && cl->edict != pInvoker)
if ((flags & FEV_NOTHOST) && cl->lw && cl == host_client)
continue;
if ((flags & FEV_HOSTONLY) && cl->edict != pInvoker)
continue;
if (flags & FEV_RELIABLE)

View File

@ -119,7 +119,7 @@ void Log_Open(void)
time_t ltime;
struct tm *today;
char szFileBase[MAX_PATH];
char szTestFile[MAX_PATH];
char szTestFile[MAX_PATH+8]; // room for extra string
int i;
FileHandle_t fp;
char *temp;

View File

@ -2059,7 +2059,9 @@ qboolean SV_CheckForDuplicateNames(char *userinfo, qboolean bIsReconnecting, int
return changed;
char newname[MAX_NAME];
Q_snprintf(newname, sizeof(newname), "(%d)%-0.*s", ++dupc, 28, rawname);
const int maxLenDupName = MAX_NAME - (sizeof("(d)") - 1);
Q_snprintf(newname, sizeof(newname), "(%d)%.*s", ++dupc, maxLenDupName - 1, rawname);
#ifdef REHLDS_FIXES
// Fix possibly incorrectly cut UTF8 chars
@ -5461,7 +5463,10 @@ void SV_PropagateCustomizations(void)
// For each active player
for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++)
{
if (!pHost->active && !pHost->spawned || pHost->fakeclient)
if (pHost->fakeclient)
continue;
if (!pHost->active && !pHost->spawned)
continue;
// Send each customization to current player
@ -6590,7 +6595,10 @@ void SV_BanId_f(void)
for (int i = 0; i < g_psvs.maxclients; i++)
{
client_t *cl = &g_psvs.clients[i];
if (!cl->active && !cl->connected && !cl->spawned || cl->fakeclient)
if (cl->fakeclient)
continue;
if (!cl->active && !cl->connected && !cl->spawned)
continue;
if (!Q_stricmp(SV_GetClientIDString(cl), idstring))
@ -6663,7 +6671,10 @@ void SV_BanId_f(void)
for (int i = 0; i < g_psvs.maxclients; i++)
{
client_t *cl = &g_psvs.clients[i];
if (!cl->active && !cl->connected && !cl->spawned || cl->fakeclient)
if (cl->fakeclient)
continue;
if (!cl->active && !cl->connected && !cl->spawned)
continue;
if (SV_CompareUserID(&cl->network_userid, id))
@ -7325,7 +7336,10 @@ void SV_KickPlayer(int nPlayerSlot, int nReason)
Q_sprintf(rgchT, "%s was automatically disconnected\nfrom this secure server.\n", client->name);
for (int i = 0; i < g_psvs.maxclients; i++)
{
if (!g_psvs.clients[i].active && !g_psvs.clients[i].spawned || g_psvs.clients[i].fakeclient)
if (g_psvs.clients[i].fakeclient)
continue;
if (!g_psvs.clients[i].active && !g_psvs.clients[i].spawned)
continue;
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_centerprint);
@ -7522,7 +7536,7 @@ void SV_BeginFileDownload_f(void)
{
if (host_client->fully_connected ||
sv_send_resources.value == 0.0f ||
sv_downloadurl.string != NULL && sv_downloadurl.string[0] != 0 && Q_strlen(sv_downloadurl.string) <= 128 && sv_allow_dlfile.value == 0.0f ||
(sv_downloadurl.string != NULL && sv_downloadurl.string[0] != 0 && Q_strlen(sv_downloadurl.string) <= 128 && sv_allow_dlfile.value == 0.0f) ||
Netchan_CreateFileFragments(TRUE, &host_client->netchan, name) == 0)
{
SV_FailDownload(name);
@ -8166,17 +8180,17 @@ typedef struct GameToAppIDMapItem_s
} GameToAppIDMapItem_t;
GameToAppIDMapItem_t g_GameToAppIDMap[11] = {
0x0A, "cstrike",
0x14, "tfc",
0x1E, "dod",
0x28, "dmc",
0x32, "gearbox",
0x3C, "ricochet",
0x46, "valve",
0x50, "czero",
0x64, "czeror",
0x82, "bshift",
0x96, "cstrike_beta",
{ 0x0A, "cstrike" },
{ 0x14, "tfc" },
{ 0x1E, "dod" },
{ 0x28, "dmc" },
{ 0x32, "gearbox" },
{ 0x3C, "ricochet" },
{ 0x46, "valve" },
{ 0x50, "czero" },
{ 0x64, "czeror" },
{ 0x82, "bshift" },
{ 0x96, "cstrike_beta" },
};
int GetGameAppID(void)

View File

@ -1255,7 +1255,7 @@ void PF_WaterMove(edict_t *pSelf)
if (!(flags & (FL_IMMUNE_WATER | FL_GODMODE)))
{
if ((flags & FL_SWIM) && (waterlevel < drownlevel) || (waterlevel >= drownlevel))
if (((flags & FL_SWIM) && waterlevel < drownlevel) || (waterlevel >= drownlevel))
{
if (pSelf->v.air_finished < g_psv.time && pSelf->v.pain_finished < g_psv.time)
{

View File

@ -173,7 +173,10 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl
// Send resource to all other active players
for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++)
{
if (!pHost->active && !pHost->spawned || pHost->fakeclient)
if (pHost->fakeclient)
continue;
if (!pHost->active && !pHost->spawned)
continue;
if (pHost == pPlayer && bSkipPlayer)

View File

@ -28,11 +28,6 @@
#include "precompiled.h"
typedef struct command_s
{
char *command;
} command_t;
sv_adjusted_positions_t truepositions[MAX_CLIENTS];
qboolean g_balreadymoved;
@ -47,9 +42,9 @@ edict_t *sv_player;
qboolean nofind;
#if defined(SWDS) && defined(REHLDS_FIXES)
command_t clcommands[] = { "status", "name", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "setinfo", "sendents", "fullupdate", "setpause", "unpause", NULL };
const char *clcommands[] = { "status", "name", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "setinfo", "sendents", "fullupdate", "setpause", "unpause", NULL };
#else
command_t clcommands[23] = { "status", "god", "notarget", "fly", "name", "noclip", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "nextdl", "setinfo", "showinfo", "sendents", "fullupdate", "setpause", "unpause", NULL };
const char *clcommands[23] = { "status", "god", "notarget", "fly", "name", "noclip", "kill", "pause", "spawn", "new", "sendres", "dropclient", "kick", "ping", "dlfile", "nextdl", "setinfo", "showinfo", "sendents", "fullupdate", "setpause", "unpause", NULL };
#endif
cvar_t sv_edgefriction = { "edgefriction", "2", FCVAR_SERVER, 0.0f, NULL };
@ -560,7 +555,10 @@ void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
if ((check->v.flags & FL_CLIENT) && check->v.health <= 0.0)
continue;
if (check->v.mins[2] == 0.0 && check->v.maxs[2] == 1.0 || Length(check->v.size) == 0.0)
if (check->v.mins[2] == 0.0 && check->v.maxs[2] == 1.0)
continue;
if (Length(check->v.size) == 0.0)
continue;
fmin = check->v.absmin;
@ -1031,11 +1029,11 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
int SV_ValidateClientCommand(char *pszCommand)
{
char *p;
const char *p;
int i = 0;
COM_Parse(pszCommand);
while ((p = clcommands[i].command) != NULL)
while ((p = clcommands[i]) != NULL)
{
if (!Q_stricmp(com_token, p))
{
@ -1742,7 +1740,7 @@ void SV_ParseCvarValue2(client_t *cl)
Con_DPrintf("Cvar query response: name:%s, request ID %d, cvar:%s, value:%s\n", cl->name, requestID, cvarName, value);
}
void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, int8 opcode) {
void EXT_FUNC SV_HandleClientMessage_api(IGameClient* client, uint8 opcode) {
client_t* cl = client->GetClient();
if (opcode < clc_bad || opcode > clc_cvarvalue2)
{

View File

@ -35,8 +35,6 @@
const int CMD_MAXBACKUP = 64;
typedef struct command_s command_t;
typedef struct sv_adjusted_positions_s
{
int active;
@ -59,7 +57,6 @@ typedef struct clc_func_s
} clc_func_t;
extern edict_t *sv_player;
extern command_t clcommands[23];
extern sv_adjusted_positions_t truepositions[MAX_CLIENTS];
extern qboolean g_balreadymoved;

View File

@ -490,7 +490,7 @@ void NORETURN Sys_Error(const char *error, ...)
#endif // SWDS
//Allahu akbar!
int *null = 0;
volatile int *null = 0;
*null = 0;
exit(-1);
}

View File

@ -455,7 +455,7 @@ void Sys_ShowProgressTicks(char *specialProgressMsg)
}
}
int Sys_InitGame(char *lpOrgCmdLine, char *pBaseDir, void *pwnd, int bIsDedicated)
int Sys_InitGame(const char *lpOrgCmdLine, const char *pBaseDir, void *pwnd, int bIsDedicated)
{
host_initialized = FALSE;
@ -640,7 +640,7 @@ NOXREF int BuildMapCycleListHints(char **hints)
}
*/
bool CDedicatedServerAPI::Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory)
bool CDedicatedServerAPI::Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory)
{
dedicated_ = (IDedicatedExports *)launcherFactory(VENGINE_DEDICATEDEXPORTS_API_VERSION, NULL);
if (!dedicated_)

View File

@ -58,7 +58,7 @@ private:
char m_OrigCmd[1024];
public:
EXT_FUNC virtual bool Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory);
EXT_FUNC virtual bool Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory);
EXT_FUNC virtual int Shutdown();
EXT_FUNC virtual bool RunFrame();
EXT_FUNC virtual void AddConsoleText(char *text);
@ -93,7 +93,7 @@ NOXREF void Sys_ShutdownLauncherInterface();
void Sys_InitAuthentication();
NOXREF void Sys_ShutdownAuthentication();
void Sys_ShowProgressTicks(char *specialProgressMsg);
int Sys_InitGame(char *lpOrgCmdLine, char *pBaseDir, void *pwnd, int bIsDedicated);
int Sys_InitGame(const char *lpOrgCmdLine, const char *pBaseDir, void *pwnd, int bIsDedicated);
void Sys_ShutdownGame();
void ClearIOStates();

View File

@ -81,7 +81,7 @@ void ForceReloadProfile()
}
}
bool CEngine::Load(bool dedicated, char *basedir, char *cmdline)
bool CEngine::Load(bool dedicated, const char *basedir, const char *cmdline)
{
bool success = false;
SetState(DLL_ACTIVE);

View File

@ -56,7 +56,7 @@ public:
CEngine();
virtual ~CEngine();
virtual bool Load(bool dedicated, char *rootDir, char *cmdLine);
virtual bool Load(bool dedicated, const char *rootDir, const char *cmdLine);
virtual void Unload();
virtual void SetState(int iState);
virtual int GetState();

View File

@ -43,6 +43,7 @@ const char *gNetworkMessageNames[MAX_NETMESSAGE] =
};
client_textmessage_t gNetworkTextMessage[MAX_NETMESSAGE] =
{
{
0, // effect
255, 255, 255, 255,
@ -55,6 +56,7 @@ client_textmessage_t gNetworkTextMessage[MAX_NETMESSAGE] =
0.0f, // fxTime,
NETWORK_MESSAGE1,// pName message name.
gNetworkTextMessageBuffer[0] // pMessage
}
};
char* EXT_FUNC memfgets(unsigned char *pMemFile, int fileSize, int *pFilePos, char *pBuffer, int bufferSize)

View File

@ -565,22 +565,22 @@ int Q_UChar32ToUTF8(uchar32 uVal, char * pUTF8Out) {
else if (uVal <= 0x7FF)
{
*pUTF8Out = (uVal >> 6) | 0xC0;
pUTF8Out[1] = uVal & 0x3F | 0x80;
pUTF8Out[1] = (uVal & 0x3F) | 0x80;
return 2;
}
else if (uVal <= 0xFFFF)
{
*pUTF8Out = (uVal >> 12) | 0xE0;
pUTF8Out[2] = uVal & 0x3F | 0x80;
pUTF8Out[1] = (uVal >> 6) & 0x3F | 0x80;
*pUTF8Out = ((uVal >> 12)) | 0xE0;
pUTF8Out[2] = (uVal & 0x3F) | 0x80;
pUTF8Out[1] = (((uVal >> 6)) & 0x3F) | 0x80;
return 3;
}
else
{
*pUTF8Out = (uVal >> 18) & 7 | 0xF0;
pUTF8Out[1] = (uVal >> 12) & 0x3F | 0x80;
pUTF8Out[3] = uVal & 0x3F | 0x80;
pUTF8Out[2] = (uVal >> 6) & 0x3F | 0x80;
*pUTF8Out = ((uVal >> 18) & 7) | 0xF0;
pUTF8Out[1] = ((uVal >> 12) & 0x3F) | 0x80;
pUTF8Out[3] = (uVal & 0x3F) | 0x80;
pUTF8Out[2] = ((uVal >> 6) & 0x3F) | 0x80;
return 4;
}
}
@ -600,7 +600,7 @@ int __cdecl Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out)
}
else
{
pUTF16Out[1] = uVal & 0x3FF | 0xDC00;
pUTF16Out[1] = (uVal & 0x3FF) | 0xDC00;
pUTF16Out[0] = ((uVal - 0x10000) >> 10) | 0xD800;
return 2;
}

View File

@ -71,7 +71,7 @@ void R_InitTextures()
{
for (int y = 0; y < texSize; y++, dest++)
{
if (x < (texSize / 2) == y < (texSize / 2))
if ((x < (texSize / 2)) == (y < (texSize / 2)))
*dest = -1;
else
*dest = 0;

View File

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.1)
project(rehlds CXX)
add_subdirectory(FileSystem_Stdio)

View File

@ -0,0 +1,93 @@
cmake_minimum_required(VERSION 3.1)
project(filesystem_stdio CXX)
option(DEBUG "Build with debug information." OFF)
option(USE_INTEL_COMPILER "Use the Intel compiler." OFF)
option(USE_CLANG_COMPILER "Use the Clang compiler." OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(WRAP_FUNCS_LIST
"scandir" "opendir" "freopen" "fopen" "fopen64" "open" "open64" "creat"
"access" "stat" "lstat" "__xstat" "__lxstat" "__xstat64" "__lxstat64"
"chmod" "chown" "lchown" "unlink" "symlink" "link" "mknod" "mount"
"mkfifo" "rename" "utime" "utimes" "mkdir" "rmdir"
)
if (USE_INTEL_COMPILER)
set(CMAKE_C_COMPILER "/opt/intel/bin/icc")
set(CMAKE_CXX_COMPILER "/opt/intel/bin/icpc")
elseif (USE_CLANG_COMPILER)
set(CMAKE_C_COMPILER "/usr/bin/clang")
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-exceptions")
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3 -O3 -ggdb")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g0 -O3")
endif()
if (USE_INTEL_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qoption,cpp,--treat_func_as_string_literal_cpp")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-intel -no-intel-extensions")
else()
# Produce code optimized for the most common IA32/AMD64/EM64T processors.
# As new processors are deployed in the marketplace, the behavior of this option will change.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=generic -msse3\
-fpermissive\
-Wno-unknown-pragmas -Wno-unused-result -Wno-unused-variable -Wno-unused-function\
-Wno-write-strings -Wno-sign-compare")
if (NOT USE_CLANG_COMPILER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-truncation -Wno-class-memaccess")
endif()
endif()
foreach(f ${WRAP_FUNCS_LIST})
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-wrap,${f}")
endforeach()
set(PROJECT_SRC_DIR
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/../.."
)
set(PROJECT_PUBLIC_DIR
"${PROJECT_SOURCE_DIR}/../../common"
"${PROJECT_SOURCE_DIR}/../../public"
"${PROJECT_SOURCE_DIR}/../../public/rehlds"
)
set(FILESYSTEM_STDIO_SRCS
"src/BaseFileSystem.cpp"
"src/filesystem_helpers.cpp"
"src/FileSystem_Stdio.cpp"
"src/linux_support.cpp"
"src/pathmatch.cpp"
"src/public_amalgamation.cpp"
)
include_directories(
${PROJECT_SRC_DIR}
${PROJECT_PUBLIC_DIR}
)
add_definitions(
-D_LINUX
-DLINUX
-D_GLIBCXX_USE_CXX11_ABI=0
-D_strdup=strdup
-D_stricmp=strcasecmp
-D_strnicmp=strncasecmp
-D_vsnprintf=vsnprintf
-D_snprintf=snprintf
-D_unlink=unlink
)
add_library(filesystem_stdio SHARED ${FILESYSTEM_STDIO_SRCS})
set_target_properties(filesystem_stdio PROPERTIES PREFIX "" COMPILE_FLAGS "-m32" LINK_FLAGS "-m32" POSITION_INDEPENDENT_CODE ON)
target_link_libraries(filesystem_stdio dl)

View File

@ -1132,8 +1132,8 @@ bool IsWildCardMatch(const char *wildcardString, const char *stringToCheck)
// we only want to advance the pointers if we successfully assigned
// both of our char variables, so we'll do it here rather than in the
// loop condition itself
*stringToCheck++;
*wildcardString++;
stringToCheck++;
wildcardString++;
// if this isn't a case-sensitive match, make both chars uppercase
wcChar = toupper(wcChar);
@ -1148,7 +1148,7 @@ bool IsWildCardMatch(const char *wildcardString, const char *stringToCheck)
// until we've either found a match or the string has
// ended
if (starMatchesZero)
*stringToCheck--;
stringToCheck--;
while (*stringToCheck)
{
@ -1501,7 +1501,7 @@ void CBaseFileSystem::Warning(FileWarningLevel_t level, const char *fmt, ...)
#ifdef _WIN32
OutputDebugString(warningtext);
#else
fprintf(stderr, warningtext);
fprintf(stderr, "%s", warningtext);
#endif
}
}
@ -1654,15 +1654,15 @@ bool CBaseFileSystem::CSearchPath::PackFileLessFunc(CPackFileEntry const &src1,
}
CBaseFileSystem::CSearchPath::CSearchPath() :
m_PackFiles(0, MAX_ENTRY_PATH, CSearchPath::PackFileLessFunc),
m_Path(CUtlSymbol("")),
m_bIsMapPath(false),
m_bIsPackFile(false),
m_bAllowWrite(true),
m_lPackFileTime(0),
m_hPackFile(nullptr),
m_nNumPackFiles(0),
m_iCurSearchFile(0),
m_hPackFile(nullptr)
m_bAllowWrite(true),
m_PackFiles(0, MAX_ENTRY_PATH, CSearchPath::PackFileLessFunc)
{
}

View File

@ -172,7 +172,7 @@ void NORETURN FileSystem_SysError(const char *fmt, ...)
fprintf(fl, "%s\n", string);
fclose(fl);
int *null = 0;
volatile int *null = 0;
*null = 0;
exit(-1);
}

View File

@ -63,13 +63,13 @@ delta_definition_t g_DeltaDataDefinition[] =
delta_description_t g_MetaDescription[] =
{
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, 0, 0 },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, 0, 0 }
{ DT_INTEGER, DELTA_D_DEF(fieldType), 1, 32, 1.0, 1.0, 0, {0, 0} },
{ DT_STRING, DELTA_D_DEF(fieldName), 1, 1, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldOffset), 1, 16, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(fieldSize), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_INTEGER, DELTA_D_DEF(significant_bits), 1, 8, 1.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(premultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} },
{ DT_FLOAT, DELTA_D_DEF(postmultiply), 1, 32, 4000.0, 1.0, 0, {0, 0} }
};
namespace Delta {

View File

@ -39,7 +39,7 @@
class IDedicatedServerAPI : public IBaseInterface
{
public:
virtual bool Init(char *basedir, char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) = 0;
virtual bool Init(const char *basedir, const char *cmdline, CreateInterfaceFn launcherFactory, CreateInterfaceFn filesystemFactory) = 0;
virtual int Shutdown() = 0;
virtual bool RunFrame() = 0;
virtual void AddConsoleText(char *text) = 0;

View File

@ -34,7 +34,7 @@ class IDedicatedExports : public IBaseInterface
{
public:
virtual ~IDedicatedExports() {};
virtual void Sys_Printf(char *text) = 0;
virtual void Sys_Printf(const char *text) = 0;
};
#define VENGINE_DEDICATEDEXPORTS_API_VERSION "VENGINE_DEDICATEDEXPORTS_API_VERSION001"

View File

@ -130,7 +130,7 @@ CSysModule *Sys_LoadModule(const char *pModuleName)
HMODULE hDLL = LoadLibrary(pModuleName);
#else
HMODULE hDLL = nullptr;
char szAbsoluteModuleName[1024];
char szAbsoluteModuleName[2048];
if (pModuleName[0] != '/')
{
char szCwd[1024];
@ -150,7 +150,7 @@ CSysModule *Sys_LoadModule(const char *pModuleName)
if (!hDLL)
{
char str[512];
char str[2048+6]; // room for extension string
#if defined(_WIN32)
_snprintf(str, sizeof(str), "%s.dll", pModuleName);

View File

@ -108,8 +108,8 @@ typedef IVoidHookChain<IGameClient*> IRehldsHook_ClientConnected;
typedef IVoidHookChainRegistry<IGameClient*> IRehldsHookRegistry_ClientConnected;
//HandleNetCommand
typedef IVoidHookChain<IGameClient*, int8> IRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistry<IGameClient*, int8> IRehldsHookRegistry_HandleNetCommand;
typedef IVoidHookChain<IGameClient*, uint8> IRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistry<IGameClient*, uint8> IRehldsHookRegistry_HandleNetCommand;
//Mod_LoadBrushModel
typedef IVoidHookChain<model_t*, void*> IRehldsHook_Mod_LoadBrushModel;

View File

@ -44,7 +44,7 @@ void CharacterSetBuild(characterset_t *pSetBuffer, const char *pszSetString)
while (pszSetString[i])
{
pSetBuffer->set[pszSetString[i]] = 1;
pSetBuffer->set[(unsigned)pszSetString[i]] = 1;
i++;
}
}

View File

@ -140,7 +140,7 @@ SpewRetval_t _SpewMessage(SpewType_t spewType, char const* pMsgFormat, va_list
/* Printf the file and line for warning + assert only... */
int len = 0;
if ((spewType == SPEW_ASSERT))
if (spewType == SPEW_ASSERT)
{
len = sprintf(pTempBuffer, "%s (%d) : ", s_pFileName, s_Line);
}
@ -149,7 +149,7 @@ SpewRetval_t _SpewMessage(SpewType_t spewType, char const* pMsgFormat, va_list
len += vsprintf(&pTempBuffer[len], pMsgFormat, args);
// Add \n for warning and assert
if ((spewType == SPEW_ASSERT))
if (spewType == SPEW_ASSERT)
{
len += sprintf(&pTempBuffer[len], "\n");
}

View File

@ -1,4 +1,4 @@
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//========= Copyright 1996-2001, Valve LLC, All rights reserved. ============
//
// The copyright to the contents herein is the property of Valve, L.L.C.
// The contents may be used and/or copied only with the written permission of
@ -205,7 +205,7 @@ int CUtlBuffer::VaScanf(char const* pFmt, va_list list)
char c;
char* pEnd;
while (c = *pFmt++)
while ((c = *pFmt++))
{
// Stop if we hit the end of the buffer
if (m_Get >= Size())

View File

@ -234,11 +234,12 @@ protected:
// Constructor, Destructor
template <class T, class I, typename L, class M>
CUtlRBTree<T, I, L, M>::CUtlRBTree(int growSize, int initSize, LessFunc_t lessfunc) :
m_Elements(growSize, initSize),
m_LessFunc(lessfunc),
m_Elements(growSize, initSize),
m_Root(InvalidIndex()),
m_NumElements(0), m_TotalElements(0),
m_FirstFree(InvalidIndex())
m_NumElements(0),
m_FirstFree(InvalidIndex()),
m_TotalElements(0)
{
}

View File

@ -322,7 +322,7 @@ namespace detail
bool operator==(const Opd& rhs) const
{
if ((opdtype_ & O_TYPE_TYPE_MASK) != (rhs.opdtype_ & O_TYPE_TYPE_MASK) || opdsize_ != opdsize_) {return false;}
if ((opdtype_ & O_TYPE_TYPE_MASK) != (rhs.opdtype_ & O_TYPE_TYPE_MASK) || opdsize_ != rhs.opdsize_) {return false;}
if (IsReg()) {return reg_ == rhs.reg_ && reg_assignable_ == rhs.reg_assignable_;}
if (IsMem()) {return base_ == rhs.base_ && index_ == rhs.index_ && scale_ == rhs.scale_ && disp_ == rhs.disp_ && addrsize_ == rhs.addrsize_;}
if (IsImm()) {return imm_ == rhs.imm_;}

View File

@ -102,7 +102,7 @@ int CSimplePlatform::setsockopt(SOCKET s, int level, int optname, const char* op
#ifdef _WIN32
return setsockopt_v11(s, level, optname, optval, optlen);
#else
return setsockopt(s, level, optname, optval, optlen);
return ::setsockopt(s, level, optname, optval, optlen);
#endif
}
@ -213,6 +213,8 @@ void NORETURN rehlds_syserror(const char* fmt, ...) {
fclose(fl);
//TerminateProcess(GetCurrentProcess(), 1);
*((int*)NULL) = 0;
volatile int *null = 0;
*null = 0;
while (true);
}

View File

@ -103,8 +103,8 @@ typedef IVoidHookChainImpl<IGameClient*> CRehldsHook_ClientConnected;
typedef IVoidHookChainRegistryImpl<IGameClient*> CRehldsHookRegistry_ClientConnected;
//HandleNetCommand
typedef IVoidHookChainImpl<IGameClient*, int8> CRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistryImpl<IGameClient*, int8> CRehldsHookRegistry_HandleNetCommand;
typedef IVoidHookChainImpl<IGameClient*, uint8> CRehldsHook_HandleNetCommand;
typedef IVoidHookChainRegistryImpl<IGameClient*, uint8> CRehldsHookRegistry_HandleNetCommand;
//Mod_LoadBrushModel
typedef IVoidHookChainImpl<model_t*, void*> CRehldsHook_Mod_LoadBrushModel;

158
rehlds/version/appversion.sh Executable file
View File

@ -0,0 +1,158 @@
#!/bin/bash
init()
{
SOURCE_DIR=$@
GIT_DIR=$SOURCE_DIR/..
VERSION_FILE=$GIT_DIR/gradle.properties
APPVERSION_FILE=$SOURCE_DIR/version/appversion.h
if test -z "`git --version`"; then
echo "Please install git client"
echo "sudo apt-get install git"
exit -1
fi
# Read old version
if [ -e $APPVERSION_FILE ]; then
OLD_VERSION=$(cat $APPVERSION_FILE | grep -wi '#define APP_VERSION' | sed -e 's/#define APP_VERSION[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
if [ $? -ne 0 ]; then
OLD_VERSION=""
else
# Remove quotes
OLD_VERSION=$(echo $OLD_VERSION | xargs)
fi
fi
# Get major, minor and maintenance information from gradle.properties
MAJOR=$(sed -nr -e '/majorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r')
if [ $? -ne 0 -o "$MAJOR" = "" ]; then
MAJOR=0
fi
MINOR=$(sed -nr -e '/minorVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r')
if [ $? -ne 0 -o "$MINOR" = "" ]; then
MINOR=0
fi
MAINTENANCE=$(sed -nr -e '/maintenanceVersion/ s/.*\= *//p' "$VERSION_FILE" | tr -d '\n\r')
if [ $? -ne 0 -o "$MAINTENANCE" = "" ]; then
MAINTENANCE=0
fi
BRANCH_NAME=$(git -C "$GIT_DIR/" rev-parse --abbrev-ref HEAD)
if [ $? -ne 0 -o "$BRANCH_NAME" = "" ]; then
BRANCH_NAME=master
fi
COMMIT_COUNT=$(git -C "$GIT_DIR/" rev-list --count $BRANCH_NAME)
if [ $? -ne 0 -o "$COMMIT_COUNT" = "" ]; then
COMMIT_COUNT=0
fi
#
# Configure remote url repository
#
# Get remote name by current branch
BRANCH_REMOTE=$(git -C "$GIT_DIR/" config branch.$BRANCH_NAME.remote)
if [ $? -ne 0 -o "$BRANCH_REMOTE" = "" ]; then
BRANCH_REMOTE=origin
fi
# Get commit id
COMMIT_SHA=$(git -C "$GIT_DIR/" rev-parse --verify HEAD)
COMMIT_SHA=${COMMIT_SHA:0:7}
# Get remote url
COMMIT_URL=$(git -C "$GIT_DIR/" config remote.$BRANCH_REMOTE.url)
URL_CONSTRUCT=0
if [[ "$COMMIT_URL" == *"git@"* ]]; then
URL_CONSTRUCT=1
# Strip prefix 'git@'
COMMIT_URL=${COMMIT_URL#git@}
# Strip postfix '.git'
COMMIT_URL=${COMMIT_URL%.git}
# Replace ':' to '/'
COMMIT_URL=${COMMIT_URL/:/\/}
elif [[ "$COMMIT_URL" == *"https://"* ]]; then
URL_CONSTRUCT=1
# Strip prefix 'https://'
COMMIT_URL=${COMMIT_URL#https://}
# Strip postfix '.git'
COMMIT_URL=${COMMIT_URL%.git}
fi
if test "$URL_CONSTRUCT" -eq 1; then
# Append extra string
if [[ "$COMMIT_URL" == *"bitbucket.org"* ]]; then
COMMIT_URL=$(echo https://$COMMIT_URL/commits/)
else
COMMIT_URL=$(echo https://$COMMIT_URL/commit/)
fi
fi
#
# Detect local modifications
#
if [ `git -C "$GIT_DIR/" ls-files -m | wc -l` = 0 ]; then
MODIFIED=
else
MODIFIED=+m
fi
NEW_VERSION="$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT-dev$MODIFIED"
# Update appversion.h if version has changed or modifications/mixed revisions detected
if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then
update_appversion
fi
}
update_appversion()
{
day=$(date +%m)
year=$(date +%Y)
hours=$(date +%H:%M:%S)
month=$(LANG=en_us_88591; date +"%b")
# Write appversion.h
echo Updating appversion.h, new version is '"'$NEW_VERSION'"', the old one was $OLD_VERSION
echo -e "#ifndef __APPVERSION_H__\r">"$APPVERSION_FILE"
echo -e "#define __APPVERSION_H__\r">>"$APPVERSION_FILE"
echo -e "\r">>"$APPVERSION_FILE"
echo -e "//\r">>"$APPVERSION_FILE"
echo -e "// This file is generated automatically.\r">>"$APPVERSION_FILE"
echo -e "// Don't edit it.\r">>"$APPVERSION_FILE"
echo -e "//\r">>"$APPVERSION_FILE"
echo -e "\r">>"$APPVERSION_FILE"
echo -e "// Version defines\r">>"$APPVERSION_FILE"
echo -e '#define APP_VERSION "'$NEW_VERSION'"\r'>>"$APPVERSION_FILE"
echo -e "#define APP_VERSION_C $MAJOR,$MINOR,$MAINTENANCE,$COMMIT_COUNT\r">>"$APPVERSION_FILE"
echo -e '#define APP_VERSION_STRD "'$MAJOR.$MINOR.$MAINTENANCE.$COMMIT_COUNT'"\r'>>"$APPVERSION_FILE"
echo -e "#define APP_VERSION_FLAGS 0x0L\r">>"$APPVERSION_FILE"
echo -e "\r">>"$APPVERSION_FILE"
echo -e '#define APP_COMMIT_DATE "'$month $day $year'"\r'>>"$APPVERSION_FILE"
echo -e '#define APP_COMMIT_TIME "'$hours'"\r'>>"$APPVERSION_FILE"
echo -e "\r">>"$APPVERSION_FILE"
echo -e '#define APP_COMMIT_SHA "'$COMMIT_SHA'"\r'>>"$APPVERSION_FILE"
echo -e '#define APP_COMMIT_URL "'$COMMIT_URL'"\r'>>"$APPVERSION_FILE"
echo -e "\r">>"$APPVERSION_FILE"
echo -e "#endif //__APPVERSION_H__\r">>"$APPVERSION_FILE"
}
# Initialise
init $*
# Exit normally
exit 0