Commit graph

20811 commits

Author SHA1 Message Date
Robert Müller 45f619722b Avoid duplicate creation of ddnet-libs directory
Avoid error messages due to `ddnet-libs` directory already existing and being created multiple times.
2024-05-23 20:43:53 +02:00
Robert Müller 60733bc033 Remove redundant check for existing directory with mkdir -p
The `mkdir -p` command is already idempotent so separately checking whether the directory exists is not necessary.
2024-05-23 20:43:30 +02:00
Robert Müller e9581b87ba Ensure specified target system for buiding libraries is valid
Abort building libraries if the specified target system is not one of the supported values.
2024-05-23 20:42:25 +02:00
Robert Müller 2844ad7239 Remove redundant OS_NAME_PATH variable
This variable was simply assigned the same value as the `OS_NAME` variable.
2024-05-23 18:06:59 +02:00
Robert Müller 0da30b7857 Remove obsolete autogen.sh usage for OpenSSL build
The OpenSSL project does not contain an `autogen.sh` file anymore, which was causing an error message when building the libraries.
2024-05-23 18:06:59 +02:00
heinrich5991 60fb40676a
Merge pull request #8310 from ChillerDragon/pr_shfmt
Use shfmt as formatter for shell scripts
2024-05-23 06:26:50 +00:00
ChillerDragon c75584406a Use shfmt as formatter for shell scripts 2024-05-23 08:05:00 +08:00
heinrich5991 1e11fffb03
Merge pull request #8390 from Robyt3/Base-chdir-getcwd-Cleanup
Minor refactoring of `fs_chdir` and `fs_getcwd` functions
2024-05-22 21:25:27 +00:00
heinrich5991 848f4a846b
Merge pull request #8334 from Robyt3/Android-Building-Fix
Fix the Android build and improve the Android building `README.md`
2024-05-22 21:19:40 +00:00
Robert Müller 68d474c81f
Merge pull request #8363 from heinrich5991/pr_ddnet_str_from_int
Optimize `str_format(…, …, "%d", …)` using templates
2024-05-22 21:01:17 +00:00
Robert Müller f04bea6b4b Minor refactoring of fs_chdir and fs_getcwd functions
Remove unnecessary `fs_is_dir` check in the `fs_chdir` function. The `SetCurrentDirectoryW` and `chdir` functions would already include such necessary checks anyway.

Assert that `GetCurrentDirectoryW` was successful instead of logging an error message. This function should only potentially fail if the current working directory was changed by another thread between the two calls, which should not happen in our code.
2024-05-22 19:22:23 +02:00
Dennis Felsing 9048bf2997
Merge pull request #7820 from gerdoe-jr/set-rescue
Add `/rescuemode` support
2024-05-22 17:22:07 +00:00
heinrich5991 df9980ee3e Optimize str_format(…, …, "%d", …) using templates
This would make the function `str_from_int` unnecessary, at least
user-facing.

Advantage: User doesn't have to care about `str_from_int`/`str_format`
distinction.

Disadvantage: We're adding some template programming to `system.h`,
potentially slowing all compilation.
2024-05-22 14:44:46 +02:00
heinrich5991 612a71f874
Merge pull request #8351 from ChillerDragon/pr_rcon_percentage
Show percentage of loaded rcon commands (closed #7769)
2024-05-22 08:39:40 +00:00
heinrich5991 7c4d3a5978
Merge pull request #8391 from hardliner66/fix_econ
Allow econ to succeed, even if ipv6 econ fails to bind to socket
2024-05-21 19:20:14 +00:00
Steve Biedermann 3af8c00fc7 allow ipv4 econ to succeed, even if ipv6 econ fails to open port 2024-05-21 20:55:30 +02:00
Robert Müller 1316ac3c70 Improve the Android building README.md 2024-05-21 17:38:48 +02:00
Robert Müller e4a7fd59f7 Determine default version name and code from version.h
Parse `GAME_RELEASE_VERSION` and `DDNET_VERSION_NUMBER` definitions from `src/game/version.h` by default, so specifying a version manually is usually not necessary.
2024-05-21 17:38:48 +02:00
Robert Müller 51e4e41805 Change tw.DDNet package name to org.ddnet.client 2024-05-21 17:38:48 +02:00
Robert Müller 664b0e98bb Upgrade Gradle and fix Android deprecation errors
Upgrade to Gradle 8.5 and Gradle Plugin 8.3.0 for compatibility with Java 21. Explicity set Java version 21 in `build.gradle`. Increment compile and target SDK version to 34 accordingly.

Remove the explicitly defined, obsolete `buildToolsVersion` property in `build.gradle`, as it is now automatically derived by Gradle.

Replace the deprecated property `android:extractNativeLibs` in `AndroidMainfest.xml` with `useLegacyPackaging` in `build.gradle`.

Replace the deprecated package definition `package="tw.DDNet"` in `AndroidMainfest.xml` with `namespace("tw.DDNet")` in `build.gradle`.

Add the required property `android:exported="true"` to the main activity in `AndroidMainfest.xml`.
2024-05-21 17:38:42 +02:00
Robert Müller cdbe1f775a Various fixes/improvements to Android building scripts
Use [cargo-ndk](https://github.com/bbqsrc/cargo-ndk) to configure cargo for building with the Android NDK. The output of `cargo ndk` is written to a subfolder for the target triplet, which cannot be changed by parameter. Therefore, the `CARGO_BUILD_DIR` is changed to this subfolder for the Android build, so the build process can find the output.

Use `$HOME` instead of `~` because cargo-ndk cannot correctly access the folder otherwise (will fail with error message indicating it could not determine the NDK version).

Add `DDNET_TEST_NO_LINK=ON` CMake argument, to fix Rust linking errors with tests.

Add additional CMake arguments to specify system name, API version and NDK location. Upgrade to Android API 34.

Use `nproc` instead of `32` threads for building.
2024-05-21 17:36:47 +02:00
Robert Müller b2c2a74db7 Remove unused shell script function arguments
Only the first two arguments of the `build_for_type` and `copy_libs` functions are used.
2024-05-21 17:36:47 +02:00
Robert Müller ceb1640320 Fix incorrect CMake target name in cmake_android.sh
The name of the main target was changed from `DDNet` to `game-client`.
2024-05-21 17:36:46 +02:00
Robert Müller 468cd85839 Add build folder parameter to cmake_android.sh
Add a parameter instead of using the fixed build folder `build_android`.
2024-05-21 17:36:46 +02:00
Robert Müller 9afe7444c1 Fix SDL3 being used in gen_libs.sh
The SDL default branch is now SDL3, so we need to check out specifically the SDL2 branch.
2024-05-21 17:36:46 +02:00
Robert Müller ad9b44bfed Remove local.properties and add it to .gitignore
This file is not supposed to be added to version control and will be regenerated whenever the Gradle build is run.
2024-05-21 17:36:46 +02:00
Robert Müller dfae99da76 Fix unused variable Silent in client.cpp on Android 2024-05-21 17:36:46 +02:00
Robert Müller 4a2a23530c Fix integrity_save.txt file not being closed 2024-05-21 17:36:46 +02:00
Robert Müller b2b0cd0c81 Fix shadowed variable declarations in android_main.cpp 2024-05-21 17:36:46 +02:00
Robert Müller 447321700d
Merge pull request #8388 from def-/pr-polish2
Update Polish translations
2024-05-21 15:31:41 +00:00
Dennis Felsing b4a41ea098
Merge pull request #8387 from ChillerDragon/pr_clang_format_interfaces
Whitelist class names starting with I
2024-05-21 06:59:06 +00:00
ChillerDragon ab64d64fed Whitelist class names starting with I
Fixes clang issues being detected in interface classes such as `class IJob`

Fixes the following clangd error:

``Invalid case style for class 'IJob' (fix available)``
2024-05-21 11:05:39 +08:00
heinrich5991 42fa41092c
Merge pull request #8384 from Robyt3/Client-Demo-Race-Compat-Removal
Remove `cl_ddrace_scoreboard` and `cl_demo_assume_race` settings
2024-05-20 10:09:56 +00:00
Robert Müller 7da8308c3f Remove cl_ddrace_scoreboard and cl_demo_assume_race settings
Time score will now always be used for any game with the flag `GAMEINFOFLAG_TIMESCORE` set in the `CNetObj_GameInfoEx` object. If the flag is not set, points score is used instead.

Backwards compatibility for old demos, that were recorded without this net object and flag, is removed. For old demos, points score is always assumed now.

Closes #6700.
2024-05-20 11:07:01 +02:00
Dennis Felsing b63380f7ce Update Polish translations 2024-05-20 13:36:29 +08:00
Jupeyy 08a8680a8e
Merge pull request #8383 from Robyt3/Graphics-Clear-Revert
Revert "Always clear window with black color instead of background color
2024-05-19 20:05:38 +00:00
heinrich5991 b94dfc5b77
Merge pull request #8382 from Robyt3/Scripts-CopyFix-Performance-Regression
Fix performance regression in `copy_fix.py`
2024-05-19 19:47:38 +00:00
Robert Müller c0a6f5a927 Revert "Always clear window with black color instead of background color"
This reverts commit caa062c88c.

As this decreased FPS and caused the background quad to be rendered twice when using a map background in entities mode.
2024-05-19 20:01:56 +02:00
Robert Müller fd4f61e601 Fix performance regression in copy_fix.py 2024-05-19 19:47:12 +02:00
Dennis Felsing 8a20f0d8a2
Merge pull request #8379 from Robyt3/Android-Landscape-Fullscreen
Force landscape orientation and hide title bar on Android
2024-05-19 13:22:40 +00:00
Robert Müller 05c825947a Force landscape orientation and hide title bar on Android
Always force landscape orientation to be used for the game on Android.

Hide the title bar so it is not shown when starting the game. There is also a bug with SDL currently that leads to the title bar and status bar being shown permanently after minimizing and reopening the app, which is alleviated by hiding the title bar.
2024-05-19 12:58:33 +02:00
Dennis Felsing 85b00ba7c1
Merge pull request #8374 from Robyt3/Graphics-Clear-Black
Always clear window with black color instead of background color
2024-05-18 14:09:23 +00:00
Robert Müller caa062c88c Always clear window with black color instead of background color
Always use black color to clear the window with all graphics backends, instead of using `cl_background_color` or `cl_background_entities_color`, respectively, as the clear color. The respective map background color is rendered using a quad in `CMapLayers` instead, so this should not affect appearance of maps. This does not have any noticeable effect on FPS. Previously, the unused part of the window (when it is resized smaller than 5:4 aspect ratio), was colored using the map background color, whereas now it will be cleared black consistently.

The color parameters of the `IGraphics::Clear` function and of the `SCommand_Clear` command are removed, as we always expect the screen to be cleared black now.

The parameter `ForceClearNow` of the `IGraphics::Clear` function was already unused previously and is also removed.
2024-05-18 15:20:17 +02:00
Dennis Felsing fcacef5fbb
Merge pull request #8362 from Robyt3/Android-Backbutton-Handling
Translate back-button to escape-key on Android, quit if Android back-button is pressed 3 times within 1 second
2024-05-18 01:10:32 +00:00
Dennis Felsing 058382f253
Merge pull request #8367 from Robyt3/Graphics-Backend-Image-Format-Cleanup
Remove redundant graphics backend functions returning RGBA format
2024-05-18 01:09:40 +00:00
Dennis Felsing 1cb9f07e3c
Merge pull request #8370 from Robyt3/Scripts-DrMingw-Show-All-Modules
Also print external module/symbol names in `parse_drmingw.sh`
2024-05-18 01:09:28 +00:00
Robert Müller 91848f0be6 Quit if Android back-button is pressed 3 times within 1 second
Interpret fast repeated presses of the back-button (3 times within 1 second) as a quit-event, so the app can be quit cleanly and quickly without using the UI. The client settings are otherwise not saved if the app is closed by minimizing it using the home button and waiting for the OS to kill it or by discarding it in the recent apps view.
2024-05-17 19:37:44 +02:00
Robert Müller bba606feae Translate back-button to escape-key on Android
Translate the Android back-button to the escape-key, so it can be used to navigate back in menus, open/close the ingame menu, close the editor etc.

Trap the Android back button by setting the `SDL_ANDROID_TRAP_BACK_BUTTON` hint, so it can be handled in our code reliably instead of letting the system handle it.
2024-05-17 19:36:35 +02:00
Robert Müller 554f244ef2 Remove redundant graphics backend functions returning RGBA format
The graphics backends only support the RGBA format with the `SCommand_Texture_Create` and `SCommand_Texture_Update` commands, so the `TexFormatToOpenGLFormat`, `TextureFormatToVulkanFormat` and `TexFormatToNewOpenGLFormat` functions and the command member variables for the format are unnecessary. The `TexFormatToNewOpenGLFormat` function was unused.
2024-05-17 19:36:11 +02:00
Robert Müller c8f6811aba Also print external module/symbol names in parse_drmingw.sh
Example output before this change:

```
Module offset: 0x00007FF7C8DE0000
Image base: 0x0000000140000000
0x0000000772cb5efc: ?? ??:0
0x000000077cd5c3e8: ?? ??:0
0x000000075d063cc3: ?? ??:0
0x000000075d2a3d61: ?? ??:0
0x000000075d0b7fde: ?? ??:0
0x000000075d2a5f18: ?? ??:0
0x000000075d2a6809: ?? ??:0
0x000000075d0b8140: ?? ??:0
0x000000075cf9d41b: ?? ??:0
0x000000014034b4c7: CCommandProcessorFragment_Vulkan::WaitFrame() at src/engine/client/backend/vulkan/backend_vulkan.cpp:2341
0x000000014034a1a5: CCommandProcessorFragment_Vulkan::NextFrame() at src/engine/client/backend/vulkan/backend_vulkan.cpp:2501
0x000000014032d5b6: CCommandProcessorFragment_Vulkan::RunCommand(CCommandBuffer::SCommand const*) at src/engine/client/backend/vulkan/backend_vulkan.cpp:6473
0x000000014001a7e6: CCommandProcessor_SDL_GL::RunBuffer(CCommandBuffer*) at src/engine/client/backend_sdl.cpp:335
0x00000001400168eb: CGraphicsBackend_Threaded::ThreadFunc(void*) at src/engine/client/backend_sdl.cpp:65
0x0000000140237f9a: CWindowsComLifecycle::~CWindowsComLifecycle() at src/base/system.cpp:4660
 (inlined by) thread_run at src/base/system.cpp:796
0x00000007ea7e257d: ?? ??:0
0x00000007eb62aa48: ?? ??:0
```

Output for the same crash dump with this change:

```
Module offset: 0x00007FF7C8DE0000
Image base: 0x0000000140000000

amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0x1f40c
atig6pxx.dll!AmdGetCallbackProcs+0x124
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0x57773
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0x297811
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0xaba8e
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0x2999c8
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0x29a2b9
amdvlk64.dll!vk_icdGetInstanceProcAddrSG+0xabbf0
amdvlk64.dll!IcdPresentBuffers+0xb8eb
0x000000014034b4c7: CCommandProcessorFragment_Vulkan::WaitFrame() at src/engine/client/backend/vulkan/backend_vulkan.cpp:2341
0x000000014034a1a5: CCommandProcessorFragment_Vulkan::NextFrame() at src/engine/client/backend/vulkan/backend_vulkan.cpp:2501
0x000000014032d5b6: CCommandProcessorFragment_Vulkan::RunCommand(CCommandBuffer::SCommand const*) at src/engine/client/backend/vulkan/backend_vulkan.cpp:6473
0x000000014001a7e6: CCommandProcessor_SDL_GL::RunBuffer(CCommandBuffer*) at src/engine/client/backend_sdl.cpp:335
0x00000001400168eb: CGraphicsBackend_Threaded::ThreadFunc(void*) at src/engine/client/backend_sdl.cpp:65
0x0000000140237f9a: CWindowsComLifecycle::~CWindowsComLifecycle() at src/base/system.cpp:4660
 (inlined by) thread_run at src/base/system.cpp:796
KERNEL32.DLL!BaseThreadInitThunk+0x1d
ntdll.dll!RtlUserThreadStart+0x28
```

Also improve variable names in the script and add some comments.
2024-05-17 19:35:37 +02:00