Skip to content

Commit fb65b04

Browse files
committed
Merge remote-tracking branch 'ddnet/master' into twbl
2 parents ed40cc6 + f6fcc6c commit fb65b04

File tree

742 files changed

+70704
-31538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+70704
-31538
lines changed

.clang-tidy

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ Checks: >
2020
bugprone-*,
2121
-bugprone-assignment-in-if-condition,
2222
-bugprone-branch-clone,
23+
-bugprone-casting-through-void,
2324
-bugprone-easily-swappable-parameters,
2425
-bugprone-implicit-widening-of-multiplication-result,
2526
-bugprone-incorrect-roundings,
2627
-bugprone-integer-division,
2728
-bugprone-macro-parentheses,
29+
-bugprone-multi-level-implicit-pointer-conversion,
2830
-bugprone-narrowing-conversions,
2931
-bugprone-parent-virtual-call,
3032
-bugprone-reserved-identifier,
3133
-bugprone-suspicious-include,
32-
-bugprone-unhandled-self-assignment,
3334
-bugprone-suspicious-realloc-usage,
35+
-bugprone-switch-missing-default-case,
36+
-bugprone-unchecked-optional-access,
37+
-bugprone-unhandled-self-assignment,
3438
clang-analyzer-*,
3539
-clang-analyzer-optin.cplusplus.UninitializedObject,
3640
-clang-analyzer-optin.cplusplus.VirtualCall,
@@ -45,6 +49,7 @@ Checks: >
4549
cppcoreguidelines-virtual-class-destructor,
4650
misc-*,
4751
-misc-const-correctness,
52+
-misc-include-cleaner,
4853
-misc-no-recursion,
4954
-misc-non-private-member-variables-in-classes,
5055
-misc-static-assert,
@@ -55,8 +60,8 @@ Checks: >
5560
modernize-deprecated-headers,
5661
modernize-deprecated-ios-base-aliases,
5762
modernize-loop-convert,
58-
modernize-make-unique,
5963
modernize-make-shared,
64+
modernize-make-unique,
6065
modernize-redundant-void-arg,
6166
modernize-replace-auto-ptr,
6267
modernize-replace-disallow-copy-and-assign-macro,
@@ -71,6 +76,7 @@ Checks: >
7176
modernize-use-transparent-functors,
7277
modernize-use-uncaught-exceptions,
7378
readability-*,
79+
-readability-avoid-nested-conditional-operator,
7480
-readability-braces-around-statements,
7581
-readability-convert-member-functions-to-static,
7682
-readability-else-after-return,
@@ -80,12 +86,15 @@ Checks: >
8086
-readability-implicit-bool-conversion,
8187
-readability-isolate-declaration,
8288
-readability-magic-numbers,
89+
-readability-math-missing-parentheses,
8390
-readability-named-parameter,
8491
-readability-non-const-parameter,
8592
-readability-simplify-boolean-expr,
8693
-readability-suspicious-call-argument,
8794
-readability-uppercase-literal-suffix,
95+
-readability-use-std-min-max,
8896
performance-*,
97+
-performance-enum-size,
8998
-performance-no-int-to-ptr,
9099
portability-*,
91100
@@ -102,9 +111,15 @@ CheckOptions:
102111
- key: readability-identifier-naming.LocalConstantCase
103112
value: CamelCase
104113
- key: readability-identifier-naming.ClassMemberCase
114+
value: UPPER_CASE
115+
- key: readability-identifier-naming.MemberCase
105116
value: CamelCase
106-
- key: readability-identifier-naming.ClassMemberPrefix
117+
- key: readability-identifier-naming.MemberPrefix
107118
value: m_
119+
- key: readability-identifier-naming.MemberIgnoredRegexp
120+
value: '^(m_ap|m_v|m_p|m_a|ms_p|[a-z]$).*'
121+
- key: readability-identifier-naming.StaticVariablePrefix
122+
value: s_
108123
- key: readability-identifier-naming.ClassMethodCase
109124
value: CamelCase
110125
- key: readability-identifier-naming.ClassCase
@@ -114,19 +129,19 @@ CheckOptions:
114129
- key: readability-identifier-naming.StructPrefix
115130
value: S
116131
- key: readability-identifier-naming.StructIgnoredRegexp
117-
value: '^([CS]|MapObject$|EnvelopedQuad$).*'
132+
value: '^C.*'
118133
- key: readability-identifier-naming.ClassIgnoredRegexp
119134
value: '^(I|CCommandProcessorFragment_Vulkan$).*'
120135
- key: readability-identifier-naming.ParameterCase
121136
value: CamelCase
122137
- key: readability-identifier-naming.ParameterIgnoredRegexp
123-
value: '^(p|a|v|[a-z]$|s[hw]$|warning_msg$|error_msg$|string$|integer$|boolean$|object$|index$|rhs$|lhs$|[xy]off$|id$|mode$|rgb$|[xy][0123]$|width$|height$|[sdw][xy]$|ownId$|fnMatchCallback$).*'
138+
value: '^(p|a|v|[a-z]$|[xy][0123]$).*'
124139
- key: readability-identifier-naming.ClassMethodIgnoredRegexp
125140
value: '^(Con_).*'
126141
- key: readability-identifier-naming.ClassMemberIgnoredRegexp
127-
value: '^(ms_aStandardScreen$|s_1024x1024ImgSize$|s_ImageBufferCacheId$|s_VertexBufferCacheId$|s_StagingBufferImageCacheId$|REPLACEMENT_CHARACTER$|(MAX|MIN)_FONT_SIZE$|MAXIMUM_ATLAS_DIMENSION$|INITIAL_ATLAS_DIMENSION$|MAX_SECTION_DIMENSION_MAPPED$|MIN_SECTION_DIMENSION$|s_StagingBufferCacheId$|ms_MainThreadIndex$).*'
142+
value: '^(m_a|m_v|m_p|ms_p|ms_a|ms_v|s_1024x1024ImgSize$|s_ImageBufferCacheId$|s_VertexBufferCacheId$|s_StagingBufferImageCacheId$|REPLACEMENT_CHARACTER$|(MAX|MIN)_FONT_SIZE$|MAXIMUM_ATLAS_DIMENSION$|INITIAL_ATLAS_DIMENSION$|MAX_SECTION_DIMENSION_MAPPED$|MIN_SECTION_DIMENSION$|s_StagingBufferCacheId$).*'
128143
- key: readability-identifier-naming.LocalConstantIgnoredRegexp
129144
value: '^(p|a|v|s_|MAX_ANIM_SPEED$|DATA_OFFSET$|HEADER_LEN$|MIN_ANIM_SPEED$|[hwdcbqstf]$|[xt][0123]$|result$|sub$|it$|len$|d[xy]$).*'
130145
- key: readability-identifier-naming.LocalVariableIgnoredRegexp
131-
value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|Tickdelta_legacy$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|GfxFsaaSamples_MouseButton$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|cData$|sub$|ret$|rendered$|(lower|upper)(16|26|24|32)|size$|wSearch$|bAlreadyHit$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_skin$|best_matches$|m_aClient$|matches$|nohook$|through_cut$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|m_TileF?Index$|mode$|maxModes$|numModes$|iLogLength$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*'
146+
value: '^(p|a|s_|FT_|TB_|s_|ul_|v|[xy]i$|[zijklxyhmrgbacwestnduvqf]$|[dmpwsitcf][xy]$|(ch|skel)[0-2]?$|it$|tw$|dt$|th$|ls$|func$|res$|shader$|len$|maxLength$|length$|offset$|offpos$|result$|bg$|sp$|url$|index$|ctxt$|key$|null$|logger$|LAST_MODIFIED$|teleNr$|target$|id$|hit$|hsl[0-2]?$|rgb[0-2]?$|dir$|tmp$|sub$|ret$|rendered$|size$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_matches$|matches$|nohook$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*'
132147

.clangd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Style:
2+
AngledHeaders: ["base/.*", "engine/.*", "game/.*"]

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/game/editor/mapitems/map_io.cpp @Patiga

.github/workflows/build.yml

Lines changed: 91 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
os: [ubuntu-latest, macOS-latest, windows-latest, ubuntu-20.04]
18+
os: [ubuntu-latest, macOS-latest, windows-latest, ubuntu-22.04]
1919
include:
2020
- os: ubuntu-latest
2121
cmake-args: -G Ninja
2222
cmake-init-env: CXXFLAGS=-Werror
2323
package-file: "*-linux_x86_64.tar.xz"
2424
fancy: true
25-
- os: ubuntu-20.04
25+
- os: ubuntu-22.04
2626
cmake-path: /usr/bin/
2727
cmake-args: -G Ninja -DTEST_MYSQL=ON
2828
cmake-init-env: CXXFLAGS=-Werror
@@ -35,7 +35,7 @@ jobs:
3535
package-file: "*-macos.dmg"
3636
fancy: false
3737
- os: windows-latest
38-
cmake-args: -A x64
38+
cmake-args: -A x64 -DEXCEPTION_HANDLING=ON
3939
cmake-init-env: CXXFLAGS=/WX LDFLAGS=/WX
4040
package-file: "*-win64.zip"
4141
fancy: false
@@ -51,11 +51,13 @@ jobs:
5151
sudo apt-get update -y
5252
# mount: /var/lib/grub/esp: special device /dev/disk/by-id/scsi-... does not exist.
5353
# sudo apt-get upgrade -y
54-
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr -y
54+
sudo apt-get install pkg-config ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libvulkan-dev glslang-tools spirv-tools libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libpng-dev valgrind gcovr libglew-dev -y
5555
5656
- name: Prepare Linux (non-fancy)
5757
if: ${{ contains(matrix.os, 'ubuntu') && !matrix.fancy }}
5858
run: |
59+
curl -LO https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.tar.gz
60+
sudo tar --strip-components 1 -C /usr -xf cmake-3.13.4-Linux-x86_64.tar.gz
5961
# Our minimum supported Rust version (MSRV)
6062
rustup default 1.63.0
6163
sudo rm -rf /var/lib/mysql/ /var/run/mysqld
@@ -74,7 +76,7 @@ jobs:
7476
- name: Prepare Linux (fancy)
7577
if: contains(matrix.os, 'ubuntu') && matrix.fancy
7678
run: |
77-
sudo apt-get install libmariadb-dev libwebsockets-dev mariadb-server -y
79+
sudo apt-get install cmake libmariadb-dev libwebsockets-dev mariadb-server -y
7880
sudo systemctl stop mysql
7981
sudo rm -rf /var/lib/mysql/
8082
sudo mysql_install_db --user=mysql --datadir=/var/lib/mysql/
@@ -91,7 +93,7 @@ jobs:
9193
if: contains(matrix.os, 'macOS')
9294
run: |
9395
brew update || true
94-
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools || true
96+
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools rust || true
9597
brew upgrade freetype
9698
pip3 install --break-system-packages dmgbuild
9799
echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH
@@ -100,10 +102,23 @@ jobs:
100102
- name: Cache Rust dependencies
101103
uses: Swatinem/rust-cache@v2
102104

105+
- name: Build mastersrv
106+
if: "!contains(matrix.os, 'ubuntu-22.04')"
107+
run: |
108+
cd src/mastersrv
109+
cargo build
110+
111+
- name: Build masterping
112+
if: "!contains(matrix.os, 'ubuntu-22.04')"
113+
run: |
114+
cd src/masterping
115+
cargo build
116+
103117
- name: Build in debug mode
104118
run: |
105119
mkdir debug
106120
cd debug
121+
${{ matrix.cmake-path }}cmake --version
107122
${{ matrix.cmake-path }}cmake -E env ${{ matrix.cmake-init-env }} ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
108123
${{ matrix.cmake-path }}cmake --build . --config Debug --target everything ${{ matrix.build-args }}
109124
@@ -139,7 +154,6 @@ jobs:
139154
run: |
140155
mkdir headless
141156
cd headless
142-
${{ matrix.cmake-path }}cmake --version
143157
${{ matrix.cmake-path }}cmake -E env CXXFLAGS="--coverage -Werror" ${{ matrix.cmake-path }}cmake -E env LDFLAGS="--coverage -Werror" ${{ matrix.cmake-path }}cmake ${{ matrix.cmake-args }} -DHEADLESS_CLIENT=ON -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
144158
${{ matrix.cmake-path }}cmake -E env RUSTFLAGS="-Clink-arg=--coverage" ${{ matrix.cmake-path }}cmake --build . --config Debug ${{ matrix.build-args }}
145159
@@ -155,21 +169,6 @@ jobs:
155169
with:
156170
flags: unittests
157171

158-
- name: Test headless client (start & connect)
159-
if: contains(matrix.os, 'ubuntu-latest')
160-
run: |
161-
cd headless
162-
# Remove old coverage data:
163-
find . -name '*.gcno' -o -name '*.gcda' -delete
164-
./DDNet-Server &
165-
./DDNet "cl_download_skins 0;connect localhost:8303;quit"
166-
167-
- name: Upload Codecov report (start & connect)
168-
if: contains(matrix.os, 'ubuntu-latest')
169-
uses: codecov/codecov-action@v4
170-
with:
171-
flags: startconnect
172-
173172
- name: Build in release mode with debug info and all features on
174173
if: matrix.fancy
175174
run: |
@@ -193,10 +192,10 @@ jobs:
193192
- name: Run integration tests with Valgrind's Memcheck
194193
if: contains(matrix.os, 'ubuntu-latest')
195194
run: |
196-
cd headless
197195
# Remove old coverage data:
198-
find . -name '*.gcno' -o -name '*.gcda' -delete
199-
./integration_test.sh --valgrind-memcheck
196+
find headless -name '*.gcno' -o -name '*.gcda' -delete
197+
cp src/mastersrv/target/debug/mastersrv headless
198+
python scripts/integration_test.py --test-mastersrv --valgrind-memcheck headless
200199
201200
- name: Upload Codecov report (integration tests)
202201
if: contains(matrix.os, 'ubuntu-latest')
@@ -216,3 +215,70 @@ jobs:
216215
with:
217216
name: ddnet-${{ matrix.os }}
218217
path: release/artifacts
218+
219+
build-android:
220+
runs-on: ubuntu-24.04
221+
env:
222+
CARGO_HTTP_MULTIPLEXING: false
223+
steps:
224+
- uses: actions/checkout@v4
225+
with:
226+
submodules: true
227+
228+
- name: Validate Gradle Wrapper
229+
uses: gradle/actions/wrapper-validation@v4
230+
231+
- name: Prepare Linux
232+
run: |
233+
sudo apt-get update -y
234+
sudo apt-get install cmake ninja-build openjdk-21-jdk p7zip-full curl glslang-tools openssl
235+
cargo install cargo-ndk
236+
rustup target add armv7-linux-androideabi
237+
rustup target add i686-linux-android
238+
rustup target add aarch64-linux-android
239+
rustup target add x86_64-linux-android
240+
mkdir ~/Android
241+
cd ~/Android
242+
mkdir Sdk
243+
cd Sdk
244+
mkdir ndk
245+
cd ndk
246+
wget --quiet https://dl.google.com/android/repository/android-ndk-r26d-linux.zip
247+
unzip android-ndk-r26d-linux.zip
248+
rm android-ndk-r26d-linux.zip
249+
cd ~/Android/Sdk
250+
mkdir build-tools
251+
cd build-tools
252+
wget --quiet https://dl.google.com/android/repository/build-tools_r30.0.3-linux.zip
253+
unzip build-tools_r30.0.3-linux.zip
254+
rm build-tools_r30.0.3-linux.zip
255+
mv android-11 30.0.3
256+
cd ~/Android/Sdk
257+
mkdir cmdline-tools
258+
cd cmdline-tools
259+
wget --quiet https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
260+
unzip commandlinetools-linux-11076708_latest.zip
261+
rm commandlinetools-linux-11076708_latest.zip
262+
mv cmdline-tools latest
263+
yes | latest/bin/sdkmanager --licenses
264+
265+
- name: Cache Rust dependencies
266+
uses: Swatinem/rust-cache@v2
267+
268+
- name: Build Android app
269+
env:
270+
TW_KEY_NAME: /home/runner/DDNet.jks
271+
TW_KEY_ALIAS: DDNet-Key
272+
run: |
273+
export TW_KEY_PW="$(openssl rand -base64 32)"
274+
keytool -genkey -v -keystore "$TW_KEY_NAME" -keyalg RSA -keysize 2048 -validity 10000 -alias "$TW_KEY_ALIAS" -storepass "$TW_KEY_PW" -dname "CN=DDNet CI, OU=DDNet, O=DDNet"
275+
mkdir build-android
276+
scripts/android/cmake_android.sh all DDNet org.ddnet.client Release build-android
277+
mkdir artifacts
278+
mv build-android/DDNet.apk artifacts
279+
280+
- name: Upload Artifacts
281+
uses: actions/upload-artifact@v4
282+
with:
283+
name: ddnet-android
284+
path: artifacts

.github/workflows/clang-sanitizer.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@ on:
1010

1111
jobs:
1212
check-clang-san:
13-
runs-on: ubuntu-20.04
13+
runs-on: ubuntu-latest
1414
env:
1515
CARGO_HTTP_MULTIPLEXING: false
1616
steps:
17-
- uses: actions/checkout@v4
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
1819
with:
1920
submodules: true
2021

21-
- name: Prepare linux
22+
- name: Prepare Linux
2223
run: |
2324
sudo apt-get update -y
24-
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libvulkan-dev glslang-tools spirv-tools -y
25+
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libnotify-dev libsdl2-dev libsqlite3-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libx264-dev libvulkan-dev glslang-tools spirv-tools libglew-dev -y
26+
2527
- name: Cache Rust dependencies
2628
uses: Swatinem/rust-cache@v2
29+
2730
- name: Build with ASan and UBSan
2831
run: |
2932
mkdir clang-sanitizer
@@ -34,35 +37,44 @@ jobs:
3437
export CFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer"
3538
cmake -DCMAKE_BUILD_TYPE=Debug -DHEADLESS_CLIENT=ON -Werror=dev -DDOWNLOAD_GTEST=ON -DDEV=ON -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=. ..
3639
make -j"$(nproc)"
40+
3741
- name: Run server and headless client with ASan and UBSan
3842
run: |
3943
cd clang-sanitizer
40-
export UBSAN_OPTIONS=suppressions=./ubsan.supp:log_path=./SAN:print_stacktrace=1:halt_on_errors=0
41-
export ASAN_OPTIONS=log_path=./SAN:print_stacktrace=1:check_initialization_order=1:detect_leaks=1:halt_on_errors=0
42-
export LSAN_OPTIONS=suppressions=./lsan.supp
44+
export UBSAN_OPTIONS=suppressions=../ubsan.supp:log_path=SAN:print_stacktrace=1:halt_on_errors=0
45+
export ASAN_OPTIONS=log_path=SAN:print_stacktrace=1:check_initialization_order=1:detect_leaks=1:halt_on_errors=0
46+
export LSAN_OPTIONS=suppressions=../lsan.supp
4347
./DDNet "cl_download_skins 0;quit" || true
4448
./DDNet-Server shutdown || true
4549
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
4650
then
47-
cat ./SAN.*
51+
cat SAN.*
4852
exit 1
4953
fi
54+
5055
- name: Run unit tests with ASan and UBSan
5156
run: |
5257
cd clang-sanitizer
5358
cmake --build . --config Debug --target run_cxx_tests
5459
# Rust tests work locally, but still not in CI, even with the same directory
5560
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
5661
then
57-
cat ./SAN.*
62+
cat SAN.*
5863
exit 1
5964
fi
65+
66+
- name: Build mastersrv
67+
run: |
68+
cd src/mastersrv
69+
cargo build
70+
cp target/debug/mastersrv ../../clang-sanitizer
71+
6072
- name: Run integration tests with ASan and UBSan
6173
run: |
6274
cd clang-sanitizer
63-
make run_integration_tests
75+
python ../scripts/integration_test.py --test-mastersrv .
6476
if test -n "$(find . -maxdepth 1 -name 'SAN.*' -print -quit)"
6577
then
66-
cat ./SAN.*
78+
cat SAN.*
6779
exit 1
6880
fi

0 commit comments

Comments
 (0)