Skip to content

Commit

Permalink
Merge branch 'upstream_master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sjrc6 committed Jul 24, 2024
2 parents 6c46d4a + c7bcdc3 commit 752a91e
Show file tree
Hide file tree
Showing 170 changed files with 6,567 additions and 4,367 deletions.
24 changes: 21 additions & 3 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Checks: >
-bugprone-suspicious-include,
-bugprone-unhandled-self-assignment,
-bugprone-suspicious-realloc-usage,
-bugprone-switch-missing-default-case,
-bugprone-casting-through-void,
-bugprone-multi-level-implicit-pointer-conversion,
-bugprone-unchecked-optional-access,
clang-analyzer-*,
-clang-analyzer-optin.cplusplus.UninitializedObject,
-clang-analyzer-optin.cplusplus.VirtualCall,
Expand All @@ -50,6 +54,7 @@ Checks: >
-misc-static-assert,
-misc-unused-parameters,
-misc-use-anonymous-namespace,
-misc-include-cleaner,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
Expand Down Expand Up @@ -85,8 +90,11 @@ Checks: >
-readability-simplify-boolean-expr,
-readability-suspicious-call-argument,
-readability-uppercase-literal-suffix,
-readability-use-std-min-max,
-readability-avoid-nested-conditional-operator,
performance-*,
-performance-no-int-to-ptr,
-performance-enum-size,
portability-*,
WarningsAsErrors:
Expand All @@ -103,8 +111,18 @@ CheckOptions:
value: CamelCase
- key: readability-identifier-naming.ClassMemberCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberPrefix
- key: readability-identifier-naming.MemberCase
value: CamelCase
- key: readability-identifier-naming.MemberPrefix
value: m_
- key: readability-identifier-naming.MemberIgnoredRegexp
value: '^(m_ap|m_v|m_p|m_a|ms_p|[a-z]$).*'
- key: readability-identifier-naming.ClassMemberPrefix
value: ms_
- key: readability-identifier-naming.StaticVariablePrefix
value: s_
- key: readability-identifier-naming.StaticVariableIgnoredRegexp
value: '^(NullAddr$|aDummyNameBuf$|aModifier$|EXPLANATION$|LocalClientId$|Dir$|LOCATION_NAMES$|EditorHotkeyWasPressed$|EditorHotKeyChecktime$|FrictionFraction$|LastTime$|SkidSoundTime$|NewVal$|aRotated$).*'
- key: readability-identifier-naming.ClassMethodCase
value: CamelCase
- key: readability-identifier-naming.ClassCase
Expand All @@ -124,9 +142,9 @@ CheckOptions:
- key: readability-identifier-naming.ClassMethodIgnoredRegexp
value: '^(Con_).*'
- key: readability-identifier-naming.ClassMemberIgnoredRegexp
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$).*'
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$).*'
- key: readability-identifier-naming.LocalConstantIgnoredRegexp
value: '^(p|a|v|s_|MAX_ANIM_SPEED$|DATA_OFFSET$|HEADER_LEN$|MIN_ANIM_SPEED$|[hwdcbqstf]$|[xt][0123]$|result$|sub$|it$|len$|d[xy]$).*'
- key: readability-identifier-naming.LocalVariableIgnoredRegexp
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]$).*'
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$|(lower|upper)(16|26|24|32)|size$|isWeaponCollide$|zerochar$|dist$|sound$|match$|best_matches$|matches$|nohook$|btn$|savedLayers$|l[hw]$|evilz$|sec$|min$|to2$|delay$|mode$|maxModes$|numModes$|[xy]Fract$|[xy]Int$|imgg[xy]$|skip$|localPlayer$|fdratio$|[rgbat][0-2]$|[xy][0-3]$|x[rl]$).*'

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
if: contains(matrix.os, 'macOS')
run: |
brew update || true
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools || true
brew install pkg-config sdl2 ffmpeg ninja molten-vk vulkan-headers glslang spirv-tools rust || true
brew upgrade freetype
pip3 install --break-system-packages dmgbuild
echo /Library/Frameworks/Python.framework/Versions/3.12/bin >> $GITHUB_PATH
Expand Down
42 changes: 25 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,10 @@ if(NOT MSVC AND NOT HAIKU)
add_cxx_compiler_flag_if_supported(OUR_FLAGS -ffloat-store)
endif()

# This is needed to get the server to correctly display special characters
# on ARM systems.
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)
endif()
# We assume that char is signed in various places in the code. In particular,
# the Str.StrToInts test will fail when char is not signed and names containing
# special characters will be displayed incorrectly on servers.
add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)

# Don't insert timestamps into PEs to keep the build reproducible.
if(TARGET_OS STREQUAL "windows")
Expand Down Expand Up @@ -872,11 +871,11 @@ list(APPEND TARGETS_OWN rust-bridge-shared)

if(TARGET_OS STREQUAL "android")
set(CARGO_BUILD_DIR "${CARGO_NDK_TARGET}/")
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build)
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} ndk --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml" -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} build)
set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} ndk -t ${CARGO_NDK_TARGET} -p ${CARGO_NDK_API} test)
else()
set(CARGO_BUILD_DIR "")
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build)
set(CARGO_BUILD ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} DDNET_TEST_NO_LINK=1 ${RUST_CARGO} build --manifest-path "${PROJECT_SOURCE_DIR}/Cargo.toml")
set(CARGO_TEST ${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${PROJECT_BINARY_DIR} ${RUST_CARGO} test)
endif()
if(MSVC)
Expand Down Expand Up @@ -950,7 +949,7 @@ if(NOT CMAKE_OSX_ARCHITECTURES)
add_custom_command(
OUTPUT ${RUST_OUTPUTS}
COMMAND ${CARGO_BUILD}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
USES_TERMINAL
DEPENDS ${RUST_SRC}
)
Expand Down Expand Up @@ -983,7 +982,7 @@ else()
add_custom_command(
OUTPUT ${RUST_OUTPUTS}
COMMAND ${CARGO_BUILD} --target=${arch}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
USES_TERMINAL
DEPENDS ${RUST_SRC}
)
Expand Down Expand Up @@ -1410,6 +1409,7 @@ set(EXPECTED_DATA
editor/cursor.png
editor/cursor_resize.png
editor/entities/DDNet.png
editor/entities/F-DDrace.png
editor/entities/FNG.png
editor/entities/Race.png
editor/entities/Vanilla.png
Expand Down Expand Up @@ -1528,6 +1528,7 @@ set(EXPECTED_DATA
mapres/water.png
mapres/winter_doodads.png
mapres/winter_main.png
mapres/winter_main_0.7.png
mapres/winter_mountains.png
mapres/winter_mountains2.png
mapres/winter_mountains3.png
Expand Down Expand Up @@ -2820,6 +2821,7 @@ if(GTEST_FOUND OR DOWNLOAD_GTEST)
secure_random.cpp
serverbrowser.cpp
serverinfo.cpp
snapshot.cpp
str.cpp
strip_path_and_extension.cpp
swap_endian.cpp
Expand Down Expand Up @@ -3130,10 +3132,16 @@ if(NOT DEV)
install(TARGETS ${TARGET_ANTIBOT} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT server)
endif()
install(TARGETS ${TARGETS_TOOLS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/ddnet COMPONENT tools)
install(FILES other/ddnet.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications COMPONENT client)
if(TARGET game-client)
install(FILES other/ddnet.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications COMPONENT client)
endif()
foreach(SIZE 16 32 48 256)
install(FILES other/icons/DDNet_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet.png COMPONENT client)
install(FILES other/icons/DDNet-Server_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet-server.png COMPONENT server)
if(TARGET game-client)
install(FILES other/icons/DDNet_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet.png COMPONENT client)
endif()
if(TARGET game-server)
install(FILES other/icons/DDNet-Server_${SIZE}x${SIZE}x32.png DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME ddnet-server.png COMPONENT server)
endif()
endforeach()
foreach(file ${VULKAN_SHADER_FILE_LIST})
install(FILES ${PROJECT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/ddnet/data/shader/vulkan COMPONENT client)
Expand Down Expand Up @@ -3194,11 +3202,11 @@ if(CLIENT AND DMGBUILD)
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/discord/${LIB_DIR}/discord_game_sdk.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/freetype/${LIB_DIR}/libfreetype.6.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/png/${LIB_DIR}/libpng16.16.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavcodec.60.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavformat.60.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavutil.58.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswresample.4.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswscale.7.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavcodec.61.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavformat.61.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libavutil.59.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswresample.5.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/ddnet-libs/ffmpeg/${LIB_DIR}/libswscale.8.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/libsteam_api.dylib ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/Frameworks/
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/darwin_strip_rpath.py ${CMAKE_OTOOL} ${CMAKE_INSTALL_NAME_TOOL} ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/${CLIENT_EXECUTABLE}
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @loader_path/../Frameworks ${DMG_TMPDIR}/${CLIENT_EXECUTABLE}.app/Contents/MacOS/${CLIENT_EXECUTABLE}
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ members = [
"src/rust-bridge/test",
]

resolver = "2"

[profile.dev]
panic = "abort"

Expand Down
30 changes: 15 additions & 15 deletions cmake/FindFFMPEG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ endif()

set_extra_dirs_lib(FFMPEG ffmpeg)
find_library(AVCODEC_LIBRARY
NAMES avcodec.60 avcodec libavcodec
NAMES avcodec.61 avcodec libavcodec
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVCODEC_LIBRARY_DIRS}
PATHS ${PATHS_AVCODEC_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)

find_library(AVFORMAT_LIBRARY
NAMES avformat.60 avformat libavformat
NAMES avformat.61 avformat libavformat
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVFORMAT_LIBRARY_DIRS}
PATHS ${PATHS_AVFORMAT_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)

find_library(AVUTIL_LIBRARY
NAMES avutil.58 avutil libavutil
NAMES avutil.59 avutil libavutil
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_AVUTIL_LIBRARY_DIRS}
PATHS ${PATHS_AVUTIL_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)

find_library(SWSCALE_LIBRARY
NAMES swscale.7 swscale libswscale
NAMES swscale.8 swscale libswscale
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_SWSCALE_LIBRARY_DIRS}
PATHS ${PATHS_SWSCALE_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
)

find_library(SWRESAMPLE_LIBRARY
NAMES swresample.4 swresample libswresample
NAMES swresample.5 swresample libswresample
HINTS ${HINTS_FFMPEG_LIBDIR} ${PC_SWRESAMPLE_LIBRARY_DIRS}
PATHS ${PATHS_SWRESAMPLE_LIBDIR}
${CROSSCOMPILING_NO_CMAKE_SYSTEM_PATH}
Expand Down Expand Up @@ -150,19 +150,19 @@ set(FFMPEG_COPY_FILES)
if(FFMPEG_BUNDLED)
if(TARGET_OS STREQUAL "windows")
set(FFMPEG_COPY_FILES
"${EXTRA_FFMPEG_LIBDIR}/avcodec-60.dll"
"${EXTRA_FFMPEG_LIBDIR}/avformat-60.dll"
"${EXTRA_FFMPEG_LIBDIR}/avutil-58.dll"
"${EXTRA_FFMPEG_LIBDIR}/swresample-4.dll"
"${EXTRA_FFMPEG_LIBDIR}/swscale-7.dll"
"${EXTRA_FFMPEG_LIBDIR}/avcodec-61.dll"
"${EXTRA_FFMPEG_LIBDIR}/avformat-61.dll"
"${EXTRA_FFMPEG_LIBDIR}/avutil-59.dll"
"${EXTRA_FFMPEG_LIBDIR}/swresample-5.dll"
"${EXTRA_FFMPEG_LIBDIR}/swscale-8.dll"
)
elseif(TARGET_OS STREQUAL "mac")
set(FFMPEG_COPY_FILES
"${EXTRA_FFMPEG_LIBDIR}/libavcodec.60.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libavformat.60.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libavutil.58.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libswresample.4.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libswscale.7.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libavcodec.61.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libavformat.61.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libavutil.59.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libswresample.5.dylib"
"${EXTRA_FFMPEG_LIBDIR}/libswscale.8.dylib"
)
endif()
endif()
Binary file added data/editor/entities/F-DDrace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/editor/entities_clear/f-ddrace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 752a91e

Please sign in to comment.