Commit Graph
406 Commits
Author SHA1 Message Date
David Palacios 467bb36711 CLI: add AVX2 pre-flight CPU check before executing titles
(cherry picked from commit 534e1dd74c57448bef4c525e204acc123387d6f2)
2026-11-25 01:03:00 -06:00
Luiz Neves b2e23f834c HLE: test that XGSuggestSwizzleMode picks linear for a 1D texture
(cherry picked from commit 246ecea9631acfe1b694421c6c600e3981a1f752)
2026-11-25 01:03:00 -06:00
BastienRdz ea78bb9483 Loader: a clwb in the last bytes of a page is emulated instead of faulting
emulate_amd_only copies only the bytes left in the faulting page and
gated clwb_len on n >= 15 because clwb_len took a fixed [u8; 15]. A
4- to 10-byte clwb starting in the last 14 bytes of a page (or falling
back from a clwb_loop that straddles the page end) was therefore
skipped, leaving pre-Ice Lake Intel CPUs with an unhandled
STATUS_ILLEGAL_INSTRUCTION.

Change clwb_len to take &[u8], bounds-checking each byte read and
returning Some(len) only when len <= code.len(), and drop the n >= 15
guard in emulate_amd_only.

Fixes #924.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 60d2cf9cbcf5a2abc773d5de10c3c892e77d3340)
2026-11-25 01:03:00 -06:00
Enzo Souza Duarte 41dc5da4c9 Config: ignore an empty VICTORY_CONFIG
(cherry picked from commit fd44561ea1180aff5380285527fb8cac8195f4e8)
2026-11-25 01:03:00 -06:00
nino-exe bb0a2428fc policy: resolve a .. in the not-yet-existing part of a path
`resolve` canonicalizes the longest existing prefix and re-appends the rest, but it walks up with
`Path::file_name()`, which is None for a trailing `..`. A path such as `<tmp>/a/../b` (nothing exists yet) hit the
`_` arm and returned PolicyError::Io, so a cache_dir or data_dir with a `..` in a directory that does not exist yet
was rejected, and `normalize`'s `..` handling for the missing tail was never reached.

A trailing `..` is now kept in `rest` so `normalize` resolves it lexically.

Test: resolves_dot_dot_in_a_path_that_does_not_exist_yet (fails before, passes after). cargo test -p victory-core,
cargo fmt --check and cargo clippy --tests are clean.

(cherry picked from commit 52f0a099ede8aa4d5bde61a0c46963a77a4378ba)
2026-11-25 01:03:00 -06:00
quaternion 6ee01b61bd fix(hle): honor the requested executable on relaunch
runtime stores an absolute image path while relaunch_args searched raw CLI arguments for exact text, so a relative launch argument made XLaunchNewGame silently rerun the old title. Normalize the argument the same way runtime does before replacing it. Also split the title's quoted config args into proper arguments instead of split_whitespace. Add a regression covering a relative startup path, a different target and quoted/empty args.

(cherry picked from commit 71e88665c44f6f82370e2fb84e6d2358c1e7b180)
2026-11-25 01:03:00 -06:00
quaternion d23f0b83e1 fix(hle): read manifest fields past inline XML comments
elements() took field text up to the next '<', so a generator comment before the value made TitleId, StoreId or SizeMB empty. Skip comments while gathering the text. Add a regression with comments inside all three fields.

(cherry picked from commit ca362a42473bb0f8f9a83377091287a621e94527)
2026-11-25 01:03:00 -06:00
quaternion 7a4f0018b5 fix(loader): stage prepared images in per-writer files
write_if_changed used a shared <hash>.tmp file, so two concurrent cold launches of the same image could truncate each other's staging bytes or fail the rename after the other had published. Move publication into a portable module that stages under a unique pid/sequence name and removes it on failure. Two hermetic tests cover concurrent publishers and a failed rename.

(cherry picked from commit 1aac20aa8fd97237053c985b942225d54c0194a7)
2026-11-25 01:03:00 -06:00
quaternion 98b36e12a2 fix(pe): keep every name for a shared export ordinal
The PE-specific export table stores one name per address-table slot, so when two names alias one ordinal the earlier name is silently dropped from ImageInfo and from victory inspect --exports. Use the generic Object::exports iterator instead, which yields every named export and then ordinal-only entries, and map its target and flags back to our representation. Add a synthetic PE regression with two names for one ordinal plus a separate export.

(cherry picked from commit d0dd9fc5c01ce2e7e82047b4ab7e5b4821c82d7a)
2026-11-25 01:03:00 -06:00
给伊莉雅补魔 3af6d8fb0e GPU: add synthetic unit tests for query.rs and signature.rs
(cherry picked from commit 0be58e62d24181a9eb60244a7e4d878a3627d401)
2026-11-25 01:03:00 -06:00
给伊莉雅补魔 ed07828ce2 PE: add synthetic unit tests for implib.rs and layout.rs
(cherry picked from commit 131944d02dc0b37469f85f907234c664eb8027af)
2026-11-25 01:03:00 -06:00
Aws c7541110d4 List successfully emitted shaders in offline translation scans
(cherry picked from commit 6d174aeeeb93669ab9f43ff01b24963933433af8)
2026-11-25 01:03:00 -06:00
TG0000 62d1b8139e GPU: seek directly to private data on final release
Co-Authored-By: GPT 6.2 Sol <[email protected]>
(cherry picked from commit 3e98bd7e0ce79762162ac958e3ab67cc85de00c9)
2026-11-25 01:03:00 -06:00
给伊莉雅补魔 6aa6fc1cbb loader(crash): verify unwind against known caller frames when RtlCaptureStackBackTrace returns empty
(cherry picked from commit 121412bec21b0790d04d56399f49e2d140652864)
2026-11-25 01:02:59 -06:00
TG0000 8961e15fc7 Formats: share immutable texture swizzle tables
Co-Authored-By: GPT 6.2 Sol <[email protected]>
(cherry picked from commit 64b80c310941c8c105c9ac78fe4c29004f5e88a4)
2026-11-25 01:02:59 -06:00
给伊莉雅补魔 eabb82601c docs(architecture): list BCPack as implemented in victory-formats
(cherry picked from commit aaacc2dcfe09afc10d0893b0259ef20afd326280)
2026-11-25 01:02:59 -06:00
DocBlack89 0aa61efd22 fix(pipeline): retry collisions when creating cache staging files
Preserve stale staging files left by interrupted writers and retry a bounded number of atomic create_new attempts. Propagate unrelated I/O errors immediately. Add deterministic CPU regressions. AI-assisted.

(cherry picked from commit a32eacdd5e0f2e55b5c0cddeb0d44d5fa93f9bb9)
2026-11-25 01:02:59 -06:00
Nixitov efbf10765a HLE: implement the RPC runtime's GUID calls
(cherry picked from commit 7216ab7113115ea1accfabc6e3a00ee700c7c846)
2026-11-25 01:02:59 -06:00
EatCodeSleep2 3f497dafc1 Handle unsupported display deferrals in the HLE test
(cherry picked from commit efe102edac86f365a9951f3c92228413cbee8e46)
2026-11-25 01:02:59 -06:00
Thomas Askharoun e8eb93a2bd Show on-disk file size in victory inspect
(cherry picked from commit 43e2ca9de29f5833941970e82ed89872c9f86a81)
2026-11-25 01:02:59 -06:00
AlanQiang0418 379f4e733d Formats: reject multisampled linear texture layouts
(cherry picked from commit 350f91c23a9402b2a556a84c208a80030910ae3f)
2026-11-25 01:02:59 -06:00
LF2000 Builder 886afce1e3 translate: refuse a VICTORY_EMIT_DUMP directory inside the repo
translate writes emitted DXIL and validator reports to the
VICTORY_EMIT_DUMP directory. Both are derived from the game's shaders,
but the directory was never checked against the source tree. With
VICTORY_EMIT_DUMP=. run from the checkout, the .txt reports land in the
repo, and git and cargo xtask policy both let them through.

Check the directory once at the start of translate::run, as Config
already does for the cache and data directories.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 988fd9a64718ee9a235cff3b60192b6b86006c4d)
2026-11-25 01:02:59 -06:00
LF2000 Builder 939ba82922 Shaders: print only the operands an instruction has in SP3 text
The disassembly text showed operands that some instructions lack, and
dropped VOP3P negation that applies to one half only:

- s_memtime, s_memrealtime and s_get_waveid_in_workgroup printed the
  unused SMEM base and offset.
- A global or scratch access with no SGPR base printed `null`, not `off`.
- A MUBUF load with lds printed the unused vdata as a destination.
- VOP1 SDWA printed src1_sel, though VOP1 has no second source.
- VOP3P ops other than v_fma_mix with only neg_lo or only neg_hi set on
  a source printed as if the source were not negated. These now get
  LLVM's neg_lo:[..] and neg_hi:[..] suffixes; a source negated in both
  halves keeps `-src`.

Expected operands come from llvm-mc -mcpu=gfx1030 (gfx1010 for
s_get_waveid_in_workgroup). Only the text changes; translation reads
Fields and is unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 6325df752c5638365c3e5a2b2f827ba0f3f145cb)
2026-11-25 01:02:59 -06:00
KoLolX3 77582c3af4 GPU: VICTORY_* switches set to 0 are off
Six diagnostic switches (VICTORY_D3D12_DEBUG, _GBV, _DRED, _WARP,
VICTORY_GPU_TIMING and VICTORY_DUMP_TARGETS) were on whenever their
variable existed, so VICTORY_D3D12_WARP=0 still selected the software
adapter. They now go through one helper that reads a value other than 0
as on and an unset variable or 0 as off; every other value keeps the
meaning it had. The README says so above its switch table.

(cherry picked from commit a4974e4c21c16e2305942e37a868647d42eefe37)
2026-11-25 01:02:59 -06:00
LF2000 Builder 20d9d1ebfe xtask: count \x escapes and 0x hex arrays as encoded runs in the policy check
The run check split on every byte that is not alphanumeric or +/=, so
b"\x4d\x5a..." broke into 3-character pieces and an xxd -i style
[0x4d, 0x5a, ...] array into 4-character pieces. Either form of up to
about 100 KB of copied bytes passed the check and the pre-commit hook.

Also count the hex digits of \x escapes and 0x literals that have only
commas, whitespace or backslashes between them, and flag the file when
that passes the same 512 limit. The largest such run in the tree is 36
digits. Decimal arrays are still not caught.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e950e81756340b10c3ef87d9c1789ae482f1a262)
2026-11-25 01:02:58 -06:00
Devin ea357d4210 Shaders: reuse lane guards for unchanged EXEC within a block
An instruction guard depends on its EXEC and the reachability of its block. Keep the most recent result, including an elided guard, rather than repeating the same BDD queries for consecutive vector instructions. Scalar instructions still bypass guard selection.

Cover EXEC changes across and within a branch with a synthetic shader. Add a CPU-only guard_runs benchmark for unmasked, short, and long masked runs.

(cherry picked from commit 81b81df351437c50f4321286c725de51664c7b1b)
2026-11-25 01:02:58 -06:00
broccolize bda8238b80 GPU: clear DXGI outputs on out-of-range enumeration
(cherry picked from commit b796c8b8b80cfa4506f254474ab9fd7260bfd8e6)
2026-11-25 01:02:58 -06:00
LF2000 Builder ee054d4732 xmem: report allocations the host refuses
A refused XMemVirtualAlloc or XMemAllocDefault handed the title a null in
silence, and the title then writes at null plus an offset, which reads
like a title bug. In #289 the faulting write is at 0x217800, the
request's length 0x2173a0 rounded up to 2 KiB, so the base it built on
was most likely such a null.

At the commit limit, XMemVirtualAlloc now writes the same crashes.log
report the physical-page commit writes since #51 (the shared part is
`commit_refused`); other refusals, and a host heap out of memory, are
warnings.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 65062e133c75c3b6e984ac51e904512d41f71f93)
2026-11-25 01:02:58 -06:00
Enzo Souza Duarte 45f9f49dac HLE: require two hex digits in percent escapes
(cherry picked from commit 75fe6c02b278f18eab33ad893bda1dd68d176287)
2026-11-25 01:02:58 -06:00
nathanbzrr 67d1d0222b Census: deduplicate PE imports without hint
(cherry picked from commit a3f89eda547690efa8542b8b993b9de894f05bb1)
2026-11-25 01:02:58 -06:00
nathanbzrr 5dcfa24dd5 XStore: wire offline *Result slots and fix OOB XStoreShowProductPageUIResult slot
(cherry picked from commit 2c22e2b2d23ef2c6e79e67d5cff51d5c8ec3475d)
2026-11-25 01:02:58 -06:00
marquezini 2e11203dfd Kernel: GetModuleFileName of a title image into a null buffer
A slice may not start at null, even an empty one, so asking for a title
image's name with (NULL, 0) was undefined behaviour; a debug build
aborted the process. A null buffer is now no buffer: nothing is written,
0 is returned and the last error is ERROR_INSUFFICIENT_BUFFER.

(cherry picked from commit c000581df2cf12aaadfe49025f9abba8b5993c8e)
2026-11-25 01:02:58 -06:00
marquezini 2ea5f0f6f4 XGameUi: a text entry's limit is the console's
XGameUiShowTextEntryAsync documents a 1024-character maximum on console,
1024 for a maxTextLength of 0, and 1024 for the Password scope whatever
the title asks. 0 meant no limit here, larger limits were kept and the
scope was ignored.

(cherry picked from commit 936e5e51c91c7b380a4729aeaa2255824ce8085a)
2026-11-25 01:02:58 -06:00
FIocker d02932f322 Shader info: show stage I/O even when instruction decoding fails
Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e6ebec9ccf0bc27cfe0b5509ec3d07a0969eb25f)
2026-11-25 01:02:58 -06:00
Duff 803ada0162 HLE: a '>' in a quoted manifest attribute does not end its tag
The MicrosoftGame.config reader ended a tag at its first '>', but XML
allows '>' unescaped inside an attribute value. A value with one
(DefaultDisplayName="A > B") cut the tag short: its '/>' was never
seen, so the element stayed open and every element after it was read
as its child. Game/TitleId and the storage quota were then not found,
and the title ran as id 00000000 with no storage quota, its saves and
temporary files in that folder, without a warning.

A tag now ends at the first '>' outside quotes.

(cherry picked from commit d549b6397e3f40e77f9da670344aa15f12b26abb)
2026-11-25 01:02:58 -06:00
Pedro Fortunato f4a7ae21ad fix(formats): reject overlapping texture depth slices
(cherry picked from commit 93a24b7cdaeb0e7f132f711e9cbd9ba405b0f639)
2026-11-25 01:02:58 -06:00
Duff c719d0cf2b HLE: load a host DLL outside the module cache's lock
host::module held the module cache's lock while it called
LoadLibraryExA. Loading a DLL that is not loaded yet takes the OS
loader lock, and title code runs under that lock too (a title DLL's
thread attach, TLS callbacks run as threads start), where it can need
the cache: any first use of a host! function, or a late-bound title
DLL. One thread holding the cache and waiting for the loader lock,
another holding the loader lock and waiting for the cache: the process
hangs, and cannot even exit, as ExitProcess needs the loader lock too.

The cache is now looked up, then unlocked for the load, then locked
again to keep the handle; a thread that loaded the same DLL meanwhile
got the same module, which stays loaded.

(cherry picked from commit c6959acba38304852c185bcd7bc2ba1478d6e0b2)
2026-11-25 01:02:57 -06:00
marquezini 410001269c XStore: a store id without an installed package is an invalid argument
XStoreQueryPackageIdentifier documents E_INVALIDARG for a store id that
has no installed package. We returned XPackage's 0x89245208 instead.

(cherry picked from commit e3bef089855cc4b463a0ce7e1a70f6abf7c859e5)
2026-11-25 01:02:57 -06:00
Maraco91 89fb38b8cd GPU: every object answers for IUnknown
No graphics object's interface list holds IUnknown, so QueryInterface
for it (and every call that hands out an object by interface id) said
E_NOINTERFACE and returned null. COM code asks for it to compare two
pointers for identity, to keep an object as a plain reference, or to
pass it on to an API that takes any object.

object::is, which all of those go through, now also matches IUnknown.
The DXGI device answers with the D3D12 device, which it already stands
for: one pointer whichever of the object's interfaces is asked.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 92f2c60c8159e34a47570aa81f3d25624cc6db5c)
2026-11-25 01:02:57 -06:00
AnoHunted 7e4bb28d04 Audio: an XMA read block past the ring's end wraps instead of filling forever
The decoder fills an XMA voice's output ring until the write block
(word 0, bits 27-31) comes round to the title's read block (word 9,
bits 0-4). The write block wraps modulo the ring size (word 0, bits
22-26), and so does a read block moved on by command 18, but a read block
the title set up at or past the ring's end was compared as it was: no
write block ever equalled it. With a stream that loops forever the pass
never ended, holding that voice's lock, so the title's next command on
the voice (advance, disable) waited for good, and releasing the context
arrays did too.

Take the read block modulo the ring size as well, as the write side
already does. A test sets up read block 6 on a ring of four with an
endless loop and requires the pass to end within seconds, with blocks 0
and 1 filled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 1054fe87de08038e887d6f7c6f44e5b07ac7a9f9)
2026-11-25 01:02:57 -06:00
Maraco91 3d567d4bb3 XAsync: a new block where a result was left behind begins a call
Calls are filed by their block's address, and a call that succeeded with
a result stays filed until XAsyncGetResult takes it. XAsyncBegin refused
any block whose address had a call filed. So when a title never took a
result and freed the block, the next block it was given at that address
could not begin a call: E_INVALIDARG, every time, with the old call's
provider never cleaned up.

A zeroed block is a new one: the block of a result left behind holds the
result's size, so it never reads zero. XAsyncBegin now ends a finished
call filed under the address of a zeroed block (its provider gets its
cleanup) and begins the new one. A call still in flight keeps its
address, and a block still holding a result is refused as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 5cff0007a525b83f5c69912d7a38f53c6dafcfef)
2026-11-25 01:02:57 -06:00
Manuel Pérez 91d41b2c90 Loader: suspend a thread before reading its TEB; skip bad dump times
Stack dumps (VICTORY_STACKS, diagnostics builds) read another thread's
TEB right after NtQueryInformationThread and suspended it only later: a
thread exiting in between frees its TEB, and the read faults. The
thread is now suspended first and resumed on every way out.

The dump times went through Duration::from_secs_f64, which panics on
`inf` or `1e20`, killing the dump thread (the crash hook logs it as a
crash). They are parsed by `schedule` now, which leaves out NaN and
times no Duration holds. 1 new test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit acdcc41687be2ecd2bf2efc43ab7449329483382)
2026-11-25 01:02:57 -06:00
Diego 8b4f50f2e1 fix(pe): validate section raw data bounds
(cherry picked from commit e57e76a7b4058e50d665ddcc9a11eb3cd4de4e7d)
2026-11-25 01:02:57 -06:00
Maledetto 1466eb61a2 Loader: clzero loops in one exception; rdpru
Based on #34 by ka1qux (commit faa0a9a), rebased over #45, which added the
same flag and register helpers for clwb loops; the duplicates are merged
into gpr/cmp_flags/CMP_FLAGS.

clzero: the two loops compilers build around it are done whole in one
exception, leaving registers and flags as the last pass would. Anything else
around it is one line and the next instruction.

rdpru: returns the time-stamp counter for MPERF and APERF, 0 for other
counters, and leaves the flags as they are: a Ryzen 7 5800X3D running it
natively in user mode changes none, for known counters or not.

Added over #34:
- loop 1 rejects cmp rax, rax (it fell into the loop and left wrong flags);
- tests that go through the emulation on any CPU (both loop shapes, the
  rax-rax and wrong-neighbour fallbacks, rdpru with both flag states), since
  on an AMD host the native tests never enter the handler.

(cherry picked from commit 0de9efced179dfb523748f21cf4bdbe0d3aa7533)
2026-11-25 01:02:57 -06:00
Maraco91 fc0d5e7795 Media: a share is refused however it is spelled
The source resolver's rule (local files only) knew a share as `\..`,
`//..` or `file://server/..`. The host knows more spellings: any two
leading separators (`/\server\share`), the object manager's prefix
(`\??\UNC\server\share`), and a `file:` URL with no host whose path
starts with two separators (`file:////server/share`,
`file:\server\share`, also percent-encoded). Those fell through as
relative paths or drive-less local files and went to the host's
resolver unchanged.

They are refused now, naming the server. Paths with one leading
separator, a drive after the slashes or the prefix, and the path of a
URL that names this machine pass as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce)
2026-11-25 01:02:57 -06:00
Maraco91 8b5f54b235 Audio: an XMA loop's skip is of its first frame, not of its last
When a frame ended a loop, decode cut it at the loop's end subframe, set
the loop's skip (the subframes of the loop's first frame that lie before
the loop) and then took that skip out of the frame in hand: the loop's
last. So the head of the last frame was dropped instead, and the first
frame played from its start, with the audio before the loop in it. The
number of samples came out the same; the seam did not.

The pending skip is still applied to the frame in hand, and the loop's
skip is set after it, for the frame decoded next.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
(cherry picked from commit 985d8d4b025384b5f13a3177ef906c8b6cce6840)
2026-11-25 01:02:57 -06:00
AnoHunted 717b3e81b2 XMA: noise tests, and end a frame at its data instead of looping forever
Decoder::decode took the caller's bit count as the end of the frame. Past
the data the bit reader returns zeros, and a stereo tile header reading
only zeros gives the subframe to no channel, so it never moves on; with a
count beyond the data it never overreads either, and looped for good.
Clamp the end to the bits the data holds. A frame from read_frame always
holds its bits, so its decoding does not change.

Add deterministic noise tests (xorshift64, fixed seeds, as BCPack's):
buffers of noise packets, streams of noise frames with clean and damaged
headers, frames in mono and stereo at each sample rate, bit counts past the
data, and read_frame and packet at any offset. Every walk is bounded and
every decode must give one frame of samples. The bit-count test hangs
without the fix; the others pass on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit d4d1822049fed053c6188ea0b016b0976a71bf41)
2026-11-25 01:02:57 -06:00
TG0000 ade1da1129 XMA: build the inverse transform's rotations once per subframe size
imdct_half worked out every pre- and post-rotation with sin_cos on each
call (n of them per subframe) and ran its FFT on two fresh Vecs. The
rotations, the bit-reversed order and the butterfly rotations now come
from a table built once for 128, 256 and 512 samples; the work buffers
live on the stack. Every value is computed with the same expression (the
butterflies with the same running product), so the output is bit for
bit what it was.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 4eb0898b3cbd6d0bbbffad540aca5d7e3531ac58)
2026-11-25 01:02:57 -06:00
Duff 9a34298a0b Files: a title run by its file name alone gets its own folder as G:
`victory run GTA6.exe`, run from the game folder, gives an exe path with
an empty parent, and that empty folder was mounted as G:. An empty path
cannot be made absolute, so the root stayed empty and G:\x64\a.rpf
became \x64\a.rpf: the root of the current drive. The title then found
none of its files.

An empty root is now the current directory, which is what an empty
folder means everywhere else (`Path::new("").join("x")` is `x` in the
current directory). Passing a path with a folder in it is unaffected.

(cherry picked from commit 01ae55a3ba04c39a0e8851cc00da16af7a49adbd)
2026-11-25 01:02:56 -06:00
Duff 37e07605f8 XTaskQueue: terminating a queue cancels its delayed callbacks too
A callback submitted with a delay waited on a thread of its own and was
delivered when the delay ran out, whether or not the queue had been
terminated meanwhile. XTaskQueueTerminate only canceled what was already
in the ports, so a pending delayed callback was not canceled: it ran
later as live work (canceled = false), after the termination callback,
by which time a title may have freed what the callback uses.

The queue now keeps its delayed callbacks in a list until their delay
runs out. Terminate cancels them along with the queued ones, before it
calls the termination callback, and a delay that runs out after that
finds nothing to deliver. A submit racing Terminate checks `terminated`
under the list's lock, so the callback is either canceled or refused.

(cherry picked from commit b9ff219826e61ba6306f6a1378b613319f70da47)
2026-11-25 01:02:56 -06:00