Commit graph

9868 commits

Author SHA1 Message Date
Freddie Wang 32b8c8c192
Translate "Name" and "Time" header in ghost menu 2021-06-11 13:31:30 +08:00
def c60715e907 Add timeout for serverbrowser http request 2021-06-09 17:40:46 +02:00
Jupeyy 90303692df Don't refresh, if a job is already running 2021-06-09 17:40:46 +02:00
bors[bot] b445862628
Merge #3888
3888: Send server info request for ping with different token r=Jupeyy a=heinrich5991

Thanks to @Jupeyy for figuring out this bug.

Previously, the client would send the request for server info and the
server info ping packet with the same token, making the answer
indistinguishable from each other. Fix this by generating a token that
won't collide.

Fixes #3862.

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-06-09 15:36:38 +00:00
heinrich5991 97a8fcca04 Send server info request for ping with different token
Thanks to @Jupeyy for figuring out this bug.

Previously, the client would send the request for server info and the
server info ping packet with the same token, making the answer
indistinguishable from each other. Fix this by generating a token that
won't collide.

Fixes #3862.
2021-06-09 17:29:06 +02:00
Jupeyy fea070a712 Remove unused variables 2021-06-09 05:35:28 +02:00
Jupeyy 9956242b4e Remove cl_load_country_flags 2021-06-08 01:06:07 +02:00
bors[bot] 8bd552d3b8
Merge #3884
3884: Make mouse pos calculation more robust against NaNs r=def- a=Jupeyy

1. Since the config didn't have a limit set, they could be negative, which directly caused bugs
2. If you set a min mouse distance, lets say 5, It can mathematically happen that you drag your mouse exactly so much that you hit the (0, 0) point and the if(.. < MinDistance) branch normalizes that point, which causes non restorable NaNs.
It's now safe, the min distance is later in code checked to be atleast 1, i "even" just made it safe enough, so there shouldn't be any change in behaviour:
07ab4d5356/src/game/client/components/controls.cpp (L298-L304)
Which casts the float to an int and checks the int, and this does not restore the mouse pos for NaNs, because nan to int is not 0
its some insanly high value int_max or smth

To reproduce both bugs "easily" on current master you can abuse a SDL limitation,
relative mouse mode seems to only move upto +-1 unit,
- so for 1. set the ingame mouse sens to 100000 and the max mouse distance to -1000 and move your mouse fast for a few seconds, happens relativly easy (Thanks to Souly how to reproduce it)
- for 2. set mouse sens to 100 and max distance to 1 and min distance to 5, this case is a bit harder to reprod in debug mode, probably bcs of the way mouse pos is later handled and also maybe bcs of floating point differences with signs that go close to 0... had to move the mouse few seconds but still got it relativly fast (with -0fast it happens almost instant)

it will exactly happen what i explained in 2. that the reported mouse movement negates the current mouse pos, resulting in mouse pos (0,0)

![screenshot_2021-06-06_21-55-18](https://user-images.githubusercontent.com/6654924/120938281-35bf4b80-c712-11eb-9b6b-7523e8b436bd.png)

This this was also a bug reported in #bugs channel, i think we could also add it to the release

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-06-07 08:28:24 +00:00
Jupeyy cd68b4608e Make calculation which sets mouse pos safer 2021-06-06 23:38:11 +02:00
Jupeyy 403803df4f Give mouse settings a maximum 2021-06-06 23:38:11 +02:00
bors[bot] 07ab4d5356
Merge #3882
3882: Fix inconsistent handling of death tile between front and game layer r=def- a=Zwelf

Fixes #3880

I believe that it can be safely merged. I tried to see the difference, but I couldn't get a measureable difference with only Kill-Tiles and Stoppers.

All affected maps with number of death tiles in front layer (generated with Patigas twmap library):

```
"types/brutal/maps/Rogue World.map": 189
"types/brutal/maps/New World.map": 214
"types/brutal/maps/Flow Fever.map": 7
"types/brutal/maps/A Strange Dream.map": 372
"types/brutal/maps/Jungledread.map": 1253
"types/brutal/maps/Lobster Party.map": 19
"types/novice/maps/Tangerine.map": 354
"types/solo/maps/Vesper.map": 238
"types/ddmax/maps/Creative.map": 6
"types/dummy/maps/Juma.map": 1
"types/dummy/maps/Ulver.map": 15
"types/dummy/maps/NoTeleBro.map": 1
"types/dummy/maps/Gummy.map": 1
"types/dummy/maps/Cultist.map": 5
"types/dummy/maps/Nincorn.map": 42
"types/dummy/maps/Squadron.map": 85
"types/dummy/maps/DarkSpy 2.map": 49
"types/dummy/maps/Capricorn.map": 1
"types/moderate/maps/Kero-Gores8.map": 109
"types/moderate/maps/The Swamp.map": 62
"types/insane/maps/Redefined 2.map": 1
"types/insane/maps/1AndOnLyLife.map": 2
```

I looked into some of these maps and it doesn't make a difference there.

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-06-05 17:27:32 +00:00
bors[bot] f6e887f7aa
Merge #3881
3881: Use str_length r=def- a=ChillerDragon

Either we should delete str_length or we should use it. Feel free to downvote this pr if u think delete is the way to go.

Co-authored-by: ChillerDragon <ChillerDragon@gmail.com>
2021-06-05 17:17:30 +00:00
ChillerDragon 8a4f4fc6c9 Use str_length 2021-06-05 16:46:01 +02:00
Zwelf 4d14bcea0b Fix inconsistent handling of death tile between front and game layer 2021-06-05 16:38:53 +02:00
bors[bot] 46f204bda7
Merge #3873
3873: Add japanese compressed font r=def- a=TsFreddie

This is a 57kb hiragana/katakana font sits between deja vu sans and source han sans. GlowSansJCompressed is a fork of Source Han Sans so the style and license are the same: https://github.com/welai/glow-sans/blob/master/docs/README-en.md

Was torn between condensed (thiner) font and compressed (thinnest) font, but I figure since we want to fit them better, might as well make more text fit rather than less:

![image](https://user-images.githubusercontent.com/3797859/120436727-e0053f00-c3b1-11eb-8760-4c5afbb4a6da.png)

The font weight is "book" because glow sans has 9 font weights instead of matching source han sans's 7. so the weight name was shifted.

_Japanese translation will come later._

## 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 if it works standalone, system.c especially
- [ ] 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: Freddie Wang <tsfreddiewang@gmail.com>
2021-06-04 14:28:24 +00:00
Freddie Wang 66caa896b9 Add japanese condensed font 2021-06-04 21:15:29 +08:00
bors[bot] af6a3778e3
Merge #3876
3876: Fix crash in serverbrowser initialization r=def- a=heinrich5991

Another missing commit.

Fixes #3875.

CC #3772 #3855

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-06-02 22:42:52 +00:00
heinrich5991 26a577b891 Fix crash in serverbrowser initialization
Another missing commit.

Fixes #3875.

CC #3772 #3855
2021-06-03 00:27:00 +02:00
def 87ed889747 Move hammer and pistol weapons (fixes #3872) 2021-06-02 12:28:14 +02:00
bors[bot] 593ce122e6
Merge #3866
3866: Add Input handling to UI Ex initialization r=def- a=Jupeyy




fixes #3865

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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>
2021-05-31 17:07:26 +00:00
Jupeyy aa9338614f Use FontSize for rendered cursor 2021-05-31 16:23:07 +02:00
Jupeyy 14f448d6d6 Init input handling in UI Ex 2021-05-31 12:27:04 +02:00
ChillerDragon 68962e9b40 Fix a woopsie in snapshot docs
Thanks to @def- and @murpii :)
2021-05-29 11:07:33 +02:00
bors[bot] e5e2e46da2
Merge #3837
3837: Use "occupado" spawn spots when nothing else is left r=heinrich5991 a=def-

Better than not spawning at all

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-28 17:21:50 +00:00
bors[bot] 992cd86d8e
Merge #3848
3848: Update German translation, some minor English fixes, update language files r=heinrich5991 a=def-

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-28 17:11:05 +00:00
bors[bot] 7e9b0fcb6b
Merge #3858
3858: Reduce spamminess of http server browser r=heinrich5991 a=def-

As reported by fokkonaut on Discord. Not sure if we lose relevant
information.

Previously:
```
[2021-05-28 12:08:54][http]: http https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:55][http]: task done https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:55][http]: http https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task done https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][serverbrowse_http]: found master, url='https://master2.ddnet.tw/ddnet/15/servers.json' time=2437ms
[2021-05-28 12:08:57][http]: http https://master4.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task failed. libcurl error: Could not resolve host: master4.ddnet.tw
[2021-05-28 12:08:57][http]: http https://master3.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task failed. libcurl error: Could not resolve host: master3.ddnet.tw
[2021-05-28 12:08:57][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][serverbrowse_http]: found master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=201ms
[2021-05-28 12:08:58][serverbrowse_http]: determined best master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=201ms
[2021-05-28 12:08:58][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
```
Now:
```
[2021-05-28 12:29:58][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:29:59][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:30:00][serverbrowse_http]: found master, url='https://master2.ddnet.tw/ddnet/15/servers.json' time=799ms
[2021-05-28 12:30:00][serverbrowse_http]: found master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=43ms
[2021-05-28 12:30:00][serverbrowse_http]: determined best master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=43ms
```
<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-28 15:13:42 +00:00
def bcdb3e0247 Reduce spamminess of http server browser
As reported by fokkonaut on Discord. Not sure if we lose relevant
information.

Previously:

[2021-05-28 12:08:54][http]: http https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:55][http]: task done https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:55][http]: http https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task done https://master2.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][serverbrowse_http]: found master, url='https://master2.ddnet.tw/ddnet/15/servers.json' time=2437ms
[2021-05-28 12:08:57][http]: http https://master4.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task failed. libcurl error: Could not resolve host: master4.ddnet.tw
[2021-05-28 12:08:57][http]: http https://master3.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task failed. libcurl error: Could not resolve host: master3.ddnet.tw
[2021-05-28 12:08:57][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:57][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][serverbrowse_http]: found master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=201ms
[2021-05-28 12:08:58][serverbrowse_http]: determined best master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=201ms
[2021-05-28 12:08:58][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:08:58][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json

Now:

[2021-05-28 12:29:58][http]: http https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:29:59][http]: task done https://master1.ddnet.tw/ddnet/15/servers.json
[2021-05-28 12:30:00][serverbrowse_http]: found master, url='https://master2.ddnet.tw/ddnet/15/servers.json' time=799ms
[2021-05-28 12:30:00][serverbrowse_http]: found master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=43ms
[2021-05-28 12:30:00][serverbrowse_http]: determined best master, url='https://master1.ddnet.tw/ddnet/15/servers.json' time=43ms
2021-05-28 12:30:27 +02:00
def badaae58e9 [http]: http -> [http]: fetching 2021-05-28 12:11:59 +02:00
heinrich5991 f5e91ba192 Remove unused parts of the new serverinfo 2021-05-27 21:48:10 +02:00
heinrich5991 bfef7c9ba3 Add forgotten commit data from #3772
Change filename `serverlist_urls.cfg` → `ddnet-serverlist-urls.cfg`,
change filename `cache.sqlite3` → `ddnet-cache.sqlite3`, add `const` to
a variable and change pings to just before multiples of 100.

Fixes #3853.
2021-05-27 21:48:04 +02:00
Learath2 7e95911714 Fix alignment for CVoteOptionServer 2021-05-27 19:35:20 +02:00
heinrich5991 039f2c6823 Fix (harmless) array OOB access when no pings were cached
Use `vector.data()` instead of `&vector[0]` to get access to the
underlying array.

Fixes #3850.
2021-05-27 15:53:40 +02:00
Freddie Wang 769970b30b Only predict pickup if affected by movers 2021-05-27 15:45:41 +08:00
def 3716bece80 masterserver -> master server, serverlist -> server list 2021-05-27 09:03:36 +02:00
bors[bot] efde7523e4
Merge #3772
3772: Add client-side HTTP server info r=def- a=heinrich5991

Summary
=======

The idea of this is that clients will not have to ping each server for
server infos which takes long, leaks the client's IP address even to
servers the user does not join and is a DoS vector of the game servers
for attackers.

For the Internet, DDNet and KoG tab, the server list is entirely fetched
from the master server, filtering out servers that don't belong into the
list.

The favorites tab is also supposed to work that way, except for servers
that are marked as "also ping this server if it's not in the master
server list".

The LAN tab continues to broadcast the server info packet to find
servers in the LAN.

How does it work?
=================

The client ships with a list of master server list URLs. On first start,
the client checks which of these work and selects the fastest one.
Querying the server list is a HTTP GET request on that URL. The
response is a JSON document that contains server infos, server addresses
as URLs and an approximate location.

It can also contain a legacy server list which is a list of bare IP
addresses similar to the functionality the old master servers provided
via UDP. This allows us to backtrack on the larger update if it won't
work out.

Lost functionality
==================

(also known as user-visible changes)

Since the client doesn't ping each server in the list anymore, it has no
way of knowing its latency to the servers.

This is alleviated a bit by providing an approximate location for each
server (continent) so the client only has to know its own location for
approximating pings.
## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-26 21:00:49 +00:00
bors[bot] fbf3d6e943
Merge #3844
3844: Add UI Ex class to share common ui implementations r=def- a=Jupeyy

Between menus and editor for example

Currently only did DoEditBox, as this created crashes in the editor

fixes #3395

It's copy and paste from the implementation of CMenus, except for 4 lines, which i'll mark below

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-26 13:21:01 +00:00
Jupeyy b7adc5a690 Add UI Ex class to share common ui implementations
between menus and editor for example
2021-05-26 15:02:33 +02:00
bors[bot] 47d63317aa
Merge #3826
3826: Respect TuneZone for characters r=def- a=TsFreddie

*I might be totally insane for doing this.
*The effect is only truly noticeable if you have high ping AND dropping packets.*

*clang-tidy's warning doesn't seems to relate to anything I've changed*


Now characters will try to respect TuneZones when ~~evolving and~~ predicting (like projectiles do). Since it is really important to keep TuningList as accurate as possible, I made a TuningList update logic so we try our best to update tunings only for the correct TuneZone (instead of constantly shoving current tuning into TuningList)

And each CCharacterCore now has its own Tunings to avoid any characters influencing GameWorld's tuning. Some server code has to be updated accordingly. I checked the code path, didn't notice anything that would make our server behave differently.

And I guess I should tag @trml myself this time.

## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps (as far as I could tell)
- [ ] 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: Freddie Wang <tsfreddiewang@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
2021-05-23 08:16:57 +00:00
Zwelf fa79ffa1a1 Simplify entities destruction 2021-05-22 20:02:00 +02:00
bors[bot] bf1fa15380
Merge #3841
3841: Add better support for compose binds in demo menu r=def- a=ChillerDragon

I assume shift is a common compose bind. So users might have bound
shift+scroll or shift+arrowkeys to something else and do not want to
change the playback speed while triggering that compose bind.

I have to admit this is something I personally need and I am not sure what the demand for it is.
But for example my zoom bind is shift+mousewheelup and shift+mousewheeldown and I change that a lot while watching demos but it keeps affecting the playback speed. Maybe someone else has a compose bind using the alt key I do not know. But this solves my issue :)

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-22 10:03:42 +00:00
bors[bot] 502711541e
Merge #3804
3804: HiDPI-aware Resolution List r=def- a=TsFreddie

This is a version of https://github.com/teeworlds/teeworlds/pull/2827

Which gives you a resolution list that allows you to select appropriate window size (which is saved in config and used to initialize videos), while showing the canvas size (which is the drawing resolution), at least on MacOS.

This also fixes incorrect clips that happens without HiDPI enabled, because `Graphics()->ScreenWidth()` (in canvas size) was reported incorrectly before, which is now fixed.

Also, I noticed that `m_DesktopScreenWidth` and `m_DesktopScreenHeight` (in window size in MacOS) is used incorrectly or differently from what it was used during initialization:

* During initialization, DesktopScreenWidth is the "screen width of your desktop", but it was used as the "game window size on your desktop" when checking whether to resize window. I added a separate window size calculation to use during resize.

Also, god, I hope SDL's different sizes and stuff is reported consistently at least in Wayland or X, so please test. I know in Windows they are always in pixel/canvas size so it might not be a huge issue there.

## Checklist

- [x] Tested the change ~~ingame~~ on MacOS
- [ ] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options (again, on MacOS, with both HiDPI and non-HiDPI settings)
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] 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: Freddie Wang <tsfreddiewang@gmail.com>
2021-05-22 09:56:09 +00:00
ChillerDragon 7d87089acd Make sure ctrl+shift+s works same as clicking UI
Do not overwrite the current map when saving as a new file

closed #1972
2021-05-22 11:40:08 +02:00
ChillerDragon 18e69b4df1 Add better support for compose binds in demo menu
I assume shift is a common compose bind. So users might have bound
shift+scroll or shift+arrowkeys to something else and do not want to
change the playback speed while triggering that compose bind.
2021-05-22 11:31:15 +02:00
Jupeyy b607cf0f60 Remove texture quality config 2021-05-21 15:00:14 +02:00
bors[bot] 309cc79899
Merge #3815
3815: Remove "Show only supported" switch from graphics tab r=def- a=ardadem

gfx_display_all_modes can be used instead

## 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 if it works standalone, system.c especially
- [ ] 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: Arda Demir <ddmirarda@gmail.com>
2021-05-21 12:47:22 +00:00
def 72f3b774b8 Use "occupado" spawn spots when nothing else is left
Better than not spawning at all
2021-05-20 21:39:04 +02:00
bors[bot] 42545ebcdb
Merge #3834
3834: Remove alpha clamp r=def- a=Jupeyy

Was still from the first version of the HSL sliders, which didn't had a border around the selector and made the alpha slider invisible(for menu colors slider), but thats not needed anymore(bcs borders are not transparent).

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-19 10:58:07 +00:00
def ae6a78c0ca Try to fix clang-tidy warnings (untested) 2021-05-19 12:58:04 +02:00
Jupeyy d39322d7a6 Differenciate between width and height for body part 2021-05-19 12:10:58 +02:00
Jupeyy 835901460c Remove alpha clamp 2021-05-19 12:04:04 +02:00
def 304d9f36ec Fix UB with super (fixes #3830) 2021-05-17 11:41:15 +02:00
Jupeyy 18fa5bdc22 Remove stack pointer for pID in UIs 2021-05-17 10:02:21 +02:00
heinrich5991 ad26358853 Fix clang-tidy warnings
Even fix a bug in the process, if `m_pDDNetInfo` is null.
2021-05-14 01:25:59 +02:00
heinrich5991 53e9457965 Save previously determined best serverlist
Also make the whole process more robust against failures, retry finding
the best serverlist if the current one is broken.
2021-05-14 01:01:09 +02:00
heinrich5991 9002c9f9a2 Allow pinging favorites directly, leaking your IP address
This is on by default for favorites added in the LAN tab, otherwise off.
2021-05-14 01:01:09 +02:00
heinrich5991 47c803f3fb Remove server info backward compatibility that is no longer needed
Goes all the way back to 04eddacd65 in
2008, pre 0.5.0.
2021-05-14 01:01:09 +02:00
heinrich5991 bd4e0f7fd8 Try parsing the server list before considering a masterserver 2021-05-14 01:01:08 +02:00
heinrich5991 afe6ab87e2 Also sort HTTP server info by score/name 2021-05-14 01:01:08 +02:00
heinrich5991 ee42faac1f Determine one's own location automatically, but provide override
Automatically determine the approximate location of the client by
including that info in the already fetched https://info2.ddnet.tw/info.
Can be overridden using the the config variable `br_location`.
2021-05-14 01:01:08 +02:00
heinrich5991 9eca91de74 Special case China as its own continent for ping estimation
It has an exceptionally bad connection to the outside due to the Great
Firewall of China:
https://en.wikipedia.org/w/index.php?title=Great_Firewall&oldid=1019589632
2021-05-14 01:01:08 +02:00
heinrich5991 acbaa87835 Use in-band ping for determining latency, if supported
Still fall back to server info requests for pinging.
2021-05-14 01:01:08 +02:00
heinrich5991 5ae0c3f3a0 Fix server capabilities only working after disconnect 2021-05-14 01:01:08 +02:00
heinrich5991 6567743546 Add PINGEX and PONGEX messages that are correlatable
The current NETMSG_PING and NETMSG_PING_REPLY messages suffer from the
fact that you cannot know whether a given NETMSG_PING_REPLY is from your
NETMSG_PING.
2021-05-14 01:01:08 +02:00
heinrich5991 a0df2bdf9c Measure the ping to the current server occasionally
This is done using the serverbrowser extended GETINFO packet. It's done
when the client enters the game and every ten minutes afterwards.
2021-05-14 01:01:08 +02:00
heinrich5991 ed561c3602 Add a command to ping all servers
Name it in a way to make clear what information it leaks to anyone who
wants to listen.
2021-05-14 01:01:07 +02:00
heinrich5991 bce7a4f84e Add serverbrowser ping cache 2021-05-14 01:00:41 +02:00
heinrich5991 355c6fccd3 Add sqlite3 to the client 2021-05-14 01:00:41 +02:00
heinrich5991 4301ffab58 Give tests their own playground IStorage
Also add a function to clean it up after the test.
2021-05-14 01:00:41 +02:00
heinrich5991 fb27b83d79 Add function to remove directories
Add tests. Unify behavior of `fs_remove` across operating systems to
only remove files, not directories. Previously on Linux, it would also
delete directories.
2021-05-14 01:00:41 +02:00
heinrich5991 436e202cbd Add client-side HTTP server info
Summary
=======

The idea of this is that clients will not have to ping each server for
server infos which takes long, leaks the client's IP address even to
servers the user does not join and is a DoS vector of the game servers
for attackers.

For the Internet, DDNet and KoG tab, the server list is entirely fetched
from the master server, filtering out servers that don't belong into the
list.

The favorites tab is also supposed to work that way, except for servers
that are marked as "also ping this server if it's not in the master
server list".

The LAN tab continues to broadcast the server info packet to find
servers in the LAN.

How does it work?
=================

The client ships with a list of master server list URLs. On first start,
the client checks which of these work and selects the fastest one.
Querying the server list is a HTTP GET request on that URL. The
response is a JSON document that contains server infos, server addresses
as URLs and an approximate location.

It can also contain a legacy server list which is a list of bare IP
addresses similar to the functionality the old master servers provided
via UDP. This allows us to backtrack on the larger update if it won't
work out.

Lost functionality
==================

(also known as user-visible changes)

Since the client doesn't ping each server in the list anymore, it has no
way of knowing its latency to the servers.

This is alleviated a bit by providing an approximate location for each
server (continent) so the client only has to know its own location for
approximating pings.
2021-05-14 01:00:39 +02:00
heinrich5991 11adc8c1ff Make it possible to run jobs in the current thread 2021-05-13 03:15:18 +02:00
Freddie Wang 500ba7609f Respect tunezone for characters 2021-05-13 00:57:50 +08:00
heinrich5991 782c826381 Add secure_rand_below function
It works by masking the numbers and the using rejection sampling to
ensure a uniform generation.
2021-05-12 17:02:02 +02:00
bors[bot] 22ef342ffc
Merge #3825
3825: Add sv_swap r=heinrich5991 a=def-

Because swap is broken and the current way of disabling is horrible.

<!-- What is the motivation for the changes of this 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-11 20:05:47 +00:00
def 6a348c8f60 Add sv_swap
Because swap is broken and the current way of disabling is horrible.
2021-05-11 17:05:17 +02:00
bors[bot] e7787bf58d
Merge #3823
3823: Add hookcollision color changeable r=heinrich5991 a=Jupeyy

![t](https://cdn.discordapp.com/attachments/293493549758939136/841549439742378034/unknown.png)

in HUD

## Checklist

- [ ] 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-11 14:39:42 +00:00
Jupeyy f8b15e0412 Add hookcollision color changeable 2021-05-11 14:34:53 +02:00
Freddie Wang 796035a358 Remove dangling declaration 2021-05-09 15:14:16 +08:00
bors[bot] 5d0e820af4
Merge #3814
3814: Fix x11 notify by Maiski r=def- a=Jupeyy

This works on KDE without problems, he also tested on i3

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-07 21:33:46 +00:00
Arda Demir 500670cfba Rename gfx_display_all_modes to gfx_display_all_video_modes 2021-05-07 12:56:50 +03:00
bors[bot] 1d0253aa67
Merge #3811
3811: Add Intel as vendor to the block list on windows r=def- a=Jupeyy

I also added, that the warning doesnt require to be displayed, as it currently won't help anyway to update the driver.

Should set all Intel users to OGL 2.0 default, they can ofc still manually change the setting as they want

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-07 07:52:57 +00:00
bors[bot] 23b8ad5cc2
Merge #3812
3812: Make init/shutdown when GL processor creation fails safer r=def- a=Jupeyy

Especially with GL 3.3, which has a shutdown command implemented, it should only get called, if it actually created the the backend stuff.

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-07 07:43:27 +00:00
Arda Demir 9f0f305e21 Remove "Show only supported" switch 2021-05-07 10:25:00 +03:00
Freddie Wang 08ecb91622 detect display changes and clamp the resolution 2021-05-07 12:00:32 +08:00
Jupeyy 99e460deb7 Fix x11 notify by Maiski 2021-05-07 02:07:37 +02:00
Freddie Wang 24ccffb005 calculate canvas size instead of window size 2021-05-06 22:29:49 +08:00
bors[bot] 70f79bf3bc
Merge #3813
3813: Only sort friends, if you got any r=def- a=Jupeyy

as TsFreddie pointed out, it asserts inside the array function back(), bcs the list is empty.

## 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 if it works standalone, system.c especially
- [ ] 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>
Co-authored-by: def <dennis@felsin9.de>
2021-05-06 13:40:09 +00:00
def 6465e482a1 Add unit test for empty range 2021-05-06 15:39:34 +02:00
Jupeyy f99f062d0a Only sort friends, if you got any 2021-05-06 14:45:34 +02:00
Jupeyy fbbfbf7890 don't initialize opengl stuff, if not required 2021-05-06 13:39:17 +02:00
Jupeyy a0fdacf54f make tests work 2021-05-06 13:10:39 +02:00
Freddie Wang 2f008d04d3 dpi-aware resolution list 2021-05-06 18:59:30 +08:00
Jupeyy 9104c19a1a remove dublicate code 2021-05-06 12:48:46 +02:00
def 427c01294a av_init_packet is deprecated, use av_packet_alloc instead 2021-05-06 12:25:12 +02:00
Jupeyy 899c30406d Add Intel as vendor to the block list on windows 2021-05-06 12:23:40 +02:00
bors[bot] 97ab2c6c01
Merge #3798
3798: Add GLES support r=def- a=Jupeyy

I know i *****ed up, that i didnt move the files in a different commit, but when i noticed it was already too late.
Its mostly disabling stuff that GLES doesn't support. Global LOD bias or glOrtho for examlpe.

~***Strong note***:
This will move ALL linux implementation to GLES instead of GL, since GLES is supported by X11 and wayland, we probably want some testing for this.
This also means, that the default for Linux gets GLES 3.0 which is equivalent to OpenGL 3.3, not OpenGL 3.0!!!~

~If you wonder "why":
Gles just works differently to OGL, it knows about all functions that exists, and e.g. doesn't require GLEW at all, but that also means, that GLES does NOT work while we use OGL, because GLEW would kill GLES.~
GLEW in EGL mode works fine with wayland, just requires X11 to use EGL too(SDL_VIDEO_X11_FORCE_EGL)

_Additionally, for GLES only, only 3.0 and 1.0 context are supported._(doesn't matter anymore for linux)

probably fixes:
~not_really_fixes  #3797~
fixes #2885

And would also allow android support, if i ever get these build scripts upto date, or smby is interested into fixing them for me :D

## 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 if it works standalone, system.c especially
- [ ] 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>
2021-05-06 09:50:26 +00:00
bors[bot] 4f974effa0
Merge #3809
3809: Compress IPv6 string representations according to RFC5952 r=def- a=heinrich5991

https://tools.ietf.org/html/rfc5952#section-4

Also add some tests.

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [x] Written a unit test if it works standalone, system.c especially
- [ ] 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>
2021-05-05 22:16:02 +00:00
heinrich5991 b2a54dc7f8 Compress IPv6 string representations according to RFC5952
https://tools.ietf.org/html/rfc5952#section-4

Also add some tests.
2021-05-05 18:22:52 +02:00
Dennis Felsing 6bd41d5dd2
Support ipv6
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2021-05-05 17:32:37 +02:00
def 6a6ba69189 Steam: Support connecting to hostname
instead of just ip address, untested
2021-05-05 16:10:30 +02:00