Commit Graph
173 Commits
Author SHA1 Message Date
LibretroAdmin 5ab2152e6a The checks today's commits left behind: cloud sync reads, centre point picks, gapless WMA, the H.264 border
66376b18 sends cloud sync reads to disk through
task_push_http_download_file_with_headers(), which the webdav_options,
webdav_backup, webdav_reauth, s3_backup and gdrive_backup samples
include webdav.c, s3.c or google_drive.c without: none of them linked.
Each stubs it as the GET it is, recorded as their transfer stubs record
one. webdav_reauth's stale-nonce read wrote nothing to the file the
callback now opens, and read the stale copy there; it writes the body
first, as the download would.

ab6a34d3 has the point scaler take the sample nearest each output
pixel's centre, and video_frame_convert_to_bgr24()'s fused downscale
path (screenshots, translation) still started half a sample short, so
video_frame_failure_test found it apart from the scaler it checks
against. It starts from the centre too. Its 2x2 to 1x1 case now
expects the bottom right sample, the one nearest the centre.

a2cd6efc plays WMA1 and WMA2 gapless: a stream's first frame is the
encoder's priming and its second half plays on the drain.
wma_player_test's fixture is one frame, so what plays is that frame's
second half, as audio_transfer_wma_test was told in the same commit.

The H.264 encoder's border copies its first and last rows outwards,
rows that are never the same; the overlap check allows them.

The five cloud sync samples pass, video_frame_failure_test and its
translation check, pixconv_test, scaler_point_test and
image_scale_transfer_test pass, check-wma passes, and the overlap copy
check is clean.
2026-11-11 21:23:52 +01:00
LibretroAdmin ccc4165176 tls_retro: count the duplex client's lines without their CR
The failing duplex check was the Windows client's, run under Wine in
the network clients job (EXE=.exe). A Windows binary ends its lines
with CR LF, so '^got: s[1-4]$' matched none of its four 'got:' lines,
the check counted 0 of 4, and it failed on every run although the
client read all four, sent all 60, and the server printed 'done'
(its -msg trace shows the line and both KeyUpdates). The lines are
counted with the CRs taken out.

The Wine run of the duplex check now passes three of three; it failed
four of four before. d9b00b7's longer server tail was not the cause;
it costs nothing and stays.
2026-11-11 04:47:45 +01:00
LibretroAdmin e630ac2e02 net/retrossl: SSL_RETRO_NO_SNI, a ClientHello without server_name
For a client that emulates one which never sent SNI, as the Wii's IOS
does: the ClientHello carries no server_name, and the certificate is
still checked against the host. The local server test reads the
server's trace for the extension, with and without the flag.
2026-11-11 00:31:36 +01:00
LibretroAdmin d9b00b7e61 tls_retro: the cache test's put blocks, the duplex check's server waits
tls_cache_threads_test called tls_cache_put() with two arguments after
58ccb33 gave it a third, nonblock, and crypto-tsan-check stopped
building. The test stores to check every store landed, so it passes
false: a blocking put, as a handshake that is not nonblocking makes.

The duplex check's openssl server closed its input 1.5 s after sending
"end", and s_server shuts the connection down when its input ends. The
client sends its 60 lines 50 ms apart and then "done"; on a slow runner
the last of them were still on their way when the server shut down, so
the client finished cleanly (its 4 lines read, all of its own sent) but
the server never printed "done" and the check failed. Its input now
stays open 10 s after "end"; the server is killed a second after the
client exits, so the longer tail costs nothing. With the client's lines
slowed to 140 ms apart the old script fails the same way and the new
one passes.

crypto-tsan-check passes, and the local server matrix and the duplex
check pass.
2026-11-10 22:49:17 +01:00
LibretroAdmin fed60b7e05 net/retrossl: SSL_RETRO_DUPLEX, one thread receiving while another sends
A connection configured with SSL_RETRO_DUPLEX may be read on one thread
and written on another at the same time, with no lock - what a client
that keeps a reader and a writer thread on one socket needs (RPCS3's
RPCN client, which had wolfSSL's write_dup for it).

What the two sides shared:

- Receiving pushed out pending output (a sealed record the socket had
  not taken, a KeyUpdate owed) before reading. In duplex mode it does
  not: the sending side's buffers, keys and sequence number are the
  sending thread's alone.
- A KeyUpdate the server asks for was answered from the receive path.
  In duplex mode the receive path only raises key_update, now an atomic,
  and the next send or flush sends ours before its data, as RFC 8446
  4.6.3 asks. The blocking receive path does the same in duplex mode.
- ssl_socket_retro_pending() read the sending side's state for its
  write interest; in duplex mode it reports none.
- last_err could be written by both at once when the connection drops;
  it is an atomic, stored and read relaxed.

A duplex connection takes its record buffer for sending when it is
configured, not on its first send. Without the flag nothing changes but
key_update and last_err being atomics (plain loads and stores on x86 and
ARM).

samples/network/tls_retro/tls_duplex reads the lines openssl s_server
sends while a second thread sends 60 of its own, over TLS 1.3 with two
requested KeyUpdates and an unrequested one between the server's lines,
and over TLS 1.2. The server must print all 60 lines and its -msg trace
must show exactly two KeyUpdates from us. CI runs it in the local server
matrix and again built under ThreadSanitizer; with the receive path
still pushing output, TSan reports the races, and with the request not
raised, the server sees no KeyUpdate.
2026-11-10 21:21:04 +01:00
Codex 58ccb33e28 net: advance TLS handshakes without blocking socket I/O
Add a TLS-only step API across the native, Mbed TLS and BearSSL backends. Preserve handshake state and pending ciphertext across calls, report readiness interests, and close stalled connections without waiting.

Snapshot resumption keys with the offered session and skip contended cache updates in nonblocking calls. Exercise fragmented records, backpressure, cancellation, cache replacement and contention, plus real server verification through the existing network CI jobs.
2026-11-10 20:07:06 +01:00
Codex 8c62b973fd Measure HTTP stall tests with the production monotonic clock
Use the same clock as the timeout being checked so wall-clock adjustments cannot change the elapsed-time assertion. Retain the original bounds and print transfer state when a stall check fails.
2026-11-10 18:29:50 +01:00
Codex dd3a2d0831 Yield on partial native TLS records and control traffic
Retain partial record headers and bodies instead of switching a nonblocking read into a blocking receive. Process one record or buffered post-handshake message per service call, keeping direct application decryption.

Queue KeyUpdate replies in the retired handshake cork behind existing ciphertext and ahead of new application records. Preserve duplex reads under write backpressure and expose buffered work/write interest to HTTP waits.

Test fragmented input, mixed APIs, control ordering, socket failures and authenticated output. Drive OpenSSL HTTP and KeyUpdate acceptance through readiness waits. The handshake remains synchronous.
2026-11-10 18:24:38 +01:00
LibretroAdmin 71cd6b5384 CLI: reject an invalid port in --command
A bad port fell back to the default, so the command went to the wrong
place and the send reported success.
2026-11-09 03:03:38 +01:00
LibretroAdmin f3c3c579c2 task_queue: survive wait and reset before init
A failed command-line argument jumps to the init failure path, which
waits on the task queue before it is created, and segfaults.
2026-11-09 03:03:38 +01:00
davey a6a84b36a0 CLI: exit cleanly when sending a command fails
Failed sends must exit before frontend initialization cleanup, which
requires a task queue that does not exist yet.
2026-11-09 03:03:38 +01:00
LibretroAdmin ac2f2f5e40 nfs_retro: the idle cases start from the idler's own word
The cases that keep a file open across a pause killed the server a
fixed 3 or 4 s after starting the idler and then idled long enough
that a slow client - under Wine or a sanitizer - would still be
open: 10 s for unfs3, 12 s past a 5 s lease for Ganesha. They now
wait for the idler to say its files are open, then restart the
server, so the idle can be shorter: 5 s for unfs3, 7 s past a 3 s
lease for Ganesha.

Natively on two cores: unfs3 47 s -> 37 s, Ganesha 132 s -> 110 s;
all cases pass natively and under Wine.
2026-11-09 01:44:13 +01:00
LibretroAdmin 9dcb232de1 smb_retro: wait on smbd's port, not fixed delays
Each case stopped the servers - which already waits for every one of
their processes to exit - then slept 0.3 s more before starting smbd
again, a dozen times a pass, and the restart cases slept a whole
second after starting it. They now wait for port 445 to be free, and
for it to listen, polling every 50 ms for two seconds at most. Without
ss the old delays stay.

The script on two cores: 106.6 s -> 98.4 s natively, all 26 cases
passing; the job runs it three times.
2026-11-09 00:34:06 +01:00
LibretroAdmin 3823cd15bf tls_retro: a case starts once its server listens, not after a fixed wait
local_server_test.sh started its openssl server, or its Python one,
some eighty times and slept 0.4 s (0.8 s, 0.5 s) before each
connection, and the job runs the script three times: natively, under
Wine and under ASan. It now waits until the port is in the socket
table, checked every 20 ms for five seconds at most. The table is
asked rather than the port probed, since the pooling cases count the
server's connections. Without ss the fixed wait stays.

iproute2, which has ss, is in the job's packages.

The script on two cores: 110 s -> 17 s natively, 202 s -> 150 s under
Wine; all 83 cases pass both ways.
2026-11-08 23:33:03 +01:00
LibretroAdmin 4f7ec8f83d samples: no first-run download prompt over the menus the tests drive
Since 5bf0c36 the first-run download prompt is offered when the assets
folder does not exist yet, as in every fresh config these tests write,
and it comes up as a confirm message over the menu, which then holds
the menu's input. stdio_e2e's MENU down left the selection on 0, and
the views e2e's pointer-sbs-full cases on x11 and sdl3 found the menu's
cursor still at the first pointer position. Both configs now set
rgui_show_start_screen false, which the welcome screen and the prompt
both hang off.

On 26.04 stdio_e2e passes and the x11 pointer cases pass, both
pointer-sbs-full cases failing without it as on CI.
2026-11-08 03:13:20 +01:00
LibretroAdmin aa6a6bb75d netplay_e2e: say which side lost the stick when a lane fails
"states that never hash alike" failed once with the host seeing the
client's stick on none of 1513 frames, and did not fail again in 18
runs here. A failing lane now prints how often the client's own stick
moved, which shows whether its network gamepad was read at all, and
the device ids each core was given, which show whether the ports were
the analog joypads stick sync needs; the network gamepad's [Network]
and bind lines join the log lines it prints.
2026-11-07 23:27:16 +01:00
libretroadminandClaude Opus 5.5 26f5a00402 net_http: per-request TLS settings for the built-in client
net_http_connection_set_tls() hands a request its own
ssl_socket_retro_config: trust anchors, a client certificate, suites.
Such a request runs on a connection of its own, neither taken from
the pool nor returned to it, so settings never leak between requests
to the same host. With another TLS backend the request fails.

tls_http takes the settings and a sequence of GETs; the local server
matrix covers a client certificate over AES-256-CBC and pool
isolation in both directions against a keep-alive server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LBQPGdk3hhQeqHc7WNDcYr
2026-11-07 00:59:58 +01:00
libretroadmin aac31cf684 net_socket_ssl_retro: per-connection trust, client certificates, RSA and CBC suites
ssl_socket_retro_configure() gives one connection its own settings
before it connects: trust anchors in place of the bundle, whether to
verify the chain and the hostname, the suites to offer, and an RSA
client certificate chain with its key. A 1.2 CertificateRequest is
answered with that chain and a CertificateVerify signed with SHA-256,
SHA-384 or SHA-1 as the server allows, or with an empty Certificate
when there is none to give; a connection presenting a certificate runs
1.2. Such a connection neither resumes a cached session nor leaves one
behind, so no session crosses from one policy to another.

Offered only when a connection names them, the RSA key exchange
(premaster encrypted with rsa_pkcs1_encrypt(), the leaf checked for
keyEncipherment through x509_verify_chain_ex()) and the AES-CBC
suites with HMAC-SHA1/256/384 records, whose padding and MAC are
checked together so that a bad one fails the same way either way. The
default ClientHello is unchanged. These are what the servers of the
Wii U and other consoles of its time expect.

tls_config drives a configured connection in the local server matrix:
own anchors, no hostname check, every new suite over a 1 MB transfer,
a required client certificate from PKCS#1 and PKCS#8 keys under each
signature hash, and a CBC record changed in flight refused.
2026-11-07 00:06:53 +01:00
LibretroAdmin e98e1da005 vfs smb, scan: read every smb:// URL from the configured server
The VFS reads the configured server whatever host a URL names, so a
scan or refresh no longer compares the host: a playlist saved under an
older server address refreshes after the SMB server setting changes,
and the check takes no name lookup. A share other than the configured
one is still refused.

vfs_test checks URLs of other hosts, unresolvable ones included, pass
on their share alone.
2026-11-06 05:15:15 +01:00
davey a2bd2a71db vfs smb: keep a failure code per share; check a URL against the settings
A failed connect kept only the client's error text, the last of any
thread's, so a caller of stat could not tell a wrong password from a
missing folder.
Each pool now keeps the outcome of its last connect: connected, or the
step that failed (name lookup, connect, login, share), from the
built-in client's phase or libsmb2's NT status. smb_url_failure()
reads it for a URL without I/O or taking a use.

The VFS also connects to the configured server whatever host a URL
names, and a configured share overrides the URL's, so a scan of
smb://otherhost/... reads the configured server and saves the other
host into the playlist. smb_url_check() says whether a URL names the
configured server and share: hosts compare as text, ignoring case and
without a user@ prefix, a port or IPv6 brackets, and only on a
mismatch are both names looked up; the share is compared only when
one is configured. It may block on that lookup, so it is for worker
threads.

vfs_test checks each failure code against a local smbd, frozen server
included, and the URL checks without a server, the URLs the menu
builds from the settings included. vfs_threads_test reads the code
beside the pool evictions under TSan.
2026-11-06 05:15:14 +01:00
davey 1165a9f1f6 net_smb2: remember which connect step failed
rsmb_connect() kept only an error string and the last reply's status,
so a caller could not tell a wrong password from a missing share or a
server that is not there. The context now records the step a failed
connect was on (lookup, TCP connect and negotiate, session, tree
connect; a send or receive that fails counts as the connect), read
with rsmb_get_phase(), and smb2_get_phase() for the VFS's compat
layer. smb_test checks each step against a local smbd.
2026-11-06 05:15:14 +01:00
LibretroAdmin 24457eef48 S3: keep the path buffers off the stack
s3_backup_then held six path buffers on the stack, 12.8 KiB, and
s3_read and s3_delete_object two each, a little over 4 KiB. The backup
names now go in one allocation, and the URL and canonical URI of an
object come from s3_object_urls, one allocation holding both, which
s3_update_upload uses too. The largest frame in the driver is now
s3_build_request_url's 2.1 KiB. The hand-copied empty payload hash in
the GET and DELETE goes to S3_EMPTY_PAYLOAD_SHA256.

s3_backup_test fails those allocations for a backup before an upload
or a delete, a plain upload, a delete and a read: nothing starts,
nothing is reported, nothing leaks.
2026-11-04 22:46:27 +01:00
LibretroAdmin 890f0c1106 samples/s3_backup: link Winsock on Windows, keep temp files local
The test never linked under MinGW: net_http.c and its sockets need
ws2_32, which the Makefile left out, as the other network samples do
not. It also wrote its scratch files under /tmp, which a native Windows
build resolves to \tmp on the current drive, usually missing. They go
in the current directory now, and clean removes the .exe too.
2026-11-04 22:43:03 +01:00
LibretroAdmin 9d85133572 S3: stream uploads from the file, not a whole-file copy
An upload read the whole file into one malloc before it started: up to
the 64 MiB multipart threshold for a single PUT, and the whole file,
however large, for a multipart upload, held until its last part was
acknowledged. Out of memory the upload failed, and on the consoles the
threshold is sized for, that is not far off.

The body is now pulled from the file by net_http as the socket takes
it, through net_http_connection_set_content_source, the way WebDAV
already uploads: one send buffer instead of the file. Each multipart
part is a byte range of the file, seeked to on its first run so it
reads its own bytes whatever was read before it, and a replay on a
fresh connection rewinds to the range's start. The payload hash for the
signature is taken by reading the range in 64 KiB runs into
sha256_stream_update. The fallback to a single PUT when the multipart
start fails in transport streams the whole file the same way.

task_push_http_transfer_with_source is task_push_http_transfer_with_
content with a source in place of the buffer. The upload's URL buffers
move off the stack (4.2 KiB to 112 bytes).

s3_backup_test's stub drains every streamed body as net_http would,
with a replay from the start, and checks it is all there and is what
was signed. New lanes: an 11 MiB multipart upload (three parts, each
its own range of the file), its single-PUT fallback, and an empty file.
The multipart threshold can be set by the test for that.
2026-11-04 22:36:51 +01:00
LibretroAdmin 44090f5ea9 S3: sign with the shared SHA-256 and HMAC, streamed
The SigV4 signer assembled the canonical request and the string to
sign in 4 KiB stack buffers and MACed them with its own HMAC. A URI
or copy source past 4 KiB was signed cut short, and so was a secret
key over 123 octets (the setting takes 185), so those requests came
back 403. The two buffers also put the signer's frame at 9 KiB.

The canonical request now goes straight into sha256_stream_update as
it is made, and the string to sign into hmac_sha256_update, both from
crypto/kdf.c: nothing is assembled, so nothing is cut short. The query
is sorted as an index of spans over the caller's string, on the stack
up to 16 parameters, so the signer allocates only its result. The
hand-written HMAC, the query copy and the old signature helper go.

HAVE_S3 now needs HAVE_CRYPTO, which every build that defines it
(Apple) already has; griffin says so if it is missing.

s3_backup_test checks seven signatures against an independent SigV4
computation, including a 5001-character URI and a 150-octet secret,
which master signs wrong. The query and out-of-memory tests follow the
new shape, and the test rebuilds when the driver changes.
2026-11-04 22:36:51 +01:00
LibretroAdmin a7b2a2ef96 nfs: READ data lands in the caller's buffer, not in rx first
A READ reply is read as it is parsed: the RPC and READ headers into
c->rx, the data itself straight to where the octets go, for v3 READ,
v4 READ and each data run of READ_PLUS, across fragment marks. A reply
the fast path does not take - an error, GRACE or DELAY, READ_PLUS
refused, a denied call - is read whole into c->rx and parsed as
before. Nothing is asked of the socket that the reply has not promised,
so a short reply fails rather than waits.

Lanes: local_read_plus_test.sh reads the sparse file again from
fake_nfs42.py with every reply cut into 333-octet fragments and an
empty last one, as READ_PLUS and, with READ_PLUS refused, as READ.
2026-11-04 22:01:59 +01:00
Anthony Schemel fd880c6ac0 s3: sort query parameters as SigV4 requires; sign nothing out of memory
s3_canonicalize_query_string splits the query on '&', sorts the
parameters by name and then by value in byte order, and joins them
again; names are compared on their own, so a name that extends
another sorts after it. Callers keep URL-encoding each name and value.

When the canonical headers or query cannot be allocated the signer
returns no signature, which s3_build_auth_header_ex passes on as NULL
and every caller treats as a failure.

s3_backup_test checks the sort order, including names that extend
one another, and fails each of the signer's allocations in turn.

Closes #19956
2026-11-04 17:51:42 +01:00
Anthony Schemel b82437f038 webdav: no Digest header without an accepted challenge
The cnonce is written only when a challenge is accepted and cleared
with the rest of the digest, so webdav_create_digest_auth_header()
builds nothing while it is empty: after a challenge the parser
rejected, the next request goes out with no Authorization header and
the server's 401 is reported as usual.

webdav_reauth_test sends rejected challenges (an open-ended nonce or
realm, no nonce, qop="auth-int") after an accepted one and checks
that no header is built from them.

Closes #19954
2026-11-04 17:44:31 +01:00
Davey HughesandLibretroAdmin 188f37a97b nfs, smb: apply setting changes without a restart, log why a listing failed (#19982)
* nfs, smb: apply menu setting changes without a restart

The clients took their settings at startup and after config_load
only. Their numbers (NFS version, ports, timeout, read-ahead,
connection count, SMB auth mode) are copies, so a menu change waited
for a restart. Each change now hands the clients the current values.

SMB keys its pools on the whole configuration, so its next connection
uses the new values. The NFS pool matched a free connection by export
alone, so a changed server, version or port could ride an old one.
New settings now close the idle connections and advance a generation;
a slot whose generation or server differs connects again. The pool is
kept rather than replaced, so nfs_init_cfg() cannot free it under a
thread that has just taken a slot.

On version 4 an NFS port of 0 means 2049 and the mount port is
unused; the sublabels say so.

vfs_threads_test changes the ports while a prefetcher holds a slot.

* nfs, smb: log why a network directory listing failed

A failed file browser listing of an nfs:// or smb:// directory showed
"Directory not found" and logged nothing. It now logs one error line
with the URL, the settings the client ran with and the client's
reason.

The NFS client's reasons say what failed: the step and the server's
status (v4.2 mount: LOOKUP roms: NFS4ERR_NOENT), the address a connect
was refused at or timed out on, and RPC rejects such as PROG_MISMATCH
or AUTH_TOOWEAK. A refusal (PERM, ACCESS, WRONGSEC, or a v3 MOUNT
ACCES) adds that a Linux export needs 'insecure' for a client port
above 1023, as this client's always is. A failed walk or redial keeps
its own reason.

Failures that never reach a server record one too: no export, no
server in the URL, no SMB server set. SMB gets smb_get_last_error() to
match nfs_get_last_error().

nfs_error_test checks the reasons without a server and against
fake_nfs42.py.

* nfs: open files keep the settings they were opened with

An open nfs:// file or directory stored only its server and export, so
after a settings change its next read reconnected with the new version
and ports: a v3 handle sent over v4, or the stream's server asked on
another server's port.

Open files and directories now keep the version, ports and timeout
they were opened with and reconnect with those. Each pool slot carries
the parameters it connected with and is reused only on an exact match,
which replaces the settings generation. Read-ahead is client-side and
still follows the settings on every take.

nfs_error_test reads an open file on across a port and version change.

* smb: list a server's shares when no share is set

Browsing smb://server with no share configured never listed anything.
retro_vfs_opendir_impl rejected any SMB handle whose dir was NULL,
which is exactly the handle retro_vfs_opendir_smb returns for a share
list, and leaked it. The backend already reads and closes that handle,
so the dispatcher now accepts it. The UWP dispatcher does the same and
takes an entry's directory flag from the listing instead of a stat.

vfs_test checks the share list through the dispatcher as well.

* nfs: a file opened over a private connection keeps its export

With no NFS Export set, the export comes from the URL and is found when
connecting. When every pooled connection is busy, as it is once a few
read-only streams' prefetchers hold one each, the open goes over a
private connection and the file or directory handle recorded an empty
export. Every later borrow then mounted "": refused on v3; on v4 the
pseudo root, where the path under the export is not found, so such a
stream never got its prefetcher.

Record the export the connection was made with, through a new
rnfs_get_export().

nfs_error_test opens a file by URL while a prefetcher holds the only
slot.

* nfs, smb: settings as immutable copies; pools keyed by the copy

nfs_init_cfg() and smb_init_cfg() copy the settings they are given,
strings included, and publish the copy through vfs_cfg_snapshot.h:
a reader holds the copy it got between enter and leave, and a copy
that was replaced is freed once nothing holds it - retro_retire.h's
epochs where the pointer atomics are lock-free, a reference count
under a short flag elsewhere. Menu edits may rewrite the settings in
place while pool, prefetch and task threads read them.

NFS resolves a URL against the held copy's export without copying it,
and applies the timeout and read-ahead on every take: neither is
part of what a connection must match. SMB pools remember the copy
they were last matched to, so a take on that copy and share finds its
pool without building or comparing a key. A READDIR failure names the
result's own status.

nfs_cfg_race_test and smb_cfg_race_test free the caller's struct right
after handing it over, then resolve against it, and hand one struct
over repeatedly while four threads stat and list; they need no server
and run ahead of the server matrices in local_unfs3_test.sh and
local_samba_test.sh.

---------

Co-authored-by: LibretroAdmin <[email protected]>
2026-11-04 17:39:23 +01:00
Acts1631andLibretroAdmin 4e51bd75ed net_smb2: bound directory entry lengths without overflow (#19973)
* net_smb2: bound directory entry lengths without overflow

A server-controlled FileNameLength could wrap the addition used to
validate a QUERY_DIRECTORY entry. The UTF-16 decoder would then read
past the directory reply buffer.

Compare the length by subtraction and validate nonzero next-entry
offsets against the complete current entry and remaining reply.

* net_smb2: wrap-proof NTLM target info span, U+FFFD for lone surrogates

The NTLM challenge's target-info offset and length are checked by
rsmb_span_ok, which cannot wrap a 32-bit size_t. rsmb_utf8 takes a
low surrogate only when one follows its high surrogate and writes
U+FFFD for either half on its own, so names from the server are
always valid UTF-8.

samples/network/smb_retro/smb_dir_bounds_test hands rsmb_readdir
hostile directory pages placed at the end of their allocations
(wrapping and oversized name lengths, next offsets inside an entry
or past the page) alongside a well-formed one, and checks the name
decoder and span check; local_samba_test.sh runs it ahead of the
server matrix.

---------

Co-authored-by: LibretroAdmin <[email protected]>
2026-11-04 16:59:49 +01:00
Acts1631andLibretroAdmin a8e46dccca net_nfs3: stop bitmap walks after truncated replies (#19974)
* net_nfs3: stop bitmap walks after truncated replies

NFSv4 bitmap word counts come from the server. Once an XDR cursor
failed, two loops kept decrementing the declared count, allowing a
short reply to consume billions of iterations.

Stop both walks on cursor failure, matching the existing reclaim path.

* net_nfs3: bound every reply read to the bytes received

Fixed-size fields in replies (stateids, verifiers, the session id)
are read through xdr_get_fixed and xdr_skip, so the cursor never
passes the end of a reply; nfs4_res reports a cut-short result as
NFS4ERR_BADXDR rather than NFS4_OK. OPEN results share one parser
for create and reclaim and READDIR pages one taker for v3 and v4,
each leaving the caller's state alone for a truncated reply, and
xdr_get_opaque checks a length and its pad apart so neither wraps
on 32-bit targets.

samples/network/nfs_retro/nfs_reply_bounds_test drives these
decoders on short and hostile replies placed at the end of their
allocations; local_unfs3_test.sh runs it ahead of the server
matrix.

---------

Co-authored-by: LibretroAdmin <[email protected]>
2026-11-04 16:54:01 +01:00
libretroadminandClaude Opus 5.5 591237dc48 Clear what fast-forward queued when it ends
Leaving fast-forward drops what it left in the threaded pipeline's ring
behind a jump fade, and the device's writer drops core audio until the
device has played down to rate control's setpoint, so a blocking writer
is no longer held for as long as the queue takes to play out. That held
the core in device-period steps for seconds after every fast-forward,
which a VRR display shows as judder until the menu is toggled (#19940),
and cost every other configuration a hitch on exit. The five-frame
non-blocking window Sync to Exact Content Framerate used for this is
removed; it never drained the queue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LBQPGeAnyXTjoifK18NSfm
2026-10-31 09:10:23 +01:00
Davey Hughesandlibretroadmin 6ebf66b643 OpenXR: per-screen placement for headset screens, and Edit Screens to arrange them by hand (#19945)
* video: per-screen geometry for the headset's floating screens

Each floating screen, by the core's logical screen id, gets its own
offsets, yaw, pitch, roll, scale and visibility (video_screen_xr_t),
applied on top of where the layout puts it. video_views_xr_reset gives
the defaults and video_views_xr_normalize clamps each value to its
range: offsets to 10 m either way, angles to 180 degrees, scale from 0.1
to 10. A planner given no screens uses the defaults, so nothing moves
until a setting does.

* configuration: save per-screen headset geometry

video_screen<N>_xr_x, _y, _z, _yaw, _pitch, _roll, _scale and _visible
keep each floating screen's adjustments for screen ids 1 to 8, and
survive configuration overrides like the other video settings. A minimal
save writes only the values that differ from the defaults.

The video_screens settings sample checks the round trip and the override
cases, and runs in the OpenXR input and Wine views jobs. The defaults
fixture now links video_views.c, which the reset uses.

* menu: per-screen controls for the headset's floating screens

Stereo 3D & Screens gains Screen, which picks a floating screen by its
logical id among those in the current frame's map, and for it
Horizontal, Vertical and Depth Offset, Yaw, Pitch, Roll, Scale and
Visible, with Reset Screen and Reset All Screens. The rows apply live
and are hidden where they cannot apply, such as a tracked projection's
eyes. Stepping between screens reads one snapshot of the map and is
bounded, so a tracking change mid-step cannot leave it walking an empty
map.

docs/openxr.md describes the controls; the video_screens sample drives
them through the shipping menu actions.

* video: apply per-screen headset geometry to the frame snapshots

Each XR planner, Vulkan's and GL's, takes the normalized screen settings
with the frame snapshot, so a screen moves, turns, scales or hides as
its rows change, while paused too; recentering and tracked projections
are unaffected. Screen images are kept between frames, so shader
feedback survives a placement change.

A retained XR target that cannot be allocated is skipped quietly,
remembered by its size so it is not retried every frame; only the
desktop UI and canvas targets log the failure.

Covered by openxr_core_test, the video_screens sample, the e2e runner's
feedback shader case and the new vulkan_views_target sample.

* android: keep the OpenXR EGL context C89

gl_xr_egl_init declared its extension string after statements.

* video: pose inverse, layout spots and grab maths for headset edit mode

Each item's layout spot comes from one helper that placement uses and
the quad set records per slot, so a shown pose turns back into the
settings that placed it. Grab maths: the item follows the aim, level
unless tilting, offsets clamped to the settings' range; the stick pushes
along the ray and resizes. Edit picking sees every item and takes the
menu by a handle bar under it.

* video: a frame without a view map is screen 1 in the headset

A core without a views map (SNES, say) had no screen to select, so its
frame could not be moved. Its whole frame now takes screen 1's offsets,
turn, scale and visibility, and the selector lists Screen 1. gl's window
stays as laid out while the menu is open over it.

* video: the headset's menu in front of screen 1, or where it was put

The menu sat at a fixed spot, so moving screen 1 closer left the menu
behind it. It now floats 10 cm in front of screen 1, facing as it does,
at its default angular size and never nearer than 0.4 m, while screen 1
floats and shows, and is still submitted after the screens. A menu place
(video_openxr_menu_xr_* with video_openxr_menu_placed) overrides that;
it is saved like the per-screen keys, and Reset All Screens clears it.

* input: Edit Headset Screens mode for the OpenXR controllers

Edit Screens starts from a hotkey, a headset action, the
HEADSET_EDIT_SCREENS command or a Stereo 3D & Screens row, and stops on
the same, on opening the menu, on a video reinit or when the session
ends. It syncs its own action set in place of the game's, points the
lasers at every item whatever the Laser Pointer setting, keeps the
menu's quad up while editing, and with While Editing Screens set to
Pause pauses only content that was running. A runtime that refuses its
bindings keeps the game's and leaves edit mode unavailable.

The setting reaches the headset's poll with the others, and the pause
and resume are asked of the frontend as platform requests, so the input
driver issues no command and takes no settings itself. A Laser Pointer
value past its choices, which a hand-edited config can hold, reads as
Auto rather than as edit mode's.

* input: grab, tilt, push and resize headset screens in edit mode

A grip on an item takes it in the screens' frame: it keeps its pose
relative to the hand, stays level unless the trigger is held, and the
stick pushes it along the laser and resizes it, past a deadzone. Each
poll writes the item's offsets, turn and scale where the menu's rows
write them, through named frontend calls, clamped so it waits at a limit
and resumes from there. The menu is taken by its handle; a menu that
follows screen 1 is placed as large as it shows. The main button resets
a free item as Reset Screen does, or puts the menu back in front of
screen 1. A recenter, a screen leaving the map and leaving edit mode let
go, counted for the frame snapshot; an untracked hand holds its item
still.

* openxr: held screens follow the hand at the headset's rate

The main thread publishes what each hand holds through a seqlock; each
headset frame re-places a held item, both eyes of a stereo screen, from
that frame's own aim, so it no longer waits for the next video frame. An
item let go stays where the hand left it until a quad set planned at or
after its release (an edit count carried in the frame snapshot) shows
it, even once the hand holds another item, so nothing steps back. Lazy
Follow holds its glide while anything is held.

Edit mode outlines every item, brightly the one under a laser, and draws
the menu's handle bar under it, from the laser's image, now an atlas of
the dot, two outlines and two handle bars. They take only the layers the
screens leave after the dots.

* openxr: edit mode end-to-end cases and documentation

The test layer's aim can roll, and the e2e runner drives edit mode
against Monado: grabs that follow the hand on every headset frame and
stay where they are let go, level and tilt, the stick, resets of a
screen and of the menu, the menu taken by its handle and following
Screen 1 at its size, outlines and the handle, a no-map core, a views
core's fallback frame, Follow Head, Lazy Follow, recentering, two hands,
pausing, and what starts and ends edit mode, including the headset's
hotkey bits with no command interface. The cases whose work is a host's
or driver's own run on glcore and gl too. docs/openxr.md explains
editing screens in the headset and where the menu goes.

* openxr: a laser beam from each controller to its dot

A thin strip runs from each hand's aim to its dot, or 1.5 m into
nothing, turned about its own axis each headset frame to face the head
so it never shows edge on. It comes from the laser's image, so it needs
no new swapchain, and uses layers left after the dots and edit mode's
outlines, so it is the first to go when the runtime has few. The new
Laser Beam setting shows it in edit mode only (the default), always, or
never; outside edit mode, Laser Pointer and its hotkey hide it with the
dot.

* openxr: edit mode outlines in three bands, outside the item

A light band between two dark ones shows on white, black and busy
borders alike. The rim now sits wholly outside its item, 5 mm clear of
it even after filtering, so it never covers the picture; its region
grows to keep two texels a band at about the old thickness. Screens'
outlines are submitted before the screens, so a neighbour placed flush
covers the part of a rim over its picture, while the menu's outline and
handle bar stay on top. The handle bar moves 5 mm below the menu's
outline, which it would otherwise cover, and gets the same bands, faint
and bright.

* input: choose a headset edit item with Select Next and Previous

Edit mode steps from the laser through the screens it can move and the
menu. A chosen item is the one lit, either hand's grip takes it from
wherever the hand is, and Reset resets it, so a screen hidden behind
another can be moved. Whatever a hand holds stays lit.

A ray on the menu's handle bar takes the menu before any screen in front
of it. Within 3 cm of the bar, a ray that came from the bar keeps the
menu even over a screen, and one that came from elsewhere takes it only
where no screen is hit.

* openxr: snap a held headset screen to the screens near it

Snap to Screens, on by default, turns a held screen parallel or square
to a nearby screen and lines up its plane, edges or centre. Each pull is
exact within 3 cm or 5 degrees and fades out over as far again, so the
screen catches up with the hand rather than jumping, and snapping fades
in over the first 5 cm or 10 degrees after a grab, so taking a screen
never moves it. With several screens near, the snap that leaves the
least error wins, so a near screen's exact pull beats a far one's fading
pull whatever their order.

One stateless function inside the grab serves the main thread and the
headset's thread, so a screen is saved where it was shown. The holding
hand buzzes as a snap takes hold, once, and not again until the screen
has left that pull.

* input: turn a held headset item with the free hand's stick

A quarter turn of a held screen needed the controller turned a quarter
turn, which swung the screen round the hand on its long reach, so a
square snap could not be reached. Now the stick of the hand holding
nothing turns what the other hand holds about the vertical through its
middle, faster the further it is pushed, and snapping still catches it
parallel or square.

A carried item keeps its pitch and roll and its angle to the way the
hand points across the floor, so raising, lowering or twisting the hand
no longer tips or swivels it; the trigger lets it ride the hand rigidly.

* openxr: smooth the controller aim in edit mode

A screen held about 2 m out on the laser magnified every tremor of the
hand. In edit mode each hand's aim now goes through a One Euro filter,
which smooths a slow hand hard and a fast one little, with its rate
taken from the headset frame's own time step. The headset's thread
filters once a frame and hands the result to the main thread, which
grabs, moves and lets go from it, so a screen is saved where it was
shown. The new Edit Smoothing setting picks Off, Low, Medium (the
default) or High; outside edit mode the lasers are never smoothed.

* openxr: name the chosen edit item beside the controller

Edit mode now shows a faint tag just above the hand that last pressed
Select Next or Previous, reading Laser, Screen N or Menu, so what the
grip will take is plain without a notice. The words are drawn once into
the laser's image in the default font and the interface language, light
over a dark halo like the outlines so they read on any background, and
the tag is one more headset layer; when the runtime is short of layers
the beams are dropped before it.

On a runtime whose swapchains are too narrow for the words, the laser's
image keeps its old width and there is no tag.

* input: tilt a held headset item with the free hand's stick

In edit mode the free hand's stick already turns the item the other hand
holds. Its up and down now tilt that item too, about the item's own
left-right line through its middle, at the turn's rate and with no
limit: up tips the top back, as when pushing a monitor's top back. It
works whether the item is carried or rides the hand with the trigger
held, and snaps as the turn does.

Within about 25 degrees of left or right the stick only turns, and
within about 25 degrees of up or down it only tilts, so a push meant for
one does not drift into the other. Edit mode's starting notice lists the
turn and tilt and stays about 8 seconds.

* input: snap a turned or tilted headset item to angle steps

While the free hand's stick turns or tilts a held item in edit mode, the
item clicks into steps of the new Snap to Angles setting (15 degrees by
default; 30, 45, 90 or Off), so it is easy to set straight. The turn
counts from facing the user's head across the floor, the tilt from
upright. Within about 2 degrees of a step the item holds there and the
holding hand buzzes once; the stick's own angle keeps adding up, so
pushing on leaves the step.

Only the stick steps: carrying an item or tilting it with the trigger
never clicks, and a snap to another screen that would engage wins over a
step.

* openxr: show the back of a headset screen turned away

Runtimes draw only the front of a quad layer, so a screen or the menu
turned away from the head vanished. When the head is behind a quad's
plane, the frame now submits a plain dark panel in that quad's place: a
solid grey cell of the laser's image, at the quad's size, turned to
face the head. It takes the quad's own layer, so the layer count and
cap are unchanged. Edit mode picks either face, so an item turned away
stays grabbable, and its outline, handle and dot turn with its back.

* input: keep a screen snap's angle once the free stick lets go

A snap to another screen shows a held screen square or parallel to it,
but the item's own angle stays where the stick or the hand took it, up
to several degrees off. The next turn with the free hand's stick started
from that hidden angle, so the screen left the snap early on one side,
late on the other, and caught up with a lurch.

Now, as the free stick returns to its deadzone and as a push starts, a
snap engaged on the turn becomes the item's own angle: the carried turn,
or the orientation the trigger tilts. A snap still fading in never does,
since that would hop the screen into it. The place is left to the hand,
and carrying alone never keeps the angle, so pointing still pulls a
screen out of a snap. Letting go of the grip leaves the item where it
shows, as before.

* openxr: hinge a held headset screen to a neighbour's edge

Snap to Screens now also hinges a held screen to another along a
shared edge at any angle between them, so a DS or 3DS pair can be
opened at a slant: an edge within 5 degrees of parallel to one of the
other's, within 3 cm of its line and sharing some length with it,
turns exactly parallel and moves onto it, centres or ends level, its
angle left free. The pull fades in over the first 3 cm of shared
length, so a screen slides off the end of the other's edge without a
jump, and a diagonal neighbour never hinges. Screens that would
overlap do not hinge; the pull is whole from flat to square and fades
out folded shut.

Flat and square snap as before and report a hinge at 0 and 90. A turn
to the same screen pivots on the shared edge, so the edge stays on the
line as the screen leaves flat or square. The snap still keeps nothing
between calls; its result carries a hinge bit, and video_xr_snap_hinge
also says which edge and line, for the stick to swing about.

* input: swing a hinged headset screen about the shared edge

While a held screen is hinged to another, the free hand's stick axis
that turns nearest the shared edge, the tilt for a top or bottom edge
and the turn for a side one, now swings it about that edge, so it stays
attached; the other axis still turns or tilts it and can pull it off.
Where the swing leaves it, angle and place, it stays as the stick lets
go. Snap to Angles counts a hinged screen's steps from flat with the
other screen.

A hinge counts only while the screen's own edge is within its range,
not when other snaps alone hold it on the line, so a swing never
carries a screen round a line it is far from.

A square corner is a side hinge at 90 degrees, so the turn stick there
now swings the screen about the corner's edge. Main thread only;
nothing new reaches the frame loop, which still shows the grab through
video_xr_grab_pose.

* openxr: leave a gap between hinged headset screens

Edges that meet in edit mode, side by side, at a corner or hinged at any
angle, now click to a set gap from within 1 cm and otherwise keep the
gap the hand gives them, still hinged, up to 10 cm (letting go by 13).
Screens no longer have to touch, which made them overlap. Each grab
carries the gap, so the edit poll and the frame loop snap alike; until a
setting sets it, it is 0.

Pushed past touching, a hinged edge stops there for the first centimetre
of the push, the stop fading out by 3 cm, and ticks once per push.

A swing pivots on the held screen's own edge, so the gap keeps through
it, and a commit keeps the hand's gap unless the click holds it. After a
swing lets go past square, that stick axis and its steps keep pivoting
on the same edge until the edge leaves the hinge's reach, so a flick
past square and back does not creep.

Of two neighbours within the 5 degree turn snap, the nearer edge wins
the turn and the hinge, by one measure for every screen, so a screen
stacked behind, one off the ends of the edge or a side wall at a corner
never outranks a hinge the turn holds.

* menu: add Hinge Gap for headset screens

Hinge Gap (0, 1, 2, 3, 5 or 10 cm, default 2) sets the gap edit mode's
Snap to Screens leaves between screens that meet edge to edge, side by
side, at a corner or hinged. Edit mode takes it as it starts and gives
it to each grab; the click to it buzzes like the other snaps.

* menu: put Edit Screens under Headset Output

Stereo 3D & Screens now lists Edit Screens and its snaps right under the
switch that reveals them, then the headset's own setup, then where the
screens go, with the per-screen rows last and Visible first among them.

* openxr: track each held screen's hinge on the frame loop

The frame loop already re-snaps each held screen every frame. It now
also keeps, per hand, the hinge that snap holds whole, until the edge
leaves the hinge's 4.5 cm reach, where the frame draws it, so edit mode
can mark it. A kept hinge whose target no longer matches is dropped.

video_xr gains the hinge line's ends, along the overlap of the two real
edges and midway across the gap, an outline cut that drops one edge's
rim, and a green strip in the laser's image, before the tags.

* openxr: mark a hinged headset screen with a green line

While a held screen's hinge holds, the two edges that meet drop their
outline rim and a 6 mm green line runs along the hinge where they
overlap, midway across the gap, so it is clear when the hinge has taken
hold.

The line is drawn as the beam is, a centimetre nearer the eye than the
edges, since SteamVR does not keep the order of overlapping quad layers,
and comes after the outlines in the layer budget; hidden rims cost no
layer.

* input: buzz longer as a headset screen hinges

A hinge taking hold now gets one 150 ms buzz at 0.8 on the hand carrying
the screen, against the 20 ms snap tick, so the attach can be felt. It
fires again only after the edge leaves the hinge's reach, hinges
elsewhere, or the other hand takes the screen it hinges on, so a swing
past square and back does not repeat it. Ticks due while it plays are
skipped rather than cutting it short.

* openxr: find headset screens resting in a hinge

Two screens no hand holds rest in a hinge when their poses pass the
test that engages a carried screen's hinge, with either one carried,
and the hinge, held whole with nothing else pulling, leaves the carried
one where it is. So a hinge found at rest stays hinged when its screen
is taken. The engaged test moves into its own function so both use the
same one, and one target can pull whole whatever the grab's fade.

* openxr: keep a headset screen's hinge shown at rest

In Edit Screens, two screens no hand holds that rest in a hinge keep
the green line and their hidden rims, whether let go hinged or loaded
that way. The main thread counts them only when a resting screen
changes and sends them with the hands' record, so a release and its
resting pair arrive together; the frame loop places each line from
the screens it shows. A screen hinged at rest on two adjacent edges
still keeps one of those rims.

The hands' record now outgrows the quads, so the seqlock's copy is
sized to the larger of the two.

* openxr: pick up a hinged headset screen still hinged

Taking up a screen that rests in a hinge starts the carry on that hinge,
whole from the first poll, with no buzz and no jump, until it leaves the
hinge's reach, another hinge takes hold, or the other hand takes the
screen it hinges on. Until the grab's own snapping has faded in, the
kept hinge's target still pulls whole, so a straight pull out does not
hop.

The grab carries the hinge so both threads hold it the same; of several,
the one the snap ranks best carries over, and only where holding it
moves nothing. While the other screens fade in, the hinge's screen also
leads the turn, so a nearer one still fading does not take it.

* openxr: end a headset screen's hinge where a push passes the stop

Pushing a hinged screen into its neighbour holds the edge at touching
for 3 cm of push, fading out by 5.5 cm. Where it stops holding, the
hinge ends: the line goes, the rims come back, and the lid and buzz are
cleared, so screens pushed into each other show no hinge that a let-go
there would not rest in. Pulled back, the hinge takes hold again 5 mm
short of where it ended, with the long buzz, so a tremor there does not
flicker it.

The grab carries that through flag, and the frame loop keeps its line
until the main thread sets it, so the two threads never disagree for
more than a poll.

At Hinge Gap 1 a pair let go touching rests hinged and is taken up
hinged, as at every other gap. A screen swung into a square corner gets
the long buzz on arrival, and the other hand taking the target does not
hop the carried screen by the push's depth.

* input: let go of a headset screen where it was before the grip opened

Opening the grip twitches the hand, and the poll that sees the grip
open would move the screen by that twitched aim. Half a degree of pitch
moves a screen 1.8 m out by 1.6 cm, enough to knock it off its hinge's
gap or out of level, so it would not rest hinged.

Each hand keeps a short trail of where, turned and as large as its
screen showed, entries at least 10 ms apart, and a grip let go puts the
screen as it showed 80 ms before (INPUT_OPENXR_EDIT_REWIND_US), or as it
was taken if held for less. Edit mode's end and a recenter let go where
the screen shows.

* openxr: find where a let-go headset screen settles in its hinge

A screen let go while its hinge shows should land exactly in that hinge,
so the hinge still shows at rest and a pick-up is hinged.
video_xr_hinge_settle holds the hinge whole from the hand's pose, then
moves the edge to the set gap from within 3 cm of it (touching stays
where the stop holds it) and levels it along the edge within the level
pull's reach. Its result must pass the rest test, and it turns no
further than a grab's hinge engages, which shares that test.

A pair resting inside a settle band but off its point is no longer
listed at rest, since a pick-up and let-go would move it. A touching
rest is taken 5 mm deeper into the push stop, at every Hinge Gap, so a
hand that drifts less than that apart before letting go settles touching
rather than at the gap.

* openxr: settle a let-go headset screen into its hinge

A screen let go while its hinge shows now goes exactly into that hinge:
to the set gap from within 3 cm of it, touching from the stop's hold,
and level along the edge from within the level pull's reach. It then
rests there, listed and green, in the same publish, and is saved
there. Elsewhere it stays where it shows, as before.

Each trail entry also records where the hand put the screen with no
snap and whether a let-go there settles. At the let-go the rewound
entry is settled again against the screens as they are now, at that
entry's size, and put in one go.

* openxr: let a hinged headset screen rest at any fold

Snap to Screens' turn to flat, and its turn to square at a corner, is
whole within 5 degrees and fades out by 10, so a hinged screen held
there shows at twice its angle off less 10. No fold shown in that fade
read as a rest: the pair was not listed, a let-go there did not settle
into its hinge, and taking it up would have moved it.

Where a hand takes a rest, it now holds the screen at the angle the
turn's fade shows it from, the inverse of the turn's pull, so every
fold rests, is listed and is taken up unmoved. Held snapping is
unchanged.

* input: keep a headset screen's hinge through a shaking hand

Edit Screens' hinge buzz, lid and push stop followed the snap's own
engage and reach on every poll. A hand shaking half a degree (1.6 cm at
the screen) about a hinge's edge flipped them many times a second, each
flip a long buzz.

Each hold now keeps one mark: the hinge a let-go would settle into. It
takes hold at once, with the long buzz, and lets go only once polls have
seen the hand out of where a let-go would settle for 150 ms, each poll
counting at most 50 ms, so a stalled main thread or a spell untracked
never lets it go alone. The other hand taking its target, hinged
elsewhere or not, the target leaving and the let-go end it at once. The
lid waits for the mark to go, the push stop follows it, and a let-go
while it shows settles into it from where the hand last would have, edit
mode's end and a recenter included.

* openxr: draw a held screen's hinge as the main thread marks it

The grab carries the main thread's hinge mark, and the frame loop draws
a held screen's green line and cuts its rims from that mark alone,
through video_xr_grab_marked, while it snaps the screen every frame. A
frame loop taking the hinge by itself between polls would flicker the
line for a hand shaking at the edge of the hinge's range while the mark
held. A mark whose target the frame does not show cuts no rim.

The other hand taking the mark's target ends it, and the lid, on any
poll, tracked or not, so a lost hand's line does not come back when that
hand lets go.

video_xr_grab_near_hinge loses its past argument, which only the frame
loop's keep used.

* openxr: keep edit mode's hinge layers in place

SteamVR does not keep submission order for overlapping quad layers, so
a layer added, dropped or moved to another index can pop the edit
outlines in front of the screens, as a wobble at a hinge would do to
its line's layer.

The hinge lines are fixed slots: one for each hand holding a
screen, hand 0 first, then one for each pair at rest. A slot with no
line to show is drawn in place from its screen's middle, at rows of
the laser image that are empty either way up. The layer count and
every index change only at a grab, a let-go or a re-count of the pairs
at rest; a mark only changes crops and which rows a slot shows.

* input: date a let-go's trail by frame and stop it at a stall

Each trail entry is dated by the frame its aims are from, one a frame
and per hand, and the release poll records a new frame's aims first.
The rewind stops at a stall, entries more than 2.5 frames apart, a
frame counted as at least 20 ms so a fast headset's close entries never
read as one. Under load a stall of 0.1 to 0.3 s can come just before
the release; the entry from 80 ms back would then hold the pose from
before it and step the let-go back across all the stall's motion.

With Edit Smoothing on, which damps the twitch, a let-go that does not
settle into a hinge stays where and as large as it shows: a rewind there
would step back by what the smoothed aim still lags. The hinge decision
and the settle use the trail either way.

* openxr: cut edit outlines from cells instead of turning them

Cutting a top or bottom rim from the one outline image turns both
outline quads a quarter turn and swaps their width and height, and on
SteamVR that can blink every edit outline as the hinge takes hold or
lets go; side cuts, which never turn, do not.

The laser's image carries twelve pre-cut outline cells after the
tags, faint and bright, for a cut top, bottom, left, right, top and
bottom, or left and right, so a cut only picks a cell and the quads keep
their pose and size. The image is then 5582 texels wide. A runtime whose
swapchains are narrower, or that does not say how wide they can be,
keeps the turned and cropped outline at 2498 or 1208 wide. One log line
at the laser's creation gives the width chosen and the runtime's limit.
GL writes the top and bottom cells swapped for its bottom-up rows, and
Android's copy of the image is allocated rather than static.

The edit-hinge-3ds-narrow e2e case runs the turned cut at
RA_XR_LAYER_MAX_WIDTH=4096, on Vulkan and the GL EGL lanes.

* video: draw headset screens straight into the runtime's images

Each headset screen was drawn into an image of the driver's own and
copied from it into the runtime's on every new frame, Vulkan with a
render pass and GL3 with a blit. Screens are now drawn into the
runtime's image itself, as before per-screen placement, with no image
of the driver's and no copy.

A screen drawn again with no new frame - resized, made again or moved
while paused - replays the last frame's final pass from the chain:
build_viewport_pass_replay draws it at the new size from what it read
then, the passes' outputs, their feedback and the history that frame
saw, with that frame's count. Nothing else runs, feedback does not
swap and history stays, so a feedback or history preset holds still
while paused. A chain made to replay keeps one more history image, so
the frame's end writes where the last frame did not read; the window's
chains keep what they did. This also has movie frames reach the
headset, which the copy held at the first one, and draws a screen
resized while paused at its new size rather than stretching the old
image.

* openxr: leave what users who never edit see as it was

Screens seen from behind turn to their grey backs only while Edit
Screens is on, where screens are turned around; outside it nothing
changes and no head is located for them. The grabs carry whether
editing is on.

The menu opens at its own spot, straight ahead of the anchor, as it
did. Menu in Front of Screen 1, off by default, keeps it just in front
of screen 1 and moving with it.

The frame loop copies the main thread's grabs only once their stamp
moves, so outside edit mode no frame copies them. A new session clears
the frame loop's own copy and passes over what was published before
it, rather than publishing itself: the main thread stays the grabs'
one writer.

On Touch, the left menu button that opens the menu from edit mode is
spent until let go: held on as edit mode ends, it is no Start and does
not toggle the menu again after a second.

---------

Co-authored-by: libretroadmin <[email protected]>
2026-10-30 05:40:25 +01:00
Davey Hughesandlibretroadmin 642575470e vfs: return an SMB read-ahead connection with its pool's window (#19943)
* vfs: return an SMB read-ahead connection with its pool's window

A read-ahead stream turns off the client read-ahead on its
prefetcher's pooled connection while the prefetcher runs. It did so
before opening the file and left it off when the open or the
prefetcher failed, so the slot went back to its pool with no window.
On close it set the window from the current settings, but a pool
keeps the settings it was built with and is used again when the
settings return to them, so after a read-ahead change a connection
could go back to its pool with the wrong window. The window now goes
off only after a successful open and is restored from the pool's key
whenever it was turned off.

* smb_retro: switch the SMB settings under vfs_threads_test's workers

A new phase has a thread switch the settings between two connection
keys while the workers open, read and list, so slots are taken from
and given back to two pools as a settings edit would. The two-shares
phase covers a second share; this covers the key changing under them.

* smb_retro: test that a slot goes back with its pool's window

A stream with a prefetcher open while read-ahead is turned off now
checks, once it closes, that every idle pooled connection still has
its pool's window. This fails without the read-ahead fix before it.
smb_pool_windows_ok() makes the check, with a getter for the window
the built-in client holds.

The switching phase is driven by the workers, each moving the key on
after a round, instead of a thread spinning on smb_init_cfg(). It
switches across five keys, more than there are pools, half of them
with read-ahead off, so idle pools are evicted beside busy ones, and
it checks the windows once the workers are done.

---------

Co-authored-by: libretroadmin <[email protected]>
2026-10-30 03:41:06 +01:00
Davey HughesandLibretroAdmin 9d38efa2d6 scan: let the parallel readers open smb:// files (#19939)
* vfs: close a private SMB connection when an open, stat or opendir fails

When every pool slot is held, smb_take() connects privately for the
caller. If the open, stat or opendir then fails, smb_heal() returns
NULL when the connection is alive (a missing path, the usual case) or
cannot be replaced, and the caller stored that NULL over its context
and gave back nothing, so the connection and its socket were never
freed.

Keep the caller's context when smb_heal() returns NULL, so smb_give()
closes it. A pooled slot is given back as before.

vfs_test holds both pool slots with open files and then stats, opens
and lists a missing path; LSan reported the three connections before.

* vfs: release an SMB stream's connection when close follows a failed mend

When a stream's connection cannot be mended (the server is gone and
the reconnect is refused), or its file cannot be opened again, the
mend clears the stream's handle. Close returned early on the missing
handle, so a private stream leaked its connection, a pooled stream
kept its slot busy for the pool's life (smb_shutdown then left the
pool unfreed), and the reopen record leaked either way.

Close now checks for the connection rather than the handle and closes
the handle only when there is one. After a failed mend a private
connection is freed without a goodbye, since the server may be gone.

smb_idle_test gains a mode in which the server is stopped for good
during the pause, and local_samba_test.sh runs it, so the sanitizer
lane's LSan reports these leaks.

* cloud sync: make and drop SMB contexts under the VFS's list lock

libsmb2 keeps every context on one process-wide list with no lock of
its own, so the SMB VFS makes and drops its contexts under a lock
(4e6885d5a3). The SMB cloud sync driver called smb2_init_context() and
smb2_destroy_context() directly. A sync that began or ended while the
VFS connected or disconnected on another thread, as during a scan,
could lose a list entry, after which a live connection reads as dead,
or break the list.

The VFS exports its two wrappers and cloud sync uses them. The
built-in client has no such list; there they call straight through.

cloud_sync_test runs cloud sync's connect and disconnect beside private
VFS connections; the libsmb2 TSan lane reported the race before.

* scan: readers take smb:// paths when an SMB client is built

The scan's parallel readers were kept off every "://" path. smb://
paths go through the SMB VFS, whose connection pool serves several
streams at once, and the commits before this one fix the connection
leaks and the libsmb2 list race that readers would otherwise hit. So
readers now take smb:// paths in builds with an SMB client, built-in
or libsmb2; other schemes stay with the scan.

database_scan_test adds smb://, nfs:// and ftp:// archives to a
threaded scan's list and counts the readers' reads of each. Its TSan
build gets a stub SMB backend, so CI runs both halves.

* vfs: keep an SMB pool per share, never freed under its users

Pools live in a static table, one per connection key. Each pool's state
and user count share one atomic word: a lookup or a held slot is a use,
only an idle pool is evicted, and a retired pool closes its connections
when its last user leaves. Readers on two shares each keep their pool's
connections, and no thread touches a freed pool.

A failed reconnect after a dead transport frees the connection without
the round trips of a logoff; a pooled slot reconnects on its next take.

vfs_threads_test runs threads alternating between two shares of one
directory with no share configured.

---------

Co-authored-by: LibretroAdmin <[email protected]>
2026-10-29 18:17:24 +01:00
Codex 8f51d7e34a Fix stale menu framebuffer and command test fixtures
Match RGUI scratch-line storage and exact nearest-neighbor sampling in the framebuffer harness, and release the scratch allocation. Stub command_frame_start in the hardcore input fixture so input polling links.
2026-10-28 18:25:49 +01:00
Rob Loach ef41fe39e7 MCP: review fixes for frames, RAM, hardcore 2026-10-28 14:56:51 +01:00
Rob Loach ef3c8db6b3 MCP: no tools while achievements are hardcore 2026-10-28 14:56:51 +01:00
Rob Loach 35d113d308 MCP: memory tools read cores without a map 2026-10-28 14:56:51 +01:00
Rob Loach 30a01d0696 MCP: GET_FRAME, the screen without a file 2026-10-28 14:56:51 +01:00
LibretroAdmin 4bead9073a netplay: one CRC check for both paths, decided anew after each state load
A client compares the host's CRC for a frame either when it arrives or
once the client reaches that frame, and both now go through one check.
The first check at or after a state loaded from the host decides
whether this core's CRCs can be compared: that state is the host's, so
a mismatch there turns desync checks off with a warning, as a core
whose states carry a timestamp needs. Any later mismatch asks for the
host's state. A client logs each state it loads from the host.

samples/network/netplay_e2e gains a rollback desync lane with input
latency, so some checks wait for the client to reach their frame, and
a lane whose core states never hash alike between peers, which must
stop at one resync past the join with its checks turned off.
NETPLAY_E2E_JUNK puts a per-peer serialize count in the test core's
state.
2026-10-28 06:53:39 +01:00
LibretroAdmin b9c0d2796b netplay: run on from a resync state that arrived past the next frame
A client behind a lockstep host can be handed a state labeled with a
frame it has not reached yet, and when that state is read after the
frame has advanced the forced rewind loads it one frame past run. The
rewind now makes the state's frame the one run next, so the client
never runs an earlier frame's input on top of the host's state and
the resync actually mends the desync.

samples/network/netplay_e2e gains a lane where the client runs slower
than the host and has its RAM upset, and NETPLAY_E2E_PACE_MS to set a
peer's pace.
2026-10-27 20:47:59 +01:00
LibretroAdmin 5361e1bc8f netplay: lockstep for cores whose states are too large to roll back
Rollback keeps a savestate for every buffered frame and serializes every
frame, which a state in the tens of megabytes (Dolphin) cannot afford,
and needs states that restore deterministically enough to rewind on.

Lockstep runs a frame only once every player's real input for it has
arrived and never rewinds, so all delta frames share one state, used
only to hand a joiner the game or to resync. Desync checks hash the
core's system RAM, or the RAM in its memory map, rather than a whole
state; a state is serialized for them only when the core shows neither.
Input latency rises by a frame whenever lockstep has to wait and falls
again once input keeps arriving early, so it holds full speed over a
slow link. A host keeps sending while it waits on a joiner, grows its
buffers if the core's state has grown, and starts on the running game
instead of reloading it. A client takes a state labeled with a frame
whose input it already has, and loads it there.

Lockstep is a local choice and plays with rollback peers of this
protocol, and it is on by itself for cores past 32 MB of state and for
cores whose savestates load but cannot be rewound on, which netplay
used to refuse. The Lockstep setting asks for it everywhere. Older
clients cannot join a lockstep host.

samples/network/netplay_e2e runs a host and a client over the loopback
on a test core: sticks synced or not, lockstep, a lockstep host with a
rollback client, a desync mended and a 40 MB state.
2026-10-27 19:50:48 +01:00
LibretroAdmin a0d408f0ce netplay: sync the analog sticks of joypad ports
Netplay sent a joypad port's buttons only, so a core reading the sticks
of a joypad port (N64, GameCube and others) desynced or saw them at
rest on every remote player. The host now sends joypad ports as analog,
three words instead of one, with bit 30 marking them; each side hands
the core the joypad device it set, so nothing changes for the core.

This is protocol 8. A host with Sync Analog Sticks on, the default,
turns away older clients with the out-of-date message rather than
letting them desync; with it off, any version still joins.
2026-10-27 19:08:12 +01:00
LibretroAdmin 88362bc790 smb_retro: let the AD DC's processes go before removing its directory
The cleanup killed the domain controller and slept half a second
before removing its directory. Samba's children can still be writing
under it then, and the removal failed with "Directory not empty". That
failure became the script's exit status, so a matrix that had passed
was reported as failing.

The cleanup now waits, up to five seconds, until no process names the
directory, killing whatever is left, and then removes it. The script
exits with the matrix's own status, not the removal's.
2026-10-27 05:52:04 +01:00
LibretroAdmin fa0ceb469f file_stream: filestream_view(), a read that lends instead of copying
filestream_view() points at up to len octets at the stream position
and moves past them, as filestream_read() would after copying them:
from the gets/getc lookahead, from the file's mapping, from a
frontend VFS's mapping, or from an smb:// or nfs:// stream's
read-ahead window. -1 lends nothing and moves nothing, and the
caller reads as before.

The scan CRC step, sha1_calculate(), the cloud sync MD5 and
filestream_matches_buf() take what can be lent where it lies and
read the rest, so a hash over a share with read-ahead on no longer
copies what the prefetcher already holds; on a mapped file they
consume the mapping as before. A mapping over 4 GiB is hashed in
blocks rather than passed as one length the hashers truncate.

vfs_view_test covers the lookahead, mapped, unmapped, update-stream
and frontend-mapping cases and sha1_calculate(); the smb:// and
nfs:// thread tests read a file through lends against its contents
with read-ahead off and on.
2026-10-27 02:09:52 +01:00
Codex 361e816382 tls tests: link eventcounts with threaded VFS users
Include the eventcount implementation in the thread, stall and verification-hook source groups used by the Windows VFS read-ahead worker.
2026-10-26 07:08:12 +01:00
Codex b7436d8ffc Netplay: finish host setup when relay lookup fails
Resume direct hosting after an empty relay response or timeout instead of deferring another lookup. Cover failure, retry, success, deadline and cancellation through the shipping decision functions.
2026-10-26 02:05:24 +01:00
LibretroAdmin f6a5bb0e95 vfs: map only descriptor-backed streams
A read-only open asking for a mapping takes the descriptor branch only
for plain files and SAF. cdrom://, smb:// and nfs:// streams stay on
their own backends and are read unmapped, so archives on a network
share open and list.

Lane: the smb_retro and nfs_retro vfs_threads_test open with
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS, built with file mapping as
the shipping build has it.
2026-10-25 09:59:55 +01:00
Rob Loach 22ee469999 MCP: schema check, readable MENU, smaller tool list (#19878)
* MCP: schema check on all tools, readable MENU

* MCP: MENU marks choices, answers when closed

* MCP: MENU types, shows dialogs; drop menu option

* MCP: fold INPUT, OPTION, CORE_OPTION; trim list

* MCP: MENU path, more, tab names; clearer errors

* MCP: menu title as a text line; trim the list

* MCP: trim STEPS' descriptions

* MCP: INPUT says the core gets what is held

* MCP: MENU review fixes
2026-10-24 12:59:56 +02:00