1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 20:25:47 +00:00
Commit Graph

24 Commits

Author SHA1 Message Date
libretroadmin
bd090dea71 Replace more strlcat calls 2023-07-16 18:07:49 +02:00
libretroadmin
e8242253a7 Reduce strlcat calls where possible 2023-06-19 06:00:10 +02:00
LibretroAdmin
6f738d4fbd Gradually get rid of strcpy_literal
Reasons:
1 - Just a macro for strcpy
1.2 - doesn't have a return type unlike strlcpy, can't be used
for string concatenation
1.3 - unsafe compared to strlcpy

Do either manual string assignment per character or strlcpy, no
inbetween by resorting to strcpy
2022-08-23 15:04:47 +02:00
LibretroAdmin
b2634ea588 * Create fill_pathname_join_special - and specify fill_pathname_join
as deprecated.
* Use fill_pathname_join_special in the vast majority of cases where
we can ensure out_path is a new empty string
* Get rid of some extension concatenation with strlcat where encountered
* Some general cleanups with NULL termination of strings that get immediately
passed to strlcpy/strlcpy-adjacent functions
2022-08-04 14:19:38 +02:00
libretroadmin
e4b33fd0e6 (formats/json/rjson.c) Get rid of some implicit strlens and pass
size parameter to the functions instead˜
2022-07-17 06:58:22 +02:00
Cthulhu-throwaway
ab208fca91
(Netplay) Ensure current content is reloaded before joining a host (#14117) 2022-07-01 01:02:04 +02:00
Cthulhu-throwaway
c1e8925f87
(Netplay) Find content task refactor (#14089) 2022-06-23 14:48:57 +02:00
Cthulhu-throwaway
7e798d04ba (Netplay) Some refactoring and fixes 2022-06-17 18:00:48 -03:00
Mats
4a1a1e2fa7
(steam) Introduce Steam Rich Presence (#13798) 2022-04-02 08:07:40 +01:00
Cthulhu-throwaway
690c802921
Netplay Stuff (#13375)
* Netplay Stuff

## PROTOCOL FALLBACK
In order to support older clients a protocol fallback system was introduced.
The host will no longer send its header automatically after a TCP connection is established, instead, it awaits for the client to send his before determining which protocol this connection is going to operate on.
Netplay has now two protocols, a low protocol and a high protocol; the low protocol is the minimum protocol it supports, while the high protocol is the highest protocol it can operate on.
To fully support older clients, a hack was necessary: sending the high protocol in the unused client's header salt field, while keeping the protocol field to the low protocol. Without this hack we would only be able to support older clients if a newer client was the host.
Any future system can make use of this system by checking connection->netplay_protocol, which is available for both the client and host.

## NETPLAY CHAT
Starting with protocol 6, netplay chat is available through the new NETPLAY_CMD_PLAYER_CHAT command.
Limitations of the command code, which causes a disconnection on unknown commands, makes this system not possible on protocol 5.
Protocol 5 connections can neither send nor receive chat, but other netplay operations are unaffected.
Clients send chat as a string to the server, and it's the server's sole responsability to relay chat messages.
As of now, sending chat uses RetroArch's input menu, while the display of on-screen chat uses a widget overlay and RetroArch's notifications as a fallback.
If a new overlay and/or input system is desired, no backwards compatibility changes need to be made.
Only clients in playing mode (as opposed to spectating mode) can send and receive chat.

## SETTINGS SHARING
Some settings are better used when both host and clients share the same configuration.
As of protocol 6, the following settings will be shared from host to clients (without altering a client's configuration file): input latency frames and allow pausing.

## NETPLAY TUNNEL/MITM
With the current MITM system being defunct (at least as of 1.9.X), a new system was in order to solve most if not all of the problems with the current system.
This new system uses a tunneling approach, which is similar to most VPN and tunneling services around.

Tunnel commands:
RATS[unique id] (RetroArch Tunnel Session) - 16 bytes -> When this command is sent with a zeroed unique id, the tunnel server interprets this as a netplay host wanting to create a new session, in this case, the same command is returned to the host, but now with its unique session id. When a client needs to connect to a host, this command is sent with the unique session id of the host, causing the tunnel server to send a RATL command to the host.
RATL[unique id] (RetroArch Tunnel Link) - 16 bytes -> The tunnel server sends this command to the host when a client wants to connect to the host. Once the host receives this command, it establishes a new connection to the tunnel server, sending this command together with the client's unique id through this new connection, causing the tunnel server to link this connection to the connection of the client.
RATP (RetroArch Tunnel Ping) - 4 bytes -> The tunnel server sends this command to verify that the host, whom the session belongs to, is still around. The host replies with the same command. A session is closed if the tunnel server can not verify that the host is alive.

Operations:
Host -> Instead of listening and accepting connections, it connects to the tunnel server, requests a new session and then monitor this connection for new linking requests. Once a request is received, it establishes a new connection to the tunnel server for linking with a client. The tunnel server's address and port are obtained by querying the lobby server. The host will publish its session id together with the rest of its info to the lobby server.
Client -> It connects to the tunnel server and then sends the session id of the host it wants to connect to. A host's session id is obtained from the json data sent by the lobby server.

Improvements (from current MITM system):
No longer a risk of TCP port exhaustion; we only use one port now at the tunnel server.
Very little cpu usage. About 95% net I/O bound now.
Future backwards compatible with any and all changes to netplay as it no longer runs any netplay logic at MITM servers.
No longer operates the host in client mode, which was a source of many of the current problems.
Cleaner and more maintainable system and code.

Notable functions:
netplay_mitm_query -> Grabs the tunnel's address and port from the lobby server.
init_tcp_socket -> Handles the creation and operation mode of the TCP socket based on whether it's host, host+MITM or client.
handle_mitm_connection -> Creates and completes linking connections and replies to ping commands (only 1 of each per call to not affect performance).

## MISC
Ping Limiter: If a client's estimated latency to the server is higher than this value, connection will be dropped just before finishing the netplay handshake.
Ping Counter: A ping counter (similar to the FPS one) can be shown in the bottom right corner of the screen, if you are connected to a host.
LAN Discovery: Refactored and moved to its own "Refresh Netplay LAN List" button.

## FIXES
Many minor fixes to the current netplay implementation are also included.

* Remove NETPLAY_TEST_BUILD
2021-12-19 16:58:01 +01:00
twinaphex
67c010394d Remove netplay_discovery.h - hopefully fixes other build issues 2021-11-05 19:12:55 +01:00
twinaphex
2820231dd0 Revert "Revert "remove unused variables""
This reverts commit 0c735e5c9c.
2021-11-05 18:53:09 +01:00
twinaphex
0c735e5c9c Revert "remove unused variables"
This reverts commit cea8528929.
2021-11-05 18:34:43 +01:00
twinaphex
cea8528929 remove unused variables 2021-11-05 17:40:56 +01:00
twinaphex
3ead1ac5df Move discord code to separate file 2021-11-05 14:00:37 +01:00
twinaphex
543e4bca16 Merge Discord code into retroarch.c 2020-06-06 20:50:25 +02:00
twinaphex
9fda2bdebd Add TODO/FIXME comments 2020-06-04 14:09:45 +02:00
twinaphex
ec35ce7fdc Add TODO/FIXME notes 2020-05-29 10:23:48 +02:00
twinaphex
6dc758a080 Move cheevos-new to cheevos/ 2020-05-21 23:23:01 +02:00
twinaphex
e1e6f2db51 Fix CXX_BUILD 2020-05-21 05:10:33 +02:00
twinaphex
d9ab59cb4a Comment out function that isn't used 2020-05-20 16:29:57 +02:00
twinaphex
115e779cf0 (Discord) Comment out code that isn't being used 2020-05-20 16:03:46 +02:00
twinaphex
3387170d62 (Discord) Cleanups - get rid of discord_register.h header 2020-05-20 15:43:01 +02:00
twinaphex
03ea12d334 Move discord files to network/ 2020-05-20 15:27:27 +02:00