Commit graph

5319 commits

Author SHA1 Message Date
Robert Müller d6a20f271b Improve some variable names in CHttp 2024-02-04 23:29:05 +01:00
Robert Müller 987acfbba7 Use more specific log levels for HTTP requests 2024-02-04 23:27:40 +01:00
Robert Müller 6c6f058a8c Cleanup HTTP request cleanup
Ensure with assertion that file is closed when `CHttpRequest` is destructed.

Remove unnecessary assignments in destructor.
2024-02-04 23:25:56 +01:00
Robert Müller 48fad83681 Remove hard-coded commands from client-side
Both console and chat commands are sent to clients dynamically with respective messages, so the static lists of commands were only used for servers not making use of these messages. Instead of assuming potentially incorrect console and chat commands on those servers, the lists will now be empty for those servers.

Move the command registration from the `ddracecommands.h` and `ddracechat.h` header files to the `CGameContext::RegisterDDRaceCommands` and `CGameContext::RegisterChatCommands` functions and delete the header files. The `CHAT_COMMAND` and `CONSOLE_COMMAND` macros are removed, because they only add unnecessary indirection now. The strings `CHAT_COMMAND` and `CONSOLE_COMMAND` are simply replaced with `Console()->Register` and semicolons are added at the end of the lines.

Closes #7665.
2024-02-04 13:16:04 +01:00
Robert Müller 7c9b1fbbb4 Add tabs for favorite communities, separate country/type filters
Support adding up to three communities as favorites in the server browser. Favorites can be changed with favorite buttons which are shown in the community filter on the Internet and Favorites tabs. The commands `add_favorite_community` and `remove_favorite_community` are added to change the favorite communities via the console and for saving the favorite communities to the config file. For the favorite communities, additional tabs using the communities' icons are shown in the server browser next to the Internet, LAN and Favorites tabs. Each community tab shows only the servers from the respective community, hence the community filters UI is not shown on the community tabs but only on the Internet and Favorites tabs. The country and type filters on community tabs cover only the countries and types from the respective community. Favorite communities are added from left to right. When more than three favorite communities are added, the oldest (leftmost) favorite community will be removed from the list.

When starting the client for the first time, i.e. with `cl_show_welcome 1`, the DDNet tab will be created as the only favorite community and selected initially. The community, country and type filters are unset when starting for the first time, so the Internet tab now shows all servers per default.

When starting with a `ui_page` for a favorite community that is not configured, the page is reset to the Internet tab. This also affects those who upgrade from versions with the old DDNet and KoG tabs. The server browser is now also correctly updated when changing `ui_page` via the console.

Track country and type filters for every community separately, to avoid filters resetting when switching between community tabs or changing the community filter. The commands `add_excluded_community`, `remove_excluded_community`, `add_excluded_country`, `remove_excluded_country`, `add_excluded_type` and `remove_excluded_type` are added to change the exclusion filters via the console and for saving the exclusion filters to the config file.

Render community filters above the toolbox (filter, info and friends) tabs when on the Internet and Favorites tab, so this setting is more visible and can be changed also when the other toolbox tabs are selected.

Add icon for the none community, based on the tee country flag color. This icon is hard-coded in the client, as the none community also is, so fetching the icon from the server would be inconvenient. Load community icons already when rendering the menu instead of only when rendering the server browser, so the icons are immediately available when using the start menu.

Find tutorial server by searching for community type "Tutorial" instead of searching for "(Tutorial)" in the server name.

Avoid cleaning favorite communities and filters when there are no communities, i.e. when the DDNet info failed to be loaded or does not contain any communities, to avoid losing all favorite communities and filters in this case.

Closes #7774.
2024-02-03 21:12:23 +01:00
Robert Müller a8f3b56850 Fix undefined behavior on loading empty PNG files
When empty PNG files are loaded, the `std::vector` for the file contents is resized to size 0, which results in undefined behavior when it is accessed with `front`.

When `io_tell` fails, i.e. returns `-1`, this was incorrectly cast to an `unsigned` and therefore caused a very large allocation and potentially crashes due to lack of memory.
2024-02-03 20:00:08 +01:00
heinrich5991 78bd4970be
Merge pull request #7909 from furo321/set-correct-name-size
Set correct size of name column in SQL table
2024-02-03 16:19:29 +00:00
furo 5378fdc20b Set correct size of name column in SQL table 2024-02-03 00:21:42 +01:00
heinrich5991 7f85922d75
Merge pull request #7872 from Robyt3/Client-Dummy-Config-Desc
Minor improvement of dummy config variable descriptions
2024-02-02 21:55:14 +00:00
heinrich5991 63e010b8e4
Merge pull request #7906 from furo321/limit-port-range
Set max limit for `sv_port` and `ec_port` to 65535
2024-02-02 21:53:27 +00:00
furo 2ed631b90a Set max limit for sv_port and ec_port to 65535 2024-02-02 22:08:56 +01:00
Robert Müller e8305ef111 Move CSnapIDPool to separate compilation unit 2024-02-02 20:33:43 +01:00
Dennis Felsing a7097f1ae7
Merge pull request #7884 from furo321/cmdlist
Tell the user about `/cmdlist` when using an unknown chat command.
2024-01-31 08:59:36 +00:00
furo a9df61e1dd Tell the user about /cmdlist when using an unknown chat command. 2024-01-31 00:27:38 +01:00
Robert Müller 2e35250401 Improve client/server launch log messages
Use error log level for error messages. Use info log level explicitly instead of using `dbg_msg`.

Log time taken for initialization in trace level message.
2024-01-30 20:45:23 +01:00
Robert Müller dd44c6cd4d Minor improvement of dummy config variable descriptions 2024-01-28 20:12:22 +01:00
Learath 31b3ac71c2 Fix client/server updates 2024-01-28 19:34:30 +01:00
Dennis Felsing d60852a020
Merge pull request #7868 from Learath2/dd_pr_updater
Fix updater issue. Close #7867
2024-01-28 12:37:42 +00:00
Learath 2470e7489d Fix updater issue. Close #7867 2024-01-28 12:50:54 +01:00
heinrich5991 dcdc66d1df
Merge pull request #7869 from furo321/testcmds-error
Add a error message for when testing commands aren't allowed
2024-01-27 17:59:51 +00:00
furo 633330bcd8 Add a error message for when testing commands aren't allowed 2024-01-27 18:18:32 +01:00
Robert Müller 5d7f2c6e1b Show error messages in console when add_demomarker fails
When there are too many demo markers already or when the previous demo marker is too close.
2024-01-27 13:26:08 +01:00
Robert Müller d5c7488480 Ensure client window is maximized and active after restarting
Add parameter to `shell_execute` to either start the process in the foreground or background on Windows. Previously, all processes were started in the background, because this is desired when starting the server from the client. However, this causes the graphics initialization to fail when restarting the client after updating or with the `restart` command when using Vulkan with windowed and windowed fullscreen mode.

Closes #6578.
2024-01-25 20:52:17 +01:00
Robert Müller c4d512d86e
Merge pull request #7687 from archimede67/editor-better-map-settings
Editor: better map settings input (autocomplete, validation)
2024-01-24 18:17:19 +00:00
Corantin H 0cd002e08c Various fixes to map settings handling 2024-01-23 20:15:30 +01:00
Corantin H aca398f3c9 Added dialog to fix invalid map settings on load 2024-01-23 20:13:57 +01:00
Corantin H 9cc8a28305 Better map settings input (autocomplete, validation) 2024-01-23 20:13:56 +01:00
Robert Müller 9c66a6a147 Remove unused parameter of SetWindowParams function
The `bool AllowResizing` parameter is only passed to other `SetWindowParams` functions but never used in the end, as whether or not resizing is allowed is separately determined based on the value of the `int FullscreenMode` parameter.
2024-01-23 17:49:55 +01:00
Robert Müller 797db31aa1 Fix countries/types filters excluding all servers
Instead of cleaning the countries/types filters based on all available communities' countries/types, only consider the countries/types of currently selected communities. Ensure countries/types are always cleaned when updating the server browser filter in the UI. This fixes that countries/types which are not available for the selected communities were still affecting the server filtering, causing no servers to be shown in some cases.

Closes #7847.
2024-01-22 22:30:15 +01:00
Samuele Radici 79cf3b4e17
Update config_variables.h
text error
2024-01-22 01:33:44 +01:00
Dennis Felsing fca6e0abe3
Merge pull request #7837 from Robyt3/Demo-Recorder-Improvements
Refactor demo recorder usage
2024-01-21 22:39:46 +00:00
Alexander Akulich d0f5ced546 Make http states a enum class and use it across the codebase 2024-01-22 01:06:59 +03:00
Robert Müller 9150f48562 Refactor demo recorder usage
To simplify the usage of the demo recorder, parameters are added to the `IDemoRecorder::Stop` function to control whether the demo file is removed or renamed when stopping the recording.

Ensure demo files of the replay recorder are always removed (except on crashes). The temporary replay demos were previously not removed when being disconnected from a server.

Fix auto demos being stopped and restarted when enabling replays in the settings menu. Now only the replay recorder is stopped/started when necessary.

Fix replay recorder being restarted when setting `cl_replay` variable with console without changing the value.

Remove unnecessary `CClient::m_ButtonRender` variable. Demo rendering is already stopped correctly when reaching the end of the demo without this additional variable.

Remove unused `CDemoRecorder::m_pMapData` variable.
2024-01-21 22:21:56 +01:00
Robert Müller b89e4e8770 Finish CHttpRequest::OnCompletion before updating State()
Ensure that the `CHttpRequest::OnCompletion` function has finished before updating the state which is visible to other threads. Otherwise, threads may try to access the result of a completed HTTP request, before the result has been initialized/updated in the `OnCompletion` function.

Fixes warning due to invalid texture width/height being shown for downloaded skins, because the texture was loaded before the image data was initialized. Closes #7818.

Regression from #7683. Before this, the `OnCompletion` function could also modify the HTTP request's state, which was used to check if loading the skin PNG failed. Instead of doing this, a separate check is added for the skin download task to check that the PNG was loaded successfully.
2024-01-21 14:53:33 +01:00
ChillerDragon e59c9a6450 Only log http requests if `dbg_curl 1`
closed #7823
2024-01-19 12:38:53 +08:00
Robert Müller 4be76f0d08 Add time scale to debug graphs for constant scrolling speed
Store X value (time) for all graph entries in addition to the Y value (FPS, prediction margin etc.). The `CGraph::Add` function adds values to the graph at the current time. The `CGraph::InsertAt` function allows specifying arbitrary X values, as long as the values are inserted in increasing order.

The entries are kept in a ringbuffer and old entries are recycled when it's full. The size of the ringbuffer is configurable for each graph, as the FPS graph needs significantly more buffer because values are added more often.

The scrolling speed of the graphs is fixed by specifying the maximum size of the window of values which should be displayed. For this purpose, a parameter is added to the `CGraph::Scale` function to specify the size of the window which should be rendered in the `CGraph::Render` function. For the FPS graph only the last second is rendered, so small spikes are still noticeable. For prediction and gametime margin graphs the last five seconds are rendered, which should result in a similar scrolling speed as before this change. The debug tuning graph is a special case, where the X values set manually and fixed to 0-127, same as before, instead of being based on the current time.

The graph rendering is made much more efficient by precalculating when the vertex colors need to be updated, to avoid all unnecessary calls to `SetColorVertex`. Additionally, line items are bundled together in an array to avoid calling `LinesDraw` for every individual line item.
2024-01-17 20:43:19 +01:00
Robert Müller c90a52f51c Add CDynamicRingBuffer to avoid specifying size as template 2024-01-17 18:17:08 +01:00
heinrich5991 626b7ca805
Merge pull request #7795 from Robyt3/Menus-Browser-Tab-Icons
Use icons for Internet, LAN and Favorites server browser tabs, use star icon for favorite servers
2024-01-17 13:56:59 +00:00
Robert Müller 0512e65dbe Fix warning title being uninitialized in some cases
For some warnings a random title instead of the default title was shown because it was not initialized.
2024-01-16 20:12:25 +01:00
heinrich5991 bb3bd57c0e
Merge pull request #7683 from Learath2/dd_pr_curlmultifinal
Use curl-multi. Supersedes #5842
2024-01-15 21:54:24 +00:00
Learath2 f5910343e2 Fix CI 2024-01-14 15:37:44 +03:00
Dennis Felsing 8dee975d66
Merge pull request #7744 from Robyt3/Editor-Color-Palette-Pipette
Add color palette and pipette to editor
2024-01-13 22:55:16 +00:00
Robert Müller a873485643 Fix multi-line text selection not rendered correctly anymore
The `CTextCursor::m_LineCount` variable is only updated after the cursor is rendered. For calculating the selection quads we need to check `LineCount` instead, which is updated while the cursor is being rendered. Regression from #7733.
2024-01-13 23:21:13 +01:00
Learath2 bcf86d81f3 Fix CRegister 2024-01-13 15:28:53 +03:00
Robert Müller 89802396a7 Use icons for Internet, LAN and Favorites server browser tabs
Free up space for up to three more server browser tabs of the same size (on 5:4 resolutions), i.e. tabs for configurable communities.

Remove the additional server browser icon tab on the right side. Remove the purely visual Demo and News tabs which were only shown when the respective page is already active. Instead, always show all server browser tabs when offline.
2024-01-13 12:47:11 +01:00
Learath2 6eb51239c9 Fix some clang-tidy issues and UB 2024-01-12 23:27:49 +03:00
Learath2 32e968335b Fix lots of weirdness in updater 2024-01-12 23:19:47 +03:00
Robert Müller 5e510cdbf4 Include limits instead of climits
Consistently use `std::numeric_limits` instead of `INT_MIN` and `INT_MAX`.
2024-01-11 22:24:37 +01:00
Robert Müller 3eeba01578 Remove duplicate cleanup when connecting
The `IClient::Disconnect` function is always called at the beginning of the `IClient::Connect` function. The `IClient::Disconnect` function calls `IClient::DisconnectWithReason`, if the client is not already offline, which performs cleanup of temporary commands and demo recorders already, so the same cleanup in the `Connect` function is unnecessary. An assertion is added to ensure that the client was properly disconnected before connecting. Connecting while the client is already quitting or restarting is now prevented, as the client state cannot be changed once set to quitting or restarting.
2024-01-10 21:48:09 +01:00
heinrich5991 035cb6eab8
Merge pull request #7784 from ChillerDragon/pr_256_welcome
Increase sv_welcome to 256
2024-01-10 16:57:59 +00:00
ChillerDragon 21f6af9d38 Increase sv_welcome to 256 2024-01-10 17:39:24 +01:00
Robert Müller 80a52cae95 Avoid including zlib.h in header file
By adding `CDataFileWriter::ECompressionLevel` to replace usage of zlib internal compression levels in the `CDataFileWriter` API.

Use `std::numeric_limits<int>::max()` instead of `INT_MAX` in one case where the latter was only declared by the transitive zlib include. The `limits` header is already included and its use is more fitting for C++ code.
2024-01-09 19:36:41 +01:00
Dennis Felsing 0dc9495e80
Merge pull request #7781 from HiRavie/master
Improve text outlines
2024-01-09 10:58:08 +00:00
heinrich5991 9de11a5ecd
Merge pull request #7780 from Robyt3/Serverbrowser-Community-Update-Fix
Fix community not set for servers with missing server info
2024-01-08 21:26:34 +00:00
Robert Müller 6bdc73ad3d Fix community not set for servers with missing server info
The server community was only initialized when receiving server info. This caused servers for which no server info is received to be hidden when using the community filter. Now the community filter also works correctly for servers for which no ordinary server info is received, by initializing the community already when adding server entries to the list.

Closes #7776.
2024-01-08 22:07:24 +01:00
Ravie 2e44c02bbc Improve text outlines 2024-01-08 21:52:14 +01:00
Learath2 9b3ebf3f1b Remove debug statement, fix CI 2024-01-07 17:48:48 +03:00
Robert Müller a80d875e85 Improve error log messages when saving settings fails
Log separate messages for `io_sync` error, `io_close` error and general write errors.
2024-01-07 12:24:07 +01:00
Robert Müller 43b1e5cb1f Improve warning popup message when saving settings fails
The message was previously showing an incorrect filename.
2024-01-07 12:23:58 +01:00
Robert Müller 999119c60f Propagate unknown UUID-based map items in map tools
Adapt the `CDataFileReader::GetItem` function so it optionally also returns a `CUuid` for UUID-based map items, including for items with unknown UUIDs where the item type will be `-1`. Adapt the `CDataFileWriter::AddItem` function so it optionally also accepts a `CUuid` which will be used if the item type is `-1`.

The additional checks for invalid map item types in the map tools are removed again and instead the new UUID parameters are used so map items with unknown UUIDs are written back to maps correctly.

Closes #7701.
2024-01-06 21:25:15 +01:00
heinrich5991 c12835bc39 Group NETMSG_RCON_CMD_ADD 2024-01-05 18:10:57 +01:00
Dennis Felsing ca9c4f532a
Merge pull request #7757 from Robyt3/Graphics-LoadTexture-Move
Avoid copying texture memory when possible
2024-01-04 11:32:42 +00:00
Dennis Felsing 4f89a4d3fd
Merge pull request #7749 from archimede67/editor-fix-autosave-crash
Fix crash on editor autosave, add system method `timestamp_from_str`
2024-01-04 11:17:08 +00:00
Robert Müller abc7b602b2 Avoid copying texture memory when possible
Add separate `IGraphics::LoadTextureRawMove` function with non-`const` `void *pData` argument in addition to existing `LoadTextureRaw` function with `const void *pData` argument. The former function takes ownership of the data and avoids copying the texture data into an additional buffer, if the texture data is already in RGBA format. Non-RGBA texture data always needs to be converted and therefore also copied.

The `LoadTextureRaw` function is split into smaller functions to share common code with the `LoadTextureRawMove` function. Alternatively to this, a flag `TEXLOAD_MOVE_DATA` could have been added to the existing `LoadTextureRaw` function, which would have required the use of `const_cast` to free the texture data.
2024-01-03 23:03:04 +01:00
Corantin H 3c9294321e Fix crash on editor autosave
Add system method `timestamp_from_str` and add tests.
Replace `int64_t` with `time_t` to be more consistent.
2024-01-02 23:38:41 +01:00
Robert Müller e27bf7b6c1 Fix crash in assertion handler after client/graphics destroyed
Unset the assertion handler before shutting down the kernel (including graphics) and client. Otherwise the assertion handler itself crashes when assertion errors happen after the graphics/client have been destroyed.
2024-01-02 19:20:57 +01:00
Dennis Felsing 3defe8eb0e
Merge pull request #7703 from BlaiZephyr/fix-cmake-warning
change cast of pointer to uintptr_t
2023-12-30 23:11:53 +00:00
melon 5d35cd8a66 change cast of pointer to uintptr-t 2023-12-30 22:54:47 +01:00
Robert Müller f5e7fa24d6 Add color palette and pipette to editor
Add color palette with up to 8 colors to editor toolbar. The palette colors work like regular color picker buttons, so they open a color picker popup on click and the value can be copied and pasted with Ctrl+Right click and Ctrl+Left click respectively. Less palette colors are shown when not enough space is available (with 5:4 resolutions).

Add color pipette which allows selecting any color displayed on the screen. Selecting a color with the pipette adds the new color to the palette and shifts the other colors to the right. The selected color is also copied to the clipboard immediately. The hotkey Ctrl+Shift+C is added to toggle the color pipette, which allows using the color pipette in popups and dialogs.

The implement this, the function `IGraphics::ReadPixel` and the command `SCommand_TrySwapAndReadPixel` are added to read a specified pixel's color from the backbuffer. Like the screenshot command, this command also requires a swap operation to be performed before the correct pixel color can be read with the Vulkan backend. The `ReadPixel` function therefore accepts a pointer to a `ColorRGBA` that will be filled after the next swap operation.

Closes #7430.
2023-12-30 13:17:30 +01:00
Robert Müller 661339cc64 Optimize allocation of sound sample indices
Replace linear search for free sample index with free list. This brings sound sample index allocation down to constant complexity independent of the number of allocated sounds. On average the time to allocate sound samples is reduced by around 75% (843µs down to 223µs). For perspective, the time to load all default sounds on client launch is reduced by around 15ms (although this does not significantly affect launch time due to threaded loading).
2023-12-29 13:07:04 +01:00
Robert Müller 87191a380e Use sound lock when setting/getting current time of sample
The lock needs to be owned when accessing the sound voices. Calling `IsPlaying` is redundant, as the loops effectively check whether the sample is playing.
2023-12-29 12:35:45 +01:00
Robert Müller 7a84a746e0 Add CSample::TotalTime function 2023-12-29 12:25:39 +01:00
Dennis Felsing 0f1171a501
Merge pull request #7741 from furo321/translate-racefinish
Use 0.7 translation layer for `Sv_RaceFinish` netmessage.
2023-12-29 08:00:19 +00:00
furo 1a94aa6d8a Use 0.7 translation layer for Sv_RaceFinish netmessage. 2023-12-29 08:33:36 +01:00
Robert Müller c9640459e4 Improve editor toolbar anim and grid buttons, add dropdowns
Add dropdown menus for changing animation and grid settings (i.e. animation speed and grid size) instead of conditionally showing more buttons for this directly in the menu bar. This frees up space in the menu bar, which is currently full on 5:4 resolutions.

The icons previously used for the default animation/grid buttons are now used for the main buttons that toggle animation/grid instead of using text.

Support setting lower animation speeds with the plus and minus buttons by adjusting the step size when the animation speed is low.

Support setting arbitrary animation speed by text input.
2023-12-28 17:43:09 +01:00
Robert Müller 72019df288 More efficient text selection rendering
Render one quad for each line of the text selection instead of rendering one quad per selected character.

This increases the average FPS when the console is open and all text is selected by around 10% (from around 849 to around 943 FPS) (on my machine, in release mode).
2023-12-27 21:07:25 +01:00
Robert Müller 32373c0559 Fix color rendering being inconsistent with displayed color values
When normalizing color components in the engine graphics, round the components to the nearest integer instead of rounding down. Otherwise the color that is rendered in color pickers may be off by 1 in any of its RGB components from the color that the color picker displays as text (hex string and individual components). The slightly incorrect color can be confirmed by creating a screenshot or otherwise reading the backbuffer (planned editor pipette feature).

This should not change map rendering, since maps already store quantized RGBA values on which the rounding mode should have no effect. It may however slightly change appearance of colors in all other places (at most +1 in every RGB component).
2023-12-27 13:49:55 +01:00
Robert Müller 0a0e066535 Remove unused FlipImgData parameter from Vulkan backend
The parameter is always set to `false` so the code is unused.
2023-12-26 17:34:02 +01:00
Robert Müller c3689cd9b4 Remove unused VkBufferImageCopy Region variable
According to the Vulkan specification, the struct `VkBufferImageCopy` is used only for `vkCmdCopyBufferToImage` and `vkCmdCopyImageToBuffer`. The variable `Region` is only initialized but not passed to either of those functions.
2023-12-26 14:06:24 +01:00
Dennis Felsing a9c316055f
Merge pull request #7712 from furo321/rework-cfilecollection
Rework `CFileCollection`.
2023-12-26 08:02:40 +00:00
Dennis Felsing f12f789c3a
Merge pull request #7709 from furo321/server-demos-fixes
A few fixes and improvements to server-side auto demos.
2023-12-26 07:58:30 +00:00
furo 5b5ead8356 Rework CFileCollection.
- Use existing functions from `system.h`
- Use sorting from `<algorithm>`
- Don't recall `ListDirectory` for every removal, which caused the client to hang previously with a lot of files.
2023-12-26 03:31:06 +01:00
Robert Müller 4c223a0002 Improve text line spacing and console text selection
Consider line spacing to belong to the previous line when calculating and rendering text selection. Instead of handling spacing between entries separately in the console, also include line spacing for the last line in the height calculation. Pixel align the line spacing in addition to the font size, as previously some gaps between the entries were larger than others due to missing pixel alignment. This allows rendering the text selection in the console smoothly without any gaps between the console entries/lines.

Closes #7617.
2023-12-25 19:11:42 +01:00
furo b1f9137e34 Change path to demos/auto/server. Use same filename format as client. 2023-12-25 17:31:25 +01:00
furo 1c098c2941 Don't use the same demo recorder for auto and manual demos. 2023-12-25 17:29:39 +01:00
Robert Müller c31f82a9e9 Refactor graphics SetColor functions
Reduce duplicate code.

Replace `clampf` function with `NormalizeColorComponent` function that convert color component from `float` to `unsigned char`.

Use `size_t` instead of `int`.
2023-12-23 17:56:52 +01:00
Robert Müller 45ced1f499 Avoid duplicate calculation in QuadsTex3DDrawTL
Only calculate `CurIndex` value once outside of loop instead of calculating it every iteration.
2023-12-21 22:04:40 +01:00
Edgar 2b344f4a01
Merge pull request #7647 from Robyt3/Server-Votes-Config-Improvement
Improve vote config variable descriptions and value range
2023-12-20 10:41:17 +00:00
Learath 1f224344ec Format and bump fake curl 2023-12-18 23:02:00 +01:00
Learath d847b0f60c Fix double request, fix merge error 2023-12-18 22:42:25 +01:00
Learath 1dc8496470 Use curl-multi 2023-12-18 20:06:43 +01:00
Dennis Felsing 173345df74
Merge pull request #7673 from Jupeyy/pr_fix_ms_sample_accuracy
Fix multi sampling accuracy
2023-12-18 07:52:17 +00:00
Jupeyy caecb31751 Fix multi sampling accuracy 2023-12-17 10:39:28 +01:00
Dennis Felsing e689441d14
Merge pull request #7668 from Robyt3/Engine-Notifications-Interface
Add `INotifications` kernel interface
2023-12-16 23:17:18 +00:00
Dennis Felsing 0ce8413570
Merge pull request #7671 from Robyt3/Server-Config-Flags-Cleanup
Remove `CFGFLAG_SAVE` when `CFGFLAG_SERVER` used
2023-12-16 23:16:51 +00:00
Robert Müller eb222ae02a Remove CFGFLAG_SAVE when CFGFLAG_SERVER used
Server variables are currently not saved.
2023-12-16 21:21:03 +01:00
Robert Müller 5f9d6b208c
Merge pull request #7667 from furo321/rest-of-string
Use rest of string parameter for `save_replay`
2023-12-16 18:39:04 +00:00
furo d2efc936cf Use rest of string parameter for save_replay 2023-12-16 19:02:56 +01:00
Robert Müller 013b8dffa5 Add INotifications kernel interface
Add a proper kernel interface `INotifications` for the notifications component instead of using a C style interface.

Add parameter for the application name when initializing notifications to avoid hardcoding the application name.

The implementation for macOS is kept in Objective-C and a TODO is added, as the API we are currently using appears to be deprecated.
2023-12-16 18:15:43 +01:00
Robert Müller b067ccafc6 Improve vote config variable descriptions and value range
Closes #7584.
2023-12-16 18:01:06 +01:00
archimede67 5dbd5a1f49 Added quad alignment/snapping to other quads/points 2023-12-16 01:29:09 +01:00
Edgar 8be0ba3a84
Merge pull request #7655 from def-/pr-discord-build
Fix discord build
2023-12-15 09:32:28 +00:00
Edgar 726ffe35d0
Merge pull request #7654 from def-/pr-curlopt-share
Disable CURL_LOCK_DATA_CONNECT (fixes #7636)
2023-12-15 09:26:34 +00:00
Dennis Felsing 255cf408cd Fix discord build
/home/deen/isos/ddnet/ddnet-source/src/engine/client/discord.cpp: In member function ‘bool CDiscord::Init(FDiscordCreate)’:
/home/deen/isos/ddnet/ddnet-source/src/engine/client/discord.cpp:39:17: error: ‘mem_zero’ was not declared in this scope
   39 |                 mem_zero(&m_ActivityEvents, sizeof(m_ActivityEvents));
      |                 ^~~~~~~~
2023-12-15 00:55:26 +01:00
Dennis Felsing 5ff8697be1 Disable CURL_LOCK_DATA_CONNECT (fixes #7636) 2023-12-15 00:51:02 +01:00
Robert Müller 6a12e209b6 Fix readability-make-member-function-const 2023-12-14 23:38:03 +01:00
Corantin H af77ebac54 Added console search function 2023-12-14 21:58:27 +01:00
BlaiZephyr 6521344eca changed GFX → Gfx 2023-12-13 15:46:49 +01:00
Robert Müller 187120dd31 Ensure network log files are closed when shutting down engine
Previously, the network log files were not explicitly closed unless the `dbg_lognetwork` command is used again manually.
2023-12-12 20:00:52 +01:00
Robert Müller 10b486a6b0 Remove unnecessary use of GetCompletePath
The result `aFullPath` is unused.
2023-12-12 20:00:48 +01:00
heinrich5991 be53d83019 Remove #include <system.h> from one more header 2023-12-12 00:44:46 +01:00
Dennis Felsing 7813cfed6c
Merge pull request #7618 from heinrich5991/pr_ddnet_less_system_h
Make less headers depend on `<base/system.h>`
2023-12-11 23:08:59 +00:00
heinrich5991 05af24a052 Make less headers depend on <base/system.h>
Move a couple of trivial type definitions to `<base/types.h>` instead.
2023-12-11 23:52:23 +01:00
Robert Müller 140fcea667 Avoid using console to reset game settings
Prevent potential dead lock when using `/map` chat command in combination with Teehistorian. Closes #7619. I could not reproduce the issue on Windows though.

This also means resetting game settings should actually be efficient now, because it only involves iterating over all game settings and directly resetting their value.
2023-12-10 11:23:20 +01:00
Dennis Felsing addb3c6980
Merge pull request #7616 from Robyt3/Snapshot-Storage-Separate-Alloc
Separate snapshot storage holder and snap data allocations
2023-12-09 21:45:45 +00:00
Robert Müller 7ae7877248
Merge pull request #7593 from archimede67/console-scrolling
Add ability to scroll in console. Remove pages.
2023-12-09 18:26:32 +00:00
Robert Müller d3cc932a9b
Merge pull request #7393 from archimede67/editor-undo-redo-v2
Editor undo/redo v2
2023-12-09 18:17:38 +00:00
Robert Müller efc451324d Separate snapshot storage holder and snap data allocations
Previously, only one buffer was allocated to store each snapshot holder structure, the snapshot data and alternative snapshot data. This prevents tools like ASAN from detecting some invalid accesses, e.g. to the snapshot holder structure by underflowing the snapshot data pointer. Now three separate allocations are used instead. This hopefully helps debugging #2677.
2023-12-09 19:03:07 +01:00
furo e0b51c2aec Add ability to scroll in console. Remove pages. 2023-12-09 12:20:43 +01:00
heinrich5991 0c33be1692
Merge pull request #7604 from Robyt3/Endianness-Check
Add compile time errors for unsupported endianness
2023-12-08 16:13:17 +00:00
Robert Müller 30df38f926 Add compile time errors for unsupported endianness
We support little and big endian but not PDP endian (Middle-endian).

Define endianness as string `CONF_ARCH_ENDIAN_STRING` to avoid conditional compilation when printing endianness.
2023-12-08 16:57:01 +01:00
Robert Müller 6b547b1388 Fix incorrect map being loaded/downloaded
The `LoadMapSearch` function returns an error message or `nullptr` on success but the condition was incorrectly changed in #7580 so the opposite was checked instead.

Closes #7597.
2023-12-07 17:46:58 +01:00
heinrich5991 f52aa8a61c
Merge pull request #7592 from Robyt3/Protocol-VoteTime-Fix
Fix votes with timeout over 60 seconds not being shown in client
2023-12-05 19:34:41 +00:00
Robert Müller b738f5f9ce Fix votes with timeout over 60 seconds not being shown in client
Setting a vote timeout longer than 60 seconds with `sv_vote_time` caused the vote network messages to be discarded with the error message `weird message 'Sv_VoteSet' (15), failed on 'm_Timeout'` by the client, as the protocol did not allow longer vote timeouts.

This changes the protocol so the vote timeout can be any positive integer although for now the maximum `sv_vote_time` value is changed back to 60 again to preserve compatibility with old clients.

Closes #7583.
2023-12-05 20:12:15 +01:00
heinrich5991 801274ac63
Merge pull request #7580 from Robyt3/Message-Unpack-Check
Add missing unpacker error checks for server and client packets
2023-12-05 19:01:33 +00:00
Robert Müller 4ad0a48a48 Add missing unpacker error checks for server and client packets
Ensure all packets are unpacked correctly before using the unpacked data.

Ensure strings are valid UTF-8 in `CUnpacker::GetString`.
2023-12-05 19:40:27 +01:00
heinrich5991 3607e8e0f2
Merge pull request #7581 from Robyt3/Snapshot-Refactoring
Various minor refactoring of snapshot-related code
2023-12-05 00:36:40 +00:00
heinrich5991 da6dbc9da8
Merge pull request #7582 from Robyt3/Kernel-Refactoring
Support arbitrary number of kernel interfaces, assert on errors
2023-12-05 00:34:33 +00:00
Corantin H 96e4c5f7cd Add editor undo/redo feature 2023-12-04 22:44:20 +01:00
Robert Müller 0c6978f553 Support arbitrary number of kernel interfaces, assert on errors
Support registering arbitrary number of interfaces with `IKernel` instead at most 32.

Assert when incorrect arguments are passed to `IKernel` functions instead of returning a `bool`, which was not being handled in all cases. These functions are not expected to fail expect on programming errors.

Consistently order and format creation and registration of kernel interfaces in client and server.
2023-12-04 18:11:47 +01:00
Robert Müller 0ff2c5b772 Use size_t and add assertions for CSnapshotStorage::Add 2023-12-04 17:59:40 +01:00
Robert Müller f5ed4159b7 Mark functions and pointers as const 2023-12-04 17:59:40 +01:00
Robert Müller 0472808561 Add assertions for CSnapshotDelta::SetStaticsize parameters 2023-12-04 17:59:40 +01:00
Robert Müller 8f9a44514f Remove unnecessary RangeCheck function 2023-12-04 17:59:39 +01:00
heinrich5991 a0d8c6c3c6 Reintroduce m_HaveGlobalTcpAddr
CC #7575
2023-12-04 02:52:48 +01:00
Robert Müller 93d669143d Use nullptr instead of 0 and 0x0 2023-12-03 12:15:22 +01:00
Robert Müller 026ddc3f3a Extract common expression in variable pSnapshot 2023-12-03 12:15:22 +01:00
Robert Müller d70fc84e38 Properly initialize all CClient member variables
Additionally, ensure snapshots are cleared and dummy is disconnected when disconnecting programatically with `DisconnectWithReason`.

Add `NETADDR_ZEROED` and `UUID_ZEROED` for more convenient initialization without using `mem_zero`.
2023-12-02 18:33:46 +01:00
furo d9a726eb48 Stop all recording of server demos on shutdown. 2023-12-02 11:10:20 +01:00
Dennis Felsing 01847457a9
Merge pull request #7571 from BurnyLlama/fix-demo-record
Added check if demo recorder is already active.
2023-12-01 23:01:04 +00:00
Dennis Felsing d452372b13
Merge pull request #7567 from Robyt3/Windows-Ignore-Invalid-UTF16
Check for invalid unicode in filenames etc. on Windows
2023-12-01 23:00:00 +00:00
BurnyLlama 0e684e10d2 Added check if demo recorder is already active. Closes #7568. 2023-12-01 23:06:13 +01:00
Emir Marincic eba86204db
Merge pull request #7552 from Robyt3/Config-Refactoring
Refactor config manager, move config variable handling
2023-12-01 19:34:44 +00:00
Robert Müller 8b589f3c49 Check for invalid unicode in filenames etc. on Windows
Add stricter error handling when converting between UTF-16 (wide characters) and UTF-8 (multi-byte) on Windows.

The `windows_wide_to_utf8` function now returns an `std::optional`, which will be empty if the argument contains invalid UTF-16. Files/folders with names containing invalid UTF-16 are now ignored on Windows. It was previously not possible to use these files either, as converting their names to UTF-8 changed the invalid codepoints to unicode replacement characters.

The `windows_utf8_to_wide` function now fails with an assertion error if the argument contains invalid UTF-8, as this should never happen.

Closes #7486.
2023-12-01 20:27:03 +01:00
heinrich5991 21cfb01ec3
Merge pull request #7515 from furo321/racefinish-message
Add finish info messages from 0.7
2023-12-01 16:13:06 +00:00
Robert Müller 1d7c0fad49 Check SHA256 of downloaded maps and community icons
Add `CHttpRequest::ExpectSha256` function to specify expected SHA256 for HTTP downloads. If the download completes with a different SHA256 hash than expected, then the download fails and the file is deleted.

Closes #7485.
2023-11-30 21:31:48 +01:00
Robert Müller 159ddf5534 Refactor config manager, move config variable handling
Move all code for handling of config variables from console to config manager. The console no longer depends on the config manager, instead the config manager now depends on the console.

Add `struct`s to manage config variables of different types (int, color and string). The config manager now keeps a list of all config variables, so usage of the preprocessor can be avoided except for code to initially create all config variables. Additionally, a separate list of just the game config variables (config variables with `CFGFLAG_GAME`) is kept to optimize the `ResetGameSettings` function, as this function is called whenever connecting to a server and should be fast. Previously, this function was even less efficient because it preformed a linear search for every individual game config variable to find the respective command data.

Move console commands that opperate only on config variables (`reset`, `toggle` and `+toggle`) to config manager. Ensure that these commands only opperate on the desired config variables (client or server, respectively) by checking `IConsole::FlagMask`.

Add `IConfigManager::SetReadOnly` function to set/unset config variables as read-only instead of manually overriding the command handlers for the `sv_rescue` and `sv_test_cmds` config variables. This also fixes that read-only config variables could still be changed by using the `reset` command. A console message is now printed when trying to change a read-only config variable. Removing the special handling for these two config variables is additionally useful so the console does not need to keep a pointer to config values and manager.

Use a `CHeap` for the config variables, their help texts and the previous values of string config variables to avoid many separate allocations as well usage of static variables. Also use the heap to store the unknown commands instead of using `std::string`s.

Properly trigger command chain when resetting config variables with the `reset` command and when resetting game settings on map loading. Closes #7461.

Format default value for color variables as RGB/RGBA hex with dollar sign prefix. Closes #5523.

Add log message when using `reset` with a variable that does not exist. Use `log_error` instead of `dbg_msg` when saving config file fails.

Support unlimited number of config save callbacks instead of at most 16. The code also becomes more readable by using an `std::vector` instead of a fixed-size array and a separate num variable.

Consistently name `MACRO_CONFIG_*` parameters when declaring the macros.

Add `IConsole::CMDLINE_LENGTH` constant to represent the maximum length of the console input and thereby reduce usage of magic numbers for buffer sizes.
2023-11-30 20:26:00 +01:00
Robert Müller 1c2903b0b4 Remove unused enum literal MAX_PRINT_CB 2023-11-29 20:42:23 +01:00
Robert Müller 5aa9003180 Remove unused ver parameter of MACRO_INTERFACE 2023-11-28 21:46:03 +01:00
furo eff6361c38 Add settings for info messages 2023-11-26 17:30:49 +01:00
Dennis Felsing c90899cc29
Merge pull request #7549 from Robyt3/Memheap-Refactoring
Refactor `CHeap`
2023-11-26 13:36:30 +00:00
Robert Müller 591c08cf34 Use static_casts instead of C style, remove unnecessary casts 2023-11-26 13:40:01 +01:00
Robert Müller 7a142df580 Move variable declarations closer to usages 2023-11-26 13:29:02 +01:00
Robert Müller ec6d7b48bf Use nullptr instead of 0x0 2023-11-26 13:20:56 +01:00
Robert Müller 41d2c80f21 Add templated CHeap::Allocate function
Add a templated `CHeap::Allocate` function to simplify memory allocation of objects using `CHeap`. The function uses perfect forwarding to construct objects with the specified arguments.
2023-11-26 13:09:23 +01:00
Corantin H fee9b986fb Added possibility to edit chat size and width. Refactored chat preview code. 2023-11-26 12:27:56 +01:00
Dennis Felsing 3e2f8f8a44
Merge pull request #7543 from Robyt3/Console-Interface-Cleanup
Minor refactoring of `IConsole`
2023-11-25 22:21:40 +00:00
Dennis Felsing 0601794801
Merge pull request #7547 from Robyt3/Server-Nameban-Clan
Also apply name bans to clans, trim space from clans, refactor name bans, move code to separate class `CNameBans`
2023-11-25 22:18:46 +00:00
Robert Müller 794e6b750b Also apply name bans to clans, trim space from clans
Apply the name bans system also to player clans, meaning players joining with banned clan names are kicked and changing the clan to a banned name while ingame has no effect.

Additionally, trim UTF-8 whitespace from beginning and end of clan. This was already done for player names but not for clans.

Closes #7516.
2023-11-25 23:00:57 +01:00
Robert Müller 8156052cc1 Refactor name bans, move code to separate class CNameBans
Unify all code for name bans in new class `CNameBans` in the existing `name_ban.cpp/h` files. The previously global function `IsNameBanned` is now the member function `CNameBans::IsBanned`. The existing name ban tests are extended for the `CNameBans` class.

Move `CNameBan` constructor definition to source file to avoid including `system.h` in the header file. Use `bool` instead of `int` for `m_IsSubstring`. Reorder `CNameBan` constructor arguments and remove unnecessary default value.
2023-11-25 22:28:54 +01:00
Robert Müller 42b952bc6c Move config variables to config_variables.h, remove variables.h
The contents of `variables.h` are moved to `config_variables.h` instead of being included with the preprocessor. The file `variables.h` is removed, so all config variables can be found in a single file instead of being spread over two files without any clear structure. The original declaration order of config variables is preserved. The unnecessary header guard `GAME_VARIABLES_H` from `variables.h` is removed, as the comment `// This file can be included several times.` already serves the same purpose of silencing the header guard check.

A comment is added at the end of `config_variables.h` to mark the location where modders should ideally declare all of their own config variables to avoid merge conflicts with us in the future.

Closes #7472.
2023-11-25 16:40:55 +01:00
Robert Müller e410dd85f8 Replace IConsole::m_Cheated variable with Cheated getter
Interfaces should not have member variables, so the variable is moved to `CConsole`. Only a getter `IConsole::Cheated` is added because the cheated state of the console is never reset.
2023-11-25 11:43:42 +01:00
Robert Müller c216567431 Add IConsole::FlagMask getter function
So other interfaces/components can check which console commands are active. In particular this will be used to refactor the config manager. The respective setter function already exists.
2023-11-25 11:42:56 +01:00
furo 9627e7b3a8 Simplify TickSpeed getters 2023-11-23 15:33:30 +01:00
furo b9fd612ef5 Replace 50 with SERVER_TICK_SPEED or TickSpeed() 2023-11-23 14:42:30 +01:00
Robert Müller 61c201c37c Fix string game settings not being reset correctly
Due to swapped `str_copy` arguments, the old value for string game variables was being overridden by the current value instead of the other way around in `CConsole::ResetGameSettings`.

There are currently no string game settings affected by this.
2023-11-22 23:16:57 +01:00
Robert Müller d331bcb496 Fix color game settings not being reset correctly
Handling color settings the same as int settings in `CConsole::ResetGameSettings` is not correct, as this causes the color variable data to be cast to int variable data.

There are currently no color game settings affected by this.
2023-11-22 23:12:56 +01:00
Robert Müller 48bfecc0d3 Ensure debug dummies are not included in server info
Also fix normal clients being disconnected/controlled like debug dummies.

Closes #7523.
2023-11-22 19:23:38 +01:00
heinrich5991 f95b0f163f
Merge pull request #7520 from Robyt3/Packer-Improvements
Minor improvements to `CPacker` and `CUnpacker`
2023-11-22 16:44:30 +00:00
Robert Müller ab4e737a57 Fix misaligned int loads in CUnpacker::GetUncompressedInt
Use `mem_copy` instead of dereferencing potentially misaligned address as `int`.
2023-11-21 21:57:06 +01:00
Robert Müller 51e3c37c03 Use mem_copy instead of for-loop in CPacker::AddRaw
Using `memcpy` is faster, assuming the compiler doesn't already transform the loop to `memcpy` automatically.
2023-11-21 21:49:29 +01:00
Robert Müller 0d8a0d3b1d Dynamically connect/disconnect debug dummies, cleanup
Call expected server callback functions to simulate clients dynamically connecting and disconnecting when changing the `dbg_dummies` variable. This makes the debug dummies more useful for debugging. Previously, the debug dummies were considered invalid clients, whereas they are now considered to be ingame, so they should behave mostly like real clients being connected to the server. The debug dummies also have correct client names now, e.g. "Debug dummy 42".

The game server code is cleaned up by moving all special handling for debug dummies to the engine server function `CServer::UpdateDebugDummies`.

The left/right direction inputs for debug dummies are now properly added to the client input array, so their input handling should be consistent with normal clients, which fixes some inconsistent prediction with debug dummies.
2023-11-21 19:59:20 +01:00
Dennis Felsing 35f071b021
Merge pull request #7513 from Robyt3/ImageLoader-Greyscale-Fix
Handle all color channel counts in image loader, refactoring
2023-11-20 21:55:00 +00:00
Robert Müller 29a32b7acc Use const char * instead of char const * consistently
Both are equivalent. Seems to already be used consistently for all other types.
2023-11-20 22:26:19 +01:00
Robert Müller bcae7da6b4 Handle all color channel counts in image loader
Greyscale images with alpha channel (i.e. channel count = 2) were incorrectly handled as RGBA images, causing the client to crash when loading such images. Now the images can successfully be loaded with the image loader, but the client still only supports loading RGB and RGBA images like before.
2023-11-20 21:58:29 +01:00
Robert Müller f0a17435e6 Ensure freed image buffer is not propagated
The image data is freed when the image format is unsupported, but `CImageInfo::m_pData` would still point to the freed memory, so double-frees were possible.
2023-11-20 21:58:29 +01:00
Robert Müller 82b75ddfe0 Improve error log messages for PNG loading 2023-11-20 21:58:29 +01:00
Robert Müller 0427dfff2e Use bool instead of int 2023-11-20 21:58:29 +01:00
Robert Müller 15e4f9a886 Remove remaining obsolete // ignore_convention comments 2023-11-20 21:58:29 +01:00
Dennis Felsing d11a271f45
Merge pull request #7506 from trml/pr_predmargin_simplify
Make prediction margin take effect instantanously
2023-11-19 21:56:40 +00:00
dobrykafe 904abae6ac replace sizeof x with sizeof(x) 2023-11-19 22:36:47 +01:00
trml 717aad2677 Make prediction margin take effect immediately 2023-11-19 19:52:39 +01:00
heinrich5991 b4567d6e25
Merge pull request #7502 from Robyt3/Browser-CommunityFilter-Fixes
Prevent community filters excluding all elements, fix server browser update on community filter change via console
2023-11-19 16:24:52 +00:00
Robert Müller aba67f46ee Prevent community filters excluding all elements
Ensure that community/country/type filters do not exclude all allowed elements, which can happen when a previously selected community is not available anymore or when arbitrary community filter values are set with the console.
2023-11-19 15:34:33 +01:00
heinrich5991 a5b72fef42 Allow antibot to kick people 2023-11-19 14:59:14 +01:00
heinrich5991 28b00892f6 Allow more complex interaction with the antibot via the console
Allows the antibot to receive arbitrary console commands.
2023-11-19 04:41:56 +01:00
Dennis Felsing 97d64cdfea
Merge pull request #6256 from heinrich5991/pr_ddnet_typesafe_mem_zero
Typesafe `mem_zero` function
2023-11-18 23:00:48 +00:00
heinrich5991 b951734c03 Don't allow mem_zero for nontrivial types
Initialize nontrivial types with a constructor instead. Make the
compiler aware that some of our constructors are indeed trivial.

This allows `mem_zero` calls to actually always zero the memory.
2023-11-18 22:55:17 +01:00
Robert Müller ddf935795d Fix inverted community parsing conditions 2023-11-18 22:55:08 +01:00
Chairn 6e629e1deb Type safe mem_zero function (fixes #5228)
Partially replaces #5690.
POD types are just memset. Other types are either destructed if not
trivial and/or constructed if not trivial. Types need to have a default
constructor.
Virtual classes can be mem_zeroed only if they already have been
constructed, otherwise it is UB.
2023-11-18 22:47:22 +01:00
Robert Müller ee04cd4dda
Merge pull request #7459 from heinrich5991/pr_ddnet_community_json
Add icon URL, remove `servers-key`/`ranks-key` from community JSON
2023-11-18 21:08:23 +00:00
heinrich5991 c7cd281aff Add icon URL, remove servers-key/ranks-key from community JSON
Previously:

```json
{
  "ddnet": {
    "name": "DDraceNetwork",
    "servers-key": "servers",
    "ranks-key": "maps",
    "icon-sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b"
  }
}
```

Now:
```json
[
  {
    "id": "ddnet",
    "name": "DDraceNetwork",
    "icon": {
      "sha256": "162313eeb954e34495ad03066fee1418ed3c963e76cc83dff993e1c7856c742b",
      "url": "https://info.ddnet.org/icons/ddnet.png"
    },
    "ranks": [
      …
    ],
    "servers": {
      …
    }
  }
]
```

Special case `ddnet` to look for the `servers`, `maps` in the top-level
and `kog` to look for `servers-kog` in the top-level.
2023-11-18 21:52:51 +01:00
Robert Müller fcddc165b2 Remove unnecessary mem_zero of ringbuffer memory
Zeroing the entire ringbuffer memory is unnecessary and inefficient. Only the first item in the ringbuffer has to be initialized properly.

It's unlikely that existing code depends on allocated memory being zeroed, as recycled ringbuffer items where never zeroed.
2023-11-18 17:40:36 +01:00
Robert Müller 5c7bb58457 Ensure filenames are valid UTF-8 on Unix
On Unix, the encoding of filenames is unspecified, although UTF-8 is likely used in most cases. Detecting and converting from several possible encodings to UTF-8 would be too much effort, considering that most systems already use UTF-8 per default. Therefore, any filenames which are not valid UTF-8 will be ignored when listing directories with `fs_listdir(_fileinfo)`, `fs_storage_path` will fail if the storage location is not valid UTF-8 and `fs_getcwd` will fail if the current working directory is not valid UTF-8. Paths specified in `storage.cfg` must also be valid UTF-8.

On Windows, we already ensure that all filenames are converted to UTF-8.
2023-11-17 18:55:28 +01:00
ChillerDragon 9e27a5a107 Fix unused variabled m_WasRecording 2023-11-15 12:11:58 +01:00
Dennis Felsing e74e6770c3
Merge pull request #7325 from Robyt3/Browser-Community-Filter
Add community server filter and icons, remove DDNet and KoG tabs
2023-11-12 00:00:05 +00:00
Dennis Felsing d716210e31
Merge pull request #7408 from Jupeyy/pr_tile_border_shader
Switch to a fragment shader solution for border tile rendering
2023-11-11 23:02:34 +00:00
Dennis Felsing aefa52c6b9
Merge pull request #7432 from Robyt3/Base-Standard-Mutex-Wrapper
Add `CLock` wrapper for `std::mutex` to replace `lock_*` functions, use `CLock` instead of `std::mutex`, add thread-safety annotations
2023-11-11 22:07:02 +00:00
furo 6599b7e14b Save unknown commands from settings_ddnet.cfg 2023-11-11 19:09:13 +01:00
Robert Müller 10470046b7 Use CLock instead of std::mutex, add thread-safety annotations
Use `CLock` and `CLockScope` instead of `std::mutex` and add clang thread-safety analysis annotations everywhere except for usages in engine graphics and video, as those usages also involve `std::condition_variable`.

Fix lock not being unlocked on all code paths in `CFutureLogger::Log`, which is caught by the static analysis.
2023-11-11 00:09:17 +01:00