Commit Graph

186 Commits

Author SHA1 Message Date
sonninnos
2e90ec9202
More widget corrections (#16296) 2024-02-26 20:59:43 -08:00
sonninnos
fa3c685ef9
Minor widget alignments (#16288) 2024-02-26 03:12:31 -08:00
sonninnos
3c4dd50974
More widget additions and adjustments (#16287) 2024-02-25 20:23:08 -08:00
sonninnos
8342b3cebe
Widget position+size+color adjustments (#16284) 2024-02-24 23:44:29 -08:00
Eric Warmenhoven
79e43e2bd4
Fix many warnings (#16180)
Also change iOS/tvOS to use system zlib instead of compiling it in
2024-01-31 09:15:14 -08:00
sonninnos
b341d90c2e
Fix word wrapped widget length (#15905) 2023-11-14 09:51:43 -08:00
Cpod12
274d47f957
Xunkar's AI service rework updated (#15640)
* AI service rework

* File missing

* Fixed C89 build

* Fixed usage of inline for C89 build

* Fixed an overlay unloading bug

Made sure to unload the overlay on release and when the server returns empty values in automatic modes.

* Fixed forward decl (c89)

* Fixed OpenGL texture loading

Moved image display to the main thread for now

* Changed some formatting slightly

* Fixed struct variable order and put brackets on newlines

* Moved pointer, fixed retroarch.cfg, and replaced strlcat with strlcpy

* Fixed catenation issue

* Fixed a few other catenation issues

* Fixed one more concatenation  issue

* Fixed concatenation issue

* Fixed a few other concatenation issues

* Fixed one more concatenation  issue

* potential fix for parsing issue

---------

Co-authored-by: Xunkar <329857+xunkar@users.noreply.github.com>
2023-10-24 00:27:06 -07:00
Eric Warmenhoven
ef12e43522
Fix reading past the end of an allocated buffer. (#15713)
title_length is originally calculated to be the msg length, but later
if the task has a title then that is used instead, but the length is
not updated. If msg is longer than title, we read past the end of the
buffer.
2023-09-20 10:50:35 -07:00
libretroadmin
f53ada6489 Cleanups, style nits, try to reduce some more strlens, etc. 2023-08-17 18:20:45 +02:00
libretroadmin
c6c7c343df video_frame_info - more flags 2023-08-16 19:47:24 +02:00
libretroadmin
bc41e0fdf4 video_frame_info - start passing flags 2023-08-16 19:17:23 +02:00
libretroadmin
0c51321099 Get rid of font_driver_flush 2023-06-15 23:41:40 +02:00
Grisly Glee
2cc377c154 Fix corrupt task progress percentage 2023-06-06 01:53:13 +02:00
libretroadmin
8a5a59da50 Refactors, move some functions to retroarch.c and make them static 2023-05-31 16:08:31 +02:00
libretroadmin
5e94d81f33 gfx_display_font_free - useless wrapper function 2023-05-28 22:26:21 +02:00
libretroadmin
a6c54a8e54 Simplify gfx_display_get_widget_pixel_scale - code was only ever called from XMB 2023-05-28 22:07:48 +02:00
libretroadmin
3b823d18d5 Simplify some code in gfx_display.c 2023-05-28 21:34:57 +02:00
libretroadmin
baba57c10a Cleanups 2023-05-08 00:08:44 +02:00
libretroadmin
6b71214ed7 Silence some signed/unsigned mismatch warnings 2022-11-21 19:34:43 +01:00
sonninnos
69060796bb
Improve widget appearance with missing assets (#14588) 2022-11-04 00:15:31 +01:00
sonninnos
bbd6c0ae9a
Add delay to savestate notifications (#14514) 2022-10-15 11:29:07 +02:00
LibretroAdmin
f40d157571
Use flags pt3 (#14491)
* (Vulkan) Use flags for vulkan_emulated_mailbox

* Use flags for vk_texture

* dispgfx_widget - use flags instead of bools

* (Autoconfig) Use flags
2022-10-07 11:08:17 +02:00
LibretroAdmin
0bdc761adb
Buildfix for previous commit 2022-10-06 09:32:26 +02:00
LibretroAdmin
30eb0edcf8 Use flags for some structs instead of tons of bools - less state/variables to bookkeep,
less memory used
2022-10-06 06:53:13 +02:00
reallibretroadmin
0033224c25 Fix some implicit conversion signedness warnings 2022-10-02 03:22:34 +02:00
LibretroAdmin
55391ac29f Plug some more implication conversion of return value of strlen 2022-09-02 01:22:12 +02:00
LibretroAdmin
0ffdd14940 Change msg_len of font driver to size_t - avoids all the type
casting/conversion
2022-09-02 01:10:28 +02:00
LibretroAdmin
25b76fdb54 input_keyboard_osk_event_append and others: don't call strlen
implicitly, always leave it up to caller
font_driver_get_message_width - try to avoid scenario where 'len'
is 0
2022-08-27 15:13:56 +02:00
LibretroAdmin
e769436876 (word wrap functions in stdstring.c) Avoid implicit strlens, caller
should pass the 'length' to the function instead
2022-08-23 17:06:01 +02:00
Jamiras
85c44f9245
more thread-awareness in task callbacks (#14337)
* more thread-awareness in task callbacks
2022-08-23 15:11:11 +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
6dd52d9bb1 Get rid of more boilerplate code in file_path_special.c 2022-08-02 18:05:51 +02:00
LibretroAdmin
f472e4d0de (gfx_widgets) Call fill_pathname_application_special outside of hot functions
(gfx widgets) Pre-assemble and store paths that are not subject to change
2022-08-01 02:07:36 +02:00
libretroadmin
8ac1a36259 Don't do NULL termination on strings when passing to strlcpy and/or
a file_path function that calls strlcpy under the hood
2022-07-26 07:01:10 +02:00
sonninnos
1245cbc63b
Widget color+position adjustments (#14195) 2022-07-22 02:36:49 +02:00
LibretroAdmin
29774f5b7a
Small opts (#14186)
* (joypad_connection) Small optimizations -
* Turn functions static where possible
* Hose strlen call out of loop

* (input_driver.c) General cleanups:
* Some small code/style nits

task_screenshot.c:
* Move widget callback function for screenshots to task_screenshot.c

(file_path.c):
* Turn get_pathname_num_slashes into static function
* path_linked_list_free - always returns true, so get rid of return value
* path_linked_list_new - fix function signature
* path_get_archive_delim - do not NULL-terminate string, already done by strlcpy later on

General:
* Slight optimizations - use int/size_t for loop counter variable instead of unsigned
* Take advantage of fact that strlcpy already NULL-terminates, so don't do this explicitly
outside if we're just going to end up calling strlcpy/fill_pathname_join on it anyway
2022-07-19 10:01:33 +02:00
libretroadmin
c2f618d394 * (gfx_widgets) ptr_width >= ptr_height - equal would just mean setting ptr_width to
the same value, so turn it into 'greater than' instead
* Avoid some tertiary operators where we just set the variable back to its
own value
2022-07-09 13:00:50 +02:00
libretroadmin
821bb86b37 Get rid of HAVE_THREADS macros 2022-07-06 15:01:53 +02:00
libretroadmin
3c20e709ea Move gfx_display_reset_textures_list_buffer to gfx_display.c 2022-07-06 13:11:44 +02:00
libretroadmin
3aafa40c69 Bugfix for previous commit - cosine/sine were wrong 2022-07-06 12:09:08 +02:00
libretroadmin
bb6937949d gfx_widget_draw_icon optimization - if radians is 0, we know cosine and
sine already. Avoid sinf/cosf computation when possible
2022-07-06 11:40:59 +02:00
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