mirror of
https://github.com/rehlds/rehlds.git
synced 2025-07-25 14:41:44 +03:00
Compare commits
115 Commits
3.10.0.759
...
master
Author | SHA1 | Date | |
---|---|---|---|
b3f2d7d6cc | |||
14f7665e54 | |||
89f17f5b7f | |||
c69fd54580 | |||
ec4cef7937 | |||
09368ebd7e | |||
cbeb08abd3 | |||
|
ae2639d3df | ||
|
1571474af7 | ||
|
97dd83d626 | ||
5cac7a97ab | |||
|
44e510a25c | ||
|
7bc5d86add | ||
|
98b4103b86 | ||
|
2f87ace7fc | ||
|
a2953ea374 | ||
|
45fe816fdd | ||
|
89958d348e | ||
e9991716fc | |||
|
20c16bfad3 | ||
|
28c205de11 | ||
|
1a68407710 | ||
|
4afb6e3be9 | ||
|
e83b324301 | ||
|
64c684af4a | ||
|
e54adb089c | ||
|
18b173d5c6 | ||
|
6e6368da30 | ||
|
df862d9bb6 | ||
12b35dbe8c | |||
c17dacd152 | |||
85d55d15db | |||
df704585aa | |||
|
5a1f66a6b4 | ||
|
fe184a82e0 | ||
|
b29740c19e | ||
|
7073363c88 | ||
|
2834fb8494 | ||
|
c8308a2c60 | ||
|
ed954a710f | ||
|
9935f8bc75 | ||
|
9c1e84328e | ||
|
c1ccc5009a | ||
|
0f45ec09fa | ||
|
c9f9bbfff9 | ||
|
a761efa75d | ||
|
82a3d1d084 | ||
|
693b51c883 | ||
|
47ffe4b257 | ||
|
3c4acbb046 | ||
|
5b72d06bfb | ||
|
0d1bdbab67 | ||
|
61ee4f9269 | ||
|
b870de768b | ||
|
3c282b435c | ||
|
ec47e4d978 | ||
|
462fe55fb8 | ||
|
f26ad71aba | ||
|
59ed3f6867 | ||
|
516bb93627 | ||
|
174414db81 | ||
|
05f4a279f9 | ||
|
58391b6ee5 | ||
|
498d7e0d18 | ||
|
a7b60451f3 | ||
|
63fde229c9 | ||
|
9b0dbe8dd2 | ||
|
41c5186b2c | ||
|
90cb97ddae | ||
|
76cbd2c140 | ||
|
f29d6c5769 | ||
|
355172d6db | ||
|
62407e0dd6 | ||
|
1d6c6826db | ||
|
5002ff9abe | ||
|
32857e7785 | ||
|
93f5775ac2 | ||
|
0af97d98bb | ||
|
ffb65795dd | ||
|
3f19bc1d3e | ||
|
7fcec97af4 | ||
|
b7f6eb8023 | ||
|
5ec8c29185 | ||
|
6f031901cf | ||
|
de3679f039 | ||
|
2ba27d409c | ||
|
f955b07b69 | ||
|
918612fa23 | ||
|
8841ba4aec | ||
|
0c5ce53666 | ||
|
a680f18ee1 | ||
|
1796459953 | ||
|
5e8b0ba616 | ||
|
14b56e0514 | ||
|
d6ebe82833 | ||
|
d76b06dcc2 | ||
|
e9045e3b63 | ||
|
be0e1c843b | ||
|
3dc9f8c92d | ||
|
815da982a0 | ||
|
4e0a3f312a | ||
|
2f0a402f9d | ||
|
6d169b0119 | ||
|
f319f50068 | ||
|
77b4cd3d32 | ||
|
745f8b3735 | ||
|
5bc2d83b08 | ||
|
471158b1d9 | ||
|
c86849ef63 | ||
|
22a00eff89 | ||
|
ed83cb6c50 | ||
|
2118e8f052 | ||
|
04ddafe637 | ||
|
aaffe43e3e | ||
|
9508c8376b |
360
.github/workflows/build.yml
vendored
360
.github/workflows/build.yml
vendored
@ -5,16 +5,18 @@ on:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '.github/**'
|
||||
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize]
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: 'Windows'
|
||||
runs-on: windows-latest
|
||||
runs-on: windows-2025
|
||||
|
||||
env:
|
||||
solution: 'msvc/ReHLDS.sln'
|
||||
@ -24,27 +26,75 @@ jobs:
|
||||
buildTest: 'Test Fixes'
|
||||
|
||||
steps:
|
||||
- name: Configure
|
||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
# TODO: add support of 141_xp toolchain at VS2022+
|
||||
# - name: Install v140, v141 and v142 toolsets
|
||||
# shell: cmd
|
||||
# run: |
|
||||
# "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" modify ^
|
||||
# --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" ^
|
||||
# --add Microsoft.VisualStudio.Component.WindowsXP ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140.x86.x64 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v140.xp ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.140.CRT ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v141.xp ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v142 ^
|
||||
# --add Microsoft.VisualStudio.Component.VC.v142.x86.x64 ^
|
||||
# --quiet --norestart
|
||||
|
||||
- name: Select PlatformToolset
|
||||
id: select_toolset
|
||||
shell: pwsh
|
||||
run: |
|
||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||
$vs2019 = & $vswhere -products * -version "[16.0,17.0)" -property installationPath -latest
|
||||
$vs2022 = & $vswhere -products * -version "[17.0,)" -property installationPath -latest
|
||||
|
||||
if ($vs2019) {
|
||||
"toolset=v140_xp" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Selected v140_xp toolset"
|
||||
} elseif ($vs2022) {
|
||||
"toolset=v143" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Selected v143 toolset"
|
||||
} else {
|
||||
Write-Error "No suitable Visual Studio installation found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
- name: Build and Run unittests
|
||||
shell: pwsh
|
||||
run: |
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
$toolset = '${{ steps.select_toolset.outputs.toolset }}'
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildTest }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
.\"msvc\Test Fixes\swds.exe"
|
||||
If ($LASTEXITCODE -ne 0 -And
|
||||
$LASTEXITCODE -ne 3)
|
||||
{[Environment]::Exit(1)}
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
run: |
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false
|
||||
$toolset = '${{ steps.select_toolset.outputs.toolset }}'
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildReleasePlay }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=$toolset /p:XPDeprecationWarning=false
|
||||
|
||||
- name: Get rcedit from chocolatey
|
||||
shell: pwsh
|
||||
run: |
|
||||
choco install rcedit -y
|
||||
|
||||
- name: Move files
|
||||
run: |
|
||||
@ -52,6 +102,7 @@ jobs:
|
||||
mkdir publish\tests
|
||||
mkdir publish\bin\win32\valve\dlls
|
||||
move "msvc\${{ env.buildReleasePlay }}\swds.dll" publish\tests\swds.dll
|
||||
|
||||
move msvc\${{ env.buildRelease }}\hlds.exe publish\bin\win32\hlds.exe
|
||||
move msvc\${{ env.buildRelease }}\hltv.exe publish\bin\win32\hltv.exe
|
||||
move msvc\${{ env.buildRelease }}\swds.dll publish\bin\win32\swds.dll
|
||||
@ -69,99 +120,181 @@ jobs:
|
||||
move msvc\${{ env.buildRelease }}\filesystem_stdio.pdb publish\debug\filesystem_stdio.pdb
|
||||
move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb
|
||||
|
||||
- name: Get app version
|
||||
id: get_version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$versionFile = "rehlds/version/appversion.h"
|
||||
if (-not (Test-Path $versionFile)) {
|
||||
Write-Error "Version file not found: $versionFile"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$content = Get-Content $versionFile
|
||||
foreach ($line in $content) {
|
||||
if ($line -match '^\s*#define\s+APP_VERSION\s+"([^"]+)"') {
|
||||
$version = $matches[1]
|
||||
"version=$version" >> $env:GITHUB_OUTPUT
|
||||
Write-Host "Found version: $version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
Write-Error "APP_VERSION not found in file"
|
||||
exit 1
|
||||
|
||||
- name: Show version
|
||||
run: echo "Version is ${{ steps.get_version.outputs.version }}"
|
||||
- name: Edit resources at windows binaries
|
||||
run: |
|
||||
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\hlds.exe --set-version-string ProductName "ReHLDS" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "The Half-Life Dedicated Server, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam"
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\hltv.exe --set-version-string ProductName "ReHLTV" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "The Half-Life TV, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam"
|
||||
rcedit ${{ github.workspace }}\publish\tests\swds.dll --set-version-string ProductName "swds.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A dll used by Steamworks Dedicated Servers, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\swds.dll --set-version-string ProductName "swds.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A ddll used by Steamworks Dedicated Servers, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\core.dll --set-version-string ProductName "core.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription " A dll, it is a core of game engine, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\proxy.dll --set-version-string ProductName "proxy.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A dll for proxying network connections, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\demoplayer.dll --set-version-string ProductName "demoplayer.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A dll for demoplayer functionality, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\filesystem_stdio.dll --set-version-string ProductName "filesystem_stdio.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A dll that manages file input/output operations, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
rcedit ${{ github.workspace }}\publish\bin\win32\valve\dlls\director.dll --set-version-string ProductName "director.dll" --set-file-version "${{ steps.get_version.outputs.version }}" --set-product-version "${{ steps.get_version.outputs.version }}" --set-version-string FileDescription "A dll used for Director functionality in Half-Life 1, Commit: $env:GITHUB_SHA" --set-version-string "Comments" "Commit: $env:GITHUB_SHA" --set-version-string CompanyName "ReHLDS Dev Team" --set-version-string LegalCopyright "Copyright 2025 Valve, ReHLDS DevTeam" --set-icon rehlds/dedicated/msvc/icon.ico
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Import PFX and sign
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
KEY_PFX_PASS: ${{ secrets.KEY_PFX_PASS }}
|
||||
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md
|
||||
run: |
|
||||
$pfxBase64 = "${{ secrets.KEY_PFX_B64 }}"
|
||||
[IO.File]::WriteAllBytes("${{ github.workspace }}\signing-cert.pfx", [Convert]::FromBase64String($pfxBase64))
|
||||
certutil -f -p "${{ secrets.KEY_PFX_PASS }}" -importPFX "${{ github.workspace }}\signing-cert.pfx"
|
||||
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\hlds.exe
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "reHLTV" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\hltv.exe
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - swds.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\tests\swds.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - swds.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\swds.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - core.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\core.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - proxy.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\proxy.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - demoplayer.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\demoplayer.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - filesystem_stdio.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\filesystem_stdio.dll
|
||||
& 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe' sign /a /f "${{ github.workspace }}\signing-cert.pfx" /p $env:KEY_PFX_PASS /d "ReHLDS - director.dll" /du "https://rehlds.dev/" /tr "http://timestamp.digicert.com" /td sha256 /fd sha256 /v ${{ github.workspace }}\publish\bin\win32\valve\dlls\director.dll
|
||||
Remove-Item -Recurse -Force "${{ github.workspace }}\signing-cert.pfx"
|
||||
shell: "pwsh"
|
||||
|
||||
- name: Deploy artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: win32
|
||||
path: publish/*
|
||||
|
||||
testdemos:
|
||||
name: 'Test demos'
|
||||
runs-on: ubuntu-latest
|
||||
container: s1lentq/testdemos:latest
|
||||
runs-on: ubuntu-24.04
|
||||
container: rehldsorg/testdemos:latest
|
||||
needs: [windows]
|
||||
|
||||
env:
|
||||
WINEDEBUG: -all
|
||||
WINEDLLOVERRIDES: mshtml=
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: ../../../opt/HLDS
|
||||
working-directory: /opt/HLDS
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
test: [
|
||||
{ file: 'cstrike-muliplayer-1', desc: 'CS: Multiplayer' },
|
||||
{ file: 'rehlds-phys-single1', desc: 'Half-Life: Physics singleplayer' },
|
||||
{ file: 'crossfire-1-multiplayer-1', desc: 'Half-Life: Multiplayer on crossfire map' },
|
||||
{ file: 'shooting-hl-1', desc: 'Half-Life: Shooting with several weapons' },
|
||||
]
|
||||
|
||||
steps:
|
||||
- name: Deploying windows artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: win32
|
||||
|
||||
- name: Play demos
|
||||
- name: Setup dependencies
|
||||
run: |
|
||||
chown root ~
|
||||
rsync -a deps/rehlds/* .
|
||||
mv $GITHUB_WORKSPACE/tests/swds.dll .
|
||||
|
||||
descs=(
|
||||
"CS: Multiplayer"
|
||||
"Half-Life: Physics singleplayer"
|
||||
"Half-Life: Multiplayer on crossfire map"
|
||||
"Half-Life: Shooting with several weapons"
|
||||
)
|
||||
|
||||
demos=(
|
||||
"cstrike-muliplayer-1"
|
||||
"rehlds-phys-single1"
|
||||
"crossfire-1-multiplayer-1"
|
||||
"shooting-hl-1"
|
||||
)
|
||||
|
||||
retVal=0
|
||||
for i in "${!demos[@]}"; do
|
||||
params=$(cat "testdemos/${demos[i]}.params")
|
||||
|
||||
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[0m"
|
||||
echo -e " - \e[0;33mParameters $params\e[0m"
|
||||
|
||||
wine hlds.exe --rehlds-enable-all-hooks --rehlds-test-play "testdemos/${demos[i]}.bin" $params &> result.log || retVal=$?
|
||||
|
||||
if [ $retVal -ne 777 ] && [ $retVal -ne 9 ]; then
|
||||
# Print with catchy messages
|
||||
while read line; do
|
||||
echo -e " \e[0;33m$line"
|
||||
done <<< $(cat result.log | sed '0,/demo failed/I!d;/wine:/d;/./,$!d')
|
||||
|
||||
echo " 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸 🔸"
|
||||
while read line; do
|
||||
echo -e " \e[1;31m$line";
|
||||
done < rehlds_demo_error.txt
|
||||
echo -e " \e[30;41mExit code: $retVal\e[0m"
|
||||
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;31m Failed ❌"
|
||||
exit 6 # Test demo failed
|
||||
else
|
||||
# Print result HLDS console
|
||||
while read line; do
|
||||
echo -e " \e[0;33m$line"
|
||||
done <<< $(cat result.log | sed '/wine:/d;/./,$!d')
|
||||
echo -e " \e[30;43mExit code: $retVal\e[0m"
|
||||
echo -e "\e[1m[$((i + 1))/${#demos[@]}] \e[1;36m${descs[i]} testing...\e[1;32m Succeed ✔"
|
||||
fi
|
||||
done
|
||||
- name: Play test
|
||||
env:
|
||||
demo: ${{ matrix.test.file }}
|
||||
desc: ${{ matrix.test.desc }}
|
||||
run: ./runTest.sh
|
||||
|
||||
linux:
|
||||
name: 'Linux'
|
||||
runs-on: ubuntu-latest
|
||||
container: s1lentq/linux86buildtools:latest
|
||||
runs-on: ubuntu-24.04
|
||||
container: debian:11-slim
|
||||
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
apt-get install -y \
|
||||
gcc-multilib g++-multilib \
|
||||
build-essential \
|
||||
libc6-dev libc6-dev-i386 \
|
||||
git cmake rsync \
|
||||
g++ gcc
|
||||
|
||||
- name: Configure
|
||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: GPG Import
|
||||
run: |
|
||||
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
|
||||
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
|
||||
|
||||
# Import the public key
|
||||
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failed to import the public key"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Import the private key
|
||||
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Error: Failed to import the private key"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Extract the fingerprint of the imported public key
|
||||
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
|
||||
|
||||
# Check if the fingerprint was extracted
|
||||
if [[ -z "$GPG_LINUX_FINGERPRINT" ]]; then
|
||||
echo "Error: Failed to extract the fingerprint of the key"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Set the trust level for the key
|
||||
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to set trust for the key $GPG_LINUX_FINGERPRINT"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
echo "Key $GPG_LINUX_FINGERPRINT successfully imported and trusted"
|
||||
gpg --list-keys
|
||||
|
||||
#export for global use
|
||||
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
if: github.event_name != 'pull_request'
|
||||
|
||||
- name: Build and Run unittests
|
||||
run: |
|
||||
rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
||||
rm -rf build && cmake -DCMAKE_BUILD_TYPE=Unittests -B build && cmake --build build -j8
|
||||
retVal=0
|
||||
export LD_LIBRARY_PATH="rehlds/lib/linux32:$LD_LIBRARY_PATH"
|
||||
./build/rehlds/engine_i486 2> /dev/null > result.log || retVal=$?
|
||||
@ -183,9 +316,9 @@ jobs:
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Build using Intel C++ Compiler
|
||||
- name: Build using GCC Compiler
|
||||
run: |
|
||||
rm -rf build && CC=icc CXX=icpc cmake -B build && cmake --build build -j8
|
||||
rm -rf build && cmake -B build && cmake --build build -j8
|
||||
|
||||
- name: Prepare HLSDK
|
||||
run: |
|
||||
@ -198,7 +331,8 @@ jobs:
|
||||
|
||||
- name: Move files
|
||||
run: |
|
||||
mkdir -p publish/bin/linux32/valve/dlls
|
||||
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
|
||||
@ -228,31 +362,25 @@ jobs:
|
||||
shell: bash
|
||||
|
||||
- name: Deploy artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@v4
|
||||
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:
|
||||
name: 'Publish'
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-24.04
|
||||
needs: [windows, testdemos, linux]
|
||||
|
||||
steps:
|
||||
- name: Deploying linux artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: linux32
|
||||
|
||||
- name: Deploying windows artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: win32
|
||||
|
||||
@ -270,18 +398,68 @@ jobs:
|
||||
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/')
|
||||
- name: Set SIGN_READY env
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "release" && \
|
||||
"${{ github.event.action }}" == "published" && \
|
||||
"${{ github.ref }}" == refs/tags/* ]]; then
|
||||
echo "SIGN_READY=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "SIGN_READY=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Final signing and Packaging bin/dbg
|
||||
id: packaging-job
|
||||
run: |
|
||||
if [[ "$SIGN_READY" == "true" ]]; then
|
||||
echo "Signing avalible."
|
||||
|
||||
echo "${{ secrets.PUB_ASC }}" > "${{ secrets.PUB_ASC_FILE }}"
|
||||
echo "${{ secrets.KEY_ASC }}" > "${{ secrets.KEY_ASC_FILE }}"
|
||||
gpg --batch --yes --import "${{ secrets.PUB_ASC_FILE }}"
|
||||
gpg --batch --yes --import "${{ secrets.KEY_ASC_FILE }}"
|
||||
GPG_LINUX_FINGERPRINT=$(gpg --list-keys --with-colons | grep '^fpr' | head -n 1 | cut -d: -f10)
|
||||
echo "$GPG_LINUX_FINGERPRINT:6:" | gpg --batch --import-ownertrust
|
||||
echo "GPG_LINUX_FINGERPRINT=$GPG_LINUX_FINGERPRINT" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Signing skipped."
|
||||
fi
|
||||
|
||||
sign_file() {
|
||||
if [[ "$SIGN_READY" == "true" ]]; then
|
||||
local file=$1
|
||||
gpg --batch --yes --detach-sign --armor -u "$GPG_LINUX_FINGERPRINT" "$file"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to sign $file"
|
||||
exit 2
|
||||
fi
|
||||
echo "$file signed successfully."
|
||||
else
|
||||
echo "$file not signed (SIGN_READY=$SIGN_READY)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Pack and try sign final archive
|
||||
7z a -tzip rehlds-bin-${{ env.APP_VERSION }}.zip bin/ hlsdk/
|
||||
sign_file "rehlds-bin-${{ env.APP_VERSION }}.zip"
|
||||
|
||||
# Pack and try sign final archive
|
||||
7z a -t7z -m0=lzma2 -mx=9 -mfb=64 -aoa rehlds-dbg-${{ env.APP_VERSION }}.7z debug/
|
||||
sign_file "rehlds-dbg-${{ env.APP_VERSION }}.7z"
|
||||
|
||||
shell: bash
|
||||
|
||||
- name: Publish artifacts
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: rehlds-ci-${{ env.APP_VERSION }}
|
||||
path: |
|
||||
*.zip
|
||||
*.7z
|
||||
*.asc
|
||||
|
||||
- name: Release artifacts
|
||||
uses: softprops/action-gh-release@v2
|
||||
id: publish-job
|
||||
if: |
|
||||
startsWith(github.ref, 'refs/tags/') &&
|
||||
@ -290,11 +468,7 @@ jobs:
|
||||
files: |
|
||||
*.zip
|
||||
*.7z
|
||||
*.asc
|
||||
|
||||
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
|
||||
|
307
CHANGELOG.md
Normal file
307
CHANGELOG.md
Normal file
@ -0,0 +1,307 @@
|
||||
# [ReHLDS](https://github.com/ReHLDS/ReHLDS) Changelog
|
||||
|
||||
**ReHLDS** is a result of reverse engineering of original `HLDS` (build `6152`/`6153`) using `DWARF` debug info embedded into linux version of `HLDS`, `engine_i486.so`.
|
||||
|
||||
Along with reverse engineering, a lot of defects and (potential) bugs were found and fixed.
|
||||
|
||||
---
|
||||
|
||||
## [`3.14.0.857`](https://github.com/rehlds/rehlds/releases/tag/3.14.0.857) - 2025-03-27
|
||||
|
||||
### Added
|
||||
- Added cvarhook from latest HLDS build. Making `mapcyclefile`/`sv_cheats` work in realtime (resolve #868) by @s1lentq in https://github.com/rehlds/ReHLDS/commit/6f031901cfa85d86c6028086bc9335db1e867a03
|
||||
- Added forgotten CVar `sys_timescale` by @s1lentq
|
||||
- Add support cheats commands: `god`, `notarget`, `noclip` by @s1lentq (https://github.com/rehlds/ReHLDS/commit/7fcec97af4c6598ab6a65d60cf424b7775a11729);
|
||||
- engine: add `sv_allow_autoaim` cvar for `HL25` DLL compatibility by @a1batross in #1000;
|
||||
- Added new CVar: `r_cachestudio` by @s1lentq in https://github.com/rehlds/ReHLDS/commit/0af97d98bbe31af26395ba616d4be6a089f691b6;
|
||||
- Implement commands `rcon_adduser`, `rcon_deluser`, `rcon_users` to allow use RCON only by known user IPs (Resolves https://github.com/rehlds/ReHLDS/pull/796)
|
||||
SV_Rcon: Minor refactoring by @s1lentq in https://github.com/rehlds/ReHLDS/commit/62407e0dd63542f0da8438ebb22b33d3bcab3b9d;
|
||||
- Implemented optional CVar `sv_tags` for sets a string defining the "gametags" for this server to allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value by @s1lentq in https://github.com/rehlds/ReHLDS/commit/76cbd2c14025b3e54bc14b8fcfe17ce5fa273195;
|
||||
- Add `SV_SendResources` hook by @ShadowsAdi in #1024;
|
||||
- Implement API interface game message manager by @s1lentq in https://github.com/rehlds/ReHLDS/commit/c9f9bbfff98cdb6e8ca45b9ab626f40d0c7bb22b;
|
||||
- CalcSurfaceExtents: MAX_SURFACE_TEXTURE_SIZE limit increased from 256 to 512 by @s1lentq in https://github.com/rehlds/ReHLDS/commit/b29740c19e8cfe7a1ee0605cadccd05b35e8678e;
|
||||
- Added new CVars for improved handling of decompression failures by @s1lentq in https://github.com/rehlds/ReHLDS/commit/64c684af4a8e6030b9e06a59a774d6efd92db352;
|
||||
- Added codesign and resources by @stamepicmorg in https://github.com/rehlds/ReHLDS/pull/1069;
|
||||
|
||||
|
||||
### Fixed
|
||||
- Fixed reversing mistake, missing checking string for null by @s1lentq in https://github.com/rehlds/ReHLDS/commit/2ba27d409c364d12c01b6b72813ac4b991a6e224;
|
||||
- Host_Motd_f: Fixed viewing motd when motdfile is not specified by @s1lentq in https://github.com/rehlds/ReHLDS/commit/de3679f0391f1452532c820f07a8c4042b1c4281;
|
||||
- FIX: Don't exec config file when exceed limit text buffer by @s1lentq in https://github.com/rehlds/ReHLDS/commit/32857e77859789275daeb353a278cd6632c2b6bf;
|
||||
- Prevent crash `Cache_UnlinkLRU: NULL link` on client-side if aiment with sprite model will be to render as a studio model by @s1lentq in https://github.com/rehlds/ReHLDS/commit/5002ff9abe86e9573952e2dc45ec9229d0044a3b;
|
||||
- RCON: Fixes redirect print and minor refactoring by @s1lentq in https://github.com/rehlds/ReHLDS/commit/41c5186b2c8c00f49101ed2c5d81a47cf79449c4;
|
||||
- Host_Status_f: Fixed incorrect player index to output by @s1lentq in https://github.com/rehlds/ReHLDS/commit/9b0dbe8dd2ced5f0ead251116f5b9ebd61f6d6a4;
|
||||
- MSG_WriteBitAngle: Cap the precision check from 32 to 22 to avoid overflow issues when representing angles with more than 22 bits because the multiply by 'shift' may result in overflow by @s1lentq in https://github.com/rehlds/ReHLDS/commit/63fde229c98f7e1bb8f7ea9b8358027414ed26ac;
|
||||
- Fix reversing mistake in `TEX_InitFromWad` (Don't add file handle before check) by @s1lentq in https://github.com/rehlds/ReHLDS/commit/a7b60451f33e076ba04e4ae38312c2f691540a2d
|
||||
- Fix crash when the entity with aiment doesn't have a model by @s1lentq in https://github.com/rehlds/ReHLDS/commit/498d7e0d18060f53a65286fcbf91e772f42c5611;
|
||||
- SV_WriteEntitiesToClient: Reset movetype if the aiment index is invalid by @s1lentq in https://github.com/rehlds/ReHLDS/commit/58391b6ee5e5faefcf84349443a2a36066ed8246;
|
||||
- SV_ParseResourceList: Do not uploading according to `sv_allowupload` CVar by @s1lentq in https://github.com/rehlds/ReHLDS/commit/59ed3f6867b1b3cba69cd7650887841da8e76d42;
|
||||
- Do not send customizations list on duplicate or missing resource by @s1lentq in https://github.com/rehlds/ReHLDS/commit/f26ad71aba6a596602245c64af71cd196196859f;
|
||||
- Do not propagate custom logos according to sv_send_logos cvar by @s1lentq in https://github.com/rehlds/ReHLDS/commit/ec47e4d97834c35f8667684f15a372c85505ce55;
|
||||
- Draw_ValidateCustomLogo: Fixed incorrect offset to palette size by @s1lentq in https://github.com/rehlds/ReHLDS/commit/3c282b435c7d0508d72104d26a0c9171f7feea71;
|
||||
- Netchan_CreateFileFragments: Fixed a hang connection on verifying resource stage, when precached file exists but is absolutely empty by @s1lentq in https://github.com/rehlds/ReHLDS/commit/61ee4f926938b1894bedfd9f139d45db48d89903;
|
||||
- Implemented reduction of impact caused by zip-bomb exploit by @s1lentq in https://github.com/rehlds/ReHLDS/pull/994;
|
||||
- Improved behavior of `sv_filterban 0`. Fixes https://github.com/rehlds/ReHLDS/issues/1027 by @s1lentq in https://github.com/rehlds/ReHLDS/commit/693b51c8839847270048be40b62fb1d37f9954ae;
|
||||
- Fixed GCC compilation warnings/errors. Fixes https://github.com/rehlds/ReHLDS/issues/1032 by @s1lentq in https://github.com/rehlds/ReHLDS/commit/9c1e84328ebcdb47ea83c157dd8c7e493dda28a6;
|
||||
- [HLTV]: Fix reverse-engineering mistake in `ObjectDictionary::RemoveIndex` by @s1lentq in https://github.com/rehlds/ReHLDS/commit/ed954a710fb0888328db1bd9b2c916cf9fc63062;
|
||||
- [HLTV]: Fix reverse-engineering mistake in `World::WritePacketEntities` by @s1lentq in https://github.com/rehlds/ReHLDS/commit/c8308a2c60d34e4f735b3404f86701109e85f73b;
|
||||
- fix setting ucmd in `sv_user.cpp` related to https://github.com/rehlds/ReHLDS/issues/1041 by @overl4y in https://github.com/rehlds/ReHLDS/pull/1042;
|
||||
- SV_ProcessFile: Ignore customization file uploads if upload is disabled by @s1lentq in https://github.com/rehlds/ReHLDS/commit/fe184a82e0a361b9e8bd1625ca93fac948467be1;
|
||||
- CI Workflow Improvements and Fixes by @SergeyShorokhov in #1056;
|
||||
- Improved movevars sync logic for clients, allowing independent sync of movement props for each client, regardless of global movevars by @s1lentq in https://github.com/rehlds/ReHLDS/commit/df862d9bb6069084ee17b23135152c57b748e40e;
|
||||
- FIX: potential crash in `PrecacheModelSounds` by @s1lentq in https://github.com/rehlds/ReHLDS/commit/18b173d5c6715eaf052a979984622f867661cd7b;
|
||||
- FIX: crash due fakeclient by @s1lentq in https://github.com/rehlds/ReHLDS/commit/e54adb089c816425bac43c7eaf6fc5b898401fb4;
|
||||
- Netchan_CopyFileFragments: fix typo by @s1lentq in https://github.com/rehlds/ReHLDS/commit/1a684077109023f86cfe9b70d6a1bba92a35c5f6;
|
||||
|
||||
|
||||
### Changed
|
||||
- Improve `pfnShouldCollide` condition on `SV_ClipToLinks` by @dystopm in #985
|
||||
- Minor refactor (add `BoundsIntersect` function) by @Hamdi #986
|
||||
- Reworked AlertMessage by @s1lentq in https://github.com/rehlds/ReHLDS/commit/93f5775ac26240782981f47ee8e052fb53d30877
|
||||
- CI/CD update:
|
||||
- Draw_ValidateCustomLogo: Minor refactoring & cleanup by @s1lentq in https://github.com/rehlds/ReHLDS/commit/174414db81116b3647e7bb1b906417d6a38ed3a3;
|
||||
- HPAK_ResourceForHash: Remove message with missing custom.hpk by @s1lentq in https://github.com/rehlds/ReHLDS/commit/516bb936271b1cf8523d6f97a421370128a7c964;
|
||||
- SV_CreateCustomizationList: spew logs in only dev mode by @s1lentq in https://github.com/rehlds/ReHLDS/commit/462fe55fb832209270118b6def6034f8eec6efbf;
|
||||
- CalcSurfaceExtents: more info in extents error message by @s1lentq in https://github.com/rehlds/ReHLDS/commit/6e6368da300f7d024076e6272faa135280cf3bda;
|
||||
- Move SV_CheckMovingGround into SV_Physics by @dystopm in #1045;
|
||||
- `IP` and `IPX` allocation warnings move under `-dev` arg by @SergeyShorokhov in #1071;
|
||||
|
||||
## New Contributors
|
||||
* @dystopm made their first contribution in https://github.com/rehlds/ReHLDS/pull/985
|
||||
* @anzz1 made their first contribution in https://github.com/rehlds/ReHLDS/pull/1021
|
||||
* @jonathan-up made their first contribution in https://github.com/rehlds/ReHLDS/pull/1040
|
||||
* @overl4y made their first contribution in https://github.com/rehlds/ReHLDS/pull/1042
|
||||
* @stamepicmorg made their first contribution in https://github.com/rehlds/ReHLDS/pull/1058
|
||||
|
||||
**Full Changelog**: [3.13.0.788...3.14.0.857](https://github.com/rehlds/rehlds/compare/3.13.0.788...3.14.0.857)
|
||||
|
||||
## [`3.13.0.788`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.13.0.788) - 2023-07-12
|
||||
|
||||
### Added
|
||||
- Added `SV_AllowPhysent` hook by @justgo97 in [(#951)](ttps://github.com/dreamstalker/ReHLDS/pull/951)
|
||||
- `GetBonePosition`: Added bone index bounds check
|
||||
- `GetAttachment`: Added attachment index bounds check
|
||||
- Added more checks for possible `numleaf` overflow
|
||||
|
||||
### Fixed
|
||||
- `SV_BuildSoundMsg`: fix '`\n`' in args check
|
||||
|
||||
### Changed
|
||||
- Revert "change destinition folder for linux build" by @wopox1337 in [(#977)](https://github.com/dreamstalker/ReHLDS/pull/977)
|
||||
- Allowed the clients to connect on the server of different game: Client should be use `setinfo _gd <game>`
|
||||
- Increased limit leafs `MAX_MAP_LEAFS` up to `32767`
|
||||
|
||||
## New Contributors
|
||||
- @justgo97 made their first contribution in [(#951)](https://github.com/dreamstalker/ReHLDS/pull/951)
|
||||
|
||||
**Full Changelog**: [3.12.0.780...3.13.0.788](https://github.com/ReHLDS/ReHLDS/compare/3.12.0.780...3.13.0.788)
|
||||
|
||||
## [`3.12.0.780`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.12.0.780) - 2022-09-19
|
||||
|
||||
### Fixed
|
||||
- `Netchan_CreateFileFragments`: Fixed a very old and rare bug with dlfile while downloading direct from server, when content of resource size is less than header size first fragment.
|
||||
|
||||
### Changed
|
||||
- `API`: Implement `*_Precache_*`, `ClientPrintf`, `CheckUserInfo` and `AddResource` hooks by @ShadowsAdi in [(#903)](https://github.com/dreamstalker/ReHLDS/pull/903)
|
||||
|
||||
## New Contributors
|
||||
* @ShadowsAdi made their first contribution in [(#903)](https://github.com/dreamstalker/ReHLDS/pull/903)
|
||||
|
||||
**Full Changelog**: [3.11.0.779...3.12.0.780](https://github.com/ReHLDS/ReHLDS/compare/3.11.0.779...3.12.0.780)
|
||||
|
||||
## [`3.11.0.779`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.11.0.779) - 2022-08-24
|
||||
|
||||
### Fixed
|
||||
- `StripUnprintableWorker` did not count the null terminator [e9045e3](https://github.com/dreamstalker/ReHLDS/commit/e9045e3)
|
||||
- Very old and rare bug in function `Netchan_CreateFileFragments` with dlfile hang while downloading direct from server, when content of resource size is less than header size first fragment [d76b06d](https://github.com/dreamstalker/ReHLDS/commit/d76b06d)
|
||||
|
||||
**Full Changelog**: [3.11.0.777...3.11.0.779](https://github.com/ReHLDS/ReHLDS/compare/3.11.0.777...3.11.0.779)
|
||||
|
||||
## [`3.11.0.777`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.11.0.777) - 2022-06-20
|
||||
|
||||
### Fixed
|
||||
* Fixed `null or empty` input string in `COM_LoadFile` (`FS_Open` with input empty string `""` will succeed on some POSIX systems)
|
||||
- Resolved [(#919)](https://github.com/dreamstalker/ReHLDS/issues/919)
|
||||
|
||||
**Full Changelog**: [3.11.0.776...3.11.0.777](https://github.com/ReHLDS/ReHLDS/compare/3.11.0.776...3.11.0.777)
|
||||
|
||||
## [`3.11.0.776`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.11.0.776) - 2022-04-20
|
||||
|
||||
### Fixed
|
||||
* Fixed typo `ZONE_DYNAMIC_SIZE`
|
||||
|
||||
**Full Changelog**: [3.11.0.767...3.11.0.776](https://github.com/ReHLDS/ReHLDS/compare/3.11.0.767...3.11.0.776)
|
||||
|
||||
## [`3.11.0.767`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.11.0.767) - 2021-10-25
|
||||
|
||||
### Added
|
||||
* Implement `SV_EmitPings()` hook by @francoromaniello in [(#858)](https://github.com/ReHLDS/ReHLDS/pull/858)
|
||||
* Implement `Con_Printf()` hook by @francoromaniello in [(#861)](https://github.com/ReHLDS/ReHLDS/pull/861)
|
||||
|
||||
### Changed
|
||||
* `API`: Add hooks `ED_Alloc()` & `ED_Free()`. by @StevenKal in [(#867)](https://github.com/ReHLDS/ReHLDS/pull/867)
|
||||
* `SV_HullForEntity`: better log in `Sys_Error` by @wopox1337 in [(#843)](https://github.com/ReHLDS/ReHLDS/pull/843)
|
||||
* Update on grammar/spelling by @mlgpero in [(#865)](https://github.com/ReHLDS/ReHLDS/pull/865)
|
||||
|
||||
## New Contributors
|
||||
* @StevenKal made their first contribution in [(#867)](https://github.com/ReHLDS/ReHLDS/pull/867)
|
||||
* @francoromaniello made their first contribution in [(#858)](https://github.com/ReHLDS/ReHLDS/pull/858)
|
||||
* @Urufusan made their first contribution in [(#865)](https://github.com/ReHLDS/ReHLDS/pull/865)
|
||||
|
||||
**Full Changelog**: [v3.10.0.761...3.11.0.767](https://github.com/ReHLDS/ReHLDS/compare/v3.10.0.761...3.11.0.767)
|
||||
|
||||
## [`3.10.0.760`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.10.0.760) - 2021-06-23
|
||||
|
||||
### Changed
|
||||
- Changed the destination folder for `Linux build` [(#842)](https://github.com/ReHLDS/ReHLDS/pull/842).
|
||||
- Temporary removed `Windows build`. :warning:
|
||||
|
||||
**Full Changelog**: [3.10.0.759...3.10.0.760](https://github.com/ReHLDS/ReHLDS/compare/3.10.0.759...3.10.0.760)
|
||||
|
||||
|
||||
## [`3.10.0.761`](https://github.com/ReHLDS/ReHLDS/releases/tag/v3.10.0.761) - 2021-06-23
|
||||
|
||||
### Changed
|
||||
- Reset `m_bSentNewResponse` to allow new connection when the client goes through the full stage of connection (`cl:connect` -> `sv:S2C_CONNECTION` -> `cl:new` -> `SV_New_f`)
|
||||
- Related [3a9bfb9](https://github.com/ReHLDS/ReHLDS/commit/3a9bfb9)
|
||||
|
||||
**Full Changelog**: [3.10.0.760...v3.10.0.761](https://github.com/ReHLDS/ReHLDS/compare/3.10.0.760...v3.10.0.761)
|
||||
|
||||
## [`3.10.0.760`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.10.0.760) - 2021-06-23
|
||||
|
||||
### Changed
|
||||
- Changed the destination folder for `Linux build` [(#842)](https://github.com/ReHLDS/ReHLDS/pull/842).
|
||||
- Temporary removed `Windows build`. :warning:
|
||||
|
||||
**Full Changelog**: [3.10.0.759...3.10.0.760](https://github.com/ReHLDS/ReHLDS/compare/3.10.0.759...3.10.0.760)
|
||||
|
||||
## [`3.10.0.759`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.10.0.759) - 2021-06-22
|
||||
|
||||
### Fixed
|
||||
- Fixed volume checking in emit sound [(#341)](https://github.com/ReHLDS/ReHLDS/pull/341)
|
||||
- `static_map.h`: fix lowercase convert [(#806)](https://github.com/ReHLDS/ReHLDS/pull/806)
|
||||
- `SV_New_f`: Deny new connection twice at a time if user messages are received;
|
||||
- `SV_ReadClientMessage`: Fixed empty names on bad read.
|
||||
|
||||
### Changed
|
||||
- `sv_user.cpp`: Small code refactoring [(#810)](https://github.com/ReHLDS/ReHLDS/pull/810)
|
||||
- `ReHLDS API`: Enhanced IGameClient/IRehldsServerData/IRehldsServerStatic interfaces
|
||||
- `sv_main.cpp`: SV_New_f() uses Q_snprintf() unsafe format. #807 [()](https://github.com/ReHLDS/ReHLDS/pull/807)
|
||||
|
||||
**Full Changelog**: [3.9.0.752...3.10.0.759](https://github.com/ReHLDS/ReHLDS/compare/3.9.0.752...3.10.0.759)
|
||||
|
||||
## [`3.9.0.752`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.9.0.752) - 2021-06-14
|
||||
|
||||
### Added
|
||||
- `ReHLDS API`: Add GetEntityInit hook [(#832)](https://github.com/ReHLDS/ReHLDS/pull/832)
|
||||
- Implement CVar `sv_usercmd_custom_random_seed` [(#837)](https://github.com/ReHLDS/ReHLDS/pull/837)
|
||||
|
||||
### Fixed
|
||||
- `HLTV`: Fix crash in ProcessStringCmd [(#838)](https://github.com/ReHLDS/ReHLDS/pull/838)
|
||||
|
||||
### Changed
|
||||
- `SV_ParseMove`, `SV_ParseConsistencyResponse`: check length
|
||||
|
||||
**Full Changelog**: [3.8.0.739...3.9.0.752](https://github.com/ReHLDS/ReHLDS/compare/3.8.0.739...3.9.0.752)
|
||||
|
||||
## [`3.8.0.739`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.8.0.739) - 2021-04-21
|
||||
|
||||
### Added
|
||||
* Added libraries libm/librt built on `GLIBC` `2.11.1` [(#827)](https://github.com/ReHLDS/ReHLDS/pull/827)
|
||||
|
||||
### Fixed
|
||||
* `QuaternionSlerp`: Fixed wrong values [(#763)](https://github.com/ReHLDS/ReHLDS/pull/763)
|
||||
|
||||
### Changed
|
||||
* Updated `Intel C++ Compiler` version `17.0` up to `19.0`
|
||||
|
||||
**Full Changelog**: [3.8.0.723...3.8.0.739](https://github.com/ReHLDS/ReHLDS/compare/3.8.0.723...3.8.0.739)
|
||||
|
||||
## [`3.8.0.723`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.8.0.723) - 2021-03-23
|
||||
|
||||
### Fixed
|
||||
* `CalcSurfaceExtents:` Fixed a fatal error on some maps due loss of floating point
|
||||
* `HLTV:` ExecuteString Fix parser [(#821)](https://github.com/ReHLDS/ReHLDS/pull/821)
|
||||
|
||||
### Changed
|
||||
* `HLTV:` Downgrade GLIBC version
|
||||
|
||||
**Full Changelog**: [3.8.0.715...3.8.0.723](https://github.com/ReHLDS/ReHLDS/compare/3.8.0.715...3.8.0.723)
|
||||
|
||||
## [`3.8.0.715`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.8.0.715) - 2021-03-18
|
||||
|
||||
### Fixed
|
||||
* Make sure the `timer` is high precision [(#799)](https://github.com/ReHLDS/ReHLDS/pull/799)
|
||||
|
||||
**Full Changelog**: [3.8.0.711...3.8.0.715](https://github.com/ReHLDS/ReHLDS/compare/3.8.0.711...3.8.0.715)
|
||||
|
||||
## [`3.8.0.711`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.8.0.711) - 2021-02-06
|
||||
|
||||
### Added
|
||||
* `HLTV`: Added new chatdelay command [(#777)](https://github.com/ReHLDS/ReHLDS/pull/777)
|
||||
* `HLTV`: prevent clients from setting userinfo * keys with setinfo command [(#792)](https://github.com/ReHLDS/ReHLDS/pull/792)
|
||||
* `Cbuf_Execute`: Add checks commented out for multi-lines [(#719)](https://github.com/ReHLDS/ReHLDS/pull/719)
|
||||
|
||||
### Fixed
|
||||
* Fixed local-buffer overrun, may undefined behavior with hitboxes blending or crash (reverse-engineering mistake) [722e19d](https://github.com/ReHLDS/ReHLDS/commit/722e19d)
|
||||
* Fixed dos attack on connection challenges system [(#802)](https://github.com/ReHLDS/ReHLDS/pull/802)
|
||||
* Fixed crash `COM_ListMaps` [(#791)](https://github.com/ReHLDS/ReHLDS/pull/791)
|
||||
|
||||
**Full Changelog**: [3.8.0.702...3.8.0.711](https://github.com/ReHLDS/ReHLDS/compare/3.8.0.702...3.8.0.711)
|
||||
|
||||
## [`3.8.0.702`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.8.0.702) - 2020-11-09
|
||||
|
||||
### Fixed
|
||||
* Fixed crash `MSG_ReadFloat`
|
||||
|
||||
### Changed
|
||||
* **ReHLDS API:** Implemented `SV_ShouldSendConsistencyList`
|
||||
* **ReHLDS API:** Bump minor
|
||||
|
||||
**Full Changelog**: [3.7.0.698...3.8.0.702](https://github.com/ReHLDS/ReHLDS/compare/3.7.0.698...3.8.0.702)
|
||||
|
||||
## [`3.7.0.698`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.7.0.698) - 2020-08-19
|
||||
|
||||
### Added
|
||||
* Graceful shutdown on sigterm [(#776)](https://github.com/ReHLDS/ReHLDS/pull/776)
|
||||
- Add players kick on `SIGINT \ SIGTERM`
|
||||
- Add SIGINT & SIGTERM handling linux console
|
||||
|
||||
### Changed
|
||||
* Changed shutdown method
|
||||
|
||||
**Full Changelog**: [3.7.0.697...3.7.0.698](https://github.com/ReHLDS/ReHLDS/compare/3.7.0.697...3.7.0.698)
|
||||
|
||||
## [`3.7.0.697`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.7.0.697) - 2020-08-10
|
||||
|
||||
### Fixed
|
||||
* **SV_ProcessFile:** Wrap `Con_Printf` in `Con_NetPrintf` to avoid spam in HLDS console
|
||||
|
||||
**Full Changelog**: [3.7.0.696...3.7.0.697](https://github.com/ReHLDS/ReHLDS/compare/3.7.0.696...3.7.0.697)
|
||||
|
||||
## [`3.7.0.696`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.7.0.696) - 2020-05-18
|
||||
|
||||
### Added
|
||||
* Implement `svc_exec` support in the engine and HLTV [(#737)](https://github.com/ReHLDS/ReHLDS/pull/737)
|
||||
- Added `svc_exec` to the list of svc commands in engine
|
||||
- Added `svc_exec` support to HLTV code
|
||||
- Made the engine code forward-compatible with future svc_* additions
|
||||
- Added reserved svc_* slots in the enumerations
|
||||
|
||||
**Full Changelog**: [3.7.0.695...3.7.0.696](https://github.com/ReHLDS/ReHLDS/compare/3.7.0.695...3.7.0.696)
|
||||
|
||||
## [`3.7.0.695`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.7.0.695) - 2020-04-06
|
||||
|
||||
### Fixed
|
||||
* Vulnerability fix WAD part 2
|
||||
- Client-side: Fixed a potential vulnerability from bogus `tempdecal.wad`
|
||||
|
||||
**Full Changelog**: [3.7.0.694...3.7.0.695](https://github.com/ReHLDS/ReHLDS/compare/3.7.0.694...3.7.0.695)
|
||||
|
||||
## [`3.7.0.694`](https://github.com/ReHLDS/ReHLDS/releases/tag/3.7.0.694) - 2020-03-20
|
||||
|
||||
### Fixed
|
||||
* Vulnerability fix WAD part 1
|
||||
- Server-side: Fixed a potential vulnerability from bogus `tempdecal.wad`
|
||||
|
||||
**Full Changelog**: [3.7.0.694](https://github.com/ReHLDS/ReHLDS/commits/3.7.0.694)
|
696
LICENSE
696
LICENSE
@ -1,675 +1,21 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
{one line to give the program's name and a brief idea of what it does.}
|
||||
Copyright (C) {year} {name of author}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
{project} Copyright (C) {year} {fullname}
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014–2025 ReHLDS Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the “Software”), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
16
LICENSE-TRANSITION.md
Normal file
16
LICENSE-TRANSITION.md
Normal file
@ -0,0 +1,16 @@
|
||||
# License Transition Notice
|
||||
|
||||
ReHLDS was originally licensed under the GNU General Public License v3.0 (GPLv3).
|
||||
|
||||
As of July 2025, the project has transitioned to the MIT License with the explicit agreement of the major contributors, including:
|
||||
|
||||
- dreamstalker
|
||||
- s1lent
|
||||
- WPMGPRoSToTeMa
|
||||
- Lev
|
||||
- wopox
|
||||
|
||||
All significant contributors have agreed to this license transition.
|
||||
All previous contributions are now considered to be licensed under the MIT License unless otherwise noted.
|
||||
|
||||
For questions, contact us via GitHub or the ReHLDS dev chat.
|
81
README.md
81
README.md
@ -1,4 +1,4 @@
|
||||
# ReHLDS [](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml) [](https://github.com/dreamstalker/rehlds/releases/latest) []() [](http://isitmaintained.com/project/dreamstalker/rehlds "Percentage of issues still open") [](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" />
|
||||
# ReHLDS [](https://github.com/rehlds/ReHLDS/actions/workflows/build.yml) [](https://github.com/rehlds/ReHLDS/releases/latest)  [](http://isitmaintained.com/project/rehlds/ReHLDS "Percentage of issues still open") [](https://www.gnu.org/licenses/gpl-3.0) [](https://www.bestpractices.dev/en/projects/10929) <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?
|
||||
@ -6,7 +6,16 @@ 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: [Game Tracker](http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version)
|
||||
You can try playing on one of many servers that are using ReHLDS: [Game Tracker](http://www.gametracker.com/search/?search_by=server_variable&search_by2=sv_version)
|
||||
|
||||
> [!TIP]
|
||||
> ReHLDS linux-releases now is signed via `GPG`, pubkey is: `63547829004f07716f7be4856c32c4282e60fb67` and could be found at [https://keyserver.ubuntu.com/](https://keyserver.ubuntu.com/pks/lookup?search=63547829004f07716f7be4856c32c4282e60fb67+&fingerprint=on&op=index).
|
||||
>
|
||||
> How to:
|
||||
> 1. [Download](https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x63547829004f07716f7be4856c32c4282e60fb67) `63547829004f07716f7be4856c32c4282e60fb67.asc` key
|
||||
> 2. Import: `gpg --import 63547829004f07716f7be4856c32c4282e60fb67.asc`
|
||||
> 3. Download release `archive` and `.asc` file.
|
||||
> 4. Verify: `gpg --verify some-rehlds.zip.asc some-rehlds.zip`.
|
||||
|
||||
## Goals of the project
|
||||
<ul>
|
||||
@ -14,46 +23,74 @@ You can try play on one of the servers that using rehlds: [Game Tracker](http://
|
||||
<li>Performance optimizations (use of SSE for vector math for example) is another goal for the future</li>
|
||||
</ul>
|
||||
|
||||
## 🛠 License
|
||||
|
||||
ReHLDS is licensed under the [MIT License](./LICENSE).
|
||||
|
||||
### License Transition
|
||||
> [!NOTE]
|
||||
> Originally released under [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html), ReHLDS transitioned to the MIT License in July 2025 with the agreement of the core contributors.
|
||||
> See [LICENSE-TRANSITION.md](./LICENSE-TRANSITION.md) for details.
|
||||
|
||||
## How can use it?
|
||||
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.
|
||||
ReHLDS is fully compatible with the official pre-anniversary edition of HLDS (engine version <= 8684) 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.
|
||||
|
||||
> [!CAUTION]
|
||||
> ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.
|
||||
|
||||
#### Downloading HLDS via steamcmd
|
||||
|
||||
```
|
||||
app_set_config 90 mod cstrike
|
||||
app_update 90 -beta steam_legacy validate
|
||||
```
|
||||
|
||||
## Downloads
|
||||
* [Release builds](https://github.com/dreamstalker/rehlds/releases)
|
||||
* [Dev builds](https://github.com/dreamstalker/rehlds/actions/workflows/build.yml)
|
||||
* [Release builds](https://github.com/rehlds/ReHLDS/releases)
|
||||
* [Dev builds](https://github.com/rehlds/ReHLDS/actions/workflows/build.yml)
|
||||
|
||||
ReHLDS binaries require `SSE`, `SSE2` and `SSE3` instruction sets to run and can benefit from `SSE4.1` and `SSE4.2`
|
||||
|
||||
<b>Warning!</b> ReHLDS is not binary compatible with original hlds since it's compiled with compilers other than ones used for original hlds.
|
||||
This means that plugins that do binary code analysis (Orpheu for example) probably will not work with rehlds.
|
||||
This means that plugins that do binary code analysis (Orpheu for example) probably will not work with ReHLDS.
|
||||
|
||||
## Configuring
|
||||
<details>
|
||||
<summary>Click to expand</summary>
|
||||
<ul>
|
||||
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
|
||||
<li>syserror_logfile <filename> // File for the system error log. Default: sys_error.log
|
||||
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
|
||||
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
|
||||
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an unknown command. Default: 0
|
||||
<li>sv_rcon_condebug <1|0> // Print rcon debug in the console. Default: 1
|
||||
<li>sv_force_ent_intersection <1|0> // In a 3-rd party plugins used to force colliding of SOLID_SLIDEBOX entities. Default: 0
|
||||
<li>sv_rehlds_force_dlmax <1|0> // Force a client's cl_dlmax cvar to 1024. It avoids an excessive packets fragmentation. Default: 0
|
||||
<li>sv_rehlds_hull_centering <1|0> // Use center of hull instead of corner. Default: 0
|
||||
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
|
||||
<li>syserror_logfile <filename> // File for the system error log. Default: sys_error.log
|
||||
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
|
||||
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
|
||||
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an unknown command. Default: 0
|
||||
<li>sv_rcon_condebug <1|0> // Print rcon debug in the console. Default: 1
|
||||
<li>sv_force_ent_intersection <1|0> // In a 3-rd party plugins used to force colliding of SOLID_SLIDEBOX entities. Default: 0
|
||||
<li>sv_rehlds_force_dlmax <1|0> // Force a client's cl_dlmax cvar to 1024. It avoids an excessive packets fragmentation. Default: 0
|
||||
<li>sv_rehlds_hull_centering <1|0> // Use center of hull instead of corner. Default: 0
|
||||
<li>sv_rehlds_movecmdrate_max_avg // Max average level of 'move' cmds for ban. Default: 400
|
||||
<li>sv_rehlds_movecmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
|
||||
<li>sv_rehlds_movecmdrate_max_burst // Max burst level of 'move' cmds for ban. Default: 2500
|
||||
<li>sv_rehlds_movecmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
|
||||
<li>sv_rehlds_send_mapcycle <1|0> // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
|
||||
<li>sv_rehlds_send_mapcycle <1|0> // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
|
||||
<li>sv_rehlds_stringcmdrate_max_avg // Max average level of 'string' cmds for ban. Default: 80
|
||||
<li>sv_rehlds_stringcmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
|
||||
<li>sv_rehlds_stringcmdrate_max_burst // Max burst level of 'string' cmds for ban. Default: 400
|
||||
<li>sv_rehlds_stringcmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
|
||||
<li>sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". See [wiki](https://github.com/dreamstalker/rehlds/wiki/Userinfo-keys) to collect sufficient set of keys for your server. Default: ""
|
||||
<li>sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". See [wiki](https://github.com/rehlds/ReHLDS/wiki/Userinfo-keys) to collect sufficient set of keys for your server. Default: ""
|
||||
<li>sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
|
||||
<li>sv_rehlds_maxclients_from_single_ip // Limit number of connections from the single ip address. Default: 5
|
||||
<li>sv_rehlds_maxclients_from_single_ip // Limit number of connections at the same time from single IP address, not confuse to already connected players. Default: 5
|
||||
<li>sv_rehlds_local_gametime <1|0> // A feature of local gametime which decrease "lags" if you run same map for a long time. Default: 0
|
||||
<li>sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
|
||||
<li>sv_usercmd_custom_random_seed // When enabled server will populate an additional random seed independent of the client. Default: 0
|
||||
<li>sv_net_incoming_decompression <1|0> // When enabled server will decompress of incoming compressed file transfer payloads. Default: 1
|
||||
<li>sv_net_incoming_decompression_max_ratio <0|100> // Sets the max allowed ratio between compressed and uncompressed data for file transfer. (A ratio close to 90 indicates large uncompressed data with low entropy) Default: 80.0
|
||||
<li>sv_net_incoming_decompression_max_size <16|65536> // Sets the max allowed size for decompressed file transfer data. Default: 65536 bytes
|
||||
<li>sv_net_incoming_decompression_min_failures <0|10> // Sets the min number of decompression failures required before a player's connection is flagged for potential punishment. Default: 4
|
||||
<li>sv_net_incoming_decompression_max_failures <0|10> // Sets the max number of decompression failures allowed within a specified time window before action is taken against the player. Default: 10
|
||||
<li>sv_net_incoming_decompression_min_failuretime: <0.1|10.0> // Sets the min time in secs within which decompression failures are tracked to determine if the player exceeds the failure thresholds. Default: 0.1
|
||||
<li>sv_net_incoming_decompression_punish // Time in minutes for which the player will be banned for malformed/abnormal bzip2 fragments (0 - Permanent, use a negative number for a kick). Default: -1
|
||||
<li>sv_tags <comma-delimited string list of tags> // Sets a string defining the "gametags" for this server, this is optional, but if it is set it allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value. Default: ""
|
||||
<li>sv_filterban <-1|0|1>// Set packet filtering by IP mode. -1 - All players will be rejected without any exceptions. 0 - No checks will happen. 1 - All incoming players will be checked if they're IP banned (if they have an IP filter entry), if they are, they will be kicked. Default: 1
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
@ -61,11 +98,14 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
|
||||
<ul>
|
||||
<li>rescount // Prints the total count of precached resources in the server console
|
||||
<li>reslist <sound | model | decal | generic | event> // Separately prints the details of the precached resources for sounds, models, decals, generic and events in server console. Useful for managing resources and dealing with the goldsource precache limits.
|
||||
<li>rcon_adduser <ipaddress/CIDR> // Add a new IP address or CIDR range to RCON user list (This command adds a new IP address to the RCON user list. The specified IP or CIDR range is granted privileged access to server console. Without any Rcon users, access is allowed to anyone with a valid password)</li>
|
||||
<li>rcon_deluser <ipaddress> {removeAll} // Remove an IP address or CIDR range from RCON user list</li>
|
||||
<li>rcon_users // List all IP addresses and CIDR ranges in RCON user list</li>
|
||||
</ul>
|
||||
|
||||
## Build instructions
|
||||
### Checking requirements
|
||||
There are several software requirements for building rehlds:
|
||||
There are several software requirements for building ReHLDS:
|
||||
|
||||
#### Windows
|
||||
<pre>
|
||||
@ -116,6 +156,7 @@ 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 cmake
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
|
@ -182,6 +182,7 @@ set(ENGINE_SRCS
|
||||
rehlds/public_amalgamation.cpp
|
||||
rehlds/rehlds_api_impl.cpp
|
||||
rehlds/rehlds_interfaces_impl.cpp
|
||||
rehlds/rehlds_messagemngr_impl.cpp
|
||||
rehlds/rehlds_security.cpp
|
||||
)
|
||||
|
||||
|
@ -170,7 +170,7 @@ byte *BSPModel::LeafPVS(mleaf_t *leaf)
|
||||
|
||||
byte *BSPModel::DecompressVis(unsigned char *in)
|
||||
{
|
||||
static unsigned char decompressed[MODEL_MAX_PVS];
|
||||
static unsigned char decompressed[MAX_MAP_LEAFS / 8];
|
||||
if (in == nullptr) {
|
||||
return m_novis;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "l_studio.h"
|
||||
#include "edict.h"
|
||||
#include "bspfile.h"
|
||||
|
||||
// values for model_t's needload
|
||||
#define NL_PRESENT 0
|
||||
@ -87,9 +88,7 @@ private:
|
||||
|
||||
protected:
|
||||
model_t m_model;
|
||||
|
||||
enum { MODEL_MAX_PVS = 1024 };
|
||||
byte m_novis[MODEL_MAX_PVS];
|
||||
byte m_novis[MAX_MAP_LEAFS / 8];
|
||||
byte *m_base;
|
||||
|
||||
int m_visframecount;
|
||||
|
@ -1060,15 +1060,18 @@ void World::ParseClientData(BitBuffer *stream, unsigned int deltaSeqNr, BitBuffe
|
||||
}
|
||||
}
|
||||
|
||||
// When a delta command is received from the server
|
||||
// We need to grab the entity # out of it any the bit settings, too
|
||||
int World::ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &numbase, bool &newbl, int &newblindex, bool full, int &offset)
|
||||
{
|
||||
int num;
|
||||
bool isdelta, isnext;
|
||||
bool isdelta;
|
||||
|
||||
offset = 0;
|
||||
custom = false;
|
||||
newbl = false;
|
||||
newbl = false;
|
||||
|
||||
// This full update (non-delta)
|
||||
if (full)
|
||||
{
|
||||
isdelta = stream->ReadBit() ? true : false;
|
||||
@ -1077,6 +1080,8 @@ int World::ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &
|
||||
else
|
||||
{
|
||||
isdelta = false;
|
||||
|
||||
// the entity was removed from server or not
|
||||
remove = stream->ReadBit() ? true : false;
|
||||
}
|
||||
|
||||
@ -1088,11 +1093,11 @@ int World::ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &
|
||||
{
|
||||
if (stream->ReadBit())
|
||||
{
|
||||
num = stream->ReadBits(11);
|
||||
num = stream->ReadBits(MAX_EDICT_BITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
int delta = stream->ReadBits(6);
|
||||
int delta = stream->ReadBits(DELTA_OFFSET_BITS);
|
||||
num = delta + numbase;
|
||||
}
|
||||
}
|
||||
@ -1105,20 +1110,19 @@ int World::ParseDeltaHeader(BitBuffer *stream, bool &remove, bool &custom, int &
|
||||
|
||||
if (m_MaxInstanced_BaseLine)
|
||||
{
|
||||
isnext = stream->ReadBit() ? true : false;
|
||||
if (isnext)
|
||||
newbl = stream->ReadBit() ? true : false;
|
||||
|
||||
if (newbl)
|
||||
{
|
||||
newbl = true;
|
||||
newblindex = stream->ReadBits(6);
|
||||
newblindex = stream->ReadBits(MAX_BASELINE_BITS);
|
||||
}
|
||||
}
|
||||
|
||||
if (full && !newbl)
|
||||
{
|
||||
isnext = stream->ReadBit() ? true : false;
|
||||
if (isnext)
|
||||
if (stream->ReadBit() != 0)
|
||||
{
|
||||
offset = stream->ReadBits(6);
|
||||
offset = stream->ReadBits(MAX_BASELINE_BITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1152,10 +1156,10 @@ int World::CompressFrame(frame_t *from, BitBuffer *stream)
|
||||
unsigned char *start = stream->CurrentByte();
|
||||
for (auto entnum = 0u; entnum < from->entitynum; entnum++)
|
||||
{
|
||||
header.num = entities[entnum].number;
|
||||
header.custom = (entities[entnum].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.num = entities[entnum].number;
|
||||
header.custom = (entities[entnum].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.newblindex = 0;
|
||||
header.newbl = false;
|
||||
header.newbl = false;
|
||||
|
||||
entity_state_t *baseline = &m_BaseLines[header.num];
|
||||
header.offset = FindBestBaseline(entnum, &baseline, entities, header.num, header.custom);
|
||||
@ -1273,26 +1277,25 @@ bool World::GetDeltaFromCache(unsigned int seqNr, unsigned int deltaNr, BitBuffe
|
||||
return 0;
|
||||
}
|
||||
|
||||
// marker an entity index that not in an old packet (for svc_packetentities)
|
||||
#define ENTITY_SENTINEL 9999
|
||||
|
||||
void World::WritePacketEntities(BitBuffer *stream, frame_t *frame, frame_t *deltaframe)
|
||||
{
|
||||
int oldmax;
|
||||
int oldindex;
|
||||
int newindex;
|
||||
int newnum;
|
||||
int oldnum;
|
||||
entity_state_t *frameEntities;
|
||||
entity_state_t *deltaEntities;
|
||||
unsigned int oldmax, oldindex, newindex;
|
||||
int newnum, oldnum;
|
||||
entity_state_t *frameEntities, *deltaEntities;
|
||||
|
||||
deltacallback_t header;
|
||||
header.instanced_baseline = (m_MaxInstanced_BaseLine > 0) ? true : false;
|
||||
header.num = 0;
|
||||
header.offset = 0;
|
||||
header.numbase = 0;
|
||||
header.num = 0;
|
||||
header.offset = 0;
|
||||
header.numbase = 0;
|
||||
header.newblindex = 0;
|
||||
header.full = false;
|
||||
header.newbl = false;
|
||||
header.remove = false;
|
||||
header.custom = false;
|
||||
header.newbl = false;
|
||||
header.remove = false;
|
||||
header.full = false;
|
||||
header.custom = false;
|
||||
|
||||
if (frame->delta || deltaframe->delta) {
|
||||
m_System->Errorf("World::WritePacketEntities: frame and delta frame must be uncompressed.\n");
|
||||
@ -1302,79 +1305,82 @@ void World::WritePacketEntities(BitBuffer *stream, frame_t *frame, frame_t *delt
|
||||
m_Delta.SetTime(frame->time);
|
||||
|
||||
oldmax = deltaframe->entitynum;
|
||||
newnum = 0; // index in frame->entities
|
||||
oldnum = 0; // index in deltaframe->entities
|
||||
newindex = 0; // index in frame->entities
|
||||
oldindex = 0; // index in deltaframe->entities
|
||||
|
||||
frameEntities = (entity_state_t *)frame->entities;
|
||||
deltaEntities = (entity_state_t *)deltaframe->entities;
|
||||
|
||||
stream->StartBitMode();
|
||||
while (true)
|
||||
|
||||
while (newindex < frame->entitynum || oldindex < oldmax)
|
||||
{
|
||||
if ((unsigned)newnum < frame->entitynum)
|
||||
{
|
||||
newindex = frameEntities[newnum].number;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldnum >= oldmax)
|
||||
break;
|
||||
newnum = (newindex >= frame->entitynum) ? ENTITY_SENTINEL : frameEntities[newindex].number;
|
||||
oldnum = (oldindex >= oldmax) ? ENTITY_SENTINEL : deltaEntities[oldindex].number;
|
||||
|
||||
// TODO: Unreachable code
|
||||
if ((unsigned)newnum < frame->entitynum)
|
||||
newindex = frameEntities[newnum].number;
|
||||
else
|
||||
newindex = 9999;
|
||||
}
|
||||
|
||||
if (oldnum < oldmax)
|
||||
oldindex = deltaEntities[oldnum].number;
|
||||
else
|
||||
oldindex = 9999;
|
||||
|
||||
if (newindex == oldindex)
|
||||
// this is a delta update of the entity from previous position
|
||||
if (newnum == oldnum)
|
||||
{
|
||||
header.custom = (frameEntities[newnum].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.num = newindex;
|
||||
// delta update from old position
|
||||
// because the force parm is false, this will not result
|
||||
// in any bytes being emitted if the entity has not changed at all
|
||||
// note that players are always 'newentities', this updates their oldorigin always
|
||||
// and prevents warping
|
||||
|
||||
header.custom = (frameEntities[newindex].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.num = newnum;
|
||||
header.newblindex = 0;
|
||||
header.newbl = false;
|
||||
header.remove = false;
|
||||
header.newbl = false;
|
||||
header.remove = false;
|
||||
|
||||
delta_t *delta = GetDeltaEncoder(newindex, header.custom);
|
||||
m_Delta.WriteDelta(stream, (byte *)&deltaEntities[oldnum], (byte *)&frameEntities[newnum], true, delta, &header);
|
||||
delta_t *delta = GetDeltaEncoder(newnum, header.custom);
|
||||
m_Delta.WriteDelta(stream, (byte *)&deltaEntities[oldindex], (byte *)&frameEntities[newindex], false, delta, &header);
|
||||
|
||||
oldnum++;
|
||||
newnum++;
|
||||
oldindex++;
|
||||
newindex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (newindex >= oldindex)
|
||||
// Figure out how we want to update the entity
|
||||
// This is a new entity, send it from the baseline
|
||||
if (newnum < oldnum)
|
||||
{
|
||||
if (newindex > oldindex)
|
||||
{
|
||||
header.num = oldindex;
|
||||
header.remove = true;
|
||||
header.newbl = false;
|
||||
header.newblindex = 0;
|
||||
//
|
||||
// If the entity was not in the old packet (oldnum == 9999),
|
||||
// then delta from the baseline since this is a new entity
|
||||
header.custom = (frameEntities[newindex].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.num = newnum;
|
||||
header.newblindex = 0;
|
||||
header.newbl = false;
|
||||
header.remove = false;
|
||||
|
||||
m_Delta.WriteHeader(stream, &header);
|
||||
++oldnum;
|
||||
}
|
||||
delta_t *delta = GetDeltaEncoder(newnum, header.custom);
|
||||
m_Delta.WriteDelta(stream, (byte *)&m_BaseLines[newnum], (byte *)&frameEntities[newindex], true, delta, &header);
|
||||
newindex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
header.custom = (frameEntities[newnum].entityType & ENTITY_BEAM) == ENTITY_BEAM;
|
||||
header.newblindex = 0;
|
||||
header.num = newindex;
|
||||
header.remove = false;
|
||||
header.newbl = false;
|
||||
// the old entity isn't present in the new message
|
||||
if (newnum > oldnum)
|
||||
{
|
||||
//
|
||||
// If the entity was in the old list, but is not in the new list (newindex == 9999),
|
||||
// then construct a special remove message
|
||||
|
||||
delta_t *delta = GetDeltaEncoder(newindex, header.custom);
|
||||
m_Delta.WriteDelta(stream, (byte *)&m_BaseLines[oldnum], (byte *)&frameEntities[newnum], true, delta, &header);
|
||||
newnum++;
|
||||
header.num = oldnum;
|
||||
header.newblindex = 0;
|
||||
header.newbl = false;
|
||||
header.remove = true; // tell the client that entity was removed from server
|
||||
|
||||
m_Delta.WriteHeader(stream, &header);
|
||||
oldindex++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// No more entities.. (end of packet entities)
|
||||
stream->WriteBits(0, 16);
|
||||
|
||||
stream->EndBitMode();
|
||||
}
|
||||
|
||||
@ -1467,13 +1473,14 @@ double World::GetTime()
|
||||
return m_WorldTime;
|
||||
}
|
||||
|
||||
// An svc_packetentities has just been parsed, deal with the rest of the data stream
|
||||
bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsigned int from)
|
||||
{
|
||||
int newnum, oldnum;
|
||||
int oldindex, newindex;
|
||||
int newnum, oldnum;
|
||||
unsigned int oldindex, newindex;
|
||||
|
||||
bool remove, custom, newbl;
|
||||
int newblindex, numbase, offset;
|
||||
bool remove, custom, newbl;
|
||||
int newblindex, numbase, offset;
|
||||
|
||||
frame_t deltaFrame;
|
||||
if (!GetUncompressedFrame(from, &deltaFrame)) {
|
||||
@ -1485,11 +1492,15 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
||||
oldindex = 0;
|
||||
newindex = 0;
|
||||
|
||||
remove = false;
|
||||
custom = false;
|
||||
newbl = false;
|
||||
numbase = 0;
|
||||
newblindex = 0;
|
||||
numbase = 0;
|
||||
newbl = false;
|
||||
remove = false;
|
||||
custom = false;
|
||||
|
||||
//
|
||||
// Parse uncompress entities
|
||||
//
|
||||
|
||||
m_Delta.SetTime(frame->time);
|
||||
stream->StartBitMode();
|
||||
@ -1500,60 +1511,75 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
||||
while (stream->PeekBits(16))
|
||||
{
|
||||
newnum = ParseDeltaHeader(stream, remove, custom, numbase, newbl, newblindex, false, offset);
|
||||
oldnum = (oldindex >= deltaFrame.entitynum) ? ENTITY_SENTINEL : deltaEntity[oldindex].number;
|
||||
|
||||
if ((unsigned)oldindex < deltaFrame.entitynum)
|
||||
oldnum = deltaEntity[oldindex].number;
|
||||
else
|
||||
oldnum = 9999;
|
||||
|
||||
while (newnum > oldnum)
|
||||
while (oldnum < newnum)
|
||||
{
|
||||
//
|
||||
// one or more entities from the old packet are unchanged
|
||||
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
{
|
||||
m_System->DPrintf("WARNING!World::UncompressEntitiesFromStream: newindex >= MAX_PACKET_ENTITIES.\n");
|
||||
stream->m_Overflowed = true;
|
||||
}
|
||||
|
||||
// copy one of the old entities over to the new packet unchanged
|
||||
Q_memcpy(&entity[newindex], &deltaEntity[oldindex], sizeof(entity[newindex]));
|
||||
|
||||
newindex++;
|
||||
oldindex++;
|
||||
|
||||
if ((unsigned)oldindex < deltaFrame.entitynum)
|
||||
oldnum = deltaEntity[oldindex].number;
|
||||
else
|
||||
oldnum = 9999;
|
||||
// lookup next index
|
||||
oldnum = (oldindex >= deltaFrame.entitynum) ? ENTITY_SENTINEL : deltaEntity[oldindex].number;
|
||||
}
|
||||
|
||||
if (newnum >= oldnum)
|
||||
// delta from previous state
|
||||
if (newnum == oldnum)
|
||||
{
|
||||
if (newnum == oldnum)
|
||||
if (remove)
|
||||
{
|
||||
if (remove)
|
||||
{
|
||||
++oldindex;
|
||||
}
|
||||
else
|
||||
{
|
||||
entity[newindex].entityType = custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
||||
|
||||
delta_t *delta = GetDeltaEncoder(newnum, custom);
|
||||
m_Delta.ParseDelta(stream, (byte *)&deltaEntity[oldindex], (byte *)&entity[newindex], delta);
|
||||
|
||||
entity[newindex].number = newnum;
|
||||
++newindex;
|
||||
++oldindex;
|
||||
}
|
||||
oldindex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert new the entity to frame
|
||||
|
||||
entity[newindex].entityType = custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
||||
|
||||
delta_t *delta = GetDeltaEncoder(newnum, custom);
|
||||
m_Delta.ParseDelta(stream, (byte *)&deltaEntity[oldindex], (byte *)&entity[newindex], delta);
|
||||
|
||||
entity[newindex].number = newnum;
|
||||
newindex++;
|
||||
oldindex++;
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (!remove)
|
||||
|
||||
// Figure out how we want to update the entity
|
||||
// This is a new entity, sent it from the baseline
|
||||
if (newnum < oldnum)
|
||||
{
|
||||
//
|
||||
// If the entity was not in the old packet (oldnum == 9999),
|
||||
// then delta from the baseline since this is a new entity
|
||||
|
||||
if (remove)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
{
|
||||
m_System->DPrintf("World::UncompressEntitiesFromStream: newindex >= MAX_PACKET_ENTITIES.\n");
|
||||
stream->m_Overflowed = true;
|
||||
}
|
||||
|
||||
//
|
||||
// Insert new the entity to frame
|
||||
|
||||
entity_state_t *baseline;
|
||||
if (newbl)
|
||||
{
|
||||
@ -1574,9 +1600,12 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
||||
m_Delta.ParseDelta(stream, (byte *)baseline, (byte *)&entity[newindex], delta);
|
||||
entity[newindex].number = newnum;
|
||||
newindex++;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// peek bit == 0 end of packet entities
|
||||
if (stream->ReadShort())
|
||||
{
|
||||
m_System->DPrintf("WARNING! World::UncompressEntitiesFromStream: missing end tag.\n");
|
||||
@ -1585,7 +1614,10 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
||||
|
||||
stream->EndBitMode();
|
||||
|
||||
while ((unsigned)oldindex < deltaFrame.entitynum)
|
||||
// Copy all the rest of the entities from the old packet
|
||||
//
|
||||
|
||||
while (oldindex != ENTITY_SENTINEL && oldindex < deltaFrame.entitynum)
|
||||
{
|
||||
if (newindex >= MAX_PACKET_ENTITIES)
|
||||
{
|
||||
@ -1593,33 +1625,22 @@ bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream, unsi
|
||||
stream->m_Overflowed = true;
|
||||
}
|
||||
|
||||
// copy everything to the new state we are delta'ing
|
||||
Q_memcpy(&entity[newindex], &deltaEntity[oldindex], sizeof(entity[newindex]));
|
||||
newindex++;
|
||||
oldindex++;
|
||||
}
|
||||
|
||||
if (newindex != frame->entitynum) {
|
||||
m_System->DPrintf("WARNING! World::UncompressEntitiesFromStream: newindex != frame->entitynum.\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool World::UncompressEntitiesFromStream(frame_t *frame, BitBuffer *stream)
|
||||
{
|
||||
int num;
|
||||
int newindex = 0;
|
||||
int entnum = frame->entitynum;
|
||||
int num, newindex = 0;
|
||||
int entnum = frame->entitynum;
|
||||
entity_state_t *baseline;
|
||||
bool remove, custom, newbl;
|
||||
int newblindex, numbase, offset;
|
||||
|
||||
newblindex = 0;
|
||||
numbase = 0;
|
||||
|
||||
remove = false;
|
||||
custom = false;
|
||||
newbl = false;
|
||||
bool remove = false, custom = false, newbl = false;
|
||||
int newblindex = 0, numbase = 0, offset;
|
||||
|
||||
entity_state_t *entities = (entity_state_t *)frame->entities;
|
||||
m_Delta.SetTime(frame->time);
|
||||
@ -2240,8 +2261,8 @@ void World::RearrangeFrame(frame_t *frame, int seqNrOffset, float timeOffset)
|
||||
BitBuffer tempStream(frame->entities, frame->entitiesSize);
|
||||
Q_memset(frame->entities, 0, frame->entitiesSize);
|
||||
|
||||
int newsize = CompressFrame(&fullFrame, &tempStream);
|
||||
if ((unsigned)newsize > frame->entitiesSize || tempStream.IsOverflowed()) {
|
||||
unsigned int newsize = CompressFrame(&fullFrame, &tempStream);
|
||||
if (newsize > frame->entitiesSize || tempStream.IsOverflowed()) {
|
||||
m_System->Printf("WARNING! World::RearrangeFrame: wrong entities size (%i != %i).\n", frame->entitiesSize, newsize);
|
||||
return;
|
||||
}
|
||||
|
@ -39,6 +39,9 @@
|
||||
#define RESOURCE_INDEX_BITS 12
|
||||
#define RESOURCE_MAX_COUNT (1 << RESOURCE_INDEX_BITS)
|
||||
|
||||
#define MAX_BASELINE_BITS 6
|
||||
#define MAX_BASELINES (1 << MAX_BASELINE_BITS)
|
||||
|
||||
class World: public IWorld, public BaseSystemModule {
|
||||
public:
|
||||
World() {}
|
||||
|
@ -98,6 +98,9 @@
|
||||
// Max size of udp packet payload
|
||||
#define MAX_UDP_PACKET 4010 // 9 bytes SPLITHEADER + 4000 payload?
|
||||
|
||||
#define DELTA_OFFSET_BITS 6
|
||||
#define DELTA_OFFSET_MAX ((1 << DELTA_OFFSET_BITS) - 1)
|
||||
|
||||
enum svc_commands_e
|
||||
{
|
||||
svc_bad,
|
||||
|
@ -195,7 +195,7 @@ bool ObjectDictionary::RemoveIndex(int index, bool freeObjectMemory)
|
||||
CheckSize();
|
||||
ClearCache();
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ObjectDictionary::RemoveIndexRange(int minIndex, int maxIndex)
|
||||
|
@ -74,6 +74,7 @@
|
||||
// SV_EmitSound2 flags
|
||||
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
|
||||
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker
|
||||
#define SND_EMIT2_USE_ORIGIN (1<<2) // use given origin instead of entity origin
|
||||
|
||||
// Engine edict->spawnflags
|
||||
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
|
||||
|
@ -47,4 +47,16 @@ struct cvar_listener_t
|
||||
const char *name;
|
||||
};
|
||||
|
||||
typedef void (*pfnCvar_HookVariable_t) (cvar_t *pCvar);
|
||||
|
||||
struct cvarhook_t
|
||||
{
|
||||
pfnCvar_HookVariable_t hook;
|
||||
|
||||
cvar_t *cvar;
|
||||
cvarhook_t *next;
|
||||
};
|
||||
|
||||
qboolean Cvar_HookVariable(const char *var_name, cvarhook_t *pHook);
|
||||
|
||||
#endif // CVARDEF_H
|
||||
|
@ -29,6 +29,9 @@
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
// The maximum user messages
|
||||
#define MAX_USERMESSAGES 256
|
||||
|
||||
// user message
|
||||
#define MAX_USER_MSG_DATA 192
|
||||
|
||||
|
@ -235,7 +235,8 @@ void Cbuf_Execute(void)
|
||||
}
|
||||
|
||||
// execute the command line
|
||||
Cmd_ExecuteString(line, src_command);
|
||||
if (line[0])
|
||||
Cmd_ExecuteString(line, src_command);
|
||||
|
||||
if (cmd_wait)
|
||||
{
|
||||
@ -406,17 +407,12 @@ void Cmd_Exec_f(void)
|
||||
else
|
||||
{
|
||||
char *pszDataPtr = configContents;
|
||||
while (true)
|
||||
while (pszDataPtr && *pszDataPtr)
|
||||
{
|
||||
Cbuf_Execute(); // TODO: This doesn't obey the rule to first execute commands from the file, and then the others in the buffer
|
||||
pszDataPtr = COM_ParseLine(pszDataPtr); // TODO: COM_ParseLine can be const char*
|
||||
|
||||
if (com_token[0] == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Cbuf_InsertTextLines(com_token);
|
||||
if (com_token[0])
|
||||
Cbuf_InsertTextLines(com_token);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,17 +31,17 @@
|
||||
unsigned char *gPAS;
|
||||
unsigned char *gPVS;
|
||||
int gPVSRowBytes;
|
||||
unsigned char mod_novis[MODEL_MAX_PVS];
|
||||
unsigned char mod_novis[MAX_MAP_LEAFS / 8];
|
||||
|
||||
void Mod_Init(void)
|
||||
{
|
||||
SW_Mod_Init();
|
||||
Q_memset(mod_novis, 255, MODEL_MAX_PVS);
|
||||
Q_memset(mod_novis, 0xFF, MAX_MAP_LEAFS / 8);
|
||||
}
|
||||
|
||||
unsigned char *Mod_DecompressVis(unsigned char *in, model_t *model)
|
||||
{
|
||||
static unsigned char decompressed[MODEL_MAX_PVS];
|
||||
static unsigned char decompressed[MAX_MAP_LEAFS / 8];
|
||||
|
||||
if (in == NULL)
|
||||
{
|
||||
|
@ -29,15 +29,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "maintypes.h"
|
||||
#include "model.h"
|
||||
|
||||
// Looks like no more than 8096 visibility leafs per world model
|
||||
const int MODEL_MAX_PVS = 1024;
|
||||
|
||||
extern unsigned char *gPAS;
|
||||
extern unsigned char *gPVS;
|
||||
extern int gPVSRowBytes;
|
||||
extern unsigned char mod_novis[MODEL_MAX_PVS];
|
||||
|
||||
void Mod_Init(void);
|
||||
unsigned char *Mod_DecompressVis(unsigned char *in, model_t *model);
|
||||
|
@ -586,9 +586,9 @@ void MSG_WriteBitData(void *src, int length)
|
||||
|
||||
void MSG_WriteBitAngle(float fAngle, int numbits)
|
||||
{
|
||||
if (numbits >= 32)
|
||||
if (numbits > 22)
|
||||
{
|
||||
Sys_Error("%s: Can't write bit angle with 32 bits precision\n", __func__);
|
||||
Sys_Error("%s: Can't write bit angle with more than 22 bits precision\n", __func__);
|
||||
}
|
||||
|
||||
uint32 shift = (1 << numbits);
|
||||
@ -1446,31 +1446,64 @@ char *COM_FileExtension(char *in)
|
||||
#endif // #ifdef REHLDS_FIXES
|
||||
}
|
||||
|
||||
// Fills "out" with the file name without path and extension.
|
||||
// Fills "out" with the file name without path and extension
|
||||
void COM_FileBase(const char *in, char *out)
|
||||
{
|
||||
const char *start, *end;
|
||||
int len;
|
||||
COM_FileBase_s(in, out, -1);
|
||||
}
|
||||
|
||||
*out = 0;
|
||||
|
||||
len = Q_strlen(in);
|
||||
if (len <= 0)
|
||||
return;
|
||||
|
||||
start = in + len - 1;
|
||||
end = in + len;
|
||||
while (start >= in && *start != '/' && *start != '\\')
|
||||
// Extracts the base name of a file (no path, no extension, assumes '/' as path separator)
|
||||
const char *COM_FileBase_s(const char *in, char *out, int size)
|
||||
{
|
||||
if (!in || !in[0])
|
||||
{
|
||||
if (*start == '.')
|
||||
end = start;
|
||||
start--;
|
||||
*out = '\0';
|
||||
return NULL;
|
||||
}
|
||||
start++;
|
||||
|
||||
len = end - start;
|
||||
Q_strncpy(out, start, len);
|
||||
out[len] = 0;
|
||||
int len = Q_strlen(in);
|
||||
if (len <= 0)
|
||||
return NULL;
|
||||
|
||||
// scan backward for '.'
|
||||
int end = len - 1;
|
||||
while (end && in[end] != '.' && !PATHSEPARATOR(in[end]))
|
||||
end--;
|
||||
|
||||
// no '.', copy to end
|
||||
if (in[end] != '.')
|
||||
{
|
||||
end = len - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Found ',', copy to left of '.'
|
||||
end--;
|
||||
}
|
||||
|
||||
// Scan backward for '/'
|
||||
int start = len - 1;
|
||||
while (start >= 0 && !PATHSEPARATOR(in[start]))
|
||||
start--;
|
||||
|
||||
if (start < 0 || !PATHSEPARATOR(in[start]))
|
||||
{
|
||||
start = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
start++;
|
||||
}
|
||||
|
||||
// Length of new sting
|
||||
int maxcopy = end - start + 1;
|
||||
if (size >= 0 && maxcopy >= size)
|
||||
return NULL;
|
||||
|
||||
// Copy partial string
|
||||
Q_strncpy(out, &in[start], maxcopy);
|
||||
out[maxcopy] = '\0';
|
||||
return out;
|
||||
}
|
||||
|
||||
void COM_DefaultExtension(char *path, char *extension)
|
||||
@ -1945,6 +1978,34 @@ NOXREF int COM_ExpandFilename(char *filename)
|
||||
return *filename != 0;
|
||||
}
|
||||
|
||||
// small helper function shared by lots of modules
|
||||
qboolean COM_IsAbsolutePath(const char *pStr)
|
||||
{
|
||||
if (strchr(pStr, ':') || pStr[0] == '/' || pStr[0] == '\\')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
qboolean COM_IsValidPath(const char *pszFilename)
|
||||
{
|
||||
if (!pszFilename)
|
||||
return FALSE;
|
||||
|
||||
if (Q_strlen(pszFilename) <= 0 ||
|
||||
Q_strstr(pszFilename, "\\\\") || // to protect network paths
|
||||
Q_strstr(pszFilename, ":") || // to protect absolute paths
|
||||
Q_strstr(pszFilename, "..") || // to protect relative paths
|
||||
Q_strstr(pszFilename, "~") ||
|
||||
Q_strstr(pszFilename, "\n") || // CFileSystem_Stdio::FS_fopen doesn't allow this
|
||||
Q_strstr(pszFilename, "\r")) // CFileSystem_Stdio::FS_fopen doesn't allow this
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int EXT_FUNC COM_FileSize(const char *filename)
|
||||
{
|
||||
FileHandle_t fp;
|
||||
@ -1962,7 +2023,10 @@ int EXT_FUNC COM_FileSize(const char *filename)
|
||||
|
||||
unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength)
|
||||
{
|
||||
char base[33];
|
||||
if (!path || !path[0])
|
||||
return NULL;
|
||||
|
||||
char base[MAX_PATH];
|
||||
unsigned char *buf = NULL;
|
||||
|
||||
#ifndef SWDS
|
||||
@ -1982,8 +2046,10 @@ unsigned char* EXT_FUNC COM_LoadFile(const char *path, int usehunk, int *pLength
|
||||
}
|
||||
|
||||
int len = FS_Size(hFile);
|
||||
COM_FileBase(path, base);
|
||||
base[32] = 0;
|
||||
if (!COM_FileBase_s(path, base, sizeof(base)))
|
||||
Sys_Error("%s: Bad path length: %s", __func__, path);
|
||||
|
||||
base[32] = '\0';
|
||||
|
||||
switch (usehunk)
|
||||
{
|
||||
|
@ -169,6 +169,7 @@ NOXREF char *COM_SkipPath(char *pathname);
|
||||
void COM_StripExtension(char *in, char *out);
|
||||
char *COM_FileExtension(char *in);
|
||||
void COM_FileBase(const char *in, char *out);
|
||||
const char *COM_FileBase_s(const char *in, char *out, int size);
|
||||
void COM_DefaultExtension(char *path, char *extension);
|
||||
void COM_UngetToken(void);
|
||||
char *COM_Parse(char *data);
|
||||
@ -186,6 +187,8 @@ void COM_CreatePath(char *path);
|
||||
NOXREF void COM_CopyFile(char *netpath, char *cachepath);
|
||||
NOXREF int COM_ExpandFilename(char *filename);
|
||||
int COM_FileSize(const char *filename);
|
||||
qboolean COM_IsAbsolutePath(const char *pStr);
|
||||
qboolean COM_IsValidPath(const char *pszFilename);
|
||||
unsigned char *COM_LoadFile(const char *path, int usehunk, int *pLength);
|
||||
void COM_FreeFile(void *buffer);
|
||||
void COM_CopyFileChunk(FileHandle_t dst, FileHandle_t src, int nSize);
|
||||
|
@ -32,7 +32,8 @@
|
||||
All cvar names are case insensitive! Values not.
|
||||
*/
|
||||
|
||||
cvar_t *cvar_vars;
|
||||
cvar_t *cvar_vars = NULL;
|
||||
cvarhook_t *cvar_hooks = NULL;
|
||||
char cvar_null_string[] = "";
|
||||
|
||||
void Cvar_Init(void)
|
||||
@ -319,8 +320,10 @@ void Cvar_DirectSet(struct cvar_s *var, const char *value)
|
||||
|
||||
void Cvar_Set(const char *var_name, const char *value)
|
||||
{
|
||||
cvar_t *var = Cvar_FindVar(var_name);
|
||||
cvar_t *var;
|
||||
cvarhook_t *pHook;
|
||||
|
||||
var = Cvar_FindVar(var_name);
|
||||
if (!var)
|
||||
{
|
||||
Con_DPrintf("%s: variable \"%s\" not found\n", __func__, var_name);
|
||||
@ -328,6 +331,15 @@ void Cvar_Set(const char *var_name, const char *value)
|
||||
}
|
||||
|
||||
Cvar_DirectSet(var, value);
|
||||
|
||||
for (pHook = cvar_hooks; pHook; pHook = pHook->next)
|
||||
{
|
||||
if (pHook->cvar == var)
|
||||
{
|
||||
pHook->hook(var);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Cvar_SetValue(const char *var_name, float value)
|
||||
@ -730,3 +742,36 @@ void Cvar_CmdInit(void)
|
||||
{
|
||||
Cmd_AddCommand("cvarlist", Cmd_CvarList_f);
|
||||
}
|
||||
|
||||
qboolean Cvar_HookVariable(const char *var_name, cvarhook_t *pHook)
|
||||
{
|
||||
cvar_t *cvar;
|
||||
|
||||
if (!pHook || !pHook->hook)
|
||||
return FALSE;
|
||||
|
||||
if (pHook->cvar || pHook->next)
|
||||
return FALSE;
|
||||
|
||||
cvar = Cvar_FindVar(var_name);
|
||||
if (!cvar)
|
||||
return FALSE;
|
||||
|
||||
cvarhook_t *pCur = cvar_hooks;
|
||||
pHook->cvar = cvar;
|
||||
|
||||
if (pCur)
|
||||
{
|
||||
while (pCur->next)
|
||||
pCur = pCur->next;
|
||||
|
||||
pCur->next = pHook;
|
||||
}
|
||||
else
|
||||
{
|
||||
// First in chain is null, assign pHook to it
|
||||
cvar_hooks = pHook;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -717,14 +717,9 @@ NOXREF qboolean Draw_CacheReload(cachewad_t *wad, int i, lumpinfo_t *pLump, cach
|
||||
qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_t *lump)
|
||||
{
|
||||
texture_t tex;
|
||||
miptex_t *mip;
|
||||
miptex_t tmp;
|
||||
int pix;
|
||||
int pixoffset;
|
||||
int paloffset;
|
||||
int palettesize;
|
||||
int nPalleteCount;
|
||||
int nSize;
|
||||
miptex_t *mip, tmp;
|
||||
int i, pix, paloffset, palettesize;
|
||||
int size;
|
||||
|
||||
if (wad->cacheExtra != DECAL_EXTRASIZE)
|
||||
{
|
||||
@ -734,58 +729,54 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_
|
||||
|
||||
tex = *(texture_t *)data;
|
||||
mip = (miptex_t *)(data + wad->cacheExtra);
|
||||
tmp = *mip;
|
||||
|
||||
// Copy mip texture data
|
||||
tmp = *mip;
|
||||
tex.width = LittleLong(tmp.width);
|
||||
tex.height = LittleLong(tmp.height);
|
||||
tex.anim_max = 0;
|
||||
tex.anim_min = 0;
|
||||
tex.anim_total = 0;
|
||||
tex.alternate_anims = NULL;
|
||||
tex.anim_next = NULL;
|
||||
tex.anim_total = tex.anim_min = tex.anim_max = 0;
|
||||
tex.alternate_anims = tex.anim_next = NULL;
|
||||
|
||||
if (!tex.width || tex.width > 256 || tex.height > 256)
|
||||
{
|
||||
Con_Printf("%s: Bad wad dimensions %s\n", __func__, wad->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < MIPLEVELS; i++)
|
||||
for (i = 0; i < MIPLEVELS; i++)
|
||||
tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]);
|
||||
|
||||
if (tex.width <= 0 || tex.height <= 0 ||
|
||||
// Check if texture dimensions exceed limits
|
||||
tex.width > 256 || tex.height > 256)
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad tex size %ux%u on %s\n", __func__, tex.width, tex.height, wad->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pix = tex.width * tex.height;
|
||||
pixoffset = pix + (pix >> 2) + (pix >> 4) + (pix >> 6);
|
||||
size = pix + (pix >> 2) + (pix >> 4) + (pix >> 6);
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
// Ensure that pixoffset won't be exceed the pre allocated buffer
|
||||
// This can happen when there are no color palettes in payload
|
||||
if ((pixoffset + sizeof(texture_t)) >= (unsigned)(wad->cacheExtra + lump->size))
|
||||
if ((unsigned)(size + sizeof(miptex_t)) >= (unsigned)(lump->size + wad->cacheExtra))
|
||||
{
|
||||
Con_Printf("%s: Bad wad payload size %s\n", __func__, wad->name);
|
||||
return FALSE;
|
||||
Con_Printf("%s: Bad cached wad size %i/%i on %s\n", __func__, size + sizeof(miptex_t), lump->size + wad->cacheExtra, wad->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
paloffset = (pix >> 2) + tmp.offsets[0] + pix;
|
||||
palettesize = (pix >> 4) + paloffset;
|
||||
paloffset = size + sizeof(miptex_t);
|
||||
palettesize = *(u_short *)(data + wad->cacheExtra + paloffset); // Get palette size
|
||||
|
||||
if ((tmp.offsets[0] + pix != tmp.offsets[1])
|
||||
|| paloffset != tmp.offsets[2]
|
||||
|| palettesize != tmp.offsets[3])
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
|
||||
// Check if offsets are valid for mip levels
|
||||
if (pix + tmp.offsets[i] != tmp.offsets[i + 1])
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
|
||||
return FALSE;
|
||||
}
|
||||
pix >>= 2;
|
||||
}
|
||||
|
||||
if (palettesize > 256)
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad palette size %i on %s\n", __func__, palettesize, wad->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t));
|
||||
if (nPalleteCount > 256)
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad palette size %i on %s\n", __func__, nPalleteCount, wad->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2;
|
||||
if (nSize > lump->disksize)
|
||||
if ((palettesize + 2 * (palettesize + 1) + size + LittleLong(tmp.offsets[0])) > lump->disksize)
|
||||
{
|
||||
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
|
||||
return FALSE;
|
||||
|
@ -30,6 +30,9 @@
|
||||
|
||||
#include "entity_state.h"
|
||||
|
||||
// marker an entity index that not in an old packet (for svc_packetentities)
|
||||
#define ENTITY_SENTINEL 9999
|
||||
|
||||
typedef struct packet_entities_s
|
||||
{
|
||||
int num_entities;
|
||||
|
@ -42,9 +42,7 @@ typedef struct ipfilter_s
|
||||
} compare;
|
||||
float banEndTime;
|
||||
float banTime;
|
||||
#ifdef REHLDS_FIXES
|
||||
int cidr;
|
||||
#endif // REHLDS_FIXES
|
||||
} ipfilter_t;
|
||||
|
||||
typedef struct userfilter_s
|
||||
|
@ -620,7 +620,9 @@ qboolean HPAK_ResourceForHash(char *pakname, unsigned char *hash, struct resourc
|
||||
fp = FS_Open(name, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
#ifndef REHLDS_FIXES
|
||||
Con_Printf("ERROR: couldn't open %s.\n", name);
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
FS_Read(&header, sizeof(hash_pack_header_t), 1, fp);
|
||||
|
@ -57,7 +57,11 @@ cvar_t deathmatch = { "deathmatch", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
cvar_t coop = { "coop", "0", FCVAR_SERVER, 0.0f, NULL };
|
||||
|
||||
cvar_t sys_ticrate = { "sys_ticrate", "100.0", 0, 0.0f, NULL };
|
||||
|
||||
void sys_timescale_hook_callback(cvar_t *cvar);
|
||||
cvarhook_t sys_timescale_hook = { sys_timescale_hook_callback, NULL, NULL };
|
||||
cvar_t sys_timescale = { "sys_timescale", "1.0", 0, 0.0f, NULL };
|
||||
|
||||
cvar_t fps_max = { "fps_max", "100.0", FCVAR_ARCHIVE, 0.0f, NULL };
|
||||
cvar_t host_killtime = { "host_killtime", "0.0", 0, 0.0f, NULL };
|
||||
cvar_t sv_stats = { "sv_stats", "1", 0, 0.0f, NULL };
|
||||
@ -143,6 +147,9 @@ void Host_InitLocal(void)
|
||||
Host_InitCommands();
|
||||
Cvar_RegisterVariable(&host_killtime);
|
||||
Cvar_RegisterVariable(&sys_ticrate);
|
||||
Cvar_RegisterVariable(&sys_timescale);
|
||||
Cvar_HookVariable(sys_timescale.name, &sys_timescale_hook);
|
||||
|
||||
Cvar_RegisterVariable(&fps_max);
|
||||
Cvar_RegisterVariable(&fps_override);
|
||||
Cvar_RegisterVariable(&host_name);
|
||||
@ -351,22 +358,29 @@ void Host_WriteCustomConfig(void)
|
||||
|
||||
void SV_ClientPrintf(const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
char string[1024];
|
||||
|
||||
if (!host_client->fakeclient)
|
||||
{
|
||||
va_list va;
|
||||
char string[1024];
|
||||
|
||||
va_start(va, fmt);
|
||||
Q_vsnprintf(string, ARRAYSIZE(string) - 1, fmt, va);
|
||||
va_end(va);
|
||||
|
||||
string[ARRAYSIZE(string) - 1] = 0;
|
||||
|
||||
MSG_WriteByte(&host_client->netchan.message, svc_print);
|
||||
MSG_WriteString(&host_client->netchan.message, string);
|
||||
g_RehldsHookchains.m_SV_ClientPrintf.callChain(SV_ClientPrintf_internal, string);
|
||||
}
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_ClientPrintf_internal(const char *Dest)
|
||||
{
|
||||
char string[1024];
|
||||
|
||||
Q_strlcpy(string, Dest);
|
||||
|
||||
MSG_WriteByte(&host_client->netchan.message, svc_print);
|
||||
MSG_WriteString(&host_client->netchan.message, string);
|
||||
}
|
||||
|
||||
void SV_BroadcastPrintf(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
@ -1184,7 +1198,11 @@ int Host_Init(quakeparms_t *parms)
|
||||
else
|
||||
{
|
||||
Cvar_RegisterVariable(&suitvolume);
|
||||
#ifdef REHLDS_FIXES
|
||||
Cvar_RegisterVariable(&r_cachestudio);
|
||||
#endif
|
||||
}
|
||||
|
||||
Cbuf_InsertText("exec valve.rc\n");
|
||||
Hunk_AllocName(0, "-HOST_HUNKLEVEL-");
|
||||
host_hunklevel = Hunk_LowMark();
|
||||
@ -1269,3 +1287,23 @@ void Host_Shutdown(void)
|
||||
g_psv.time = 0.0f;
|
||||
g_pcl.time = 0.0f;
|
||||
}
|
||||
|
||||
void sys_timescale_hook_callback(cvar_t *cvar)
|
||||
{
|
||||
int i;
|
||||
client_t *client = NULL;
|
||||
|
||||
if (!Host_IsServerActive())
|
||||
return;
|
||||
|
||||
for (i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
client = &g_psvs.clients[i];
|
||||
|
||||
if (!client->fakeclient && (client->active || client->spawned || client->connected))
|
||||
{
|
||||
MSG_WriteByte(&client->netchan.message, svc_timescale);
|
||||
MSG_WriteFloat(&client->netchan.message, max(0.1f, sys_timescale.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ NOXREF void Info_WriteVars(FileHandle_t fp);
|
||||
void Host_WriteConfiguration(void);
|
||||
void Host_WriteCustomConfig(void);
|
||||
void SV_ClientPrintf(const char *fmt, ...);
|
||||
void SV_ClientPrintf_internal(const char *Dest);
|
||||
void SV_BroadcastPrintf(const char *fmt, ...);
|
||||
void Host_ClientCommands(const char *fmt, ...);
|
||||
void SV_DropClient_api(IGameClient* cl, bool crash, const char* fmt, ...);
|
||||
|
@ -205,11 +205,19 @@ void Host_Motd_f(void)
|
||||
char *next;
|
||||
|
||||
pFileList = motdfile.string;
|
||||
if (*pFileList == '/' || Q_strstr(pFileList, ":") || Q_strstr(pFileList, "..") || Q_strstr(pFileList, "\\"))
|
||||
if (!COM_IsValidPath(pFileList) || COM_IsAbsolutePath(pFileList))
|
||||
{
|
||||
Con_Printf("Unable to open %s (contains illegal characters)\n", pFileList);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *pchExtension = COM_FileExtension(pFileList);
|
||||
if (Q_stricmp(pchExtension, "txt") != 0)
|
||||
{
|
||||
Con_Printf("Invalid motdfile name %s (wrong file extension, must be .txt)\n", pFileList);
|
||||
return;
|
||||
}
|
||||
|
||||
pFile = FS_Open(pFileList, "rb");
|
||||
if (!pFile)
|
||||
{
|
||||
@ -602,7 +610,6 @@ void Host_Status_f(void)
|
||||
Host_Status_Printf(conprint, log, "players : %i active (%i max)\n\n", nClients, g_psvs.maxclients);
|
||||
Host_Status_Printf(conprint, log, "# name userid uniqueid frag time ping loss adr\n");
|
||||
|
||||
int count = 1;
|
||||
client = g_psvs.clients;
|
||||
for (j = 0; j < g_psvs.maxclients; j++, client++)
|
||||
{
|
||||
@ -626,7 +633,7 @@ void Host_Status_f(void)
|
||||
val = SV_GetClientIDString(client);
|
||||
else val = "BOT";
|
||||
|
||||
Host_Status_Printf(conprint, log, "#%2i %8s %i %s", count++, va("\"%s\"", client->name), client->userid, val);
|
||||
Host_Status_Printf(conprint, log, "#%2i %8s %i %s", j + 1, va("\"%s\"", client->name), client->userid, val);
|
||||
if (client->proxy)
|
||||
{
|
||||
const char *userInfo = Info_ValueForKey(client->userinfo, "hspecs");
|
||||
@ -716,7 +723,6 @@ void Host_Status_Formatted_f(void)
|
||||
Host_Status_Printf(conprint, log, "players : %i active (%i max)\n\n", nClients, g_psvs.maxclients);
|
||||
Host_Status_Printf(conprint, log, "%-2.2s\t%-9.9s\t%-7.7s\t%-20.20s\t%-4.4s\t%-8.8s\t%-4.4s\t%-4.4s\t%-21.21s\n","# ","name","userid ","uniqueid ","frag","time ","ping","loss","adr");
|
||||
|
||||
int count = 1;
|
||||
char *szRemoteAddr;
|
||||
client = g_psvs.clients;
|
||||
for (j = 0; j < g_psvs.maxclients; j++, client++)
|
||||
@ -747,12 +753,117 @@ void Host_Status_Formatted_f(void)
|
||||
#endif // REHLDS_FIXES
|
||||
szIDString = SV_GetClientIDString(client);
|
||||
Host_Status_Printf(conprint, log, "%-2.2s\t%-9.9s\t%-7.7s\t%-20.20s\t%-4.4s\t%-8.8s\t%-4.4s\t%-4.4s\t%-21.21s\n",
|
||||
va("%-2i", count++),va("\"%s\"", client->name),va("%-7i", client->userid),szIDString,
|
||||
va("%-2i", j + 1),va("\"%s\"", client->name),va("%-7i", client->userid),szIDString,
|
||||
va("%-4i", (int)client->edict->v.frags),sz,va("%-4i", SV_CalcPing(client)),va("%-4i", (int)client->packet_loss),szRemoteAddr);
|
||||
}
|
||||
Host_Status_Printf(conprint, log, "%i users\n", nClients);
|
||||
}
|
||||
|
||||
// Sets client to godmode
|
||||
void Host_God_f(void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
Cmd_ForwardToServer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sv_cheats.value)
|
||||
return;
|
||||
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE;
|
||||
if (!((int)sv_player->v.flags & FL_GODMODE))
|
||||
SV_ClientPrintf("godmode OFF\n");
|
||||
else
|
||||
SV_ClientPrintf("godmode ON\n");
|
||||
}
|
||||
|
||||
// Sets client to notarget mode
|
||||
void Host_Notarget_f(void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
Cmd_ForwardToServer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sv_cheats.value)
|
||||
return;
|
||||
|
||||
sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET;
|
||||
if (!((int)sv_player->v.flags & FL_NOTARGET))
|
||||
SV_ClientPrintf("notarget OFF\n");
|
||||
else
|
||||
SV_ClientPrintf("notarget ON\n");
|
||||
}
|
||||
|
||||
// Searches along the direction ray in steps of "step" to see if
|
||||
// the entity position is passible
|
||||
// Used for putting the player in valid space when toggling off noclip mode
|
||||
int FindPassableSpace(edict_t *pEdict, vec_t *direction, float step)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 100; i++)
|
||||
{
|
||||
VectorMA(pEdict->v.origin, step, direction, pEdict->v.origin);
|
||||
|
||||
if (!SV_TestEntityPosition(pEdict))
|
||||
{
|
||||
// Store old origin
|
||||
VectorCopy(pEdict->v.origin, pEdict->v.oldorigin);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Host_Noclip_f(void)
|
||||
{
|
||||
if (cmd_source == src_command)
|
||||
{
|
||||
Cmd_ForwardToServer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sv_cheats.value)
|
||||
return;
|
||||
|
||||
if (sv_player->v.movetype != MOVETYPE_NOCLIP)
|
||||
{
|
||||
sv_player->v.movetype = MOVETYPE_NOCLIP;
|
||||
SV_ClientPrintf("noclip ON\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sv_player->v.movetype = MOVETYPE_WALK;
|
||||
|
||||
// Store old origin
|
||||
VectorCopy(sv_player->v.origin, sv_player->v.oldorigin);
|
||||
|
||||
SV_ClientPrintf("noclip OFF\n");
|
||||
|
||||
if (SV_TestEntityPosition(sv_player))
|
||||
{
|
||||
vec3_t forward, right, up;
|
||||
AngleVectors(sv_player->v.v_angle, forward, right, up);
|
||||
|
||||
if (!FindPassableSpace(sv_player, forward, 1.0)
|
||||
&& !FindPassableSpace(sv_player, right, 1.0)
|
||||
&& !FindPassableSpace(sv_player, right, -1.0) // left
|
||||
&& !FindPassableSpace(sv_player, up, 1.0) // up
|
||||
&& !FindPassableSpace(sv_player, up, -1.0) // down
|
||||
&& !FindPassableSpace(sv_player, forward, -1.0)) // back
|
||||
{
|
||||
Con_DPrintf("Can't find the world\n");
|
||||
}
|
||||
|
||||
VectorCopy(sv_player->v.oldorigin, sv_player->v.origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Host_Ping_f(void)
|
||||
{
|
||||
int i;
|
||||
@ -3138,11 +3249,12 @@ void Host_InitCommands(void)
|
||||
Cmd_AddCommand("setinfo", Host_SetInfo_f);
|
||||
Cmd_AddCommand("fullinfo", Host_FullInfo_f);
|
||||
|
||||
#ifndef SWDS
|
||||
Cmd_AddCommand("god", Host_God_f);
|
||||
Cmd_AddCommand("notarget", Host_Notarget_f);
|
||||
Cmd_AddCommand("fly", Host_Fly_f);
|
||||
Cmd_AddCommand("noclip", Host_Noclip_f);
|
||||
|
||||
#ifndef SWDS
|
||||
Cmd_AddCommand("fly", Host_Fly_f);
|
||||
Cmd_AddCommand("viewmodel", Host_Viewmodel_f);
|
||||
Cmd_AddCommand("viewframe", Host_Viewframe_f);
|
||||
Cmd_AddCommand("viewnext", Host_Viewnext_f);
|
||||
|
@ -856,6 +856,12 @@ qboolean Info_IsValid(const char *s)
|
||||
return false;
|
||||
};
|
||||
|
||||
// invalid utf8 chars are deprecated
|
||||
if (!Q_UnicodeValidate(s))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (*s == '\\')
|
||||
{
|
||||
const char* key = ++s;
|
||||
|
@ -418,3 +418,12 @@ qboolean VectorCompare(const vec_t *v1, const vec_t *v2)
|
||||
}
|
||||
|
||||
#endif // #if !defined(REHLDS_SSE)
|
||||
|
||||
qboolean BoundsIntersect(const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2)
|
||||
{
|
||||
if (mins1[0] > maxs2[0] || mins1[1] > maxs2[1] || mins1[2] > maxs2[2])
|
||||
return FALSE;
|
||||
if (maxs1[0] < mins2[0] || maxs1[1] < mins2[1] || maxs1[2] < mins2[2])
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -171,3 +171,4 @@ void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]);
|
||||
NOBODY void FloorDivMod(double numer, double denom, int *quotient, int *rem);
|
||||
NOBODY int GreatestCommonDivisor(int i1, int i2);
|
||||
NOBODY fixed16_t Invert24To16(fixed16_t val);
|
||||
qboolean BoundsIntersect(const vec3_t mins1, const vec3_t maxs1, const vec3_t mins2, const vec3_t maxs2);
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
model_t *loadmodel;
|
||||
char loadname[32];
|
||||
char loadname[MAX_MODEL_NAME];
|
||||
model_t mod_known[MAX_KNOWN_MODELS];
|
||||
int mod_numknown;
|
||||
unsigned char* mod_base;
|
||||
@ -330,7 +330,12 @@ model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean trackCRC)
|
||||
Con_DPrintf("loading %s\n", mod->name);
|
||||
|
||||
// allocate a new model
|
||||
COM_FileBase(mod->name, loadname);
|
||||
if (!COM_FileBase_s(mod->name, loadname, sizeof(loadname)))
|
||||
{
|
||||
Sys_Error("%s: Bad model name length: %s", __func__, mod->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
loadmodel = mod;
|
||||
|
||||
mod->needload = NL_PRESENT;
|
||||
@ -849,6 +854,7 @@ void CalcSurfaceExtents(msurface_t *s)
|
||||
int i, j, e;
|
||||
mvertex_t *v;
|
||||
mtexinfo_t *tex;
|
||||
vec3_t middle{};
|
||||
int bmins[2], bmaxs[2];
|
||||
|
||||
mins[0] = mins[1] = 999999;
|
||||
@ -864,6 +870,8 @@ void CalcSurfaceExtents(msurface_t *s)
|
||||
else
|
||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
||||
|
||||
VectorAdd(middle, v->position, middle);
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
// FIXED: loss of floating point
|
||||
@ -879,6 +887,8 @@ void CalcSurfaceExtents(msurface_t *s)
|
||||
}
|
||||
}
|
||||
|
||||
VectorScale(middle, 1.0f / s->numedges, middle);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
bmins[i] = (int) floor(mins[i] / 16);
|
||||
@ -886,8 +896,16 @@ void CalcSurfaceExtents(msurface_t *s)
|
||||
|
||||
s->texturemins[i] = bmins[i] * 16;
|
||||
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
||||
if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 256)
|
||||
Sys_Error("%s: Bad surface extents", __func__);
|
||||
|
||||
if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > MAX_SURFACE_TEXTURE_SIZE)
|
||||
{
|
||||
int surfID = s - loadmodel->surfaces;
|
||||
Sys_Error("%s: Bad #%d surface extents %d/%d on %s at position (%d,%d,%d)",
|
||||
__func__, surfID, s->extents[0], s->extents[1],
|
||||
tex->texture->name,
|
||||
(int)middle[0], (int)middle[1], (int)middle[2]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include "crc.h"
|
||||
|
||||
extern model_t* loadmodel;
|
||||
extern char loadname[32];
|
||||
extern char loadname[MAX_MODEL_NAME];
|
||||
extern model_t mod_known[MAX_KNOWN_MODELS];
|
||||
extern int mod_numknown;
|
||||
extern unsigned char* mod_base;
|
||||
|
@ -422,6 +422,7 @@ typedef struct netchan_s
|
||||
|
||||
// Incoming and outgoing flow metrics
|
||||
flow_t flow[MAX_FLOWS];
|
||||
|
||||
} netchan_t;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
|
@ -36,6 +36,15 @@ cvar_t net_showpackets = { "net_showpackets", "0", 0, 0.0f, nullptr};
|
||||
cvar_t net_showdrop = { "net_showdrop", "0", 0, 0.0f, nullptr};
|
||||
cvar_t net_drawslider = { "net_drawslider", "0", 0, 0.0f, nullptr};
|
||||
cvar_t net_chokeloopback = { "net_chokeloop", "0", 0, 0.0f, nullptr};
|
||||
|
||||
cvar_t sv_net_incoming_decompression = { "sv_net_incoming_decompression", "1", 0, 1.0f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_max_ratio = { "sv_net_incoming_decompression_max_ratio", "80.0", 0, 80.0f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_max_size = { "sv_net_incoming_decompression_max_size", "65536", 0, 65536.0f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_min_failures = { "sv_net_incoming_decompression_min_failures", "4", 0, 4.0f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_max_failures = { "sv_net_incoming_decompression_max_failures", "10", 0, 10.0f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_min_failuretime = { "sv_net_incoming_decompression_min_failuretime", "0.1", 0, 0.1f, nullptr };
|
||||
cvar_t sv_net_incoming_decompression_punish = { "sv_net_incoming_decompression_punish", "-1", 0, -1.0f, nullptr };
|
||||
|
||||
cvar_t sv_filetransfercompression = { "sv_filetransfercompression", "1", 0, 0.0f, nullptr};
|
||||
cvar_t sv_filetransfermaxsize = { "sv_filetransfermaxsize", "10485760", 0, 0.0f, nullptr};
|
||||
|
||||
@ -178,6 +187,7 @@ void Netchan_Clear(netchan_t *chan)
|
||||
void Netchan_Setup(netsrc_t socketnumber, netchan_t *chan, netadr_t adr, int player_slot, void *connection_status, qboolean(*pfnNetchan_Blocksize)(void *))
|
||||
{
|
||||
Netchan_Clear(chan);
|
||||
g_GameClients[player_slot]->NetchanClear();
|
||||
|
||||
Q_memset(chan, 0, sizeof(netchan_t));
|
||||
|
||||
@ -1158,7 +1168,10 @@ void Netchan_CreateFileFragmentsFromBuffer(qboolean server, netchan_t *chan, con
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
send -= buf->frag_message.cursize;
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
|
||||
buf->isbuffer = TRUE;
|
||||
@ -1200,7 +1213,9 @@ int Netchan_CreateFileFragments(qboolean server, netchan_t *chan, const char *fi
|
||||
|
||||
if (!FS_FileExists(filename))
|
||||
return FALSE;
|
||||
if (FS_FileSize(filename) > sv_filetransfermaxsize.value)
|
||||
|
||||
unsigned int nSize = FS_FileSize(filename);
|
||||
if (nSize == 0 || nSize > sv_filetransfermaxsize.value)
|
||||
return FALSE;
|
||||
|
||||
auto wait = (fragbufwaiting_t *)Mem_ZeroMalloc(sizeof(fragbufwaiting_t));
|
||||
@ -1321,7 +1336,7 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
remaining = filesize;
|
||||
pos = 0;
|
||||
|
||||
while (remaining)
|
||||
while (remaining > 0)
|
||||
{
|
||||
send = min(chunksize, remaining);
|
||||
buf = Netchan_AllocFragbuf();
|
||||
@ -1353,7 +1368,10 @@ int Netchan_CreateFileFragments_(qboolean server, netchan_t *chan, const char *f
|
||||
MSG_WriteString(&buf->frag_message, filename);
|
||||
MSG_WriteString(&buf->frag_message, bCompressed ? "bz2" : "uncompressed");
|
||||
MSG_WriteLong(&buf->frag_message, uncompressed_size);
|
||||
send -= buf->frag_message.cursize;
|
||||
|
||||
// Check if we aren't send more than we should
|
||||
if ((chunksize - send) < buf->frag_message.cursize)
|
||||
send -= buf->frag_message.cursize;
|
||||
}
|
||||
buf->isfile = TRUE;
|
||||
buf->iscompressed = bCompressed;
|
||||
@ -1389,8 +1407,13 @@ void Netchan_FlushIncoming(netchan_t *chan, int stream)
|
||||
{
|
||||
fragbuf_t *p, *n;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
msg_readcount = 0;
|
||||
#ifdef REHLDS_FIXES
|
||||
if ((chan->player_slot - 1) == host_client - g_psvs.clients)
|
||||
#endif
|
||||
{
|
||||
SZ_Clear(&net_message);
|
||||
msg_readcount = 0;
|
||||
}
|
||||
|
||||
p = chan->incomingbufs[stream];
|
||||
while (p)
|
||||
@ -1404,6 +1427,93 @@ void Netchan_FlushIncoming(netchan_t *chan, int stream)
|
||||
chan->incomingready[stream] = FALSE;
|
||||
}
|
||||
|
||||
void Netchan_DecompressionCvarsBounds()
|
||||
{
|
||||
if (sv_net_incoming_decompression_min_failures.value < 1)
|
||||
Cvar_SetValue("sv_net_incoming_decompression_min_failures", 1);
|
||||
|
||||
else if (sv_net_incoming_decompression_min_failures.value > NET_DECOMPRESS_MAX_TIMES)
|
||||
Cvar_SetValue("sv_net_incoming_decompression_min_failures", NET_DECOMPRESS_MAX_TIMES);
|
||||
|
||||
if (sv_net_incoming_decompression_max_failures.value < 1)
|
||||
Cvar_SetValue("sv_net_incoming_decompression_max_failures", 1);
|
||||
|
||||
else if (sv_net_incoming_decompression_max_failures.value > NET_DECOMPRESS_MAX_TIMES)
|
||||
Cvar_SetValue("sv_net_incoming_decompression_max_failures", NET_DECOMPRESS_MAX_TIMES);
|
||||
|
||||
if (sv_net_incoming_decompression_max_failures.value < sv_net_incoming_decompression_min_failures.value)
|
||||
{
|
||||
int iTemp = sv_net_incoming_decompression_max_failures.value;
|
||||
Cvar_SetValue("sv_net_incoming_decompression_max_failures", sv_net_incoming_decompression_min_failures.value);
|
||||
Cvar_SetValue("sv_net_incoming_decompression_min_failures", iTemp);
|
||||
}
|
||||
|
||||
if (sv_net_incoming_decompression_min_failuretime.value <= 0.0f)
|
||||
Cvar_SetValue("sv_net_incoming_decompression_min_failuretime", 0.1f);
|
||||
}
|
||||
|
||||
// Check for an abnormal size ratio between compressed and uncompressed data
|
||||
qboolean Netchan_ValidateDecompress(netchan_t *chan, int stream, unsigned int compressedSize, unsigned int uncompressedSize)
|
||||
{
|
||||
#ifdef REHLDS_FIXES
|
||||
int i;
|
||||
|
||||
if (sv_net_incoming_decompression_max_ratio.value <= 0)
|
||||
return TRUE; // validation is disabled
|
||||
|
||||
if (compressedSize >= uncompressedSize)
|
||||
return TRUE;
|
||||
|
||||
float ratio = ((float)(uncompressedSize - compressedSize) / uncompressedSize) * 100.0f;
|
||||
if (ratio < sv_net_incoming_decompression_max_ratio.value)
|
||||
return TRUE; // no low entropy for uncompressed data
|
||||
|
||||
if ((chan->player_slot - 1) != host_client - g_psvs.clients)
|
||||
return TRUE;
|
||||
|
||||
Netchan_DecompressionCvarsBounds();
|
||||
|
||||
FragStats_t &stats = g_GameClients[chan->player_slot - 1]->GetFragStats(stream);
|
||||
|
||||
// check if the client should be rejected based on total failed decompress
|
||||
if (stats.num_decompress_failures >= sv_net_incoming_decompression_max_failures.value)
|
||||
{
|
||||
for (i = 0; i < sv_net_incoming_decompression_max_failures.value - 1; i++)
|
||||
stats.decompress_failure_times[i] = stats.decompress_failure_times[i + 1];
|
||||
|
||||
stats.num_decompress_failures = sv_net_incoming_decompression_max_failures.value - 1;
|
||||
}
|
||||
|
||||
stats.decompress_failure_times[stats.num_decompress_failures++] = realtime;
|
||||
|
||||
// check if the client should be rejected based on recent failed decompress
|
||||
int recent_failures = 0;
|
||||
for (i = 0; i < stats.num_decompress_failures; i++)
|
||||
{
|
||||
if ((realtime - stats.decompress_failure_times[i]) <= sv_net_incoming_decompression_min_failuretime.value)
|
||||
recent_failures++;
|
||||
}
|
||||
|
||||
if (recent_failures >= sv_net_incoming_decompression_min_failures.value)
|
||||
{
|
||||
if (chan->player_slot == 0)
|
||||
Con_DPrintf("Incoming abnormal uncompressed size with ratio %.2f\n", ratio);
|
||||
else
|
||||
Con_DPrintf("%s:Incoming abnormal uncompressed size with ratio %.2f from %s\n", NET_AdrToString(chan->remote_address), ratio, host_client->name);
|
||||
|
||||
if (sv_net_incoming_decompression_punish.value >= 0)
|
||||
{
|
||||
Con_DPrintf("%s:Banned for malformed/abnormal bzip2 fragments from %s\n", NET_AdrToString(chan->remote_address), host_client->name);
|
||||
Cbuf_AddText(va("addip %.1f %s\n", sv_net_incoming_decompression_punish.value, NET_BaseAdrToString(chan->remote_address)));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
qboolean Netchan_CopyNormalFragments(netchan_t *chan)
|
||||
{
|
||||
fragbuf_t *p, *n;
|
||||
@ -1420,6 +1530,9 @@ qboolean Netchan_CopyNormalFragments(netchan_t *chan)
|
||||
|
||||
p = chan->incomingbufs[FRAG_NORMAL_STREAM];
|
||||
|
||||
chan->incomingbufs[FRAG_NORMAL_STREAM] = nullptr;
|
||||
chan->incomingready[FRAG_NORMAL_STREAM] = FALSE;
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
MSG_BeginReading();
|
||||
|
||||
@ -1457,26 +1570,62 @@ qboolean Netchan_CopyNormalFragments(netchan_t *chan)
|
||||
}
|
||||
|
||||
SZ_Clear(&net_message);
|
||||
|
||||
chan->incomingbufs[FRAG_NORMAL_STREAM] = nullptr;
|
||||
chan->incomingready[FRAG_NORMAL_STREAM] = FALSE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
if (*(uint32 *)net_message.data == MAKEID('B', 'Z', '2', '\0'))
|
||||
{
|
||||
// Determine whether decompression of compressed data is allowed
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!sv_net_incoming_decompression.value)
|
||||
{
|
||||
if (chan->player_slot == 0)
|
||||
{
|
||||
Con_DPrintf("Incoming compressed normal fragment disallowed from\n");
|
||||
return FALSE;
|
||||
}
|
||||
// compressed data is expected only after requesting resource list
|
||||
else if (host_client->m_sendrescount == 0)
|
||||
{
|
||||
Con_DPrintf("%s:Incoming compressed normal fragment disallowed from %s\n", NET_AdrToString(chan->remote_address), host_client->name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
char uncompressed[65536];
|
||||
unsigned int uncompressedSize = 65536;
|
||||
BZ2_bzBuffToBuffDecompress(uncompressed, &uncompressedSize, (char*)net_message.data + 4, net_message.cursize - 4, 1, 0);
|
||||
unsigned int uncompressedSize = clamp((int)sv_net_incoming_decompression_max_size.value, 16, 65536); // valid range (16 - 65536) bytes
|
||||
unsigned int compressedSize = net_message.cursize - 4;
|
||||
|
||||
// Decompress net buffer data
|
||||
qboolean success = TRUE;
|
||||
|
||||
if (BZ2_bzBuffToBuffDecompress(uncompressed, &uncompressedSize, (char *)net_message.data + 4, compressedSize, 1, 0) != BZ_OK)
|
||||
{
|
||||
// malformed data or compressed data exceeding sv_net_incoming_decompression_max_size
|
||||
success = FALSE;
|
||||
}
|
||||
else if (!Netchan_ValidateDecompress(chan, FRAG_NORMAL_STREAM, compressedSize, uncompressedSize))
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!success)
|
||||
{
|
||||
// Drop client if decompression was unsuccessful
|
||||
SV_DropClient(host_client, FALSE, "Malformed/abnormal compressed data");
|
||||
SZ_Clear(&net_message);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Copy uncompressed data back to the net buffer
|
||||
Q_memcpy(net_message.data, uncompressed, uncompressedSize);
|
||||
net_message.cursize = uncompressedSize;
|
||||
}
|
||||
|
||||
chan->incomingbufs[FRAG_NORMAL_STREAM] = nullptr;
|
||||
chan->incomingready[FRAG_NORMAL_STREAM] = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1493,7 +1642,6 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
|
||||
qboolean bCompressed;
|
||||
unsigned int uncompressedSize;
|
||||
|
||||
|
||||
if (!chan->incomingready[FRAG_FILE_STREAM])
|
||||
return FALSE;
|
||||
|
||||
@ -1505,6 +1653,19 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (chan->player_slot > 0 && (chan->player_slot - 1) == host_client - g_psvs.clients)
|
||||
{
|
||||
// customization already uploaded with request by operator,
|
||||
// do not accept any other customization
|
||||
if (host_client->uploaddoneregistering)
|
||||
{
|
||||
SV_DropClient(host_client, FALSE, "Too many customization have been uploaded (unrequested customization)");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bCompressed = FALSE;
|
||||
SZ_Clear(&net_message);
|
||||
MSG_BeginReading();
|
||||
@ -1619,10 +1780,53 @@ qboolean Netchan_CopyFileFragments(netchan_t *chan)
|
||||
|
||||
if (bCompressed)
|
||||
{
|
||||
unsigned char* uncompressedBuffer = (unsigned char*)Mem_Malloc(uncompressedSize);
|
||||
Con_DPrintf("Decompressing file %s (%d -> %d)\n", filename, nsize, uncompressedSize);
|
||||
BZ2_bzBuffToBuffDecompress((char*)uncompressedBuffer, &uncompressedSize, (char*)buffer, nsize, 1, 0);
|
||||
// Determine whether decompression of compressed data is allowed
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!sv_net_incoming_decompression.value)
|
||||
{
|
||||
if (chan->player_slot == 0)
|
||||
{
|
||||
Con_DPrintf("Incoming compressed file fragment disallowed from\n");
|
||||
return FALSE;
|
||||
}
|
||||
// compressed data is expected only after requesting resource list
|
||||
else if (host_client->m_sendrescount == 0)
|
||||
{
|
||||
Con_DPrintf("%s:Incoming compressed file fragment disallowed from %s\n", NET_AdrToString(chan->remote_address), host_client->name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uncompressedSize = clamp(uncompressedSize, 16u, (unsigned)sv_net_incoming_decompression_max_size.value); // valid range (16 - 65536) bytes
|
||||
|
||||
qboolean success = TRUE;
|
||||
unsigned char *uncompressedBuffer = (unsigned char *)Mem_Malloc(uncompressedSize);
|
||||
unsigned int compressedSize = nsize;
|
||||
|
||||
// Decompress net buffer data
|
||||
if (BZ2_bzBuffToBuffDecompress((char *)uncompressedBuffer, &uncompressedSize, (char *)buffer, compressedSize, 1, 0) != BZ_OK)
|
||||
{
|
||||
// malformed data or compressed data exceeding sv_net_incoming_decompression_max_size
|
||||
success = FALSE;
|
||||
}
|
||||
else if (!Netchan_ValidateDecompress(chan, FRAG_FILE_STREAM, compressedSize, uncompressedSize))
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
Mem_Free(buffer);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
// Drop client if decompression was unsuccessful
|
||||
SV_DropClient(host_client, FALSE, "Malformed/abnormal compressed data");
|
||||
SZ_Clear(&net_message);
|
||||
Mem_Free(uncompressedBuffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Con_DPrintf("Decompressing file %s (%d -> %d)\n", filename, compressedSize, uncompressedSize);
|
||||
pos = uncompressedSize;
|
||||
buffer = uncompressedBuffer;
|
||||
}
|
||||
@ -1813,6 +2017,15 @@ void Netchan_Init(void)
|
||||
Cvar_RegisterVariable(&net_chokeloopback);
|
||||
Cvar_RegisterVariable(&net_drawslider);
|
||||
Cvar_RegisterVariable(&sv_filetransfercompression);
|
||||
#ifdef REHLDS_FIXES
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_max_ratio);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_max_size);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_min_failures);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_max_failures);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_min_failuretime);
|
||||
Cvar_RegisterVariable(&sv_net_incoming_decompression_punish);
|
||||
#endif
|
||||
Cvar_RegisterVariable(&sv_filetransfermaxsize);
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,7 @@ void NET_AdjustLag()
|
||||
}
|
||||
lasttime = realtime;
|
||||
|
||||
if (allow_cheats || fakelag.value == 0.0)
|
||||
if (sv_cheats.value || fakelag.value == 0.0)
|
||||
{
|
||||
if (fakelag.value != gFakeLag)
|
||||
{
|
||||
@ -689,7 +689,7 @@ qboolean NET_LagPacket(qboolean newdata, netsrc_t sock, netadr_t *from, sizebuf_
|
||||
{
|
||||
if (fakeloss.value != 0.0)
|
||||
{
|
||||
if (allow_cheats)
|
||||
if (sv_cheats.value)
|
||||
{
|
||||
static int losscount[NS_MAX] = {};
|
||||
++losscount[sock];
|
||||
@ -1768,7 +1768,7 @@ void NET_GetLocalAddress()
|
||||
|
||||
if (noip)
|
||||
{
|
||||
Con_Printf("TCP/IP Disabled.\n");
|
||||
Con_DPrintf("TCP/IP Disabled.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1823,7 +1823,7 @@ void NET_GetLocalAddress()
|
||||
#ifdef _WIN32
|
||||
if (noipx)
|
||||
{
|
||||
Con_Printf("No IPX Support.\n");
|
||||
Con_DPrintf("No IPX Support.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
playermove_t *pmove;
|
||||
movevars_t movevars;
|
||||
movevars_t sv_movevars;
|
||||
|
||||
cvar_t pm_showclip = { "pm_showclip", "0", 0, 0.0f, NULL };
|
||||
|
||||
@ -98,7 +98,7 @@ void PM_Init(playermove_t *ppm)
|
||||
VectorCopy(player_maxs[i], ppm->player_maxs[i]);
|
||||
}
|
||||
|
||||
ppm->_movevars = &movevars;
|
||||
ppm->movevars = &sv_movevars;
|
||||
|
||||
ppm->PM_Info_ValueForKey = Info_ValueForKey;
|
||||
ppm->PM_Particle = CL_Particle;
|
||||
|
@ -39,7 +39,7 @@ extern vec3_t player_mins[MAX_MAP_HULLS];
|
||||
extern vec3_t player_maxs[MAX_MAP_HULLS];
|
||||
|
||||
extern playermove_t *pmove;
|
||||
extern movevars_t movevars;
|
||||
extern movevars_t sv_movevars;
|
||||
|
||||
qboolean PM_AddToTouched(pmtrace_t tr, vec_t *impactvelocity);
|
||||
void PM_StuckTouch(int hitent, pmtrace_t *ptraceresult);
|
||||
|
@ -1011,6 +1011,11 @@ qboolean EXT_FUNC PR_IsEmptyString(const char *s)
|
||||
}
|
||||
|
||||
int EXT_FUNC PF_precache_sound_I(const char *s)
|
||||
{
|
||||
return g_RehldsHookchains.m_PF_precache_sound_I.callChain(PF_precache_sound_I_internal, s);
|
||||
}
|
||||
|
||||
int EXT_FUNC PF_precache_sound_I_internal(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
Host_Error("%s: NULL pointer", __func__);
|
||||
@ -1058,6 +1063,11 @@ int EXT_FUNC PF_precache_sound_I(const char *s)
|
||||
}
|
||||
|
||||
unsigned short EXT_FUNC EV_Precache(int type, const char *psz)
|
||||
{
|
||||
return g_RehldsHookchains.m_EV_Precache.callChain(EV_Precache_internal, type, psz);
|
||||
}
|
||||
|
||||
unsigned short EXT_FUNC EV_Precache_internal(int type, const char *psz)
|
||||
{
|
||||
if (!psz)
|
||||
Host_Error("%s: NULL pointer", __func__);
|
||||
@ -1377,6 +1387,11 @@ int SV_LookupModelIndex(const char *name)
|
||||
}
|
||||
|
||||
int EXT_FUNC PF_precache_model_I(const char *s)
|
||||
{
|
||||
return g_RehldsHookchains.m_PF_precache_model_I.callChain(PF_precache_model_I_internal, s);
|
||||
}
|
||||
|
||||
int EXT_FUNC PF_precache_model_I_internal(const char *s)
|
||||
{
|
||||
int iOptional = 0;
|
||||
if (!s)
|
||||
@ -1432,6 +1447,9 @@ int EXT_FUNC PF_precache_model_I(const char *s)
|
||||
{
|
||||
for (int i = 0; i < MAX_MODELS; i++)
|
||||
{
|
||||
if (!g_psv.model_precache[i])
|
||||
continue;
|
||||
|
||||
// use case-sensitive names to increase performance
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!Q_strcmp(g_psv.model_precache[i], s))
|
||||
@ -1445,8 +1463,13 @@ int EXT_FUNC PF_precache_model_I(const char *s)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
int EXT_FUNC PF_precache_generic_I(const char *s)
|
||||
{
|
||||
return g_RehldsHookchains.m_PF_precache_generic_I.callChain(PF_precache_generic_I_internal, s);
|
||||
}
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
int EXT_FUNC PF_precache_generic_I_internal(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
Host_Error("%s: NULL pointer", __func__);
|
||||
@ -1493,7 +1516,7 @@ int EXT_FUNC PF_precache_generic_I(const char *s)
|
||||
return g_rehlds_sv.precachedGenericResourceCount++;
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
int EXT_FUNC PF_precache_generic_I(const char *s)
|
||||
int EXT_FUNC PF_precache_generic_I_internal(const char *s)
|
||||
{
|
||||
if (!s)
|
||||
Host_Error("%s: NULL pointer", __func__);
|
||||
@ -1525,7 +1548,7 @@ int EXT_FUNC PF_precache_generic_I(const char *s)
|
||||
{
|
||||
for (int i = 0; i < MAX_GENERIC; i++)
|
||||
{
|
||||
if (!Q_stricmp(g_psv.generic_precache[i], s))
|
||||
if (g_psv.generic_precache[i] && !Q_stricmp(g_psv.generic_precache[i], s))
|
||||
return i;
|
||||
}
|
||||
Host_Error("%s: '%s' Precache can only be done in spawn functions", __func__, s);
|
||||
@ -1779,7 +1802,14 @@ void EXT_FUNC PF_aim_I(edict_t *ent, float speed, float *rgflReturn)
|
||||
bestdir[1] = dir[1];
|
||||
bestdir[2] = dir[2];
|
||||
bestdir[0] = dir[0];
|
||||
bestdist = sv_aim.value;
|
||||
if (sv_allow_autoaim.value)
|
||||
{
|
||||
bestdist = sv_aim.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
bestdist = 0.0f;
|
||||
}
|
||||
|
||||
for (int i = 1; i < g_psv.num_edicts; i++)
|
||||
{
|
||||
@ -2094,7 +2124,7 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin
|
||||
if (msg_type == 0)
|
||||
Sys_Error("%s: Tried to create a message with a bogus message type ( 0 )", __func__);
|
||||
|
||||
gMsgStarted = 1;
|
||||
gMsgStarted = TRUE;
|
||||
gMsgType = msg_type;
|
||||
gMsgEntity = ed;
|
||||
gMsgDest = msg_dest;
|
||||
@ -2121,7 +2151,7 @@ void EXT_FUNC PF_MessageEnd_I(void)
|
||||
qboolean MsgIsVarLength = 0;
|
||||
if (!gMsgStarted)
|
||||
Sys_Error("%s: called with no active message\n", __func__);
|
||||
gMsgStarted = 0;
|
||||
gMsgStarted = FALSE;
|
||||
|
||||
if (gMsgEntity && (gMsgEntity->v.flags & FL_FAKECLIENT))
|
||||
return;
|
||||
@ -2245,6 +2275,7 @@ void EXT_FUNC PF_WriteByte_I(int iValue)
|
||||
{
|
||||
if (!gMsgStarted)
|
||||
Sys_Error("%s: called with no active message\n", __func__);
|
||||
|
||||
MSG_WriteByte(&gMsgBuffer, iValue);
|
||||
}
|
||||
|
||||
|
@ -120,14 +120,18 @@ edict_t *FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszFiel
|
||||
int GetEntityIllum(edict_t *pEnt);
|
||||
qboolean PR_IsEmptyString(const char *s);
|
||||
int PF_precache_sound_I(const char *s);
|
||||
int PF_precache_sound_I_internal(const char *s);
|
||||
unsigned short EV_Precache(int type, const char *psz);
|
||||
unsigned short EV_Precache_internal(int type, const char *psz);
|
||||
void EV_PlayReliableEvent_api(IGameClient *cl, int entindex, unsigned short eventindex, float delay, event_args_t *pargs);
|
||||
void EV_PlayReliableEvent(client_t *cl, int entindex, unsigned short eventindex, float delay, event_args_t *pargs);
|
||||
void EV_PlayReliableEvent_internal(client_t *cl, int entindex, unsigned short eventindex, float delay, event_args_t *pargs);
|
||||
void EV_Playback(int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||
void EV_SV_Playback(int flags, int clientindex, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||
int PF_precache_model_I(const char *s);
|
||||
int PF_precache_model_I_internal(const char *s);
|
||||
int PF_precache_generic_I(const char *s);
|
||||
int PF_precache_generic_I_internal(const char *s);
|
||||
int PF_IsMapValid_I(const char *mapname);
|
||||
int PF_NumberOfEntities_I(void);
|
||||
char *PF_GetInfoKeyBuffer_I(edict_t *e);
|
||||
|
@ -37,6 +37,11 @@ void ED_ClearEdict(edict_t *e)
|
||||
}
|
||||
|
||||
edict_t *ED_Alloc(void)
|
||||
{
|
||||
return g_RehldsHookchains.m_ED_Alloc.callChain(ED_Alloc_internal);
|
||||
}
|
||||
|
||||
edict_t *EXT_FUNC ED_Alloc_internal(void)
|
||||
{
|
||||
int i;
|
||||
edict_t *e;
|
||||
@ -71,6 +76,11 @@ edict_t *ED_Alloc(void)
|
||||
}
|
||||
|
||||
void ED_Free(edict_t *ed)
|
||||
{
|
||||
g_RehldsHookchains.m_ED_Free.callChain(ED_Free_internal, ed);
|
||||
}
|
||||
|
||||
void EXT_FUNC ED_Free_internal(edict_t *ed)
|
||||
{
|
||||
if (!ed->free)
|
||||
{
|
||||
|
@ -35,7 +35,9 @@
|
||||
|
||||
void ED_ClearEdict(edict_t *e);
|
||||
edict_t *ED_Alloc(void);
|
||||
edict_t *ED_Alloc_internal(void);
|
||||
void ED_Free(edict_t *ed);
|
||||
void ED_Free_internal(edict_t *ed);
|
||||
NOXREF void ED_Count(void);
|
||||
char *ED_NewString(const char *string);
|
||||
char *ED_ParseEdict(char *data, edict_t *ent);
|
||||
|
@ -881,6 +881,15 @@ void EXT_FUNC AnimationAutomove(const edict_t *pEdict, float flTime)
|
||||
void EXT_FUNC GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles)
|
||||
{
|
||||
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!pstudiohdr)
|
||||
return;
|
||||
|
||||
if (iBone < 0 || iBone >= pstudiohdr->numbones)
|
||||
return; // invalid bone
|
||||
#endif
|
||||
|
||||
g_pSvBlendingAPI->SV_StudioSetupBones(
|
||||
g_psv.models[pEdict->v.modelindex],
|
||||
pEdict->v.frame,
|
||||
@ -906,14 +915,23 @@ void EXT_FUNC GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflO
|
||||
mstudioattachment_t *pattachment;
|
||||
vec3_t angles;
|
||||
|
||||
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!pstudiohdr)
|
||||
return;
|
||||
|
||||
if (iAttachment < 0 || iAttachment >= pstudiohdr->numattachments)
|
||||
return; // invalid attachment
|
||||
#endif
|
||||
|
||||
pattachment = (mstudioattachment_t *)((char *)pstudiohdr + pstudiohdr->attachmentindex);
|
||||
pattachment += iAttachment;
|
||||
|
||||
angles[0] = -pEdict->v.angles[0];
|
||||
angles[1] = pEdict->v.angles[1];
|
||||
angles[2] = pEdict->v.angles[2];
|
||||
|
||||
pstudiohdr = (studiohdr_t *)Mod_Extradata(g_psv.models[pEdict->v.modelindex]);
|
||||
pattachment = (mstudioattachment_t *)((char *)pstudiohdr + pstudiohdr->attachmentindex);
|
||||
pattachment += iAttachment;
|
||||
|
||||
g_pSvBlendingAPI->SV_StudioSetupBones(
|
||||
g_psv.models[pEdict->v.modelindex],
|
||||
pEdict->v.frame,
|
||||
|
@ -53,6 +53,7 @@ const int MAX_NAME = 32;
|
||||
#include "pm_defs.h"
|
||||
#include "inst_baseline.h"
|
||||
#include "net_ws.h"
|
||||
#include "pm_shared/pm_movevars.h"
|
||||
|
||||
const int DEFAULT_SOUND_PACKET_VOLUME = 255;
|
||||
const float DEFAULT_SOUND_PACKET_ATTENUATION = 1.0f;
|
||||
@ -95,13 +96,6 @@ typedef enum redirect_e
|
||||
RD_PACKET = 2,
|
||||
} redirect_t;
|
||||
|
||||
typedef enum server_state_e
|
||||
{
|
||||
ss_dead = 0,
|
||||
ss_loading = 1,
|
||||
ss_active = 2,
|
||||
} server_state_t;
|
||||
|
||||
typedef struct server_s
|
||||
{
|
||||
qboolean active;
|
||||
@ -242,6 +236,7 @@ typedef struct client_s
|
||||
double m_lastvoicetime;
|
||||
int m_sendrescount;
|
||||
qboolean m_bSentNewResponse;
|
||||
movevars_t movevars;
|
||||
} client_t;
|
||||
|
||||
enum
|
||||
@ -283,6 +278,7 @@ extern rehlds_server_t g_rehlds_sv;
|
||||
extern cvar_t sv_lan;
|
||||
extern cvar_t sv_lan_rate;
|
||||
extern cvar_t sv_aim;
|
||||
extern cvar_t sv_allow_autoaim;
|
||||
|
||||
extern cvar_t sv_skycolor_r;
|
||||
extern cvar_t sv_skycolor_g;
|
||||
@ -349,7 +345,6 @@ extern cvar_t sv_proxies;
|
||||
extern cvar_t sv_outofdatetime;
|
||||
extern cvar_t mapchangecfgfile;
|
||||
|
||||
extern qboolean allow_cheats;
|
||||
extern cvar_t mp_logecho;
|
||||
extern cvar_t mp_logfile;
|
||||
extern cvar_t sv_allow_download;
|
||||
@ -366,6 +361,7 @@ extern cvar_t sv_visiblemaxplayers;
|
||||
extern cvar_t sv_downloadurl;
|
||||
extern cvar_t sv_allow_dlfile;
|
||||
extern cvar_t sv_version;
|
||||
extern cvar_t sv_tags;
|
||||
#ifdef REHLDS_FIXES
|
||||
extern cvar_t sv_echo_unknown_cmd;
|
||||
extern cvar_t sv_auto_precache_sounds_in_models;
|
||||
@ -405,7 +401,6 @@ enum GameType_e
|
||||
|
||||
extern GameType_e g_eGameType;
|
||||
|
||||
extern int fatbytes;
|
||||
extern int giNextUserMsg;
|
||||
extern int hashstrings_collisions;
|
||||
|
||||
@ -418,10 +413,6 @@ extern delta_t *g_pweapondelta;
|
||||
extern delta_t *g_pusercmddelta;
|
||||
#endif
|
||||
|
||||
extern unsigned char fatpvs[1024];
|
||||
extern int fatpasbytes;
|
||||
extern unsigned char fatpas[1024];
|
||||
|
||||
extern int gPacketSuppressed;
|
||||
|
||||
extern char localinfo[MAX_LOCALINFO];
|
||||
@ -465,13 +456,13 @@ void SV_BuildHashedSoundLookupTable(void);
|
||||
void SV_AddSampleToHashedLookupTable(const char *pszSample, int iSampleIndex);
|
||||
qboolean SV_ValidClientMulticast(client_t *client, int soundLeaf, int to);
|
||||
void SV_Multicast(edict_t *ent, vec_t *origin, int to, qboolean reliable);
|
||||
void SV_WriteMovevarsToClient(sizebuf_t *message);
|
||||
void SV_WriteMovevarsToClient(sizebuf_t *message, struct movevars_s *movevars);
|
||||
void SV_WriteDeltaDescriptionsToClient(sizebuf_t *msg);
|
||||
void SV_SetMoveVars(void);
|
||||
void SV_QueryMovevarsChanged(void);
|
||||
void SV_SetMoveVars(struct movevars_s *movevars);
|
||||
void SV_SendServerinfo(sizebuf_t *msg, client_t *client);
|
||||
void SV_SendServerinfo_internal(sizebuf_t *msg, client_t *client);
|
||||
void SV_SendResources(sizebuf_t *msg);
|
||||
void SV_SendResources_internal(sizebuf_t *msg);
|
||||
void SV_WriteClientdataToMessage(client_t *client, sizebuf_t *msg);
|
||||
void SV_WriteSpawn(sizebuf_t *msg);
|
||||
void SV_SendUserReg(sizebuf_t *msg);
|
||||
@ -498,6 +489,7 @@ int SV_CheckKeyInfo_internal(netadr_t *adr, char *protinfo, unsigned short *port
|
||||
int SV_CheckForDuplicateSteamID(client_t *client);
|
||||
qboolean SV_CheckForDuplicateNames(char *userinfo, qboolean bIsReconnecting, int nExcludeSlot);
|
||||
int SV_CheckUserInfo(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, int nReconnectSlot, char *name);
|
||||
int SV_CheckUserInfo_internal(netadr_t *adr, char *userinfo, qboolean bIsReconnecting, int nReconnectSlot, char *name);
|
||||
int SV_FindEmptySlot(netadr_t *adr, int *pslot, client_t ** ppClient);
|
||||
void SV_ConnectClient(void);
|
||||
void SV_ConnectClient_internal(void);
|
||||
@ -558,6 +550,7 @@ NOXREF qboolean SV_HasEventsInQueue(client_t *client);
|
||||
void SV_GetNetInfo(client_t *client, int *ping, int *packet_loss);
|
||||
int SV_CheckVisibility(edict_t *entity, unsigned char *pset);
|
||||
void SV_EmitPings(client_t *client, sizebuf_t *msg);
|
||||
void SV_EmitPings_internal(client_t *client, sizebuf_t *msg);
|
||||
void SV_WriteEntitiesToClient(client_t *client, sizebuf_t *msg);
|
||||
void SV_CleanupEnts(void);
|
||||
qboolean SV_SendClientDatagram(client_t *client);
|
||||
@ -568,6 +561,7 @@ void SV_SendClientMessages(void);
|
||||
void SV_ExtractFromUserinfo(client_t *cl);
|
||||
int SV_ModelIndex(const char *name);
|
||||
void SV_AddResource(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
||||
void SV_AddResource_internal(resourcetype_t type, const char *name, int size, unsigned char flags, int index);
|
||||
size_t SV_CountResourceByType(resourcetype_t type, resource_t **pResourceList = nullptr, size_t nListMax = 0, size_t *nWidthFileNameMax = nullptr);
|
||||
void SV_CreateGenericResources(void);
|
||||
void SV_CreateResourceList(void);
|
||||
@ -589,6 +583,9 @@ void SV_ClearEntities(void);
|
||||
int RegUserMsg(const char *pszName, int iSize);
|
||||
qboolean StringToFilter(const char *s, ipfilter_t *f);
|
||||
USERID_t *SV_StringToUserID(const char *str);
|
||||
bool CanBeWrittenWithoutCIDR(const ipfilter_t &f);
|
||||
void FilterToString(const ipfilter_t &f, char *s);
|
||||
bool IsFilterIncludesAnotherFilter(const ipfilter_t &f, const ipfilter_t &f2);
|
||||
void SV_BanId_f(void);
|
||||
void Host_Kick_f(void);
|
||||
void SV_RemoveId_f(void);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1491,28 +1491,7 @@ void SV_Physics()
|
||||
if (i > 0 && i <= g_psvs.maxclients)
|
||||
continue;
|
||||
|
||||
if (ent->v.flags & FL_ONGROUND)
|
||||
{
|
||||
edict_t *groundentity = ent->v.groundentity;
|
||||
if (groundentity && (groundentity->v.flags & FL_CONVEYOR))
|
||||
{
|
||||
if (ent->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(ent->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, ent->v.basevelocity);
|
||||
else
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, ent->v.basevelocity);
|
||||
|
||||
ent->v.flags |= FL_BASEVELOCITY;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(ent->v.flags & FL_BASEVELOCITY))
|
||||
{
|
||||
// Apply momentum (add in half of the previous frame of velocity first)
|
||||
VectorMA(ent->v.velocity, (host_frametime * 0.5f + 1.0f), ent->v.basevelocity, ent->v.velocity);
|
||||
VectorClear(ent->v.basevelocity);
|
||||
}
|
||||
|
||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||
SV_CheckMovingGround(ent, host_frametime);
|
||||
|
||||
switch (ent->v.movetype)
|
||||
{
|
||||
|
@ -232,6 +232,10 @@ CSteam3Server::CSteam3Server() :
|
||||
m_CallbackLogonFailure(this, &CSteam3Server::OnLogonFailure),
|
||||
m_SteamIDGS(1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid)
|
||||
{
|
||||
#ifdef REHLDS_FIXES
|
||||
m_GameTagsData[0] = '\0';
|
||||
#endif
|
||||
|
||||
m_bHasActivePlayers = false;
|
||||
m_bWantToBeSecure = false;
|
||||
m_bLanOnly = false;
|
||||
@ -499,6 +503,21 @@ void CSteam3Server::RunFrame()
|
||||
}
|
||||
}
|
||||
|
||||
void CSteam3Server::UpdateGameTags()
|
||||
{
|
||||
#ifdef REHLDS_FIXES
|
||||
if (!m_GameTagsData[0] && !sv_tags.string[0])
|
||||
return;
|
||||
|
||||
if (m_GameTagsData[0] && !Q_stricmp(m_GameTagsData, sv_tags.string))
|
||||
return;
|
||||
|
||||
Q_strlcpy(m_GameTagsData, sv_tags.string);
|
||||
Q_strlwr(m_GameTagsData);
|
||||
CRehldsPlatformHolder::get()->SteamGameServer()->SetGameTags(m_GameTagsData);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CSteam3Server::SendUpdatedServerDetails()
|
||||
{
|
||||
int botCount = 0;
|
||||
@ -521,6 +540,8 @@ void CSteam3Server::SendUpdatedServerDetails()
|
||||
CRehldsPlatformHolder::get()->SteamGameServer()->SetBotPlayerCount(botCount);
|
||||
CRehldsPlatformHolder::get()->SteamGameServer()->SetServerName(Cvar_VariableString("hostname"));
|
||||
CRehldsPlatformHolder::get()->SteamGameServer()->SetMapName(g_psv.name);
|
||||
|
||||
UpdateGameTags();
|
||||
}
|
||||
|
||||
void CSteam3Client::Shutdown()
|
||||
|
@ -54,6 +54,8 @@ protected:
|
||||
bool InitModule();
|
||||
};
|
||||
|
||||
#define MAX_STEAM_TAGS_LENGTH 128 // Steam doesn't send tags string more than 128 bytes
|
||||
|
||||
class CSteam3Server: public CSteam3
|
||||
{
|
||||
public:
|
||||
@ -71,6 +73,10 @@ protected:
|
||||
bool m_bLanOnly;
|
||||
CSteamID m_SteamIDGS;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
char m_GameTagsData[MAX_STEAM_TAGS_LENGTH];
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
NOBODY void SetServerType();
|
||||
@ -96,6 +102,7 @@ public:
|
||||
void NotifyOfLevelChange(bool bForce);
|
||||
void RunFrame();
|
||||
void SendUpdatedServerDetails();
|
||||
void UpdateGameTags();
|
||||
};
|
||||
|
||||
class CSteam3Client: public CSteam3
|
||||
|
@ -138,13 +138,16 @@ void SV_CreateCustomizationList(client_t *pHost)
|
||||
{
|
||||
pCust->nUserData2 = nLumps;
|
||||
gEntityInterface.pfnPlayerCustomization(pHost->edict, pCust);
|
||||
#ifdef REHLDS_FIXES
|
||||
SV_Customization(pHost, pResource, TRUE);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sv_allow_upload.value == 0.0f)
|
||||
Con_Printf("Ignoring custom decal from %s\n", pHost->name);
|
||||
Con_DPrintf("Ignoring custom decal from %s\n", pHost->name);
|
||||
else
|
||||
Con_Printf("Ignoring invalid custom decal from %s\n", pHost->name);
|
||||
Con_DPrintf("Ignoring invalid custom decal from %s\n", pHost->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -157,6 +160,11 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl
|
||||
int nPlayerNumber;
|
||||
client_t *pHost;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
if ((pResource->ucFlags & RES_CUSTOM) && !sv_send_logos.value)
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Get originating player id
|
||||
for (i = 0, pHost = g_psvs.clients; i < g_psvs.maxclients; i++, pHost++)
|
||||
{
|
||||
@ -199,18 +207,13 @@ void SV_Customization(client_t *pPlayer, resource_t *pResource, qboolean bSkipPl
|
||||
// Creates customizations list for the current player and sends resources to other players.
|
||||
void SV_RegisterResources(void)
|
||||
{
|
||||
resource_t *pResource;
|
||||
client_t *pHost = host_client;
|
||||
|
||||
pHost->uploading = FALSE;
|
||||
#ifdef REHLDS_FIXES
|
||||
SV_CreateCustomizationList(pHost); // FIXED: Call this function only once. It was crazy to call it for each resource available.
|
||||
for (pResource = pHost->resourcesonhand.pNext; pResource != &pHost->resourcesonhand; pResource = pResource->pNext)
|
||||
{
|
||||
SV_Customization(pHost, pResource, TRUE);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
for (pResource = pHost->resourcesonhand.pNext; pResource != &pHost->resourcesonhand; pResource = pResource->pNext)
|
||||
for (resource_t *pResource = pHost->resourcesonhand.pNext; pResource != &pHost->resourcesonhand; pResource = pResource->pNext)
|
||||
{
|
||||
SV_CreateCustomizationList(pHost);
|
||||
SV_Customization(pHost, pResource, TRUE);
|
||||
@ -509,8 +512,13 @@ void SV_ParseResourceList(client_t *pSenderClient)
|
||||
}
|
||||
}
|
||||
|
||||
host_client->uploading = TRUE;
|
||||
host_client->uploaddoneregistering = FALSE;
|
||||
#ifdef REHLDS_FIXES
|
||||
if (sv_allow_upload.value != 0.0f)
|
||||
#endif //REHLDS_FIXES
|
||||
{
|
||||
host_client->uploading = TRUE;
|
||||
host_client->uploaddoneregistering = FALSE;
|
||||
|
||||
SV_BatchUploadRequest(host_client);
|
||||
SV_BatchUploadRequest(host_client);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ edict_t *sv_player;
|
||||
qboolean nofind;
|
||||
|
||||
#if defined(SWDS) && defined(REHLDS_FIXES)
|
||||
const char *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", "noclip", "god", "notarget", NULL };
|
||||
#else
|
||||
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
|
||||
@ -511,13 +511,20 @@ void SV_CopyEdictToPhysent(physent_t *pe, int e, edict_t *check)
|
||||
pe->vuser4[2] = check->v.vuser4[2];
|
||||
}
|
||||
|
||||
bool EXT_FUNC SV_AllowPhysent_mod(edict_t* check, edict_t* sv_player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SV_AllowPhysent(edict_t* check, edict_t* sv_player) {
|
||||
return g_RehldsHookchains.m_SV_AllowPhysent.callChain(SV_AllowPhysent_mod, check, sv_player);
|
||||
}
|
||||
|
||||
void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
|
||||
{
|
||||
struct link_s *l;
|
||||
edict_t *check;
|
||||
int e;
|
||||
physent_t *ve;
|
||||
int i;
|
||||
link_t *next;
|
||||
float *fmax;
|
||||
float *fmin;
|
||||
@ -547,6 +554,11 @@ void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
|
||||
if (check->v.solid != SOLID_BSP && check->v.solid != SOLID_BBOX && check->v.solid != SOLID_SLIDEBOX && check->v.solid != SOLID_NOT)
|
||||
continue;
|
||||
|
||||
// Apply our own custom checks
|
||||
if (!SV_AllowPhysent(check, sv_player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
e = NUM_FOR_EDICT(check);
|
||||
ve = &pmove->visents[pmove->numvisent];
|
||||
pmove->numvisent = pmove->numvisent + 1;
|
||||
@ -575,13 +587,7 @@ void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
|
||||
if (check->v.flags & FL_CLIENT)
|
||||
SV_GetTrueMinMax(e - 1, &fmin, &fmax);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (fmin[i] > pmove_maxs[i] || fmax[i] < pmove_mins[i])
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != 3)
|
||||
if (!BoundsIntersect(pmove_mins, pmove_maxs, fmin, fmax))
|
||||
continue;
|
||||
|
||||
if (check->v.solid || check->v.skin != -16)
|
||||
@ -680,35 +686,33 @@ qboolean SV_PlayerRunThink(edict_t *ent, float frametime, double clienttimebase)
|
||||
return ent->free == 0;
|
||||
}
|
||||
|
||||
void SV_CheckMovingGround(edict_t *player, float frametime)
|
||||
void SV_CheckMovingGround(edict_t *ent, float frametime)
|
||||
{
|
||||
edict_t *groundentity;
|
||||
|
||||
if (player->v.flags & FL_ONGROUND)
|
||||
if (ent->v.flags & FL_ONGROUND)
|
||||
{
|
||||
groundentity = player->v.groundentity;
|
||||
groundentity = ent->v.groundentity;
|
||||
if (groundentity)
|
||||
{
|
||||
if (groundentity->v.flags & FL_CONVEYOR)
|
||||
{
|
||||
if (player->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(player->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, player->v.basevelocity);
|
||||
if (ent->v.flags & FL_BASEVELOCITY)
|
||||
VectorMA(ent->v.basevelocity, groundentity->v.speed, groundentity->v.movedir, ent->v.basevelocity);
|
||||
else
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, player->v.basevelocity);
|
||||
player->v.flags |= FL_BASEVELOCITY;
|
||||
VectorScale(groundentity->v.movedir, groundentity->v.speed, ent->v.basevelocity);
|
||||
ent->v.flags |= FL_BASEVELOCITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(player->v.flags & FL_BASEVELOCITY))
|
||||
if (!(ent->v.flags & FL_BASEVELOCITY))
|
||||
{
|
||||
VectorMA(player->v.velocity, frametime * 0.5f + 1.0f, player->v.basevelocity, player->v.velocity);
|
||||
player->v.basevelocity[0] = 0;
|
||||
player->v.basevelocity[1] = 0;
|
||||
player->v.basevelocity[2] = 0;
|
||||
VectorMA(ent->v.velocity, frametime * 0.5f + 1.0f, ent->v.basevelocity, ent->v.velocity);
|
||||
VectorClear(ent->v.basevelocity);
|
||||
}
|
||||
|
||||
player->v.flags &= ~FL_BASEVELOCITY;
|
||||
ent->v.flags &= ~FL_BASEVELOCITY;
|
||||
}
|
||||
|
||||
void SV_ConvertPMTrace(trace_t *dest, pmtrace_t *src, edict_t *ent)
|
||||
@ -878,7 +882,11 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
|
||||
pmove->spectator = 0;
|
||||
pmove->waterjumptime = sv_player->v.teleport_time;
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
Q_memcpy(&pmove->cmd, ucmd, sizeof(pmove->cmd));
|
||||
#else
|
||||
Q_memcpy(&pmove->cmd, &cmd, sizeof(pmove->cmd));
|
||||
#endif
|
||||
|
||||
pmove->dead = sv_player->v.health <= 0.0;
|
||||
pmove->movetype = sv_player->v.movetype;
|
||||
@ -921,9 +929,17 @@ void SV_RunCmd(usercmd_t *ucmd, int random_seed)
|
||||
pmove->PM_PlaySound = PM_SV_PlaySound;
|
||||
pmove->PM_TraceTexture = PM_SV_TraceTexture;
|
||||
pmove->PM_PlaybackEventFull = PM_SV_PlaybackEventFull;
|
||||
pmove->movevars = &host_client->movevars;
|
||||
|
||||
const movevars_t movevars = *pmove->movevars; // preserve current movevars
|
||||
host_client->movevars = sv_movevars; // always use global movevars as a base
|
||||
|
||||
gEntityInterface.pfnPM_Move(pmove, TRUE);
|
||||
|
||||
// Determine whether movevars has changed or not
|
||||
if (!host_client->fakeclient && Q_memcmp(&movevars, pmove->movevars, sizeof(movevars)) != 0)
|
||||
SV_WriteMovevarsToClient(&host_client->netchan.message, pmove->movevars); // sync movevars for the client
|
||||
|
||||
sv_player->v.deadflag = pmove->deadflag;
|
||||
sv_player->v.effects = pmove->effects;
|
||||
sv_player->v.teleport_time = pmove->waterjumptime;
|
||||
|
@ -1083,6 +1083,10 @@ void LoadThisDll(const char *szDllFilename)
|
||||
goto IgnoreThisDLL;
|
||||
}
|
||||
|
||||
#ifdef REHLDS_API
|
||||
MessageManager().Init();
|
||||
#endif
|
||||
|
||||
pfnGiveFnptrsToDll(&g_engfuncsExportedToDlls, &gGlobalVariables);
|
||||
if (g_iextdllMac == MAX_EXTENSION_DLL)
|
||||
{
|
||||
@ -1150,46 +1154,47 @@ void EXT_FUNC EngineFprintf(void *pfile, const char *szFmt, ...)
|
||||
|
||||
void EXT_FUNC AlertMessage(ALERT_TYPE atype, const char *szFmt, ...)
|
||||
{
|
||||
char szOut[2048];
|
||||
va_list argptr;
|
||||
static char szOut[1024];
|
||||
|
||||
va_start(argptr, szFmt);
|
||||
if (atype == at_logged && g_psvs.maxclients > 1)
|
||||
{
|
||||
va_start(argptr, szFmt);
|
||||
Q_vsnprintf(szOut, sizeof(szOut), szFmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
Log_Printf("%s", szOut);
|
||||
return;
|
||||
}
|
||||
else if (developer.value != 0.0f)
|
||||
{
|
||||
switch (atype)
|
||||
{
|
||||
case at_notice:
|
||||
Q_strcpy(szOut, "NOTE: ");
|
||||
break;
|
||||
case at_console:
|
||||
szOut[0] = 0;
|
||||
break;
|
||||
case at_aiconsole:
|
||||
if (developer.value < 2.0f)
|
||||
return;
|
||||
szOut[0] = 0;
|
||||
break;
|
||||
case at_warning:
|
||||
Q_strcpy(szOut, "WARNING: ");
|
||||
break;
|
||||
case at_error:
|
||||
Q_strcpy(szOut, "ERROR: ");
|
||||
break;
|
||||
case at_logged:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int iLen = Q_strlen(szOut);
|
||||
Q_vsnprintf(&szOut[iLen], sizeof(szOut) - iLen, szFmt, argptr);
|
||||
Con_Printf("%s", szOut);
|
||||
}
|
||||
|
||||
if (!developer.value)
|
||||
return;
|
||||
|
||||
if (atype == at_aiconsole && developer.value < 2)
|
||||
return;
|
||||
|
||||
va_start(argptr, szFmt);
|
||||
Q_vsnprintf(szOut, sizeof(szOut), szFmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
switch (atype)
|
||||
{
|
||||
case at_notice:
|
||||
Con_Printf("NOTE: %s", szOut);
|
||||
break;
|
||||
case at_console:
|
||||
case at_aiconsole:
|
||||
Con_Printf("%s", szOut);
|
||||
break;
|
||||
case at_warning:
|
||||
Con_Printf("WARNING: %s", szOut);
|
||||
break;
|
||||
case at_error:
|
||||
Con_Printf("ERROR: %s", szOut);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NOXREF void Sys_SplitPath(const char *path, char *drive, char *dir, char *fname, char *ext)
|
||||
@ -1318,7 +1323,7 @@ void Con_DebugLog(const char *file, const char *fmt, ...)
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
void EXT_FUNC Con_Printf(const char *fmt, ...)
|
||||
void Con_Printf(const char *fmt, ...)
|
||||
{
|
||||
char Dest[4096];
|
||||
va_list va;
|
||||
@ -1327,6 +1332,11 @@ void EXT_FUNC Con_Printf(const char *fmt, ...)
|
||||
Q_vsnprintf(Dest, sizeof(Dest), fmt, va);
|
||||
va_end(va);
|
||||
|
||||
g_RehldsHookchains.m_Con_Printf.callChain(Con_Printf_internal, Dest);
|
||||
}
|
||||
|
||||
void EXT_FUNC Con_Printf_internal(const char *Dest)
|
||||
{
|
||||
#ifdef REHLDS_FLIGHT_REC
|
||||
FR_Log("REHLDS_CON", Dest);
|
||||
#endif
|
||||
|
@ -135,5 +135,6 @@ void Con_Debug_f(void);
|
||||
void Con_Init(void);
|
||||
void Con_DebugLog(const char *file, const char *fmt, ...);
|
||||
void Con_Printf(const char *fmt, ...);
|
||||
void Con_Printf_internal(const char *Dest);
|
||||
void Con_SafePrintf(const char *fmt, ...);
|
||||
void Con_DPrintf(const char *fmt, ...);
|
||||
|
@ -109,10 +109,10 @@ qboolean TEX_InitFromWad(char *path)
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
texfile = FS_Open(wadPath, "rb");
|
||||
texfiles[nTexFiles++] = texfile;
|
||||
if (!texfile)
|
||||
Sys_Error("%s: couldn't open %s\n", __func__, wadPath);
|
||||
|
||||
texfiles[nTexFiles++] = texfile;
|
||||
Con_DPrintf("Using WAD File: %s\n", wadPath);
|
||||
SafeRead(texfile, &header, 12);
|
||||
if (Q_strncmp(header.identification, "WAD2", 4) && Q_strncmp(header.identification, "WAD3", 4))
|
||||
@ -147,8 +147,9 @@ void TEX_CleanupWadInfo(void)
|
||||
|
||||
for (int i = 0; i < nTexFiles; i++)
|
||||
{
|
||||
FS_Close(texfiles[i]);
|
||||
texfiles[i] = 0;
|
||||
if (texfiles[i])
|
||||
FS_Close(texfiles[i]);
|
||||
texfiles[i] = NULL;
|
||||
}
|
||||
|
||||
nTexLumps = 0;
|
||||
|
@ -285,7 +285,7 @@ static const uint32_t g_isPrintTable[2048] = {
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF0000, 0xFFFFFFFF, 0xFFFCFFFF, 0xFFFFFFFF, 0x000000FF, 0x0FFF0000,
|
||||
0x03FF0000, 0xFFFF0000, 0xFFF7FFFF, 0xFFDF0D0B, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x9FFFFFFF,
|
||||
0x8FFFF7EE, 0xBFFFFFFF, 0xAFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFF, 0x1CFCFCFC, 0x00000000
|
||||
0x8FFFF7EE, 0xBFFFFFFF, 0xAFFFFFFE, 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFFFFFE, 0x1CFCFCFC, 0x00000000
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -461,7 +461,7 @@ static uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStri
|
||||
// walk backwards from the end of the string, killing any whitespace
|
||||
*pbStrippedWhitespace = false;
|
||||
|
||||
uchar16 *pwchEnd = pwch + cchLength;
|
||||
uchar16 *pwchEnd = pwch + cchLength - 1;
|
||||
while (--pwchEnd >= pwch)
|
||||
{
|
||||
if (!iswspace(*pwchEnd) && !Q_IsMeanSpaceW(*pwchEnd))
|
||||
@ -474,7 +474,7 @@ static uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStri
|
||||
// walk forward in the string
|
||||
while (pwch < pwchEnd)
|
||||
{
|
||||
if (!iswspace(*pwch))
|
||||
if (!iswspace(*pwch) && !Q_IsMeanSpaceW(*pwch))
|
||||
break;
|
||||
|
||||
*pbStrippedWhitespace = true;
|
||||
@ -484,7 +484,7 @@ static uchar16 *StripWhitespaceWorker(uchar16 *pwch, int cchLength, bool *pbStri
|
||||
return pwch;
|
||||
}
|
||||
|
||||
uchar16 *__cdecl StripUnprintableWorker(uchar16 *pwch, bool *pStripped)
|
||||
uchar16 *__cdecl StripUnprintableWorker(uchar16 *pwch, int *pLength, bool *pStripped)
|
||||
{
|
||||
uchar16* rPos = pwch;
|
||||
uchar16* wPos = pwch;
|
||||
@ -503,6 +503,10 @@ uchar16 *__cdecl StripUnprintableWorker(uchar16 *pwch, bool *pStripped)
|
||||
|
||||
*wPos = 0;
|
||||
*pStripped = rPos != wPos;
|
||||
|
||||
if (*pStripped)
|
||||
*pLength = (wPos - pwch) + 1; // null termination
|
||||
|
||||
return pwch;
|
||||
}
|
||||
|
||||
@ -736,8 +740,8 @@ qboolean Q_StripUnprintableAndSpace(char *pch)
|
||||
bStrippedAny = false;
|
||||
bStrippedWhitespace = false;
|
||||
int cwch = (unsigned int)Q_UTF8ToUTF16(pch, (uchar16 *)pwch_alloced, cubDest, _STRINGCONVERTFLAG_ASSERT) >> 1;
|
||||
uchar16 * pwch = StripUnprintableWorker(pwch_alloced, &bStrippedAny);
|
||||
pwch = StripWhitespaceWorker(pwch, cwch - 1, &bStrippedWhitespace);
|
||||
uchar16 * pwch = StripUnprintableWorker(pwch_alloced, &cwch, &bStrippedAny);
|
||||
pwch = StripWhitespaceWorker(pwch, cwch, &bStrippedWhitespace);
|
||||
if (bStrippedWhitespace || bStrippedAny)
|
||||
Q_UTF16ToUTF8(pwch, pch, cch, STRINGCONVERT_ASSERT_REPLACE);
|
||||
|
||||
|
@ -31,11 +31,14 @@
|
||||
#include "maintypes.h"
|
||||
#include "quakedef.h"
|
||||
|
||||
// The maximum length of a usermessage name in a network transmission
|
||||
#define MAX_USERMESSAGES_LENGTH 16
|
||||
|
||||
typedef struct _UserMsg
|
||||
{
|
||||
int iMsg;
|
||||
int iSize;
|
||||
char szName[16];
|
||||
char szName[MAX_USERMESSAGES_LENGTH];
|
||||
struct _UserMsg *next;
|
||||
pfnUserMsgHook pfn;
|
||||
} UserMsg;
|
||||
|
@ -238,7 +238,8 @@ hull_t *SV_HullForEntity(edict_t *ent, const vec_t *mins, const vec_t *maxs, vec
|
||||
// explicit hulls in the BSP model
|
||||
if (ent->v.movetype != MOVETYPE_PUSH && ent->v.movetype != MOVETYPE_PUSHSTEP)
|
||||
{
|
||||
Sys_Error("%s: SOLID_BSP without MOVETYPE_PUSH", __func__);
|
||||
Sys_Error("%s: SOLID_BSP without MOVETYPE_PUSH\nEntity classname = %s, model = %s",
|
||||
__func__, STRING(ent->v.classname), STRING(ent->v.model));
|
||||
}
|
||||
|
||||
return SV_HullForBsp(ent, mins, maxs, offset);
|
||||
@ -358,12 +359,7 @@ void SV_TouchLinks(edict_t *ent, areanode_t *node)
|
||||
if (touch->v.solid != SOLID_TRIGGER)
|
||||
continue;
|
||||
|
||||
if (ent->v.absmin[0] > touch->v.absmax[0]
|
||||
|| ent->v.absmin[1] > touch->v.absmax[1]
|
||||
|| ent->v.absmin[2] > touch->v.absmax[2]
|
||||
|| ent->v.absmax[0] < touch->v.absmin[0]
|
||||
|| ent->v.absmax[1] < touch->v.absmin[1]
|
||||
|| ent->v.absmax[2] < touch->v.absmin[2])
|
||||
if (!BoundsIntersect(ent->v.absmin, ent->v.absmax, touch->v.absmin, touch->v.absmax))
|
||||
continue;
|
||||
|
||||
// check brush triggers accuracy
|
||||
@ -646,12 +642,7 @@ int SV_LinkContents(areanode_t *node, const vec_t *pos)
|
||||
if (Mod_GetType(touch->v.modelindex) != mod_brush)
|
||||
continue;
|
||||
|
||||
if (pos[0] > touch->v.absmax[0]
|
||||
|| pos[1] > touch->v.absmax[1]
|
||||
|| pos[2] > touch->v.absmax[2]
|
||||
|| pos[0] < touch->v.absmin[0]
|
||||
|| pos[1] < touch->v.absmin[1]
|
||||
|| pos[2] < touch->v.absmin[2])
|
||||
if (!BoundsIntersect(pos, pos, touch->v.absmin, touch->v.absmax))
|
||||
continue;
|
||||
|
||||
int contents = touch->v.skin;
|
||||
@ -1189,13 +1180,15 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
|
||||
if (touch->v.solid == SOLID_TRIGGER)
|
||||
Sys_Error("%s: Trigger in clipping list", __func__);
|
||||
|
||||
#ifndef REHLDS_OPT_PEDANTIC
|
||||
if (gNewDLLFunctions.pfnShouldCollide && !gNewDLLFunctions.pfnShouldCollide(touch, clip->passedict))
|
||||
#ifdef REHLDS_FIXES
|
||||
// https://github.com/dreamstalker/rehlds/issues/46
|
||||
continue;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
#endif // REHLDS_FIXES
|
||||
#endif // REHLDS_OPT_PEDANTIC
|
||||
|
||||
// monsterclip filter
|
||||
if (touch->v.solid == SOLID_BSP)
|
||||
@ -1213,12 +1206,7 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
|
||||
if (clip->ignoretrans && touch->v.rendermode != kRenderNormal && !(touch->v.flags & FL_WORLDBRUSH))
|
||||
continue;
|
||||
|
||||
if (clip->boxmins[0] > touch->v.absmax[0]
|
||||
|| clip->boxmins[1] > touch->v.absmax[1]
|
||||
|| clip->boxmins[2] > touch->v.absmax[2]
|
||||
|| clip->boxmaxs[0] < touch->v.absmin[0]
|
||||
|| clip->boxmaxs[1] < touch->v.absmin[1]
|
||||
|| clip->boxmaxs[2] < touch->v.absmin[2])
|
||||
if (!BoundsIntersect(clip->boxmins, clip->boxmaxs, touch->v.absmin, touch->v.absmax))
|
||||
continue;
|
||||
|
||||
if (touch->v.solid != SOLID_SLIDEBOX
|
||||
@ -1247,6 +1235,16 @@ void SV_ClipToLinks(areanode_t *node, moveclip_t *clip)
|
||||
continue; // don't clip against owner
|
||||
}
|
||||
|
||||
#ifdef REHLDS_OPT_PEDANTIC
|
||||
if (gNewDLLFunctions.pfnShouldCollide && !gNewDLLFunctions.pfnShouldCollide(touch, clip->passedict))
|
||||
#ifdef REHLDS_FIXES
|
||||
// https://github.com/dreamstalker/rehlds/issues/46
|
||||
continue;
|
||||
#else
|
||||
return;
|
||||
#endif // REHLDS_FIXES
|
||||
#endif // REHLDS_OPT_PEDANTIC
|
||||
|
||||
trace_t trace;
|
||||
if (touch->v.flags & FL_MONSTER)
|
||||
trace = SV_ClipMoveToEntity(touch, clip->start, clip->mins2, clip->maxs2, clip->end);
|
||||
@ -1297,12 +1295,7 @@ void SV_ClipToWorldbrush(areanode_t *node, moveclip_t *clip)
|
||||
if (!(touch->v.flags & FL_WORLDBRUSH))
|
||||
continue;
|
||||
|
||||
if (clip->boxmins[0] > touch->v.absmax[0]
|
||||
|| clip->boxmins[1] > touch->v.absmax[1]
|
||||
|| clip->boxmins[2] > touch->v.absmax[2]
|
||||
|| clip->boxmaxs[0] < touch->v.absmin[0]
|
||||
|| clip->boxmaxs[1] < touch->v.absmin[1]
|
||||
|| clip->boxmaxs[2] < touch->v.absmin[2])
|
||||
if (!BoundsIntersect(clip->boxmins, clip->boxmaxs, touch->v.absmin, touch->v.absmax))
|
||||
continue;
|
||||
|
||||
if (clip->trace.allsolid)
|
||||
|
@ -679,7 +679,7 @@ void Cache_Force_Flush()
|
||||
|
||||
void Cache_Flush()
|
||||
{
|
||||
if (g_pcl.maxclients <= 1 || allow_cheats)
|
||||
if (g_pcl.maxclients <= 1 || sv_cheats.value)
|
||||
{
|
||||
Cache_Force_Flush();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "maintypes.h"
|
||||
|
||||
#define ZONE_DYNAMIC_SIZE 0x20000
|
||||
#define ZONE_DYNAMIC_SIZE 0x200000
|
||||
|
||||
typedef struct memblock_s memblock_t;
|
||||
typedef struct memzone_s memzone_t;
|
||||
|
@ -59,7 +59,7 @@ FILE *CFileSystem_Stdio::FS_fopen(const char *filename, const char *options, boo
|
||||
#ifndef _WIN32
|
||||
if (!tst && !Q_strchr(options, 'w') && !Q_strchr(options, '+')) {
|
||||
const char *file = findFileInDirCaseInsensitive(filename);
|
||||
tst = fopen(filename, options);
|
||||
tst = fopen(file, options);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
|
@ -258,7 +258,7 @@ typedef struct CaseFoldHashBucket
|
||||
|
||||
#include "pathmatch_casefolding.h"
|
||||
|
||||
inline static void locate_case_fold_mapping(const uint32_t from, uint32_t *to)
|
||||
inline __attribute__((always_inline)) static void locate_case_fold_mapping(const uint32_t from, uint32_t *to)
|
||||
{
|
||||
const uint8_t hashed = ((from ^ (from >> 8)) & 0xFF);
|
||||
const CaseFoldHashBucket *bucket = &case_fold_hash[hashed];
|
||||
@ -282,7 +282,7 @@ inline static void locate_case_fold_mapping(const uint32_t from, uint32_t *to)
|
||||
to[2] = 0;
|
||||
}
|
||||
|
||||
inline static uint32_t *fold_utf8(const char *str)
|
||||
inline __attribute__((always_inline)) static uint32_t *fold_utf8(const char *str)
|
||||
{
|
||||
uint32_t *retval = new uint32_t[(Q_strlen(str) * 3) + 1];
|
||||
uint32_t *dst = retval;
|
||||
@ -313,7 +313,7 @@ inline static uint32_t *fold_utf8(const char *str)
|
||||
return retval;
|
||||
}
|
||||
|
||||
inline static int utf8casecmp_loop(const uint32_t *folded1, const uint32_t *folded2)
|
||||
inline __attribute__((always_inline)) static int utf8casecmp_loop(const uint32_t *folded1, const uint32_t *folded2)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
@ -356,7 +356,7 @@ public:
|
||||
operator DIR *() { return m_pDir; }
|
||||
operator bool() { return m_pDir != nullptr; }
|
||||
|
||||
private:
|
||||
private:
|
||||
void Close() { if (m_pDir) closedir(m_pDir); }
|
||||
|
||||
DIR *m_pDir;
|
||||
@ -500,22 +500,6 @@ static bool Descend(char *pPath, size_t nStartIdx, bool bAllowBasenameMismatch,
|
||||
return false;
|
||||
}
|
||||
|
||||
char *GetSteamContentPath()
|
||||
{
|
||||
char szContentLink[4096];
|
||||
Q_snprintf(szContentLink, sizeof(szContentLink), "%s/.steam/steam", getenv("HOME"));
|
||||
|
||||
char *pszContentPath = realpath(szContentLink, nullptr);
|
||||
if (pszContentPath) {
|
||||
Q_strcat(pszContentPath, "/");
|
||||
}
|
||||
else {
|
||||
pszContentPath = Q_strdup("/");
|
||||
}
|
||||
|
||||
return pszContentPath;
|
||||
}
|
||||
|
||||
#ifdef DO_PATHMATCH_CACHE
|
||||
typedef std::map<std::string, std::pair<std::string, time_t> > resultCache_t;
|
||||
typedef std::map<std::string, std::pair<std::string, time_t> >::iterator resultCacheItr_t;
|
||||
@ -574,33 +558,39 @@ PathMod_t pathmatch(const char *pszIn, char **ppszOut, bool bAllowBasenameMismat
|
||||
|
||||
if (pPath)
|
||||
{
|
||||
// I believe this code is broken. I'm guessing someone wanted to avoid lowercasing
|
||||
// the path before the steam directory - but it's actually skipping lowercasing
|
||||
// whenever steam is found anywhere - including the filename. For example,
|
||||
// /home/mikesart/valvesrc/console/l4d2/game/left4dead2_dlc1/particles/steam_fx.pcf
|
||||
// winds up only having the "steam_fx.pcf" portion lowercased.
|
||||
#ifdef NEVER
|
||||
// optimization, if the path contained steam somewhere
|
||||
// assume the path up through the component with 'steam' in
|
||||
// is valid (because we almost certainly obtained it
|
||||
// progamatically
|
||||
size_t nStartIdx = 0;
|
||||
static char *pszSteamPath = nullptr;
|
||||
static size_t nSteamPathLen = 0;
|
||||
if (!pszSteamPath)
|
||||
char *p = strcasestr(pPath, "steam");
|
||||
if (p)
|
||||
{
|
||||
pszSteamPath = GetSteamContentPath();
|
||||
nSteamPathLen = Q_strlen(pszSteamPath);
|
||||
}
|
||||
while (p > pPath)
|
||||
{
|
||||
if (p[-1] == '/')
|
||||
break;
|
||||
p--;
|
||||
}
|
||||
|
||||
// optimization, if the path contained steam somewhere
|
||||
// assume the path up through the component with 'steam' in
|
||||
// is valid (because we almost certainly obtained it
|
||||
// progamatically
|
||||
if (strncasecmp(pPath, pszSteamPath, nSteamPathLen) == 0)
|
||||
if ((p == pPath + 1) && (*pPath != '/'))
|
||||
p = pPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
nStartIdx = nSteamPathLen - 1;
|
||||
Q_memcpy(pPath, pszSteamPath, nStartIdx);
|
||||
p = pPath;
|
||||
}
|
||||
|
||||
#else
|
||||
char *p = pPath;
|
||||
#endif
|
||||
|
||||
// Try the lower casing of the remaining path
|
||||
char *pBasename = p + nStartIdx;
|
||||
char *pBasename = p;
|
||||
while (*p)
|
||||
{
|
||||
if (*p == '/') {
|
||||
@ -620,7 +610,7 @@ PathMod_t pathmatch(const char *pszIn, char **ppszOut, bool bAllowBasenameMismat
|
||||
|
||||
// path didn't match lowered successfully, restore the basename
|
||||
// if bAllowBasenameMismatch was true
|
||||
if (bAllowBasenameMismatch && *pBasename)
|
||||
if (bAllowBasenameMismatch)
|
||||
{
|
||||
const char *pSrc = pszIn + (pBasename - pPath);
|
||||
while (*pBasename)
|
||||
@ -635,7 +625,7 @@ PathMod_t pathmatch(const char *pszIn, char **ppszOut, bool bAllowBasenameMismat
|
||||
DEBUG_BREAK();
|
||||
}
|
||||
|
||||
bool bSuccess = Descend(pPath, nStartIdx, bAllowBasenameMismatch);
|
||||
bool bSuccess = Descend(pPath, 0, bAllowBasenameMismatch);
|
||||
if (bSuccess)
|
||||
{
|
||||
*ppszOut = pPath;
|
||||
|
@ -119,6 +119,7 @@
|
||||
<ClCompile Include="..\rehlds\FlightRecorderImpl.cpp" />
|
||||
<ClCompile Include="..\rehlds\flight_recorder.cpp" />
|
||||
<ClCompile Include="..\rehlds\main.cpp" />
|
||||
<ClCompile Include="..\rehlds\rehlds_messagemngr_impl.cpp" />
|
||||
<ClCompile Include="..\rehlds\rehlds_api_impl.cpp" />
|
||||
<ClCompile Include="..\rehlds\rehlds_interfaces_impl.cpp" />
|
||||
<ClCompile Include="..\rehlds\hookchains_impl.cpp" />
|
||||
@ -386,6 +387,7 @@
|
||||
<ClInclude Include="..\public\rehlds\eiface.h" />
|
||||
<ClInclude Include="..\public\rehlds\FlightRecorder.h" />
|
||||
<ClInclude Include="..\public\rehlds\hookchains.h" />
|
||||
<ClInclude Include="..\public\rehlds\IMessageManager.h" />
|
||||
<ClInclude Include="..\public\rehlds\keydefs.h" />
|
||||
<ClInclude Include="..\public\rehlds\maintypes.h" />
|
||||
<ClInclude Include="..\public\rehlds\model.h" />
|
||||
@ -439,6 +441,7 @@
|
||||
<ClInclude Include="..\rehlds\FlightRecorderImpl.h" />
|
||||
<ClInclude Include="..\rehlds\flight_recorder.h" />
|
||||
<ClInclude Include="..\rehlds\hookchains_impl.h" />
|
||||
<ClInclude Include="..\rehlds\rehlds_messagemngr_impl.h" />
|
||||
<ClInclude Include="..\rehlds\platform.h" />
|
||||
<ClInclude Include="..\rehlds\precompiled.h" />
|
||||
<ClInclude Include="..\rehlds\RehldsRuntimeConfig.h" />
|
||||
@ -463,6 +466,7 @@
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\version\msvc\version.vcxproj">
|
||||
<Project>{6973dca5-253c-4d84-b51e-187e035eae06}</Project>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
|
@ -341,6 +341,9 @@
|
||||
<ClCompile Include="..\testsuite\memory.cpp">
|
||||
<Filter>testsuite</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\rehlds\rehlds_messagemngr_impl.cpp">
|
||||
<Filter>rehlds</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\version\version.h">
|
||||
@ -1060,5 +1063,11 @@
|
||||
<ClInclude Include="..\testsuite\memory.h">
|
||||
<Filter>testsuite</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\rehlds\rehlds_messagemngr_impl.h">
|
||||
<Filter>rehlds</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\rehlds\IMessageManager.h">
|
||||
<Filter>public\rehlds</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -184,7 +184,7 @@ typedef struct playermove_s
|
||||
|
||||
char physinfo[ MAX_PHYSINFO_STRING ]; // Physics info string
|
||||
|
||||
struct movevars_s *_movevars;
|
||||
struct movevars_s *movevars;
|
||||
vec3_t player_mins[MAX_MAP_HULLS];
|
||||
vec3_t player_maxs[MAX_MAP_HULLS];
|
||||
|
||||
|
337
rehlds/public/rehlds/IMessageManager.h
Normal file
337
rehlds/public/rehlds/IMessageManager.h
Normal file
@ -0,0 +1,337 @@
|
||||
/*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @brief Interface for defining message parameters and behavior for a individual message object
|
||||
*/
|
||||
class IMessage
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief The parameter types for a message
|
||||
*/
|
||||
enum class ParamType : uint8
|
||||
{
|
||||
Byte,
|
||||
Char,
|
||||
Short,
|
||||
Long,
|
||||
Angle,
|
||||
Coord,
|
||||
String,
|
||||
Entity,
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Blocking behavior types for messages
|
||||
*/
|
||||
enum class BlockType : uint8
|
||||
{
|
||||
Not, // Not a block
|
||||
Once, // Block once
|
||||
Set // Set block
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Message destinations
|
||||
*/
|
||||
enum class Dest : uint8
|
||||
{
|
||||
BROADCAST, // Unreliable to all
|
||||
ONE, // Reliable to one (msg_entity)
|
||||
ALL, // Reliable to all
|
||||
INIT, // Write to the init string
|
||||
PVS, // Ents in PVS of org
|
||||
PAS, // Ents in PAS of org
|
||||
PVS_R, // Reliable to PVS
|
||||
PAS_R, // Reliable to PAS
|
||||
ONE_UNRELIABLE, // Send to one client, but don't put in reliable stream, put in unreliable datagram
|
||||
SPEC, // Sends to all spectator proxies
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Data types for message data
|
||||
*/
|
||||
enum class DataType : uint8
|
||||
{
|
||||
Any, // Any part of the message
|
||||
Dest, // Destination of the message
|
||||
Index, // Index of the message
|
||||
Origin, // Origin of the message
|
||||
Edict, // Pointer to the edict of the recipient client
|
||||
Param, // Parameter of the message
|
||||
Max
|
||||
};
|
||||
|
||||
virtual ~IMessage() = default;
|
||||
|
||||
/**
|
||||
* @brief Returns the number of parameters in the message
|
||||
* @return The number of parameters
|
||||
*/
|
||||
virtual int getParamCount() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the type of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @return The type of the parameter
|
||||
*/
|
||||
virtual ParamType getParamType(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the integer value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @return The integer value of the parameter
|
||||
*/
|
||||
virtual int getParamInt(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the float value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @return The float value of the parameter
|
||||
*/
|
||||
virtual float getParamFloat(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the string value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @return The string value of the parameter
|
||||
*/
|
||||
virtual const char* getParamString(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the integer value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @param value The integer value to set
|
||||
*/
|
||||
virtual void setParamInt(size_t index, int value) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the float value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @param value The float value to set
|
||||
*/
|
||||
virtual void setParamFloat(size_t index, float value) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the vector value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @param pos The vector value to set
|
||||
*/
|
||||
virtual void setParamVec(size_t index, const float *pos) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the string value of the parameter at the given index
|
||||
* @param index The index of the parameter
|
||||
* @param string The string value to set
|
||||
*/
|
||||
virtual void setParamString(size_t index, const char *string) = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the destination of the message
|
||||
* @return The destination of the message
|
||||
*/
|
||||
virtual Dest getDest() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the index of the message
|
||||
* @return The index of the message
|
||||
*/
|
||||
virtual int getId() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the origin of the message
|
||||
* @return The origin of the message
|
||||
*/
|
||||
virtual const float* getOrigin() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the edict associated with the message
|
||||
* @return The edict associated with the message
|
||||
*/
|
||||
virtual struct edict_s* getEdict() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Checks if the specified type of message data has been modified
|
||||
*
|
||||
* This function allows you to check if any part of the message data, such as its
|
||||
* destination, type, origin, edict, or any specific parameter, has been modified
|
||||
*
|
||||
* @param type The type of the data to check for modification
|
||||
* This can be one of the following:
|
||||
* - DataType::Any: Check if any part of the message has been modified
|
||||
* - DataType::Dest: Check if the destination has been modified
|
||||
* - DataType::Index: Check if the message ID has been modified
|
||||
* - DataType::Origin: Check if the origin has been modified
|
||||
* - DataType::Edict: Check if the edict pointer has been modified
|
||||
* - DataType::Param: Check if a specific parameter has been modified
|
||||
*
|
||||
* @param index The index of the parameter to check for modification (used only when type is DataType::Param)
|
||||
* Default value is -1, which means the parameter index is not applicable
|
||||
*
|
||||
* @return True if the specified data type has been modified, false otherwise
|
||||
*/
|
||||
virtual bool isDataModified(DataType type = DataType::Any, size_t index = -1) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Resets a specific type of message data to its original value
|
||||
*
|
||||
* @param type The type of data to reset to its original value
|
||||
* This can be one of the following:
|
||||
* - DataType::Any: Reset all modified message data to its original values
|
||||
* - DataType::Dest: Reset the destination to its original value
|
||||
* - DataType::Index: Reset the message ID to its original value
|
||||
* - DataType::Origin: Reset the origin to its original value
|
||||
* - DataType::Edict: Reset the edict pointer of the recipient client to its original value
|
||||
* - DataType::Param: Reset a specific parameter to its original value
|
||||
*
|
||||
* @param index The index of the parameter to reset (used only when type is DataType::Param)
|
||||
* Default value is -1, which means the parameter index is not applicable
|
||||
*
|
||||
* @return True if the modified data type was reset, false otherwise
|
||||
*/
|
||||
virtual bool resetModifiedData(DataType type = DataType::Any, size_t index = -1) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the destination of the message
|
||||
*/
|
||||
virtual void setDest(Dest dest) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the index of the message
|
||||
*/
|
||||
virtual void setId(int msg_id) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the origin of the message
|
||||
*/
|
||||
virtual void setOrigin(const float *origin) = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the edict associated with the message
|
||||
*/
|
||||
virtual void setEdict(struct edict_s *pEdict) = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original destination of the message before any modifications
|
||||
* @return The original destination of the message
|
||||
*/
|
||||
virtual Dest getOriginalDest() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original type of the message before any modifications
|
||||
* @return The original type of the message
|
||||
*/
|
||||
virtual int getOriginalId() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original origin of the message before any modifications
|
||||
* @return The original origin of the message
|
||||
*/
|
||||
virtual const float* getOriginalOrigin() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original edict associated with the message before any modifications
|
||||
* @return The original edict associated with the message
|
||||
*/
|
||||
virtual struct edict_s* getOriginalEdict() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original integer value of the parameter at the given index before any modifications
|
||||
* @param index The index of the parameter
|
||||
* @return The original integer value of the parameter
|
||||
*/
|
||||
virtual int getOriginalParamInt(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original float value of the parameter at the given index before any modifications
|
||||
* @param index The index of the parameter
|
||||
* @return The original float value of the parameter
|
||||
*/
|
||||
virtual float getOriginalParamFloat(size_t index) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the original string value of the parameter at the given index before any modifications
|
||||
* @param index The index of the parameter
|
||||
* @return The original string value of the parameter
|
||||
*/
|
||||
virtual const char* getOriginalParamString(size_t index) const = 0;
|
||||
|
||||
// This must be the last virtual function in class
|
||||
#ifdef REHLDS_SELF
|
||||
// Set the copyback buffer for the message
|
||||
virtual void setCopybackBuffer(struct sizebuf_s *pbuf) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MESSAGEMNGR_VERSION_MAJOR 2
|
||||
#define MESSAGEMNGR_VERSION_MINOR 0
|
||||
|
||||
/**
|
||||
* @brief Interface manages hooks and blocking behavior game messages
|
||||
*/
|
||||
class IMessageManager
|
||||
{
|
||||
public:
|
||||
using hookfunc_t = void (*)(IVoidHookChain<IMessage *> *chain, IMessage *msg);
|
||||
|
||||
virtual ~IMessageManager() = default;
|
||||
|
||||
/**
|
||||
* @brief Returns the major version of the MessageManager
|
||||
* @return The major version
|
||||
*/
|
||||
virtual int getMajorVersion() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the minor version of the MessageManager
|
||||
* @return The minor version
|
||||
*/
|
||||
virtual int getMinorVersion() const = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns the blocking behavior for the given message type
|
||||
* @param msg_id The message type
|
||||
* @return The blocking behavior for the given message type
|
||||
*/
|
||||
virtual IMessage::BlockType getMessageBlock(int msg_id) const = 0;
|
||||
|
||||
/**
|
||||
* @brief Sets the blocking behavior for the given message type
|
||||
* @param msg_id The message type
|
||||
* @param blockType The blocking behavior to set
|
||||
*/
|
||||
virtual void setMessageBlock(int msg_id, IMessage::BlockType blockType) = 0;
|
||||
|
||||
/**
|
||||
* @brief Registers a hook function for the given message type
|
||||
* @param msg_id The message type to register the hook for
|
||||
* @param handler The hook function to register
|
||||
* @param priority The priority of the hook function (see enum HookChainPriority)
|
||||
*/
|
||||
virtual void registerHook(int msg_id, hookfunc_t handler, int priority = HC_PRIORITY_DEFAULT) = 0;
|
||||
|
||||
/**
|
||||
* @brief Unregisters a hook function for the given message type
|
||||
* @param msg_id The message type to unregister the hook for
|
||||
* @param handler The hook function to unregister
|
||||
*/
|
||||
virtual void unregisterHook(int msg_id, hookfunc_t handler) = 0;
|
||||
};
|
@ -32,6 +32,7 @@
|
||||
#define HLBSP_VERSION 30 // half-life regular version
|
||||
|
||||
#define MAX_MAP_HULLS 4
|
||||
#define MAX_MAP_LEAFS 32767 // signed short limit
|
||||
|
||||
#define CONTENTS_ORIGIN -7 // removed at csg time
|
||||
#define CONTENTS_CLIP -8 // changed to contents_solid
|
||||
|
@ -67,4 +67,12 @@ typedef enum sv_delta_s
|
||||
sv_packet_delta,
|
||||
} sv_delta_t;
|
||||
|
||||
// From engine/server.h
|
||||
typedef enum server_state_e
|
||||
{
|
||||
ss_dead = 0,
|
||||
ss_loading = 1,
|
||||
ss_active = 2,
|
||||
} server_state_t;
|
||||
|
||||
#endif // MAINTYPES_H
|
||||
|
@ -144,6 +144,13 @@ struct msurface_s
|
||||
// surface generation data
|
||||
struct surfcache_s *cachespots[MIPLEVELS];
|
||||
|
||||
// Maximum s/t texture size on the surface
|
||||
#if defined(GLQUAKE) || defined(SWDS)
|
||||
#define MAX_SURFACE_TEXTURE_SIZE 512
|
||||
#else
|
||||
#define MAX_SURFACE_TEXTURE_SIZE 256 // Software rendering is limited to 256
|
||||
#endif
|
||||
|
||||
short texturemins[2]; // smallest s/t position on the surface.
|
||||
short extents[2]; // ?? s/t texture size, 1..256 for all non-sky surfaces
|
||||
|
||||
|
@ -68,6 +68,10 @@ struct event_state_s
|
||||
extern char *pr_strings;
|
||||
extern globalvars_t gGlobalVariables;
|
||||
|
||||
#if !defined(STRING) && defined(SWDS)
|
||||
#define STRING(offset) ((const char *)(pr_strings + (unsigned int)(offset)))
|
||||
#endif
|
||||
|
||||
//============================================================================
|
||||
|
||||
edict_t *ED_Alloc (void);
|
||||
|
@ -31,13 +31,14 @@
|
||||
#include "rehlds_interfaces.h"
|
||||
#include "hookchains.h"
|
||||
#include "FlightRecorder.h"
|
||||
#include "IMessageManager.h"
|
||||
#include "interface.h"
|
||||
#include "model.h"
|
||||
#include "ObjectList.h"
|
||||
#include "pr_dlls.h"
|
||||
|
||||
#define REHLDS_API_VERSION_MAJOR 3
|
||||
#define REHLDS_API_VERSION_MINOR 10
|
||||
#define REHLDS_API_VERSION_MINOR 15
|
||||
|
||||
//Steam_NotifyClientConnect hook
|
||||
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
|
||||
@ -211,6 +212,57 @@ typedef IHookChainRegistry<bool, IGameClient *, bool> IRehldsHookRegistry_SV_Sho
|
||||
typedef IHookChain<ENTITYINIT, char *> IRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistry<ENTITYINIT, char *> IRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//SV_EmitPings hook
|
||||
typedef IHookChain<void, IGameClient *, sizebuf_t *> IRehldsHook_SV_EmitPings;
|
||||
typedef IHookChainRegistry<void, IGameClient *, sizebuf_t *> IRehldsHookRegistry_SV_EmitPings;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChain<edict_t *> IRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistry<edict_t *> IRehldsHookRegistry_ED_Alloc;
|
||||
|
||||
//ED_Free hook
|
||||
typedef IVoidHookChain<edict_t *> IRehldsHook_ED_Free;
|
||||
typedef IVoidHookChainRegistry<edict_t *> IRehldsHookRegistry_ED_Free;
|
||||
|
||||
//Con_Printf hook
|
||||
typedef IHookChain<void, const char *> IRehldsHook_Con_Printf;
|
||||
typedef IHookChainRegistry<void, const char *> IRehldsHookRegistry_Con_Printf;
|
||||
|
||||
//SV_CheckUserInfo hook
|
||||
typedef IHookChain<int, netadr_t *, char *, qboolean, int, char *> IRehldsHook_SV_CheckUserInfo;
|
||||
typedef IHookChainRegistry<int, netadr_t *, char *, qboolean, int, char *> IRehldsHookRegistry_SV_CheckUserInfo;
|
||||
|
||||
//PF_precache_generic_I hook
|
||||
typedef IHookChain<int, const char *> IRehldsHook_PF_precache_generic_I;
|
||||
typedef IHookChainRegistry<int, const char *> IRehldsHookRegistry_PF_precache_generic_I;
|
||||
|
||||
//PF_precache_model_I hook
|
||||
typedef IHookChain<int, const char *> IRehldsHook_PF_precache_model_I;
|
||||
typedef IHookChainRegistry<int, const char *> IRehldsHookRegistry_PF_precache_model_I;
|
||||
|
||||
//PF_precache_sound_I hook
|
||||
typedef IHookChain<int, const char *> IRehldsHook_PF_precache_sound_I;
|
||||
typedef IHookChainRegistry<int, const char *> IRehldsHookRegistry_PF_precache_sound_I;
|
||||
|
||||
//EV_Precache hook
|
||||
typedef IHookChain<unsigned short, int, const char *> IRehldsHook_EV_Precache;
|
||||
typedef IHookChainRegistry<unsigned short, int, const char *> IRehldsHookRegistry_EV_Precache;
|
||||
|
||||
//SV_AddResource hook
|
||||
typedef IVoidHookChain<resourcetype_t, const char *, int, unsigned char, int> IRehldsHook_SV_AddResource;
|
||||
typedef IVoidHookChainRegistry<resourcetype_t, const char *, int, unsigned char, int> IRehldsHookRegistry_SV_AddResource;
|
||||
|
||||
//SV_ClientPrintf hook
|
||||
typedef IVoidHookChain<const char *> IRehldsHook_SV_ClientPrintf;
|
||||
typedef IVoidHookChainRegistry<const char *> IRehldsHookRegistry_SV_ClientPrintf;
|
||||
|
||||
//SV_AllowPhysent hook
|
||||
typedef IHookChain<bool, edict_t*, edict_t*> IRehldsHook_SV_AllowPhysent;
|
||||
typedef IHookChainRegistry<bool, edict_t*, edict_t*> IRehldsHookRegistry_SV_AllowPhysent;
|
||||
|
||||
//SV_SendResources hook
|
||||
typedef IVoidHookChain<sizebuf_t *> IRehldsHook_SV_SendResources;
|
||||
typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_SendResources;
|
||||
|
||||
class IRehldsHookchains {
|
||||
public:
|
||||
@ -259,6 +311,19 @@ public:
|
||||
virtual IRehldsHookRegistry_SV_Frame* SV_Frame() = 0;
|
||||
virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList() = 0;
|
||||
virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit() = 0;
|
||||
virtual IRehldsHookRegistry_SV_EmitPings* SV_EmitPings() = 0;
|
||||
virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc() = 0;
|
||||
virtual IRehldsHookRegistry_ED_Free* ED_Free() = 0;
|
||||
virtual IRehldsHookRegistry_Con_Printf* Con_Printf() = 0;
|
||||
virtual IRehldsHookRegistry_SV_CheckUserInfo* SV_CheckUserInfo() = 0;
|
||||
virtual IRehldsHookRegistry_PF_precache_generic_I* PF_precache_generic_I() = 0;
|
||||
virtual IRehldsHookRegistry_PF_precache_model_I* PF_precache_model_I() = 0;
|
||||
virtual IRehldsHookRegistry_PF_precache_sound_I* PF_precache_sound_I() = 0;
|
||||
virtual IRehldsHookRegistry_EV_Precache* EV_Precache() = 0;
|
||||
virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0;
|
||||
virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0;
|
||||
virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0;
|
||||
virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources() = 0;
|
||||
};
|
||||
|
||||
struct RehldsFuncs_t {
|
||||
@ -369,6 +434,9 @@ struct RehldsFuncs_t {
|
||||
void(*MSG_BeginReading)();
|
||||
double(*GetHostFrameTime)();
|
||||
struct cmd_function_s *(*GetFirstCmdFunctionHandle)();
|
||||
|
||||
// Pause
|
||||
void(*SetServerPause)(bool status);
|
||||
};
|
||||
|
||||
class IRehldsApi {
|
||||
@ -382,6 +450,7 @@ public:
|
||||
virtual IRehldsServerStatic* GetServerStatic() = 0;
|
||||
virtual IRehldsServerData* GetServerData() = 0;
|
||||
virtual IRehldsFlightRecorder* GetFlightRecorder() = 0;
|
||||
virtual IMessageManager *GetMessageManager() = 0;
|
||||
};
|
||||
|
||||
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"
|
||||
|
@ -36,6 +36,7 @@ class IGameClient;
|
||||
|
||||
#include "common_rehlds.h"
|
||||
#include "userid_rehlds.h"
|
||||
#include "FileSystem.h"
|
||||
|
||||
#ifdef REHLDS_SELF
|
||||
#include "server.h"
|
||||
|
@ -90,3 +90,7 @@ void AbstractHookChainRegistry::removeHook(void* hookFunc) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AbstractHookChainRegistry::getCount() const {
|
||||
return m_NumHooks;
|
||||
}
|
||||
|
@ -109,10 +109,11 @@ protected:
|
||||
|
||||
protected:
|
||||
void addHook(void* hookFunc, int priority);
|
||||
bool findHook(void* hookFunc) const;
|
||||
void removeHook(void* hookFunc);
|
||||
|
||||
public:
|
||||
int getCount() const;
|
||||
bool findHook(void* hookFunc) const;
|
||||
AbstractHookChainRegistry();
|
||||
};
|
||||
|
||||
@ -132,9 +133,14 @@ public:
|
||||
EXT_FUNC virtual void registerHook(hookfunc_t hook, int priority) {
|
||||
addHook((void*)hook, priority);
|
||||
}
|
||||
|
||||
EXT_FUNC virtual void unregisterHook(hookfunc_t hook) {
|
||||
removeHook((void*)hook);
|
||||
}
|
||||
|
||||
bool isEmpty() const {
|
||||
return getCount() == 0;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ...t_args>
|
||||
@ -157,4 +163,8 @@ public:
|
||||
EXT_FUNC virtual void unregisterHook(hookfunc_t hook) {
|
||||
removeHook((void*)hook);
|
||||
}
|
||||
|
||||
bool isEmpty() const {
|
||||
return getCount() == 0;
|
||||
}
|
||||
};
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "rehlds_api_impl.h"
|
||||
#include "FlightRecorderImpl.h"
|
||||
#include "flight_recorder.h"
|
||||
#include "rehlds_messagemngr_impl.h"
|
||||
#include "rehlds_security.h"
|
||||
|
||||
#include "dlls/cdll_dll.h"
|
||||
|
@ -52,7 +52,9 @@ char* EXT_FUNC GetClientFallback_api() {
|
||||
}
|
||||
|
||||
int* EXT_FUNC GetAllowCheats_api() {
|
||||
return &allow_cheats;
|
||||
static int sv_cheats_stub = 0;
|
||||
Con_Printf("WARNING! allow_cheats marked as deprecated! Use sv_cheats cvar directly!\n");
|
||||
return &sv_cheats_stub;
|
||||
}
|
||||
|
||||
bool EXT_FUNC GSBSecure_api() {
|
||||
@ -456,6 +458,36 @@ void EXT_FUNC RemoveCvarListener_api(const char *var_name, cvar_callback_t func)
|
||||
}
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_SetMoveVars_api()
|
||||
{
|
||||
SV_SetMoveVars(&sv_movevars);
|
||||
}
|
||||
|
||||
void EXT_FUNC SV_WriteMovevarsToClient_api(sizebuf_t *message)
|
||||
{
|
||||
SV_WriteMovevarsToClient(message, &sv_movevars);
|
||||
}
|
||||
|
||||
void EXT_FUNC SetServerPause(bool setPause)
|
||||
{
|
||||
g_psv.paused = setPause;
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (g_psvs.clients[i].fakeclient)
|
||||
continue;
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_setpause);
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, g_psv.paused);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, svc_setpause);
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
CRehldsServerStatic g_RehldsServerStatic;
|
||||
CRehldsServerData g_RehldsServerData;
|
||||
CRehldsHookchains g_RehldsHookchains;
|
||||
@ -473,8 +505,8 @@ RehldsFuncs_t g_RehldsApiFuncs =
|
||||
&SV_CheckChallenge_api,
|
||||
&SV_SendUserReg,
|
||||
&SV_WriteDeltaDescriptionsToClient,
|
||||
&SV_SetMoveVars,
|
||||
&SV_WriteMovevarsToClient,
|
||||
&SV_SetMoveVars_api,
|
||||
&SV_WriteMovevarsToClient_api,
|
||||
&GetClientFallback_api,
|
||||
&GetAllowCheats_api,
|
||||
&GSBSecure_api,
|
||||
@ -559,7 +591,8 @@ RehldsFuncs_t g_RehldsApiFuncs =
|
||||
&SZ_Clear_api,
|
||||
&MSG_BeginReading_api,
|
||||
&GetHostFrameTime_api,
|
||||
&GetFirstCmdFunctionHandle_api
|
||||
&GetFirstCmdFunctionHandle_api,
|
||||
&SetServerPause,
|
||||
};
|
||||
|
||||
bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin)
|
||||
@ -567,7 +600,7 @@ bool EXT_FUNC SV_EmitSound2_internal(edict_t *entity, IGameClient *pReceiver, in
|
||||
bool bSendPAS = (channel != CHAN_STATIC && !(flags & SND_FL_STOP) && !(emitFlags & SND_EMIT2_NOPAS));
|
||||
vec3_t origin = {0, 0, 0};
|
||||
|
||||
if (entity && entity != g_psv.edicts)
|
||||
if ((!pOrigin || !(emitFlags & SND_EMIT2_USE_ORIGIN)) && entity && entity != g_psv.edicts)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
origin[i] = (entity->v.maxs[i] + entity->v.mins[i]) * 0.5f + entity->v.origin[i];
|
||||
@ -835,6 +868,58 @@ IRehldsHookRegistry_GetEntityInit* CRehldsHookchains::GetEntityInit() {
|
||||
return &m_GetEntityInit;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_EmitPings* CRehldsHookchains::SV_EmitPings() {
|
||||
return &m_SV_EmitPings;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_ED_Alloc* CRehldsHookchains::ED_Alloc() {
|
||||
return &m_ED_Alloc;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_ED_Free* CRehldsHookchains::ED_Free() {
|
||||
return &m_ED_Free;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_Con_Printf* CRehldsHookchains::Con_Printf() {
|
||||
return &m_Con_Printf;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_CheckUserInfo* CRehldsHookchains::SV_CheckUserInfo() {
|
||||
return &m_SV_CheckUserInfo;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_PF_precache_generic_I* CRehldsHookchains::PF_precache_generic_I() {
|
||||
return &m_PF_precache_generic_I;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_PF_precache_model_I* CRehldsHookchains::PF_precache_model_I() {
|
||||
return &m_PF_precache_model_I;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_PF_precache_sound_I* CRehldsHookchains::PF_precache_sound_I() {
|
||||
return &m_PF_precache_sound_I;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_EV_Precache* CRehldsHookchains::EV_Precache() {
|
||||
return &m_EV_Precache;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_AddResource* CRehldsHookchains::SV_AddResource(){
|
||||
return &m_SV_AddResource;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_ClientPrintf* CRehldsHookchains::SV_ClientPrintf(){
|
||||
return &m_SV_ClientPrintf;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_AllowPhysent* CRehldsHookchains::SV_AllowPhysent() {
|
||||
return &m_SV_AllowPhysent;
|
||||
}
|
||||
|
||||
IRehldsHookRegistry_SV_SendResources* CRehldsHookchains::SV_SendResources() {
|
||||
return &m_SV_SendResources;
|
||||
}
|
||||
|
||||
int EXT_FUNC CRehldsApi::GetMajorVersion()
|
||||
{
|
||||
return REHLDS_API_VERSION_MAJOR;
|
||||
@ -863,6 +948,10 @@ IRehldsServerData* EXT_FUNC CRehldsApi::GetServerData() {
|
||||
return &g_RehldsServerData;
|
||||
}
|
||||
|
||||
IMessageManager* EXT_FUNC CRehldsApi::GetMessageManager() {
|
||||
return &MessageManager();
|
||||
}
|
||||
|
||||
IRehldsFlightRecorder* EXT_FUNC CRehldsApi::GetFlightRecorder() {
|
||||
return g_FlightRecorder;
|
||||
}
|
||||
|
@ -206,6 +206,58 @@ typedef IHookChainRegistryImpl<bool, IGameClient *, bool> CRehldsHookRegistry_SV
|
||||
typedef IHookChainImpl<ENTITYINIT, char *> CRehldsHook_GetEntityInit;
|
||||
typedef IHookChainRegistryImpl<ENTITYINIT, char *> CRehldsHookRegistry_GetEntityInit;
|
||||
|
||||
//SV_EmitPings hook
|
||||
typedef IHookChainImpl<void, IGameClient *, sizebuf_t *> CRehldsHook_SV_EmitPings;
|
||||
typedef IHookChainRegistryImpl<void, IGameClient *, sizebuf_t *> CRehldsHookRegistry_SV_EmitPings;
|
||||
|
||||
//ED_Alloc hook
|
||||
typedef IHookChainImpl<edict_t *> CRehldsHook_ED_Alloc;
|
||||
typedef IHookChainRegistryImpl<edict_t *> CRehldsHookRegistry_ED_Alloc;
|
||||
|
||||
//ED_Free hook
|
||||
typedef IVoidHookChainImpl<edict_t *> CRehldsHook_ED_Free;
|
||||
typedef IVoidHookChainRegistryImpl<edict_t *> CRehldsHookRegistry_ED_Free;
|
||||
|
||||
//Con_Printf hook
|
||||
typedef IHookChainImpl<void, const char *> CRehldsHook_Con_Printf;
|
||||
typedef IHookChainRegistryImpl<void, const char *> CRehldsHookRegistry_Con_Printf;
|
||||
|
||||
//SV_CheckUserInfo hook
|
||||
typedef IHookChainImpl<int, netadr_t*, char*, qboolean, int, char*> CRehldsHook_SV_CheckUserInfo;
|
||||
typedef IHookChainRegistryImpl<int, netadr_t*, char*, qboolean, int, char*> CRehldsHookRegistry_SV_CheckUserInfo;
|
||||
|
||||
//PF_precache_generic_I hook
|
||||
typedef IHookChainImpl<int, const char*> CRehldsHook_PF_precache_generic_I;
|
||||
typedef IHookChainRegistryImpl<int, const char*> CRehldsHookRegistry_PF_precache_generic_I;
|
||||
|
||||
//PF_precache_model_I hook
|
||||
typedef IHookChainImpl<int, const char*> CRehldsHook_PF_precache_model_I;
|
||||
typedef IHookChainRegistryImpl<int, const char*> CRehldsHookRegistry_PF_precache_model_I;
|
||||
|
||||
//PF_precache_sound_I hook
|
||||
typedef IHookChainImpl<int, const char*> CRehldsHook_PF_precache_sound_I;
|
||||
typedef IHookChainRegistryImpl<int, const char*> CRehldsHookRegistry_PF_precache_sound_I;
|
||||
|
||||
//EV_Precache hook
|
||||
typedef IHookChainImpl<unsigned short, int, const char*> CRehldsHook_EV_Precache;
|
||||
typedef IHookChainRegistryImpl<unsigned short, int, const char*> CRehldsHookRegistry_EV_Precache;
|
||||
|
||||
//SV_AddResource hook
|
||||
typedef IVoidHookChainImpl<resourcetype_t, const char*, int, unsigned char, int> CRehldsHook_SV_AddResource;
|
||||
typedef IVoidHookChainRegistryImpl<resourcetype_t, const char*, int, unsigned char, int> CRehldsHookRegistry_SV_AddResource;
|
||||
|
||||
//SV_ClientPrintf hook
|
||||
typedef IVoidHookChainImpl<const char*> CRehldsHook_SV_ClientPrintf;
|
||||
typedef IVoidHookChainRegistryImpl<const char*> CRehldsHookRegistry_SV_ClientPrintf;
|
||||
|
||||
//SV_AllowPhysent hook
|
||||
typedef IHookChainImpl<bool, edict_t*, edict_t*> CRehldsHook_SV_AllowPhysent;
|
||||
typedef IHookChainRegistryImpl<bool, edict_t*, edict_t*> CRehldsHookRegistry_SV_AllowPhysent;
|
||||
|
||||
//SV_SendResources hook
|
||||
typedef IVoidHookChainImpl<sizebuf_t *> CRehldsHook_SV_SendResources;
|
||||
typedef IVoidHookChainRegistryImpl<sizebuf_t *> CRehldsHookRegistry_SV_SendResources;
|
||||
|
||||
class CRehldsHookchains : public IRehldsHookchains {
|
||||
public:
|
||||
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
|
||||
@ -251,6 +303,19 @@ public:
|
||||
CRehldsHookRegistry_SV_Frame m_SV_Frame;
|
||||
CRehldsHookRegistry_SV_ShouldSendConsistencyList m_SV_ShouldSendConsistencyList;
|
||||
CRehldsHookRegistry_GetEntityInit m_GetEntityInit;
|
||||
CRehldsHookRegistry_SV_EmitPings m_SV_EmitPings;
|
||||
CRehldsHookRegistry_ED_Alloc m_ED_Alloc;
|
||||
CRehldsHookRegistry_ED_Free m_ED_Free;
|
||||
CRehldsHookRegistry_Con_Printf m_Con_Printf;
|
||||
CRehldsHookRegistry_SV_CheckUserInfo m_SV_CheckUserInfo;
|
||||
CRehldsHookRegistry_PF_precache_generic_I m_PF_precache_generic_I;
|
||||
CRehldsHookRegistry_PF_precache_model_I m_PF_precache_model_I;
|
||||
CRehldsHookRegistry_PF_precache_sound_I m_PF_precache_sound_I;
|
||||
CRehldsHookRegistry_EV_Precache m_EV_Precache;
|
||||
CRehldsHookRegistry_SV_AddResource m_SV_AddResource;
|
||||
CRehldsHookRegistry_SV_ClientPrintf m_SV_ClientPrintf;
|
||||
CRehldsHookRegistry_SV_AllowPhysent m_SV_AllowPhysent;
|
||||
CRehldsHookRegistry_SV_SendResources m_SV_SendResources;
|
||||
|
||||
public:
|
||||
EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
|
||||
@ -296,6 +361,19 @@ public:
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_Frame* SV_Frame();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_ShouldSendConsistencyList* SV_ShouldSendConsistencyList();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_GetEntityInit* GetEntityInit();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_EmitPings* SV_EmitPings();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_ED_Alloc* ED_Alloc();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_ED_Free* ED_Free();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_Con_Printf* Con_Printf();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_CheckUserInfo* SV_CheckUserInfo();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_PF_precache_generic_I* PF_precache_generic_I();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_PF_precache_model_I* PF_precache_model_I();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_PF_precache_sound_I* PF_precache_sound_I();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_EV_Precache* EV_Precache();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent();
|
||||
EXT_FUNC virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources();
|
||||
};
|
||||
|
||||
extern CRehldsHookchains g_RehldsHookchains;
|
||||
@ -313,6 +391,7 @@ public:
|
||||
virtual IRehldsServerStatic* GetServerStatic();
|
||||
virtual IRehldsServerData* GetServerData();
|
||||
virtual IRehldsFlightRecorder* GetFlightRecorder();
|
||||
virtual IMessageManager* GetMessageManager();
|
||||
};
|
||||
|
||||
extern sizebuf_t* GetNetMessage_api();
|
||||
|
@ -530,6 +530,15 @@ netchan_t* EXT_FUNC CNetChan::GetChan()
|
||||
return m_pNetChan;
|
||||
}
|
||||
|
||||
void CNetChan::Clear()
|
||||
{
|
||||
for (int i = 0; i < MAX_STREAMS; i++)
|
||||
{
|
||||
for (int j = 0; j < NET_DECOMPRESS_MAX_TIMES; j++)
|
||||
m_FragStats[i].decompress_failure_times[j] = 0;
|
||||
m_FragStats[i].num_decompress_failures = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int EXT_FUNC CRehldsServerStatic::GetMaxClients()
|
||||
|
@ -30,6 +30,16 @@
|
||||
#include "rehlds_interfaces.h"
|
||||
#include "server.h"
|
||||
|
||||
const int NET_DECOMPRESS_MAX_TIMES = 10;
|
||||
|
||||
struct FragStats_t
|
||||
{
|
||||
float decompress_failure_times[NET_DECOMPRESS_MAX_TIMES];
|
||||
|
||||
// Count of abnormal fragment decompressions in a time window
|
||||
int num_decompress_failures;
|
||||
};
|
||||
|
||||
class CNetChan : public INetChan
|
||||
{
|
||||
private:
|
||||
@ -38,6 +48,10 @@ private:
|
||||
#ifdef REHLDS_FIXES
|
||||
uint8_t m_messageBuffer[NET_MAX_PAYLOAD];
|
||||
#endif
|
||||
|
||||
// Stats for decompression of incoming fragments
|
||||
FragStats_t m_FragStats[MAX_STREAMS];
|
||||
|
||||
public:
|
||||
CNetChan(netchan_t* chan);
|
||||
|
||||
@ -46,10 +60,13 @@ public:
|
||||
|
||||
virtual netchan_t* GetChan();
|
||||
|
||||
void Clear();
|
||||
|
||||
public:
|
||||
#ifdef REHLDS_FIXES
|
||||
uint8_t* GetExtendedMessageBuffer() { return m_messageBuffer; };
|
||||
#endif
|
||||
FragStats_t &GetFragStats(int stream) { return m_FragStats[stream]; };
|
||||
};
|
||||
|
||||
|
||||
@ -247,6 +264,9 @@ public:
|
||||
uint8_t* GetExtendedMessageBuffer() { return m_NetChan.GetExtendedMessageBuffer(); };
|
||||
#endif
|
||||
|
||||
void NetchanClear() { m_NetChan.Clear(); }
|
||||
FragStats_t &GetFragStats(int stream) { return m_NetChan.GetFragStats(stream); };
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
void SetupLocalGameTime() { m_localGameTimeBase = g_psv.time; }
|
||||
double GetLocalGameTime() const { return g_psv.time - m_localGameTimeBase; }
|
||||
|
1085
rehlds/rehlds/rehlds_messagemngr_impl.cpp
Normal file
1085
rehlds/rehlds/rehlds_messagemngr_impl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
183
rehlds/rehlds/rehlds_messagemngr_impl.h
Normal file
183
rehlds/rehlds/rehlds_messagemngr_impl.h
Normal file
@ -0,0 +1,183 @@
|
||||
/*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IMessageManager.h"
|
||||
#include "hookchains.h"
|
||||
|
||||
#include <memory> // std::unique_ptr
|
||||
#include <algorithm> // std::move
|
||||
|
||||
/**
|
||||
* @brief Implementation interface manages hooks and blocking behavior game messages
|
||||
*/
|
||||
class MessageManagerImpl: public IMessageManager
|
||||
{
|
||||
public:
|
||||
|
||||
void Init();
|
||||
|
||||
MessageManagerImpl();
|
||||
~MessageManagerImpl() = default;
|
||||
|
||||
/**
|
||||
* @brief Returns the major version of the MessageManager
|
||||
* @return The major version
|
||||
*/
|
||||
int getMajorVersion() const { return MESSAGEMNGR_VERSION_MAJOR; }
|
||||
|
||||
/**
|
||||
* @brief Returns the minor version of the MessageManager
|
||||
* @return The minor version
|
||||
*/
|
||||
int getMinorVersion() const { return MESSAGEMNGR_VERSION_MINOR; }
|
||||
|
||||
/**
|
||||
* @brief Returns the blocking behavior for the given message type
|
||||
* @param msg_id The message type
|
||||
* @return The blocking behavior for the given message type
|
||||
*/
|
||||
IMessage::BlockType getMessageBlock(int msg_id) const;
|
||||
|
||||
/**
|
||||
* @brief Sets the blocking behavior for the given message type
|
||||
* @param msg_id The message type
|
||||
* @param blockType The blocking behavior to set
|
||||
*/
|
||||
void setMessageBlock(int msg_id, IMessage::BlockType blockType);
|
||||
|
||||
/**
|
||||
* @brief Registers a hook function for the given message type
|
||||
* @param msg_id The message type to register the hook for
|
||||
* @param handler The hook function to register
|
||||
* @param priority The priority of the hook function (see enum HookChainPriority)
|
||||
*/
|
||||
void registerHook(int msg_id, hookfunc_t handler, int priority = HC_PRIORITY_DEFAULT);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a hook function for the given message type
|
||||
* @param msg_id The message type to unregister the hook for
|
||||
* @param handler The hook function to unregister
|
||||
*/
|
||||
void unregisterHook(int msg_id, hookfunc_t handler);
|
||||
|
||||
private:
|
||||
friend void PF_MessageBegin_Intercept(int msg_dest, int msg_id, const float *pOrigin, edict_t *ed);
|
||||
friend void PF_MessageEnd_Intercept();
|
||||
friend void PF_WriteByte_Intercept(int iValue);
|
||||
friend void PF_WriteChar_Intercept(int iValue);
|
||||
friend void PF_WriteShort_Intercept(int iValue);
|
||||
friend void PF_WriteLong_Intercept(int iValue);
|
||||
friend void PF_WriteAngle_Intercept(float flValue);
|
||||
friend void PF_WriteCoord_Intercept(float flValue);
|
||||
friend void PF_WriteString_Intercept(const char *sz);
|
||||
friend void PF_WriteEntity_Intercept(int iValue);
|
||||
|
||||
bool MessageBegin(int msg_dest, int msg_id, const float *pOrigin, edict_t *ed);
|
||||
bool MessageEnd();
|
||||
|
||||
private:
|
||||
bool WriteParam(IMessage::ParamType type, bool sign = false, size_t length = -1);
|
||||
|
||||
bool m_inblock; // Flag indicating whether a message block is currently active
|
||||
bool m_inhook; // Flag indicating whether a message hook is currently active
|
||||
|
||||
/**
|
||||
* @brief The fixed-size memory pool holds a list of free objects
|
||||
* @tparam T The type of objects stored in the stack
|
||||
* @tparam MAX The maximum size of the stack
|
||||
*/
|
||||
template <typename T, size_t MAX>
|
||||
class MessagePool
|
||||
{
|
||||
public:
|
||||
std::unique_ptr<T> acquire()
|
||||
{
|
||||
if (_size > 0)
|
||||
return std::move(_freeObjects[--_size]); // reusing
|
||||
return std::make_unique<T>(); // initialize constructor for new element
|
||||
}
|
||||
|
||||
void release(std::unique_ptr<T> obj)
|
||||
{
|
||||
if (_size < MAX)
|
||||
_freeObjects[_size++] = std::move(obj);
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
while (_size > 0)
|
||||
_freeObjects[--_size].reset();
|
||||
}
|
||||
|
||||
private:
|
||||
size_t _size{0u};
|
||||
std::unique_ptr<T> _freeObjects[MAX]{};
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Helper a templated MessageStack class to manage a stack of Message objects with fixed size
|
||||
* @tparam T The type of objects stored in the stack
|
||||
* @tparam MAX The maximum size of the stack
|
||||
*/
|
||||
template <typename T, size_t MAX>
|
||||
class MessageStack
|
||||
{
|
||||
public:
|
||||
MessageStack(MessagePool<T, MAX> &pool) : _pool(pool) {}
|
||||
|
||||
T &push()
|
||||
{
|
||||
std::unique_ptr<T> msg = _pool.acquire();
|
||||
_activeObjects[_size++] = std::move(msg);
|
||||
return *_activeObjects[_size - 1];
|
||||
}
|
||||
|
||||
void pop()
|
||||
{
|
||||
if (_size > 0)
|
||||
_pool.release(std::move(_activeObjects[--_size]));
|
||||
}
|
||||
|
||||
size_t size() const { return _size; }
|
||||
size_t max_size() const { return MAX; }
|
||||
|
||||
const T &top() const { return *_activeObjects[_size - 1]; }
|
||||
T &top() { return *_activeObjects[_size - 1]; }
|
||||
|
||||
private:
|
||||
size_t _size{0u};
|
||||
std::unique_ptr<T> _activeObjects[MAX]{};
|
||||
MessagePool<T, MAX> &_pool;
|
||||
};
|
||||
|
||||
static const size_t MAX_MSGSTACK = 16; // The maximum size of the message stack, 16 it should be enough
|
||||
MessagePool<class MessageImpl, MAX_MSGSTACK> m_pool; // A fixed-size memory pool stack for reusable
|
||||
MessageStack<class MessageImpl, MAX_MSGSTACK> m_stack;
|
||||
|
||||
using HookRegistry_t = IVoidHookChainRegistryImpl<IMessage *>;
|
||||
HookRegistry_t *m_hooks[MAX_USERMESSAGES]{};
|
||||
|
||||
IMessage::BlockType m_blocks[MAX_USERMESSAGES]{}; // The array of blocking behaviors for each message type
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The singleton instance of the MessageManager
|
||||
*/
|
||||
extern MessageManagerImpl &MessageManager();
|
@ -13,7 +13,9 @@ void check_size() {
|
||||
|
||||
|
||||
void checkSizesStatic() {
|
||||
CHECK_TYPE_SIZE(client_t, 0x5018, 0x4EF4);
|
||||
// CHECK_TYPE_SIZE(client_t, 0x5018, 0x4EF4);
|
||||
CHECK_TYPE_SIZE(userfilter_t, 0x20, 0x18);
|
||||
#ifndef REHLDS_FIXES
|
||||
CHECK_TYPE_SIZE(CSteam3Server, 0x90, 0xA8);
|
||||
#endif
|
||||
}
|
||||
|
@ -20,13 +20,32 @@ 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%"
|
||||
for /f "tokens=*" %%i in ('powershell -NoProfile -Command ^
|
||||
"$now = Get-Date; Write-Output ('{0:yyyy}|{0:MM}|{0:dd}|{0:HH}|{0:mm}|{0:ss}' -f $now)"') do (
|
||||
for /f "tokens=1-6 delims=|" %%a in ("%%i") do (
|
||||
set "YYYY=%%a"
|
||||
set "MM=%%b"
|
||||
set "DD=%%c"
|
||||
set "hour=%%d"
|
||||
set "min=%%e"
|
||||
set "sec=%%f"
|
||||
)
|
||||
)
|
||||
|
||||
echo YYYY=%YYYY%
|
||||
echo MM=%MM%
|
||||
echo DD=%DD%
|
||||
echo hour=%hour%
|
||||
echo min=%min%
|
||||
echo sec=%sec%
|
||||
|
||||
:: 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)
|
||||
|
@ -6,5 +6,5 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 10
|
||||
#define VERSION_MINOR 15
|
||||
#define VERSION_MAINTENANCE 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user