Commit graph

19198 commits

Author SHA1 Message Date
Robert Müller 27f65cdbb0 Fix client crash due to truncated skin name 2024-03-08 11:21:21 +01:00
Robert Müller 653c5d07d4 Add validation for StrToInts and IntsToStr, move and rename
Rename `StrToInts` function to `str_to_int32` and add strict validation. Because this function should only used with trusted internal strings, assertions are added to ensure that no invalid UTF-8 is being encoded as integers and that the string is not truncated. Some buffer sizes are adjusted accordingly, so truncation cannot happen.

Rename `IntsToStr` function to `int32_to_str` and add lenient validation. An additional argument specifying the size of the output buffer is added to assert that the size of the output buffer is sufficient. However, because this function is used to decode data sent by the server and read from maps and ghosts, invalid input data should never result in crashes or invalid UTF-8 strings. This function will replace invalid UTF-8 codepoints with `?` characters. The Unicode replacement character is not used, because it's 3 bytes long, so the string with added replacement characters may not fit into the buffer and this would also make the function more complicated, because it would require a temporary buffer. This provides reasonable support for loading old maps which might contain invalid UTF-8 in their layer, group or envelope names.

The functions are renamed and moved from `gamecore.h` to `system.h`. The motivation for this is that the tools would otherwise have to depend on game-shared, which previously only worked because the functions were inline. The inline definition is not wanted, because it requires adding a `system.h` include in `gamecore.h`.

Tests are added to ensure the function still behaves the same as before for valid inputs and correctly handles invalid inputs.
2024-03-07 23:41:26 +01:00
Robert Müller 891242f9a2 Fix HTTP client shutdown and deadlock on request error
Fix HTTP client effectively shutting down by entering the `ERROR` state when a request cannot be added. Now only the invalid request is aborted immediately. The `ERROR` state is now only entered when a curl function fails in a way where recovery is not possible.

Fix occasional deadlock when HTTP client is shutting down after entering the `ERROR` state, by also immediately aborting new requests when the HTTP client is already in the `ERROR` state.

Remove unused `CHttp::EState::STOPPING`.
2024-03-05 22:56:35 +01:00
By 52a2e17b55 Update traditional_chinese.txt 2024-03-05 10:06:59 +01:00
dobrykafe eb42a8e507 update czech translations 2024-03-04 23:36:51 +01:00
Egehan 2c4b5b101d Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:50:04 +01:00
Egehan a9d5d316cf Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:49:56 +01:00
Egehan b2718c7ec3 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:49:51 +01:00
noKetchup dbf8ec1f33 Update spanish.txt 2024-03-04 10:47:14 +01:00
Egehan eb0c26dd1c Update turkish.txt 2024-03-03 12:17:04 +01:00
甘竹 Bamcane 116156a4bc Update simplified_chinese.txt 2024-03-03 10:47:02 +01:00
Vladislav Gerasimov d7fcede25e Update russian.txt 2024-03-03 08:55:37 +01:00
Vladislav Gerasimov c31e173c42 Update russian.txt 2024-03-03 08:55:33 +01:00
Rafael Fontenelle 4ba71b7cf5 Update brazilian_portuguese.txt 2024-03-02 23:32:50 +01:00
furo 6bebafcc95 Update Swedish translations for 18.1 2024-03-02 23:18:21 +01:00
Dennis Felsing f7ea38ecf1 Version 18.1 2024-03-02 14:12:19 +01:00
dobrykafe 1ced40d95b show countdown in player/tee settings for sv_info_change_delay 2024-03-02 14:11:33 +01:00
Robert Müller b544c3e839 Add assertions to all thread and semaphore functions
Assert on failures in all `thread_*` and `sphore_*` functions on all operating systems instead of only printing log messages on Unix, as these functions are only expected to fail when used with incorrect arguments or in some cases when a dead-lock is detected.

On macOS, `sphore_wait` was not correctly calling `sem_wait` in a loop to repeat the wait operation if it is interrupted by a signal.

On Windows, the AIO tests were failing with the additional assertions. The maximum count that semaphores on Windows could be incremented to was previously, arbitrarily limited to 10000, which was causing the `ReleaseSemaphore` call to fail as the AIO semaphore is signaled 65536 times (for each write operation) in multiple of the AIO tests.
2024-03-02 14:11:25 +01:00
Dennis Felsing 66cc7b5e5b Update translations for upcoming 18.1 2024-03-02 14:09:33 +01:00
Dennis Felsing 5d070ec5c3
Merge pull request #8043 from Robyt3/Editor-Envelope-Point-Color-Fix
Fix editor crash when right-clicking bezier control points
2024-03-02 12:50:42 +00:00
Robert Müller 350acae56b
Merge pull request #8041 from Jupeyy/pr_small_alloc_fix_vk
Search __most__ fitting allocation, not _first_ fitting
2024-03-02 12:36:48 +00:00
Robert Müller 6895cdc343 Fix editor crash when right-clicking bezier control points
The color selection should only be shown for normal envelope points but not for bezier control points, because it always changes the previously selected normal envelope point. This caused the client to crash when right-clicking a bezier control point when no normal envelope point was previously selected.

Closes #8020.
2024-03-02 13:16:26 +01:00
Jupeyy ec39742017 Search __most__ fitting allocation, not _first_ fitting 2024-03-02 13:12:58 +01:00
Jupeyy 5ff25a9377
Merge pull request #8042 from Robyt3/Vulkan-Blitting-Fix
Fix editor color picker when Vulkan image blitting used
2024-03-02 11:50:45 +00:00
Robert Müller 209a367ab2 Fix editor color picker when Vulkan image blitting used
When image blitting is supported by the Vulkan backend, the color picker was reading incorrect pixel values, because the offset positions for the blitting region are the positions of the top-left and bottom-right corners, but instead the top-left offset and size (width, height) were passed as arguments.

Closes #8040.
2024-03-02 12:32:11 +01:00
Dennis Felsing 4be92b227f
Merge pull request #8038 from Robyt3/Client-SetState-Refactoring
Minor refactoring of `CClient::SetState`
2024-03-01 18:45:04 +00:00
Robert Müller 52da715858 Minor refactoring of CClient::SetState
- Rename parameter `s` to `State`.
- Only print debug message if new state is different from old state.
- Reduce indentation.
2024-03-01 18:58:41 +01:00
Jupeyy 011299d0e3
Merge pull request #8035 from Robyt3/Entities-Switch-Fix
Always build switch entities layers
2024-03-01 15:08:53 +00:00
Robert Müller dd09834f32 Always build switch entities layers
Only building the switch entities layer when the current map has a switch layer (#8011) also does not work, because the entities textures are cached for each type and not reloaded unless the entities are changed manually. First joining a server with a map that does not have a switch layer will cause the textures for the type of that server to be built without the switch entities layer, so the switch entities texture will be missing when joining a server of that type with a map that does have a switch layer.

Instead, the switch entities layer textures are always built now, so the cached entities textures are can be used on all maps of the respective server type. This is expected to slightly increase the total memory usage after joining multiple servers of different types. As before, tiles which are unused are masked unless `m_DontMaskEntities` is set.
2024-02-29 21:45:53 +01:00
Robert Müller 16feff41de
Merge pull request #8033 from bencie/bg-entities-no-extension
Let users pick background entities map without file extensions
2024-02-29 17:55:13 +00:00
bencie 26cc7dde2f Refactor 2024-02-29 18:37:39 +01:00
bencie 2868b3cdf6 Let users pick background entities map without file extensions 2024-02-29 18:13:50 +01:00
Robert Müller be9411b262
Merge pull request #8031 from dobrykafe/pr-emotional-tees
fix incorrect usage of `SvEmotionalTees`
2024-02-29 16:06:43 +00:00
dobrykafe d2b2071bda fix incorrect usage of SvEmotionalTees 2024-02-29 16:47:58 +01:00
Dennis Felsing 61e6714e33
Merge pull request #8030 from dobrykafe/pr-chat-command-args
Make chat command arguments case-insensitive when possible
2024-02-29 08:13:47 +00:00
dobrykafe 720572ddda make chat command arguments case-insensitive when possible 2024-02-29 01:17:11 +01:00
heinrich5991 9620a9d3d9
Merge pull request #8029 from Robyt3/Menus-RenderPopupFullscreen-Function
Extract `CMenus::RenderPopupFullscreen` function
2024-02-28 22:39:29 +00:00
heinrich5991 ffc7ad0924
Merge pull request #8028 from Robyt3/Windows-Defines-CMakeLists
Define Windows header macros only once in `CMakeLists.txt`
2024-02-28 22:28:43 +00:00
Robert Müller 6080cffcbb Extract CMenus::RenderPopupFullscreen function
Improve readability of the `CMenus::Render` function by extracting the code for rendering the fullscreen popups into a separate function.
2024-02-28 22:53:51 +01:00
Robert Müller 8d774fa48c Define Windows header macros only once in CMakeLists.txt
Instead of defining the macro `WIN32_LEAN_AND_MEAN` and sometimes also the macro `_WIN32_WINNT` in each file that directly or indirectly includes `<windows.h>`, only define these macros once consistently in `CMakeLists.txt`.

Also define `NTDDI_VERSION`, which is the new macro to specify the minimum Windows version starting with Windows Vista. This macro needs to be defined in addition to old `_WIN32_WINNT` macro, according to the documentation.

See https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers
2024-02-28 21:40:28 +01:00
archimede67 758664c29d
Merge pull request #8021 from Robyt3/Envelope-Render-Fixes
Various fixes for envelope and bezier evaluation
2024-02-26 21:49:34 +00:00
Robert Müller ecfc18d129 Minor refactoring of bezier curve evaluation
- Remove `ValidateFCurve` function because it's small and only used once.
- Remove unnecessary checks in `SolveBezier`, as all of these conditions are already checked before the function is called.
- Remove unnecessary double negation of `InTang` to improve readability.
- Use `double` literals for `double` comparisons instead of `float` literals.
- Fix comments.
2024-02-26 20:43:35 +01:00
Robert Müller 47a8156ca8 Fix inaccurate evaluation of bezier curve envelopes
There is no need to divide the times by 1000 when evaluating bezier curves, as all times are relative and the division adds significant inaccuracy, to the point where evaluation of bezier curves goes completely wrong in some cases.

Closes #8005.
2024-02-26 20:43:21 +01:00
Robert Müller cc1d43e5a0 Fix division by zero when envelope point times overlap
Effectively skip envelope points whose start time is equal to the start time of the next envelope point.
2024-02-26 20:43:12 +01:00
Robert Müller 5aab9969ce Fix first envelope line segment not being rendered in editor
Rendering was started with the second line segment after one time step has already passed.
2024-02-26 20:42:58 +01:00
Robert Müller 7c4d51f111
Merge pull request #8016 from dobrykafe/pr-save-replay-improve
Improvements regarding `save_replay`
2024-02-26 18:39:20 +00:00
dobrykafe 91349e4cae add error handling for CDemoEdit job 2024-02-26 18:44:11 +01:00
dobrykafe 268b79cb61 handle invalid filename for save_replay 2024-02-26 18:43:51 +01:00
Robert Müller 2258cbca57
Merge pull request #8007 from heinrich5991/pr_ddnet_vital_ping
Respond to pings sent as vital messages with vital pongs
2024-02-26 12:22:46 +00:00
Dennis Felsing ae5bf905ff
Merge pull request #8018 from MilkeeyCat/pr_remove_useless_command_in_ci
ci: remove useless command in ci
2024-02-26 09:22:54 +00:00