Commit graph

12078 commits

Author SHA1 Message Date
Robert Müller 3c1cd89ae6 Append file extension before checking for identical cut demo filename
The file extension needs to be appended to the cut demo name before checking whether the name matches the currently playing file, otherwise the "Please use a different name" error message is not shown and instead the "File already exists" question is shown.
2022-10-24 19:53:42 +02:00
Robert Müller be45604354 Fix demo file not being closed after showing error message
When entering the name of an existing demo file into the Slice demo dialog and pressing the Ok button twice, the file handle that's used for checking for the demo file's existence is not closed, hence the cut demo file cannot be deleted until the client is closed.
2022-10-24 19:48:44 +02:00
Robert Müller 5c11937543 Use fegetenv/fesetenv instead of _control87 on Windows
As `_control87` doesn't seem to be available for some MinGW compilers.

Closes #5969.
2022-10-23 10:59:53 +02:00
Robert Müller c0da3b93e4 Fix IME not being deactivated when editor is closed
Previously the IME was not deactivated when the editor is closed, so `SDL_TEXTINPUT` events where still being reported ingame after exiting the editor.
2022-10-21 21:31:21 +02:00
Robert Müller 75326e8393 Fix text input not working when entering editor with bind
When entering the editor with a custom bind (e.g. `bind e "cl_editor 1"`) or when opening it from the console while also immediately closing the console (e.g. with `cl_editor 1; toggle_local_console`), the IME state was not properly set to active, so SDL did not report any `SDL_TEXTINPUT` events, leading to editboxes in the editor not receiving any text.

The is fixed by always enabling the IME state when entering the editor, which was previously only done when using the Ctrl+Shift+E hotkey or coincidentally when the editor is activated while the IME is already active, i.e. when the menu or console is open.

Closes #5095.
2022-10-21 21:20:10 +02:00
Robert Müller f5a16c1c77 Fix crash in editor when using up/down keys on empty images list 2022-10-21 20:28:30 +02:00
Robert Müller 4a683e024a Fix crash in editor when using up/down keys on empty sounds list 2022-10-21 20:28:00 +02:00
bors[bot] 8feba4ecf6
Merge #5966
5966: Fix duplicate description of cl_default_zoom_level r=heinrich5991 a=def-

Since #5894 is not landing

<!-- 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

- [ ] 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: Dennis Felsing <dennis@felsin9.de>
2022-10-21 11:53:55 +00:00
bors[bot] 9c6a187ee9
Merge #5965
5965: Don't print max value when there is none (fixes #5953) r=edg-l a=def-

<!-- 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: Dennis Felsing <dennis@felsin9.de>
2022-10-21 07:35:19 +00:00
Dennis Felsing eb27b26d8d Also ignore min value 2022-10-21 00:34:44 +02:00
Dennis Felsing f7bc58b056 Fix duplicate description of cl_default_zoom_level
Since #5894 is not landing
2022-10-21 00:12:07 +02:00
Dennis Felsing 26a08360f8 Don't print max value when there is none (fixes #5953) 2022-10-21 00:09:30 +02:00
Robert Müller 73fe4e6ed4 Use str_copy instead of snprintf to copy strings 2022-10-20 20:56:58 +02:00
Robert Müller c4cf26ea81 Replace atol usages with str_toint, as type is int anyway
As `atol` does not provide any way to detect errors and can cause undefined behavior on errors, i.e. when the result cannot be represented as a `long`.

The `atol` function was only used in `priv_net_extract` for parsing the port, which is an `int` and not a `long`, so the existing `str_toint` is used instead.

References:

- https://wiki.sei.cmu.edu/confluence/display/c/ERR07-C.+Prefer+functions+that+support+error+checking+over+equivalent+functions+that+don%27t
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/atol.html
2022-10-20 20:54:01 +02:00
Robert Müller 1469e88a79 Replace atof usages with strtod (str_tofloat wrapper)
As `atof` does not provide any way to detect errors and can cause undefined behavior on errors, i.e. when the result cannot be represented as a `float`.

References:

- https://wiki.sei.cmu.edu/confluence/display/c/ERR07-C.+Prefer+functions+that+support+error+checking+over+equivalent+functions+that+don%27t
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/atof.html
2022-10-20 20:30:12 +02:00
Robert Müller 6b043bf3b2 Replace atoi usages with strtol (str_toint wrapper)
As `atoi` does not provide any way to detect errors and can cause undefined behavior on errors, i.e. when the result cannot be represented as an `int`.

References:

- https://wiki.sei.cmu.edu/confluence/display/c/ERR07-C.+Prefer+functions+that+support+error+checking+over+equivalent+functions+that+don%27t
- https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoi.html
2022-10-20 20:30:11 +02:00
bors[bot] 53080e3e14
Merge #5938
5938: Hex Values in the editor's info feature r=heinrich5991 a=VoxelDoesCode

Add an option when the info button is selected, you can show the hexadecimal values for a tile rather than 1-255. This has some benefits, as it aligns in a perfect grid. Can help with making and test automappers.

![image](https://user-images.githubusercontent.com/95713843/195209286-82dd04d5-f469-4932-bbd7-93ec3fd32f99.png)

## 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
- [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: VoxelDoesCode <bluheadcat@gmail.com>
2022-10-19 22:47:35 +00:00
heinrich5991 dcd76fd3e1 Add support for Rust code in DDNet
The glue is done using the [cxx crate](https://cxx.rs/) on the Rust
side.

As a proof-of-concept, only a small console command (`rust_version`)
printing the currently used Rust version was added.

You can generate and open the Rust documentation using
`DDNET_TEST_NO_LINK=1 cargo doc --open`.

You can run the Rust tests using `cmake --build <build dir> --target
run_rust_tests`, they're automatically included in the `run_tests`
target as well.

Rust tests don't work on Windows in debug mode on Windows because Rust
cannot currently link with the debug version of the C stdlib on Windows:
https://github.com/rust-lang/rust/issues/39016.

---

The stuff in `src/rust-bridge` is generated using
```
cxxbridge src/engine/shared/rust_version.rs --output src/rust-bridge/engine/shared/rust_version.cpp --output src/rust-bridge/engine/shared/rust_version.h
cxxbridge src/engine/console.rs --output src/rust-bridge/cpp/console.cpp --output src/rust-bridge/cpp/console.h
```
2022-10-19 23:46:06 +02:00
Jupeyy b70fc39571 fix skin click ptr 2022-10-19 20:18:43 +02:00
Robert Müller 25e6eed0e8 Fix compilation with VS2022 with exception handling enabled
By moving the calling convention `APIENTRY`, which expands to `__stdcall`, inside the parenthesis.

```
Severity	Code	Description	Project	File	Line	Suppression State
Error	C2143	syntax error: missing ')' before '('	engine-shared	src\base\system.cpp	4242
Warning	C4229	anachronism used: modifiers on data are ignored	engine-shared	src\base\system.cpp	4242
Error	C2059	syntax error: ')'	engine-shared	src\base\system.cpp	4242
Error	C2059	syntax error: ')'	engine-shared	src\base\system.cpp	4242
Error	C3536	'exception_log_file_path_func': cannot be used before it is initialized	engine-shared	src\base\system.cpp	4246
Error	C2446	'==': no conversion from 'nullptr' to 'int'	engine-shared	src\base\system.cpp	4246
Error	C2064	term does not evaluate to a function taking 1 arguments	engine-shared	src\base\system.cpp	4249
```
2022-10-16 18:16:58 +02:00
bors[bot] 24207b741c
Merge #5947
5947: Fix client crash when server does not send gameinfo r=def- a=Robyt3

As reported by `@ChillerDragon` on Discord.

## 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
- [X] 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: Robert Müller <robytemueller@gmail.com>
2022-10-15 19:20:25 +00:00
Robert Müller c78f71b2b9 Fix client crash when server does not send gameinfo 2022-10-15 19:43:26 +02:00
Robert Müller 0a6ad9cf9d Add tests for too small/large sha256_str and md5_str buffers
Rename `Expect` to `ExpectSha256` and `Expect2` to `ExpectMd5` for better readability.

Pass buffer size by template parameter to reduce duplicate source code.
2022-10-15 18:18:18 +02:00
Robert Müller a07c51b637 Use size_t for indices in digest_str 2022-10-15 18:08:41 +02:00
Robert Müller c0b5e8965e Refactor usages of sha256_str
- Pass the actual array size instead of using the constant.
- Use the string length to write sha256 string to file.
2022-10-15 18:06:45 +02:00
bors[bot] 9e4da2244a
Merge #5944
5944: Fix example name in mapbug description r=heinrich5991 a=Zwelf

Fix typo: 6c3d0e999b/src/game/mapbugs_list.h (L3)

## 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: Zwelf <zwelf@strct.cc>
2022-10-14 16:02:40 +00:00
Robert Müller 05eb1db436 Update zlib to version 1.2.13
Release notes: https://github.com/madler/zlib/releases/tag/v1.2.13
2022-10-14 14:53:24 +02:00
Zwelf 0e0e55eb43 Fix example name in mapbug description 2022-10-13 11:51:18 +02:00
heinrich5991 ea17fc753e Enable antispoof for vanilla by default
Having it disabled opens up the server for attacks.
2022-10-13 09:55:39 +02:00
bors[bot] 6c3d0e999b
Merge #5933 #5941
5933: Inline `Is(GameType)` functions and remove support for legacy 64 player info protocol r=def- a=heinrich5991

## 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)


5941: Get away from vector for skins r=def- a=Jupeyy

most of the time it uses the index just to get the skin, downloaded skins change the index. Now its simply a heap object and downloaded skins load directly. Also the loading might be a bit faster bcs it had a loop lookup .Also O(1) lookup

not 100% tested. also fixes a bug with favorite skins hopefully
## 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: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
2022-10-12 22:08:17 +00:00
bors[bot] bd3b4f2d50
Merge #5942
5942: Support unicode with ExcHndl, use upstream module offsets, handle errors r=def- a=Robyt3

Update Dr. Mingw (ExcHndl) to 0.9.8.

Use the new `ExcHndlSetLogFileNameW` function to set the exception log file name using wide characters, to support paths containing unicode.

It's not necessary to call `ExcHndlInit` explicitly after loading `exchndl.dll`, as the `DllMain` will already initialize the exception handler when the DLL is loaded. Module offsets are supported by upstream ExcHndl now, so we don't need to provide our own version that supplies the module offset to `ExcHndlInit` anymore. Upstream ExcHndl will also resolve the source code lines for addresses automatically, when the executable is build with debug information.

Handle the cases that the exception handling module cannot be loaded and that the `ExcHndlSetLogFileNameW` function cannot be found in the module.

Update `scripts/parse_drmingw.sh`:

- Parse both old and new module offsets.
- Use tabs instead of spaces consistently.
- Reset the ANSI color after printing colored messages.

Closes #5877.

Needs https://github.com/ddnet/ddnet-libs/pull/34.

Example crash logs:

- [crash_debug_old.RTP.txt](https://github.com/ddnet/ddnet/files/9768008/crash_debug_old.RTP.txt)
- [crash_debug_new.RTP.txt](https://github.com/ddnet/ddnet/files/9768011/crash_debug_new.RTP.txt)
- [crash_release_old.RTP.txt](https://github.com/ddnet/ddnet/files/9768010/crash_release_old.RTP.txt)
- [crash_release_new.RTP.txt](https://github.com/ddnet/ddnet/files/9768009/crash_release_new.RTP.txt)

## 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>
2022-10-12 21:44:43 +00:00
Jupeyy a804c3ca5b Get away from vector for skins
most of the time it uses the index just to get the skin, downloaded skins change the index.
Now its simply a heap object and downloaded skins load directly. Also the loading might be a bit faster bcs it had a loop lookup
Also O(1) lookup
2022-10-12 22:32:36 +02:00
Robert Müller fb317779fc Support unicode with ExcHndl, use upstream module offsets, handle errors
Update Dr. Mingw (ExcHndl) to 0.9.8.

Use the new `ExcHndlSetLogFileNameW` function to set the exception log file name using wide characters, to support paths containing unicode.

It's not necessary to call `ExcHndlInit` explicitly after loading `exchndl.dll`, as the `DllMain` will already initialize the exception handler when the DLL is loaded.
Module offsets are supported by upstream ExcHndl now, so we don't need to provide our own version that supplies the module offset to `ExcHndlInit` anymore.
Upstream ExcHndl will also resolve the source code lines for addresses automatically, when the executable is build with debug information.

Handle the cases that the exception handling module cannot be loaded and that the `ExcHndlSetLogFileNameW` function cannot be found in the module.

Update `scripts/parse_drmingw.sh`:

- Parse both old and new module offsets.
- Use tabs instead of spaces consistently.
- Reset the ANSI color after printing colored messages.
2022-10-12 21:11:35 +02:00
Robert Müller c68841a733 Ensure Windows DDE conversations are finished in open_link
Use `ShellExecuteExW` instead of `ShellExecuteW` to pass the additional flag `SEE_MASK_NOASYNC`. This should ensure that DDE (Dynamic data exchange) conversations are finished before the function returns, as it would otherwise be necessary to manually pump messages on the calling thread. DDE conversations may be initiated when shell extensions are loaded via `ShellExecute`. Failing to answer the DDE messages will block the calling UI thread and may cause a dead-lock.

The flag `SEE_MASK_FLAG_NO_UI` is used to prevent native error message popups when the link/file cannot be opened.

Additionally, the `ShellExecute` verb is changed from `"open"` to `NULL`, which will cause the default shell handler to be used instead, as the `"open"` verb may not be available for all targets. Though for most targets it will be the default verb anyway.

References:

- https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew
- https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shellexecuteinfow
- https://devblogs.microsoft.com/oldnewthing/20070430-00/?p=27063
- https://learn.microsoft.com/en-us/windows/win32/dataxchg/about-dynamic-data-exchange

Yet another attempt at solving #5744.
2022-10-12 17:18:57 +02:00
Robert Müller 4bb549b68e Initialize the Windows COM library on all threads
Use threading model `COINIT_APARTMENTTHREADED` on threads that own a window (the main client thread) and `COINIT_MULTITHREADED` on all other threads.

Add assertions to ensure that the COM library is initialized successfully and only once per thread.

References:

- https://learn.microsoft.com/en-us/windows/win32/learnwin32/initializing-the-com-library
- https://learn.microsoft.com/en-us/windows/win32/com/single-threaded-apartments
- https://learn.microsoft.com/en-us/windows/win32/com/multithreaded-apartments

Yet another attempt at solving #5744.
2022-10-12 17:18:57 +02:00
heinrich5991 a595936fb5 Remove chat timeout code fallback heuristic
KoG is now on the newest version, we no longer need this.
2022-10-12 16:12:02 +02:00
heinrich5991 150485e3b0 Remove support for legacy 64 player info protocol
It was only being used for "Leak IP" favorites and LAN servers. Since
KoG has upgraded to latest DDNet, there aren't much servers left that
don't understand the new 64 player info protocol.

Keywords: fstd, dtsf
2022-10-12 16:12:02 +02:00
VoxelDoesCode 484cb82872 Hex Values in the editor's info feature
Clang format before squash
2022-10-11 19:27:12 -04:00
heinrich5991 a97a597592 Inline Is(GameType) functions
They are used for two purposes, coloring gametypes in the serverbrowser
and enabling backward compatibility. These are independent, we shouldn't
add more stuff to the backward compatibility, hence I split them up and
inlined them.
2022-10-11 16:05:46 +02:00
bors[bot] 8de0247d00
Merge #5909
5909: Add favorite skins r=def- a=Jupeyy

Advantages:
- my friend fokkonaut can mark his favorite vanilla skins
- u can mark skin db skins which auto download if not loaded

untested, bad code, maybe buggy.
but still want feedback :)

![image](https://user-images.githubusercontent.com/6654924/193877801-6880a4f6-3f42-4e16-ad00-f44583aa2a87.png)


## 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>
2022-10-10 14:42:18 +00:00
def c2d1118c90 Only announce servers using Steam/Discord integration which are registered 2022-10-09 16:16:54 +02:00
bors[bot] 6d7df66448
Merge #5918
5918: Constify snap more (inspired by upstream) r=Robyt3 a=ChillerDragon

Incorporate const added in those upstream commits:
d86d576217
e6b8518b49

## 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: ChillerDragon <ChillerDragon@gmail.com>
2022-10-09 13:53:05 +00:00
bors[bot] 9a664c62e9
Merge #5924
5924: Grammer fix in snapshot doc "haven't" -> "hasn't" r=def- a=ChillerDragon

<!-- 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

- [ ] 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: ChillerDragon <ChillerDragon@gmail.com>
2022-10-09 13:29:10 +00:00
ChillerDragon 6d0b2ee44c Grammer fixes in snapshot doc
Thanks to @def-
2022-10-09 15:24:09 +02:00
ChillerDragon 9982a7bad3 Constify snap more (inspired by upstream)
Incorporate const added in those upstream commits:
d86d576217
e6b8518b49
2022-10-09 15:12:12 +02:00
ChillerDragon b2285855f5 Remove unused SnapInvalidateItem
suggested by @Robyt3 <3
2022-10-09 15:11:58 +02:00
bors[bot] b7da20826d
Merge #5919
5919: Tweak the running visuals r=def- a=VoxelDoesCode

Sorry for putting this off for so long. Turns out animating with raw code is harder than you'd think.

https://user-images.githubusercontent.com/95713843/194726134-40925aea-6ec4-40ae-9597-b80a28d1b6a2.mp4



## 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
- [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: VoxelDoesCode <bluheadcat@gmail.com>
2022-10-08 22:58:13 +00:00
VoxelDoesCode fc09212d43 Tweak the running visuals 2022-10-08 16:07:15 -04:00
bors[bot] 31b0c0a6cd
Merge #5916
5916: fix import on mastersrv r=heinrich5991 a=edg-l

<!-- 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

- [ ] 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: Edgar Luque <git@edgarluque.com>
2022-10-07 19:35:34 +00:00
Edgar 5cfec69fad fix import on mastersrv 2022-10-07 21:32:53 +02:00
bors[bot] 665f829759
Merge #5915
5915: Don't overlap menu + debug messages (fixes #5914) r=Robyt3 a=def-

![Screenshot 2022-10-07 at 19 03 03](https://user-images.githubusercontent.com/2335377/194611779-93062028-0684-4745-b3b9-9949cec074fa.png)

## 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: Dennis Felsing <dennis@felsin9.de>
2022-10-07 18:48:08 +00:00
Dennis Felsing 774f7a6f33 Don't overlap menu + debug messages (fixes #5914) 2022-10-07 19:03:20 +02:00
def 317b2df7c0 Support multiple values to search/exclude (fixes #4119) 2022-10-07 18:21:14 +02:00
Dennis Felsing c4463a3848 Only show ingame hint in Game tab
Since it looks ugly overlaid over the other tabs
2022-10-06 18:38:32 +02:00
Jupeyy fbc4c9cd6e Add favorite skins 2022-10-05 19:23:03 +02:00
bors[bot] d1463c62d1
Merge #5906
5906: Revert ingame menu close button, Add help text at bottom left when menu is open r=heinrich5991 a=def-

Even I got confused by it and accidentally hit power off button. Left side seems not popular for close either (#5888)

Since opening the menu requires Escape, players can probably figure out Escape to close it again.

Add help text at bottom left when menu is open

![screenshot-20221003@000950](https://user-images.githubusercontent.com/2335377/193478531-58ade8e6-074f-4710-8543-66c6bddfc963.png)

> Revert "Don't show home button ingame"
>
> This reverts commit d3ff903d44.
>
> Revert "Move home button to very right so it is consistent with close button ingame (fixes #5881)"
>
> This reverts commit 9cc08cc9d3.
>
> Revert "Add close button to close ingame menu"
>
> This reverts commit cfcfb7b3f0.

<!-- 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
- [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: def <dennis@felsin9.de>
2022-10-05 11:38:17 +00:00
Robert Müller 3c5a9f7672 Print the operating system version on client/server launch 2022-10-03 13:19:31 +02:00
Robert Müller 1697231916 Handle non-default Windows directory in os_version_str
- Retrieve version information of `kernel32.dll` without providing a fixed path to the Windows directory, to handle the case that Windows is not installed in the default location `C:\Windows`. This works because `GetFileVersionInfoSizeW` and `GetFileVersionInfoW` use the search sequence defined by `LoadLibrary`, so they will find the DLL without the path explicitly being specified. The version is retrieved from `kernel32.dll` instead of `user32.dll`, as the former is more commonly used for this purpose.
- Use the unicode (wide character) functions consistently instead of the ANSI functions.
- Use the correct format specifier `%hu` for `unsigned short` (i.e. `WORD` in the Windows API).

References:

- https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-getfileversioninfosizew
- https://learn.microsoft.com/en-us/windows/win32/api/winver/nf-winver-getfileversioninfow
- https://stackoverflow.com/a/44672263/1708371
2022-10-03 13:17:26 +02:00
def 361622ec37 Add help text at bottom left when menu is open 2022-10-03 00:11:01 +02:00
def 9e5d830e34 Revert ingame menu close button
Even I got confused by it and accidentally hit power off button. Left
side seems not popular for close either (#5888)

Since opening the menu requires Escape, players can probably figure out
Escape to close it again.

> Revert "Don't show home button ingame"
>
> This reverts commit d3ff903d44.
>
> Revert "Move home button to very right so it is consistent with close button ingame (fixes #5881)"
>
> This reverts commit 9cc08cc9d3.
>
> Revert "Add close button to close ingame menu"
>
> This reverts commit cfcfb7b3f0.
2022-10-02 23:59:48 +02:00
def 55ff665894 Less logging when loading maps on expected path 2022-10-01 22:46:39 +02:00
Robert Müller 9d1f393c55 Fix unknown command handler for filenames containing spaces
Pass the original string to the unknown command callback instead of the parsed command, as the latter ends at the first whitespace, which breaks for unknown commands (filenames) containing spaces.

Closes #5902.
2022-10-01 20:10:59 +02:00
Robert Müller c924f6bb25 Use str_isspace in str_skip_(to_)whitespace(s), add tests
Update the `str_skip_to_whitespace(_const)` functions according to their documentation, which already stated that `\r` was also considered as whitespace.
2022-09-30 14:54:33 +02:00
Robert Müller 9472db419b Fix str_hex and add tests
- Properly null-terminate the destination buffer when the data size is zero.
- Fix early loop exit when destination buffer is too small for all data.
2022-09-30 14:54:33 +02:00
Robert Müller 3383b7dc0f Add tests for str_countchr, update documentation 2022-09-30 14:54:33 +02:00
Robert Müller b029452e99 Add tests for str_rchr, update documentation 2022-09-30 14:54:33 +02:00
Robert Müller da57768854 Add tests for str_clean_whitespaces, fix documentation 2022-09-30 14:54:33 +02:00
Robert Müller 6bc633ed35 Add tests for str_sanitize 2022-09-30 14:54:33 +02:00
Robert Müller 67fe41137e Add tests for str_sanitize_cc 2022-09-30 14:54:33 +02:00
Robert Müller 8c1735cda6 Extend tests of str_has_cc with other control characters
The character `\n` was checked redundantly. Now more obscure control characters are also checked instead.
2022-09-30 14:54:21 +02:00
Robert Müller 98848cde70 Use str_comp_filenames to sort maps and demos again
This means that digit characters in filenames will be comparsed as numbers instead of being compared as individual digits.

The use of this function was previously (d2f5714042) removed as it did not sort names case insensitively, whereas now it does.
2022-09-30 14:48:53 +02:00
Robert Müller 02a7913121 Sort filenames case insensitive with str_comp_filenames, add tests
This changes `str_comp_filenames` so it sorts filenames case insensitive while also comparing digits characters as numbers.

This makes filename sorting consistent with the behavior in Windows Explorer.
2022-09-30 14:48:52 +02:00
Robert Müller ce145cfa4e Improve str_trim_words and add tests
- Change argument and return value to `const char *`, as the string is not modified by this function.
- Use our own `str_isspace` instead of standard library `isspace`.
- Always trim leading whitespace to correctly handle inputs with leading whitespace.
2022-09-30 12:29:32 +02:00
Robert Müller e98728f8f0 Extend str_isspace to consider \r as whitespace, add documentation
This allows the function to be reused in more places where `\r` is also considered as whitespace.
2022-09-30 12:13:23 +02:00
Robert Müller 3176032a7b Fix spelling seperate -> separate 2022-09-29 18:54:40 +02:00
bors[bot] 5b4c0fb3a7
Merge #5887
5887: Don't show home button ingame r=heinrich5991 a=def-

Broken in #5882
Old:
![Screenshot 2022-09-27 at 13 01 39](https://user-images.githubusercontent.com/2335377/192509141-e95c7df4-707b-4364-af0b-9150ec63f470.png)
New:
![Screenshot 2022-09-27 at 13 02 59](https://user-images.githubusercontent.com/2335377/192509182-91eacebd-56f5-4604-917f-8b747d02949f.png)

## 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: Dennis Felsing <dennis@felsin9.de>
2022-09-29 08:30:56 +00:00
Robert Müller f97067738e Use CreateFolder instead of fs_makedir + GetPath
As the former method is a wrapper for the latter two with additional log messages on errors.
2022-09-27 16:33:24 +02:00
Robert Müller 5482571c69 Add assertions for invalid storage arguments 2022-09-27 16:33:24 +02:00
Robert Müller a3f5d1b924 Use TYPE_SAVE instead of 0 2022-09-27 16:33:24 +02:00
Robert Müller 4fd983dc03 Add missing error handling for RenameBinaryFile 2022-09-27 16:33:24 +02:00
Robert Müller 481fb33efa Show log message when a storage path cannot be added 2022-09-27 15:25:04 +02:00
Robert Müller 2db41124b5 Use for-each loop for array apDirs 2022-09-27 15:25:04 +02:00
Robert Müller e21f9c609b Remove unnecessary virtual of GetPath method 2022-09-27 15:25:04 +02:00
Robert Müller 6fbcfb6fd9 Move variable declarations 2022-09-27 15:25:04 +02:00
Robert Müller c5d96eb0f6 Rename variable p to pStorage 2022-09-27 15:25:04 +02:00
bors[bot] a32b6c6055
Merge #5889
5889: Fix windows build r=def- a=fokkonaut

Required for std::min

## 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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
2022-09-27 11:52:17 +00:00
fokkonaut a4383602c0 Fix windows build 2022-09-27 13:45:58 +02:00
Dennis Felsing d3ff903d44 Don't show home button ingame
Broken in #5882
2022-09-27 13:03:16 +02:00
def 9cc08cc9d3 Move home button to very right so it is consistent with close button ingame (fixes #5881) 2022-09-26 19:02:41 +02:00
bors[bot] 0f6594f10b
Merge #5875
5875: Move `src/game/bezier.cpp/h` to `src/base/bezier.cpp/h` r=def- a=Robyt3

As those functions are not game specific per se, they can be part of base instead.

Closes #3334.

<!-- 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>
2022-09-24 19:17:10 +00:00
bors[bot] fdf29b5197
Merge #5861
5861: Add close button to close ingame menu r=Jupeyy a=def-

Suggested by cheeser0613 since new players don't know that Escape is the only way to close it again
![Screenshot 2022-09-22 at 09 49 31](https://user-images.githubusercontent.com/2335377/191689168-d401d6e9-f68c-4c53-a905-7ff1cfa0bb9d.png)
![Screenshot 2022-09-22 at 09 49 25](https://user-images.githubusercontent.com/2335377/191689180-581145f5-29cd-4adc-a4ee-4a89ded81534.png)
I'm not sure if I prefer it on left or right side. Left side is like the start menu button, right side is like Windows bar.

## 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: Dennis Felsing <dennis@felsin9.de>
2022-09-24 19:00:28 +00:00
Robert Müller 727b147268 Move src/game/bezier.cpp/h to src/base/bezier.cpp/h
As those functions are not game specific per se, they can be part of base instead.

Closes #3334.
2022-09-24 20:53:59 +02:00
bors[bot] 3d1583d9a5
Merge #5871
5871: Fix skin prefix button container being used for multiple buttons r=heinrich5991 a=Robyt3

This meant that only the first skin prefix button could be activated.

Regression from #5633.

<!-- 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>
2022-09-24 17:49:40 +00:00
Robert Müller 9625a4e521 Fix skin prefix button container being used for multiple buttons
This meant that only the first skin prefix button could be activated.

Regression from #5633.
2022-09-24 17:43:53 +02:00
Robert Müller 61f763ff2c Use GetCurrentDirectoryW instead of _wgetcwd
For more consistent usage of the Windows API. `_wgetcwd` seems to be a wrapper around `GetCurrentDirectoryW` anyway, at least in the [Wine API](https://source.winehq.org/ident?_i=_wgetcwd).

Pass the correct size of the wide char buffer instead of passing the size of the output parameter buffer.

Remove a nullptr check. The argument should never be null and we don't check for null arguments anywhere else.
2022-09-24 17:09:31 +02:00
Robert Müller 2ba67c2306 Use SetCurrentDirectoryW instead of _wchdir
For more consistent usage of the Windows API. `_wchdir` seems to be a wrapper around `SetCurrentDirectoryW` anyway, at least in the [Wine API](https://source.winehq.org/ident?_i=_wchdir).
2022-09-24 17:09:31 +02:00
Robert Müller 8fb79242bf Use CreateDirectoryW + GetLastError instead of _wmkdir + errno
For more consistent usage of the Windows API. `_wmkdir` seems to be a wrapper around `CreateDirectoryW` anyway, at least in the [Wine API](https://source.winehq.org/ident?_i=_wmkdir).
2022-09-24 17:09:31 +02:00
bors[bot] c61e5586ff
Merge #5867
5867: Use ddnet.org on manpages r=heinrich5991 a=def-

<!-- 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

- [ ] 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: Dennis Felsing <dennis@felsin9.de>
2022-09-23 23:41:20 +00:00
bors[bot] 4f3a9cbd0d
Merge #5864
5864: refresh serverbrowser when disconnecting / abort r=def- a=luk51

This might be not complete, but this adds the functionality to refresh the server browser list after disconnecting from a server, or after aborting joining a server.

This fixes issue #5863.


## 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: Lukas Kitsche <lukaskitsche@posteo.de>
2022-09-23 23:24:58 +00:00
Dennis Felsing 17960e52b5 Add luk51 in credits 2022-09-24 01:05:00 +02:00