sceMoveOpen returned a new handle for any user, type and index, although
the console's result for a user other than the initial user and for a
type and index that are already open is not known. Both now throw, as
libSceHmd2 does for another user. Record which shadPS4 behaviour the
handle and open checks add to.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Arbzg9c2DA4DEFKVSvRgYv
MCOMMIT becomes STC plus NOP padding and RDPRU goes through a
runtime-checked stub returning the host TSC for MPERF/APERF while
other selectors yield zero, with converter and execution tests.
docs/dev/debt/relinker.md records the new lowering and its unverified
assumptions.
PS4 titles import both and do not load without them; every call throws and
the debt files list them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fast proof of a cached ShaderResources proves each sampled texture
from write stamps, keys and the pending registry. It never asks whether
the sampled lookup would still return the bound Texture, so a template
whose surface memory is unchanged keeps binding an old object:
- After the sampled cache drops or replaces the entry (#6492 marks the
texture released), Find keeps serving the template until the next
Insert, and its fast proof passes.
- When the lookup's answer changes without any lookup running (a
snapshot whose surface became host-imported is viewed through its
storage image from then on), nothing replaces the entry and the
template keeps the snapshot until it leaves the resource cache.
The fast proof now fails with 'replaced texture' when a bound texture
is released. A template whose last full walk is older than
APS5_TEMPLATE_AUDIT_MS (default 1000, 0 turns it off) takes the full
walk instead of the fast proof ('audit'), so a different lookup answer
fails the proof and the template is rebuilt.
The entry stated that image atomics on 32_SINT and 32_FLOAT act on the
raw dword with no measurement behind it. On gfx1100 the 13 integer image
atomics return and store the same raw-dword results on 32_UINT, 32_SINT
and 32_FLOAT, while 16_UINT and 8_8_8_8_UINT controls differ. gfx1100
has no float image atomics, so that part stays open.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Prevent decimal-comma LC_NUMERIC from emitting invalid JSON and silently truncating decimal-point input. Keep 17-digit output, signed underflow and overflow rejection without changing the process locale.
AI-assisted: yes (OpenAI Codex). Windows WinLibs GCC15.2 Release: original shared Json2 fails the final locale regression; fixed guest_json and guest_json_numeric_locale pass (2/2, no skips). Final conventions pass. Only relevant runtime/test targets built; full build/full suite and game/console/Linux/macOS behavior unverified. No performance or coverage increase claimed.
Add libSceCamera with sceCameraIsAttached, which reports camera 0 as not
attached and rejects other indexes, and declare the ten camera functions
PS4 titles import without an implementation.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
sceNpGetAccountCountry, sceNpGetAccountDateOfBirth, sceNpGetAccountLanguage
and sceNpGetParentalControlInfo take an online id that matches no user,
sceNpGetUserIdByOnlineId and sceNpCheckPlus report NP as signed out, and
sceNpNotifyPlusFeature is declared and throws.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Track the handles sceMoveOpen issues. A handle that was never opened,
is closed or was opened before sceMoveTerm now throws instead of
succeeding, since the console's INVALID_HANDLE result and its order
against INVALID_ARG are not known. List the no-controller path under
Silent stubs, as libSceHmd and libSceBluetoothHid do, and check the
handle values in the test.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Arbzg9c2DA4DEFKVSvRgYv
The Linux entry stub now passes each traced import through libc.prx's
TraceImport_nid_no_patch before it calls the guest entry, and stores the
returned thunk in the import's slot. The same imports are traced as on
Windows: functions bound through a PLT slot or a GOT slot, without an
addend, and not weak. TraceImport_nid_no_patch is bound eagerly through
an added GLOB_DAT relocation, so a libc.prx without it fails at load.
Each slot's page is made writable with mprotect first, so slots inside a
PT_GNU_RELRO range can be replaced.
--trace-imports now requires libc.prx among the libraries on Linux too,
and is refused with --macos.
A thread that lost the race to write the report passed SIGABRT on straight away, and the default action ended the process while the first thread was still writing. It now waits for the report to finish, polling with nanosleep for at most 2 seconds, before it chains. guest_call_trace_abort_race aborts from two threads at once and checks the whole report; it failed 35 times in 50 without the wait. Reported by jotitadev.
The SIGABRT handler used stdio and dladdr, so an abort raised while another thread held the stderr lock or the loader lock hung instead of ending. The report is now formatted into a stack buffer and written with write(2). Callers are named from a module list taken with dl_iterate_phdr when imports are traced, and import counts are read without a lock from a fixed record array. The abort test now holds the stderr lock in another thread, which timed out before this change.
Build the call tracer for Linux as well as Windows. The thunk area is a
memfd mapped twice, writable and executable, and threads are named by
gettid. Linux has no crash report, so the first traced import installs a
SIGABRT handler that prints the last calls and the most called imports,
then passes the signal on to the previous handler.
guest_call_trace and guest_call_trace_abort now run on Linux too.
The 73 sceNpCppWebApiUnknown<nn> stubs carried an APS5_EXPORT alias because their
names were placeholders. aerolib names all of them, and each name recomputes to
the NID a title imports, so the alias is dropped and the loader derives the NID
from the real symbol name, as the rest of the library does. Behaviour is
unchanged: every one of them throws.
The stubs are ordered by demangled name instead of by NID, so the Common template
instantiations and the V1/V5 accessors sit together, as the rest of the file
does. No symbol changes: the built .prx exports the same 359 NIDs as main.
The entry before it still says sceKernelAddReadEvent and
sceKernelAddWriteEvent take only guest sockets. The pipe entry now says it
is the exception, without editing that entry, which an open change to the
shared-memory entry next to it would conflict with.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The overlap audit against origin/main and the open pull requests found 39 of
the 193 declared exports that must not be declared here:
- 14 that origin/main already exports. The nid_patcher computes the NID of a
symbol from its name, and a name ending in _nid_postfix exports the NID of
the base name, so scePadOpen, sceNetInit and the rest are already there.
- 23 that an open pull request provides: #6832, #6847, #6852, #7846, #7881,
#7889, #7890, #6977 and #7690.
- 2 whose technical-debt file an open pull request creates: #7463 and #8094.
The scope is now 30 libraries and 154 exports.
A recorded comp-to-single clear stayed valid for its surface address,
size and sample count until another recognized clear replaced it, so a
surface freed and reallocated on the same memory could import the old
color for its 0x10 DCC keys. The record now also carries the image's
pipe-bank XOR, which RADV assigns per image, and is dropped when an
unmap or allocation removal covers the surface's base.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RADV's comp-to-single shader stores user data 5 to 8 as the four dwords of
sample 0's texel: v0 from s5, v1 and v2 from s[6:7] through a 64-bit shift by
zero, and v3 from s8. RADV binds the image through a uint view of the texel's
size, up to R32G32B32A32_UINT, so a 64-bit texel takes the first two dwords
and a 128-bit texel all four. 0x10 keys of RGBA16F and RGBA32F targets now
import as a clear to the recorded color instead of being refused.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
RADV clears a multisampled DCC target to a color other than 0000, 0001,
1110 or 1111 with radv_clear_dcc_comp_to_single: a compute dispatch stores
the color at the first pixel of every DCC block through a uint storage view,
and the DCC keys become 0x10. The driver refused that view of a resident
target, made a separate target in the view's format otherwise, and couldn't
import 0x10 keys.
The dispatch is now recognized by its code and not run. Its clear color is
recorded for the surface its image descriptor names, and 0x10 keys on a
multisampled target of that surface, size and sample count import as a clear
to that color, for texels up to 32 bits.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a title has configured 119.88 Hz output (mode 15) and the window moves
to a display below 120 Hz, the presenter fell back to std::terminate via a
require() call. Replace the abort with a graceful fallback: reset outputMode
to mode 1 (59.94 Hz), fire the output-mode event so the title is notified,
and continue presenting.
This matches the HDMI output mode renegotiation a real display change
requires: the system falls back to a compatible mode and notifies the
title, rather than terminating the process.
After the fallback:
- sceVideoOutGetOutputStatus reports refreshRate 3 (59.94 Hz)
- sceVideoOutGetResolutionStatus reports refreshRate 3
- vblanks run at 59.94 Hz (every-other-tick skip resumes)
- sceVideoOutIsOutputSupported(mode=15) returns the unsupported error
- sceVideoOutConfigureOutput(mode=15) succeeds again once the window is
on a 120 Hz display
The console's exact behaviour when a 120 Hz display is lost has not been
measured; this fallback is recorded as unverified in the debt file.
Fixes#7877
libSceVideodec's five exports were stubs that threw. Decoder creation,
decoding, flushing, resetting and deleting are implemented with the
structure layouts of shadPS4's PS4 library, and the decode runs through
libSceVideodec2, which decodes H.264 with FFmpeg. The picture is copied
into the caller's frame buffer with the pitch aligned to 64 and the coded
height, the chroma after the luma rows, and the picture information holds
the timestamps and the crop offsets.
A guest test decodes the H.264 fixture through the library and checks the
pictures against the reference hashes.
AnyPS5 resolves a title's imports by NID, so a title that imports a system
function no library provides fails to load with an unresolved import. The
PS5 3.20 export inventory lists 193 such exports across 37 PS5 system
libraries AnyPS5 implements but does not provide.
Declare them as throwing stubs so those titles load and reach their next
blocker. Each declaration calls NotImplemented_nid_no_patch and returns 0;
none of them implements the function. Declarations with a credible
prototype use it and cite the source with a pinned commit, and the rest
are declared without parameters, which resolves the import without making
an ABI claim. The technical-debt files record the limitation per library.
libSceMbus and libSceSystemService are left out because pull request #7821
declares them. libSceAgc is left out because its exports are versioned, so
the 3.20 NID names a different symbol from the one AnyPS5 ships.
libSceAvPlayer.native is left out because it compiles libSceAvPlayer's
Export.cpp.
Names and NIDs come from the PS5 3.20 export inventory at
https://github.com/DNNDHH/PS5-3.20_Libs/tree/b2a77c09cd71c01f34c790cfbe98c751a13262ad
The guest socket layer relies on a few Linux calls:
- The equeue wait uses poll with the timeout rounded up to a millisecond;
macOS has no ppoll.
- A readable stream socket whose peer closed is reported with POLLHUP by
peeking one byte; macOS has no POLLRDHUP.
- FIONREAD on a datagram socket, and the byte count that fstat and kevent
report for it, is SO_NREAD, the size of the next datagram; macOS adds the
source address to FIONREAD.
- socketpair throws for SOCK_SEQPACKET, which has no AF_UNIX pair on macOS.
- gethostbyname replaces gethostbyname_r, which macOS lacks.
The UDP test sends on its connected socket without an address, as #7475
does, because macOS, like FreeBSD, fails sendto with an address on a
connected socket with EISCONN. The log test uses a datagram pair with
enlarged buffers instead of SOCK_SEQPACKET.
sscanf, vsscanf, sscanf_s and vsscanf_s threw on Linux for %ls, %lc, %l[, %S and %C, because glibc stores a 32-bit wchar_t per character into the guest's 16-bit buffer. ScanGuest, the per-directive scanner the _s forms already use, now scans those fields itself: the input is decoded as UTF-8, mirroring the narrow printf family's UTF-8 output, and each character is stored as one 16-bit unit, the width and the _s size counting characters; %ls skips leading white space and stops at the next, %l[ matches an ASCII scanset with ranges and negation, and a %lc field that meets the end of the input early keeps what it read, as FreeBSD's convert_wchar does. sscanf and vsscanf route a format with a wide conversion through ScanGuest and keep the host path otherwise. The UTF-8 decoding and scanset matching live in ScanWideField.cpp, which throws for input that is not UTF-8, a character outside the BMP, a scanset member outside ASCII and positional arguments next to a wide conversion; wide conversions in fscanf still throw.