* change bsv file suffix to replay, update strings
* add trivial RPLY block to save states
* WIP rerecording support, doesn't load states properly yet--issue with checking identifiers?
* Fixed a type error to get time identifiers working right, ready for testing
* handle case where state without replay data is loaded during replay
* cleanups
* whitespace cleanup
* Cleanups, change replay file format magic, fix logic around future states
* Remove failed future message
* Add play-replay-from-slot command, fix load-state-from-slot to use given slot
* build fixes
* Fix race conditions in emscripten build and incorrect replay state incrementing
* Style fix for single line if
---------
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
* Add bsv replay controls (not yet fully implemented), remove toggle
see notes in task_movie.c, make sure command.c calls the right
functions, check retroarch.c and other todos.
bsv files are also now stored with states, not saves.
* Compilation fixes
* Added command impls for play and record replay, and some code in load state to do the right thing there
* Guard some parts of the new code with HAVE_BSV_MOVIE
* wip, menu fixes
* more menu fixes, osd for movie errors, halt recording properly
* Menu and label fixes
* move bsvs to own file suffix series under savestates, fix recording and playback command validity checks
* Fix replay autoincrement
* fix endif placement, whoops
---------
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
When a simple preset loads, wildcards which are found in paths inside the presets will
be replaced with values coming from the current RetroArch context. This will operate
on both texture paths and reference paths.
This would allow you to do things like have one preset which could be used with the entire list of images from the Bezel Project
E.G.
"/shaders/MyBackground_$VID-DRV$ _$CORE$.png"
would be replaced with
"/shaders/MyBackground_glcore_YabaSanshiro.png"
If no file found at that path, the path will revert to the original path, so operates as a fallback
"/shaders/MyBackground_$VID-DRV$ _$CORE$.png"
* Possible wildcards/tokens to be replaced:
*
* $CONTENT-DIR$ -> Content Directory of the game rom
*
* $CORE$ -> Core name
*
* $GAME$ -> Game ROM's name
*
* $VID-DRV$ -> Video Driver: Currently active driver, possible replacement values:
* glcore
* gl
* vulkan
* d3d11
* d3d9_hlsl
* "N/A"
*
* $VID-DRV-SHADER-EXT$ -> Video Driver Shader File Extension: The extension of shaders type supported by the current video driver:
* cg
* glsl
* slang
*
* $VID-DRV-PRESET-EXT$ -> Video Driver Preset File Extension: The extension of shaders type supported by the current video driver:
* cgp
* glslp
* slangp
*
* $CORE-REQ-ROT$ -> Core Requested Rotation: Rotation the core is requesting, possible replacement values:
* CORE-REQ-ROT-0
* CORE-REQ-ROT-90
* CORE-REQ-ROT-180
* CORE-REQ-ROT-270
*
* $VID-ALLOW-CORE-ROT$ -> Video Allow Core Rotation: Reflects Retroarch's setting allowing the core requested rotation to affect the final rotation:
* VID-ALLOW-CORE-ROT-OFF
* VID-ALLOW-CORE-ROT-ON
*
* $VID-USER-ROT$ -> Video User Rotation: Rotation the core is requesting, possible replacement values, does not affect the UI:
* VID-USER-ROT-0
* VID-USER-ROT-90
* VID-USER-ROT-180
* VID-USER-ROT-270
*
* $VID-FINAL-ROT$ -> Video Final Rotation: Rotation which is the sum of the user rotation and the core rotation if it has been allowed, does not affect the UI:
* VID-FINAL-ROT-0
* VID-FINAL-ROT-90
* VID-FINAL-ROT-180
* VID-FINAL-ROT-270
*
* $SCREEN-ORIENT$ -> Screen Orientation: User adjusted screen orientation, will change windows from landscape to portrait, including the Retroarch UI:
* SCREEN-ORIENT-0
* SCREEN-ORIENT-90
* SCREEN-ORIENT-180
* SCREEN-ORIENT-270
*
* $VIEW-ASPECT-ORIENT$ -> Viewport Aspect Orientation: Orientation of the aspect ratio of the RetroArch viewport
* VIEW-ASPECT-ORIENT-HORZ
* VIEW-ASPECT-ORIENT-VERT
*
* $CORE-ASPECT-ORIENT$ -> Core Aspect Orientation: Orientation of the aspect ratio requested by the core
* CORE-ASPECT-ORIENT-HORZ
* CORE-ASPECT-ORIENT-VERT
*
* $PRESET_DIR$ -> Preset directory's name
*
* $PRESET$ -> Preset's name
*
* If no wildcards are found within the path, or the path
* after replacing the wildcards does not exist on disk,
* the path returned will be unaffected.
* [Vulkan] Add v2 of context negotiation interface.
* [Vulkan] Add vkEnumerateInstanceVersion symbol.
* [Vulkan] Implement v2 context negotiation
* [libretro] Add GET_HW_CONTEXT_NEGOTIATION_INTERFACE_SUPPORT.
Works around issues in v1 interface where it was not possible to
query what frontend would do when faces with newer interface versions.
This env-call gives stronger guarantees how things have to work.
* [runloop] Implement GET_HW_CONTEXT_NEGOATION_INTERFACE_SUPPORT.
Fairly trivial. Just report the latest version.
* [Vulkan] Add stricted wording around get_application_info in v2.
* [Vulkan] Be more defensive about get_application_info() in v1.
* add keyboard recording support to bsv
BSV movies recorded in older RA *WILL NOT* replay properly after this
patch. While looking to see if the core actually uses a keyboard
device could mitigate this, it is an unavoidable consequence of using
BSV, a format which carries no metadata whatsoever.
* Fix for loop declarations and some whitespace
---------
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
* BSV ergonomics improvements
- Date stamp toggled recordings instead of overwriting or using save
slot number
- Properly stop movie on playback EOF; also pause emulation
- Add recording flag to match playback flag in bsv state enum
- Rename bsv "movie path" to "movie auto path" to clarify role
- Allow stopping movie playback before EOF using record toggle hotkey
---------
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
* Allow for both -e and -R to start a BSV file recording at a state
The key issue is that loading a state takes some time, and the BSV
recording shouldn't start until that's done.
The minimal patch for this would just be a change to runloop.c which
moves movie initialization after entry state loading, throwing in a
task_queue_wait(). This makes for some awkward repeated autoload OSD
messages and doesn't solve the underlying issue.
Most of this change puts BSV recording start/stop into tasks, like
saving and loading are tasks; this was important to centralize BSV
operations a bit more and is the first part of a refactoring towards
more robust input recording. The necessary wait is introduced in the
begin-recording callback.
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
- Moved BSV initialization before autoload code
- Don't trigger autoload code if there is bsv movie state
Open question: What's the difference between entry state and autoload
state? Should BSV recording use the entry state even if playback does
not?
Co-authored-by: Joseph C. Osborn <jcoa2018@pomona.edu>
WIP version of Append and Prepend preset, Includes UI for Standard Retroarch, but not the QT UI companion
Co-authored-by: HyperspaceMadness <remimcgill@hotmail.com>
* Add xdelta in deps
* Include <assert.h> in xdelta3.h
- Otherwise the static_assert calls can fail
* Build xdelta3 in Makefile.common
* Add xdelta support to the softpatching infrastructure
- The patching itself isn't fully implemented yet
* Adjust how xdelta3.h checks the sizes of some types
- Now checks max values instead of relying on autotools
* First crack at xdelta softpatching support
- There may be undiscovered edge cases or bugs
* Add xdelta in deps
* Include <assert.h> in xdelta3.h
- Otherwise the static_assert calls can fail
* Build xdelta3 in Makefile.common
* Add xdelta support to the softpatching infrastructure
- The patching itself isn't fully implemented yet
* Adjust how xdelta3.h checks the sizes of some types
- Now checks max values instead of relying on autotools
* First crack at xdelta softpatching support
- There may be undiscovered edge cases or bugs
* Remove trailing commas from the enums I modified
- C89 doesn't allow them
* Remove stray whitespace
* Adjust SIZE macros in xdelta3.h
- Move them outside the XD3_USE_LARGEFILE64 block
- Add more SIZE declarations
- Make SIZEOF_UNSIGNED_LONG_LONG contingent on the presence of ULLONG_MAX
* Add some RARCH_DBG calls for xdelta patching
* Enable support for xdelta's secondary compressors
- Necessary for some patches
* Fix some format specifiers
* Remove unnecessary files from xdelta
* Include xdelta3.h with a relative path
* Add xdelta3 headers to HEADERS variable
* Gate Xdelta support behind HAVE_XDELTA
- HAVE_XDELTA is on by default
- HAVE_PATCH is still required for HAVE_XDELTA to be meaningful
- Support is mostly contingent on the availability of LZMA
- Anything modern should be okay
- Legacy platforms (e.g. DOS) may need to have Xdelta support disabled
- At least until some other solution can be found
* Disable HAVE_XDELTA on platforms where the build recently failed
- These come from looking at the failed builds on GitHub
- These are guesses, and may turn out to be wrong
* Fix a potential memory leak
- Whoops, looks like I need to call two cleanup functions
- xd3_close_stream exists separately from xd3_free_stream
* Split the --help printout for --xdelta into its own strlcat call
- GCC was complaining about #ifdefs within macro arguments being non-portable
* Fix some incorrect printf format specifiers
* Modify Xdelta to adhere to C89
- It's mostly using RetroArch's INLINE macro instead of the inline keyword
- New descriptors: 'dpad_area' and 'abxy_area'
- Each has a diagonal sensitivity setting, 100% being 8-way symmetry
- Buttons can be redefined in the cfg file
E.g. This would create a d-pad area, then redefine it to use analog directions:
overlay0_desc0 = "dpad_area,0.85,0.57,rect,0.166228,0.295516"
overlay0_desc0_up = "r_y_minus"
overlay0_desc0_down = "r_y_plus"
overlay0_desc0_left = "r_x_minus"
overlay0_desc0_right = "r_x_plus"
* * Use flags for rarch_state
* Get rid of ^M linebreaks in retroarch_types.h
* Buildfixes for consoles
* (audio driver) use flags instead of bools
* (video) Use flags instead of bools
* Rewrite input driver state bools into flags
* Reduce snprintf and/or use them only for concatenating the
string formatting of numbers/values
* Reduce snprintfs
* Use snprintf for concatenation at parts
* * We don't need to NULL-terminate strings that get passed to strlcpy/strlcat
and friends
* Use snprintf for concatenation in certain instances
* Do away with some string intermediary copies where we can avoid it
* Fix warning unused variable
* * Reduce snprintf calls
* Rewrite snprintf calls into strlcpy where possible
* Use snprintf for concatenation when necessary
* Do away with some string intermediary copies in task_translation.c
* run_translation_service - make switch slightly smaller
(snprintf) Try to reduce or simplify snprintf calls, only tend to
use it for processing integers/numbers and avoid it for regular
string concatenation (NOTE: we try to be a bit safer about it to
address earlier cited criticism, although we don't consider concatenating
3 or 4 characters at the end to be insecure)
(msg_hash_to_str) Try to avoid duplicate calls to the same localized
string when we can just cache the results once instead locally
- (database_info.c) Optimizations for database_info_build_query_enum() -
it would call strlcat at the very least 3 times, normally more than that.
Every strlcat call is at least one or more strlens. Reduce it all down
to manual string concatenation and one strlcat
- (database_info_build_query_enum) - always NULL terminates string so no need for NULL termination done by callee
* (menu_displaylist) use smaller strings for basename paths, remove one unnecessary string
in menu_displaylist.c function
- (disk_index_file.c) Avoid another trivial string concatenation by doing
it manually after fill_pathname_join_special
- (fill_pathname_join_delim) since fill_pathname_join_delim() now has a return value, use it for
string concatenation
- (platform_unix) - Use BUFSIZ as size for a buffer in system_property_get
- some other trivial strlcat usage replacements
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
* (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
- Ensure core is properly unloaded when RETRO_ENVIRONMENT_SHUTDOWN is called
- Ensure menu stack is properly flushed when RETRO_ENVIRONMENT_SHUTDOWN is called
* 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
* 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
* 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