Commit Graph

2014 Commits

Author SHA1 Message Date
Mouad-Scriptz-0 94087d08b0 feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas
The console's mouse reports relative motion, so the host cursor can never line
up with the cursor a title draws. While a title has a mouse open and the
window is focused the host cursor is hidden and captured, released on focus
loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled
from the presented image's size in window units to the title's display
resolution with sub-pixel carry, so the title's cursor travels as far as the
host pointer would, on scaled desktops and letterboxed windows alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 14:05:52 +00:00
Adrià 0c05d3cfc7
Merge pull request #4105 from MarcZX100/codex/carry-execv-execve-3558
feat(libkernel): add execve as a throwing export
2026-10-13 15:31:29 +02:00
Adrià 3faa9cb400
Merge pull request #5103 from ErenYeager1836/carry/audioout-enable-chat
feat(libSceAudioOut): implement sceAudioOut2EnableChat
2026-10-13 15:22:57 +02:00
Adrià Franch cdf4b174f4 fix(libkernel): keep the execv export and its debt line
The rename to execve dropped execv, which PPSA97358 imports.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-13 15:19:19 +02:00
MarcZX100 77016caa24 fix(libkernel): limit execve to unsupported behavior 2026-10-13 15:19:19 +02:00
David 4f1ae1cc3a feat(libkernel): implement execv and execve as throwing exports
XPSemu PPSA97358 imports both from libkernel.prx; with the imports ahead
of them covered, its predicted next stops (relink registry order, not an
observed run) are:

  FAIL: unresolved ELF import KaK52lYTBIs from libkernel.prx  (execv, 7 call sites)
  FAIL: unresolved ELF import kdguLiAheLI from libkernel.prx  (execve, 4 call sites)

Today the title stops earlier at the observed
  FAIL: unresolved ELF import aRo9AhFUXcM from libkernel.prx  (sigsetjmp, merged in #3486)

As for execvp (#2827), the process image cannot be replaced here, so both
throw with the execvp message pattern once FreeBSD 11's execve would start
loading the image (freebsd-src 8c639945, sys/kern/kern_exec.c
exec_copyin_args, do_execve, exec_check_permissions; lib/libc/gen/exec.c
execv passes environ). Before that they fail as FreeBSD does: EFAULT for a
null argument vector or path, ENOENT and ENOTDIR from the lookup as stat
reports it, EACCES for a path that is not a regular file. Paths of
PATH_MAX bytes or more and strings over ARG_MAX throw instead of guessing
the console's limits. The execv calls in XPSemu's sources run in a fork
child (net/tap.c), and its fork fails with ENOSYS (ZiZc3/XPSemu 8eec07b4,
ps5/compat/libc_missing.c, ps5/build-title.sh --defsym).

NIDs computed with tools/nid_names.py and confirmed in aerolib.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 57f0fa37132bc6c78bc02282044a00e2db859484)
2026-10-13 15:19:19 +02:00
Adrià 5aaa394cff
Merge pull request #5080 from ErenYeager1836/carry/libSceAgc-amm-semaphore
feat(libSceAgc): implement sceAgcSetAmmSemaphoreMemory and sceAgcGetSemaphoreLabel
2026-10-13 15:17:12 +02:00
Adrià 1e7f4967ed
Merge pull request #3743 from YossiYad/carry/ampr-pad-launch
feat(libSceAmpr): implement the std::_Pad thread launch helpers
2026-10-13 15:15:37 +02:00
Adrià d5835a613b
Merge pull request #5102 from Dripl1x/codex/generic-error-category
feat(libc): implement generic error category messages
2026-10-13 15:08:29 +02:00
Adrià Franch 76075edd38 test(libSceAudioOut): define TestEnableChat; drop stale EnableChat unknown-signature line
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-13 15:06:32 +02:00
screamm 50cd318bb8 feat(libSceAudioOut): implement sceAudioOut2EnableChat
Palworld (PPSA23126, #2648) stops at start-up on the export, imported by
its bundled libdiscord_partner_sdk.prx:

    FAIL: unresolved ELF import oiOi7vgPfAY from libSceAudioOut.prx

PPSA28416 imports it from its bundled party-ps5-shipping.prx as well. The
call itself has not been observed yet.

SharpProspero (5dfdb4b0, Interop/Audio/AudioOut2.cs:460-464) declares
`int sceAudioOut2EnableChat()`, "Allows chat audio alongside the
application's own", and the ps5-payload-dev SDK stub (f5d40f02,
sce_stubs/libSceAudioOut.c:62) exports it as well. There is no context or
handle to validate. The host mixes no chat audio and AudioOut2 has no chat
port, so the call records that chat audio is allowed (traced once with
APS5_TRACE_AUDIOOUT2) and returns 0. Whether the console fails it without
a chat session or when repeated is recorded in technical debt, and the
PPSA28416 "signature unknown" entry is dropped.

NID oiOi7vgPfAY matches tools/nid_names.py and the shadPS4 aerolib list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 15:06:27 +02:00
Adrià Franch 6ba5d68e07 docs(debt): move the AMM semaphore line away from the end of Functional 2026-10-13 15:01:48 +02:00
David 352d04e8dc feat(libSceAgc): implement sceAgcSetAmmSemaphoreMemory and sceAgcGetSemaphoreLabel
sceAgcSetAmmSemaphoreMemory(memory, sizeInBytes) registers the AMM semaphore memory once and zeroes the first 8 bytes of each 32-byte label; sceAgcGetSemaphoreLabel(index, label) writes memory + 32 * index for an index inside the registered memory.

Unblocks New Joe & Mac Caveman Ninja (PPSA02801) which imports both symbols. Matches OpenAGC and sharpemu agreements on signatures, 16 KiB alignment, 32-byte stride, and zeroed label counters.
2026-10-13 15:01:43 +02:00
Yossi Yadgar dd1deb6965 fix(ampr): raise std::_Pad failures as the guest std::system_error
A failing _Pad primitive threw a host std::runtime_error, which no guest
catch can see. threadcall.cpp calls the checked wrappers of xthread
(_Mtx_lockX, _Cnd_waitX, _Thrd_startX), which pass a non-success code to
_Throw_C_error: _Thrd_nomem and _Thrd_timedout become
resource_unavailable_try_again, _Thrd_busy device_or_resource_busy and
_Thrd_error invalid_argument, raised through _Throw_Cpp_error, which main
now implements. A failing thread start is _Thrd_startX's
resource_unavailable_try_again.

_Release now wakes the launching thread with _Cnd_signal, as
threadcall.cpp does; libc has it since the pad was written.

guest_ampr_threads checks, in a forked child whose guest terminate
handler reports the thrown object, that _Release on the thread still
holding the pad's mutex throws std::system_error with EBUSY. It fails
with the previous host exception and with busy mapped to
invalid_argument.
2026-10-13 15:59:28 +03:00
David d991cdccf9 feat(libSceAmpr): implement the std::_Pad thread launch helpers
Implement _ZNSt4_PadC2Ev, _ZNSt4_PadD2Ev, _ZNSt4_Pad7_LaunchEPP7pthread
and _ZNSt4_Pad8_ReleaseEv, which Deathloop (PPSA01670) and Minecraft
Legends (PPSA05510) import from libSceAmpr for the std::thread launch path.

The algorithm and object layout follow Dinkumware V6.00 thr/xthread and
thr/threadcall.cpp of Visual C++ 2013 (ganboing/crt.vc12 f1d47126): a
vtable pointer whose first slot is the pure virtual _Go(), then the
condition and mutex handles and bool _Started (0x8, 0x10, 0x18), with the
console's pointer-to-slot handles of libc Threads.cpp (#3079). The pad
uses libc's _Cnd_*/_Mtx_* exports, starts the guest thread with
pthread_create and an entry that calls _Go() and returns its result as
the exit code, as _Call_func does. The unverified layout, thread
attributes and error reporting are recorded in TechnicalDebt.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 15:51:00 +03:00
Adrià c827e11872
Merge pull request #4086 from hugodearaujo/fix/setschedparam-console
fix(libkernel): check and keep the scheduling policy of a thread
2026-10-13 14:29:15 +02:00
Adrià 94d9957725
Merge pull request #4078 from MarcZX100/codex/carry-ssl-connections-3766
fix(libSceSsl): add missing verification callback export
2026-10-13 14:26:09 +02:00
Adrià a60f8d940b
Merge pull request #5048 from MarcZX100/codex/libc-openlog-closelog
fix(libc): implement openlog and closelog state
2026-10-13 14:18:31 +02:00
Adrià 96f3e9fe5d
Merge pull request #4041 from ee6aba54/fix/agc-cmask-unknown-codes
fix(agc): keep the texels of CMASK tiles with codes other than 0 and 15
2026-10-13 14:11:16 +02:00
Evgeniy Kazarin e3cef332e6 feat(libc): implement generic error category messages 2026-10-13 14:38:04 +03:00
Dean 18414447b9
Merge pull request #4525 from Lorkydey/fix/poll-priority-windows
fix(libkernel): support POLLPRI on Windows sockets
2026-10-14 00:37:59 +13:00
Dean e09ee165d5
Merge pull request #3651 from MarcZX100/codex/libc-posix-spawn-3624
feat(libSceLibcInternal): implement posix_spawn actions
2026-10-14 00:37:44 +13:00
Dean bc1ded3a18
Merge pull request #4386 from MarcZX100/codex/carry-mlockall-getdtablesize-3628
feat(libkernel): add mlockall export
2026-10-14 00:37:29 +13:00
Dean 5d50886ee4
Merge pull request #2076 from jdmagic/feat/agc-stencil-plane-storage
feat(libSceAgcDriver): take a one-layer 2D array view of a depth surface plane as the plane
2026-10-14 00:11:01 +13:00
Dean 3ee394ea9a
Merge pull request #4543 from coltken95/fix/libc-time
fix(libc): format strftime and asctime as FreeBSD 11 does
2026-10-14 00:10:43 +13:00
hugodearaujo 5c6a9d22c4 fix(libkernel): check and keep the scheduling policy of a thread
On a PS5 (firmware 13.60) pthread_setschedparam and
scePthreadSetschedparam accept only SCHED_FIFO and SCHED_RR with a
priority of 256 to 767 or 896 to 959, return EINVAL otherwise, and
keep the policy for pthread_getschedparam. A created thread takes the
policy of explicit scheduling attributes, or its creator's when it
inherits. Here any policy and priority were accepted and SCHED_FIFO
was always reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 12:53:19 +02:00
Adrià Franch e34281b558 docs(debt): keep the other SSL stubs in the PPSA07411 entry
Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-13 12:50:47 +02:00
MarcZX100 5d00bd7bbf feat(libSceSsl): add missing verification callback export 2026-10-13 12:50:43 +02:00
Dean 768cd93977
Merge pull request #4082 from Celegans12/feat/agc-quad-tessellation
feat(agc): implement quad tessellation with counter-clockwise output and level clamps
2026-10-13 23:42:25 +13:00
Dean 53aea1ff34
Merge pull request #5024 from oneandonlydean/up4/storage-store-keeps-untracked-writes
fix(agc): keep CPU writes when a pending storage result is stored over untracked memory
2026-10-13 23:33:08 +13:00
Dean 387b8a0faa
Merge pull request #3763 from eljackjoestar-cmd/codex/dynamic-rendering-layers
fix(agc): render all attachment layers with dynamic rendering
2026-10-13 23:32:53 +13:00
Adrià c7632f036f
Merge pull request #5037 from Feuris/feat/libc-cnd-timedwait
feat(libc): implement _Cnd_timedwait
2026-10-13 12:26:09 +02:00
Adrià a1c2f9fa2c
Merge pull request #3902 from MarcZX100/codex/carry-amm-pool-references-3321
fix(ampr): preserve pooled pages across AMM remaps
2026-10-13 12:25:36 +02:00
Dean Galvin cc3b47dda0 fix(libSceAgcDriver): take a one-layer 2D array plane view as a narrow exception to the non-2D refusal
Main refuses every storage view of a depth or stencil plane that is not
2D. A 2D array view is now taken as the plane only at layer 0 with one
layer; a view with more layers or another base layer still throws.

A one-layer 2D array view replaces a 2D view of the plane like any other
view, so a store back through the replaced 2D view throws. The depth
storage dispatch test runs one-layer views of both planes and checks
that the depth and stencil tests see what they stored, and that a
two-layer view still throws.
2026-10-13 23:17:51 +13:00
Claude d0df62bd1f
fix(libc): format strftime and asctime as FreeBSD 11 does
strftime handed most conversions to the host's strftime, which differs
from FreeBSD 11's for E and O modifiers on conversions glibc does not
pair with them (%Ea was printed literally), padding flags on %+ and %v,
years outside 1000 to 9999 (%Y printed 899 and -1 where FreeBSD prints
0899 and -001), and out-of-range fields (%I of hour 100, %u of weekday
8). On Windows the padding flags printed nothing. strftime now follows
FreeBSD 11 strftime.c with the C locale on every host, and asctime
follows FreeBSD 11 asctime.c, padding years to four digits and setting
longer years apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZWLdTjf1S57iLgn2rcaFb
2026-10-13 10:12:15 +00:00
MarcZX100 7313cf5589 docs(libc): record syslog tag fallback gap 2026-10-13 09:56:31 +00:00
MarcZX100 653c5449f9 fix(libc): honor openlog identity and facility 2026-10-13 09:56:31 +00:00
ducloc080202 4aff906ca6 feat(libSceSystemService): no-op sceSystemServiceOpenChallengeActivity 2026-10-13 16:41:40 +07:00
Adrià 08f672cc51
Merge pull request #5035 from ducloc080202/feat/system-service-controller-settings
feat(libSceSystemService): no-op sceSystemServiceShowControllerSettings
2026-10-13 11:35:54 +02:00
Feuris 572d330a13 feat(libc): implement _Cnd_timedwait 2026-10-13 06:34:01 -03:00
Adrià 8299b2f7eb
Merge pull request #5036 from 0xRickx/feat/libc-atanhf
feat(libc): implement atanhf
2026-10-13 11:22:59 +02:00
screamm 5db1d8d5e9 fix(libkernel): accept POLLPRI on guest sockets under WSAPoll
Three catalog titles stop on Windows when they poll a guest socket for
POLLPRI|POLLOUT to see whether a non-blocking connect has completed:

- PPSA97510 PSXS5 (socket 0x10000002, thread gamedb, 13 s):
  what():  poll: POLLPRI is not supported by WSAPoll
- PPSA98510 SwanStation (sockets 0x10000003/0x10000002, threads gamedb
  and update): what():  poll: POLLPRI is not supported by WSAPoll
- PPSA99003 ProsperoTV ({0x10000001, POLLPRI|POLLOUT} at 5.3 s):
  what():  poll: POLLPRI is not supported by WSAPoll

FreeBSD's sopoll_generic (sys/kern/uipc_socket.c, freebsd-src 8c639945)
reports POLLPRI and POLLRDBAND alike, only while out-of-band data is
pending (so_oobmark or SBS_RCVATMARK). WSAPoll rejects POLLPRI in events
with WSAEINVAL but reports pending urgent data as POLLRDBAND, so on
Windows the guest POLLPRI is now asked of WSAPoll as POLLRDBAND and
POLLIN as POLLRDNORM (Winsock's POLLIN includes POLLRDBAND, which would
report urgent data as readable). Measured on this host: WSAPoll reports
POLLRDBAND after a peer's send(MSG_OOB), waits for it, and clears it once
the byte is read with MSG_OOB. Linux keeps polling POLLPRI on the host.

select needs no change: libkernel's select passes exceptfds as Urgent to
the libSceNet poller, which already asks WSAPoll for POLLRDBAND, and it
does not take libkernel guest sockets on either host.

The guest send and recv refuse MSG_OOB, so urgent data only comes from a
peer outside the guest's sockets; guest_poll now sends it from a host
socket and checks that a connected pair and a non-blocking connect
report POLLOUT and not POLLPRI. TechnicalDebt records where Winsock's
answer differs from FreeBSD's once the stream passes the mark.

Depends on #3649 (poll on file descriptors), whose two commits this
branch carries, since the titles reach this stop only with it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 11:15:48 +02:00
ducloc080202 46c7766f4f feat(libSceSystemService): no-op sceSystemServiceShowControllerSettings 2026-10-13 16:05:00 +07:00
Dean 2a2a3dc650
Merge pull request #4226 from MarcZX100/codex/carry-wcsftime-3625
feat(libc): implement wcsftime
2026-10-13 22:01:10 +13:00
Dean 90285be0af
Merge pull request #4367 from MarcZX100/codex/carry-windows-alias-4260
fix(libc): alias non-contiguous shared guest views on Windows
2026-10-13 22:00:55 +13:00
alfalfa-star 0d61dad293 docs(agc): record the DCC key extent assumed for 3D color targets
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:00:28 +04:00
Dean 501f4f5aa7
Merge pull request #4835 from MarcZX100/fix/agc-init-version-error-4808
fix(agc): return error for unsupported init versions
2026-10-13 22:00:27 +13:00
alfalfa-star 1055617751 feat(agc): render layered draws into 3D color targets
A color view of several depth slices of a 3D target (CB_COLOR_VIEW
SLICE_START < SLICE_MAX) was rejected as "color views of several array
slices are unsupported". Titles render such volumes with one draw: an
instanced draw whose vertex stage picks each primitive's slice through
the misc position export (PA_CL_VS_OUT_CNTL USE_VTX_RENDER_TARGET_INDX
with VS_OUT_MISC_VEC_ENA).

Depends on #423, which carries PA_CL_VS_OUT_CNTL to the recompiler.

- DecodeColorBuffer takes the slice range of a 3D target
  (ColorTarget::layers, clamped to the surface's last slice), allows DCC
  on 3D targets, and sizes a tiled 3D target by its whole surface
  (SurfaceForTarget moves to State.cpp for that). DecodeState sets
  State::renderLayers and, for a layered draw, USE_VTX_RENDER_TARGET_INDX
  (State::layerExports); color targets of different slice counts and
  layered draws with a depth target throw.
- The driver adds State::layerExports to the PA_CL_VS_OUT_CNTL bits #423
  passes (it already passes VS_OUT_MISC_VEC_ENA), so the render target
  index reaches gl_Layer only for layered draws and stays ignored
  elsewhere as before.
- A vertex stage writing gl_Layer declares ShaderViewportIndexLayerEXT
  and SPV_EXT_shader_viewport_index_layer when the device offers them
  (the device enables VK_EXT_shader_viewport_index_layer when present),
  instead of SPIR-V 1.5 ShaderLayer, which a Vulkan 1.1 device cannot
  take. Graphics validation accepts the capability, the extension and a
  vertex Layer output when it is enabled, and a per-primitive Layer
  output of a mesh stage.
- The resident target's attachment view is a 2D array view of the
  slices, and the framebuffer has that many layers (Framebuffer and
  AcquireFramebuffer take the layer count).

The execution test agc_driver_layered_volume_draw draws three bands,
one per layer, into slices 1..3 of a 4-slice 64 KiB-tiled volume and
reads every slice back: slice 0 stays untouched and slice 1 + L holds
only band L. It also recompiles a mesh program with the layer export and
validates it against the layered state. The mesh case does not draw:
lavapipe's LLVM backend aborts compiling that mesh pipeline ("Cannot
emit physreg copy instruction"), which a test cannot catch. On RADV the
same mesh draw renders the bands into the right slices.

PPSA14632 (LEGO Horizon Adventures) renders its 64x64x64 RGBA16F
translucency lighting volumes (two DCC targets, 64 instances) this way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:00:04 +04:00
Celegans12 23342340cc feat(agc): implement quad tessellation with counter-clockwise output and level clamps
DecodeShaderStages accepted only clockwise triangle patches and no HOS
level clamp narrower than [1, 63], so terrain drawn as TRI_CCW quad
patches with VGT_HOS_MAX_TESS_LEVEL 9 aborted. Quad domains and TRI_CCW
now decode and emit Quads and VertexOrderCcw; isolines, other
partitionings and point or line output still throw.

VGT_HOS_MIN/MAX_TESS_LEVEL are read per draw and pushed in the last 8
bytes of the pre-rasterization push constant slot, where the hull reads
them to clamp its factors; they stay out of every key and the recompile
request, so one hull serves every level. Zero, negative and NaN outer
factors still cull; clamps outside 0 <= min <= 63, max >= 1,
min <= max throw. Quad hulls write four outer and two inner factors at
a 24-byte stride, the layout Mesa's TF ring store uses.
2026-10-13 10:56:16 +02:00
Rick 3fe04d4b72 feat(libc): implement atanhf
Dusklight (PPSA99305) imports atanhf (cPGyc5FGjy0) from
libSceLibcInternal.prx; the libc.prx it bundles only has a zero-return
stub for it.

The implementation follows the atanhf of the libc.prx bundled with
PPSA28319 (0x438a0), read from its disassembly: FreeBSD msun's
e_atanhf.c calling msun's s_log1pf.c, both as of 59bc2f09 (stable/9,
the revision the sinhf port took expm1f and expf from). The log1pf
paths for the positive arguments atanhf passes are inlined, as the
exported log1pf is still the host's. For |x| > 1, the infinities and
NaN, Sony's error helper raises FE_INVALID and sets errno to EDOM
before returning (x - x) / (x - x); for |x| = 1 it sets errno to
ERANGE before returning x / 0. Other arguments leave errno alone.

Running that code from the title's libc.prx on a Windows host gives
the same bits, errno and floating-point exceptions as the built
libc.prx for all 2^32 arguments, and msun's own e_atanhf.c and
s_log1pf.c built with the host compiler give the same bits. With the
host log1pf instead of the msun one, 4.7% of the arguments in [0, 1)
differ. guest_math pins bits for every branch reachable from atanhf,
both signs, and the errno and exception behaviour.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-13 10:48:06 +02:00