Merge branch 'refactor-scripts-stuff' into scr-method-function
This commit is contained in:
commit
85168bb94c
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
@ -39,22 +39,21 @@ jobs:
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
|
||||
- name: Generate project files
|
||||
#run: tools/premake5 vs2022 --ci-build --ac-disable
|
||||
run: tools/premake5 vs2022 --ac-disable
|
||||
|
||||
- name: Set up problem matching
|
||||
uses: ammaraskar/msvc-problem-matcher@master
|
||||
|
||||
- name: Build ${{matrix.configuration}} binaries
|
||||
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} build/iw4x.sln
|
||||
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=Win32 build/iw4x.sln
|
||||
|
||||
- name: Upload ${{matrix.configuration}} binaries
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{matrix.configuration}} binaries
|
||||
path: |
|
||||
build/bin/${{matrix.configuration}}/iw4x.dll
|
||||
build/bin/${{matrix.configuration}}/iw4x.pdb
|
||||
build/bin/Win32/${{matrix.configuration}}/iw4x.dll
|
||||
build/bin/Win32/${{matrix.configuration}}/iw4x.pdb
|
||||
|
||||
# - name: Upload ${{matrix.configuration}} data artifacts
|
||||
# uses: actions/upload-artifact@v2
|
||||
@ -63,7 +62,6 @@ jobs:
|
||||
# path: |
|
||||
# data/*
|
||||
|
||||
|
||||
deploy:
|
||||
name: Deploy artifacts
|
||||
needs: build
|
||||
@ -116,4 +114,4 @@ jobs:
|
||||
# run: rsync -avz ./data/ ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw4x/data/
|
||||
|
||||
- name: Publish changes
|
||||
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
|
||||
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
|
||||
|
@ -3,7 +3,6 @@
|
||||

|
||||

|
||||
[](https://github.com/XLabsProject/iw4x-client/actions)
|
||||
[](https://ci.appveyor.com/project/iw4x/iw4x-client/branch/develop)
|
||||
[](https://discord.gg/sKeVmR3)
|
||||
[](https://www.patreon.com/xlabsproject)
|
||||
|
||||
|
34
appveyor.yml
34
appveyor.yml
@ -1,34 +0,0 @@
|
||||
# AppVeyor CI configuration
|
||||
|
||||
version: "#{build} ({branch})"
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
|
||||
PREMAKE_ACTION: vs2022
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
platform: Win32
|
||||
|
||||
install:
|
||||
- ps: |
|
||||
Write-Host "Updating version information..." -ForegroundColor Cyan
|
||||
|
||||
Update-AppveyorBuild -Version $(& tools/premake5.exe version | select -Last 1)
|
||||
- git submodule update --init --recursive
|
||||
- ps: |
|
||||
Write-Host "Generating project files with premake..." -ForegroundColor Cyan
|
||||
& "./tools/premake5.exe" $env:PREMAKE_ACTION
|
||||
Write-Host "Generated" -ForegroundColor Green
|
||||
|
||||
build:
|
||||
project: build/iw4x.sln
|
||||
parallel: true
|
||||
verbosity: minimal
|
||||
|
||||
artifacts:
|
||||
- path: build/bin/**/*.dll
|
||||
- path: build/bin/**/*.pdb
|
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
@ -1 +1 @@
|
||||
Subproject commit 673f5ce29015a9bba3c96792920a10601b5b0718
|
||||
Subproject commit 06a81aeb227424182125363f7554fad5146d6d2a
|
2
deps/libtommath
vendored
2
deps/libtommath
vendored
@ -1 +1 @@
|
||||
Subproject commit bea9270646303baf683f4ba2ddf0d70721f0e55d
|
||||
Subproject commit 5108f12350b6daa4aa5dbc846517ad1db2f8388a
|
19
deps/premake/dxsdk.lua
vendored
Normal file
19
deps/premake/dxsdk.lua
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
dxsdk = {
|
||||
source = path.join(dependencies.basePath, "dxsdk"),
|
||||
}
|
||||
|
||||
function dxsdk.import()
|
||||
libdirs {path.join(dxsdk.source, "Lib/x86")}
|
||||
dxsdk.includes()
|
||||
end
|
||||
|
||||
function dxsdk.includes()
|
||||
includedirs {
|
||||
path.join(dxsdk.source, "Include"),
|
||||
}
|
||||
end
|
||||
|
||||
function dxsdk.project()
|
||||
end
|
||||
|
||||
table.insert(dependencies, dxsdk)
|
32
deps/premake/json11.lua
vendored
Normal file
32
deps/premake/json11.lua
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
json11 = {
|
||||
source = path.join(dependencies.basePath, "json11"),
|
||||
}
|
||||
|
||||
function json11.import()
|
||||
links {"json11"}
|
||||
|
||||
json11.includes()
|
||||
end
|
||||
|
||||
function json11.includes()
|
||||
includedirs {json11.source}
|
||||
end
|
||||
|
||||
function json11.project()
|
||||
project "json11"
|
||||
language "C++"
|
||||
|
||||
files
|
||||
{
|
||||
path.join(json11.source, "*.cpp"),
|
||||
path.join(json11.source, "*.hpp"),
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
|
||||
defines {"_LIB"}
|
||||
removedefines {"_USRDLL", "_DLL"}
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, json11)
|
59
deps/premake/libtomcrypt.lua
vendored
Normal file
59
deps/premake/libtomcrypt.lua
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
libtomcrypt = {
|
||||
source = path.join(dependencies.basePath, "libtomcrypt"),
|
||||
}
|
||||
|
||||
function libtomcrypt.import()
|
||||
links {"libtomcrypt"}
|
||||
|
||||
libtomcrypt.includes()
|
||||
end
|
||||
|
||||
function libtomcrypt.includes()
|
||||
includedirs {
|
||||
path.join(libtomcrypt.source, "src/headers")
|
||||
}
|
||||
|
||||
defines {
|
||||
"LTC_NO_FAST",
|
||||
"LTC_NO_PROTOTYPES",
|
||||
"LTC_NO_RSA_BLINDING",
|
||||
}
|
||||
end
|
||||
|
||||
function libtomcrypt.project()
|
||||
project "libtomcrypt"
|
||||
language "C"
|
||||
|
||||
libtomcrypt.includes()
|
||||
libtommath.import()
|
||||
|
||||
files {
|
||||
path.join(libtomcrypt.source, "src/**.c"),
|
||||
}
|
||||
|
||||
removefiles {
|
||||
path.join(libtomcrypt.source, "src/**/*tab.c"),
|
||||
path.join(libtomcrypt.source, "src/encauth/ocb3/**.c"),
|
||||
}
|
||||
|
||||
defines {
|
||||
"_CRT_SECURE_NO_WARNINGS",
|
||||
"LTC_SOURCE",
|
||||
"_LIB",
|
||||
"USE_LTM"
|
||||
}
|
||||
|
||||
removedefines {
|
||||
"_DLL",
|
||||
"_USRDLL"
|
||||
}
|
||||
|
||||
linkoptions {
|
||||
"-IGNORE:4221"
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, libtomcrypt)
|
50
deps/premake/libtommath.lua
vendored
Normal file
50
deps/premake/libtommath.lua
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
libtommath = {
|
||||
source = path.join(dependencies.basePath, "libtommath"),
|
||||
}
|
||||
|
||||
function libtommath.import()
|
||||
links {"libtommath"}
|
||||
|
||||
libtommath.includes()
|
||||
end
|
||||
|
||||
function libtommath.includes()
|
||||
includedirs {
|
||||
libtommath.source
|
||||
}
|
||||
|
||||
defines {
|
||||
"LTM_DESC",
|
||||
"__STDC_IEC_559__",
|
||||
"MP_NO_DEV_URANDOM",
|
||||
}
|
||||
end
|
||||
|
||||
function libtommath.project()
|
||||
project "libtommath"
|
||||
language "C"
|
||||
|
||||
libtommath.includes()
|
||||
|
||||
files {
|
||||
path.join(libtommath.source, "*.c"),
|
||||
}
|
||||
|
||||
defines {
|
||||
"_LIB"
|
||||
}
|
||||
|
||||
removedefines {
|
||||
"_DLL",
|
||||
"_USRDLL"
|
||||
}
|
||||
|
||||
linkoptions {
|
||||
"-IGNORE:4221"
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, libtommath)
|
43
deps/premake/minizip.lua
vendored
Normal file
43
deps/premake/minizip.lua
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
minizip = {
|
||||
source = path.join(dependencies.basePath, "zlib/contrib/minizip"),
|
||||
}
|
||||
|
||||
function minizip.import()
|
||||
links {"minizip"}
|
||||
zlib.import()
|
||||
minizip.includes()
|
||||
end
|
||||
|
||||
function minizip.includes()
|
||||
includedirs {
|
||||
minizip.source
|
||||
}
|
||||
|
||||
zlib.includes()
|
||||
end
|
||||
|
||||
function minizip.project()
|
||||
project "minizip"
|
||||
language "C"
|
||||
|
||||
minizip.includes()
|
||||
|
||||
files {
|
||||
path.join(minizip.source, "*.h"),
|
||||
path.join(minizip.source, "*.c"),
|
||||
}
|
||||
|
||||
removefiles {
|
||||
path.join(minizip.source, "miniunz.c"),
|
||||
path.join(minizip.source, "minizip.c"),
|
||||
}
|
||||
|
||||
defines {
|
||||
"_CRT_SECURE_NO_DEPRECATE",
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, minizip)
|
32
deps/premake/mongoose.lua
vendored
Normal file
32
deps/premake/mongoose.lua
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
mongoose = {
|
||||
source = path.join(dependencies.basePath, "mongoose"),
|
||||
}
|
||||
|
||||
function mongoose.import()
|
||||
links {"mongoose"}
|
||||
|
||||
mongoose.includes()
|
||||
end
|
||||
|
||||
function mongoose.includes()
|
||||
includedirs {mongoose.source}
|
||||
end
|
||||
|
||||
function mongoose.project()
|
||||
project "mongoose"
|
||||
language "C"
|
||||
|
||||
mongoose.includes()
|
||||
|
||||
files
|
||||
{
|
||||
path.join(mongoose.source, "*.c"),
|
||||
path.join(mongoose.source, "*.h"),
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, mongoose)
|
34
deps/premake/pdcurses.lua
vendored
Normal file
34
deps/premake/pdcurses.lua
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
pdcurses = {
|
||||
source = path.join(dependencies.basePath, "pdcurses"),
|
||||
}
|
||||
|
||||
function pdcurses.import()
|
||||
links {"pdcurses"}
|
||||
|
||||
pdcurses.includes()
|
||||
end
|
||||
|
||||
function pdcurses.includes()
|
||||
includedirs {pdcurses.source}
|
||||
end
|
||||
|
||||
function pdcurses.project()
|
||||
project "pdcurses"
|
||||
language "C"
|
||||
|
||||
pdcurses.includes()
|
||||
|
||||
files
|
||||
{
|
||||
path.join(pdcurses.source, "pdcurses/*.c"),
|
||||
path.join(pdcurses.source, "pdcurses/*.h"),
|
||||
path.join(pdcurses.source, "wincon/*.c"),
|
||||
path.join(pdcurses.source, "wincon/*.h"),
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, pdcurses)
|
50
deps/premake/protobuf.lua
vendored
Normal file
50
deps/premake/protobuf.lua
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
protobuf = {
|
||||
source = path.join(dependencies.basePath, "protobuf"),
|
||||
}
|
||||
|
||||
function protobuf.import()
|
||||
links {"protobuf"}
|
||||
|
||||
protobuf.includes()
|
||||
end
|
||||
|
||||
function protobuf.includes()
|
||||
includedirs {
|
||||
path.join(protobuf.source, "src"),
|
||||
}
|
||||
end
|
||||
|
||||
function protobuf.project()
|
||||
project "protobuf"
|
||||
language "C++"
|
||||
|
||||
protobuf.includes()
|
||||
|
||||
files {
|
||||
path.join(protobuf.source, "src/**.cc"),
|
||||
"./src/**.proto",
|
||||
}
|
||||
|
||||
removefiles {
|
||||
path.join(protobuf.source, "src/**/*test.cc"),
|
||||
path.join(protobuf.source, "src/google/protobuf/*test*.cc"),
|
||||
|
||||
path.join(protobuf.source, "src/google/protobuf/testing/**.cc"),
|
||||
path.join(protobuf.source, "src/google/protobuf/compiler/**.cc"),
|
||||
|
||||
path.join(protobuf.source, "src/google/protobuf/arena_nc.cc"),
|
||||
path.join(protobuf.source, "src/google/protobuf/util/internal/error_listener.cc"),
|
||||
path.join(protobuf.source, "**/*_gcc.cc"),
|
||||
}
|
||||
|
||||
rules {"ProtobufCompiler"}
|
||||
|
||||
defines {"_SCL_SECURE_NO_WARNINGS"}
|
||||
|
||||
linkoptions {"-IGNORE:4221"}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, protobuf)
|
35
deps/premake/udis86.lua
vendored
Normal file
35
deps/premake/udis86.lua
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
udis86 = {
|
||||
source = path.join(dependencies.basePath, "udis86"),
|
||||
}
|
||||
|
||||
function udis86.import()
|
||||
links {"udis86"}
|
||||
|
||||
udis86.includes()
|
||||
end
|
||||
|
||||
function udis86.includes()
|
||||
includedirs {
|
||||
udis86.source,
|
||||
path.join(udis86.source, "libudis86"),
|
||||
path.join(dependencies.basePath, "extra/udis86"),
|
||||
path.join(dependencies.basePath, "extra/udis86/libudis86"),
|
||||
}
|
||||
end
|
||||
|
||||
function udis86.project()
|
||||
project "udis86"
|
||||
language "C"
|
||||
|
||||
udis86.includes()
|
||||
|
||||
files {
|
||||
path.join(udis86.source, "libudis86/*.c"),
|
||||
path.join(dependencies.basePath, "extra/udis86/libudis86/*.c"),
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, udis86)
|
39
deps/premake/zlib.lua
vendored
Normal file
39
deps/premake/zlib.lua
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
zlib = {
|
||||
source = path.join(dependencies.basePath, "zlib"),
|
||||
}
|
||||
|
||||
function zlib.import()
|
||||
links {"zlib"}
|
||||
zlib.includes()
|
||||
end
|
||||
|
||||
function zlib.includes()
|
||||
includedirs {
|
||||
zlib.source
|
||||
}
|
||||
|
||||
defines {
|
||||
"ZLIB_CONST",
|
||||
}
|
||||
end
|
||||
|
||||
function zlib.project()
|
||||
project "zlib"
|
||||
language "C"
|
||||
|
||||
zlib.includes()
|
||||
|
||||
files {
|
||||
path.join(zlib.source, "*.h"),
|
||||
path.join(zlib.source, "*.c"),
|
||||
}
|
||||
|
||||
defines {
|
||||
"_CRT_SECURE_NO_DEPRECATE",
|
||||
}
|
||||
|
||||
warnings "Off"
|
||||
kind "StaticLib"
|
||||
end
|
||||
|
||||
table.insert(dependencies, zlib)
|
2
deps/zlib
vendored
2
deps/zlib
vendored
@ -1 +1 @@
|
||||
Subproject commit 2014a993addbc8f1b9785d97f55fd189792c2f78
|
||||
Subproject commit ec3df00224d4b396e2ac6586ab5d25f673caa4c2
|
@ -1,35 +0,0 @@
|
||||
dxsdk = {
|
||||
settings = nil
|
||||
}
|
||||
|
||||
function dxsdk.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
dxsdk.settings = settings
|
||||
|
||||
if not dxsdk.settings.defines then dxsdk.settings.defines = {} end
|
||||
end
|
||||
|
||||
function dxsdk.import()
|
||||
if not dxsdk.settings then error("You need to call dxsdk.setup first") end
|
||||
|
||||
--filter "platforms:*32"
|
||||
libdirs { path.join(dxsdk.settings.source, "Lib/x86") }
|
||||
|
||||
--filter "platforms:*64"
|
||||
-- libdirs { path.join(dxsdk.settings.source, "Lib/x64") }
|
||||
|
||||
--filter {}
|
||||
|
||||
dxsdk.includes()
|
||||
end
|
||||
|
||||
function dxsdk.includes()
|
||||
if not dxsdk.settings then error("You need to call dxsdk.setup first") end
|
||||
|
||||
includedirs { path.join(dxsdk.settings.source, "Include") }
|
||||
defines(dxsdk.settings.defines)
|
||||
end
|
||||
|
||||
function dxsdk.project()
|
||||
end
|
@ -1,51 +0,0 @@
|
||||
json11 = {
|
||||
settings = nil,
|
||||
}
|
||||
|
||||
function json11.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
json11.settings = settings
|
||||
end
|
||||
|
||||
function json11.import()
|
||||
if not json11.settings then error("Run json11.setup first") end
|
||||
|
||||
links { "json11" }
|
||||
json11.includes()
|
||||
end
|
||||
|
||||
function json11.includes()
|
||||
if not json11.settings then error("Run json11.setup first") end
|
||||
|
||||
includedirs { json11.settings.source }
|
||||
end
|
||||
|
||||
function json11.project()
|
||||
if not json11.settings then error("Run json11.setup first") end
|
||||
|
||||
project "json11"
|
||||
language "C++"
|
||||
|
||||
includedirs
|
||||
{
|
||||
json11.settings.source,
|
||||
}
|
||||
|
||||
files
|
||||
{
|
||||
path.join(json11.settings.source, "*.cpp"),
|
||||
path.join(json11.settings.source, "*.hpp"),
|
||||
}
|
||||
removefiles
|
||||
{
|
||||
path.join(json11.settings.source, "test*"),
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
defines { "_LIB" }
|
||||
removedefines { "_USRDLL", "_DLL" }
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,62 +0,0 @@
|
||||
libtomcrypt = {
|
||||
settings = nil
|
||||
}
|
||||
|
||||
function libtomcrypt.setup(settings)
|
||||
if not settings.source then error("Missing source") end
|
||||
|
||||
libtomcrypt.settings = settings
|
||||
|
||||
if not libtomcrypt.settings.defines then libtomcrypt.settings.defines = {} end
|
||||
end
|
||||
|
||||
function libtomcrypt.import()
|
||||
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
|
||||
|
||||
links { "libtomcrypt" }
|
||||
libtomcrypt.includes()
|
||||
end
|
||||
|
||||
function libtomcrypt.includes()
|
||||
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
|
||||
|
||||
defines(libtomcrypt.settings.defines)
|
||||
includedirs { path.join(libtomcrypt.settings.source, "src/headers") }
|
||||
end
|
||||
|
||||
function libtomcrypt.project()
|
||||
if not libtomcrypt.settings then error("Run libtomcrypt.setup first") end
|
||||
|
||||
project "libtomcrypt"
|
||||
language "C"
|
||||
|
||||
libtomcrypt.includes()
|
||||
files
|
||||
{
|
||||
path.join(libtomcrypt.settings.source, "src/**.c"),
|
||||
}
|
||||
removefiles
|
||||
{
|
||||
path.join(libtomcrypt.settings.source, "src/**/*tab.c"), -- included by files as necessary already afaik
|
||||
path.join(libtomcrypt.settings.source, "src/encauth/ocb3/**.c"), -- fails in Visual Studio with invalid syntax
|
||||
}
|
||||
defines
|
||||
{
|
||||
"_CRT_SECURE_NO_WARNINGS",
|
||||
"LTC_SOURCE", -- we are compiling from source code
|
||||
}
|
||||
|
||||
-- dependencies
|
||||
if libtommath and libtommath.settings then
|
||||
defines { "USE_LTM" }
|
||||
libtommath.import()
|
||||
end
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
defines { "_LIB" }
|
||||
removedefines { "_DLL", "_USRDLL" }
|
||||
linkoptions { "-IGNORE:4221" }
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,46 +0,0 @@
|
||||
libtommath = {
|
||||
settings = nil
|
||||
}
|
||||
|
||||
function libtommath.setup(settings)
|
||||
if not settings.source then error("Missing source") end
|
||||
|
||||
libtommath.settings = settings
|
||||
|
||||
if not libtommath.settings.defines then libtommath.settings.defines = {} end
|
||||
end
|
||||
|
||||
function libtommath.import()
|
||||
if not libtommath.settings then error("Run libtommath.setup first") end
|
||||
|
||||
links { "libtommath" }
|
||||
libtommath.includes()
|
||||
end
|
||||
|
||||
function libtommath.includes()
|
||||
if not libtommath.settings then error("Run libtommath.setup first") end
|
||||
|
||||
defines(libtommath.settings.defines)
|
||||
includedirs { libtommath.settings.source }
|
||||
end
|
||||
|
||||
function libtommath.project()
|
||||
if not libtommath.settings then error("Run libtommath.setup first") end
|
||||
|
||||
project "libtommath"
|
||||
language "C"
|
||||
|
||||
libtommath.includes()
|
||||
files
|
||||
{
|
||||
path.join(libtommath.settings.source, "*.c"),
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
defines { "_LIB" }
|
||||
removedefines { "_DLL", "_USRDLL" }
|
||||
linkoptions { "-IGNORE:4221" }
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,42 +0,0 @@
|
||||
mongoose = {
|
||||
settings = nil,
|
||||
}
|
||||
|
||||
function mongoose.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
mongoose.settings = settings
|
||||
end
|
||||
|
||||
function mongoose.import()
|
||||
if not mongoose.settings then error("Run mongoose.setup first") end
|
||||
|
||||
links { "mongoose" }
|
||||
mongoose.includes()
|
||||
end
|
||||
|
||||
function mongoose.includes()
|
||||
if not mongoose.settings then error("Run mongoose.setup first") end
|
||||
|
||||
includedirs { mongoose.settings.source }
|
||||
end
|
||||
|
||||
function mongoose.project()
|
||||
if not mongoose.settings then error("Run mongoose.setup first") end
|
||||
|
||||
project "mongoose"
|
||||
language "C"
|
||||
|
||||
mongoose.includes()
|
||||
files
|
||||
{
|
||||
path.join(mongoose.settings.source, "*.c"),
|
||||
path.join(mongoose.settings.source, "*.h"),
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
-- always build as static lib, as mongoose doesn't export anything
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,48 +0,0 @@
|
||||
pdcurses = {
|
||||
settings = nil,
|
||||
}
|
||||
|
||||
function pdcurses.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
pdcurses.settings = settings
|
||||
end
|
||||
|
||||
function pdcurses.import()
|
||||
if not pdcurses.settings then error("Run pdcurses.setup first") end
|
||||
|
||||
links { "pdcurses" }
|
||||
pdcurses.includes()
|
||||
end
|
||||
|
||||
function pdcurses.includes()
|
||||
if not pdcurses.settings then error("Run pdcurses.setup first") end
|
||||
|
||||
includedirs { pdcurses.settings.source }
|
||||
end
|
||||
|
||||
function pdcurses.project()
|
||||
if not pdcurses.settings then error("Run pdcurses.setup first") end
|
||||
|
||||
project "pdcurses"
|
||||
language "C"
|
||||
|
||||
includedirs
|
||||
{
|
||||
pdcurses.settings.source,
|
||||
}
|
||||
|
||||
files
|
||||
{
|
||||
path.join(pdcurses.settings.source, "pdcurses/*.c"),
|
||||
path.join(pdcurses.settings.source, "pdcurses/*.h"),
|
||||
path.join(pdcurses.settings.source, "wincon/*.c"),
|
||||
path.join(pdcurses.settings.source, "wincon/*.h"),
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
-- always build as static lib, as pdcurses doesn't export anything
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,68 +0,0 @@
|
||||
protobuf = {
|
||||
settings = nil,
|
||||
}
|
||||
|
||||
function protobuf.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
protobuf.settings = settings
|
||||
end
|
||||
|
||||
function protobuf.import()
|
||||
if not protobuf.settings then error("Run protobuf.setup first") end
|
||||
|
||||
links { "protobuf" }
|
||||
protobuf.includes()
|
||||
end
|
||||
|
||||
function protobuf.includes()
|
||||
if not protobuf.settings then error("Run protobuf.setup first") end
|
||||
|
||||
includedirs
|
||||
{
|
||||
path.join(protobuf.settings.source, "src"),
|
||||
}
|
||||
end
|
||||
|
||||
function protobuf.project()
|
||||
if not protobuf.settings then error("Run protobuf.setup first") end
|
||||
|
||||
project "protobuf"
|
||||
language "C++"
|
||||
|
||||
includedirs
|
||||
{
|
||||
path.join(protobuf.settings.source, "src"),
|
||||
}
|
||||
files
|
||||
{
|
||||
path.join(protobuf.settings.source, "src/**.cc"),
|
||||
"./src/**.proto",
|
||||
}
|
||||
removefiles
|
||||
{
|
||||
path.join(protobuf.settings.source, "src/**/*test.cc"),
|
||||
path.join(protobuf.settings.source, "src/google/protobuf/*test*.cc"),
|
||||
|
||||
path.join(protobuf.settings.source, "src/google/protobuf/testing/**.cc"),
|
||||
path.join(protobuf.settings.source, "src/google/protobuf/compiler/**.cc"),
|
||||
|
||||
path.join(protobuf.settings.source, "src/google/protobuf/arena_nc.cc"),
|
||||
path.join(protobuf.settings.source, "src/google/protobuf/util/internal/error_listener.cc"),
|
||||
path.join(protobuf.settings.source, "**/*_gcc.cc"),
|
||||
}
|
||||
|
||||
-- Generate source code from protobuf definitions
|
||||
rules { "ProtobufCompiler" }
|
||||
|
||||
-- dependencies
|
||||
zlib.import()
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
defines { "_SCL_SECURE_NO_WARNINGS" }
|
||||
warnings "Off"
|
||||
linkoptions { "-IGNORE:4221" }
|
||||
|
||||
-- always build as static lib, as we include our custom classes and therefore can't perform shared linking
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,51 +0,0 @@
|
||||
udis86 = {
|
||||
settings = nil
|
||||
}
|
||||
|
||||
function udis86.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
udis86.settings = settings
|
||||
|
||||
if not udis86.settings.defines then udis86.settings.defines = {} end
|
||||
end
|
||||
|
||||
function udis86.import()
|
||||
if not udis86.settings then error("You need to call udis86.setup first") end
|
||||
|
||||
links { "udis86" }
|
||||
udis86.includes()
|
||||
end
|
||||
|
||||
function udis86.includes()
|
||||
if not udis86.settings then error("You need to call udis86.setup first") end
|
||||
|
||||
includedirs
|
||||
{
|
||||
udis86.settings.source,
|
||||
path.join(udis86.settings.source, "libudis86/"),
|
||||
path.join(udis86.settings.source, "../extra/udis86/"),
|
||||
path.join(udis86.settings.source, "../extra/udis86/libudis86/")
|
||||
}
|
||||
defines(udis86.settings.defines)
|
||||
end
|
||||
|
||||
function udis86.project()
|
||||
if not udis86.settings then error("You need to call udis86.setup first") end
|
||||
|
||||
project "udis86"
|
||||
language "C"
|
||||
|
||||
udis86.includes()
|
||||
files
|
||||
{
|
||||
path.join(udis86.settings.source, "libudis86/*.h"),
|
||||
path.join(udis86.settings.source, "libudis86/*.c"),
|
||||
path.join(udis86.settings.source, "../extra/udis86/libudis86/*.c"),
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
kind "StaticLib"
|
||||
end
|
@ -1,48 +0,0 @@
|
||||
zlib = {
|
||||
settings = nil
|
||||
}
|
||||
|
||||
function zlib.setup(settings)
|
||||
if not settings.source then error("Missing source.") end
|
||||
|
||||
zlib.settings = settings
|
||||
|
||||
if not zlib.settings.defines then zlib.settings.defines = {} end
|
||||
end
|
||||
|
||||
function zlib.import()
|
||||
if not zlib.settings then error("You need to call zlib.setup first") end
|
||||
|
||||
links { "zlib" }
|
||||
zlib.includes()
|
||||
end
|
||||
|
||||
function zlib.includes()
|
||||
if not zlib.settings then error("You need to call zlib.setup first") end
|
||||
|
||||
includedirs { zlib.settings.source }
|
||||
defines(zlib.settings.defines)
|
||||
end
|
||||
|
||||
function zlib.project()
|
||||
if not zlib.settings then error("You need to call zlib.setup first") end
|
||||
|
||||
project "zlib"
|
||||
language "C"
|
||||
|
||||
zlib.includes()
|
||||
files
|
||||
{
|
||||
path.join(zlib.settings.source, "*.h"),
|
||||
path.join(zlib.settings.source, "*.c"),
|
||||
}
|
||||
defines
|
||||
{
|
||||
"_CRT_SECURE_NO_DEPRECATE",
|
||||
}
|
||||
|
||||
-- not our code, ignore POSIX usage warnings for now
|
||||
warnings "Off"
|
||||
|
||||
kind "StaticLib"
|
||||
end
|
218
premake5.lua
218
premake5.lua
@ -3,6 +3,9 @@ gitCurrentBranchCommand = "git symbolic-ref -q --short HEAD"
|
||||
|
||||
-- Quote the given string input as a C string
|
||||
function cstrquote(value)
|
||||
if value == nil then
|
||||
return "\"\""
|
||||
end
|
||||
result = value:gsub("\\", "\\\\")
|
||||
result = result:gsub("\"", "\\\"")
|
||||
result = result:gsub("\n", "\\n")
|
||||
@ -27,18 +30,42 @@ function vertonumarr(value, vernumber)
|
||||
return vernum
|
||||
end
|
||||
|
||||
-- Option to allow copying the DLL file to a custom folder after build
|
||||
dependencies = {
|
||||
basePath = "./deps"
|
||||
}
|
||||
|
||||
function dependencies.load()
|
||||
dir = path.join(dependencies.basePath, "premake/*.lua")
|
||||
deps = os.matchfiles(dir)
|
||||
|
||||
for i, dep in pairs(deps) do
|
||||
dep = dep:gsub(".lua", "")
|
||||
require(dep)
|
||||
end
|
||||
end
|
||||
|
||||
function dependencies.imports()
|
||||
for i, proj in pairs(dependencies) do
|
||||
if type(i) == 'number' then
|
||||
proj.import()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function dependencies.projects()
|
||||
for i, proj in pairs(dependencies) do
|
||||
if type(i) == 'number' then
|
||||
proj.project()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
newoption {
|
||||
trigger = "copy-to",
|
||||
description = "Optional, copy the DLL to a custom folder after build, define the path here if wanted.",
|
||||
value = "PATH"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "no-new-structure",
|
||||
description = "Do not use new virtual path structure (separating headers and source files)."
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "copy-pdb",
|
||||
description = "Copy debug information for binaries as well to the path given via --copy-to."
|
||||
@ -183,81 +210,21 @@ newaction {
|
||||
end
|
||||
}
|
||||
|
||||
depsBasePath = "./deps"
|
||||
|
||||
require "premake/json11"
|
||||
require "premake/libtomcrypt"
|
||||
require "premake/libtommath"
|
||||
require "premake/mongoose"
|
||||
require "premake/pdcurses"
|
||||
require "premake/protobuf"
|
||||
require "premake/zlib"
|
||||
require "premake/udis86"
|
||||
require "premake/dxsdk"
|
||||
|
||||
json11.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "json11"),
|
||||
}
|
||||
libtomcrypt.setup
|
||||
{
|
||||
defines = {
|
||||
"LTC_NO_FAST",
|
||||
"LTC_NO_PROTOTYPES",
|
||||
"LTC_NO_RSA_BLINDING",
|
||||
},
|
||||
source = path.join(depsBasePath, "libtomcrypt"),
|
||||
}
|
||||
libtommath.setup
|
||||
{
|
||||
defines = {
|
||||
"LTM_DESC",
|
||||
"__STDC_IEC_559__",
|
||||
},
|
||||
source = path.join(depsBasePath, "libtommath"),
|
||||
}
|
||||
mongoose.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "mongoose"),
|
||||
}
|
||||
pdcurses.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "pdcurses"),
|
||||
}
|
||||
protobuf.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "protobuf"),
|
||||
}
|
||||
zlib.setup
|
||||
{
|
||||
defines = {
|
||||
"ZLIB_CONST"
|
||||
},
|
||||
source = path.join(depsBasePath, "zlib"),
|
||||
}
|
||||
udis86.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "udis86"),
|
||||
}
|
||||
dxsdk.setup
|
||||
{
|
||||
source = path.join(depsBasePath, "dxsdk"),
|
||||
}
|
||||
dependencies.load()
|
||||
|
||||
workspace "iw4x"
|
||||
startproject "iw4x"
|
||||
location "./build"
|
||||
objdir "%{wks.location}/obj"
|
||||
targetdir "%{wks.location}/bin/%{cfg.buildcfg}"
|
||||
buildlog "%{wks.location}/obj/%{cfg.architecture}/%{cfg.buildcfg}/%{prj.name}/%{prj.name}.log"
|
||||
targetdir "%{wks.location}/bin/%{cfg.platform}/%{cfg.buildcfg}"
|
||||
|
||||
configurations { "Debug", "Release" }
|
||||
configurations {"Debug", "Release"}
|
||||
|
||||
language "C++"
|
||||
cppdialect "C++17"
|
||||
|
||||
architecture "x86"
|
||||
platforms "x86"
|
||||
platforms "Win32"
|
||||
|
||||
systemversion "latest"
|
||||
symbols "On"
|
||||
@ -266,18 +233,18 @@ workspace "iw4x"
|
||||
warnings "Extra"
|
||||
characterset "ASCII"
|
||||
|
||||
flags { "NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks" }
|
||||
flags {"NoIncrementalLink", "NoMinimalRebuild", "MultiProcessorCompile", "No64BitChecks"}
|
||||
|
||||
filter "platforms:x86"
|
||||
filter "platforms:Win*"
|
||||
defines {"_WINDOWS", "WIN32"}
|
||||
filter {}
|
||||
|
||||
filter "configurations:Release"
|
||||
optimize "On"
|
||||
buildoptions { "/GL" }
|
||||
linkoptions { "/IGNORE:4702", "/LTCG" }
|
||||
defines { "NDEBUG" }
|
||||
flags { "FatalCompileWarnings", "FatalLinkWarnings" }
|
||||
optimize "Size"
|
||||
buildoptions {"/GL"}
|
||||
linkoptions {"/IGNORE:4702", "/LTCG"}
|
||||
defines {"NDEBUG"}
|
||||
flags {"FatalCompileWarnings", "FatalLinkWarnings"}
|
||||
|
||||
if not _OPTIONS["force-unit-tests"] then
|
||||
rtti ("Off")
|
||||
@ -286,7 +253,7 @@ workspace "iw4x"
|
||||
|
||||
filter "configurations:Debug"
|
||||
optimize "Debug"
|
||||
defines { "DEBUG", "_DEBUG" }
|
||||
defines {"DEBUG", "_DEBUG"}
|
||||
filter {}
|
||||
|
||||
project "iw4x"
|
||||
@ -296,7 +263,6 @@ workspace "iw4x"
|
||||
"./src/**.rc",
|
||||
"./src/**.hpp",
|
||||
"./src/**.cpp",
|
||||
--"./src/**.proto",
|
||||
}
|
||||
includedirs {
|
||||
"%{prj.location}/src",
|
||||
@ -312,66 +278,32 @@ workspace "iw4x"
|
||||
|
||||
-- Debug flags
|
||||
if _OPTIONS["ac-disable"] then
|
||||
defines { "DISABLE_ANTICHEAT" }
|
||||
defines {"DISABLE_ANTICHEAT"}
|
||||
end
|
||||
if _OPTIONS["ac-debug-detections"] then
|
||||
defines { "DEBUG_DETECTIONS" }
|
||||
defines {"DEBUG_DETECTIONS"}
|
||||
end
|
||||
if _OPTIONS["ac-debug-load-library"] then
|
||||
defines { "DEBUG_LOAD_LIBRARY" }
|
||||
defines {"DEBUG_LOAD_LIBRARY"}
|
||||
end
|
||||
if _OPTIONS["force-unit-tests"] then
|
||||
defines { "FORCE_UNIT_TESTS" }
|
||||
defines {"FORCE_UNIT_TESTS"}
|
||||
end
|
||||
if _OPTIONS["force-minidump-upload"] then
|
||||
defines { "FORCE_MINIDUMP_UPLOAD" }
|
||||
defines {"FORCE_MINIDUMP_UPLOAD"}
|
||||
end
|
||||
if _OPTIONS["force-exception-handler"] then
|
||||
defines { "FORCE_EXCEPTION_HANDLER" }
|
||||
defines {"FORCE_EXCEPTION_HANDLER"}
|
||||
end
|
||||
if _OPTIONS["iw4x-zones"] then
|
||||
defines { "GENERATE_IW4X_SPECIFIC_ZONES" }
|
||||
defines {"GENERATE_IW4X_SPECIFIC_ZONES"}
|
||||
end
|
||||
|
||||
-- Pre-compiled header
|
||||
pchheader "STDInclude.hpp" -- must be exactly same as used in #include directives
|
||||
pchsource "src/STDInclude.cpp" -- real path
|
||||
buildoptions { "/Zm200" }
|
||||
|
||||
-- Dependency libraries
|
||||
json11.import()
|
||||
libtomcrypt.import()
|
||||
libtommath.import()
|
||||
mongoose.import()
|
||||
pdcurses.import()
|
||||
protobuf.import()
|
||||
zlib.import()
|
||||
udis86.import()
|
||||
dxsdk.import()
|
||||
|
||||
-- fix vpaths for protobuf sources
|
||||
vpaths
|
||||
{
|
||||
["*"] = { "./src/**" },
|
||||
--["Proto/Generated"] = { "**.pb.*" }, -- meh.
|
||||
}
|
||||
|
||||
-- Virtual paths
|
||||
if not _OPTIONS["no-new-structure"] then
|
||||
vpaths
|
||||
{
|
||||
["Headers/*"] = { "./src/**.hpp" },
|
||||
["Sources/*"] = { "./src/**.cpp" },
|
||||
["Resource/*"] = { "./src/**.rc" },
|
||||
--["Proto/Definitions/*"] = { "./src/Proto/**.proto" },
|
||||
--["Proto/Generated/*"] = { "**.pb.*" }, -- meh.
|
||||
}
|
||||
end
|
||||
|
||||
vpaths
|
||||
{
|
||||
["Docs/*"] = { "**.txt","**.md" },
|
||||
}
|
||||
dependencies.imports()
|
||||
|
||||
-- Pre-build
|
||||
prebuildcommands
|
||||
@ -400,49 +332,9 @@ workspace "iw4x"
|
||||
}
|
||||
end
|
||||
|
||||
--[[
|
||||
-- Generate source code from protobuf definitions
|
||||
rules { "ProtobufCompiler" }
|
||||
|
||||
-- Workaround: Consume protobuf generated source files
|
||||
matches = os.matchfiles(path.join("src/Proto/**.proto"))
|
||||
for i, srcPath in ipairs(matches) do
|
||||
basename = path.getbasename(srcPath)
|
||||
files
|
||||
{
|
||||
string.format("%%{prj.location}/src/proto/%s.pb.h", basename),
|
||||
string.format("%%{prj.location}/src/proto/%s.pb.cc", basename),
|
||||
}
|
||||
end
|
||||
includedirs
|
||||
{
|
||||
"%{prj.location}/src/proto",
|
||||
}
|
||||
filter "files:**.pb.*"
|
||||
flags {
|
||||
"NoPCH",
|
||||
}
|
||||
buildoptions {
|
||||
"/wd4100", -- "Unused formal parameter"
|
||||
"/wd4389", -- "Signed/Unsigned mismatch"
|
||||
"/wd6011", -- "Dereferencing NULL pointer"
|
||||
"/wd4125", -- "Decimal digit terminates octal escape sequence"
|
||||
}
|
||||
defines {
|
||||
"_SCL_SECURE_NO_WARNINGS",
|
||||
}
|
||||
filter {}
|
||||
]]
|
||||
|
||||
group "External dependencies"
|
||||
json11.project()
|
||||
libtomcrypt.project()
|
||||
libtommath.project()
|
||||
mongoose.project()
|
||||
pdcurses.project()
|
||||
protobuf.project()
|
||||
zlib.project()
|
||||
udis86.project()
|
||||
group "External Dependencies"
|
||||
dependencies.projects()
|
||||
|
||||
rule "ProtobufCompiler"
|
||||
display "Protobuf compiler"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <StdInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -494,7 +494,7 @@ namespace Components
|
||||
{
|
||||
this->reallocateEntryPool();
|
||||
|
||||
Dvar::Register<bool>("r_noVoid", false, Game::DVAR_FLAG_SAVED, "Disable void model (red fx)");
|
||||
Dvar::Register<bool>("r_noVoid", false, Game::DVAR_ARCHIVE, "Disable void model (red fx)");
|
||||
|
||||
AssetHandler::ClearTemporaryAssets();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_COMMAP_VERSION 0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include <stb_truetype.h>
|
||||
@ -61,7 +61,7 @@ namespace Assets
|
||||
glyph.pixelHeight = static_cast<char>(gh);
|
||||
glyph.x0 = static_cast<char>(x0);
|
||||
glyph.y0 = static_cast<char>(y0 + yOffset);
|
||||
glyph.dx = static_cast<char>(roundf(scale * advance));
|
||||
glyph.dx = static_cast<char>(std::roundf(scale * advance));
|
||||
|
||||
// Advance to next col
|
||||
x = x + gw + 1;
|
||||
@ -92,7 +92,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
void IFont_s::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone*)
|
||||
void IFont_s::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
Components::FileSystem::File fontDefFile(Utils::String::VA("%s.json", name.data()));
|
||||
Components::FileSystem::File fontFile(Utils::String::VA("%s.ttf", name.data()));
|
||||
@ -105,11 +105,13 @@ namespace Assets
|
||||
if (!errors.empty())
|
||||
{
|
||||
Components::Logger::Error("Font define %s is broken: %s.", name.data(), errors.data());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fontDef.is_object())
|
||||
{
|
||||
Components::Logger::Error("Font define %s is invaild.", name.data(), errors.data());
|
||||
return;
|
||||
}
|
||||
|
||||
int w = fontDef["textureWidth"].int_value();
|
||||
@ -118,22 +120,28 @@ namespace Assets
|
||||
int size = fontDef["size"].int_value();
|
||||
int yOffset = fontDef["yOffset"].int_value();
|
||||
|
||||
uint8_t* pixels = Utils::Memory::AllocateArray<uint8_t>(w * h);
|
||||
auto* pixels = builder->getAllocator()->allocateArray<uint8_t>(w * h);
|
||||
|
||||
// Setup assets
|
||||
auto* texName = Utils::Memory::DuplicateString(Utils::String::VA("if_%s", name.data() + 6 /* skip "fonts/" */));
|
||||
auto* fontName = Utils::Memory::DuplicateString(name.data());
|
||||
auto* glowMaterialName = Utils::Memory::DuplicateString(Utils::String::VA("%s_glow", name.data()));
|
||||
const auto* texName = builder->getAllocator()->duplicateString(Utils::String::VA("if_%s", name.data() + 6 /* skip "fonts/" */));
|
||||
const auto* fontName = builder->getAllocator()->duplicateString(name.data());
|
||||
const auto* glowMaterialName = builder->getAllocator()->duplicateString(Utils::String::VA("%s_glow", name.data()));
|
||||
|
||||
auto* image = builder->getAllocator()->allocate<Game::GfxImage>();
|
||||
std::memcpy(image, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_IMAGE, "gamefonts_pc").image, sizeof(Game::GfxImage));
|
||||
|
||||
auto* image = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_IMAGE, "gamefonts_pc").image);
|
||||
image->name = texName;
|
||||
|
||||
auto* material = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc").material);
|
||||
material->textureTable = Utils::Memory::Duplicate(material->textureTable);
|
||||
|
||||
auto* material = builder->getAllocator()->allocate<Game::Material>();
|
||||
std::memcpy(material, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc").material, sizeof(Game::Material));
|
||||
|
||||
material->textureTable = builder->getAllocator()->allocate<Game::MaterialTextureDef>();
|
||||
material->textureTable->u.image = image;
|
||||
material->info.name = fontName;
|
||||
|
||||
auto* glowMaterial = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc_glow").material);
|
||||
auto* glowMaterial = builder->getAllocator()->allocate<Game::Material>();
|
||||
std::memcpy(glowMaterial, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc_glow").material, sizeof(Game::Material));
|
||||
|
||||
glowMaterial->textureTable = material->textureTable;
|
||||
glowMaterial->info.name = glowMaterialName;
|
||||
|
||||
@ -161,14 +169,14 @@ namespace Assets
|
||||
charset.push_back(i);
|
||||
}
|
||||
|
||||
auto* font = Utils::Memory::Allocate<Game::Font_s>();
|
||||
auto* font = builder->getAllocator()->allocate<Game::Font_s>();
|
||||
|
||||
font->fontName = fontName;
|
||||
font->pixelHeight = size;
|
||||
font->material = material;
|
||||
font->glowMaterial = glowMaterial;
|
||||
font->glyphCount = charset.size();
|
||||
font->glyphs = Utils::Memory::AllocateArray<Game::Glyph>(charset.size());
|
||||
font->glyphs = builder->getAllocator()->allocateArray<Game::Glyph>(charset.size());
|
||||
|
||||
// Generate glyph data
|
||||
int result = PackFonts(reinterpret_cast<const uint8_t*>(fontFile.getBuffer().data()), charset, font->glyphs, static_cast<float>(size), pixels, w, h, yOffset);
|
||||
@ -239,7 +247,6 @@ namespace Assets
|
||||
}
|
||||
|
||||
Utils::IO::WriteFile(Utils::String::VA("userraw\\images\\%s.iwi", texName), outIwi);
|
||||
Utils::Memory::Free(pixels);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_FX_VERSION 1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "StdInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_IMG_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_LIGHT_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_GFXMAP_VERSION 1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_MAT_VERSION "1"
|
||||
|
||||
@ -199,7 +199,7 @@ namespace Assets
|
||||
replacementFound = true;
|
||||
}
|
||||
}
|
||||
}, false, false);
|
||||
}, false);
|
||||
|
||||
if (!replacementFound)
|
||||
{
|
||||
@ -236,7 +236,7 @@ namespace Assets
|
||||
replacementFound = true;
|
||||
}
|
||||
}
|
||||
}, false, false);
|
||||
}, false);
|
||||
}
|
||||
|
||||
if (!replacementFound && asset->techniqueSet)
|
||||
@ -250,28 +250,31 @@ namespace Assets
|
||||
if (iw4TechSet)
|
||||
{
|
||||
Game::DB_EnumXAssetEntries(Game::XAssetType::ASSET_TYPE_MATERIAL, [asset, iw4TechSet](Game::XAssetEntry* entry)
|
||||
{
|
||||
if (!replacementFound)
|
||||
{
|
||||
if (!replacementFound)
|
||||
Game::XAssetHeader header = entry->asset.header;
|
||||
|
||||
if (header.material->techniqueSet == iw4TechSet->asset.header.techniqueSet)
|
||||
{
|
||||
Game::XAssetHeader header = entry->asset.header;
|
||||
Components::Logger::Print("Material %s with techset %s has been mapped to %s (last chance!), taking the sort key of material %s\n",
|
||||
asset->info.name, asset->techniqueSet->name,
|
||||
header.material->techniqueSet->name, header.material->info.name);
|
||||
|
||||
if (header.material->techniqueSet == iw4TechSet->asset.header.techniqueSet)
|
||||
{
|
||||
Components::Logger::Print("Material %s with techset %s has been mapped to %s (last chance!), taking the sort key of material %s\n", asset->info.name, asset->techniqueSet->name, header.material->techniqueSet->name, header.material->info.name);
|
||||
asset->info.sortKey = header.material->info.sortKey;
|
||||
asset->techniqueSet = iw4TechSet->asset.header.techniqueSet;
|
||||
asset->info.sortKey = header.material->info.sortKey;
|
||||
asset->techniqueSet = iw4TechSet->asset.header.techniqueSet;
|
||||
|
||||
// this is terrible!
|
||||
asset->stateBitsCount = header.material->stateBitsCount;
|
||||
asset->stateBitsTable = header.material->stateBitsTable;
|
||||
std::memcpy(asset->stateBitsEntry, header.material->stateBitsEntry, 48);
|
||||
asset->constantCount = header.material->constantCount;
|
||||
asset->constantTable = header.material->constantTable;
|
||||
// this is terrible!
|
||||
asset->stateBitsCount = header.material->stateBitsCount;
|
||||
asset->stateBitsTable = header.material->stateBitsTable;
|
||||
std::memcpy(asset->stateBitsEntry, header.material->stateBitsEntry, 48);
|
||||
asset->constantCount = header.material->constantCount;
|
||||
asset->constantTable = header.material->constantTable;
|
||||
|
||||
replacementFound = true;
|
||||
}
|
||||
replacementFound = true;
|
||||
}
|
||||
}, false, false);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (!replacementFound)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_TECHSET_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_TECHSET_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_TECHSET_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <StdInclude.hpp>
|
||||
|
||||
#define IW4X_TECHSET_VERSION "0"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_ANIM_VERSION 1
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_MODEL_VERSION 5
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "StdInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
#define IW4X_CLIPMAP_VERSION 2
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <StdInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Assets
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -8,7 +8,8 @@ namespace Components
|
||||
Utils::Cryptography::Token Auth::ComputeToken;
|
||||
Utils::Cryptography::ECC::Key Auth::GuidKey;
|
||||
|
||||
std::vector<std::uint64_t> Auth::BannedUids = {
|
||||
std::vector<std::uint64_t> Auth::BannedUids =
|
||||
{
|
||||
0xf4d2c30b712ac6e3,
|
||||
0xf7e33c4081337fa3,
|
||||
0x6f5597f103cc50e9
|
||||
@ -82,7 +83,7 @@ namespace Components
|
||||
|
||||
Command::ServerParams params;
|
||||
|
||||
if (params.length() < 3)
|
||||
if (params.size() < 3)
|
||||
{
|
||||
Game::SV_Cmd_EndTokenizedString();
|
||||
Logger::SoftError("Connecting failed: Command parsing error!");
|
||||
@ -169,7 +170,7 @@ namespace Components
|
||||
Command::ServerParams params;
|
||||
|
||||
// Ensure there are enough params
|
||||
if (params.length() < 3)
|
||||
if (params.size() < 3)
|
||||
{
|
||||
Network::Send(address, "error\nInvalid connect string!");
|
||||
return;
|
||||
@ -179,8 +180,8 @@ namespace Components
|
||||
Utils::InfoString infostr(params[2]);
|
||||
|
||||
// Read the required data
|
||||
std::string steamId = infostr.get("xuid");
|
||||
std::string challenge = infostr.get("challenge");
|
||||
const auto& steamId = infostr.get("xuid");
|
||||
const auto& challenge = infostr.get("challenge");
|
||||
|
||||
if (steamId.empty() || challenge.empty())
|
||||
{
|
||||
@ -189,12 +190,12 @@ namespace Components
|
||||
}
|
||||
|
||||
// Parse the id
|
||||
unsigned __int64 xuid = strtoull(steamId.data(), nullptr, 16);
|
||||
const auto xuid = std::strtoull(steamId.data(), nullptr, 16);
|
||||
|
||||
SteamID guid;
|
||||
guid.bits = xuid;
|
||||
|
||||
if (Bans::IsBanned({ guid, address.getIP() }))
|
||||
if (Bans::IsBanned({guid, address.getIP()}))
|
||||
{
|
||||
Network::Send(address, "error\nEXE_ERR_BANNED_PERM");
|
||||
return;
|
||||
@ -223,8 +224,8 @@ namespace Components
|
||||
}
|
||||
|
||||
// Verify the security level
|
||||
uint32_t ourLevel = static_cast<uint32_t>(Dvar::Var("sv_securityLevel").get<int>());
|
||||
uint32_t userLevel = Auth::GetZeroBits(connectData.token(), connectData.publickey());
|
||||
auto ourLevel = Dvar::Var("sv_securityLevel").get<unsigned int>();
|
||||
auto userLevel = Auth::GetZeroBits(connectData.token(), connectData.publickey());
|
||||
|
||||
if (userLevel < ourLevel)
|
||||
{
|
||||
@ -431,7 +432,7 @@ namespace Components
|
||||
Scheduler::OnFrame(Auth::Frame);
|
||||
|
||||
// Register dvar
|
||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||
|
||||
// Install registration hook
|
||||
Utils::Hook(0x6265F9, Auth::DirectConnectStub, HOOK_JUMP).install()->quick();
|
||||
@ -454,7 +455,7 @@ namespace Components
|
||||
{
|
||||
Command::Add("securityLevel", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
uint32_t level = Auth::GetZeroBits(Auth::GuidToken, Auth::GuidKey.getPublicKey());
|
||||
Logger::Print("Your current security level is %d\n", level);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -234,17 +234,17 @@ namespace Components
|
||||
{
|
||||
Command::Add("banclient", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string reason = "EXE_ERR_BANNED_PERM";
|
||||
if (params->length() >= 3) reason = params->join(2);
|
||||
if (params->size() >= 3) reason = params->join(2);
|
||||
|
||||
Bans::BanClientNum(atoi(params->get(1)), reason);
|
||||
});
|
||||
|
||||
Command::Add("unbanclient", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string type = params->get(1);
|
||||
|
||||
@ -274,9 +274,4 @@ namespace Components
|
||||
Bans::LoadBans(&list);
|
||||
});
|
||||
}
|
||||
|
||||
Bans::~Bans()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace Components
|
||||
typedef std::pair<SteamID, Game::netIP_t> Entry;
|
||||
|
||||
Bans();
|
||||
~Bans();
|
||||
|
||||
static void BanClientNum(int num, const std::string& reason);
|
||||
static void UnbanClient(SteamID id);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -36,7 +36,8 @@ namespace Components
|
||||
{ "leanright", Game::usercmdButtonBits::CMD_BUTTON_LEAN_RIGHT },
|
||||
{ "ads", Game::usercmdButtonBits::CMD_BUTTON_ADS },
|
||||
{ "holdbreath", Game::usercmdButtonBits::CMD_BUTTON_BREATH },
|
||||
{ "use", Game::usercmdButtonBits::CMD_BUTTON_USE_RELOAD | Game::usercmdButtonBits::CMD_BUTTON_ACTIVATE },
|
||||
{ "usereload", Game::usercmdButtonBits::CMD_BUTTON_USE_RELOAD },
|
||||
{ "activate", Game::usercmdButtonBits::CMD_BUTTON_ACTIVATE },
|
||||
{ "0", Bots::NUM_0 },
|
||||
{ "1", Bots::NUM_1 },
|
||||
{ "2", Bots::NUM_2 },
|
||||
@ -51,7 +52,7 @@ namespace Components
|
||||
|
||||
int Bots::BuildConnectString(char* buffer, const char* connectString, int num, int, int protocol, int checksum, int statVer, int statStuff, int port)
|
||||
{
|
||||
static auto botId = 0;
|
||||
static size_t botId = 0;
|
||||
const char* botName;
|
||||
|
||||
if (Bots::BotNames.empty())
|
||||
@ -60,7 +61,7 @@ namespace Components
|
||||
|
||||
if (bots.exists())
|
||||
{
|
||||
auto names = Utils::String::Explode(bots.getBuffer(), '\n');
|
||||
auto names = Utils::String::Split(bots.getBuffer(), '\n');
|
||||
|
||||
for (auto& name : names)
|
||||
{
|
||||
@ -119,13 +120,9 @@ namespace Components
|
||||
{
|
||||
Script::AddMethod("SetPing", [](Game::scr_entref_t entref) // gsc: self SetPing(<int>)
|
||||
{
|
||||
const auto ping = Game::Scr_GetInt(0);
|
||||
auto ping = Game::Scr_GetInt(0);
|
||||
|
||||
if (ping < 0 || ping > 999)
|
||||
{
|
||||
Game::Scr_ParamError(0, "^1SetPing: Ping needs to be between 0 and 999!\n");
|
||||
return;
|
||||
}
|
||||
ping = std::clamp(ping, 0, 999);
|
||||
|
||||
const auto* ent = Game::GetPlayerEntity(entref);
|
||||
auto* client = Script::GetClient(ent);
|
||||
@ -261,27 +258,28 @@ namespace Components
|
||||
|
||||
// Keep test client functionality
|
||||
if (!g_botai[entnum].active)
|
||||
{
|
||||
Game::SV_BotUserMove(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
Game::usercmd_s ucmd = {0};
|
||||
Game::usercmd_s userCmd = {0};
|
||||
|
||||
ucmd.serverTime = *Game::svs_time;
|
||||
userCmd.serverTime = *Game::svs_time;
|
||||
|
||||
ucmd.buttons = g_botai[entnum].buttons;
|
||||
ucmd.forwardmove = g_botai[entnum].forward;
|
||||
ucmd.rightmove = g_botai[entnum].right;
|
||||
ucmd.weapon = g_botai[entnum].weapon;
|
||||
userCmd.buttons = g_botai[entnum].buttons;
|
||||
userCmd.forwardmove = g_botai[entnum].forward;
|
||||
userCmd.rightmove = g_botai[entnum].right;
|
||||
userCmd.weapon = g_botai[entnum].weapon;
|
||||
|
||||
Game::SV_ClientThink(cl, &ucmd);
|
||||
Game::SV_ClientThink(cl, &userCmd);
|
||||
}
|
||||
|
||||
constexpr auto SV_BotUserMove = 0x626E50;
|
||||
__declspec(naked) void Bots::SV_UpdateBots_Hk()
|
||||
__declspec(naked) void Bots::SV_BotUserMove_Hk()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
call SV_BotUserMove
|
||||
|
||||
pushad
|
||||
|
||||
push edi
|
||||
@ -293,6 +291,36 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void Bots::G_SelectWeaponIndex(int clientNum, int iWeaponIndex)
|
||||
{
|
||||
if (g_botai[clientNum].active)
|
||||
{
|
||||
g_botai[clientNum].weapon = static_cast<uint16_t>(iWeaponIndex);
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void Bots::G_SelectWeaponIndex_Hk()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
pushad
|
||||
|
||||
push [esp + 0x20 + 0x8]
|
||||
push [esp + 0x20 + 0x8]
|
||||
call Bots::G_SelectWeaponIndex
|
||||
add esp, 0x8
|
||||
|
||||
popad
|
||||
|
||||
// Code skipped by hook
|
||||
mov eax, [esp + 0x8]
|
||||
push eax
|
||||
|
||||
push 0x441B85
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
Bots::Bots()
|
||||
{
|
||||
// Replace connect string
|
||||
@ -301,8 +329,10 @@ namespace Components
|
||||
// Intercept sprintf for the connect string
|
||||
Utils::Hook(0x48ADAB, Bots::BuildConnectString, HOOK_CALL).install()->quick();
|
||||
|
||||
Utils::Hook(0x627021, SV_UpdateBots_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x627241, SV_UpdateBots_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x627021, Bots::SV_BotUserMove_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x627241, Bots::SV_BotUserMove_Hk, HOOK_CALL).install()->quick();
|
||||
|
||||
Utils::Hook(0x441B80, Bots::G_SelectWeaponIndex_Hk, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Zero the bot command array
|
||||
for (auto i = 0u; i < std::extent_v<decltype(g_botai)>; i++)
|
||||
@ -315,7 +345,7 @@ namespace Components
|
||||
{
|
||||
auto count = 1u;
|
||||
|
||||
if (params->length() > 1)
|
||||
if (params->size() > 1)
|
||||
{
|
||||
if (params->get(1) == "all"s)
|
||||
{
|
||||
|
@ -31,6 +31,9 @@ namespace Components
|
||||
static void AddMethods();
|
||||
|
||||
static void BotAiAction(Game::client_t* cl);
|
||||
static void SV_UpdateBots_Hk();
|
||||
static void SV_BotUserMove_Hk();
|
||||
|
||||
static void G_SelectWeaponIndex(int clientNum, int iWeaponIndex);
|
||||
static void G_SelectWeaponIndex_Hk();
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -192,14 +192,14 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
CardTitles::CustomTitleDvar = Dvar::Register<const char*>("customtitle", "", Game::dvar_flag::DVAR_FLAG_USERINFO | Game::dvar_flag::DVAR_FLAG_SAVED, "Custom card title");
|
||||
CardTitles::CustomTitleDvar = Dvar::Register<const char*>("customtitle", "", Game::dvar_flag::DVAR_USERINFO | Game::dvar_flag::DVAR_ARCHIVE, "Custom card title");
|
||||
});
|
||||
|
||||
ServerCommands::OnCommand(21, [](Command::Params* params)
|
||||
{
|
||||
if (params->get(1) == "customTitles"s && !Dedicated::IsEnabled())
|
||||
{
|
||||
if (params->length() == 3)
|
||||
if (params->size() == 3)
|
||||
{
|
||||
CardTitles::ParseCustomTitles(params->get(2));
|
||||
return true;
|
||||
@ -210,11 +210,6 @@ namespace Components
|
||||
|
||||
});
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(CardTitles::CustomTitles); ++i)
|
||||
{
|
||||
CardTitles::CustomTitles[i].clear();
|
||||
}
|
||||
|
||||
Utils::Hook(0x62EB26, CardTitles::GetPlayerCardClientInfoStub).install()->quick();
|
||||
|
||||
// Table lookup stuff
|
||||
@ -227,12 +222,4 @@ namespace Components
|
||||
AntiCheat::CheckStartupTime();
|
||||
#endif
|
||||
}
|
||||
|
||||
CardTitles::~CardTitles()
|
||||
{
|
||||
for (int i = 0; i < ARRAYSIZE(CardTitles::CustomTitles); ++i)
|
||||
{
|
||||
CardTitles::CustomTitles[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ namespace Components
|
||||
static void ParseCustomTitles(const char * msg);
|
||||
|
||||
CardTitles();
|
||||
~CardTitles();
|
||||
|
||||
private:
|
||||
static CClient * GetClientByIndex(std::uint32_t index);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -19,7 +19,7 @@ namespace Components
|
||||
data = "^1Unable to get changelog.";
|
||||
}
|
||||
|
||||
Changelog::Lines = Utils::String::Explode(data, '\n');
|
||||
Changelog::Lines = Utils::String::Split(data, '\n');
|
||||
|
||||
for (auto& line : Changelog::Lines)
|
||||
{
|
||||
@ -60,12 +60,4 @@ namespace Components
|
||||
Scheduler::OnFrameAsync(AntiCheat::QuickCodeScanner1);
|
||||
#endif
|
||||
}
|
||||
|
||||
Changelog::~Changelog()
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
||||
Changelog::Lines.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Changelog();
|
||||
~Changelog();
|
||||
|
||||
static void LoadChangelog();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -263,7 +263,7 @@ namespace Components
|
||||
}
|
||||
|
||||
const auto* cmd = params->get(0);
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
Logger::Print("Usage: %s <client number> : prevent the player from using the chat\n", cmd);
|
||||
return;
|
||||
@ -285,7 +285,7 @@ namespace Components
|
||||
}
|
||||
|
||||
const auto* cmd = params->get(0);
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
Logger::Print("Usage: %s <client number or guid>\n%s all = unmute everyone\n", cmd, cmd);
|
||||
return;
|
||||
@ -299,7 +299,7 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->get(1) == "all"s)
|
||||
if (std::strcmp(params->get(1), "all") == 0)
|
||||
{
|
||||
Logger::Print("All players were unmuted\n");
|
||||
Chat::UnmuteInternal(0, true);
|
||||
@ -316,7 +316,7 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_FLAG_SAVED, "The normalized maximum width of a chat message");
|
||||
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_ARCHIVE, "The normalized maximum width of a chat message");
|
||||
Chat::AddChatCommands();
|
||||
});
|
||||
|
||||
@ -328,9 +328,4 @@ namespace Components
|
||||
// Change logic that does word splitting with new lines for chat messages to support fonticons
|
||||
Utils::Hook(0x592E10, CG_AddToTeamChat_Stub, HOOK_JUMP).install()->quick();
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
{
|
||||
Chat::MuteList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ namespace Components
|
||||
static constexpr auto FONT_ICON_CHAT_WIDTH_CALCULATION_MULTIPLIER = 2.0f;
|
||||
public:
|
||||
Chat();
|
||||
~Chat();
|
||||
|
||||
private:
|
||||
static Game::dvar_t** cg_chatHeight;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -75,7 +75,7 @@ namespace Components
|
||||
// Create clantag dvar
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("clantag", "", Game::dvar_flag::DVAR_FLAG_USERINFO | Game::dvar_flag::DVAR_FLAG_SAVED, "If set, your clantag will be shown on the scoreboard.");
|
||||
Dvar::Register<const char*>("clantag", "", Game::dvar_flag::DVAR_USERINFO | Game::dvar_flag::DVAR_ARCHIVE, "If set, your clantag will be shown on the scoreboard.");
|
||||
});
|
||||
|
||||
// Servercommand hook
|
||||
@ -83,7 +83,7 @@ namespace Components
|
||||
{
|
||||
if (params->get(1) == "clantags"s && !Dedicated::IsEnabled())
|
||||
{
|
||||
if (params->length() == 3)
|
||||
if (params->size() == 3)
|
||||
{
|
||||
ClanTags::ParseClantags(params->get(2));
|
||||
return true;
|
||||
@ -93,20 +93,7 @@ namespace Components
|
||||
return false;
|
||||
});
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(ClanTags::Tags); ++i)
|
||||
{
|
||||
ClanTags::Tags[i].clear();
|
||||
}
|
||||
|
||||
// Draw clantag before playername
|
||||
Utils::Hook(0x591242, ClanTags::DrawPlayerNameOnScoreboard).install()->quick();
|
||||
}
|
||||
|
||||
ClanTags::~ClanTags()
|
||||
{
|
||||
for (int i = 0; i < ARRAYSIZE(ClanTags::Tags); ++i)
|
||||
{
|
||||
ClanTags::Tags[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ namespace Components
|
||||
static const char* GetUserClantag(std::uint32_t clientnum, const char * playername);
|
||||
|
||||
ClanTags();
|
||||
~ClanTags();
|
||||
|
||||
private:
|
||||
static std::string Tags[18];
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -28,10 +28,11 @@ namespace Components
|
||||
bool ClientCommand::CallbackHandler(Game::gentity_s* ent, const char* cmd)
|
||||
{
|
||||
const auto command = Utils::String::ToLower(cmd);
|
||||
const auto got = ClientCommand::FunctionMap.find(command);
|
||||
|
||||
if (ClientCommand::FunctionMap.find(command) != ClientCommand::FunctionMap.end())
|
||||
if (got != ClientCommand::FunctionMap.end())
|
||||
{
|
||||
ClientCommand::FunctionMap[command](ent);
|
||||
got->second(ent);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -42,7 +43,7 @@ namespace Components
|
||||
{
|
||||
const auto command = Utils::String::ToLower(name);
|
||||
|
||||
ClientCommand::FunctionMap[command] = callback;
|
||||
ClientCommand::FunctionMap[command] = std::move(callback);
|
||||
}
|
||||
|
||||
void ClientCommand::ClientCommandStub(const int clientNum)
|
||||
@ -147,7 +148,7 @@ namespace Components
|
||||
Command::ServerParams params = {};
|
||||
Game::vec3_t origin, angles{0.f, 0.f, 0.f};
|
||||
|
||||
if (params.length() < 4u || params.length() > 6u)
|
||||
if (params.size() < 4 || params.size() > 6)
|
||||
{
|
||||
Game::SV_GameSendServerCommand(ent->s.number, 0,
|
||||
Utils::String::VA("%c \"GAME_USAGE\x15: setviewpos x y z [yaw] [pitch]\n\"", 0x65));
|
||||
@ -159,12 +160,12 @@ namespace Components
|
||||
origin[i] = std::strtof(params.get(i + 1), nullptr);
|
||||
}
|
||||
|
||||
if (params.length() >= 5u)
|
||||
if (params.size() >= 5)
|
||||
{
|
||||
angles[1] = std::strtof(params.get(4), nullptr); // Yaw
|
||||
}
|
||||
|
||||
if (params.length() == 6u)
|
||||
if (params.size() == 6)
|
||||
{
|
||||
angles[0] = std::strtof(params.get(5), nullptr); // Pitch
|
||||
}
|
||||
@ -289,9 +290,4 @@ namespace Components
|
||||
ClientCommand::AddCheatCommands();
|
||||
ClientCommand::AddScriptFunctions();
|
||||
}
|
||||
|
||||
ClientCommand::~ClientCommand()
|
||||
{
|
||||
ClientCommand::FunctionMap.clear();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Components
|
||||
typedef void(Callback)(Game::gentity_s* entity);
|
||||
|
||||
ClientCommand();
|
||||
~ClientCommand();
|
||||
|
||||
static void Add(const char* name, Utils::Slot<Callback> callback);
|
||||
static bool CheatsOk(const Game::gentity_s* ent);
|
||||
|
||||
|
@ -1,60 +1,75 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::unordered_map<std::string, Utils::Slot<Command::Callback>> Command::FunctionMap;
|
||||
std::unordered_map<std::string, Utils::Slot<Command::Callback>> Command::FunctionMapSV;
|
||||
|
||||
std::string Command::Params::join(size_t startIndex)
|
||||
std::string Command::Params::join(const int index)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
for (size_t i = startIndex; i < this->length(); ++i)
|
||||
for (auto i = index; i < this->size(); i++)
|
||||
{
|
||||
if (i > startIndex) result.append(" ");
|
||||
result.append(this->operator[](i));
|
||||
if (i > index) result.append(" ");
|
||||
result.append(this->get(i));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* Command::Params::operator[](size_t index)
|
||||
Command::ClientParams::ClientParams()
|
||||
: nesting_(Game::cmd_args->nesting)
|
||||
{
|
||||
return this->get(index);
|
||||
assert(Game::cmd_args->nesting < Game::CMD_MAX_NESTING);
|
||||
}
|
||||
|
||||
const char* Command::ClientParams::get(size_t index)
|
||||
int Command::ClientParams::size()
|
||||
{
|
||||
if (index >= this->length()) return "";
|
||||
return Game::cmd_argv[this->commandId][index];
|
||||
return Game::cmd_args->argc[this->nesting_];
|
||||
}
|
||||
|
||||
size_t Command::ClientParams::length()
|
||||
const char* Command::ClientParams::get(const int index)
|
||||
{
|
||||
return Game::cmd_argc[this->commandId];
|
||||
if (index >= this->size())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Game::cmd_args->argv[this->nesting_][index];
|
||||
}
|
||||
|
||||
const char* Command::ServerParams::get(size_t index)
|
||||
Command::ServerParams::ServerParams()
|
||||
: nesting_(Game::sv_cmd_args->nesting)
|
||||
{
|
||||
if (index >= this->length()) return "";
|
||||
return Game::cmd_argv_sv[this->commandId][index];
|
||||
assert(Game::sv_cmd_args->nesting < Game::CMD_MAX_NESTING);
|
||||
}
|
||||
|
||||
size_t Command::ServerParams::length()
|
||||
int Command::ServerParams::size()
|
||||
{
|
||||
return Game::cmd_argc_sv[this->commandId];
|
||||
return Game::sv_cmd_args->argc[this->nesting_];
|
||||
}
|
||||
|
||||
const char* Command::ServerParams::get(const int index)
|
||||
{
|
||||
if (index >= this->size())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Game::sv_cmd_args->argv[this->nesting_][index];
|
||||
}
|
||||
|
||||
void Command::Add(const char* name, Utils::Slot<Command::Callback> callback)
|
||||
{
|
||||
std::string command = Utils::String::ToLower(name);
|
||||
const auto command = Utils::String::ToLower(name);
|
||||
|
||||
if (Command::FunctionMap.find(command) == Command::FunctionMap.end())
|
||||
{
|
||||
Command::AddRaw(name, Command::MainCallback);
|
||||
}
|
||||
|
||||
Command::FunctionMap[command] = callback;
|
||||
Command::FunctionMap[command] = std::move(callback);
|
||||
}
|
||||
|
||||
void Command::AddSV(const char* name, Utils::Slot<Command::Callback> callback)
|
||||
@ -70,7 +85,7 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
std::string command = Utils::String::ToLower(name);
|
||||
const auto command = Utils::String::ToLower(name);
|
||||
|
||||
if (Command::FunctionMapSV.find(command) == Command::FunctionMapSV.end())
|
||||
{
|
||||
@ -80,7 +95,7 @@ namespace Components
|
||||
Command::AddRaw(name, Game::Cbuf_AddServerText);
|
||||
}
|
||||
|
||||
Command::FunctionMapSV[command] = callback;
|
||||
FunctionMapSV[command] = std::move(callback);
|
||||
}
|
||||
|
||||
void Command::AddRaw(const char* name, void(*callback)(), bool key)
|
||||
@ -134,25 +149,27 @@ namespace Components
|
||||
|
||||
void Command::MainCallback()
|
||||
{
|
||||
Command::ClientParams params(*Game::cmd_id);
|
||||
Command::ClientParams params;
|
||||
|
||||
std::string command = Utils::String::ToLower(params[0]);
|
||||
const auto command = Utils::String::ToLower(params[0]);
|
||||
const auto got = Command::FunctionMap.find(command);
|
||||
|
||||
if (Command::FunctionMap.find(command) != Command::FunctionMap.end())
|
||||
if (got != Command::FunctionMap.end())
|
||||
{
|
||||
Command::FunctionMap[command](¶ms);
|
||||
got->second(¶ms);
|
||||
}
|
||||
}
|
||||
|
||||
void Command::MainCallbackSV()
|
||||
{
|
||||
Command::ServerParams params(*Game::cmd_id_sv);
|
||||
Command::ServerParams params;
|
||||
|
||||
std::string command = Utils::String::ToLower(params[0]);
|
||||
const auto command = Utils::String::ToLower(params[0]);
|
||||
const auto got = Command::FunctionMapSV.find(command);
|
||||
|
||||
if (Command::FunctionMapSV.find(command) != Command::FunctionMapSV.end())
|
||||
if (got != Command::FunctionMapSV.end())
|
||||
{
|
||||
Command::FunctionMapSV[command](¶ms);
|
||||
got->second(¶ms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,16 +179,10 @@ namespace Components
|
||||
|
||||
Command::Add("openLink", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() > 1)
|
||||
if (params->size() > 1)
|
||||
{
|
||||
Utils::OpenUrl(params->get(1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Command::~Command()
|
||||
{
|
||||
Command::FunctionMap.clear();
|
||||
Command::FunctionMapSV.clear();
|
||||
}
|
||||
}
|
||||
|
@ -9,46 +9,44 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Params() {};
|
||||
virtual ~Params() {};
|
||||
virtual const char* get(size_t index) = 0;
|
||||
virtual size_t length() = 0;
|
||||
|
||||
virtual std::string join(size_t startIndex);
|
||||
virtual const char* operator[](size_t index);
|
||||
virtual int size() = 0;
|
||||
virtual const char* get(int index) = 0;
|
||||
virtual std::string join(int index);
|
||||
|
||||
virtual const char* operator[](const int index)
|
||||
{
|
||||
return this->get(index);
|
||||
}
|
||||
};
|
||||
|
||||
class ClientParams : public Params
|
||||
{
|
||||
public:
|
||||
ClientParams(unsigned int id) : commandId(id) {};
|
||||
ClientParams(const ClientParams &obj) : commandId(obj.commandId) {};
|
||||
ClientParams() : ClientParams(*Game::cmd_id) {};
|
||||
ClientParams();
|
||||
|
||||
const char* get(size_t index) override;
|
||||
size_t length() override;
|
||||
int size() override;
|
||||
const char* get(int index) override;
|
||||
|
||||
private:
|
||||
unsigned int commandId;
|
||||
int nesting_;
|
||||
};
|
||||
|
||||
class ServerParams : public Params
|
||||
{
|
||||
public:
|
||||
ServerParams(unsigned int id) : commandId(id) {};
|
||||
ServerParams(const ServerParams &obj) : commandId(obj.commandId) {};
|
||||
ServerParams() : ServerParams(*Game::cmd_id_sv) {};
|
||||
ServerParams();
|
||||
|
||||
const char* get(size_t index) override;
|
||||
size_t length() override;
|
||||
int size() override;
|
||||
const char* get(int index) override;
|
||||
|
||||
private:
|
||||
unsigned int commandId;
|
||||
int nesting_;
|
||||
};
|
||||
|
||||
typedef void(Callback)(Command::Params* params);
|
||||
|
||||
Command();
|
||||
~Command();
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -504,7 +504,8 @@ namespace Components
|
||||
Console::ConsoleThread = std::thread(Console::ConsoleRunner);
|
||||
}
|
||||
|
||||
Game::dvar_t* Console::RegisterConColor(const char* name, float r, float g, float b, float a, float min, float max, int flags, const char* description)
|
||||
Game::dvar_t* Console::RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min,
|
||||
float max, unsigned __int16 flags, const char* description)
|
||||
{
|
||||
static struct
|
||||
{
|
||||
@ -521,7 +522,7 @@ namespace Components
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(patchedColors); ++i)
|
||||
{
|
||||
if (std::string(name) == patchedColors[i].name)
|
||||
if (std::strcmp(dvarName, patchedColors[i].name) == 0)
|
||||
{
|
||||
r = patchedColors[i].color[0];
|
||||
g = patchedColors[i].color[1];
|
||||
@ -531,7 +532,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
return reinterpret_cast<Game::Dvar_RegisterVec4_t>(0x471500)(name, r, g, b, a, min, max, flags, description);
|
||||
return reinterpret_cast<Game::Dvar_RegisterVec4_t>(0x471500)(dvarName, r, g, b, a, min, max, flags, description);
|
||||
}
|
||||
|
||||
Console::Console()
|
||||
|
@ -66,6 +66,6 @@ namespace Components
|
||||
static void ToggleConsole();
|
||||
static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType);
|
||||
|
||||
static Game::dvar_t* RegisterConColor(const char* name, float r, float g, float b, float a, float min, float max, int flags, const char* description);
|
||||
static Game::dvar_t* RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min, float max, unsigned __int16 flags, const char* description);
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -748,7 +748,7 @@ namespace Components
|
||||
{
|
||||
if (Dedicated::IsEnabled()) return;
|
||||
|
||||
Dvar::Register<bool>("r_useD3D9Ex", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Use extended d3d9 interface!");
|
||||
Dvar::Register<bool>("r_useD3D9Ex", false, Game::dvar_flag::DVAR_ARCHIVE, "Use extended d3d9 interface!");
|
||||
|
||||
// Hook Interface creation
|
||||
Utils::Hook::Set(0x6D74D0, D3D9Ex::Direct3DCreate9Stub);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -124,7 +124,7 @@ namespace Components
|
||||
{
|
||||
auto rotation = Dvar::Var("sv_mapRotation").get<std::string>();
|
||||
|
||||
const auto tokens = Utils::String::Explode(rotation, ' ');
|
||||
const auto tokens = Utils::String::Split(rotation, ' ');
|
||||
std::vector<std::pair<std::string, std::string>> mapRotationPair;
|
||||
|
||||
for (auto i = 0u; i < (tokens.size() - 1); i += 2)
|
||||
@ -207,7 +207,7 @@ namespace Components
|
||||
|
||||
auto rotation = Dvar::Var("sv_mapRotationCurrent").get<std::string>();
|
||||
|
||||
auto tokens = Utils::String::Explode(rotation, ' ');
|
||||
auto tokens = Utils::String::Split(rotation, ' ');
|
||||
|
||||
for (unsigned int i = 0; i < (tokens.size() - 1); i += 2)
|
||||
{
|
||||
@ -275,22 +275,22 @@ namespace Components
|
||||
|
||||
Game::dvar_t* Dedicated::Dvar_RegisterSVNetworkFps(const char* dvarName, int, int min, int, int, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::dvar_flag::DVAR_FLAG_NONE, description);
|
||||
return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::dvar_flag::DVAR_NONE, description);
|
||||
}
|
||||
|
||||
Dedicated::Dedicated()
|
||||
{
|
||||
// Map rotation
|
||||
Utils::Hook::Set(0x4152E8, Dedicated::MapRotate);
|
||||
Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_FLAG_CHEAT, "");
|
||||
Dvar::Register<bool>("com_logFilter", true, Game::dvar_flag::DVAR_FLAG_LATCHED, "Removes ~95% of unneeded lines from the log");
|
||||
Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_CHEAT, "");
|
||||
Dvar::Register<bool>("com_logFilter", true, Game::dvar_flag::DVAR_LATCH, "Removes ~95% of unneeded lines from the log");
|
||||
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
|
||||
{
|
||||
// Make sure all callbacks are handled
|
||||
Scheduler::OnFrame(Steam::SteamAPI_RunCallbacks);
|
||||
|
||||
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_FLAG_NONE, "Don't act as node");
|
||||
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_NONE, "Don't act as node");
|
||||
|
||||
Utils::Hook(0x60BE98, Dedicated::InitDedicatedServer, HOOK_CALL).install()->quick();
|
||||
|
||||
@ -391,14 +391,14 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dedicated::SVRandomMapRotation = Dvar::Register<bool>("sv_randomMapRotation", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Randomize map rotation when true");
|
||||
Dvar::Register<const char*>("sv_sayName", "^7Console", Game::dvar_flag::DVAR_FLAG_NONE, "The name to pose as for 'say' commands");
|
||||
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_FLAG_NONE, "A custom message of the day for servers");
|
||||
Dedicated::SVRandomMapRotation = Dvar::Register<bool>("sv_randomMapRotation", false, Game::dvar_flag::DVAR_ARCHIVE, "Randomize map rotation when true");
|
||||
Dvar::Register<const char*>("sv_sayName", "^7Console", Game::dvar_flag::DVAR_NONE, "The name to pose as for 'say' commands");
|
||||
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_NONE, "A custom message of the day for servers");
|
||||
|
||||
// Say command
|
||||
Command::AddSV("say", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string message = params->join(1);
|
||||
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
||||
@ -418,7 +418,7 @@ namespace Components
|
||||
// Tell command
|
||||
Command::AddSV("tell", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 3) return;
|
||||
if (params->size() < 3) return;
|
||||
|
||||
int client = atoi(params->get(1));
|
||||
std::string message = params->join(2);
|
||||
@ -439,7 +439,7 @@ namespace Components
|
||||
// Sayraw command
|
||||
Command::AddSV("sayraw", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string message = params->join(1);
|
||||
Game::SV_GameSendServerCommand(-1, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||
@ -449,33 +449,13 @@ namespace Components
|
||||
// Tellraw command
|
||||
Command::AddSV("tellraw", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 3) return;
|
||||
if (params->size() < 3) return;
|
||||
|
||||
int client = atoi(params->get(1));
|
||||
std::string message = params->join(2);
|
||||
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||
Game::Com_Printf(15, "Raw -> %i: %s\n", client, message.data());
|
||||
});
|
||||
|
||||
// ! command
|
||||
Command::AddSV("!", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() != 2) return;
|
||||
|
||||
int client = -1;
|
||||
if (params->get(1) != "all"s)
|
||||
{
|
||||
client = atoi(params->get(1));
|
||||
|
||||
if (client >= *reinterpret_cast<int*>(0x31D938C))
|
||||
{
|
||||
Game::Com_Printf(0, "Invalid player.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"\"", 106));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -519,9 +499,4 @@ namespace Components
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dedicated::~Dedicated()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Dedicated();
|
||||
~Dedicated();
|
||||
|
||||
static SteamID PlayerGuids[18][2];
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -14,8 +14,8 @@ namespace Components
|
||||
|
||||
Discovery::Discovery()
|
||||
{
|
||||
Dvar::Register<int>("net_discoveryPortRangeMin", 25000, 0, 65535, Game::dvar_flag::DVAR_FLAG_SAVED, "Minimum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMax", 35000, 1, 65536, Game::dvar_flag::DVAR_FLAG_SAVED, "Maximum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMin", 25000, 0, 65535, Game::dvar_flag::DVAR_ARCHIVE, "Minimum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMax", 35000, 1, 65536, Game::dvar_flag::DVAR_ARCHIVE, "Maximum scan range port for local server discovery");
|
||||
|
||||
// An additional thread prevents lags
|
||||
// Not sure if that's the best way though
|
||||
@ -95,11 +95,6 @@ namespace Components
|
||||
#endif
|
||||
}
|
||||
|
||||
Discovery::~Discovery()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Discovery::preDestroy()
|
||||
{
|
||||
Discovery::IsPerforming = false;
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Discovery();
|
||||
~Discovery();
|
||||
|
||||
void preDestroy() override;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -902,9 +902,9 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("ui_dl_timeLeft", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_progress", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_transRate", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_timeLeft", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_progress", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_transRate", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
});
|
||||
|
||||
UIScript::Add("mod_download_cancel", [](UIScript::Token)
|
||||
@ -915,13 +915,13 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<bool>("sv_wwwDownload", false, Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to true to enable downloading maps/mods from an external server.");
|
||||
Dvar::Register<const char*>("sv_wwwBaseUrl", "", Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to the base url for the external map download.");
|
||||
Dvar::Register<bool>("sv_wwwDownload", false, Game::dvar_flag::DVAR_ARCHIVE, "Set to true to enable downloading maps/mods from an external server.");
|
||||
Dvar::Register<const char*>("sv_wwwBaseUrl", "", Game::dvar_flag::DVAR_ARCHIVE, "Set to the base url for the external map download.");
|
||||
|
||||
// Force users to enable this because we don't want to accidentally turn everyone's pc into a http server into all their files again
|
||||
// not saying we are but ya know... accidents happen
|
||||
// by having it saved we force the user to enable it in config_mp because it only checks the dvar on startup to see if we should init download or not
|
||||
Dvar::Register<bool>("mod_force_download_server", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Set to true to force the client to run the download server for mods (for mods in private matches).");
|
||||
// Force users to enable this because we don't want to accidentally turn everyone's pc into a http server into all their files again
|
||||
// not saying we are but ya know... accidents happen
|
||||
// by having it saved we force the user to enable it in config_mp because it only checks the dvar on startup to see if we should init download or not
|
||||
Dvar::Register<bool>("mod_force_download_server", false, Game::dvar_flag::DVAR_ARCHIVE, "Set to true to force the client to run the download server for mods (for mods in private matches).");
|
||||
});
|
||||
|
||||
Scheduler::OnFrame([]()
|
||||
@ -966,7 +966,8 @@ namespace Components
|
||||
|
||||
Script::AddFunction("HttpGet", []()
|
||||
{
|
||||
if (!Dedicated::IsEnabled() && !Flags::HasFlag("scriptablehttp")) return;
|
||||
if (!Flags::HasFlag("scriptablehttp"))
|
||||
return;
|
||||
|
||||
const auto* url = Game::Scr_GetString(0);
|
||||
|
||||
@ -986,7 +987,8 @@ namespace Components
|
||||
|
||||
Script::AddFunction("HttpCancel", []()
|
||||
{
|
||||
if (!Dedicated::IsEnabled() && !Flags::HasFlag("scriptablehttp")) return;
|
||||
if (!Flags::HasFlag("scriptablehttp"))
|
||||
return;
|
||||
|
||||
const auto object = Game::Scr_GetObject(0);
|
||||
for (const auto& download : Download::ScriptDownloads)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include "Game/Functions.hpp"
|
||||
#include <Game/Functions.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -9,11 +9,11 @@ namespace Components
|
||||
{
|
||||
this->dvar = Game::Dvar_FindVar(dvarName.data());
|
||||
|
||||
if (!this->dvar)
|
||||
// If the dvar can't be found it will be registered as an empty string dvar
|
||||
if (this->dvar == nullptr)
|
||||
{
|
||||
// Quick-register the dvar
|
||||
Game::Dvar_SetStringByName(dvarName.data(), "");
|
||||
this->dvar = Game::Dvar_FindVar(dvarName.data());
|
||||
this->dvar = const_cast<Game::dvar_t*>(Game::Dvar_SetFromStringByNameFromSource(dvarName.data(), "",
|
||||
Game::DvarSetSource::DVAR_SOURCE_INTERNAL));
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,10 @@ namespace Components
|
||||
|
||||
template <> int Dvar::Var::get()
|
||||
{
|
||||
if (this->dvar && this->dvar->type == Game::dvar_type::DVAR_TYPE_INT || this->dvar->type == Game::dvar_type::DVAR_TYPE_ENUM)
|
||||
if (this->dvar == nullptr)
|
||||
return 0;
|
||||
|
||||
if (this->dvar->type == Game::dvar_type::DVAR_TYPE_INT || this->dvar->type == Game::dvar_type::DVAR_TYPE_ENUM)
|
||||
{
|
||||
return this->dvar->current.integer;
|
||||
}
|
||||
@ -49,34 +52,52 @@ namespace Components
|
||||
|
||||
template <> unsigned int Dvar::Var::get()
|
||||
{
|
||||
return static_cast<unsigned int>(this->get<int>());
|
||||
if (this->dvar == nullptr)
|
||||
return 0u;
|
||||
|
||||
if (this->dvar->type == Game::dvar_type::DVAR_TYPE_INT)
|
||||
{
|
||||
return this->dvar->current.unsignedInt;
|
||||
}
|
||||
|
||||
return 0u;
|
||||
}
|
||||
|
||||
template <> float Dvar::Var::get()
|
||||
{
|
||||
if (this->dvar && this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT)
|
||||
if (this->dvar == nullptr)
|
||||
return 0.f;
|
||||
|
||||
if (this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT)
|
||||
{
|
||||
return this->dvar->current.value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
template <> float* Dvar::Var::get()
|
||||
{
|
||||
static float val[4] = { 0 };
|
||||
static Game::vec4_t vector{ 0.f, 0.f, 0.f, 0.f };
|
||||
|
||||
if (this->dvar && (this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_2 || this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_3 || this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_4))
|
||||
if (this->dvar == nullptr)
|
||||
return vector;
|
||||
|
||||
if (this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_2 || this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_3
|
||||
|| this->dvar->type == Game::dvar_type::DVAR_TYPE_FLOAT_4)
|
||||
{
|
||||
return this->dvar->current.vector;
|
||||
}
|
||||
|
||||
return val;
|
||||
return vector;
|
||||
}
|
||||
|
||||
template <> bool Dvar::Var::get()
|
||||
{
|
||||
if (this->dvar && this->dvar->type == Game::dvar_type::DVAR_TYPE_BOOL)
|
||||
if (this->dvar == nullptr)
|
||||
return false;
|
||||
|
||||
if (this->dvar->type == Game::dvar_type::DVAR_TYPE_BOOL)
|
||||
{
|
||||
return this->dvar->current.enabled;
|
||||
}
|
||||
@ -89,11 +110,6 @@ namespace Components
|
||||
return this->get<const char*>();
|
||||
}
|
||||
|
||||
void Dvar::Var::set(char* string)
|
||||
{
|
||||
this->set(const_cast<const char*>(string));
|
||||
}
|
||||
|
||||
void Dvar::Var::set(const char* string)
|
||||
{
|
||||
assert(this->dvar->type == Game::DVAR_TYPE_STRING);
|
||||
@ -165,24 +181,24 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, bool value, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, bool value, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterBool(name, value, flag.val, description);
|
||||
return Game::Dvar_RegisterBool(dvarName, value, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, const char* value, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, const char* value, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterString(name, value, flag.val, description);
|
||||
return Game::Dvar_RegisterString(dvarName, value, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, int value, int min, int max, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, int value, int min, int max, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterInt(name, value, min, max, flag.val, description);
|
||||
return Game::Dvar_RegisterInt(dvarName, value, min, max, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, float value, float min, float max, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, float value, float min, float max, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterFloat(name, value, min, max, flag.val, description);
|
||||
return Game::Dvar_RegisterFloat(dvarName, value, min, max, flag.val, description);
|
||||
}
|
||||
|
||||
void Dvar::OnInit(Utils::Slot<Scheduler::Callback> callback)
|
||||
@ -239,10 +255,10 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
|
||||
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_ARCHIVE).val, description).get<Game::dvar_t*>();
|
||||
}
|
||||
|
||||
Game::dvar_t* Dvar::SetFromStringByNameSafeExternal(const char* dvar, const char* value)
|
||||
void Dvar::SetFromStringByNameSafeExternal(const char* dvarName, const char* string)
|
||||
{
|
||||
static const char* exceptions[] =
|
||||
{
|
||||
@ -258,18 +274,19 @@ namespace Components
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(exceptions); ++i)
|
||||
{
|
||||
if (Utils::String::ToLower(dvar) == Utils::String::ToLower(exceptions[i]))
|
||||
if (Utils::String::ToLower(dvarName) == Utils::String::ToLower(exceptions[i]))
|
||||
{
|
||||
return Game::Dvar_SetFromStringByName(dvar, value);
|
||||
Game::Dvar_SetFromStringByNameFromSource(dvarName, string, Game::DvarSetSource::DVAR_SOURCE_INTERNAL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return Dvar::SetFromStringByNameExternal(dvar, value);
|
||||
Dvar::SetFromStringByNameExternal(dvarName, string);
|
||||
}
|
||||
|
||||
Game::dvar_t* Dvar::SetFromStringByNameExternal(const char* dvar, const char* value)
|
||||
void Dvar::SetFromStringByNameExternal(const char* dvarName, const char* string)
|
||||
{
|
||||
return Game::Dvar_SetFromStringByNameFromSource(dvar, value, Game::DvarSetSource::DVAR_SOURCE_EXTERNAL);
|
||||
Game::Dvar_SetFromStringByNameFromSource(dvarName, string, Game::DvarSetSource::DVAR_SOURCE_EXTERNAL);
|
||||
}
|
||||
|
||||
void Dvar::SaveArchiveDvar(const Game::dvar_t* var)
|
||||
@ -288,7 +305,7 @@ namespace Components
|
||||
{
|
||||
// Save the dvar original value if it has the archive flag
|
||||
const auto* dvar = Game::Dvar_FindVar(dvarName);
|
||||
if (dvar != nullptr && dvar->flags & Game::dvar_flag::DVAR_FLAG_SAVED)
|
||||
if (dvar != nullptr && dvar->flags & Game::dvar_flag::DVAR_ARCHIVE)
|
||||
{
|
||||
Dvar::SaveArchiveDvar(dvar);
|
||||
}
|
||||
@ -299,49 +316,49 @@ namespace Components
|
||||
Dvar::Dvar()
|
||||
{
|
||||
// set flags of cg_drawFPS to archive
|
||||
Utils::Hook::Or<BYTE>(0x4F8F69, Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Or<BYTE>(0x4F8F69, Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat camera_thirdPersonCrosshairOffset and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x447B41, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x447B41, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_fov and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E35, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E35, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_fovscale and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E68, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E68, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_debugInfoCornerOffset and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8FC2, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8FC2, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// remove archive flags for cg_hudchatposition
|
||||
Utils::Hook::Xor<BYTE>(0x4F9992, Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F9992, Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// remove write protection from fs_game
|
||||
Utils::Hook::Xor<DWORD>(0x6431EA, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED);
|
||||
Utils::Hook::Xor<DWORD>(0x6431EA, Game::dvar_flag::DVAR_WRITEPROTECTED);
|
||||
|
||||
// set cg_fov max to 90.0
|
||||
// ...120 because of V2
|
||||
static float cgFov90 = 120.0f;
|
||||
Utils::Hook::Set<float*>(0x4F8E28, &cgFov90);
|
||||
// set cg_fov max to 160.0
|
||||
// because that's the max on SP
|
||||
static float cg_Fov = 160.0f;
|
||||
Utils::Hook::Set<float*>(0x4F8E28, &cg_Fov);
|
||||
|
||||
// set max volume to 1
|
||||
static float volume = 1.0f;
|
||||
Utils::Hook::Set<float*>(0x408078, &volume);
|
||||
|
||||
// Uncheat ui_showList
|
||||
Utils::Hook::Xor<BYTE>(0x6310DC, Game::dvar_flag::DVAR_FLAG_CHEAT);
|
||||
Utils::Hook::Xor<BYTE>(0x6310DC, Game::dvar_flag::DVAR_CHEAT);
|
||||
|
||||
// Uncheat ui_debugMode
|
||||
Utils::Hook::Xor<BYTE>(0x6312DE, Game::dvar_flag::DVAR_FLAG_CHEAT);
|
||||
Utils::Hook::Xor<BYTE>(0x6312DE, Game::dvar_flag::DVAR_CHEAT);
|
||||
|
||||
// Hook dvar 'name' registration
|
||||
Utils::Hook(0x40531C, Dvar::RegisterName, HOOK_CALL).install()->quick();
|
||||
|
||||
// un-cheat safeArea_* and add archive flags
|
||||
Utils::Hook::Xor<INT>(0x42E3F5, Game::dvar_flag::DVAR_FLAG_READONLY | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_adjusted_horizontal
|
||||
Utils::Hook::Xor<INT>(0x42E423, Game::dvar_flag::DVAR_FLAG_READONLY | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_adjusted_vertical
|
||||
Utils::Hook::Xor<BYTE>(0x42E398, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_horizontal
|
||||
Utils::Hook::Xor<BYTE>(0x42E3C4, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_vertical
|
||||
Utils::Hook::Xor<INT>(0x42E3F5, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_horizontal
|
||||
Utils::Hook::Xor<INT>(0x42E423, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_vertical
|
||||
Utils::Hook::Xor<BYTE>(0x42E398, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_horizontal
|
||||
Utils::Hook::Xor<BYTE>(0x42E3C4, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_vertical
|
||||
|
||||
// Don't allow setting cheat protected dvars via menus
|
||||
Utils::Hook(0x63C897, Dvar::SetFromStringByNameExternal, HOOK_CALL).install()->quick();
|
||||
@ -349,7 +366,7 @@ namespace Components
|
||||
Utils::Hook(0x63CDB5, Dvar::SetFromStringByNameExternal, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x635E47, Dvar::SetFromStringByNameExternal, HOOK_CALL).install()->quick();
|
||||
|
||||
// SetDvar
|
||||
// Script_SetDvar
|
||||
Utils::Hook(0x63444C, Dvar::SetFromStringByNameSafeExternal, HOOK_CALL).install()->quick();
|
||||
|
||||
// Slider
|
||||
@ -368,7 +385,6 @@ namespace Components
|
||||
Utils::Hook(0x59386A, Dvar::DvarSetFromStringByNameStub, HOOK_CALL).install()->quick();
|
||||
|
||||
// If the game closed abruptly, the dvars would not have been restored
|
||||
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
Dvar::ResetDvarsValue();
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Flag(Game::dvar_flag flag) : val(flag) {};
|
||||
Flag(int flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
Flag(unsigned __int16 flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
|
||||
Game::dvar_flag val;
|
||||
};
|
||||
@ -18,14 +18,13 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Var() : dvar(nullptr) {};
|
||||
Var(const Var &obj) { this->dvar = obj.dvar; };
|
||||
Var(const Var& obj) { this->dvar = obj.dvar; };
|
||||
Var(Game::dvar_t* _dvar) : dvar(_dvar) {};
|
||||
Var(DWORD ppdvar) : Var(*reinterpret_cast<Game::dvar_t**>(ppdvar)) {};
|
||||
Var(const std::string& dvarName);
|
||||
|
||||
template<typename T> T get();
|
||||
|
||||
void set(char* string);
|
||||
void set(const char* string);
|
||||
void set(const std::string& string);
|
||||
|
||||
@ -47,8 +46,8 @@ namespace Components
|
||||
static void OnInit(Utils::Slot<Scheduler::Callback> callback);
|
||||
|
||||
// Only strings and bools use this type of declaration
|
||||
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* dvarName, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* dvarName, T value, T min, T max, Flag flag, const char* description);
|
||||
|
||||
static void ResetDvarsValue();
|
||||
|
||||
@ -58,8 +57,8 @@ namespace Components
|
||||
|
||||
static Game::dvar_t* RegisterName(const char* name, const char* defaultVal, Game::dvar_flag flag, const char* description);
|
||||
|
||||
static Game::dvar_t* SetFromStringByNameExternal(const char* dvar, const char* value);
|
||||
static Game::dvar_t* SetFromStringByNameSafeExternal(const char* dvar, const char* value);
|
||||
static void SetFromStringByNameExternal(const char* dvar, const char* value);
|
||||
static void SetFromStringByNameSafeExternal(const char* dvar, const char* value);
|
||||
|
||||
static void SaveArchiveDvar(const Game::dvar_t* var);
|
||||
static void DvarSetFromStringByNameStub(const char* dvarName, const char* value);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -108,7 +108,7 @@ namespace Components
|
||||
};
|
||||
|
||||
Elevators::BG_Elevators = Game::Dvar_RegisterEnum("bg_elevators", values,
|
||||
Elevators::ENABLED, Game::DVAR_FLAG_REPLICATED, "Elevators glitch settings");
|
||||
Elevators::ENABLED, Game::DVAR_CODINFO, "Elevators glitch settings");
|
||||
});
|
||||
|
||||
//Replace PM_CorrectAllSolid
|
||||
@ -120,8 +120,4 @@ namespace Components
|
||||
Utils::Hook(0x570E0B, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x570D70, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Elevators::~Elevators()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Elevators();
|
||||
~Elevators();
|
||||
|
||||
private:
|
||||
enum ElevatorSettings { DISABLED, ENABLED, EASY };
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -234,7 +234,7 @@ namespace Components
|
||||
Game::UI_UpdateArenas();
|
||||
|
||||
std::string command;
|
||||
for (auto i = 0; i < (params->length() >= 2 ? atoi(params->get(1)) : *Game::arenaCount); ++i)
|
||||
for (auto i = 0; i < (params->size() >= 2 ? atoi(params->get(1)) : *Game::arenaCount); ++i)
|
||||
{
|
||||
const auto* mapname = ArenaLength::NewArenas[i % *Game::arenaCount].mapName;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -495,7 +495,7 @@ namespace Components
|
||||
|
||||
FastFiles::FastFiles()
|
||||
{
|
||||
Dvar::Register<bool>("ui_zoneDebug", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Display current loaded zone.");
|
||||
Dvar::Register<bool>("ui_zoneDebug", false, Game::dvar_flag::DVAR_ARCHIVE, "Display current loaded zone.");
|
||||
|
||||
// Fix XSurface assets
|
||||
Utils::Hook(0x0048E8A5, FastFiles::Load_XSurfaceArray, HOOK_CALL).install()->quick();
|
||||
@ -594,7 +594,7 @@ namespace Components
|
||||
|
||||
Command::Add("loadzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
Game::XZoneInfo info;
|
||||
info.name = params->get(1);
|
||||
@ -622,9 +622,4 @@ namespace Components
|
||||
}, HOOK_CALL).install()/*->quick()*/;
|
||||
#endif
|
||||
}
|
||||
|
||||
FastFiles::~FastFiles()
|
||||
{
|
||||
FastFiles::ZonePaths.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
FastFiles();
|
||||
~FastFiles();
|
||||
|
||||
static void AddZonePath(const std::string& path);
|
||||
static std::string Current();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
@ -8,7 +8,7 @@ namespace Components
|
||||
{
|
||||
Flags::ParseFlags();
|
||||
|
||||
for (auto entry : Flags::EnabledFlags)
|
||||
for (const auto& entry : Flags::EnabledFlags)
|
||||
{
|
||||
if (Utils::String::ToLower(entry) == Utils::String::ToLower(flag))
|
||||
{
|
||||
@ -21,21 +21,26 @@ namespace Components
|
||||
|
||||
void Flags::ParseFlags()
|
||||
{
|
||||
static bool flagsParsed = false;
|
||||
if (flagsParsed) return;
|
||||
flagsParsed = true;
|
||||
static auto flagsParsed = false;
|
||||
if (flagsParsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only parse flags once
|
||||
flagsParsed = true;
|
||||
int numArgs;
|
||||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &numArgs);
|
||||
auto* const argv = CommandLineToArgvW(GetCommandLineW(), &numArgs);
|
||||
|
||||
if (argv)
|
||||
{
|
||||
for (int i = 0; i < numArgs; ++i)
|
||||
for (auto i = 0; i < numArgs; ++i)
|
||||
{
|
||||
std::wstring wFlag(argv[i]);
|
||||
if (wFlag[0] == L'-')
|
||||
{
|
||||
Flags::EnabledFlags.push_back(std::string(++wFlag.begin(), wFlag.end()));
|
||||
wFlag.erase(wFlag.begin());
|
||||
Flags::EnabledFlags.emplace_back(Utils::String::Convert(wFlag));
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,17 +50,7 @@ namespace Components
|
||||
// Workaround for wine
|
||||
if (Utils::IsWineEnvironment() && Dedicated::IsEnabled() && !Flags::HasFlag("console") && !Flags::HasFlag("stdout"))
|
||||
{
|
||||
Flags::EnabledFlags.push_back("stdout");
|
||||
Flags::EnabledFlags.emplace_back("stdout");
|
||||
}
|
||||
}
|
||||
|
||||
Flags::Flags()
|
||||
{
|
||||
Flags::ParseFlags();
|
||||
}
|
||||
|
||||
Flags::~Flags()
|
||||
{
|
||||
Flags::EnabledFlags.clear();
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,7 @@ namespace Components
|
||||
class Flags : public Component
|
||||
{
|
||||
public:
|
||||
Flags();
|
||||
~Flags();
|
||||
Flags() = default;
|
||||
|
||||
static bool HasFlag(const std::string& flag);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "STDInclude.hpp"
|
||||
#include <STDInclude.hpp>
|
||||
|
||||
namespace Components
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user