Commit graph

415 commits

Author SHA1 Message Date
Jupeyy 942e54de0c Fix toolchain 2021-08-24 13:21:29 +02:00
bors[bot] 00ff285784
Merge #3761
3761: Bump GTest version so we don't have to patch it anymore r=def- a=heinrich5991

Fixes #3388.

## 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-08-24 10:33:16 +00:00
heinrich5991 d00c5aa8a3 Revert "Manually patch gtest to allow CMake version 2.8.12...3.19.1"
This reverts commit 037b928dd7.

Fixes #3388.
2021-08-24 12:29:51 +02:00
heinrich5991 2191fdcf07 Bump GTest version to latest master as of 2021-04-07
Apparently they follow the "Abseil Live at Head philosophy".
2021-08-24 12:29:47 +02:00
Jupeyy b216b6744a Add Android build scripts 2021-08-24 12:18:20 +02:00
Robert Müller 8fa7610463 remove obsolete engine/shared/message.h 2021-08-20 16:23:29 +02:00
Jupeyy 8451775821 Make components member of CGameClient 2021-07-12 12:07:31 +02:00
Jupeyy 9dfea5511a Use cpp 2021-06-24 17:19:17 +02:00
Freddie Wang 66caa896b9 Add japanese condensed font 2021-06-04 21:15:29 +08: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
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
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 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 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
def 6465e482a1 Add unit test for empty range 2021-05-06 15:39:34 +02:00
Jupeyy b8f96ce500 Allow GLES3 coexists with OpenGL on Linux 2021-05-02 04:39:02 +02:00
Jupeyy e05abbaa91 Remove GL includes from headers 2021-05-01 23:56:30 +02:00
Jupeyy c0d6ce6d25 Add GLES support 2021-05-01 01:39:37 +02:00
Panagiotis Vasilopoulos 6058019141
Fixed library dependencies for the Haiku operating system 2021-04-18 07:57:24 +03:00
bors[bot] 6572f9e4fe
Merge #3779
3779: Copied Teeworld patches for the Haiku operating system r=def- a=panos

I initiated a port of ddnet and received a lot of help from the IRC in order to do so as seen in #2986. Unfortunately, my efforts went stale after one point. Fortunately, however, @threedeyes released a [set of patches for Teeworlds](2ea72967cd/games-action/teeworlds/patches/teeworlds-0.7.5.patchset). I decided to take down my repository with my own work and attempt to port Gerasim's work, which includes code for setting the directories that ddnet should use the same way one would do so in a Mac OS X-system in `src/base/system.c`, which was precisely the part where I got stuck in on my first attempt.

The changes have not been tested thoroughly yet and were the result of methodic copying and pasting.

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

## Checklist

- [ ] Tested the change ingame
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [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: Panagiotis Vasilopoulos <hello@alwayslivid.com>
2021-04-17 18:15:34 +00:00
Panagiotis Vasilopoulos 6c02076c05 Copied Teeworld patches for the Haiku operating system
Co-authored-by: Gerasim Troeglazov <3dEyes@gmail.com>
2021-04-17 20:10:56 +02:00
heinrich5991 8d6b62d8f8 Fix parsing an IPv6 address without port
The port in the NETADDR struct was left uninitialized.

Add some tests to ensure behavior.

CC #3774 #3775
2021-04-17 16:05:39 +02:00
def ce2bf096bd Move autoexec_server.cfg to data (fixes #3612) 2021-03-21 17:48:33 +01:00
Jupeyy 06dd469195 Tell MSVC that main is still entry 2021-03-05 17:36:47 +01:00
Jupeyy c20b9801d4 Don't allocate the windows console default 2021-03-01 15:25:45 +01:00
bors[bot] 2fb1c723c9
Merge #3568
3568: Get rid of the MySQL C++ connector as a dependency and disable C++ exceptions r=Learath2 a=heinrich5991

We now use the C API directly. This has the advantage of using one
obscure dependency less, as the C++ connector also used the C API.

Also remove exceptions from database code.

The equivalent code with return codes is a human-assisted mechanical
translation of the old code, no attempts to improve correctness were
made.

This allows us to enable the -fno-exceptions flag.

## 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 if it works standalone, system.c especially
- [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>
2021-02-24 16:43:16 +00:00
heinrich5991 9568d1055a Remove exceptions from database code
The equivalent code with return codes is a human-assisted mechanical
translation of the old code, no attempts to improve correctness were
made.

This allows us to enable the -fno-exceptions flag.
2021-02-24 17:39:48 +01:00
heinrich5991 d7019a244e Get rid of the MySQL C++ connector as a dependency
We now use the C API directly. This has the advantage of using one
obscure dependency less, as the C++ connector also used the C API.
2021-02-24 17:34:08 +01:00
Alexander Akulich b0c0fb316c Get rid of gamemode.h with confusing definitions
We also have GAME_NAME macro in game/version.h and the macros
from gamemode are not used anywhere else.
2021-02-23 18:26:16 +03:00
bors[bot] e6846827cf
Merge #3614
3614: Mac OS X -> macOS r=heinrich5991 a=def-

Changing the filenames of the releases will be a bit more annoying, so
not sure we want to do that

> Apple shortened the name to "OS X" in 2012 and then changed it to "macOS" in 2016

<!-- 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-02-12 13:49:29 +00:00
def e985632fae OSX -> macOS
Changing the filenames of the releases will be a bit more annoying, so
not sure we want to do that
2021-02-12 13:41:41 +01:00
def 351705b6fb Add discord dylib on Mac 2021-02-12 12:32:45 +01:00
heinrich5991 76d7835fc0 Properly support CMake 3.8 and up for dynamic linking
Messed it up when trying to unify CMake 3.8+ and CMake 3.14+ handling.
2021-02-03 00:28:49 +01:00
heinrich5991 211b1d9155 Allow to dynamically load the Discord SDK on Linux
Set `-DDISCORD_DYNAMIC=ON` on the CMake command line to enable this
feature.

Fixes #3580.
2021-02-01 12:20:11 +01:00
bors[bot] 2b5723cdef
Merge #3492 #3559 #3561 #3565
3492: Support F-Client and replace non-extended extension messages r=Learath2 a=heinrich5991

This continues what #3439 started, and also replaces non-extended messages that are DDRace extensions with extended messages. The DDNet server still sends the old message to old clients and the DDNet client still understands the old messages.

Supersedes #3439.

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


3559: Don't highlight us if we have no name (alternative fix for #3554) r=heinrich5991 a=def-

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


3561: Fix input message position in teehistorian files r=heinrich5991 a=Zwelf

Previously the message was recorded when incoming. But the time when the input should apply wasn't recorded. Now inputs are recorded right before they get applied in the game world.

And record exact tick where load/save result is returned.

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


3565: Add Arabic language translation by .Yukki r=heinrich5991 a=def-

![screenshot-20210131@093216](https://user-images.githubusercontent.com/2335377/106378755-747d7780-63a7-11eb-9553-6a1898907441.png)

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [x] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [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: fokkonaut <35420825+fokkonaut@users.noreply.github.com>
Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
Co-authored-by: def <dennis@felsin9.de>
Co-authored-by: Zwelf <zwelf@strct.cc>
2021-01-31 14:37:48 +00:00
def 6fbc8187b5 Fix Windows Discord build
CMake Error in CMakeLists.txt:
  IMPORTED_IMPLIB not set for imported target "discord-shared" configuration
  "Release".
2021-01-31 10:17:21 +01:00
heinrich5991 c2b28f124b Put the Discord stuff into its own file 2021-01-31 10:17:21 +01:00
Edgar 96db08b760 add discord rich presence 2021-01-31 10:17:21 +01:00
def 9c5b5ce2d0 Add Arabic language by .Yukki 2021-01-31 10:13:32 +01:00
heinrich5991 43998ce41a Replace projectile hack with a new extended snapshot object
Still send the old hack to old clients, still accept the old hack from
old servers. This is so F-Client can support DDNet servers without such
hacks.
2021-01-26 20:58:42 +01:00
heinrich5991 3539f2b183 Allow ParseUuid to report errors and add tests 2021-01-23 01:21:20 +01:00
Alexander Akulich 242aa63178 ddracechat.h is used by the client, so move it to src/game
where ddracecommands.h already is.
2021-01-16 03:20:57 +03:00
bors[bot] 40a36c2dfc
Merge #3377 #3487
3377: Add Thread Safety Analysis r=heinrich5991 a=def-

https://clang.llvm.org/docs/ThreadSafetyAnalysis.html

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


3487: Fix centisecs rounding in str_time_float 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-01-10 15:00:19 +00:00
Alexander Akulich dc5b9340d5 Extract allocation macros to alloc.h (mimic the upstream)
See the upstream commit 24bda2faa0
2021-01-10 14:25:12 +03:00
Aurelien Jarno 08f9d037e9 Link with -pthread instead of -lpthread
The canonical way to link with the thread library is to use -pthread, which
brings in additional libraries like libatomic.so on riscv64. However cmake
defaults to link with -lpthread which only bring the libpthread.so library.
Fortunately it has the option THREADS_PREFER_PTHREAD_FLAG for that, which is
"highly recommended" but not the default.
2020-12-30 21:50:36 +08:00
def 59f1c2cbe6 Add New Year season theme by mind and use for 2 days
Map reduces my FPS from 60 to 45, mind can't optimize it further.

I'd release this as 15.2.5 in 1-2 days ideally with no other new changes in.
2020-12-28 17:45:04 +01:00
def e592afc98c Add Thread Safety Analysis
and annotate some code: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
2020-12-23 18:13:21 +01:00
fokkonaut d4c4031f20 Add F-DDrace entities 2020-12-22 12:23:21 +01:00
heinrich5991 9cce68023a Export all symbols from the main executable for the antibot
Add `-rdynamic` if supported by the linker.

Not all symbols being exported broke our builds recently, the antibot
library used `mem_comp` from the main binary but it wasn't exported,
leading to the following runtime error:

```
./DDRace64-Server_sql: symbol lookup error: /home/teeworlds/servers/libantibot.so: undefined symbol: mem_comp
```
2020-12-09 10:17:11 +01:00