Commit Graph

411 Commits

Author SHA1 Message Date
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 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
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 adf9994828 Deprecate fill_pathname_base_noext 2022-07-11 20:13:44 +02:00
libretroadmin 0f24d52407 audio_driver_mixer_add_stream - add fall-through - simplify code 2022-07-09 13:44:55 +02:00
libretroadmin f12ad9ed34 Simplify audio mixer functions 2022-07-05 18:57:56 +02:00
LibretroAdmin 4a38831c47
Try to reduce fixed size char arrays from PATH_MAX_LENGTH to lower sizes (#14062)
* Try to reduce fixed size char arrays from PATH_MAX_LENGTH to lower sizes
2022-06-18 19:07:15 +02:00
jdgleaver 801b16885e Enable automatic configuration of 'VSync Swap Interval' 2022-05-12 14:22:46 +01:00
jSTE0 fccef557fc
miyoo: Enable ALSA audio driver and default to it (#13814)
Enable it as it does not freeze. This provides an audio backend that
can report its buffer status, allowing auto frame skip to work on cores
that support it.

Do not build or include alsathread as it results in choppy audio.
Similarly, leave tinyalsa disabled as it plays back at a higher pitch
and is also choppy.

Change the default sample rate to 32000Hz as the previous default of
32730Hz is derived from the 3DS.
2022-04-02 08:07:25 +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
jdgleaver e3217b4a35
Remove frame limit from audio batch callback (#13333) 2021-12-06 18:11:46 +01:00
twinaphex b4137915e8 Move code to proper locations 2021-11-23 16:58:36 +01:00
Autechre 1280151d13
Merge pull request #13216 from libretro/splitup-record
Split up recording code
2021-11-11 02:00:52 +01:00
twinaphex 86f899c844 Revert "Shorten character arrays that are passed to fill_pathname_base_noext"
This reverts commit 318108ac82.
2021-11-10 08:22:19 +01:00
twinaphex 0b768d0460 Split up recording code 2021-11-10 02:34:04 +01:00
twinaphex 318108ac82 Shorten character arrays that are passed to fill_pathname_base_noext 2021-11-10 00:09:33 +01:00
twinaphex 88c771fc66 Cleanups 2021-11-07 01:44:45 +01:00
twinaphex 514ed00f2d Move configuration state over to configuration.c - take it out of
p_rarch
2021-11-03 21:22:37 +01:00
twinaphex 70b337782d Fix MSVC build 2021-10-15 00:11:52 +02:00
twinaphex e47e9968ed Move audio_driver_menu_sample to audio_driver.c and turn
audio_driver_flush into static function
2021-10-13 16:29:41 +02:00
Autechre e7f182811a
Split up audio code into new file audio/audio_driver.c (#13097)
* Split up audio code into new file audio/audio_driver.c

* Fix build issues #1

* Small cleanup

* Fix typo
2021-10-11 18:01:37 +02:00
twinaphex 127bf556c7 Merge audio_driver.c into retroarch.c 2019-06-17 12:49:21 +02:00
twinaphex 8ff9e7254d (audio_driver.c) Cleanups 2019-05-29 14:26:14 +02:00
Brad Parker 10df615d14 add "Send Debug Info" option under Help 2019-03-07 19:17:54 -05:00
twinaphex 829aedc6e2 (Video/Audio) Remove 'own driver' mechanism 2019-02-27 17:09:15 +01:00
twinaphex a51acb8377 Buildfix 2019-02-12 04:03:10 +01:00
twinaphex 660d0c8de9 Remove mutexes - should hopefully fix dolphin/reicast threaded
again
2019-02-12 03:55:08 +01:00
twinaphex 386657a366 (menu widgets backport) Re-commit task queue changes 2019-02-08 08:00:32 +01:00
twinaphex 7022786f34 Revert parts of menu_widgets that were causing breakage, but leave
all the hooks in so we can add them back piece by piece again
2019-02-08 07:26:43 +01:00
natinusala c20ab3864d First version of menu widgets (gl only) 2019-02-06 20:48:24 +01:00
Twinaphex 7fedabee4b
Merge pull request #8163 from orbea/cleanup
Cleanup
2019-02-04 23:19:05 +01:00
twinaphex ebce936557 Fix UWP builds 2019-02-04 23:14:20 +01:00
orbea 28ff4b391a Clean up white space. 2019-02-03 16:00:50 -08:00
twinaphex 6aca340927 (OSX) Add CoreAudio V3 driver from stuartcarnie 2019-01-31 23:14:56 +01:00
twinaphex 9421584772 Header include updates 2019-01-31 19:41:51 +01:00
twinaphex 000646e51e Update header includes 2019-01-31 19:06:27 +01:00
twinaphex 1c9cabf249 Add HAVE_THREADS ifdefs 2019-01-28 13:04:20 +01:00
twinaphex 23463408d5 Use some macros here to avoid function call overhead 2019-01-28 08:23:20 +01:00
Brad Parker 90db5e7e27 Implement in-menu sound effects 2019-01-27 11:22:16 -05:00
twinaphex fc57b41ab6 (Audio mixer) You can now specifically set a slot to load a sound in
- set type to AUDIO_MIXER_SLOT_SELECTION_MANUAL and set idx to the
slot you want to load in (begins at 0)
2019-01-18 00:24:31 +01:00
twinaphex 65d5de6674 Add 4 additional mixer slots for system sound effects and music
for menu
2019-01-17 03:03:46 +01:00
twinaphex b9ff2e4de1 Fix some static code analysis warnings from MSVC 2017 2019-01-10 21:47:15 +01:00
Twinaphex 40997473ed
Merge branch 'master' into orbis2 2019-01-08 20:18:08 +01:00
orbea bfc366decc Squeeze extra blank lines with cat(1).
Example:

find . -type f -iname '*.c' | while read -r i; do
  cat -s "$i" > "$i.new"
  mv "$i.new" "$i"
done
2019-01-08 11:04:58 -08:00
Francisco Javier Trujillo Mata 1591bc2db2 Create Audio Driver from PS2 2019-01-03 13:16:27 +01:00
Francisco José García García a1e455d197 [ORBIS] Initial audio driver 2018-12-31 00:37:08 +01:00
nia 3ef9bbb592 Add an AudioIO dirver for NetBSD and Solaris. 2018-12-21 14:15:30 +00:00
twinaphex 726de8e447 Apply diff to fix #6382 2018-10-21 05:40:50 +02:00
twinaphex 50eb4adc4b (libnx) Use audio_switch_thread by default 2018-10-06 17:35:52 +02:00
misson20000 7072bbb829 [NSW] SDK compat fixups 2018-09-15 03:27:29 -07:00
twinaphex 2a7a2e7dee (LIBNX) Start backporting libnx code; beginning with audio drivers 2018-09-12 08:14:17 +02:00
Tatsuya79 e48b9011bf Don't adjust audio for VRR. Silence log message about it. 2018-08-09 12:29:40 +02:00
twinaphex 7bc66ae710 Buildfixes for MSVC 2015 2018-05-03 15:20:06 +02:00
twinaphex ea77fbbd38 Increase max streams from 8 to 16 2018-05-02 23:42:39 +02:00
twinaphex ab360ae3ac (Audio mixer) Add Sequential playback mode 2018-05-02 21:43:16 +02:00
twinaphex 0d36993ceb Remove name when sound is done 2018-05-02 21:02:45 +02:00
twinaphex 68a2f18bfb Cleanups 2018-05-02 20:52:06 +02:00
twinaphex 5e32f7ab40 Add To Mixer and Add To Mixer And Play actions 2018-05-02 20:39:55 +02:00
twinaphex 9fbfd503af Add value descriptions for audio mixer streams 2018-05-02 20:13:13 +02:00
twinaphex 5aeab54ab7 (Audio mixer) Ability to individually set volume per stream 2018-04-30 17:51:01 +02:00
twinaphex 01e85b321b Improve audio_driver_menu_sample 2018-04-30 15:44:12 +02:00
twinaphex 49341bac26 Add Play/Play (Looped) actions 2018-04-30 15:04:29 +02:00
twinaphex 965859ddcb Start adding mixer controls - ability to stop and remove loaded tracks 2018-04-30 14:34:25 +02:00
twinaphex b0ef193117 Add 'Enable menu audio' setting 2018-04-29 00:41:53 +02:00
twinaphex 773fc1ebad Create audio_driver_menu_sample 2018-04-29 00:06:54 +02:00
twinaphex b6df41d808 (audio_driver.c) Cleanups 2018-04-28 20:06:07 +02:00
twinaphex e7272ddefa (Audio mixer) Add MP3 support as well 2018-04-28 14:18:04 +02:00
twinaphex faa99bd323 Start adding FLAC hooks 2018-04-27 23:45:06 +02:00
Twinaphex 08a54e45f2 Get rid of a lot of implicit conversions 2018-04-09 15:56:45 +02:00
twinaphex e4b955d4d4 Fix sample count reporting 2018-03-24 16:29:39 +01:00
twinaphex 875450e228 Statistics - add sample count 2018-03-24 15:42:45 +01:00
twinaphex 1fb7d14b36 Add audio statistics 2018-03-24 12:38:25 +01:00
twinaphex 9343eacc0a Create public function compute_audio_buffer_statistics 2018-03-24 12:25:52 +01:00
Dwedit 3297900543 Add the early return to audio_driver_sample_batch 2018-03-23 17:22:00 -05:00
Dwedit 575265ff06 Remove early return from audio_driver_flush 2018-03-23 14:46:32 -05:00
Dwedit 7deeb6d2fa Functions to enable and disable audio and video, and an environment function to query status of audio and video enables 2018-03-23 14:12:05 -05:00
twinaphex 9c305f7e95 Update 2018-02-03 12:22:08 +01:00
twinaphex 535012f8bf Put compute_audio_buffer_statistics behind ifdef DEBUG 2018-02-02 21:57:58 +01:00
twinaphex 7ab992e858 Add missing null pointer check 2018-01-29 23:01:58 +01:00
twinaphex 11f26ed549 Refactor verbosity code - try to avoid log calls if verbosity is not
set
2018-01-17 06:28:26 +01:00
twinaphex 8860619a5e Add audio_resampler_quality to config file 2017-12-31 21:25:07 +01:00
twinaphex b9248cf3af Start preparing runtime toggleable resampler quality settings 2017-12-31 20:55:26 +01:00
twinaphex 7e61f08cdb Simplify audio_driver_flush 2017-12-30 14:14:30 +01:00
misson20000 033a7259b4 audio driver for the switch 2017-12-29 00:10:01 +01:00
Alcaro a7be0520b5 Define replaced 2017-12-28 04:24:33 +01:00
Alcaro b933a8796b Let's not pretend to calculate deviation if we don't actually do that 2017-12-28 03:05:42 +01:00
gblues 6904101c44 Clean up trailing whitespace
== DETAILS

Really simple code cleanup, because my editor flags trailing whitespaces
and it's pretty annoying.
2017-12-12 00:24:18 -08:00
twinaphex 721afe22d8 (MSVC 2010) Compile griffin.c as C 2017-10-02 22:06:32 +02:00
twinaphex 12957e461d Reduce more stack usage for offending functions 2017-09-09 05:26:14 +02:00
twinaphex 8654f124d1 Cleanup of audio_driver_dsp_filter_init - reduce stack usage 2017-09-09 04:56:13 +02:00
twinaphex c0207e9b56 Revert "Reduce size of variables"
This reverts commit 79f1166c6e.
2017-09-09 00:20:39 +02:00
twinaphex 79f1166c6e Reduce size of variables 2017-09-08 23:44:10 +02:00
twinaphex c3bb76a05e Try to reduce variable sizes 2017-09-08 05:58:48 +02:00
Brad Parker 0a1b3fedc0 VC6 support (targets NT 3.51) 2017-09-06 23:03:02 -04:00
Romain Tisserand cbe2d9a941 Preliminary MOD/S3M/XM support through ibmx library (part of micromod repository) 2017-08-04 15:05:29 +02:00
twinaphex 33c96bf6f2 This crashes 2017-06-24 22:09:18 +02:00
Charlton Head 4ad5f67663 TinyALSA support 2017-06-23 20:44:00 -05:00
twinaphex 80e2911bec Cleanups 2017-06-11 00:23:19 +02:00
twinaphex 34c1c5a361 Try to guard against value being -1 2017-06-09 12:15:26 +02:00
twinaphex cdf7a403ea Add audio mixer mute enable 2017-06-08 23:53:24 +02:00