6697: Minor cleanup of `CGraphics_Threaded::GetVideoModes` r=def- a=Robyt3
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6696: Allow `username:password` for reserved slots r=Learath2 a=heinrich5991
This is a more common syntax.
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
6695: Improve snapping of draggers r=def- a=trml
These are some things i noticed could be improved while attempting to add prediction for draggers:
Sets dragger owner to be the dragged player (this also means alpha will be applied).
It also ensures that the dragger that is sent for the players own team always has the same netobject id, and additionally that an idle dragger is always sent if no one in the players owns team is dragged (before it used to be that an idle dragger wasn't sent if _any_ player was dragged, including other teams visible to the player). The first one helps with keeping track of the dragger between snapshots (and simplifies prediction), while the second one ensures that a player still sees a dragger after show_other_alpha is applied to other teams.
Also fixes snapped order of to/from pos.
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: trml <trml@users.noreply.github.com>
6694: Add "No server selected" message to server details r=def- a=Robyt3
Otherwise the tab is completely empty when no server is selected.
![screenshot_2023-06-01_22-27-29](https://github.com/ddnet/ddnet/assets/23437060/b7d652cd-73de-45b7-a8fb-f16fa7f916e0)
## Checklist
- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6692: Add script to check for unused config variables to CI, remove unused config variables r=def- a=Robyt3
Add `scripts/check_config_variables.py` which checks if config variables defined in `src/game/variables.h` and `src/engine/shared/config_variables.h` are unused.
Remove unnecessary usage of the preprocessor that was causing false positives for the check.
Remove unused config variables:
- `dbg_focus`
- `gfx_tune_overlay`
- `sv_external_port`
- `dbg_pref`
- `dbg_stress_network`
- `sv_score_folder`
- `sv_rank_cheats`
## Checklist
- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Add `scripts/check_config_variables.py` which checks if config variables defined in `src/game/variables.h` and `src/engine/shared/config_variables.h` are unused.
6691: Regenerate key lists with latest SDL version r=def- a=Robyt3
Update `SDL_scancode.h` which is used by `gen_keys.py` to generate the list of keys enum (`keys.h`) and the list of key names (`keynames.h`) and regenerate the lists.
This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Update `SDL_scancode.h` which is used by `gen_keys.py` to generate the list of keys enum (`keys.h`) and the list of key names (`keynames.h`) and regenerate the lists.
This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).
6657: Allow rcon users access to reserved slots r=def- a=Learath2
<!-- What is the motivation for the changes of this pull request? -->
The password for the reserved slots keep getting leaked. Hopefully this will fix the issue.
<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [x] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Learath <learath2@gmail.com>
6686: Fix switch prediction on solo server r=def- a=trml
Fixes#6644 by sending switch state for team 0 on sv_solo_server 1 to match the team of the clients own character, and by not predicting other characters/entities when in solo.
<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: trml <trml@users.noreply.github.com>
6688: Fix flashing window not working with newer SDL versions r=Jupeyy a=Robyt3
Minimum SDL version 2.0.16 is required for `SDL_FlashWindow`. The SDL version schema changes after version 2.0.22 to 2.24.0 etc. (minor version is used instead of patchlevel) which was causing the condition that checks for minimum version 2.0.16 to not work correctly with newer SDL versions.
Closes#6687.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Minimum SDL version 2.0.16 is required for `SDL_FlashWindow`. The SDL version schema changes after version 2.0.22 to 2.24.0 etc. (minor version is used instead of patchlevel) which was causing the condition that checks for minimum version 2.0.16 to not work correctly with newer SDL versions.
Closes#6687.
6665: Fix ordering of unfinished/unconnected tees r=heinrich5991 a=Learath2
<!-- What is the motivation for the changes of this pull request? -->
I thought there was initially a strict weak ordering issue here but upon further inspection noticed it's fine.
However, people with negative score were getting sorted undeterministically, basically every unfinished tee was treated as equal since `!comp(a, b) && !comp(b, a)`. Sorting them by name was the intention.
I also got rid of the old `INT_MIN` "hack", it was only there to make the code shorter and it's no longer possible with the newly flipped sign without flipping it back on the client which is ugly.
Also made `ScoreKind` `const`, not sure if any compiler optimizes on that but why not? If we ever move to C++20 this could be a generic lambda instead where we can template `ScoreKind` and make sure it gets optimized properly.
Tidbit: I treated score 0 as a normal score, I'm not sure what it implies.
<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Learath <learath2@gmail.com>
Show begin time, end time and length of demo cut in popup.
Replace demo slice error/confirm messages with generic popups.
Improve layout. Remove unnecessary empty space.
Sometimes the calculated popup width and height do not perfectly match the width and height when the text is rendered, so a small nudge value is added to prevent cases where this was noticeable.
6679: Show error instead of replacing existing demo when renaming r=def- a=Robyt3
Renaming a demo to the name of another demo would overwrite the target demo. Now an error message popup is shown instead to prevent this.
After a demo rename error popup is shown, return to the demo rename popup instead of closing the popup.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Renaming a demo to the name of another demo would overwrite the target demo. Now an error message popup is shown instead to prevent this.
After a demo rename error popup is shown, return to the demo rename popup instead of closing the popup.
6677: Use icons for refresh and connect buttons, refactor `DoButtonMenu` r=def- a=Robyt3
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes#5605. Closes#5878.
The "Refreshing..." text is replaced with combined refresh and ellipsis icons.
Alpha and saturation of the green color of the connect button are increased.
Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.
Screenshots:
- Before:
![screenshot_2023-05-27_19-52-37](https://github.com/ddnet/ddnet/assets/23437060/3bf27f53-b034-4147-97ee-5c24a5b68457)
- After:
![screenshot_2023-05-27_19-51-07](https://github.com/ddnet/ddnet/assets/23437060/702a9c1c-be07-4cd6-94b5-b4b0fd9b4fa1)
- After (when refreshing):
![screenshot_2023-05-27_19-56-15](https://github.com/ddnet/ddnet/assets/23437060/0a456467-6550-4ce7-b756-56e3bbbc4f43)
## Checklist
- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
6678: Fix undefined behavior in `CSnapshotDelta::DiffItem` r=Chairn a=Robyt3
Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.
```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```
See #6650.
<!-- What is the motivation for the changes of this pull request? -->
<!-- Note that builds and other checks will be run for your change. Don't feel intimidated by failures in some of the checks. If you can't resolve them yourself, experienced devs can also resolve them before merging your pull request. -->
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Cast `int`s to `unsigned` before subtracting to ensure that integer wrapping is being used instead of causing undefined behavior. Same as in `UndiffItem`.
```
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/master/src/base/math.h:16:40 in
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 256 - -2147483648 cannot be represented in type 'int'
0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
5 0x7fc51ec27d09 in __libc_start_main csu/../csu/libc-start.c:308:16
6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
src/master/src/engine/shared/snapshot.cpp:206:21: runtime error: signed integer overflow: 1645289600 - -2139062144 cannot be represented in type 'int'
0 0x7650b7 in CSnapshotDelta::DiffItem(int const*, int const*, int*, int) src/master/src/engine/shared/snapshot.cpp:206:21
1 0x765cea in CSnapshotDelta::CreateDelta(CSnapshot*, CSnapshot*, void*) src/master/src/engine/shared/snapshot.cpp:323:7
2 0x51a0e2 in CServer::DoSnapshot() src/master/src/engine/server/server.cpp:964:36
3 0x537486 in CServer::Run() src/master/src/engine/server/server.cpp:2818:6
4 0x4feeb7 in main src/master/src/engine/server/main.cpp:190:21
5 0x7efd50c4ed09 in __libc_start_main csu/../csu/libc-start.c:308:16
6 0x4c3819 in _start (servers/DDNet-Server-ubsan+0x4c3819)
```
See #6650.
Use less space for refresh and connect buttons to improve layout with 5:4 and 4:3 resolutions. Closes#5605. Closes#5878.
The "Refreshing..." text is replaced with combined refresh and ellipsis icons.
Alpha and saturation of the green color of the connect button are increased.
Move `CMenus::DoButtonMenu` to `CUI::DoButton_Menu`. Simplify usage by adding `SMenuButtonProperties` parameter object for all optional arguments. Remove unused `ColorHot` parameter.
6673: Clear Victim Team render info on skin changes r=Robyt3 a=Jupeyy
fixes#6662
This should fix the issue, I guess, by simply clearing the render info. I can't find an easy way to restore the original skins of the team members as we don't save their IDs.
I couldn't directly trigger the assert, but I could certainly see the skin getting invalid when killen the team and switch to "vanilla only skins". (Edit: When triggering it a few times I got the assert)
The code generally looks a bit hacky. Maybe the original author can refactor it a bit
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
6676: Show GPU info (if available) in assert r=Robyt3 a=Jupeyy
first part of #6672
![image](https://github.com/ddnet/ddnet/assets/6654924/0e9aec5a-528a-4e7a-a3fa-93108e55597e)
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
6675: Wait for graphics thread's current execution to end before triggering… r=Robyt3 a=Jupeyy
… the assert dialog
fixes#6674
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
6671: Ensure line inputs are deactivated when they are not rendered r=def- a=Robyt3
Check if the active line input was not rendered and deactivate it in that case.
This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.
This was causing the IME candidate list to be rendered ingame after closing the menu. Closes#6666.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Check if the active line input was not rendered and deactivate it in that case.
This can happen e.g. when an input in the ingame menu is active and the menu is closed or when switching between menu and editor with an active input.
This was causing the IME candidate list to be rendered ingame after closing the menu. Closes#6666.
6670: Delete selection with backspace/delete regardless of word mode r=def- a=Robyt3
Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.
## Checklist
- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)
Co-authored-by: Robert Müller <robytemueller@gmail.com>
Also delete the lineinput selection when pressing backspace/delete and the key for skipping words (Ctrl/GUI key, Alt on macOS) is held. This is consistent with the behavior in other applications.