Commit Graph

5577 Commits

Author SHA1 Message Date
Tyler Westerberg 2add25cea0 feat(agc-driver): replay a request as a prepared artifact with --prepare
agc_shader_replay compiles a request through Recompile, the per-draw path.
Shaders the driver prepares at registration go through PrepareShader
instead and produce a different, larger artifact, so a failure or the size
of that artifact could not be reproduced from the dumped request.
--prepare compiles the request with PrepareShader and prints the artifact's
SPIR-V size, or the first line of the failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:21:48 -04:00
Tyler Westerberg bad49ba2c4 feat(libSceVoiceQoS): export sceVoiceQoSSetConnectionAttribute
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:21:46 -04:00
Dean f9984863e6
Merge pull request #3600 from CouchRiv/fix-libc-fmod-errno
fix(libc): fmod leaves errno unchanged
2026-10-12 18:20:20 +13:00
Dean 5d7be6bdc8
Merge pull request #4003 from zmeizy/claude/memory-pool-batch-type-protect
fix(libkernel): apply the memory type in sceKernelMemoryPoolBatch typ…
2026-10-12 18:20:05 +13:00
Dean 0ed0d3c9b6
Merge pull request #4033 from MarcZX100/codex/carry-shader-wqm-live-quad-bit-2548
fix(shader): fold current s_wqm pixel lane
2026-10-12 18:19:43 +13:00
Dean abd73fbc0d
Merge pull request #4002 from zmeizy/claude/barrier-destroy-after-release
fix(libkernel): let pthread_barrier_destroy wait for released waiters
2026-10-12 18:19:21 +13:00
Diversao cd067d1569 fix(agc): release parked host imports a pinned guest range waits for
A device replaced at AttachWindow keeps its host imports in
HostImports::parked until it is destroyed, and each parked import keeps
its guest ranges pinned. A guest munmap, mprotect or free of such a range
spun in the pin waiter until APS5_PIN_WAIT_MS and then failed, because the
waiter only looked at the live imports. The replaced device was already
waited idle by PrepareForReplacement, so the waiter now drops the parked
imports over the range.

agc_parked_import_unmap imports a range on one device, again on a second
one, and unmaps it with a 3 s pin wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 02:00:48 -03:00
Aarav 6197edea2b fix(libkernel): report copied socket address lengths 2026-10-12 10:21:17 +05:30
BharatYadav007 f0e852ae27 fix(libc): normalize valid mktime minus-one results 2026-10-12 10:18:20 +05:30
fma-rc 9db923e907
fix(shader): clip primitives with an all-zero clip position 2026-10-12 06:46:34 +02:00
Dean 66ab8753bf
Merge pull request #3780 from MrMha/fix/unwind-record-bounds
fix(relinker): validate file-backed unwind record ranges
2026-10-12 17:35:37 +13:00
Dean 3eabeaaa81
Merge pull request #3754 from Amoenus/codex/test-app-info-child-result-maina11
test(libkernel): verify app info missing metadata errors
2026-10-12 17:35:16 +13:00
Dean 1a8fd39199
Merge pull request #3715 from Lorkydey/feat/libkernel-wait
feat(libkernel): implement wait through guest waitpid
2026-10-12 17:35:02 +13:00
Dean 7bcadb1e56
Merge pull request #3680 from droid2299/fix/libkernel-rusage-children
fix(libkernel): support RUSAGE_CHILDREN in getrusage
2026-10-12 17:34:48 +13:00
TibixDev 2441a4b0d9 fix(agc): retry failed host imports after range replacement
Retain weak identities and the full failed span so a replacement of either owner or a shorter remaining run retries the import. Keep unchanged failures cached across unrelated mapping changes without pinning their allocations. Existing upstream import lifetime, span windows and Windows fallback remain in place. AI-assisted implementation.
2026-10-12 07:34:15 +03:00
Dean 69138616c3
Merge pull request #3653 from QRMOE/fix-libc-strftime-literal-conversions
fix(libc): preserve strftime literal conversions
2026-10-12 17:34:15 +13:00
Dean a2c4176f7e
Merge pull request #3631 from arreina/pr/json-test-leak
test(json2): destroy the value before constructing over it
2026-10-12 17:34:01 +13:00
Dean 1d1acb1266
Merge pull request #3629 from QRMOE/fix-libc-dirname-result-length
fix(libc): check dirname result length
2026-10-12 17:33:41 +13:00
danzaio 56df893667 fix(agc): preserve dumps for non-standard shader failures
Capture the request once before rethrowing from the shared handler. Standard exceptions keep the shader address, stage, optional dump filename and full message; non-standard exceptions remain unchanged after capture.

AI-assisted: yes.
2026-10-12 01:33:37 -03:00
danzaio e71e3a4b3f fix(agc): name the shader address and stage in preparation failures
PrepareShaderWithDiagnostics dumped the request but rethrew the raw error, so a failure never said which shader it came from. Wrap it with the shader address and stage, keeping the dump. AI-assisted: yes.
2026-10-12 01:33:37 -03:00
danzaio 768929bb76 test(agc): preparation failures name the shader address and stage
FailureCapture now requires the code address and stage in the diagnosed failure, with and without the request dump. Fails before the wrap, passes after. AI-assisted: yes.
2026-10-12 01:33:37 -03:00
Dean bb67fe1a34
Merge pull request #3612 from karim200003/fix/libc-fgets-nonpositive-size
fix(libc): fail fgets with a size of 0 or less like FreeBSD
2026-10-12 17:33:20 +13:00
Dean e929880df4
Merge pull request #4008 from zmeizy/claude/getenv-invalid-name-errno
fix(libc): set EINVAL when getenv gets an invalid name
2026-10-12 17:33:03 +13:00
Dean 3fefe8a32f
Merge pull request #4010 from zmeizy/claude/getenv-stable-pointers
fix(libc): keep getenv results valid when other variables change
2026-10-12 17:32:42 +13:00
Dean 8b33507dc3
Merge pull request #4007 from zmeizy/claude/atexit-with-cxa-atexit
fix(libc): run atexit handlers in one order with __cxa_atexit destruc…
2026-10-12 17:32:21 +13:00
Dean fcb57611e4
Merge pull request #4221 from oneandonlydean/up4/in-place-index-highest-2
perf(agc): keep the highest index of a large in-place index buffer while it is unchanged
2026-10-12 17:32:00 +13:00
Dean 62bd3c9e68
Merge pull request #3841 from Kikoarl/feat/sysmodule-share-module-id
feat(libSceSysmodule): register libSceShare module ID (0x10F)
2026-10-12 17:31:46 +13:00
Dean 2da042eee0
Merge pull request #3933 from fma-rc/fix/system-service-language-param
fix(libSceSystemService): answer parameter 400 with the console language
2026-10-12 17:31:24 +13:00
Dean eb91f4e860
Merge pull request #4049 from Mouhand-Kaddo/fix/demons-readonly-resummarize
fix(agc): handle Demon's Souls read-only depth resummarize
2026-10-12 17:30:54 +13:00
Dean 6d1cee6d3f
Merge pull request #3593 from ahir061/fix/recompiler-prime-shared-mutex
fix(shader): lock recompiler shared mutexes once when created
2026-10-12 17:30:28 +13:00
Dean c22957f7b0
Merge pull request #3951 from Scramblrrrr/codex/constant-phi-definitions-current-main
fix(shader): preserve distinct SSA definitions when folding Phi inputs
2026-10-12 17:30:04 +13:00
Dean 32cb3fea95
Merge pull request #3932 from CouchRiv/fix-shader-f16-denorm-flush-family
fix(shader): flush f16 denormals in unary, frexp and conversion ops per the float mode
2026-10-12 17:29:43 +13:00
Dean 6b0ce1513d
Merge pull request #4018 from Mouhand-Kaddo/fix/demons-loop-continue
fix(shader): keep Demon's Souls loop shader valid after optimization
2026-10-12 17:29:21 +13:00
Dean 991378066e
Merge pull request #3661 from Celegans12/fix/agc-own-resolved-dispatch-state
fix(agc): own resolved dispatch state through thread exit
2026-10-12 17:29:00 +13:00
Dean 35ef0b7377
Merge pull request #3937 from hansjm10/fix/libkernel-munmap-unmapped
fix(libkernel): let munmap succeed over a range with nothing mapped
2026-10-12 17:28:36 +13:00
Dean 5aa0e15a4f
Merge pull request #3867 from tv7/fix/videoout-attribute-change-pending-flip
fix(videoout): accept a buffer attribute change while a flip is pending
2026-10-12 17:28:15 +13:00
Dean 18af217211
Merge pull request #3645 from alfalfa-star/fix/recompiler-mesh-grid-size-sgpr
fix(recompiler): read NumWorkgroups in every mesh shader so RADV sizes its user data
2026-10-12 17:27:54 +13:00
Ondra97 1e429dc23f test(libs): cover watched recvfrom sender outputs 2026-10-12 06:10:09 +02:00
eljackjoestar-cmd 9873fae1ef perf(libkernel): commit Windows direct backing when mapped 2026-10-12 07:59:34 +04:00
poonasor c6f934a3d0 fix(relinker): move a short guest TLS access's follower branch into its stub
A short fs-prefixed TLS access is patched with a 5-byte jump by
relocating the following instructions into the stub, but any branch
there was rejected outright. NHL 27 hits this on every stack-protector
epilogue: fs:xor rax,[rbx] immediately followed by jne __stack_chk_fail.

Allow relative conditional branches and short jumps: re-encode rel8
forms as their rel32 equivalents, rebase the displacement when the
stub is emitted, and keep rejecting loop/jrcxz, calls, returns, and
segment-prefixed followers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 23:44:54 -04:00
authurtabo-byte 605741d39f fix(agc): key GPL libraries by sample-location enablement 2026-10-11 20:43:05 -07:00
Ondra97 8f33897275 fix(libs): allow socket receives into watched guest memory 2026-10-12 05:37:35 +02:00
authurtabo-byte fb7615e307 fix(agc): key GPL libraries by custom sample locations 2026-10-11 20:36:04 -07:00
Michon 33efe5ac5d fix(agc): the standard 8x pattern's last sample is at (7, -7)
Vulkan's standard 8x sample 7 is (0.9375, 0.0625), (7, -7) in signed sixteenths; the table had (7, -8), so the
standard pattern (PPSA99902's PA_SC_AA_SAMPLE_LOCS words 0xbd153fd1 / 0x9773f95b) was refused as nonstandard.
Regression row with those words.

Reported by @Amoenus.

Co-Authored-By: Amoenus <5391396+Amoenus@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 9a1a0672cac0f8e3dcaa6e28cbe6b7b684a40a1f)
2026-10-11 20:36:04 -07:00
authurtabo-byte 9bc72d105e fix(agc): preserve graphics behavior after rebase
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-10-11 20:36:04 -07:00
authurtabo-byte e28dcc0c12 fix(agc): validate custom sample location depth formats 2026-10-11 20:36:04 -07:00
authurtabo-byte c9e48e5ae2 feat(agc): support uniform custom MSAA sample locations 2026-10-11 20:36:04 -07:00
ducloc080202 2cf929db08 fix(libkernel): record AmmModifyMtypeProtect and AmmRemapIntoPrt commands 2026-10-12 10:33:45 +07:00
Nithishvelan M bc71f97667 fix(libkernel): return after NotImplemented in Windows shm_unlink 2026-10-12 09:03:06 +05:30
Dextroid17 ef3b121e44 fix(libSceAmpr): export sceAmprAmmSetPageTablePoolOccupancyNotificationThreshold
Resolves NID touqMEt6qXQ, the last import Trails in the Sky 2nd Chapter
(PPSA35169) is left missing on libSceAmpr.prx once the libkernel pair in #4214
is recorded. No reference describes the function's contract, so it throws via
the project's NotImplemented_nid_no_patch pattern rather than guessing a result
that a caller would act on.

sceAmprAmmGetUsageStatsData (KqiWXLgCVe0) is deliberately not included: #3814
exports it and #4207 answers it from a cited layout.

See issue #4214.
2026-10-11 23:23:44 -04:00
Dean d146ec1b66
Merge pull request #3640 from MarcZX100/feat/libc-math-predicate-exports-3624
feat(libc): export isnanf and __signbitl
2026-10-12 16:12:58 +13:00
Dean a18b088d39
Merge pull request #4005 from zmeizy/claude/posix-deadline-overflow
fix(libkernel): clamp POSIX deadlines beyond the clock range instead …
2026-10-12 16:12:38 +13:00
Dean 5a59d4e257
Merge pull request #3979 from zmeizy/claude/sema-remaining-timeout
fix(libkernel): report the remaining time from sceKernelWaitSema
2026-10-12 16:12:08 +13:00
Dean d2d4c07aab
Merge pull request #3978 from zmeizy/claude/asprintf-guest-wide
fix(libc): format 16-bit wide arguments in asprintf on Linux
2026-10-12 16:11:47 +13:00
Dean 1470522ff3
Merge pull request #3964 from MarcZX100/codex/carry-nanosleep-rmtp
fix(libkernel): leave remaining time untouched when nanosleep completes
2026-10-12 16:11:26 +13:00
Feuris d119945a45 fix(libc): allocate from realloc(NULL, 0) as malloc(0) does
realloc(NULL, 0) returned NULL without allocating anything, while malloc(0) returns a unique pointer. C11 7.22.3.5p3 says realloc with a null pointer behaves like malloc for the specified size, so code that grows an empty buffer from zero elements (p = realloc(p, n * size) with n == 0) and treats NULL as out of memory failed on its first call.

FreeBSD 11.4 never returns NULL from realloc for a zero size; je_realloc rounds the size up before choosing between resizing and allocating (contrib/jemalloc/src/jemalloc.c, je_realloc).

A null pointer with size 0 now reaches the allocator's realloc, which allocates as malloc(0) does. A non-null pointer with size 0 is still freed and NULL returned, as before.

Co-authored-by: milescoviello <kitslayer29@gmail.com>
2026-10-12 00:11:17 -03:00
Dean 9eb1486e39
Merge pull request #3957 from MarcZX100/codex/carry-recvfrom-stream
fix(libkernel): report no sender for stream recvfrom calls
2026-10-12 16:11:05 +13:00
Dean eb189f65d6
Merge pull request #3944 from hugodearaujo/fix/operation-mode-console
fix(libkernel): report the operation mode the console reports
2026-10-12 16:10:44 +13:00
Dean 5fe4bebec6
Merge pull request #3923 from AchrafReyani/fix/libkernel-close-ebadf
fix(libkernel): close an unopened descriptor on Windows without the invalid-parameter report
2026-10-12 16:10:27 +13:00
Dean c12cb634f1
Merge pull request #4249 from oneandonlydean/up4/fix-skip-messages
test(agc): word the tessellation and oversized dispatch skips as device limitations, as check_skips expects
2026-10-12 16:09:15 +13:00
Dean 4dfa8506b3
Merge pull request #1680 from emirplus/fix/savedata-memory-metadata
fix(savedata): recover from metadata setup failure
2026-10-12 16:08:53 +13:00
Dean 01e5f3b8a8
Merge pull request #3977 from hansjm10/fix/libscenet-sockaddr-len
fix(libSceNet): accept guest socket addresses whatever their sa_len
2026-10-12 16:08:32 +13:00
Dean f0674d3c08
Merge pull request #3968 from babyhuey/feat/libkernel_sys-openat
feat(libkernel_sys): implement openat
2026-10-12 16:08:11 +13:00
Dean f3abf38307
Merge pull request #3855 from Lorkydey/fix/libkernel-utc-dst-width
fix(libkernel): limit UTC-to-local DST output to 32 bits
2026-10-12 16:07:49 +13:00
Dean 26d87eec20
Merge pull request #3850 from SandstromPL/fix/relinker-module-dir-root
fix(relinker): accept the input's directory as a module directory
2026-10-12 16:07:27 +13:00
Dean f5ce5957c1
Merge pull request #3797 from YossiYad/carry/audioout-hdmi-monitor-info
feat(libSceAudioOut): implement sceAudioOutSysGetHdmiMonitorInfo
2026-10-12 16:07:06 +13:00
Gustavo Ariel Gamarra Rojas bff955a3e4 fix(agc): match any format when a storage dump shape names none 2026-10-11 23:55:12 -03:00
fablevoid c763a78b67 feat(relinker): split unaligned 256-bit stores for Rosetta
Rosetta 2 ends the process when an unaligned 256-bit store crosses into
a page the store may not write ("rosetta error: unexpectedly need to
EmulateForward on a synchronous exception") instead of raising the
fault. A store inside such a page, and a 128-bit store across one,
fault normally. The macOS write watch keeps watched pages read-only
between collections, so a guest that stores 32 bytes across the start
of a watched page ends the process.

--to-rosetta now lowers VMOVUPS, VMOVUPD and VMOVDQU with a 256-bit
memory destination to a stub that stores the low half with the same
instruction at VEX.L=0 and the high half with VEXTRACTF128 at the
operand plus 16, so each half faults like any other store. RIP-relative
operands are relocated from the instruction's place in the site. A
store whose upper half has no 32-bit displacement fails the conversion.
Aligned stores (VMOVAPS, VMOVAPD, VMOVDQA and the non-temporal forms)
cannot cross a page and are left alone.

Every store is lowered. A 4-byte store has no room for the jump to its
stub, so its stub also takes one neighbouring instruction. The
following one: a return ends the stub, a call pushes its original
return address and jumps, a jump or conditional branch is re-encoded
with a 32-bit displacement, and another 256-bit store is lowered in the
same stub. Otherwise the preceding one, unless it is a call, a jump, a
return or a trap. Register calls, LOOP, JRCXZ and branches with a
prefix that changes them do not move. When neither neighbour can move,
the store becomes a short jump to an island: a run of movable
instructions within reach is moved to its own stub, and the bytes it
frees hold the jump to the store's stub. A store with neither fails the
conversion.

The converter tests compare the halves with clang's encodings for base,
SIB, disp8 overflowing to disp32, disp32, RSP-relative, FS-absolute,
r13-based and RIP-relative operands, and check that aligned stores,
loads, register forms and masked stores are not split. They check the
stub of a short store followed by a return, a call (direct, with an
address-size prefix, and through a RIP-relative pointer), short, near
and RIP-relative jumps, short and near conditional branches and another
store; that a following register call, LOOP, JRCXZ, prefixed branch or
CLWB makes the store take the instruction before it; islands past
instructions already moved, a store that needs its own stub, a branch
target, a register call and the short-jump reach; and that a store with
no room fails.

PPSA12544: 55295 stores split in the executable, 278 of them in the
stub of the store before them; every module converts with none kept.

AI-assisted: yes
2026-10-12 02:48:33 +00:00
fma-rc e0eef6c57f
feat(pad): hold the sticks from the controller command file 2026-10-12 04:47:59 +02:00
Yassine 5959506bbd test(avplayer): link guest_avplayer with the shared runtime libraries
guest_avplayer_tests imports __cxa_throw from libc.prx, which is loaded
before libstdc++, but -static-libgcc gave it a private copy of
_Unwind_Resume. A failed Check threw through libc.prx's unwinder and the
landing pad of the test function resumed with the private one, so on
Linux every failure aborted in _Unwind_RaiseException_Phase2 instead of
printing its message from main. This is the unexplained Linux abort in
the intermittent guest_avplayer failures.

The test is now linked without the static runtime flags, as the AgcDriver,
Agc and VideoOut tests already are, so the unwinder comes from the same
library as __cxa_throw. A forced Check failure in TestPlayback aborted
before and now prints its message and exits with 1.

(cherry picked from commit fa5199cd8fef7f9c7ab9e83a441e15d16364a81d)
2026-10-12 02:47:43 +00:00
Dean 34a16b7f08
Merge pull request #4159 from MarcZX100/codex/fix-sampled-cache-fixture-4141
test(agc): keep sampled cache fixture registrations separate
2026-10-12 15:47:18 +13:00
Dean 2263cefe25
Merge pull request #3601 from Scramblrrrr/codex/legacy-sse-reciprocals
fix(relinker): lower legacy packed reciprocal register instructions
2026-10-12 15:43:20 +13:00
overlordxrz-source 4b378a251f feat(libSceRudp): implement sceRudpGetMaxSegmentSize 2026-10-11 22:43:17 -04:00
Dean 6253883dee
Merge pull request #3881 from gravelas/fix/libscejson2-object-find
feat(libSceJson2): implement Object::find, Object::iterator::operator-> and String::compare
2026-10-12 15:42:47 +13:00
Dean 438ee8a517
Merge pull request #3652 from orishamir/fix/pad-analog-triggers
fix(pad): keep partial L2/R2 values from a controller
2026-10-12 15:42:14 +13:00
Dean f49f95873c
Merge pull request #3969 from hugodearaujo/fix/user-age-level
fix(libSceUserService): report an unrestricted age level
2026-10-12 15:34:36 +13:00
Dean d1758a91c8
Merge pull request #3494 from babyhuey/carry/pthread-attr-scope-3377
feat(libkernel): implement pthread_attr_getscope, setscope, getinheritsched and getstackaddr
2026-10-12 15:33:56 +13:00
Dean c2fdb9c71c
Merge pull request #2902 from oneandonlydean/carry/libkernel-sysctl-sdk-version
feat(libkernel): support kern.sdk_version in sysctlbyname
2026-10-12 15:33:29 +13:00
Scramblrrrr 29a843579d test(memory): query host holes beside warm collect memos 2026-10-11 23:27:02 -03:00
Dean Galvin 572e9d9f78 test(agc): word the tessellation and oversized dispatch skips as device limitations, as check_skips expects 2026-10-12 15:06:12 +13:00
Achraf Reyani 6b2432875d fix(agc): accept a linear 2D texture whose DEPTH holds its default pitch
On GFX10.3 the DEPTH field of a 1D or 2D non-array linear T# carries the
row pitch minus one (Mesa's ac_descriptors.c sets it for custom pitches,
which must be multiples of 256 bytes). A single-level, uncompressed 2D
linear texture whose DEPTH equals its default 256-byte-aligned pitch now
decodes as that 2D texture; any other pitch still throws.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 11:04:50 +09:00
Dean Galvin 20b801b7e8 test(agc): report the packed f16 native skip as a device limitation, as check_skips expects 2026-10-12 14:51:21 +13:00
ArjenS-LA b41c0b3da9 fix(libkernel): reject oversized Windows directory entry names
(cherry picked from commit b0e0c1c4bfd1487047873663115a94a46987b831)
2026-10-12 01:51:01 +00:00
milescoviello 589de27c17 fix(libc): accept the fdopen modes FreeBSD accepts
fdopen only took a fixed list of 15 mode strings and failed with EINVAL
for any other, so "rt", "r+t", "re", "rbe" or "rw" gave NULL. FreeBSD's
fdopen parses the mode with __sflags (lib/libc/stdio/flags.c): after
r, w or a it takes b, +, x, e and v and stops at the first other
character ("default: known = 0;"), and only a bad first character or x
on a read-only mode fail with EINVAL. fopen and freopen already parse
modes this way through ParseFileMode (#2033).

fdopen now uses ParseFileMode as well and passes the host its normalised
mode without x, which FreeBSD's fdopen ignores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:50:11 +00:00
milescoviello 30d1e85283 fix(libScePosixForWebKit): use FreeBSD's gai_strerror message texts
gai_strerror returned its own wording for most codes, so a resolver
failure was described with text FreeBSD's libc does not use: EAI_NONAME
(8) gave "Name or service not known" instead of "hostname nor servname
provided, or not known", EAI_BADFLAGS (3) "Invalid flags" instead of
"Invalid value for ai_flags", and an unknown code "Unknown address
resolution error" instead of "Unknown error". Twelve of the fifteen
texts differed.

FreeBSD 11.4, lib/libc/net/gai_strerror.c:

	static const char *ai_errlist[] = {
		"Success",					/* 0 */
		"Address family for hostname not supported",	/* 1 */
		"Temporary failure in name resolution",		/* EAI_AGAIN */
		"Invalid value for ai_flags",			/* EAI_BADFLAGS */
		"Non-recoverable failure in name resolution",	/* EAI_FAIL */
		"ai_family not supported",			/* EAI_FAMILY */
		"Memory allocation failure", 			/* EAI_MEMORY */
		"No address associated with hostname",		/* 7 */
		"hostname nor servname provided, or not known",	/* EAI_NONAME */
		"servname not supported for ai_socktype",	/* EAI_SERVICE */
		"ai_socktype not supported", 			/* EAI_SOCKTYPE */
		"System error returned in errno", 		/* EAI_SYSTEM */
		"Invalid value for hints",			/* EAI_BADHINTS */
		"Resolved protocol is unknown",			/* EAI_PROTOCOL */
		"Argument buffer overflow"			/* EAI_OVERFLOW */
	};
	...
	if (ecode >= 0 && ecode < EAI_MAX)
		return ai_errlist[ecode];
	return "Unknown error";

The table and the unknown-code text now match, as 5830d8e44 did for
strerror.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:49:40 +00:00
milescoviello cba3b5a8b3 fix(libkernel): accept SOCK_NONBLOCK and SOCK_CLOEXEC in socket
socket only took a type of exactly SOCK_STREAM or SOCK_DGRAM, so a type
with SOCK_NONBLOCK (0x20000000) or SOCK_CLOEXEC (0x10000000) set failed
with EPROTONOSUPPORT, although socketpair already accepted both.

FreeBSD strips both flags before creating the socket (sys/kern/
uipc_syscalls.c, kern_socket: "if ((type & SOCK_CLOEXEC) != 0) { type
&= ~SOCK_CLOEXEC; oflag |= O_CLOEXEC; }" and the same for SOCK_NONBLOCK
with FNONBLOCK), and makes the new socket non-blocking with
"fo_ioctl(fp, FIONBIO, &fflag, ...)".

socket now does the same as socketpair: it creates the socket from the
plain type and, with SOCK_NONBLOCK, switches it to non-blocking.
SOCK_CLOEXEC needs nothing more, since a guest never executes another
program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:48:40 +00:00
milescoviello 910363657d fix(libc): count the whole string in mbstowcs with a null destination
mbstowcs, and libSceAmpr's copy of it, counted at most n characters
when the destination was NULL, so the usual sizing call
mbstowcs(NULL, s, 0) returned 0 and mbstowcs(NULL, s, 1) returned 1 for
a three-character string. A caller that sizes its buffer that way got a
buffer too small for the string and no terminator.

POSIX says that with a null pwcs mbstowcs "shall return the length
required to convert the entire array regardless of the value of n", and
FreeBSD does that: lib/libc/locale/mbstowcs.c passes SIZE_T_MAX as the
source limit, and the C locale's _none_mbsnrtowcs (none.c) returns the
distance to the terminating NUL when "dst == NULL".

With a null destination, SonyMbstowcs now returns the length of the
whole string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 01:47:11 +00:00
Dean d371ed3076
Merge pull request #4200 from winstrex/fix/host-entropy
fix(libs): take guest entropy from the host OS instead of std::random_device
2026-10-12 14:42:53 +13:00
Dean 695b8e552c
Merge pull request #4169 from oneandonlydean/up4/fix-mprotect-stack-bound
fix(libkernel): reject mprotect of host memory that is not a guest thread stack
2026-10-12 14:41:35 +13:00
Dean d0ca839cc9
Merge pull request #4057 from jweidenh/codex/vector-window-stage-inputs
fix(recompiler): include implicit inputs in relative vector windows
2026-10-12 14:30:23 +13:00
Nixitov 7d9966a8ee feat(libc): implement __divti3
Kart PS5 (PPSA99611) imports __divti3 and stops at start-up on main. The guest has no signed 128-bit division; add it alongside __udivti3, dividing the magnitudes and negating the quotient, and throwing on a zero divisor like the unsigned routine.
2026-10-12 03:22:38 +02:00
pallp 4b125c0ca5 fix(savedata): fill the search infos of sceSaveDataDirNameSearch
SaveDataDirNameSearchResult.infos points at an array the title reads one
entry per returned directory name, but the search never wrote it, and
SaveDataSearchInfo was declared as 128 opaque bytes. A title that asks for
the infos read whatever its buffer held.

SaveDataSearchInfo is now the 48-byte record shadPS4 declares as
OrbisSaveDataSearchInfo (blocks, free blocks, 32 reserved bytes), and the
search fills one per returned name. Every native save reports
SAVE_DATA_BLOCKS_MAX blocks, as sceSaveDataGetMountInfo and the block sort
keys already assume, so both counts are SAVE_DATA_BLOCKS_MAX and the
reserved bytes are zero.

guest_savedata_search_tests checks the two records, their zero reserved
bytes and that the search writes nothing past them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VFVE5WbaUJ2vyj8NAW44CS
2026-10-12 02:18:33 +01:00
Scramblrrrr b45232dda6 test(memory): handle Windows layouts without arena host holes 2026-10-11 22:18:20 -03:00
fma-rc b843b16a0a
fix(libSceSystemService): answer parameter 400 with the console language 2026-10-12 03:18:00 +02:00
Nesyth d9fbaf767c fix(agc): accept a CB metadata pass beside depth state without depth or stencil planes 2026-10-12 03:14:12 +02:00
saxopa cded9ba8c3 fix(relinker): accept RELATIVE relocations against a zero-value section symbol
OpenOrbis create-fself adds one to the symbol index of every relocation it
copies from .rela.dyn, so each R_X86_64_RELATIVE entry of a homebrew built
with the OpenOrbis toolchain names symbol 1, a local STT_SECTION symbol with
value 0. FreeBSD rtld computes RELATIVE as base + addend without reading the
symbol. The pipeline, the code analysis and the strict filter now accept
index 0 or a STT_SECTION symbol with value 0, and still throw for any other
symbol. The relocation is written with symbol index 0, where the pipeline
previously dropped RELATIVE entries with a nonzero index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 03:12:02 +02:00
winstrex 8f9efc25f2 fix(libs): take guest entropy from the host OS instead of std::random_device
std::random_device in libstdc++ reads RDSEED on x86 Linux. On an AMD
EPYC 9V45 (Zen 5) CI runner its 32-bit results repeat about 130 times
in 65536 draws, so guest_posix_random fails. libc now exports
HostEntropy_nid_no_patch, which uses getentropy (rand_s on Windows) and
throws when the OS cannot provide entropy. arc4random, arc4random_buf,
sceRandomGetRandomNumber, /dev/random and /dev/urandom reads,
std::_Random_device and sceKernelUuidCreate use it, and the arc4random
and random device TechnicalDebt entries say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 22:07:49 -03:00
Dean Galvin 8938a257f2 test(agc): read lane 63 of the vertex index in the registered workgroup fixture
The fixture read lane 63 of v0, which the program never writes. Since #3546 a wave64 vertex program on a narrower host subgroup builds that read as 0, so the synchronous registration the test expects to fail succeeds. v5 holds the vertex index, which is not 0 in lanes 32-63, so the read still throws.
2026-10-12 13:44:23 +13:00
screamm 1b4baaee27 fix(memory): exclude arena host holes from every write-tracking query
On Windows agc_write_tracking has failed since #3594 with

    write tracking test failed: an unwatched range reads as not stored over

from the check in CheckSharedBlock:

    if (!Watched(outside, unwatched.size())) Require(StoredOver(outside, unwatched.size(), TrackerGeneration()), "an unwatched range reads as not stored over");

The host stack array lies in a host hole of the guest arena. #3594 made
Watched, collectWrites, UnchangedSince, UnchangedSinceAll and storeOwn
reject ranges overlapping such holes, but StoredOver, MarkWritten,
WrittenSince, ChangedBlocks and ImportWatched still accepted them through
WriteTracker::covers(), so StoredOver proved a range not stored over while
Watched called it unwatched (#4087).

The exclusion now lives in WriteTracker::covers() on Windows, which every
query already asks, and the per-function checks are removed. Host holes
are padded to the allocation granularity and the tracker blocks are 64 KiB
from the arena base, so no block is shared between a hole and arena
memory, and ranges outside the holes get the same answers as before.

A new case enumerates the arena for a host hole and checks every query
against it; on the previous code StoredOver, MarkWritten, StoreOwnBytes,
WrittenSince and ChangedBlocks fail it.

Fixes #4087

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-11 21:36:46 -03:00
Scramblrrrr ef218ef928 test(agc): distinguish GPU depth from reused storage bytes 2026-10-11 21:29:59 -03:00
Scramblrrrr b9b83cef2b style(graphics): follow the code comment convention 2026-10-11 21:29:25 -03:00
Scramblrrrr 4de5726d32 fix(graphics): distinguish reused memory from depth storage aliases 2026-10-11 21:29:25 -03:00
Archit Dewan 5eb22de16d fix(relinker): reject empty positional paths 2026-10-11 20:28:56 -04:00
MarcZX100 c87c8c229b test(agc): keep sampled cache fixture registrations separate 2026-10-12 00:12:50 +00:00
hugodearaujo 0b7e4ddf9f fix(libkernel): join the calling thread and create from an unset attribute as the console does
On a PS5 (firmware 13.60) scePthreadJoin on the calling thread returns
EDEADLK and scePthreadCreate with a zeroed attribute creates a thread
with the default attributes. Here both threw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:09:08 -03:00
Celegans12 364d7cf29f fix(shader): match half-wave reductions over relatively addressed vector registers
A program that uses v_movrels_b32 or v_movreld_b32 keeps every vector
register from the lowest relatively addressed one up in a per-invocation
window array, so its plain register accesses become LoadVectorWindow and
StoreVectorWindow. The half-wave reduction matcher followed only SSA values,
so a wave64 scan, v_permlanex16_b32 join and lane 31/63 read through that
array threw that lane 63 is outside the 32-lane host subgroup.

The matcher now reads a window load at a constant slot as the value of the
last store to that slot earlier in its block, unless a store at a runtime
slot lies in between; each invocation owns its array, so that is the value
the load returns. A store in another block, or a v_movreld_b32 at a runtime
M0 in between, still throws. This was the only refused lane 32-63 read left
among Ghost of Yotei's wave64 graphics programs (one pixel program).
2026-10-12 02:07:50 +02:00
hugodearaujo b9b5bcc190 fix(libkernel): return the console's errors from the SCE mutex calls
On a PS5 (firmware 13.60) the SCE mutex attribute calls return EINVAL
for a null or uninitialized attribute, scePthreadMutexattrSetprotocol
accepts 0 to 2, scePthreadMutexInit takes an uninitialized attribute as
the default one, and destroying a destroyed mutex returns EINVAL. Here
these threw, including for the priority protection protocol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:06:55 -03:00
Avijit Singh fc7a9650f9 style(agc): remove unnecessary shutdown explanation
Keep the tracker initialization fix without an explanatory code comment or technical-debt entry, as requested in review.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-12 05:32:09 +05:30
hugodearaujo 2446a2648a fix(libkernel): return the console's errors from the scePthreadAttr calls
On a PS5 (firmware 13.60) the scePthreadAttr setters and getters return
EINVAL for a null or uninitialized attribute and for a null output,
ENOTSUP for a policy other than SCHED_FIFO and SCHED_RR, an inheritance
other than explicit and inherit, and a priority outside 256 to 767, and
EINVAL for an invalid detach state. Here they threw, or stored any
policy, inheritance and priority.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:59:17 -03:00
eljackjoestar-cmd fded8a7e7f fix(shader): prove masked writes through guarded first-lane reads 2026-10-12 03:57:04 +04:00
Dean Galvin 5b1868d23d fix(libkernel): reject mprotect of host memory that is not a guest thread stack
The Windows path from #3788 changed the protection of any committed private host region outside the guest registry, including a range crossing a guest stack's lower bound. Ranges inside a live guest thread stack keep the path from #2982.
2026-10-12 12:50:24 +13:00
lorkydey f88be06af2 fix(libkernel): resolve getlogin_r from the effective host account 2026-10-12 01:39:07 +02:00
lorkydey a4502cd4bd feat(libkernel): implement getlogin_r using the host login name 2026-10-12 01:39:07 +02:00
Dean Galvin 5864ee5839 fix(agc): report arena host holes as stored over on Windows
StoredOver still read block stamps for a range in a host region inside the guest arena interval, which Watched reports as unwatched since #3594.
2026-10-12 12:38:06 +13:00
xXPBSXx 2a7b38ab75 fix(libSceAgc): write the KytyPS5 workload packets and return null for unregistered streams
sceAgcDcbSetWorkloadsActive writes an 18-dword IT_NOP packet (stream id, 64-bit workload mask) and sceAgcDcbSetWorkloadComplete a 12-dword one (stream id, workload id, 64-bit clear mask), following KytyPS5. Both return null for a null buffer, an unregistered or out-of-range stream, a workload id above 63, and for active a duplicate id or a count of 0 or above 63. sceAgcDriverRegisterWorkloadStream and sceAgcDriverUnregisterWorkloadStream now record the stream ids the DCB calls check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 01:37:56 +02:00
Claude c35d05395d
fix(libc): reject 16-bit wide conversions in sscanf_s and after the ' flag on Linux
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ha6Tsy62AFUyp9a5Mf7vjA
2026-10-11 23:37:17 +00:00
xXPBSXx 45fcf734ab fix(libSceAgc): emit NOP packets for the DCB workload calls
sceAgcDcbSetWorkloadsActive and sceAgcDcbSetWorkloadComplete threw. They now write a plain two-dword NOP and keep no workload state.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 01:36:51 +02:00
hugodearaujo 78abb2b46a fix(libSceUserService): report the console's default accessibility settings
On a PS5 (firmware 13.60) a user with every accessibility setting at
its default reads chat transcription 0, press-and-hold delay 0, trigger
effect 1, vibration 1, zoom 0 and zoom follow focus 1; all six read 0
here. A user who is not logged in returns 0x80960009 with or without an
output, as sceUserServiceGetAgeLevel does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:35:58 -03:00
PrintOrb 4680a52c1e fix(libkernel): return positioned descriptor errors without CRT reports 2026-10-11 18:35:17 -05:00
Simon 2fd05f47e2 feat(libSceNpWebApi2): export sceNpWebApi2AddWebTraceTag
PPSA33016 imports sceNpWebApi2AddWebTraceTag (NID MgsTa76wlEk), and no
library exported it, so the loader stopped before the title started.
The title does not call it at start-up or in play, so the export throws
like the other unimplemented functions.
2026-10-12 01:30:54 +02:00
Dean bca7a29d25
Merge pull request #4021 from Mouhand-Kaddo/fix/windows-select-host-poll
fix(libkernel): restore Windows select build for Demons Souls testing
2026-10-12 12:30:30 +13:00
jdmagic d5805fb3e4 fix(libkernel): setsockopt sets options of libSceNet sockets
A title creating a socket with sceNetSocket sets its options with the BSD
setsockopt, which looked the descriptor up only among libkernel's own
sockets and returned EBADF. libSceNet now registers an option setter with
libkernel, as it does for close and select, and accepts SO_REUSEADDR,
SO_BROADCAST, SO_SNDBUF and SO_RCVBUF like libkernel's own sockets.

PPSA01289 (Sackboy: A Big Adventure) sets SO_BROADCAST on its UDP P2P
socket this way in UIpNetDriver::InitBase. The failure made every listen
fail, and the engine travelled back to its default map with ?closed,
reloading it about every two seconds behind the loading screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:23:24 -04:00
jdmagic 5d14cd02ff fix(libSceNet): failures also set libkernel's errno
libSceNet stored its errno only in its own slot (sceNetErrnoLoc). Titles
that use the BSD socket model read errno after a libSceNet call, as the
console's libSceNet calls are kernel calls that set it; shadPS4 mirrors its
net errno into the kernel errno the same way (SetKernelErrnoHook).

PPSA01289 (Sackboy: A Big Adventure) reads errno through Unreal's
GetLastErrorCode after sceNetRecvfrom. It never saw EWOULDBLOCK, so
UIpNetDriver::TickDispatch kept receiving and the game thread never left
its first networked frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:23:24 -04:00
jdmagic 12b18af550 fix(libkernel): close() closes libSceNet sockets
A libSceNet socket is a kernel descriptor on the console, so titles close it
with close(). libSceNet keeps its sockets in its own table, and libkernel's
close passed their numbers to the CRT, which reported an invalid parameter
and left the socket open. libSceNet now registers a closer with libkernel,
as it registers its poller for select. PPSA01289 (Sackboy: A Big Adventure)
closes its P2P socket this way each time it tears its network session down,
leaking one open socket per attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:23:24 -04:00
jdmagic 22827bf6ad fix(libSceNet): sceNetEpollControl takes 2 as MOD and 3 as DEL
sceNetEpollControl used Linux's EPOLL_CTL numbering (1 ADD, 2 DEL, 3 MOD).
The SCE values are 1 ADD, 2 MOD, 3 DEL (shadPS4 net_types.h,
ORBIS_NET_EPOLL_CTL_*). A title removing a socket with op 3 and a null
event got EINVAL, and op 2 deleted the registration it meant to modify.
PPSA01289 (Sackboy: A Big Adventure) removes its UDP socket from its epoll
this way before closing it, every time its network session is torn down.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:23:23 -04:00
jweidenh 5ec6cff3fa fix(recompiler): include implicit inputs in relative vector windows 2026-10-11 19:23:00 -04:00
jweidenh e4575c723e test(recompiler): keep vector window fixtures observable 2026-10-11 19:23:00 -04:00
jweidenh c0c86deeb8 test(recompiler): cover implicit inputs in relative vector windows 2026-10-11 19:23:00 -04:00
xXPBSXx 35a6df818f Merge remote-tracking branch 'upstream/main' into fix/export-ppsa30601-imports
# Conflicts:
#	core/libs/prx/libSceJson2/Export.cpp
#	docs/dev/TechnicalDebt.md
2026-10-12 01:19:36 +02:00
xXPBSXx 50ca599251 Merge remote-tracking branch 'upstream/main' into fix/ces-cp1251-profile
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-12 01:17:20 +02:00
hugodearaujo 802ec551c2 fix(libSceUserService): answer sceUserServiceGetUserName as the console does
On a PS5 (firmware 13.60) a null name returns INVALID_ARGUMENT first,
then a user id the console does not know returns 0x80960105 whatever
the buffer, and a buffer shorter than 17 bytes is zeroed before
BUFFER_TOO_SHORT is returned. Here an unknown user returned
INVALID_ARGUMENT and a short buffer was left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:12:43 -03:00
virp-mta 8b04156bfd fix(libkernel): return EDESTADDRREQ for send and sendto on unconnected UDP sockets 2026-10-12 03:12:34 +04:00
Yunus Shaikh 1b009e1879 fix(libc): subtract negative times in difftime on Windows
difftime and libc_difftime passed their arguments to the host CRT.
UCRT's _difftime64 returns 0 and sets errno to EINVAL when either
argument is negative (common_difftime in ucrt/time/difftime.cpp), so
on Windows difftime(0, -1) returned 0 instead of 1 and every
difference involving a time before 1970 was 0. C17 7.27.2.2 defines
the result as time1 - time0, and FreeBSD 11's difftime
(contrib/tzcode/stdtime/difftime.c) and glibc on the Linux build
compute it for any arguments.

Subtract the smaller time from the larger as uint64_t, which cannot
overflow, convert the difference to double and negate it when time1
is the smaller one, as FreeBSD and glibc's fallback path do. The
result is time1 - time0 rounded once to double on both hosts.
difftime now forwards to libc_difftime like the other aliases in the
file.
2026-10-11 16:12:25 -07:00
Yunus Shaikh 7cc5698094 fix(libc): format years before 1900 in asctime on Windows
asctime passed the guest tm to the host CRT. UCRT's asctime returns
null and sets errno to EINVAL when tm_year is negative or tm_mday is
past the end of the month (common_asctime_s in ucrt/time/asctime.cpp),
so on Windows asctime of any time in the years 1000 to 1899, which
gmtime converts, or of February 29 in a common year returned null.
C17 7.27.3.1 defines the text for every year from 1000 to 9999 when
each member is in its normal range (tm_mday 1 to 31), and glibc on
the Linux build and FreeBSD 11's asctime
(contrib/tzcode/stdtime/asctime.c) print it.

Format the text with the C17 algorithm's format into a thread-local
buffer that fits any member values. As in glibc and FreeBSD, a
weekday or month outside its range is printed as ???, and the year is
computed in 64 bits.
2026-10-11 16:08:53 -07:00
Adrià bab7b32852
Merge pull request #3772 from MrMha/perf/relinker-call-index
perf(relinker): use a flat sorted call-site index
2026-10-12 01:05:45 +02:00
Yunus Shaikh 433bf1ebc2 fix(libc): map _Towctrans descriptors 1 and 2 to lower and upper case
_Towctrans passed the guest's descriptor to the host towctrans.
Dinkumware's <wctype.h> (xwcc.h) defines towlower(wc) as
_Towctrans(wc, 1) and towupper(wc) as _Towctrans(wc, 2), the values
FreeBSD's wctrans.c also uses for "tolower" and "toupper". UCRT reads
1 as toupper and other nonzero values as tolower, so on Windows
towlower(L'A') returned L'A' and towupper(L'a') returned L'a', while
towlower(L'a') returned L'A'. The host wint_t is 16 bits there, which
also turned WEOF into 0xffff. glibc's wctrans_t is a pointer to a
table that towctrans reads, so on Linux descriptor 1 or 2 is
dereferenced as an address.

_Towctrans now takes the guest's 32-bit wint_t and size_t descriptor.
1 and 2 map 0..255 through the C locale tables behind _Getptolower and
_Getptoupper and return other values unchanged. Any other descriptor
sets errno to EINVAL and returns wc unchanged, as FreeBSD's
towctrans_l does.
2026-10-11 16:05:26 -07:00
jweidenh 72d5b8ce90 fix(relinker): ignore no-op relocations in guest modules 2026-10-11 19:02:06 -04:00
Yunus Shaikh f7a85491ef fix(libSceNet): report EAGAIN when a datagram receive times out on Windows
With SO_RCVTIMEO set, Winsock fails a receive that waits that long with
WSAETIMEDOUT, which native_error turned into ETIMEDOUT (60). sceNetRecv,
sceNetRecvfrom and sceNetRecvmsg on a datagram socket therefore failed
with 0x8041013C on Windows, where FreeBSD's sbwait returns EWOULDBLOCK
(35) to soreceive, Linux returns EAGAIN, and POSIX (XSH 2.10.16)
requires EAGAIN or EWOULDBLOCK when no data was received.

A datagram socket has no connection that can time out, so WSAETIMEDOUT
there only means that the receive timeout the guest set has expired:
report EAGAIN. Stream sockets keep ETIMEDOUT, since Winsock leaves a
connection in an indeterminate state after a timeout; TechnicalDebt
records that gap and the one for SO_SNDTIMEO.
2026-10-11 16:01:51 -07:00
hugodearaujo 65b6a4729b fix(libkernel): accept only the solo scheduling values the console accepts
On a PS5 (firmware 13.60) scePthreadAttrSetsolosched and
pthread_attr_setsolosched_np accept only 0 and 16; every other value
returns ENOTSUP and keeps the stored one. The SCE set and get calls
return EINVAL for a null or uninitialized attribute instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 20:01:44 -03:00
Gustavo Ariel Gamarra Rojas a70ec3946d feat(agc): store the dumped storage images at each flip
An image whose results stay on the GPU is never written back, so
APS5_DUMP_STORAGE saw nothing; APS5_STORE_AT_FLIP=1 stores every pending
image and ran a 4 GB device out of memory at 3840x2160. The selected
images alone are now stored at each flip.
2026-10-11 19:59:42 -03:00
Gustavo Ariel Gamarra Rojas f2d6986741 feat(agc): select storage dumps by shape and dump every layer
APS5_DUMP_STORAGE also takes <width>x<height>x<layers>[:<format>], for
images whose address changes from run to run (a title's 32x32x32
color-grading LUT), and the dump holds the first mip of every layer or
3D slice instead of the first one only.
2026-10-11 19:59:35 -03:00
Yunus Shaikh 0245ba7d88 fix(libc): open fopen streams with delete sharing on Windows
fopen opened its stream with _wfopen, which shares read and write
access but not delete access. While the guest held a stream open,
rename of its file failed with EIO and remove with EBUSY. POSIX rename
and remove work on open files, as on Linux and FreeBSD, and since
#3677 the descriptors sceKernelOpen returns share delete access.

fopen now creates the handle with CreateFileW sharing read, write and
delete, with the access and creation disposition of the mode, and
wraps it with _open_osfhandle and _wfdopen, keeping append mode. A
failed CreateFileW sets errno through the error mapping #3677 added to
libkernel's NativeOpen, which moves to libc as
WindowsOpenError_nid_no_patch so that both use it. freopen still
reopens through _wfreopen; TechnicalDebt records it.
2026-10-11 15:56:20 -07:00
pushkarreddyy 726e773417 feat(libkernel): support kern.sdk_version in sysctlbyname 2026-10-12 11:53:41 +13:00
Alex de54527a8b fix(shader): keep f32 denormals in compares when denormals are kept
With the f32 denormal field of FLOAT_MODE set to keep, v_cmp_X_f32 and
v_cmpx_X_f32 read a denormal operand as zero: NVIDIA, RADV and lavapipe
all flush denormals in their float compares. Compare the operands as
sign-magnitude integers instead, with NaN handled apart. Compares with
flushed denormals are unchanged. This matches RDNA2 (gfx1036) on 256
operand pairs per opcode, with f32 denormals kept and flushed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 18:51:37 -04:00
jweidenh ecd4e90628 fix(libc): preserve the guest ABI for array callbacks 2026-10-11 18:51:28 -04:00
Adrià 325e0a8bdd
Merge pull request #3741 from jweidenh/codex/optimized-pipeline-readback
test(agc): verify graphics output after optimized pipeline binding
2026-10-12 00:50:45 +02:00
Adrià 22cecd5aac
Merge pull request #3779 from pushkarreddyy/feat/libkernel-sysctl-pathname-hw-physmem
feat(libkernel): handle sysctl queries for pathname, physmem and cacheline size
2026-10-12 00:48:35 +02:00
hugodearaujo 7b5ac83a2a fix(libkernel): destroy rwlocks the way the console does
On a PS5 (firmware 13.60) destroying a rwlock returns 0 even while it
is held, and leaves 1 in the handle; every later call on that handle
returns EINVAL until it is initialized again. A zero handle is
initialized on first use by the scePthreadRwlock calls too. Here a held
rwlock returned EBUSY, a destroyed handle became null and was silently
re-created by the next POSIX call, and the scePthreadRwlock calls threw
on a zero handle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:48:33 -03:00
kallmek3nny 5fd0e261c9 fix(aio): use precise polling sleep 2026-10-11 18:48:18 -04:00
hugodearaujo 3ba4751f98 fix(libkernel): report the console's scheduling priority range
On a PS5 (firmware 13.60) sched_get_priority_max returns 767 and
sched_get_priority_min 256 for SCHED_FIFO and SCHED_RR; the two were
swapped. Every other policy, SCHED_OTHER included, returns -1 with
EINVAL instead of a range or a host exception.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 19:47:18 -03:00
ethan 0a324d8ccb fix(relinker): resolve .suprx guest module aliases 2026-10-11 15:45:27 -07:00
Adrià ba08a1582a
Merge pull request #3876 from CnRJay/feat/savedata-convert
feat(savedata): implement sceSaveDataConvert
2026-10-12 00:43:58 +02:00
Adrià f9905068b7
Merge pull request #3730 from MarcZX100/codex/voiceqos-end-3331
feat(libSceVoiceQoS): implement sceVoiceQoSEnd
2026-10-12 00:42:41 +02:00
Adrià 6dbc0ea66a
Merge pull request #3829 from YossiYad/carry/agc-vieBRwlh1Lw
feat(libSceAgc): implement the vieBRwlh1Lw interpolant mapping update
2026-10-12 00:39:58 +02:00
Kikoarl 567898cd58 feat(libSceSysmodule): register libSceVoiceChat module ID (0x114) 2026-10-12 00:39:28 +02:00
Adrià 3905e7e2c9
Merge pull request #3827 from CouchRiv/fix-shader-combined-cvt-i16-f16-omod
fix(shader): accept output modifiers on v_cvt_i16_f16 and ignore them as the hardware does
2026-10-12 00:39:20 +02:00
Adrià 2c884140a5
Merge pull request #3721 from MarcZX100/codex/content-export-sessions-3374
feat(libSceContentExport): implement export sessions
2026-10-12 00:35:54 +02:00
Adrià 6426baa107
Merge pull request #3691 from MarcZX100/fix/sem-timedwait-available-first
fix(libkernel): handle available sem_timedwait counts first
2026-10-12 00:35:17 +02:00
Mouhand Kaddo ac4954c6e3 fix(libkernel): guard Unix host polling in Windows select 2026-10-12 02:34:11 +04:00
xXPBSXx 859d0b1e63 fix(exports): also export sceHmd2GetFieldOfView
main has sceHmd2GetFieldOfViewWithoutHandle only; PPSA07411 imports sceHmd2GetFieldOfView.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 00:33:41 +02:00
Adrià dd1cf5cb9d
Merge pull request #3771 from yunusshaikh7/fix/savedata-dir-name-search-sort
fix(savedata): sort sceSaveDataDirNameSearch results by the requested key and order
2026-10-12 00:30:16 +02:00
Adrià ae7dbfa9cb
Merge pull request #3770 from A-Akhil/fix/shader-sin-cos-series
fix(shader): take v_sin_f32 and v_cos_f32 from an exact series where the driver's result is more than 4 ulp off
2026-10-12 00:29:31 +02:00
Adrià e8169f49b3
Merge pull request #3756 from Lorkydey/feat/agc-acb-atomic-gds
feat(libSceAgc): build versioned ACB atomic GDS commands
2026-10-12 00:28:45 +02:00
eljackjoestar-cmd 9a0c59570c feat(ajm): decode Opus surround mapping family 2026-10-12 02:28:14 +04:00
Adrià f9e1d2541c
Merge pull request #3750 from fma-rc/feat/shader-subvector-loop
feat(shader): implement s_subvector_loop_begin and s_subvector_loop_end
2026-10-12 00:28:10 +02:00
Simon 233590462c fix(libSceNgs2): report EMPTY for a streaming sampler that played its queue
A playing sampler voice whose waveform still accepts blocks (CONTINUE)
reported only INUSE|PLAYING after it had played every queued block, so
a title that waits for EMPTY before it reuses the voice never did.
PPSA18391 (engine: Clickteam Fusion) reads state_flags & 0x22 != 2 from
sceNgs2VoiceGetState as the end of a sound; each of its sound effects
played once and never again.

The voice now also reports EMPTY (0x20) in that state and keeps
playing, so blocks added later still play. A waveform that was closed
without CONTINUE does not report it.
2026-10-12 00:26:12 +02:00
ethan 409f53eaed fix(relinker): filter non-reference RIP-relative FF operations 2026-10-11 15:24:53 -07:00
Adrià 5aaf26bd32
Merge pull request #3689 from MarcZX100/codex/libkernel-spin-reltimedwait-3554
feat(libkernel): implement pthread spinlocks and relative condition wait
2026-10-12 00:23:53 +02:00
Adrià d2fa71b706
Merge pull request #3682 from zmeizy/claude/kernel-fsync-error-codes
fix(libkernel): return SCE error codes from sceKernelFsync
2026-10-12 00:23:21 +02:00
Hussein Kadhim 351ca3bb12 fix(libkernel): return EDEADLK for a thread joining itself and EINVAL for a null thread
scePthreadJoin threw when a joinable thread joined itself and
scePthreadJoin and scePthreadDetach threw on a null thread, so
pthread_join and pthread_detach ended the process where FreeBSD libthr
returns EDEADLK and EINVAL.
2026-10-11 22:23:16 +00:00
Adrià c059590d8e
Merge pull request #3598 from Recapi/feat/libc-asinl
feat(libc): implement the remaining long double math functions RetroArch imports
2026-10-12 00:22:48 +02:00
Simon 43573fd48a fix(libSceVideoOut): return INVALID_HANDLE for events on ports that are not open
Registering a flip or vblank event on a handle that sceVideoOutOpen never
created, or that was closed, threw, which ended titles that register
their flip event before they open the port and ignore the result. The
documented error SCE_VIDEO_OUT_ERROR_INVALID_HANDLE is returned instead,
the same check sceVideoOutSetFlipRate and the other output calls use.

The flip test program gains an "unopened" mode.
2026-10-12 00:21:47 +02:00
Dean fabbeb393b
Merge pull request #3522 from pushkarreddyy/feat/libc-reallocf
feat(libc): implement reallocf
2026-10-12 11:21:30 +13:00
Adrià 8fc53cb325
Merge pull request #3853 from billythemenace2/feat/rudp-ppsa06888-imports
feat(libSceRudp): declare the calls PPSA06888 imports
2026-10-12 00:20:03 +02:00
Dean Galvin 1dc342dd57 perf(agc): keep the highest index of a large in-place index buffer while it is unchanged
An indexed draw that binds its index buffer in place from a host import
(#2253) scans the bound range for its highest index on every draw, where
the copied path reuses the value kept with its snapshot. A draw of many
indices pays for the scan each time, and an indirect draw, which binds
the whole declared index buffer, scans the whole buffer per draw.

The recorder now keeps the highest index of an in-place index range of
4096 indices or more with the write generation collected before the
scan, and a draw takes it while the range is unchanged since
(GuestMemory::UnchangedSince and the allocation registry generation, as
for a reused snapshot). A smaller range is scanned at every draw as
before: the scan costs 0.4 ns per index and the write collect and lookup
0.2 to 1.4 us per draw, so the scan is the cheaper of the two below
about 3,000 indices, as #2253 measured on small ranges.
2026-10-12 11:19:50 +13:00
MarcZX100 d004d11fa3 fix(libSceJson2): use signed special-float enum type 2026-10-11 22:19:14 +00:00
David 1d5f5eb6c8 feat(libSceJson2): implement the InitParameter2 constructors and setSpecialFloatFormatType
Resident Evil 4 (PPSA07411, #2776) and PRAGMATA (PPSA02530, #3043) stop
on the absent export with

  what():  _ZN3sce4Json14InitParameter225setSpecialFloatFormatTypeENS0_22SpecialFloatFormatTypeE not implemented

Deathloop, Minecraft Legends and Cyberpunk import the base-object
constructor InitParameter2::InitParameter2(), InitParameterRtti2::
setAllocatorRtti and InitParameterRtti::InitParameterRtti(AllocParamRtti*,
void*, unsigned long), which were NotImplemented stubs.

InitParameter2 is the 40-byte object of SharpEmu and KytyPS5: the
allocator, its user data, the file buffer size and the 32-bit special
float format type at 0x18. Both constructors zero it, setAllocatorRtti
writes the allocation parameters and user data where setAllocator writes
the allocator, and setSpecialFloatFormatType stores the type.
InitParameterRtti's constructor writes its three arguments to the first
24 bytes. The NID WVZBP4IyM+E recomputes from the mangled name and is in
the aerolib database. The enum's values are unknown, so no value is
rejected; the inferred layouts are recorded in TechnicalDebt.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 258f2910808e5ef1636973aaefbdf51615873dcb)
2026-10-11 22:19:14 +00:00
pushkarreddyy 931aaa2a7e feat(libkernel): handle sysctl queries for pathname, physmem and cacheline size 2026-10-12 00:17:14 +02:00
milescoviello 972caa4f2a fix(libkernel): number pthread keys from 1 as FreeBSD libthr does
scePthreadKeyCreate and pthread_key_create handed out the slot index,
so the first key in a process was 0. FreeBSD libthr returns slot + 1
(_pthread_key_create: "*key = i + 1") and subtracts 1 again in
pthread_key_delete, pthread_getspecific and pthread_setspecific, so 0 is
never a valid key. Code that keeps 0 as "key not created yet" therefore
created a new key on every call and lost the values it stored under the
previous one.

Keys now start at 1; 0 and other out-of-range keys are rejected with
EINVAL by delete and set and read as NULL, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYhZu5HokHMo9mfi8QU83m
2026-10-11 22:16:59 +00:00
jweidenh 2b8f151b3f test(agc): verify optimized pipeline draws and readback 2026-10-12 00:16:28 +02:00
Alex c63294027b fix(libc): exp2 leaves errno unchanged
exp2 set errno (34) for 1024.0. FreeBSD msun never sets errno and
reports errors through floating-point exceptions only, so errno is now
saved and restored around the host call.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
2026-10-11 18:15:15 -04:00
Adrià 43bc17f7ed
Merge pull request #3727 from mariusyo07/fix/pad-vibration-mode-3
fix(pad): accept vibration mode 3
2026-10-12 00:14:30 +02:00
Adrià 24865e8e22
Merge pull request #3887 from AchrafReyani/fix/libc-windows-backtrace-stack-candidates
fix(libc): list stack return address candidates in Windows backtrace reports
2026-10-12 00:13:59 +02:00
Adrià 11d9c00cf6
Merge pull request #3884 from hansjm10/fix/sysmodule-agc-internal-id
fix(libSceSysmodule): recognize the libSceAgc internal module id
2026-10-12 00:13:05 +02:00
Adrià c8ad983fd4
Merge pull request #3871 from fdfawef324/fix/libc-log-line-one-write
fix(libc): write each log line in one call
2026-10-12 00:12:34 +02:00
Adrià f803854a5c
Merge pull request #3670 from SibteProf/fix/json2-initparameter2-base-constructor
fix(json2): implement InitParameter2 base constructor
2026-10-12 00:12:05 +02:00
Niko 5731e02841 fix(libkernel): close guest sockets in sceKernelClose
sceKernelClose passed every descriptor to the host close. Guest socket
descriptors start at 0x10000000 and are not host descriptors, so closing
an open socket returned SCE_KERNEL_ERROR_EBADF and left it in the guest
socket table with its host socket open. Route them to GuestSockets::Close
as close, sceKernelRead and sceKernelWrite already do; a closed socket
still returns SCE_KERNEL_ERROR_EBADF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 00:11:53 +02:00
Adrià af0b52ebb4
Merge pull request #3592 from MarcZX100/codex/socket-errno-errors-3573
fix(libkernel): map host socket errors to guest errno
2026-10-12 00:11:40 +02:00
Adrià b18d4feddd
Merge pull request #3580 from Amr-Youssef/feat/libkernel-sigwait
feat(libkernel): export pause, sigwait and sigwaitinfo
2026-10-12 00:11:14 +02:00
MrMha 3687b2e214 perf(relinker): use a flat sorted call-site index 2026-10-12 00:11:00 +02:00
Adrià 33067ca0c7
Merge pull request #3856 from ErenYeager1836/carry/recompiler-vector-window
perf(recompiler): keep relatively addressed vector registers in a window array
2026-10-12 00:10:58 +02:00
Adrià 59584d58b1
Merge pull request #3858 from LeandroLP23/fix/libc-internal-force-tls-destructor-windows-test
test(libSceLibcInternal): run guest_force_tls_destructor on Windows
2026-10-12 00:10:39 +02:00
Adrià 362a1f4e96
Merge pull request #3857 from gookie-dev/fix/libscexml-for-titles-that-list-it
fix(libSceXml): add an export-free libSceXml for titles that list it
2026-10-12 00:10:31 +02:00
Adrià 825cbd4106
Merge pull request #3531 from karanvora2599/perf/shader-native-packed-f16
perf(shader): compute v_pk_add_f16 and v_pk_mul_f16 with native f16 math
2026-10-12 00:10:02 +02:00
Adrià 10afe59c7d
Merge pull request #3851 from itsbo5/feat/libc-drand48-lrand48-mrand48-srand48
feat(libc): implement drand48, lrand48, mrand48 and srand48
2026-10-12 00:09:44 +02:00
Adrià 7667f53232
Merge pull request #3845 from semirkabir/feat/umtx-nwake-private
feat(libkernel): wake each listed address in _umtx_op UMTX_OP_NWAKE_PRIVATE
2026-10-12 00:09:31 +02:00
Adrià 93ba44d750
Merge pull request #3847 from semirkabir/feat/usbd-device-calls
feat(libSceUsbd): declare the device and handle calls for the no-device path
2026-10-12 00:09:29 +02:00
Adrià 972b45b807
Merge pull request #3835 from queeeef/fix/agc-rect-list-partial-primitive
fix(agc): draw the complete rectangles of a rect-list draw with a partial last one
2026-10-12 00:09:05 +02:00
Adrià 7e4074fcb9
Merge pull request #3838 from gookie-dev/fix/pad-special-port-not-connected
fix(pad): report special ports as not connected in scePadOpen
2026-10-12 00:09:03 +02:00
Adrià c7731cf4d4
Merge pull request #3843 from kr4y4/fix/agc-aniso-override-force-degamma
fix(agc): keep FORCE_DEGAMMA paired when ANISO_OVERRIDE rebuilds a sampler
2026-10-12 00:09:01 +02:00