Commit Graph

144 Commits

Author SHA1 Message Date
libretroadmin
bf5409881c gfx_display_rotate_z optimizations - if radians is 0, we know cosine
and sine already. Avoid the computation with sinf/cosf and pass it as value to the
function when possible
2022-07-06 11:03:15 +02:00
libretroadmin
6607ff3aaa rotate_draw - get rid of scale_x/y/enable - scaling is only done now
in XMB at two spots - refactor gfx_display_rotate_z so that it only
manipulates the input matrix' Z axis
2022-07-05 20:50:01 +02:00
libretroadmin
336ca1a68c Don't call gfx_display_rotate_z unless the display driver implementation's
'handles_transform' is set to false
2022-07-05 17:20:01 +02:00
libretroadmin
1798651041 (gfx_widgets) scale_enable can b set to false for widgets, scale_factor was always 1.0f
(XMB) set scale_enable to false when scale_factor is 1.0f
2022-07-05 14:18:20 +02:00
libretroadmin
681e1dea94 gfx_display_rotate_z - if scale_x/y/z are all 1.0f, then set
scale_enable to false
2022-07-05 14:02:38 +02:00
libretroadmin
367dfd6e71 No longer include file_path_special.h in gfx_display.h 2022-06-26 18:35:07 +02:00
Guo Yunhe
ab65e31e09
fix: osd fonts for chinese, korean, arabic and persian (#13639) 2022-02-26 18:05:55 +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
Tony
71836c1055
Add option for showing notifications only in menu (#13326) 2021-12-16 14:38:43 +01:00
MrHuu
8171e513aa [3DS] Fix achievement widget 2021-11-09 19:47:45 +01:00
twinaphex
e72a88a98e Move some variables to widget state 2021-10-13 17:25:31 +02:00
twinaphex
d39ea61109 Add HAVE_SCREENSHOTS ifdef 2021-09-30 15:55:31 +02:00
twinaphex
5ba8843354 Move dispwidget_get_ptr over to gfx_widgets.c 2021-09-30 04:40:15 +02:00
twinaphex
6eeebeab25 Get rid of gfx_display_set_msg_force 2021-09-21 21:10:38 +02:00
twinaphex
5eb795bf5b (widgets) Get rid of dead code 2021-09-20 02:21:05 +02:00
twinaphex
5e4ce74000 Get rid of duplicate code in gfx_widgets -
gfx_display_get_widget_dpi_scale made redundant
2021-09-13 20:21:36 +02:00
Tony
51b365b5e3
New regular widget message appearance (#12851) 2021-09-08 18:14:41 +02:00
twinaphex
0db409d5b5 Move lots of menu code over to menu/menu_driver.c - moved at least
44Kb of code over
2021-08-31 00:43:04 +02:00
twinaphex
cf7b30481b Get rid of gfx_widgets_draw_icon_blend - was just a duplicate of
gfx_widgets_draw_icon with blend_begin and blend_end wrapped around it
2021-08-29 15:21:40 +02:00
twinaphex
bea512b70b Get rid of gfx_display_draw_texture - use gfx_display_draw_quad instead 2021-08-22 17:57:21 +02:00
jdgleaver
7a3d78b1c0 (Menu+Widgets) Add workaround for FPU bug that breaks scale factor comparisons on certain platforms (fixes XMB thumbnails on 32bit Linux/Windows) 2021-07-12 12:14:55 +01:00
toshixm
4fab84ca9e improve message wrapping with CJK languages 2021-06-03 21:09:35 +09:00
twinaphex
e5e8e9b5d8 Expand widget init function 2021-04-08 00:51:10 +02:00
twinaphex
af00dca08b Get rid of some pointer grabbing for disp_get_ptr by making it
a part of video_frame_info
2021-04-05 14:55:28 +02:00
jdgleaver
371d0b7395 Add optional menu screensaver 2021-04-01 17:26:43 +01:00
twinaphex
cd9d6c0511 gfx_display - Get rid of lots of pointer grabbing 2021-03-25 20:12:34 +01:00
twinaphex
0674de54ee (gfx_widgets.c) Get rid of more pointer grabbing to
config_get_ptr/dispwidgets_get_ptr/etc
2021-03-25 15:05:09 +01:00
twinaphex
998673b8c3 (gfx_widgets) Cleanups 2021-03-25 04:59:07 +01:00
twinaphex
fada1caf68 Move two widgets functions over to proper source file 2021-03-25 04:55:27 +01:00
twinaphex
be3960e2be (gfx widgets) Add widgets_userdata to video_frame_info 2021-03-24 19:16:46 +01:00
twinaphex
68027c606e Silence some warnings 2021-02-09 16:43:40 +01:00
twinaphex
e8a7195a46 Rename gfx_timer_start to gfx_animation_timer_start 2020-10-14 07:26:24 +02:00
twinaphex
992e780407 Get rid of gx_timer_kill 2020-10-14 02:09:39 +02:00
twinaphex
6e09eada2d Cleanups 2020-10-14 01:02:22 +02:00
twinaphex
088e6b9e44 Move gfx_widgets_pure_white to dispwidget struct 2020-10-05 19:59:15 +02:00
twinaphex
90503f885b Move msg_queue_background to struct 2020-10-05 19:54:54 +02:00
twinaphex
f82b357f86 Remove getter gfx_widget_get_backdrop_orig 2020-10-02 22:12:05 +02:00
twinaphex
cd469d3fb2 gfx_widgets_draw_regular_msg - optimization - only set alpha colors
again if alpha hasn't already been applied
2020-10-02 13:33:05 +02:00
twinaphex
2594bd2cf6 Some static globals can be moved to functions 2020-10-02 13:30:57 +02:00
twinaphex
c45e7c9bc5 Cleanup 2020-10-02 11:36:11 +02:00
twinaphex
a38ecbe7de gfx_widgets_iterate - cleanup 2020-10-02 11:32:49 +02:00
twinaphex
c736f2ce28 Cleanups 2020-10-02 11:00:19 +02:00
twinaphex
497f2d92b5 gfx_widgets_ai_service_overlay_load - cleanup 2020-10-01 12:20:34 +02:00
twinaphex
a02f8a24fa Get rid of forward declarations 2020-10-01 11:06:59 +02:00
twinaphex
fe38cd9cbc (gfx widgets) get rid of more getter functions 2020-10-01 10:55:37 +02:00
twinaphex
dee807cb54 (gfx widgets) Start removing a lot of getter functions 2020-10-01 10:50:45 +02:00
twinaphex
1e6828fd63 Cleanups 2020-09-30 19:18:40 +02:00
twinaphex
03ff504aa8 Remove gfx_display_scissor_end 2020-09-28 04:04:16 +02:00
twinaphex
9d6bfabd02 Move reset_list_buffer to gfx_widgets and turn it into a static function 2020-09-28 03:30:22 +02:00
twinaphex
a56673e52d MSVC buildfix 2020-09-26 23:37:03 +02:00