1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-08 12:15:49 +00:00
Commit Graph

25 Commits

Author SHA1 Message Date
Nikos Chantziaras
0357b6c922
Add on-screen statistics toggle hotkey (#13381)
* Add on-screen statistics toggle hotkey

* CHANGES.md: Add technical statistics hotkey
2021-12-21 00:03:35 +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
efa16a8fca Revert "(Netplay) Cthulhu88 -"
This reverts commit cb4028fd3d.
2021-11-12 19:00:42 +01:00
twinaphex
cb4028fd3d (Netplay) Cthulhu88 -
* Netplay Chat menu
* Toggleable bind for chat (bound to ~ [tilde] by default)
2021-11-10 02:41:02 +01:00
markwkidd
cea6b17391
bind trigger to first mouse button by default 2021-05-20 22:50:49 -04:00
Ryunam
f3aaf24219 Add Run-Ahead Toggle hotkey with notifications 2020-11-06 21:39:11 +01:00
Tony Jansson
eb5e5b546c Hotkey for Close Content 2020-09-08 22:12:42 +03:00
twinaphex
89b441787a Reorder retro_keybind, alignment 2020-08-15 22:36:56 +02:00
Guo Yunhe
c6139b7285
Merge branch 'master' into translation-update-script 2020-01-17 17:14:11 +02:00
Guo Yunhe
c4c8778017 Rebase 2020-01-04 21:56:20 +02:00
jovonna
decd374c15 Initial port to dingux platform 2020-01-04 12:20:03 -05:00
orbea
2a3695917b Silence -Wmissing-field-initializers warnings with clang.
Silences many similar warnings with -Wextra and clang.

In file included from menu/cbs/menu_cbs_ok.c:39:
menu/cbs/../../config.def.keybinds.h:109:139: warning: missing field 'def_joyaxis' initializer [-Wmissing-field-initializers]
   { true, RETRO_DEVICE_ID_JOYPAD_B,      MENU_ENUM_LABEL_VALUE_INPUT_JOYPAD_B,              RETROK_z,       NO_BTN, NO_BTN, 0, AXIS_NONE },
                                                                                                                                          ^
2019-07-22 11:03:24 -07:00
Barry Rowe
e9625b3ed9 AI Service feature. 2019-06-21 17:48:35 -07:00
Brad Parker
19ced73596 add hotkey to toggle netplay hosting 2019-03-09 17:48:03 -05:00
Brad Parker
4bb81bbb1b add F10 hotkey to send debug info, fix F3 hotkey for FPS toggle when inside menu 2019-03-09 16:03:17 -05:00
Brad Parker
477d46d52b update copyright 2019-02-22 19:13:36 -05:00
Tatsuya79
d52b38eadc Add FPS counter hotkey. 2018-11-29 13:12:11 +01:00
twinaphex
cb8148878c Add hotkeys for 'Toggle Recording' / 'Toggle Streaming' 2018-09-18 08:52:09 +02:00
radius
1c85058e72 [recording] rename bsv recording from movie to input replay 2018-09-15 21:47:23 -05:00
Brad Parker
a1aefc901c Qt WIMP GUI 2018-04-30 14:33:05 -04:00
Ryunam
c5775fd73c Implement Slow motion toggle 2018-03-10 18:42:45 +01:00
Gregor Richards
8d5a79fc69 Removing long-obsolete now-disfunctional "netplay flip players" feature 2018-01-05 14:27:02 -05:00
David Walters
dbd9bf3b46 New lightgun binds 2017-11-26 16:59:48 +00:00
David Walters
b190ac1943 Add 'mbutton' field to retro_keybind struct 2017-11-26 11:49:37 +00:00
Josh Palmer
50cb8d2b95 Add QNX-specific settings to config.def.h, refactor default keybinds into a separate file for cleaner per-platform setup 2017-01-09 20:26:09 +00:00