Commit Graph
6138 Commits
Author SHA1 Message Date
Suryansh Prajapati 58f596ee89 fix(shader): convert f16 bits to f32 without UnpackHalf2x16
On the AMD Windows driver (Radeon RDNA2 iGPU, 32.0.21030.2001)
UnpackHalf2x16 of a byte-selected half converts the unmasked source
register: an SDWA BYTE_0 source of 0xfff0fff0 reads as f16 0xfff0
instead of 0x00f0, so agc_driver_sdwa_float_selectors and
agc_driver_sdwa_ldexp_f16 fail there. EmitF16BitsToF32 now decodes
sign, exponent and mantissa with integer operations, scaling
subnormals by 2^-24, which is exact for every half and leaves the
driver nothing to fold into the conversion.
2026-10-08 13:36:49 +05:30
Adrià da4027399e Merge pull request #1125 from TideOPL/feat/ppsa16064-missing-exports
feat(libs): add the unimplemented exports PPSA16064 imports
2026-10-08 10:01:59 +02:00
Achraf ReyaniandClaude Opus 5.5 df570de6d5 feat(libc): implement std::bad_weak_ptr and _Throw_bad_weak_ptr
BnMAMrsfVWo is _ZSt19_Throw_bad_weak_ptrv. Replace the unknown stub
with a throw of a guest std::bad_weak_ptr, and add its type info,
vtable, destructors and what().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 10:00:54 +02:00
TibixDev 48bb99d477 fix(agc): decode implicit six-face cube extents
Treat equal BASE_ARRAY and DEPTH as a six-face cube. Measured with image_load, image_sample and image_get_resinfo on RX 6600 gfx1032 using base slices 0, 5 and 6. Partial cube ranges still throw because filtered sampling differs from load bounds.

Graphics tests and GPU snapshot/storage sampling tests pass for all six faces at each tested base.

Assisted-by: OpenAI Codex
2026-10-08 11:00:04 +03:00
LeandroLP23andClaude Opus 5.5 2e9ab8cc59 fix(libc): give setvbuf a default buffer when the size is 0
FreeBSD's setvbuf takes a zero size with _IOFBF or _IOLBF as "pick the
buffer size". The UCRT rejects sizes below 2 for those modes through
its invalid parameter handler, so the call failed on Windows and a test
process was terminated. A zero size now drops the given buffer and
asks the host for one of BUFSIZ bytes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 09:58:38 +02:00
Adrià eaa6ccea08 Merge pull request #1124 from TideOPL/fix/agc-shader-fusion-swappc-terminator
fix(libSceAgc): accept s_swappc_b64 null, s[6:7] as a front half's terminator
2026-10-08 09:55:06 +02:00
Adrià f51eeff059 Merge pull request #1117 from TideOPL/fix/relinker-tls-unreached-code
fix(relinker): find Windows guest TLS accesses in code no root reaches
2026-10-08 09:54:40 +02:00
Adrià 7fccb7ff5f Merge pull request #1051 from fisherjoey/fix/linux-unwritable-host-import
fix(agc): skip Linux host imports of ranges not mapped read-write
2026-10-08 09:53:40 +02:00
Adrià Franch e8697e6938 docs: record the Windows positioned and vectored IO deviations in TechnicalDebt 2026-10-08 09:53:01 +02:00
Raihan Abdul MajidandClaude Opus 5.5 87f4444441 fix(kernel): transfer each iovec directly on Windows
Gathering every iovec into one host buffer threw for a total above
INT_MAX, which a console readv/writev accepts, and copied the whole
transfer twice. Each iovec is now read or written in place, in chunks
of at most INT_MAX bytes. A readv on a pipe returns after one read so
it does not block once the available bytes are consumed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-08 09:52:49 +02:00
Raihan Abdul MajidandClaude Opus 5.5 a38df0f020 feat(kernel): implement vectored file IO on Windows
sceKernelReadv, sceKernelWritev, sceKernelPreadv and sceKernelPwritev threw on Windows. They now gather or scatter through one host buffer and issue a single read or write, with the same argument checks and error codes as the Linux path. Positioned transfers restore the file offset afterwards, as pread and pwrite do on POSIX, and report ESPIPE for handles that are not disk files. guest_file_vector now runs on Windows as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UTjpbMX7BUFMZZaxJE98zV
2026-10-08 09:52:49 +02:00
Adrià FranchandClaude 1c523b370f test(agc): pin the 32-bit GPU clock COPY_DATA write
Co-Authored-By: Claude <[email protected]>
2026-10-08 09:48:00 +02:00
TideOPL 23e0363e59 feat(agc): copy the GPU clock counter with COPY_DATA
COPY_DATA rejected source select 9 (GPU clock count) and any cache
policy bits. PPSA16064 (Minecraft Dungeons II, Unreal Engine)
calibrates its GPU timer at start-up with a submission of five
COPY_DATA packets, control 0x06016209: GPU clock source, memory
destination, 64-bit count, source and destination cache policy 3. The
submission was rejected and the title aborted.

The clock source now writes the same counter as a RELEASE_MEM
timestamp (the host steady clock in 10 ns ticks), read when the packet
runs, through the direct execute path and through ResolveStore for
stores recorded on the GPU. A 32-bit count writes its low half. The
source and destination cache policy fields are accepted and ignored,
as for WRITE_DATA and DMA_DATA. The reference clock (source select 10)
and the other unimplemented sources still throw.

agc_driver_pm4 runs the title's packet twice and checks a nonzero,
non-decreasing counter and an 8-byte resolved store, and that source
select 10 is still rejected.
2026-10-08 09:47:53 +02:00
mrk1987 2050d84595 test(relinker): isolate guest libc resolution coverage 2026-10-08 09:43:52 +02:00
mrk1987 05e9a507a7 test(libkernel): keep setstack cases separate from stacksize tests 2026-10-08 09:43:31 +02:00
popcoder565andClaude Opus 5.5 384078c924 fix(libkernel): retry a raise that interrupts its target inside winpthreads
MinGW's thread_local goes through emutls and winpthreads' pthread_getspecific, which holds a per-thread spinlock. A raise that redirected a thread holding it ran the handler on that same thread, and a handler reading any thread_local, scePthreadSelf for one, spun on the lock forever. A raise that finds the target inside libwinpthread-1.dll now resumes it and suspends it again, as one inside NtContinue does.

guest_raise_exception's new phase raises at a thread that calls scePthreadSelf in a loop and checks that the handler sees its own thread. It hung in every run without the retry. TechnicalDebt records that a handler can still reenter other host code the thread was interrupted in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-08 03:43:13 -04:00
Adrià 1e1e1390b5 Merge pull request #1123 from TideOPL/fix/agc-command-buffer-null-cursor-down
fix(libSceAgc): treat a null cursor_down as a buffer limited by its top
2026-10-08 09:41:38 +02:00
Adrià 8cb527165a Merge pull request #1120 from TideOPL/feat/libc-sce-v2-runtime-symbols
feat(libc): export the __sce_v2 _Xbad_function_call and sized aligned delete
2026-10-08 09:40:20 +02:00
Adrià 72bcc33606 Merge pull request #1113 from Celegans12/fix/agc-batch-kept-bytes
fix(agc): bound the upload buffers that recorder batches keep alive
2026-10-08 09:39:56 +02:00
Fishybeing cd39c8db54 fix(libc): read guest wide strings as 16-bit units
The guest's wchar_t is 16 bits, but wcslen, wcscmp, wcsncmp, wcscpy, wcsncpy, wcschr, wcsrchr, wcsstr, wcspbrk, wcsspn and the wmem functions forwarded to the host's wchar_t functions, which use 32-bit units on Linux. Implement them on char16_t. The wide conversions that still use the host's wchar_t are listed in TechnicalDebt.
2026-10-08 09:39:55 +02:00
Adrià FranchandClaude 80456dac90 docs(debt): say the Linux host import check does not cover shared file mappings
Co-Authored-By: Claude <[email protected]>
2026-10-08 09:37:52 +02:00
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