Commit graph

19245 commits

Author SHA1 Message Date
furo d09304fbc5 Massively improve the speed of rcon commands sending. 2024-03-14 17:50:09 +01:00
heinrich5991 3805ffba86
Merge pull request #8073 from Robyt3/Gamecore-Str-Validation
Add validation for `StrToInts` and `IntsToStr`
2024-03-10 13:48:08 +00:00
Dennis Felsing aa2574e727
Merge pull request #8079 from Robyt3/Econ-UTF8-Validate
Ensure commands executed via Econ are valid UTF-8
2024-03-10 13:01:33 +00:00
Robert Müller 02f60421f9 Add validation for StrToInts and IntsToStr
Add strict validation for `StrToInts` function. Because this function should only be used with trusted internal strings, assertions are added to ensure that the string is not truncated. Some buffer sizes are adjusted accordingly, so truncation cannot happen.

Add less strict validation for `IntsToStr` function. 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. The function will now unpack an empty string and return `false`, if the string contains invalid UTF-8.

The inline definition of the functions is not wanted, because it requires adding a `system.h` include in `gamecore.h`. Therefore the tools now have to depend on game-shared, which previously only worked because the functions were inline.

Tests are added to ensure the function still behaves the same as before for valid inputs and correctly handles invalid inputs.
2024-03-10 12:49:56 +01:00
Robert Müller c824bcc647
Merge pull request #8078 from def-/pr-eesti-keel
Add Estonian translation (by Cammo)
2024-03-10 10:45:11 +00:00
Dennis Felsing 6d2f492ee9 Add Estonian translation (by Cammo) 2024-03-10 11:27:48 +01:00
Robert Müller bff5247746 Ensure commands executed via Econ are valid UTF-8
`CNetConsole` will now ignore received lines containing invalid UTF-8 codepoints. Previously, it was possible to crash the server on Windows with Econ commands like `exec <invalid UTF-8>`.
2024-03-10 11:23:42 +01:00
Dennis Felsing bb4dd092d8
Merge pull request #8077 from Robyt3/Graphics-ImageData-uint8_t
Use `uint8_t *` consistently for raw image data
2024-03-09 13:54:11 +00:00
Robert Müller b67263107d Use uint8_t * consistently for raw image data
Previously, usage of `void *`, `unsigned char *` and `uint8_t *` was mixed in various places for pointers to raw image data and the pointers ended up being cast to `uint8_t *` at some point anyway. Now only `uint8_t *` is used consistently, which improves type safety and readability. Casts to `uint8_t *` are now only necessary when using `malloc` or when reading data from a map.
2024-03-09 13:31:53 +01:00
Dennis Felsing b957107ce7
Merge pull request #8075 from dobrykafe/pr-slovak-translations
Update Slovak translations
2024-03-09 08:27:32 +00:00
Dennis Felsing c80e19792e
Merge pull request #8076 from Robyt3/Console-Key-Completion
Show completion options for bind key names in console
2024-03-08 22:18:08 +00:00
Robert Müller 3073934df1 Show completion options for bind key names in console
Show completion options for key names for all bind commands (`bind`, `binds`, `bind_reset`) in the local console.

At the moment this only works for completing the first key name but not for composite binds that use `+`, which would work differently than other console argument completion.

Unnamed keys (starting with `&`) are not shown as completion options.

Refactor console argument completion to reduce duplicate code.
2024-03-08 21:54:22 +01:00
dobrykafe a8b8c6ee7b update slovak translations 2024-03-08 19:41:27 +01:00
heinrich5991 1afdf47362
Merge pull request #8072 from furo321/practice-helptext
List all practice commands when enabling `/practice`
2024-03-07 00:14:36 +00:00
furo 209df982f8 List all practice commands when enabling /practice 2024-03-07 00:57:21 +01:00
archimede67 de956c8db9
Merge pull request #8071 from dobrykafe/pr-popup-image-height
Editor: Make embedded image popup bigger at all times
2024-03-06 22:47:38 +00:00
dobrykafe 0b03bc7a16 make embedded image popup bigger at all times 2024-03-06 23:27:50 +01:00
Dennis Felsing 117ccd7adf
Merge pull request #8070 from Robyt3/Engine-FIFO-UTF8-Check
Ensure commands executed via FIFO are valid UTF-8
2024-03-06 22:12:02 +00:00
Robert Müller 3656c95eca Ensure commands executed via FIFO are valid UTF-8 2024-03-06 22:01:10 +01:00
Dennis Felsing b6689bc012
Merge pull request #8068 from heinrich5991/pr_ddnet_job_atomics
Fix race conditions in job state handling
2024-03-05 21:57:11 +00:00
heinrich5991 e7717f2265 Fix race conditions in job state handling
We want to change the state of the job from `STATE_QUEUED` to
`STATE_RUNNING`, but not from `STATE_ABORTED`. Previously, the code
usedd `exchange` to change the state and compared non-atomically
afterwards. This led to `STATE_ABORTED` being replaced by
`STATE_RUNNING` in a race. With `compare_exchange_strong`, this can no
longer happen.

Fixes #8044.
2024-03-05 20:55:44 +01:00
heinrich5991 819270c453
Merge pull request #8066 from Robyt3/Http-Error-Fixes
Fix HTTP client shutdown and deadlock on request error
2024-03-05 19:46:33 +00:00
Robert Müller 9323e18616 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 19:48:45 +01:00
Dennis Felsing f3de37d9d4
Merge pull request #8019 from heinrich5991/pr_ddnet_rename_variables
Rename all variables for strict camel-casing of abbreviations
2024-03-05 16:06:58 +00:00
heinrich5991 44bf0134f0
Merge pull request #8065 from dobrykafe/pr-solo-practice-bug
Fix practice mode not resetting after disconnect on solo servers
2024-03-05 15:20:34 +00:00
heinrich5991 17402cc43f Rename all variables for strict camel-casing of abbreviations
This is the strict version, ID → Id, UI → Ui, except DDNet which stays
DDNet.

This would fix #7750.

Done using a naive rename script (for bash, use `shopt -s globstar`):

```fish
sed -i \
	-e 's/\([a-z]_\?\)ID/\1Id/g' \
	-e 's/\([^ ]\)\<UI\>/\1Ui/g' \
	-e 's/UI()/Ui()/g' \
	-e 's/\<CUI\>/CUi/g' \
	-e 's/\([\ta-z.(&]\|[,=|] \)ID\>/\1Id/g' \
	-e 's/\<ID\>\([^ ").]\)/Id\1/g' \
	-e 's/\<ID\([0-9]\)/Id\1/g' \
	-e 's/\<ID\>\( [<=>:+*/-]\)/Id\1/g' \
	-e 's/int ID/int Id/g' \
	-e 's/\([a-z]_\?\)GPU/\1Gpu/g' \
	-e 's/\([a-z]_\?\)IP/\1Ip/g' \
	-e 's/\([a-z]_\?\)CID/\1Cid/g' \
	-e 's/\([a-z]_\?\)MySQL/\1Mysql/g' \
	-e 's/MySql/Mysql/g' \
	-e 's/\([a-xz]_\?\)SQL/\1Sql/g' \
	-e 's/DPMode/DpMode/g' \
	-e 's/TTWGraphics/TTwGraphics/g' \
	\
	-e 's/Ipointer/IPointer/g' \
	-e 's/\.vendorId/.vendorID/g' \
	-e 's/\.windowId/.windowID/g' \
	-e 's/SDL_GetWindowFromId/SDL_GetWindowFromID/g' \
	-e 's/SDL_AudioDeviceId/SDL_AudioDeviceID/g' \
	-e 's/SDL_JoystickId/SDL_JoystickID/g' \
	-e 's/SDL_JoystickInstanceId/SDL_JoystickInstanceID/g' \
	-e 's/AVCodecId/AVCodecID/g' \
	src/**/*.cpp src/**/*.h {datasrc,scripts}/**/*.py
git checkout -- src/engine/external
```

I like this option because it presents clear rules.

Still needs fixups because of the naive replacement, I'd do this if we
want this merged.
2024-03-05 15:44:09 +01:00
dobrykafe d94d020c25 fix practice mode not resetting after disconnect on solo servers 2024-03-05 14:08:30 +01:00
Dennis Felsing ca9f5dfcbe
Merge pull request #8064 from By622/patch-9
Update traditional_chinese.txt
2024-03-05 09:05:35 +00:00
By 888ac2f2d4
Update traditional_chinese.txt 2024-03-05 12:01:58 +08:00
heinrich5991 c15733eda3
Merge pull request #8063 from heinrich5991/pr_ddnet_register_error
Show error from masterserver in console
2024-03-04 23:08:25 +00:00
Dennis Felsing 3c6101ccb3
Merge pull request #8061 from dobrykafe/pr-czech-translations
Update Czech translations
2024-03-04 22:36:41 +00:00
heinrich5991 12409e545c Show error from masterserver in console
Allows people to see why masterserver registering failed.
2024-03-04 21:58:30 +01:00
heinrich5991 27467c658b
Merge pull request #8062 from Robyt3/Client-Command-Register-Cleanup
Remove remaining hard-coded server commands from client-side, hide `tune_zone` command in local console
2024-03-04 20:46:03 +00:00
Robert Müller dd94da67fb Hide tune_zone command in local console
Prevent the `tune_zone` command from being shown and used in the local console, which could cause issues with prediction, by only registering it as a game setting but not as a client command. The command callback is still correctly called when map settings are loaded in the `CGameClient::LoadMapSettings` function.
2024-03-04 21:26:47 +01:00
Robert Müller bfa5bc2b3c Remove remaining hard-coded server commands from client-side
Followup for #7919.
2024-03-04 21:26:41 +01:00
dobrykafe a8192c19a0 update czech translations 2024-03-04 20:43:47 +01:00
Dennis Felsing b88cdbf21e
Merge pull request #8055 from heinrich5991/pr_ddnet_no_duplicate_git_rev
Don't show the git revision twice in server log
2024-03-04 16:09:21 +00:00
heinrich5991 e851c78e47 Don't show the git revision twice in server log
Previously:
```
2024-03-03 12:17:40 I git-revision: 885ae7ecae
2024-03-03 12:17:40 I server: version 18.0.3 on linux amd64
2024-03-03 12:17:40 I server: git revision hash: 885ae7ecae
```
2024-03-04 16:50:45 +01:00
Dennis Felsing 7f08344aa8
Merge pull request #8054 from eghwand/turkish-1
Update turkish.txt
2024-03-04 10:15:22 +00:00
Dennis Felsing 93dc17a59f
Merge pull request #8052 from Bamcane/patch-5
Update simplified_chinese.txt
2024-03-04 10:04:57 +00:00
Egehan c0b5d089e2 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan 545e4df438 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan 8ecb7415d3 Update data/languages/turkish.txt
Co-authored-by: Emir Marincic <learath2@gmail.com>
2024-03-04 10:48:26 +01:00
Egehan f3113e5136 Update turkish.txt 2024-03-04 10:48:26 +01:00
甘竹 Bamcane 57985cd8bd Update simplified_chinese.txt 2024-03-04 10:47:55 +01:00
Dennis Felsing 65a880a468
Merge pull request #8059 from n0Ketchp/patch-17
Update spanish.txt
2024-03-04 09:47:51 +00:00
noKetchup dde7b8a624
Update spanish.txt 2024-03-04 06:30:02 -03:00
Dennis Felsing 70eca3869a
Merge pull request #8051 from dobrykafe/pr-serverbrowser-friends-sort
Add sorting by number of friends to the server browser
2024-03-04 07:27:48 +00:00
Dennis Felsing b6cb7b112d
Merge pull request #8050 from gerdoe-jr/patch-1
Update russian.txt
2024-03-03 22:47:12 +00:00
Dennis Felsing a3e6a2dc50
Merge pull request #8056 from def-/pr-try-python-fix-macos
Try to fix python macOS issue
2024-03-03 22:46:58 +00:00