Commit Graph
14017 Commits
Author SHA1 Message Date
Joey Fisher 25c0a71869 fix(agc): skip Linux host imports of ranges not mapped read-write
NVIDIA (595.91.07) refuses VK_EXT_external_memory_host imports of
read-only or executable mappings with VK_ERROR_OUT_OF_DEVICE_MEMORY and
then fails every later vkAllocateMemory on the device. Check the range
is mapped read-write before importing on Linux, as the Windows path
already does for read-only memory, and copy it otherwise.

Refs #1022
2026-10-08 09:37:46 +02:00
mrk1987 b64bb679cc fix(relinker): resolve internal libc imports from guest libc 2026-10-08 09:23:13 +02:00
TibixDev 1841f3c6e7 fix(agc): honor disabled color-buffer formats
Exclude COLOR_INVALID attachments from the effective write mask while preserving later MRT export indices and depth-only rendering. Validated with the graphics tests and Skyrim menu draws.

AI-assisted implementation and testing by OpenAI Codex.
2026-10-08 10:22:13 +03:00
ToyuAU 2d59fffdb7 build(relinker): add a dependency-free conversion build mode 2026-10-08 18:21:30 +11:00
mrk1987 137a282d70 feat(libkernel): export POSIX pthread_attr_setstack 2026-10-08 09:21:14 +02:00
mrk1987 a9d31f3cba fix(libkernel): return POSIX errors from mkdir 2026-10-08 09:20:04 +02:00
Adrià 6b57386237 Merge pull request #1100 from gookie-dev/fix/agc-indirect-register-lists-at-submission
fix(agc): read indirect register lists when the command buffer is submitted
2026-10-08 09:14:02 +02:00
Dean 58a1bd6688 Merge pull request #1447 from oneandonlydean/fix/cmask-metablock-size
fix(agc): size CMASK by whole 1024x512 metablocks
2026-10-08 20:12:42 +13:00
Adrià 979ae68996 Merge pull request #1095 from kjhq/feat/libkernel-write-throttling
feat(libkernel): report no write throttling in sceKernelWriteThrottlingStatus
2026-10-08 09:11:51 +02:00
Dean 051d17dd59 Merge pull request #1329 from Dextroid17/fix/agc-nvidia-dmabuf-probe
fix(agc): keep dma-buf import off the NVIDIA proprietary driver
2026-10-08 20:09:19 +13:00
Dean a602045176 Merge pull request #493 from MichonGoddijn231849/perf/draw-key-user-words
perf(agc): draw cache keys on the user words each stage reads
2026-10-08 20:09:08 +13:00
Adrià f830fea754 Merge pull request #1094 from kjhq/feat/libkernel-mprotect
feat(libkernel): implement POSIX mprotect
2026-10-08 09:07:34 +02:00
TibixDev 9a78bda01b feat(ngs2): parse forward ATRAC9 waveform loops
Split looped waveforms into decoder-aligned intro, loop and tail blocks, preserving the encoder delay and finite or infinite repeat counts. Parse trailing sampler chunks and reject malformed loop ranges.

Validation: all seven NGS2 CTest cases passed; standalone ATRAC9 tests passed with ASan, UBSan and leak detection. AI-assisted implementation.
2026-10-08 10:00:47 +03:00
Raj 4c60962cd0 test(libc): put sprintf, sscanf and libc_printf arguments on the stack
guest_formatting called sprintf with four variadic arguments and
libc_printf with one, all in registers, and did not call sscanf, so only
snprintf had a check that fails with the old Linux register rebuild. sprintf
now formats six integers, sscanf converts eight fields and libc_printf prints
seven integers; on the old code the first gives "1 2 3 4 0 0" and the other
two crash.

Checks suggested by nauroth in #1435.
2026-10-08 12:30:40 +05:30
Raj d3900b240f fix(libSceNet): translate EHOSTUNREACH and the socket errors libkernel translates
The host's EHOSTUNREACH was reported as ENETUNREACH (51); FreeBSD's
EHOSTUNREACH is 65, which libkernel's sockets already report. EADDRNOTAVAIL,
ENOBUFS, EISCONN, ENOTCONN and EACCES had no translation and became EIO;
they now map to 49, 55, 56, 57 and 13, as in libkernel/Socket/src/Udp.cpp.

guest_sce_net connects the connected client again and expects EISCONN
(0x80410138); before this change it received EIO.
2026-10-08 12:23:36 +05:30
ChadandClaude Opus 5.5 c17337b6d9 fix(agc): size CMASK by whole 1024x512 metablocks
A CMASK holds 4 KiB per 1024x512-pixel metablock, not one nibble per 8x8
tile of the target: 1920x1080 spans 0x6000 bytes, as titles clear it,
not 16200. The swizzled nibbles of the lower-right tiles lie past the
packed size, so the fast-clear check missed them and the expanded store
left them cleared.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 19:53:02 +13:00
Raj 513479380c fix(libSceNet): report EINPROGRESS for a non-blocking connect
A non-blocking sceNetConnect that cannot complete at once must fail with
EINPROGRESS (36, 0x80410124), as FreeBSD's connect does, and a repeated call
while it is pending with EALREADY (37). On Windows, Winsock reports the
first case as WSAEWOULDBLOCK, which was translated to EAGAIN (0x80410123); on
Linux, EINPROGRESS and EALREADY had no translation and became EIO
(0x80410105). Code that waits for the connection only when connect reports
EINPROGRESS treated both as a failed connection.

guest_sce_net connects a non-blocking socket to the loopback listener and
accepts 0 or EINPROGRESS; before this change it received EAGAIN on Windows.
2026-10-08 12:22:49 +05:30
Claude 9abc931a18 refactor(libkernel): share eh_frame_hdr parsing between module info calls
sceKernelGetModuleInfoForUnwind and sceKernelGetModuleInfoFromAddr each
parsed .ehmeta and the eh_frame_hdr it names. Both now read them through
Module/EhFrame.hpp, so a bad table fails the same way in both: an
eh_frame_hdr version other than 1, an indirect or non-absptr/pcrel
encoding, a 64-bit record length or anything outside the image throws.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JkiyF6p7oDAaTtVe8ci5zP
2026-10-08 06:47:14 +00:00
Adrià bc1fbe8158 Merge pull request #1110 from Sanjaysrinivas/fix/mspace-resize-overflow
fix(libc): reject overflowing mspace resizes
2026-10-08 08:46:42 +02:00
Adrià 5de0adf643 Merge pull request #1107 from Sanjaysrinivas/fix/libc-thread-safe-time
fix(libc): avoid time conversion races
2026-10-08 08:46:01 +02:00
Adrià f23e5c564e Merge pull request #1105 from orbz22/fix/agc-guard-sources-path-regex
fix(agc): exclude tests and tools from the shader cache guard when the source path holds regex characters
2026-10-08 08:45:37 +02:00
Raj c53c45ce7a refactor(libSceAppContent): name the stub the NID database resolves
tools/nid_names.py resolves 7gxh+5QubhY to sceAppContentAddcontEnqueueDownload
(compute_nid of the name matches). The stub takes that name instead of
sceAppContentUnknown00 with an APS5_EXPORT alias, so its NID is unchanged and
NotImplemented reports the real function.
2026-10-08 12:14:15 +05:30
Adrià 66b8abd8e6 Merge pull request #1101 from eliasbruno124-dev/fix/relinker-windows-guest-filenames
fix(relinker): resolve Windows guest filename casing
2026-10-08 08:43:35 +02:00
Adrià c3f4db777c Merge pull request #1099 from winklemad/fix/sscanf-s-width-limited-fields
fix(libc): only fail sscanf_s fields when the buffer capped the width
2026-10-08 08:42:26 +02:00
Adrià 7ca179970c Merge pull request #1437 from adriadam10/fix/unique-test-temp-paths
test: give fixed temp files a random suffix so parallel runs don't collide
2026-10-08 08:38:55 +02:00
camezaro-intc 327201519a feat(font): implement sceFontDettachDeviceCacheBuffer
Detach the device cache buffer attached by sceFontAttachDeviceCacheBuffer. The signature is taken from the IDA type database of Orbital: it takes the library, a pointer to receive the buffer and a pointer to receive its size. When no cache buffer is attached, it reports NOT_ATTACHED_CACHE_BUFFER. If the library allocated the buffer itself and no buffer pointer is passed, the memory is freed. The owned bit is cleared and device_cache_buf is reset to null.
2026-10-08 00:36:52 -06:00
Raj 33fc6ada3c test(agc): build the mesh tests with MinGW
tests/Mesh.cpp called setenv and std::aligned_alloc, which MinGW does not
provide, so agc_driver_mesh_tests did not compile on Windows. The 64 KiB
indirect record block now comes from aligned operator new, and the
environment is set with _putenv_s on Windows, as ShaderDiskCache.cpp does.

The setenv also named APS5_NO_SHADER_DISK_CACHE, which nothing reads; the
shader cache is turned off by ANYPS5_NO_SHADER_CACHE.
2026-10-08 12:06:10 +05:30
Dean 66b9be6607 Merge pull request #1322 from TibixDev/pr/np-reachability-lifecycle
fix(npmanager): track reachability callback registration
2026-10-08 19:36:00 +13:00
Dean b31f1a92a3 Merge pull request #1427 from NahuelGenchi/work-pm4-failure-ctest
test(agc): run the PM4 asynchronous failure mode in ctest
2026-10-08 19:35:47 +13:00
Dean a57ccfb426 Merge pull request #1275 from KSWORK2001/fix/libscertc-dostime-range
fix(libSceRtc): answer out-of-range years in sceRtcGetDosTime
2026-10-08 19:35:43 +13:00
Dean 08766c4e71 Merge pull request #1251 from MGXAe/arena/a135bd3b-anyps5
fix(nid): reject libraries that define symbol versions
2026-10-08 19:35:39 +13:00
Dean bbead6f34b Merge pull request #1420 from Amirtheshwaran/fix/check-conventions-windows-encoding
fix(tools): read and write UTF-8 in check_conventions regardless of the Windows code page
2026-10-08 19:35:36 +13:00
Adrià 56f3da20e8 Merge pull request #1072 from alfalfa-star/feat/agc-cmask-fast-clear
feat(agc): render into CMASK fast-clear color targets
2026-10-08 08:32:04 +02:00
Adrià FranchandClaude 25000541ad test: give fixed temp files a random suffix so parallel runs don't collide
Co-Authored-By: Claude <[email protected]>
2026-10-08 08:31:16 +02:00
gookie de651c6283 fix(agc): read indirect register lists when the command buffer is submitted
The driver copies a submission's packets when it is submitted, but
SET_SH_REG_INDIRECT, SET_UCONFIG_REG_INDIRECT and SET_CONTEXT_REG_INDIRECT
read their (offset, value) lists from guest memory only when the queue
worker reaches the packet. A title that reuses its per-frame memory once
it expects the GPU to be done with it can rewrite a list in between, and
the worker then throws on the data it finds there ("extended register
semantics are not implemented (offset dword 0x3a888889)").

The lists are now read with the packets, after validation, in Submit and
for a rewind tail, and the worker writes the registers from that copy.
Pm4::Execute keeps reading the list itself for direct callers.

PPSA21402 (Balatro) keeps three frame slots and does not wait for the GPU
before reusing one: its slot labels start at 0xffffffff and the GPU only
ever writes 0xffffffff to them, so the poll before a slot is reused never
blocks. When the worker falls more than two frames behind, the title
writes per-draw constants over a SET_CONTEXT_REG_INDIRECT list the worker
has not read yet.

The console's PFP reads the list when it reaches the packet; the
difference is recorded in TechnicalDebt.md.
2026-10-08 08:30:22 +02:00
tototomate123 0b0526c4d1 fix(prx): add missing offline HFW imports 2026-10-08 08:27:31 +02:00
Adrià FranchandClaude 53a31b512e test(guest_memory): pin mprotect on an unmapped and a wrapping range
Both return -1/EINVAL: FreeBSD kern_mprotect (sys/vm/vm_mmap.c) maps only
PROTECTION_FAILURE, RESOURCE_SHORTAGE and OUT_OF_BOUNDS to their own errno, so
KERN_INVALID_ADDRESS falls to EINVAL.

Co-Authored-By: Claude <[email protected]>
2026-10-08 08:24:12 +02:00
kjhqandClaude Opus 5.5 35ae8742a9 feat(libkernel): implement POSIX mprotect
mprotect changes the protection of guest memory through the same path
as sceKernelMprotect and reports failures through errno: EINVAL for a
null or overflowing range or a range the allocation tracker rejects,
ENOMEM when allocation fails. A zero length succeeds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 08:24:06 +02:00
kjhq 329c825fe1 docs(libkernel): record how PPSA17221 reads sceKernelWriteThrottlingStatus 2026-10-08 08:21:30 +02:00
kjhq 295780ab20 feat(libkernel): report no write throttling in sceKernelWriteThrottlingStatus
The host has no SSD write budget, so the status reports the largest budget in its first qword and zeroes the rest.
2026-10-08 08:21:23 +02:00
Raj faad75d655 refactor(libc): remove the unused register save area vararg helpers
The VA_ARGS parameter list and VarArgsAbi.hpp (RegSaveArea, FillRegSaveArea,
BuildVaList and the Xmm alias in SimdTypes.hpp) were only used by the four
Linux exports that now take their arguments with va_start.
2026-10-08 11:46:56 +05:30
Raj 18113907c8 test(libc): run guest_formatting on Linux
guest_formatting_tests was built on Linux but registered with ctest on
Windows only, so the Linux printf and scanf exports had no coverage: on main
the test fails there at its first vsnprintf check and then crashes in
snprintf with eight integers.

It is registered on every platform now. The %ls checks stay Windows-only,
as glibc reads %ls as 32-bit wchar_t; that gap is recorded in TechnicalDebt.
2026-10-08 11:46:56 +05:30
Raj cbc7498b12 fix(libc): format from a copy of the guest va_list on Linux
The Linux vprintf, vsprintf, vsnprintf, vsprintf_s, vfprintf, vasprintf and
vsscanf handed the guest's va_list to the host function, which advanced the
guest's gp_offset, fp_offset and overflow_arg_area. A caller that formats
the same list twice, first to size the output and then to write it, got its
second call's arguments from past the end.

The Windows path reads its arguments from a copy (LibcDetail::FormatArguments)
and guest_formatting checks that vsnprintf leaves the list unchanged. Linux
now does the same with va_copy.
2026-10-08 11:46:56 +05:30
Raj 887a258152 fix(libc): read every variadic argument of the Linux snprintf, sprintf, sscanf and libc_printf
On Linux these four exports took the guest's registers as named parameters
and rebuilt a va_list from them. The register save area held only the
argument registers after the fixed ones, followed by zeros, with gp_offset 0,
so va_arg read the zeros for the remaining integer slots before moving to the
overflow area. overflow_arg_area was the seventh integer parameter, which is
the value of the first stack argument, not its address.

snprintf(buffer, size, "%d %d %d %d", 1, 2, 3, 4) produced "1 2 3 0",
"%s/%s/%s/%s" with four strings produced "a/b/c/(null)", and eight integers
dereferenced the value 4 and crashed. sprintf and sscanf lost their fifth
and sixth arguments, libc_printf its sixth.

They are now variadic functions that use va_start, like printf, sprintf_s,
snprintf_s and printf_s on Linux already do.
2026-10-08 11:46:56 +05:30
Adrià 7a178e2276 Merge pull request #1089 from AaravMehta-07/fix/relinker-registry-json
fix(relinker): escape control characters in call registry JSON
2026-10-08 08:10:07 +02:00
TibixDev ce280a19ca perf(agc): handle uniform pattern-fill kernels as clears
Recognize the exact typed pattern-fill kernel and route aligned, nonaliased uniform ranges through existing fill/coherence handling. Preserve control and descriptor bounds, partial dispatch counts, queued labels, and shader fallback for other cases.

Semantics checked on Radeon RX 6600: native RDNA wave32/wave64 typed R32_UINT loads/stores, execution masks, and descriptor bounds (16 cases). Real PM4 tests cover HLE and shader paths, imports and copies, indirect/partial dispatch and GPU-to-label ordering under Vulkan validation. Graphics and PM4 tests pass; Skyrim Helgen save visually checked. 64 MiB copied-buffer fill median reduced from 67.5 ms to 3.8 ms.

Written with AI assistance.
2026-10-08 09:08:38 +03:00
Adrià dcbf089d28 Merge pull request #995 from CnRJay/fix/appcontent-user-defined-params
fix(libSceAppContent): read user defined app params from param.json
2026-10-08 08:07:21 +02:00
Adrià 57b62cedf1 Merge pull request #1088 from kjhq/fix/libkernel-sockaddr-len
fix(libkernel): accept guest socket addresses whatever their sa_len
2026-10-08 08:07:17 +02:00
Adrià e9fecced17 Merge pull request #1086 from Celegans12/fix/agc-depth-bias-clamp-default
fix(agc): include PA_SU_POLY_OFFSET_CLAMP in the initial context state
2026-10-08 08:06:30 +02:00
Adrià 30e500f781 Merge pull request #917 from TidalImpact/fix/rela-bounds-check
fix(relinker): overflow-safe RELA entry bounds check
2026-10-08 08:03:28 +02:00