Commit Graph

932 Commits

Author SHA1 Message Date
LibretroAdmin
e7f3432e48 Replace some trivial strlcat usage - use return value of preceding
strlcpy then simply append the extension to it at this location
2022-08-04 03:45:09 +02:00
LibretroAdmin
5b56ff145f Refine documentation 2022-08-01 15:46:08 +02:00
libretroadmin
34a18f64e8 Don't do NULL termination on string when we pass the string to
strlcpy and/or a file_path function that does strlcpy under the hood
2022-07-23 10:46:05 +02:00
libretroadmin
4b5c7856e6 Remove some more explicit NULL-termination when we're calling a
string function that calls strlcpy under the hood
2022-07-19 20:43:12 +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
f7194e167f use path_basename_nocompression where it is safe to do so 2022-07-12 19:14:12 +02:00
libretroadmin
293722ac38 Get rid of fill_pathname_join_concat_ext 2022-07-11 22:01:20 +02:00
libretroadmin
e91cf0e40d No longer use fill_pathname_noext - just basic strlcpy/strlcat string
concatenation
2022-07-11 18:48:02 +02:00
Cthulhu-throwaway
177691e6fa
(Core Info) Ensure current core info is initialized at runloop_event_init_core when netplay is enabled (#14162) 2022-07-09 16:25:27 +02:00
libretroadmin
aae8c65880 Prevent unnecessary variable self-assignments caused by tertiary
operators - also simplify focused variable assignment
2022-07-09 13:58:10 +02:00
Cthulhu-throwaway
ef022ffe90
(Netplay) Force a core update when starting netplay (#14157) 2022-07-08 18:20:01 +02:00
libretroadmin
fbd37f8926 Consistency in variable naming conventions - rename temp_path to tmp_path
for uniformity with rest of code
2022-07-05 19:06:38 +02:00
libretroadmin
126940a98b Silence unused variable warnings for Emscripten 2022-07-01 13:49:49 +02:00
barbudreadmon
e9d67f2bbe
savestates: implement an api call for context awareness (#14101) 2022-06-30 10:45:59 +02:00
sonninnos
3d619de114 Automatic Frame Delay improvements 2022-06-14 07:11:43 +03:00
jdgleaver
801b16885e Enable automatic configuration of 'VSync Swap Interval' 2022-05-12 14:22:46 +01:00
jdgleaver
37c56d0d09
Add option to disable automatic saving of input remap files (#13894) 2022-04-27 19:12:53 +02:00
Jamiras
56c9db9c4c
re-enforce hardcore limitations once achievements are loaded (#13862) 2022-04-19 09:41:49 +02:00
barbudreadmon
d14d218b76
allow proper descriptor declaration for analog triggers (#13845) 2022-04-13 15:11:30 +02:00
Mats
4a1a1e2fa7
(steam) Introduce Steam Rich Presence (#13798) 2022-04-02 08:07:40 +01:00
strotlog
91bf7b553a (mmap) Handle disconnect bits on both sides of len 2022-03-27 04:36:03 +01:00
jdgleaver
c6e83d23f5 RETRO_ENVIRONMENT_SHUTDOWN Fixes
- Ensure core is properly unloaded when RETRO_ENVIRONMENT_SHUTDOWN is called
- Ensure menu stack is properly flushed when RETRO_ENVIRONMENT_SHUTDOWN is called
2022-03-18 13:15:47 +01:00
jdgleaver
ea77410037 Add 'Manage Remap Files' submenu + automatically save input remaps when closing content 2022-03-16 18:59:49 +01:00
jdgleaver
1490ad18a2
Prevent log spam when using rewind hotkey with cores that don't support rewind if rewind functionality itself is disabled (#13741) 2022-03-14 18:17:43 +01:00
Nikos Chantziaras
b094c58081
Add hotkey for toggling sync to exact content framerate (#13725)
* Add hotkey for toggling sync to exact content framerate

* CHANGES.md: add sync to exact content framerate toggle hotkey
2022-03-10 17:21:08 +01:00
Vladimir Serbinenko
4a53c6771c
Several fixes and improvements do NGC and Wii (#13698)
* Support new elf2dol path in Makefile.griffin

* Fix NULL pointer dereference when no core info is available

* Fix double include of different versions of libogc

* Move ngc and wii to Makefile.common

Resulting binary is 60K *smaller*. This is surprising but probably due to
less inlining happening

* gx_gfx: Fix hang on gfx initialization

* Remove sthread_isself on NGC/Wii

It relies on pthread_equal that is not there for either legacy pthreads
or normal pthreads on those platforms

* Wii networking

* Missing includes in split

* Network fixes

* Fix logging of non-format string as a format

* Support for gx netlogger

* Network fix

* Network fixes

* Network info

* gx: Move config files to app directory

Otherwise it clashes between wiiU and vWii version with unpredictable
effects
2022-03-04 13:43:00 +01:00
Tony
977a7d3eb6
Volume hotkey logic+response improvement (#13667) 2022-02-24 23:09:17 +01:00
jdgleaver
9b0cb0fc92
Add 'Standalone Cores' menu (#13655) 2022-02-22 19:23:48 +01:00
Vladimir Serbinenko
f0d8af0d34
Remove gong now that it has been successfully extracted into a standalone core (#13637) 2022-02-18 17:03:35 +01:00
jdgleaver
e541dd5ab1
Disable run-ahead and rewind based on save state support level defined in core info files (#13594)
* Disable run-ahead based on save state support level defined in core info files

* Disable rewind based on save state support level defined in core info files
2022-02-05 00:25:33 +01:00
jdgleaver
a953b27614
Rework optional fast-forward frame skipping: Drop frames based on frame timing (#13578) 2022-01-31 16:32:17 +01:00
Tony
84f558db0b
Add optional frame skipping when fast-forwarding (#13550) 2022-01-26 18:30:33 +01:00
Tony
940f7553fd
Add delay + acceleration to volume hotkeys (#13434) 2021-12-31 18:17:32 +01:00
twinaphex
689057a9b2 Fix iOS/CocoaTouch builds 2021-12-24 15:42:00 +01:00
twinaphex
43d0fa6248 remove unused variable 2021-12-24 12:51:23 +01:00
Jamiras
7ad71a4a05
fix memory map conversion (#13386) 2021-12-21 21:15:03 +01:00
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
Tony
8cc423e036
Logging cleanups (#13370) 2021-12-17 18:04:24 +01:00
Tilman M. Jaeschke
682bbab233
[New Feature] Load save states from command-line or playlist (#13354)
* load save states from command-line or playlist

* load save states from command-line or playlist

* removed some brackets
2021-12-14 14:08:06 +01:00
Tony
09880e92d2
Logging cleanups (#13320) 2021-12-04 14:21:12 +01:00
Tony
41838ef544
Refresh rate switch addition on startup (#13316) 2021-12-03 17:52:46 +01:00
Tony
121ca3a482
'Automatic Frame Delay' improvements: (#13297)
- swap interval handling
- d3dx handling
2021-12-02 02:32:39 +01:00
Autechre
5bb4df3a42
Move translation task code to tasks/task_translation.c (#13274) 2021-11-22 15:19:20 +01:00
twinaphex
9982452c18 Move code from retroarch.c to runloop.c 2021-11-22 03:33:58 +01:00
Autechre
2b87cd9313
Create runloop.c and split up runloop code to this new file; (#13269)
* Create runloop.c and split up runloop code to this new file;
retroarch.c now 207Kb and runloop.c 301Kb

* Define empty runloop_secondary_core_destroy
2021-11-22 03:27:23 +01:00
twinaphex
0a5d4288f5 Rollback runloop changes - will require a rethink in how we approach
this
2021-05-25 20:41:39 +02:00
twinaphex
2b4f2525d0 move more runloop functions over to runloop.c 2021-05-24 02:57:40 +02:00
twinaphex
75175ddbce move more runloop functiosn to runloop.c 2021-05-24 02:27:55 +02:00
twinaphex
b48ab663b0 Move BSV runloop code over to runloop.c 2021-05-23 02:20:01 +02:00