A save over an existing file is two tasks: a load of that file for the
undo, whose callback pushes the save. With threaded tasks the queue
stops refusing a blocking task once the one in flight has finished on
its thread, so a Load State pressed after the backup load was done and
before its callback had run was pushed there and then, and read the
file the save was about to replace. The state tasks' own counts say
whether one is in flight - pushed, its callback still to come - and a
request is held behind it until then, as it is behind one still
running.
The state-load-latency lane of content_load_test takes that case, and
bounds a load by a display's frames where the machine is too busy for
the harness's own, microseconds long, to mean anything.
A firmware download was titled with MSG_FIRMWARE, "One or more
firmware files are missing", so while the file came down - which it
did, and was unpacked fine - the progress notification said it was
missing. It is now "Downloading: <file>", as the core and asset
downloads are.
Reported by Craig Carnell (cscd98).
A firmware download goes to a name of RetroArch's own next to its
target - the target with ".download" added, or .retroarch-firmware.*
for an archive - and is removed when it ends. One cut off by a quit or
a crash left that file behind, and every later download of the same
firmware then failed on finding it. The leftover is now removed before
the download starts.
The missing firmware dialog added room for a button row of its own to
the box in Ozone, XMB and MaterialUI, on top of the room every driver
now makes for a confirm's buttons, which left a gap under them the
height of a second row. That room is gone, with the variables it
left unused.
The dialog's text was copied into menu_state_msg every iteration;
menu_state_text now points at it, as at a built-in confirm's. A load
job freed with the dialog still up takes the dialog down with it, so
the menu never draws a freed message.
-L and launcher loads the check refuses fall back to the dummy core
and menu whatever --load-menu-on-error says, and run again as a menu
load after Load Once or Always Trust; with no menu they fail as
before, saying how to approve the core. A re-run of a core that starts
without content, refused again because the core changed since the user
was asked, asks again. On a first run, a core the pending seed covers
waits for the seed instead of a guess.
A load the check held back no longer also says "Failed to open
libretro core": the seed's wait, the Security Warning, the refusal
with no menu or a lobby join's own message says why. A core the check
passed that the loader can't open keeps the message.
A startup load that can only fail once the frame loop runs, such as a
seed wait with no menu, quits and RetroArch exits non-zero, as for one
that fails before. On macOS, where AppKit and the run loop observer
end a quit with exit(0), such a quit exits with 1.
A netplay lobby join whose core's probe is cached opens nothing at its
core push, so the load that opens the core is the one refused: the
join's own, or an unload's still in flight. The join marks that load.
Its refusal is said and netplay left off, as for a refused push,
before the dummy core's init probes the core for the menu, and the
load isn't parked, even when the mark lands after its preload stage.
A staged load whose core the check refuses ends as a failed load does
and is parked with what it needs to run again, its subsystem state
included. It keeps that snapshot after the preload stage's pass too,
so a core that changes before the core stage opens it is parked, not
failed silently. Load Core and the other user actions with no load
after their probe park the core load; a parked Load Core whose core
changed since its check parks again on its re-run. Probes stay quiet.
Subsystem loads from a playlist or from netplay, whose subsystem a
refused core can't name, are not parked: they say the core wasn't
loaded and how to trust it. So does a netplay lobby join of a refused
core, which then leaves netplay off. While the first run's seed hasn't
checked the core's folder yet, they say RetroArch is still checking
the installed cores.
The companion UI's Load Core (Cocoa's menu bar) opens the core before
it parks it, so a first Load Core of an untrusted core asks; answered,
or trusted already, it starts a core that runs without content, as
before. Of the running core, the open reads load_no_content from the
running state, not the core; runloop_core_probe_live() says so, and
that core keeps its flag and starts as before.
Qt's Load Core shows no error box, and the Cocoa and Win32 companion
windows clear their status line, for a load the check held back: the
Security Warning says why, and Qt's modal box would hold the frame
loop the warning needs. A parked Load Core run again by Load Once or
Always Trust that then fails to open for another reason says "Failed
to open libretro core", as the runloop does; one the check refuses
again stays quiet.
The core loaded last keeps its pass after the unload, so its reload
after Close Content and menu or driver init pass without another hash
or warning. Where a file's identity can't bind the pass (Windows, and
Linux filesystems that don't keep ctime), its checked file stays open
to bind it. Loading another core ends the pass. So do the Core
Updater, Core Manager delete and core restore: on the main thread,
before they replace or delete a core file, they close every core file
the check keeps open for a pass or a refusal.
runloop_core_dylib_load opens a core only once the load check passes
it: a record, an exemption or the slot of a finished check; a refused
probe starts the check quietly. The startup load, before the frame
loop, hashes in place, an accepted startup wait now listed in
CODING-GUIDELINES. Workers open through runloop_core_dylib_open, only
where the main thread found no trust store. Until run-ahead checks its
copy, it keeps one instance where there is a trust store.
On Windows, with a trust store, load_dynamic_core() leaves a \\?\ core
path ending in '.' as given, so the check refuses it instead of
loading the file _wfullpath names without the dot.
Update Installed Cores skips a core whose CRC matches the buildbot's,
so such a core never got a .sig. With checks on, the run now fetches
the .sig of an up-to-date core that has none and checks it against
the core in place on its own, never through the core's trusted hash.
One that checks out is placed and recorded; one that doesn't is only
logged, and the next run asks again. A .sig-only download that was
never hashed places nothing. Fetching a .sig changes no core file, so
it forces no core info rescan and no contentless cores reload.
The updater fetches <core>.sig into the core's staging folder before
the core itself; with checks on, a missing one refuses the update
there. Every download is then staged and checked under its install
name, and only a core that passes replaces the installed one, its .sig
beside it, its record made on the main thread. A refused core is named
in a message and the old core stays; Update Installed Cores carries on
with the rest. Builds without keys update as before.
Only a 404 or 410 for the .sig means the core is unsigned; any other
failure ends as a failed install, never as a bad signature. A checked
download that holds anything but the core and its .sig is refused.
The core's staging folder is cleared before a download and at every
end, a capped number of entries a tick, so a hostile archive can't
stall a frame. An update cancelled after the backup task moved the new
core in still places its .sig and records it.
Restoring a backup or using Install or Restore a Core now unpacks the
core under its own name beside the one it replaces and checks it with
the .sig kept beside what was picked. A restore from RetroArch's own
backup list may be an older build. Anything that doesn't pass goes to
the Security Warning; Install and Trust runs the restore again and
installs only when the core is still the one the warning showed.
On a Play Store build a core installed through Play Feature Delivery
is a link into the APK's read-only lib folder; a restore stages beside
the link and deletes it only once the core passes. Install and Trust
that can't run the restore again says so.
A backup gets a copy of the core's .sig beside it, whether it is
written or moved into the backups before an update, so a restore can
check it. Pruning and Delete Backup remove it with the backup.
When an update's install move puts the new core in, the old .sig is
set aside as in core_install_commit(), and the backup's copy of it
goes if the move rolls back.
The push's duplicate finder reads remote_filename through task->state,
from other threads than the worker, for as long as the task is
findable. The handler leaves task->state set; the last reference still
tears the download down where it is dropped, and the struct with
remote_filename is freed once that teardown and the task's cleanup
have both let go of it. A finished download does not count as a
duplicate, as before.
download_backup_wait_test gains a lane that runs the finder on the
main thread against forty downloads finishing on the worker; under
TSan it reports the race on task->state.
A finished task stays findable until it retires, and the push's
duplicate finder reads the handle's playlist_config, so the handle is
freed in cleanup, shared with the entry download. The playlist itself
is freed by the handler when the download finishes, on the worker, so
retirement on the main thread frees only the small handle.
The pl_thumbnail_wait_test "finished" lane pushes a second download of
a playlist whose first one has finished but not retired.
Closes#20075
formats/image_texture.c loaded images by path through the data_transfer
file adapter. Its four path loaders (image_texture_load, _load_ex,
_load_request, _load_request_ex) move to streams/image_texture_file.c,
declared in streams/image_texture_file.h, the same split data_transfer,
cdfs and the DVD reader got. The names and behaviour are unchanged;
callers include the new header.
formats/image_texture.c keeps the buffer decoders and makes
image_texture_load_buffer_probe public so the adapter can reach it.
image_texture_load_set stays in formats/image_texture_set.c: it does no
file I/O of its own, and gfx_surface_still tests it against a stubbed
load_request.
griffin, Makefile.common, the companion test scripts and the sample
Makefiles that build the loaders add streams/image_texture_file.c; the
overlay task sample, which stubs image loading, does not.
data_transfer reads only through its reader callback. The path entry
points keep their names, data_transfer_open_prefix and
data_transfer_open_window, in streams/data_transfer_file.c
(<streams/data_transfer_file.h>), which opens the file through
filestream, reads it at offsets and closes it with the transfer;
data_transfer_open_prefix_reader and data_transfer_set_release are the
core's side of that.
cdfs reads only through the stream a track holds. cdfs_open_track,
cdfs_open_data_track and cdfs_open_raw_track are in
streams/cdfs_file.c (<streams/cdfs_file.h>); the length-based sector
probe they use is cdfs_track_sector_size_from_length.
rdvd_vfs, which binds files to the DVD source, and rdvd_stream, which
drives it, are streams/rdvd_vfs.c and streams/rdvd_stream.c, their
headers under <streams/>.
cdfs_file_test covers the path openers: a cooked iso and a raw bin
sized by length, a cue sheet resolving its bin beside it, an INDEX 01
offset, the data track, refusals.
intfstream_read_at reads at an offset and leaves the stream's position
where it was: files and memory streams without touching the stream, so
from several threads at once, CHD tracks by seeking there and back. The
buffered stream reads from the file and keeps its window, and its own
refills and wide reads go to the file at the offset. memstream_read_at
backs memory streams. The CUE/ISO serial detectors read their probes
this way.
The zip reader takes its end records, directory, local headers and
member chunks with one read at the offset each, where the file has
them; the reads the stream lends from stay as they are.
The Windows second handle is opened relative to the stream's own with
an empty name through ntdll's NtCreateFile on every NT. From Vista on
that is what ReOpenFile does; before it the handle is kept only when
its volume and file index match the stream's, else the path reopen
follows.
Lanes: intfstream_read_at_test (file, buffered, memory; four threads),
vfs_positional_ntverify_test (the check, on any version); archive_zip64
counts reads at offsets as reads through the stream.
The chunked decoder slid every payload byte down over the chunk
headers before it, so the decoded body was one run for the sink: one
copy of the whole body inside the receive buffer, on top of the
receive itself.
A sink can now take the body as runs (net_http_connection_set_sink_spans).
For such a sink, a chunk of 16 KB or more stays where it was received
and is recorded as a run; shorter chunks are still slid down onto the
end of the run before them, so the runs stay few and long. At most
16 runs are held, in the handle, so nothing is allocated mid-transfer;
with all 16 in use, further chunks are slid as before until the hand-
off. The hand-off point is unchanged: when the free window behind
the held bytes would fall below 32 KB, and at the end of the body or
when it is cut short.
task_http's download sink takes runs and writes them with
filestream_writev: one writev() on the targets that have it, so the
chunks reach the file from where they were received. An identity
body goes as one run, as before. net_http_connection_set_sink and
its sinks are unchanged.
Restoring a core from a backup that is not compressed is a plain file
copy, and that is the common case: installing a core update moves the
old core into the backups as it is, and installing a core from a file
copies that file. It went through the 100 KB transfer buffer, read
into and written out of. It now goes through the VFS copy into the
temporary beside the core, which the platform does itself where it
can: copy_file_range on Linux, where no byte enters user space, and
clonefile on a same-volume APFS copy, where none moves at all. The
temporary is renamed over the core when the copy is done, as before.
Backing up a core where backups are not compressed (builds without
HAVE_COMPRESSION) is the same plain copy and takes the same path.
Compressed backups, and restoring them, go through rzip as before.
The copy is stepped a megabyte at a time inside the shared I/O window,
so a tick takes no longer than it did; a cancelled copy removes its
partial file. Where the copy cannot start, the transfer buffer still
does the work.
task_push_http_download_file_with_headers is task_push_http_download_file
with extra request headers, for a server that wants authorization;
task_push_http_download_file is now that with none. The Emscripten
backend has both.
A download to a file that ends in an HTTP error response used to hand
its callback no body, so a caller could not log the server's message.
It now hands it the start of the body, up to 4 KB, read back from the
file before the file is removed; only on that error path. A
successful download still hands its callback no body, and the callers
that stream already go by their streamed flag and the error before
they look at it.
filestream_copy copied through a 256 KB buffer it read into and wrote
out of. It now runs the VFS copy (filestream_copy_begin/step/close)
to the end, which uses the platform's own primitive where there is
one: copy_file_range on Linux, where no byte enters user space, and
clonefile on a same-volume APFS copy, where no byte moves at all.
Where that copy cannot start -- no VFS v5 behind a core, or a target
that cannot be removed to make way, as on Windows when another
process holds it open -- the old loop still writes it in place.
The archive extractor's copy of a member over a target it cannot
rename onto is now filestream_copy as well, instead of a 64 KB loop
of its own.
The portable copy path, the one Windows, consoles and cross-volume
copies take, writes 128 KB pieces, and on resume opens its target to
read and write in place; both now take the descriptor path where the
platform has it. UWP gets the same hint, which its backend ignores.
The comments in task_content.c and runahead.c that named Windows copy
primitives (CopyFileFromAppW, CopyFileW) said what the VFS copy does
not do; they now say what it does.
A download comes back on the stream it was written through, opened to
read and write, which cannot lend its bytes: hashing it read the whole
file back into the 256 KB hash buffer. A download of a hash chunk or
more is now opened again to read with the mapping hint, after a flush
of the stream that wrote it, and hashed through filestream_view out of
the page cache the write just filled, with no copy. A smaller one is
a single read, cheaper than another open, and keeps its stream. Where
the platform has no mapping the new stream reads as the old one did.
Backing up and restoring a core copies it in 100 KB pieces and
checksums it in 256 KB pieces. Both ends of the uncompressed copy
and the checksum reads of the core now ask for the bulk path: the
descriptor, with no copy through a stdio buffer, on the targets that
have it. The restore's checksum of the backup keeps its mapping, and
the compressed (rzip) backup streams are unchanged. Where the bulk
path is not available the hint is ignored.
Save RAM is written in one piece and flushed; a save state in one
piece (the synchronous path) or in 100 KB to 16 MB pieces (the
task). These uncompressed writers now ask for descriptor writes:
on the desktops and Android the bytes go to the file with no copy
through a stdio buffer, and the save RAM flush has nothing left to
push. The compressed (rzip) writers are unchanged. Where descriptor
writes are not available the hint is ignored.
The sink now gets a download in pieces of 32 KB or more (identity
bodies), so the file it writes asks for descriptor writes: no copy
through a stdio buffer on the desktops and Android. The restart
path's seek and truncate work on the descriptor too. Where
descriptor writes are not available the hint is ignored.
The image is written 32 sectors (64 KB) at a time, so it asks for
descriptor writes: no copy through a stdio buffer on the desktops
and Android. The small .cue file keeps its buffer. Where descriptor
writes are not available the hint is ignored.
rgif now loads GIFs wherever RetroArch loads images: thumbnails and
backgrounds through task_image, the image viewer core, the file browser
and the image_texture/image_transfer layer underneath them all.
rgif:
- the image_transfer interface the other decoders have:
rgif_set_buf_ptr, rgif_set_avail, rgif_header_ready and
rgif_process_image, giving a 32-bit texture of its own, ARGB32 or
ABGR32 in native byte order
- RGIF_ABGR, for ABGR32 on big-endian targets
- a file not all read yet gives IMAGE_PROCESS_WAIT and is not touched;
the image is decoded in one call once it is all in
Wiring, as HAVE_RTGA is wired:
- IMAGE_TYPE_GIF (image.h) and NBIO_TYPE_GIF (task_file_transfer.h),
both appended so no other value moves
- image_texture_get_type: .gif
- image_transfer: new, free, start, is_valid, set_buffer_ptr, process,
set_avail; the support matrix gains a GIF column
- task_image and task_file_transfer: GIF is an image task
- FILE_TYPE_GIF ("gif", "GIF"): opened as image content
- the file browser's image extensions, the image viewer core's
extensions, the System Information list ("GIF (RGIF)") and
--features ("RGIF"); SUPPORTS_RGIF in config.features.h
- griffin.c, Makefile.common (rgif.o), configure (HAVE_RGIF=yes), and
next to HAVE_RTGA in every platform Makefile, the Android, Apple,
MSVC, UWP and QNX projects and the CI compile matrix
- tools/settings_check.py and tools/stack_budget.py check with it
Also: menu_displaylist's image viewer extension list wrote "tga"
without moving its length on, so "webp" and "dds" landed on top of it
and TGA dropped out of the list; it moves on now.
Tests: rgif_test checks the texture in both byte orders against
rgif_decode, the wait before the whole file is in, and a refused file;
image_decode_fuzz sweeps GIF too (every byte of a small GIF set to
edge values, and every truncation), under ASan and UBSan. The griffin
unity build with every codec, the touched objects in a configured
build, the MinGW/C89 syntax check, the overlap check and the stack
budget pass.
A folder of known kind is no longer stat'd when the scan is set up, so
the worker is where a missing folder is found. A plain scan says so,
but a database scan ended with no message on screen, and a command line
scan blamed the configuration. Give it the plain scan's message.
Refuse the other half of the same mismatch: a file that has become a
folder was walked as a folder while the scan kept treating it as a
file.
The task already holds the content kind in its config, so do not ask
for it again on the main thread.
Reuse the caller's known content kind for every path. CLI scans and
playlist refreshes already read it on a worker; asking again while
building their configuration can stall the main thread.
Keep the stat fallback when no kind is available. Reject an expected
folder that is no longer a directory on the worker before playlist
overwrite or validation.
Refresh All decides on a playlist from its first load, so a skip from
that record printed "content folder not found" even when master knows
why an smb:// folder failed. The record now keeps the reason, and both
skips share one helper.
An empty folder now joins a group like a missing one: one line, and no
second load and folder open just to skip.
The chain runs one task at a time and changes its list of dead shares
only in that task's callback, so each load borrows the list instead of
copying it. Finding whether a playlist has a database compares names
in place rather than copying each one on the main thread.
A frozen or unreachable SMB server cost the client timeout for every
smb:// playlist in Refresh All, even when they all point at the same
server.
When a playlist's smb:// folder is not there in the loading pass, its
share root is checked. If the root answers, the folder is really
missing and the run goes on as before, with no more root checks. If
it fails too, the share is taken as down for the rest of the run:
later folders, --scan paths and refreshes on it fail with the same
message and no check. With a share set in the settings, the client
uses it for every URL, so every smb:// path is down. With none set,
each URL names its share, so only the failed shares are down, and a
root that answers later clears them, so a NAS waking from sleep
recovers in the same run.
A database scan printed "??" from the lookup, before it knew what
became of the file: a loose scan then added it, an expanded archive's
members still had to be checked, and an m3u's discs could still match.
The line is now printed where a scan counts a file unmatched, so the
"??" lines and the unmatched total agree for every kind of scan.
A .lutro, which matches by its extension, was counted unmatched
without a line by a refresh of another database and by a group scan
without a Lutro playlist; both now name it.
Refresh All walked and checksummed a mixed folder once for every
playlist a Fully Automatic scan of it had filled. It now reads every
playlist's settings before it runs one, keeping only its name, folder
and settings, and loads each playlist again when it runs, so it still
holds one playlist at a time. The load turns the saved settings into
text, so grouping compares strings and stats no folder on the main
thread. Playlists named after an installed database, matched
strictly against it alone with no DAT file, saved with no other
database name and otherwise equal settings, overrides applied, share
one group scan. The group runs at its first playlist's place under
one line and task title naming the folder and the playlists, and the
summary still counts playlists. Any other playlist, and every
--scan-refresh, runs alone as before.
A Fully Automatic scan of a mixed folder fills one playlist per
database, yet refreshing those playlists walks and checksums the folder
once per playlist. A group scan does it once: it matches only the
databases of the playlists it is given and sends each match to its
database's playlist, filling one member at a time so each is sorted
once. Every member is treated as its own refresh would treat it:
cleared when overwriting, validated, given the scan settings whether or
not it gained an entry, and saved as "<name>.lpl". A result no member
takes counts as unmatched.
A group scan needs a strict database scan, so it exists only with
libretrodb. Its task title and --scan lines carry the label it is
given. While it runs, a scan of a member's playlist is refused, and
the reverse.
Nothing pushes a group scan yet; Refresh All will.
A DAT scan and --scan-match=none run apart from the database lookup,
so --scan printed only their "++"/"==" lines and the totals. They now
print the start line, a numbered line per file and a "??" for each file
they count unmatched, an m3u included, as a database scan does.
The clean pass copied, expanded and matched every entry path against
the content folder, and resolved that folder once, before it asked
whether the entry needed any of it. An entry that exists and passes the
extension filter, which is nearly all of them, now returns after the
existence check: no copy, and no realpath on a network folder unless
an entry calls for one.
The three scratch buffers become one allocation, and the refresh chain
expands the saved folder on the stack and only looks inside a
directory.
A playlist whose saved folder is an empty mount point, its drive
unplugged, was refreshed and failed with "No valid content detected.",
which made --scan-refresh and --scan-refresh-all exit 1. The refresh
chain now skips it as it skips a folder that is gone, with a "skipped:
content folder empty" line; it counts as skipped, not failed, in
Refresh All Playlists' summary and in the exit status. A menu Refresh
Playlist on such a folder is unchanged: it fails and leaves the
playlist as it was.
Validating a playlist dropped every entry whose file was missing, so a
refresh with a drive unplugged, or with a mount point left behind
empty, emptied the playlist of everything on it. A missing entry now
goes only when the folder it is judged by holds something: the content
folder for an entry inside it, else the folder holding the file or its
archive. The extension filter applies only inside the content folder;
entries outside it came from other scans.
Entries are saved with their symlinks resolved, so the content folder
is compared both as typed and resolved, ignoring case on Windows. The
test harness builds file_path.c with RARCH_INTERNAL, as RetroArch
does, so its symlink case can resolve; not on Windows, where that
turns the slashes its checks look for into backslashes.
Backups go under the assets directory, wherever saves live. A rename
fails when those are on different volumes, or on Android when saves are
in a SAF folder, and the file then was not backed up: non-destructive
mode gave up on replacing it.
Fall back to copying the file and removing the original. If it cannot
be removed, drop the copy and report the failure, as the caller relies
on the local file being gone. cloudsync_commit_test covers both a
replaced and a removed file with such a rename refused.
The Win64 build's -Wshorten-64-to-32 narrowings are made explicit where
the value is bounded: socket()/accept() handles kept as RetroArch's int
descriptors, ai_addrlen passed as socklen_t, UDP and pipe lengths,
COM/D3D counts and shader frame counters, WASAPI/XAudio2 buffer sizes.
net_socket clamps each send/recv to Winsock's int count on _WIN32 and
lets the existing loops move the rest; the remote-input descriptors are
plain ints on every platform, as socket_init returns them.
xaudio29.h declares its interfaces through a macro that, in C, leaves
out DECLARE_INTERFACE's second typedef of the forward-declared names.
Add borrowed ASF and RIFF/xWMA streams with bounded fragment assembly. Drain decoder planes directly into audio_transfer output and reuse the mixer's streaming voices. Route music input through VFS-backed moving windows.
The builtin player uses source-rate integer intervals, float callbacks when supported and a legacy S16 fallback. Respect partial callback acceptance and reset without retaining a growing output queue. Gate the feature with HAVE_RWMA, disabled by default, and preserve FFmpeg/MPV selection.
Test analytic PCM, packet fragments and refill, loop reset, implicit xWMA setup, truncated objects, sample-rate cadence, callback backpressure and codec-disabled builds.
* OpenXR: the controllers' slots are not read from the driver's view
A joypad driver that keeps its pads' state lends it to the snapshot
bridge through view(), and the bridge reads that in place of a copy
(48f9503c16). The headset's joypad wrapper is made from the driver it
wraps and kept that driver's view(), so under udev or winraw the
bridge read the controllers' slots from the driver's own pads there,
which are empty: the OpenXR controllers gave no input at all.
The wrapper of a driver that lends now has a view() of its own. It
lends none for the controllers' slots, which the bridge then copies
through the wrapper's button and axis calls, and the driver's for
every other slot.
openxr_input wraps a driver that lends all-zero views, and reads the
controllers' slot and one of the driver's the way the bridge does.
* Menu: bind capture goes to the bound user, not the controller slot
A bind capture knows the user whose binds it sets and the slot of the
controller it listens to, that user's Device Index. Three of its steps
used the user whose number is the slot instead: Bind All set every
bind after the first in that user's binds, each capture took the key
it replaced, whose mapping bit it clears, from that user's bind, and a
mouse bind listened to that user's mouse.
So with user 1's Device Index set by hand to the controller in slot 3,
Bind All for user 1 wrote all but its first bind over user 3's, which
were saved as such, and cleared the bit of a key user 3 still had
bound. A mouse bind for user 1 was never heard with one mouse, and
took user 3's click with a mouse for each user, though at run time
user 1's binds read user 1's mouse. All three now go to the bound
user.
frontend_overhead runs Bind All for user 1 on slot 3, and clicks each
user's mouse while binding user 1's B there.
* samples: hotkey_menu reads its sources as UTF-8
extract.py read input/input_driver.c in the locale's encoding, cp1252
for a native Windows Python, which fails on that file's UTF-8, so the
harness did not build there without PYTHONUTF8=1. It reads and writes
UTF-8 now; on Linux its output is unchanged.
* Input: a core port's rumble reaches every user mapped to it
A core port's rumble now goes to every user mapped to that port, the
users its input is read from, rather than to the user with the port's
number. Its motor answers true when any of theirs does; a port no user
is mapped to rumbles nothing and answers false. With every user on its
own port nothing changes.
* Input: Tap Delay holds Hotkey Enable back from its first frame
The hotkey pass reads the controllers as the last poll left them, and
the frame's own poll comes after it, under early, normal and late
polling alike. So with Hotkey Enable Tap Delay on, each press of the
Enable button reached the core for one frame before the tap saw it
and began holding it back.
While the tap is idle, a core read that finds the Enable's game button
down now asks whether the Enable is held in the frame's poll, and if
so holds the button back. The same button from another controller or
key, with the Enable up, is still the game's. Other reads cost one
test, and with Tap Delay at 0 nothing changes.
* Input: users sharing a core port drive the menu and fire profile hotkeys
With the menu up, user 1 and every user mapped to its core port drive
it. The other users on the hotkey user's core port fire hotkeys from
their own controllers in the one hotkey pass; with Hotkeys Follow
Player 1 those are core port 1's other users. With user 1 on None, the
users on core port 1 do both, and user 1 keeps them. With every user
on its own port nothing changes.
A sharing controller fires the hotkeys its profile binds, never the
hand-set ones, which stay the hotkey user's pad's: a hand-set button
names a button of one controller, and on a pad of another model it is
some other button. Its Hotkey Enable is its profile's too. While the
hotkey user has a Hotkey Enable, a sharer's hotkeys need the sharer's
own or the keyboard's, and a sharer holding its own opens only its own
hotkeys, not the hotkey user's; held on any of them, it holds game
input back. With none for the hotkey user, sharers fire freely. The
table of a sharer's profile hotkeys is made when a bind or its profile
changes, not each frame.
With Hotkey Enable Tap Delay each controller taps on its own: a tap
holds back and replays that controller's own Enable button. A hotkey
swallows the tap of the controller that fired it, and the keyboard's
tap when the keyboard's Enable opened it. Any controller's Enable held
short of the delay holds game input back, another controller's Enable
held past it included. Enable presses released while the delay is 0
are not played once it is turned on, user 1's included.
* Input: Plays As, a controller's own player, places it on connect
Sixteen entries, input_plays_as_device_N and input_plays_as_player_N,
name controllers as a reservation does, vid:pid then name, each with a
player (0 Auto). When they are read, each connected controller, lowest
slot first, takes the first entry naming it that no other has taken; a
0000:0000 vid:pid matches by the name after it, not every controller
without one. Giving a controller a player makes an entry for it,
refused when all sixteen are in use; set back to Auto, its entry is
freed.
The entries are read with the binds and written with the input
entries, a free entry's keys taken out. Two of a model are told apart
only by order, so a model's entries are written at their own places
in the order a start hands them out: lowest slot first, a gone one's
in its place, and one on Auto ahead of another of its model as an
Auto entry of its own. Once the main configuration is saved, the
entries in memory are laid out the same way, so reading it again in
the session gives each its own too. Saving an override puts them back
after its comparison load, as it does the binds. The reservations'
vid:pid parse is shared with them, unchanged.
On connect, a controller set to player N takes port N. Whoever else is
there moves to the first free port, unless it also plays as N, by its
own player or, on Auto, by N's reservation naming it: then the
newcomer shares, from the highest free port below Max Users. An Auto
controller that N's reservation names shares the same way when port N
holds a controller set to N. An explicit player beats a reservation
naming the controller. With any reservation set, Auto controllers are
otherwise left to the reservations; with none, and a player set by an
entry, they take the first free port. With no player set nothing
changes.
The moves are for this run only, through input_driver_exchange_ports(),
now in every build: the configuration keeps the ports the user set. A
reservation's own placement made while the ports are in a runtime
layout is runtime as well, so it is not saved either; reservations
place again at every connect.
A joypad driver restart lets go of every claim, since its pads can come
back in other slots with no disconnect: a pad reported again where it
is plugged in takes back its entry, the rest take theirs in slot order.
While a player is in effect, the registry's restore of the ports is
left to placement. A config reload keeps each controller's entry while
it still names it, so two of a model keep theirs. The entries count
among the settings whose change starts the joypad driver again at a
video restart, and so does a config reload that undid runtime moves.
* Input: a controller playing as another's player shares its core port
A user whose controller plays as another user's player feeds that
user's core port through the port map: that user's Mapped Port, from
remap files or identity. Its own Mapped Port is never changed or
saved. Everything that reads a user's core port reads this effective
port, and the Quick Menu's Mapped Port row reads "Shares Player 1 (core
port 1)" for a sharer.
An Auto controller placed to share with the player a reservation names
keeps sharing while it stays connected, also once that player's
controller leaves. The poll rebuilds the map when who shares changes,
and the core is told its controllers again between frames, not while
netplay or a replay owns the ports. Under First Press a press on any
of a player's controllers gives that player's user its port.
* Menu: a controller's player in Input > Controllers and Port N Controls
Settings > Input > Controllers, after RetroPad Binds, has a row per
connected controller in port order, then those past Max Users, then
the Plays As entries of controllers that are gone. A row's value is
the controller's player or, on Auto with a port, "Auto (1)", the player
Auto gives it. The sublabel names the player first and a controller
port only by its page name: "Player 1", "Player 1, shared · binds in
Port 3 Controls" for a controller sharing a player from another port,
"Not playing: more controllers than Max Users", or "Not connected".
On a Controllers row, Left and Right step through Auto, 1 to Max Users;
OK opens them as a list. RetroPad Binds > Port N Controls starts with a
row for each connected controller playing as the player port N feeds,
the same setting, then Add Controller: the other connected controllers
with a port, each with the player it plays as now, where a pick moves
that controller to this player. One controller on several players stays
Device Index's.
A change to a connected controller marks the configuration changed and
places it again as its connect did, with any controller it pushes off a
port, and no driver restarted. The entry point is in task_autodetect.c,
beside the reservation placement it reuses. A controller whose change
left no player in effect goes to the first free port. While Plays As is
in use, a change of Max Users places again the controllers left with no
port and those whose player comes within it. With every entry taken a
new one is refused with a notice.
A controller set to a player above Max Users reads "Above Max Users:
plays as Auto (Player 2)". On Port N Controls a row's sublabel reads
"This port" or "Shared · binds in Port 3 Controls". Device Index's note
for a controller another port reads becomes "used by Port 2".
After Add Controller, Port N Controls links to Port M Controls for each
controller playing as player N from port M, such as "OpenXR Controllers
(Port 4 Controls)": that controller's binds are port M's. Quick Menu >
Controls > Port N Controls starts with the same links to the pages that
hold its remaps. Both lists and the Quick Menu's Port N Controls are
made again on hotplug, and Port N Controls after a Device Index change,
with the cursor kept on its row.
The menu lanes are in stereo_headset_test, which already links the
shipping menu objects and runs in CI's OpenXR jobs; a build without
OpenXR skips it.
* Input: a controller's own hotkey buttons
A Plays As entry keeps a button and an axis of its own for any hotkey,
input_plays_as_<hotkey>_btn_N and _axis_N, written only where set; an
entry that has one is kept on Auto. It counts neither as a player nor
among the settings whose change starts the joypad driver again. A
sharer reads its own first, then its profile's, never the set's; the
hotkey port's own controller reads its own, then the set's, then its
profile's. Button and axis go each on their own.
The bind values, "8", "h0up", "+1", are read and written by helpers in
input_driver.c that the configuration's own binds now use too.
* Input: Hotkey Enable pairs with the controller it is on
A sharing controller's hotkeys go by its own Hotkey Enable, its bind or
its profile's, whatever the hotkey user has: one with an Enable fires
while it holds it or the keyboard's, one with none fires freely. With
Hotkey Device Type Merge on and a keyboard Hotkey Enable bound, a
sharer with none waits for the keyboard's, as master makes user 1's pad
wait. Holding a sharer's Enable holds game input back as any Hotkey
Enable does, and opens only that sharer's hotkeys.
Keyboard and mouse hotkeys keep master's Hotkey Enable rule whatever
sharers are connected: a sharer's Enable does not open them. Nor does
it open an input_combo_N entry with a key; an entry of RetroPad buttons
alone opens with it, as those buttons are every port's. A sharer with
an Enable of its own needs it for the menu toggle too, and whether a
pending menu tap is kept is read from the sharer's own binds, not the
set's.
The hotkey user's pad Enable plays no part in a sharer's hotkeys: each
controller's hotkeys are its own, and so is its Enable.
With Hotkey Enable Tap Delay, the hotkey of a sharer with no Enable of
its own leaves the keyboard's tap alone, as the keyboard's Enable did
not open it. Under Hotkey Device Type Merge, where such a sharer waits
for the keyboard's Enable, its hotkey swallows the keyboard's tap.
* Menu: hotkeys bound from a sharing controller are its own
Binding a hotkey also listens to the controllers that fire the hotkeys,
those on the hotkey user's core port, and its prompt gains "Listening
to Player 1's controllers", for the player the hotkey user plays as. A
press on the keyboard, the mouse, user 1's pad or the hotkey user's
goes to the set as before; a sharing controller's press is kept as that
controller's own, with an entry made for it at its player, refused with
the full notice when none is free. A press from a controller that has
its own bind for the hotkey replaces that bind, user 1's pad included.
Any bind, RetroPad binds too, also hears the port's own controller when
it is in a slot at or past Max Users, where Plays As placement can put
it, so that port's binds can be set from it.
A hotkey's row shows each connected controller's own after the set's,
"Select · OpenXR Controllers: L3", and clearing it clears theirs too.
* OpenXR: the headset shares player 1 on Auto and moves no one
For the headset's controllers, Combined or each hand in Separate, Auto
means sharing player 1, so a VR player's pad and headset both drive
player 1 with no setup. They take the highest free slot and the highest
free port below Max Users, so pads keep the low ones, and share their
player whether anyone is on its port or not, moving no one; a pad
turned on later lands on port 1 and shares with them. Set to a number,
they do the same with that player. Every other controller's Auto takes
the first free port.
A reservation naming the headset beats its Auto, as for pads, and a
number beats a reservation. A pad set to the player whose port a
headset on Auto holds takes that port, and the headset moves to the
highest free port, or gets none. Any change of Max Users places the
headset again at once, on the highest free port. Wherever Plays As asks
whether a player is in effect, a connected headset on Auto counts as
player 1, as one set to 1 does.
OpenXR looks up each controller's player only when the devices or the
entries change, and places a controller again when it starts or stops
playing as a player, or when a slot below Max Users frees up for one
placed past it. A player's controller that a pad pushed out of its slot
is placed by its player rather than taking the port with it. A headset
entry names the controller by the name OpenXR looks it up by.
The laser answers the core once, for the core port the headset's
controllers play on, so it no longer mixes with another user's mouse;
in Separate each hand's player gets it, the pointing hand aiming and
firing and the other reading offscreen. A headset controller with no
player drives no pointer, and the Monado e2e cases follow the new
placement.
mapped_port_test is built a second time with OpenXR, as
mapped_port_openxr_test, and CI runs both.
* Menu: OpenXR Controller Layout under Input > Controllers
Combined or Separate is how the headset's controllers appear, so it
moves from the headset's video rows to the bottom of
Settings > Input > Controllers, named for what it sets. The key and its
values are unchanged. Switching it reconnects the headset's
controllers, and the cursor stays on the row.
* Input: Plays As in core, content directory and game overrides
Save Override now saves the controllers' own players and hotkeys. Each
controller whose player or own hotkeys differ from the main
configuration's (with --appendconfig) has its whole entry written, all
of its entries for two of a model, in the order a start hands them
out, one on Auto ahead of another of its model as an Auto entry; one
the main configuration gives an entry and the session none is written
as Auto. An entry the same as the main configuration's is not written,
so a controller set back drops out of the override.
An override's entries are read on their own and go over the ones read
before by controller, as entries are matched to controllers (vid:pid,
else name), not by number: the last file naming a controller gives it
its whole entry, in the place of the one it had, two of a model taking
a file's entries in order, an Auto one included, the connected ones
lowest slot first; a controller no override names keeps the main
configuration's. Auto takes one back to Auto, and a controller new to
the entries takes a free one, if any of the sixteen is. Until now the
files' keys merged one by one, so an entry could pair one file's
controller with another's player, and no override could take an entry
back to Auto.
Loading or unloading an override from the menu, or loading the active
ones again, places the controllers again at once, as a Player change
does: those whose player changed, or all of them where the reload read
the configured ports back over the moves. Content load and close leave
it to the joypad driver's restart, as before.
mapped_port_test covers the merge, what is saved and the placing
again; video_screens_test saves, unloads and loads a game override
with a Plays As change.
* Input: a controller keeps its Plays As entry while its twin is unplugged
Two controllers of one model share the entries that name them, each
taking the first one no other connected controller holds. With one of
the two unplugged, anything that made the other take an entry again
could hand it the unplugged one's: a Player or Max Users change,
loading or unloading an override, any re-read of the main config, a
joypad driver restart, and Online Updater > Update Controller
Profiles, which reports every connected controller again. The
controller left then played the other one's player, and that one came
back to its twin's.
An unplugged controller's entry now stays its own for the rest of the
session, and only a connect takes it: that controller coming back, or
another of its model. A reload keeps it while the entry in its place
is still of its model, and an override's entries pair with it as if
the unplugged controller still held it from its slot. So an override
loaded with a twin unplugged gives the other twin the entry it adds
and leaves the unplugged one its own. Save Configuration and Save
Override count it as that controller's too, so what they write pairs
the same way when it is loaded again.
Placed again for a Player or Max Users change, or by Update Controller
Profiles, a controller keeps the entry it holds, or none. Reported
again by its driver while still connected, it keeps the one it holds.
A reload is judged as a whole once its last override is read: a
controller takes an entry it did not hold before only where the
reload added it for its model, so one an override newly names still
gets that entry.
A joypad driver restart still lets every claim go and hands the
entries out again in the order the controllers are reported, as a
start does, but its reports leave an unplugged controller's entry
alone. A driver's report queued behind a profile update's is not
dropped as a repeat of it, since the update takes no entry, and the
update it supersedes shows no toast, so one shows, as before.
* OpenXR e2e: FRAME_BINDS catches up with the grip poses already bound
Every profile binds pointer/grip to both hands' grip poses, and
input-frame-profile matches FRAME_BINDS exactly, so the table now lists
the poses as they are bound.
* Menu: OpenXR touch settings on Input > Controllers
Touch Hands, Touch Button and Touch Passthrough are added for the hands
that touch a screen they point at, the button that touches, and whether
that button's other binds fire too, with Touch Hands None to turn touch
off for the headset's controllers; a later commit puts them to use.
They follow OpenXR Controller Layout, Laser Pointer and Laser Beam,
which move here from Stereo 3D & Screens, at the end of Settings >
Input > Controllers, shown only for a video driver with a headset path.
A hotplug keeps the cursor on any of these rows, and overrides save
them per game.
* OpenXR: the headset's menu button is button 16, bound to Menu Toggle
The menu action of each profile presses button 16 of the pad, the left
hand's in Separate, instead of being a hotkey of its own, and the
built-in profiles bind Menu Toggle to it and label it "Menu", as pad
profiles name their Guide or Home button. It opens the menu from the
same button as before and can be bound elsewhere like a pad's Guide
button. Touch's one menu button presses button 16 once held a second.
In Edit Screens the menu button always opens the menu, whatever is
bound and whether or not Hotkey Enable is held.
Sharing player 1, the button goes by Hotkey Enable as a sharer's Guide
does where its profile has none: it opens the menu whether or not
player 1's Hotkey Enable is held, and the enabler alone opens nothing.
mapped_port_test covers both.
With the menu open, a press of the controllers' buttons hides the
laser's dots until a trigger is pulled, so hand drift cannot undo their
navigation. The menu button navigates nothing, and with no content Menu
Toggle leaves the menu open, so its press does not count.
* OpenXR: the Touch Button's buttons as pointer actions of each hand
Grip, stick click, bumper and A to Y each have an action per hand in the
laser's action set, bound from a table per profile in the same
suggestion as the pad's rows, so either controller layout can read them;
the trigger is the pad's own. The Frame's exact binding list in the e2e
gains them.
A runtime that refuses a suggestion loses its palm first, then these
rows, then edit mode's, a smaller loss tried before a larger, and keeps
the rest of the profile. INPUT_OPENXR_MAX_BINDS goes from 48 to 64 to
hold these rows with edit mode's (Index 52, Touch 51, the Frame 58); a
profile whose pad and Touch Button rows pass it is not suggested at
all, and the log names it.
* OpenXR: touch with the chosen button and hands
The Touch Button, read from its own action or, for the trigger, from the
pad's, touches a live screen the hand points at; the trigger still
clicks the menu, and is L2 or R2 on a screen once it is not the Touch
Button. A hand touches only if Touch Hands has it and its controller has
the button, as read from each hand's interaction profile; only such
hands aim at the screens, become the pointer or show a dot there, and
with none the screens stay the mouse's. The others aim at the menu
alone, which video_xr_pick() now takes as a flag. Touch Passthrough lets
the trigger's L2 or R2 through its touch.
A hand takes a changed setting at its next press. A button held through
a change of Touch Button, Touch Hands or the hand's controller profile
is no press: the trigger goes by its own last read, and any other button
counts as held until it is let go.
* OpenXR: a touch holds back its button's other binds
OpenXR gives an input to every action bound to it, so a Touch Button
other than the trigger also reaches the pad. While it touches, or a
press of it would, the pad's buttons bound to the same input of that
hand in the profile's rows are let go, in Combined and in Separate: the
Index grip's L or R, the Frame right stick's menu button. Touch
Passthrough leaves them pressed.
With the menu open, a press of the controllers takes the laser from the
dots until a trigger pull. Like the triggers' L2 and R2, what a Touch
Button's input feeds does not count as such a press, with Touch
Passthrough on or off, so the button can still touch a live screen
there. Another button on the same hand still counts.
* Menu: Touch Button offers the buttons the controllers have
The dropdown lists the buttons either hand's controller has, as its
interaction profile names them, and the one chosen; left and right step
through the same, skipping the rest. A choice the controllers lack, as
from an override made on another controller, reads "(not on this
controller)". With no controller known every button is offered. The poll
publishes those buttons through an atomic, since with threaded video XMB
draws the value on the video thread.
* docs: OpenXR controllers, touching and the menu button
Where the headset's input rows are now, what Touch Hands, Touch Button
and Touch Passthrough do, None included, and that the menu button is a
Menu Toggle bind that Hotkey Enable applies to as to a pad's Guide; on
Touch controllers in Combined it is Start, and button 16 once held a
second. Laser Pointer's description says the Touch Button touches a
screen and the trigger clicks the menu, true with Touch Passthrough on
too.
The 'Scanning content: "<dir>"' log line (and its CLI printf)
only ran on database-matched scans, so a plain manual scan with no
database logged nothing. Move it below both branches so every scan
that starts logs the folder it is walking.
A set with no clones has the same merged and split fingerprint. Both
keys indexed the record twice, so the lookup returned it twice; with
its size equal to the archive's that read as two sized records and the
set fell through to a whole read. The second key is now skipped when
it equals the first, which also keeps the index smaller.
The fingerprint's CRC list sits on the stack for sets of up to 64
members, so most archives no longer allocate for it.
rar names no member it cannot unpack (solid, encrypted, an older
packer), so a fingerprint taken over the members it does name would
claim a set that may not be all there. Such an archive now has none
and goes on to its other passes.
7z and rar also name no folder, which would look the same, so the
scan's directory walk asks them to name one as zip does, ending in
'/'. Nothing else sets the flag.
The arcade databases key each set on the CRC of the whole
TorrentZipped archive, so the same ROMs packed any other way - zstd
or 7z, other names or order, a merged parent - never match.
An optional set_fp1 key holds the CRC-32 of the set's ROM CRCs,
de-duplicated, sorted and taken as big-endian bytes; set_fpm1 holds
the same for a merged parent. The archive's one directory walk gives
its fingerprint, leaving out folders, empty members and cue or gdi
sheets; a member that stores no CRC leaves it without one. Each
database whose cores open the archive's type and that carries the
keys is looked up through an index built like the crc one. A hit
writes the record's entry, as a match on the archive's own CRC does,
and no archive is read whole for it.
An archive of several members is looked up by its fingerprint before
its size is. An archive of one member is looked up by it only after
its member's CRC missed, so a first-member hit held for a cartridge
database still wins.
Where several records of a database share the fingerprint, as a set's
split and non-merged packings can, the one whose size is the archive's
is taken; where several have that size the archive's own CRC decides,
and where none does, the one named like the archive, else the first.
The readers read a TorrentZip set whole with no grant only while no
database that opens zip carries fingerprints, so the fingerprint
indexes of those databases are built before the readers start. One
that cannot be built counts as carrying none: that database can match
the set only by its own CRC. A database without the keys costs one
walk per scan; older versions skip the keys.
Follow-up to "Scanner: Match Jaguar CD discs by CRC".
When a sheet had no data track, the fallback parsed the whole sheet
a second time with that track forced to data. That re-reads the cue
and reopens every track file - a Redump Jaguar CD has one file per
track, so ~20+ extra opens per disc during a scan.
Note the first track of session 2 (while no data track has been seen)
during the one parse instead: its start index, its end (next track's
index in the same file, or the file's end), its path and its open
stream, which the CRC pass then hashes without a fresh open, as a
data candidate's is. The force_track parameter goes away.
Same answers as before on 13 sheets (one file per track, single bin,
shared files, Enhanced CD, data before/after session 2, missing file,
CD-i, REM comments), ASan/UBSan clean. On a 24-track Redump-style
sheet: 48 -> 24 track opens, ~100 -> ~47 us per sheet.