Commit Graph
6138 Commits
Author SHA1 Message Date
Kikoarl e2974fc4db feat(shader): implement S_SCRATCH_LOAD_DWORD, S_SCRATCH_LOAD_DWORDX2 and S_SCRATCH_LOAD_DWORDX4 2026-10-06 00:12:39 +02:00
Krzysztof Hasiński 09e41584ca fix(shader): apply f32 abs and neg source modifiers on the sign bit
F32 operands applied |x| and -x as FAbs and OpFNegate. The NVIDIA driver
returns its canonical NaN 0x7fffffff from FAbs of a NaN with a payload,
so an instruction that passes a NaN operand through on the bits, such as
v_div_fixup_f32 with |v5| = 0x7ff00000, loses the payload. RADV and
lavapipe keep it.

Clear or flip the sign bit instead, as readOperand already does for U32
operands. IEEE 754 defines abs and negate as sign-bit operations, so this
is exact for every input.
2026-10-06 00:04:14 +02:00
Celegans12 3a48a57dc7 feat(agc): encode the DCC clear codes of A2R10G10B10 color targets
LayoutFor had no case for VK_FORMAT_A2R10G10B10_UNORM_PACK32, the format
of a COLOR_2_10_10_10 color target with the alternate component swap, so
FillDccClear could not encode its 0001, 1110 and 1111 clear codes. The
format now takes the A2B10G10R10 layout: the codes set the three color
channels alike, so both packings give the same words.

A draw into a copied target under these keys now starts from the clear
value instead of the stored texels, and clearTexel (the CB metadata pass
and storeClearTexels) returns the texel instead of throwing. Textures
and resident targets, stored as A2B10G10R10, and DccAlphaOnMsb are
unchanged. Split out of #648.
2026-10-05 23:45:16 +02:00
Celegans12 241faf881e feat(agc): present DCC display buffers whose keys are uncompressed or fast-cleared
sceVideoOutRegisterBuffers2 threw "DCC presentation is not implemented"
for category 1 (DCC-compressed) buffers, which PPSA26344 registers. Such
a buffer now needs DCC metadata and the tiled layout, and dcc_control may
only use the CB_DCC_CONTROL block layout bits 0x10026c.

At a flip the keys are read behind their recorded writers, one byte per
256 bytes as in the driver's DCC model. Uncompressed keys present the
stored texels as before; a uniform clear code presents its color with a
GPU clear of the scaler's source image; a pending storage image is used
when it serves the keys. Mixed or unreadable keys, clear codes the
display format has no DCC encoding for, register-clear keys over a
pending image and a clear color wider than 32 bits throw. Buffers
without DCC take the old path.
2026-10-05 23:45:15 +02:00
Dean bc24783e5b Merge pull request #733 from alfalfa-star/fix/relinker-duplicate-guest-exports
fix(relinker): allow duplicate Linux guest exports that no module imports
2026-10-06 10:34:07 +13:00
Tomás Ortellado 669c7a40fa feat(http): implement response header parsing 2026-10-05 18:32:47 -03:00
Dean f00750e7bd Merge pull request #461 from oneandonlydean/feat/font-system-font-sets
feat(font): open system font sets from a font directory
2026-10-06 10:30:44 +13:00
Dean Galvin 9d4e6d2f28 feat(font): open system font sets from a font directory
sceFontOpenFontSet failed for every set type, so PPSA21564 drew no text
in system fonts (the title screen copyright line, credits, button
guides). It now loads the set's primary font file from
ANYPS5_SYSTEM_FONTS, or anyps5-fonts beside the executable: console
files under their own names first, then openly licensed substitutes
(Noto Sans, Noto Sans Mono, Noto Sans Thai, Noto Sans CJK). The
PS5-only JG2 set types are accepted.

System font handles use the system font context. Their faces are
loaded by FreeType in host memory: about 1 MiB per CJK face does not
fit the font memory the title sizes for the console's fonts, and
sceFontCreateRenderer then failed with ALLOCATION_FAILED. Handles of
the same font file share one copy of its bytes.
2026-10-06 10:27:09 +13:00
Merijn aaefea9626 Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into feat/userservice-age-level
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-05 23:24:52 +02:00
MerijnandClaude Opus 5.5 dd2890c1c5 feat(libkernel): deliver sceKernelRaiseException on Windows
Run the SIGUSR1 handler recorded by sceKernelInstallExceptionHandler on the
target thread with a PS5 ucontext (uc_mcontext at 0x40, FreeBSD amd64
layout) of its interrupted state:

- on the calling thread, directly;
- on a thread in a libkernel wait, from an APC: the TimedWait waits are
  alertable and count themselves in a per-thread wait state, so the
  handler runs inside the wait, which then continues;
- on a running thread, by suspending it and redirecting it to an entry
  that calls the handler and restores the possibly modified context.

Other signals return EINVAL, as in shadPS4; raising without a handler
throws. Linux still throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 23:19:38 +02:00
MerijnandClaude Opus 5.5 d82bae0934 feat(libs): add exports imported by PPSA12544's Unity plugins
PPSA12544's Media/Plugins modules (CommonDialog, PSN, Share) import
libSceVrSetupDialog, which no library provided, and Share, NpTrophy2,
WebBrowserDialog and NpEntitlementAccess functions that were not
exported. Add libSceVrSetupDialog and the missing functions as
unimplemented exports, except
sceNpEntitlementAccessRequestConsumeServiceEntitlement, which reports
SCE_NP_ERROR_SIGNED_OUT like
sceNpEntitlementAccessRequestConsumeUnifiedEntitlement. Their other
imports are covered by #734 and #369, and two by #407.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 23:18:46 +02:00
MerijnandClaude Opus 5.5 6ffc81a969 feat(msgdialog): add progress bar calls to libSceMsgDialog.native
PPSA12544's Unity plugins (CommonDialog, PSN) import
sceMsgDialogProgressBarInc, sceMsgDialogProgressBarSetMsg and
sceMsgDialogProgressBarSetValue from libSceMsgDialog.native, which did
not export them. As in libSceMsgDialog, they succeed while a dialog is
running and return COMMON_DIALOG_ERROR_NOT_RUNNING otherwise; the native
dialog finishes in sceMsgDialogOpen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 23:15:28 +02:00
MerijnandClaude Opus 5.5 fd37c58391 fix(libkernel): report the stack of adopted threads
scePthreadAttrGet reported a null stack address and a zero size for an
adopted thread (the main thread), and for every guest thread on Linux,
where the stack range was never recorded. A garbage collector that scans
thread stacks through scePthreadAttrGetstackaddr and
scePthreadAttrGetstacksize (Unity IL2CPP in PPSA12544) then skipped the
main thread's stack and freed objects it still referenced. The range now
comes from the host thread: GetCurrentThreadStackLimits on Windows,
pthread_getattr_np on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 23:00:41 +02:00
Chad 4d10fd1796 Merge branch 'feat/amm-remap-protect' into feat/amm-prt 2026-10-05 16:00:02 -05:00
Chad e15c039ef8 Merge branch 'feat/amm-core' into feat/amm-remap-protect 2026-10-05 16:00:01 -05:00
ChadandClaude Opus 5.5 710369f3d3 test(libs): access aliased AMM mappings through volatile references
The AMM test writes through one mapping of a physical page and reads it
through another. The two addresses are distinct to the compiler, so GCC
13 at -O2 moved the read ahead of the write and the Linux CI check saw
the old value. The test's At helper now returns a volatile reference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:59:59 -05:00
Chad 453874d1d8 Merge branch 'feat/amm-remap-protect' into feat/amm-prt 2026-10-05 15:56:51 -05:00
Chad 11e9f6e0ab Merge branch 'feat/amm-core' into feat/amm-remap-protect 2026-10-05 15:56:49 -05:00
ChadandClaude Opus 5.5 164fcf7a05 test(libs): report the failing line of the AMPR tests
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:56:48 -05:00
MerijnandClaude Opus 5.5 73a0bc5eb4 feat(libkernel): record exception handlers
sceKernelInstallExceptionHandler and sceKernelRemoveExceptionHandler threw.
They now keep one handler per allowed signal (SIGHUP, SIGILL, SIGFPE,
SIGBUS, SIGSEGV, SIGUSR1, as in shadPS4): another signal or a null handler
returns EINVAL, a second handler for a signal returns EAGAIN, and removing
clears it. Delivery is not implemented and is recorded in the technical
debt; sceKernelRaiseException still throws.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 22:50:24 +02:00
MerijnandClaude Opus 5.5 9489b851ae fix(libkernel): read defaultLanguage from localizedParameters
A PS5 param.json keeps defaultLanguage inside localizedParameters, next to
the language entries. The parser looked for it at the root only, then fell
back to en-US and to the first member, which is the defaultLanguage string
when no en-US entry exists (PPSA12544 has only en-GB), and threw
"expected JSON object". defaultLanguage is now read from
localizedParameters first, and the fallback takes the first language
object.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 22:48:06 +02:00
ChadandClaude Opus 5.5 cf3d0f6fc7 feat(libs): implement the AMM PRT commands
sceAmprAmmCommandBufferMapAsPrt, AllocatePaForPrt, RemapIntoPrt and
UnmapToPrt, with the MapAsPrt and AllocatePaForPrt measures. Signatures,
checks and their order follow ampr_emu.

The executor keeps the PRT pages of the AMM ranges. Unbacked PRT pages
are zero-filled with GPU read access; AllocatePaForPrt backs each
unbacked page with a pool page and changes the type and protection of
backed ones; RemapIntoPrt moves a mapped range into a PRT range; and
UnmapToPrt returns the pages to the pool and zero-fills them again. A
plain map, unmap or remap over a PRT range ends it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:45:28 -05:00
MerijnandClaude Opus 5.5 d4eed90b54 fix(videoout): report unavailable output modes instead of throwing
sceVideoOutIsOutputSupported threw VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE
for every mode other than the default and 119.88 Hz, and
sceVideoOutConfigureOutput threw for an unavailable 119.88 Hz mode. Titles
probe and request modes the display may lack and handle the result:
PPSA12544 asks for 0xd000000a and falls back to 3840 pixels when it is not
supported, and its sceVideoOutConfigureOutput caller switches on the
returned error codes, including VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.
Every mode except the default now reports 0, and configuring one returns
VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 22:45:12 +02:00
Chad 6c21041d0d Merge branch 'feat/amm-core' into feat/amm-remap-protect 2026-10-05 15:41:57 -05:00
ChadandClaude Opus 5.5 0cb5ca7203 fix(libs): take the AMM submit checks from ampr_emu
The AMM submit forms now return EINVAL for a priority above 2 and EPERM
for a null command buffer, in that order, as ampr_emu's
amm_validate_submit_args does, instead of EINVAL for a null buffer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:41:49 -05:00
Celegans12 41fc6c631c feat(shader): implement s_swappc_b64 null, long branches and dword jump tables
SOP1 opcode 33 with SDST null keeps no return address, so it is exactly
s_setpc_b64; the decoder now reads it that way, as KytyPS5 does. A call
with a real destination still throws "unsupported SOP1 opcode 33".

GraphBuilder resolves two more jump shapes. A long branch is
s_getpc_b64 and s_add_u32/s_addc_u32 or s_sub_u32/s_subb_u32
immediates, also through vcc, all in one block. A dword jump table
branches to the table base minus an entry that s_load_dword reads at an
index bounded by s_min_u32 and scaled by 4; the resolver follows
register writes back through straight-line code, and anything else is
still refused. The code table load now also handles one-dword entries.

agc_shader_control_flow checks the decode, the graphs and the refusals;
the new agc_driver_scalar_swappc runs all shapes on the GPU.
2026-10-05 22:41:39 +02:00
ChadandClaude Opus 5.5 166ea44993 feat(libs): implement the AMM remap, multimap and protection changes
libSceAmpr gains sceAmprAmmCommandBufferRemap, MultiMap, ModifyProtect
and ModifyMtypeProtect with their GPU mask forms and the eight measure
functions. Signatures and the protection and mask checks follow ampr_emu.

The executor keeps a page table of the AMM ranges: each page's physical
offset, protection, memory type and whether it came from the pool. A
remap moves the pages of a fully mapped range and leaves the old range
reserved; a multimap maps the same pages again; a pool page returns to
the pool only when its last mapping goes. A protection change applies
the masked bits page by page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:36:24 -05:00
Dean 2707b3a3c8 Merge pull request #736 from adriadam10/feat/libc-wcsrtombs-s
feat(libc): implement wcsrtombs_s
2026-10-06 09:31:24 +13:00
Dean 2811e0106f Merge pull request #731 from adriadam10/feat/libc-xtime-get-ticks
feat(libc): implement _Xtime_get_ticks
2026-10-06 09:30:42 +13:00
ChadandClaude Opus 5.5 c16e59bfd5 feat(libs): implement the AMM map, map direct and unmap commands and the APR map region
libSceAmpr gains the AMM command buffer (constructor, destructor, map,
map direct and unmap, with their GPU mask forms and measures),
sceAmprAmmGiveDirectMemory, sceAmprAmmGetVirtualAddressRanges, the three
submit forms and sceAmprAmmWaitCommandBufferCompletion. The APR
MapBegin, MapDirectBegin and MapEnd commands and their measures record
the same map commands.

The libkernel executor now maps: a plain map takes pages from the direct
memory given to the mapper with usage 1, a direct map uses the given
offset, and an unmap returns the pages to that pool and leaves the range
reserved. The AMM ranges are reserved in the guest arena on first use.
Commands are walked by the buffer's byte offset so an AMM submission can
run raw command memory.

Signatures, the protection mask and the APR map rules follow ampr_emu;
the mapper model follows PS5PCEM. While an APR map region is open, a
second begin and every completion write return EPERM.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:29:33 -05:00
ChadandClaude Opus 5.5 4b336335a8 feat(libs): implement the APR gather and scatter reads
sceAmprAprCommandBufferReadFileGather, ReadFileScatter,
ReadFileGatherScatter and ResetGatherScatterState, with their measure
functions. Signatures, argument checks and the read cursor follow
ampr_emu: each read leaves the file, the next offset and the next
destination; a gather reads at a new offset into the next destination, a
scatter continues in the file into a new destination, and a
gather-scatter takes both. Recording one needs a file read since the last
reset, tracked in the command buffer object next to its type.

sceAmprAprCommandBufferReadFile now applies the same length, offset and
destination checks and rejects a null command buffer instead of
dereferencing it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:12:34 -05:00
ChadandClaude Opus 5.5 636fb5edae feat(libs): implement the AMPR 04_00 counter commands and the construct helpers
sceAmprCommandBufferWaitOnCounter_04_00 and WriteCounter_04_00 take the
counter access size and offset, the wait mask and the write operation,
with their measure functions; ConstructNop records a nop with an optional
leading word and a payload of up to 60 bytes, and ConstructMarker records
the set, push and pop markers by type. Signatures and checks follow
ampr_emu.

The executor now reads and writes counters by access: the 8-byte access
of counter n spans n and n + 1, the 2- and 1-byte accesses a half or a
byte of the counter. Waits compare at the access width, so the signed and
wrapped compares see the field's own sign bit, and the atomic writes wrap
within the field. The legacy counter commands record a 4-byte access.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 15:02:30 -05:00
Jakub Krasuski f91e13447d fix(net): return SCE_NET_ERROR codes from failing sceNet calls
Every failing sceNet function returned -1 and left the code only in
sceNetErrnoLoc. The functions return the errno combined with
0x80410100 (SCE_NET_ERROR_*), as the resolver paths of this file
already do with RESOLVER_ENODNS and as shadPS4 and fpPS4 do for the
whole library. A title that compares the result with
SCE_NET_ERROR_EWOULDBLOCK saw a non-blocking receive without data as
an unknown failure.

Assisted-by: Claude Opus 5.5
2026-10-05 21:58:21 +02:00
Jakub Krasuski 01220faa1a fix(net): keep SIGPIPE from killing the process on Linux sends
sceNetSend and sceNetSendto called send and sendto without
MSG_NOSIGNAL, so a send on a connection the peer had closed raised
SIGPIPE and terminated the process. shadPS4 has sceNetSend pass
0x20000, FreeBSD's MSG_NOSIGNAL, down to sendto, so a title gets the
error back instead of a signal.

Pass MSG_NOSIGNAL on Linux and translate EPIPE, which fell through to
EIO.

Assisted-by: Claude Opus 5.5
2026-10-05 21:57:20 +02:00
RomainROCH 12c229d19a fix(jpegenc): honor chroma sampling and encode true grayscale JPEGs 2026-10-05 21:49:36 +02:00
ChadandClaude Opus 5.5 d4f7ddaa1a fix(agc): count the one-dword NOP pad as one dword in range predication
0xffff1000 is a type-3 NOP whose count field is 0x3fff, which the command
processor reads as a single dword. sceAgcSetRangePredication read it as a
16385-dword packet and skipped the packets after it, or threw in a short
range. It is now stepped over like a type-2 filler.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-05 14:49:17 -05:00
Chad 4882413217 Merge remote-tracking branch 'upstream/main' into feat/agc-predication
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-05 14:48:11 -05:00
Chad c3ab220e45 Merge remote-tracking branch 'upstream/main' into feat/ampr-nop-04-writes
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-05 14:46:31 -05:00
Jakub Krasuski cefdea7d14 fix(libkernel): report EINVAL, EACCES, ENOBUFS, ETIMEDOUT and EINTR from Linux sockets
The Linux branch of NativeError lacked five codes the Windows branch
already translates, so they fell through to EIO. bind on a bound socket
and accept on a socket that is not listening set errno to 5 on Linux
and to 22 on Windows.

Assisted-by: Claude Opus 5.5
2026-10-05 21:41:12 +02:00
Dean 681f83e51e Merge pull request #713 from adriadam10/feat/savedata-ps4-transfer
feat(savedata): implement the PS4 transfer mount and directory search
2026-10-06 08:14:26 +13:00
Dean a2da600645 Merge pull request #712 from adriadam10/feat/share-capture-screenshot-extended
feat(libSceShare): sceShareCaptureScreenshotExtended
2026-10-06 08:13:44 +13:00
Dean 7d6afbc4d9 Merge pull request #711 from adriadam10/feat/playgodialog-getstatus
feat(libs): implement scePlayGoDialogGetStatus
2026-10-06 08:13:01 +13:00
Dean d66925cd5f Merge pull request #708 from adriadam10/feat/http-inflate-gzip
feat(http): name sceHttpSetInflateGZIPEnabled and sceHttpSetRequestStatusCallback
2026-10-06 08:12:50 +13:00
Dean 949de6665b Merge pull request #707 from adriadam10/feat/ulobjmgr-register
feat(ulobjmgr): register and unregister object
2026-10-06 08:12:08 +13:00
Dean 74dda5d30a Merge pull request #703 from adriadam10/feat/nptrophy2-unregister-unlock-callback
feat(libs): implement sceNpTrophy2UnregisterUnlockCallback
2026-10-06 08:11:26 +13:00
Dean 369605bf70 Merge pull request #681 from Raghav314/fix/ajm-batch-wait-release
fix(ajm): release a batch when sceAjmBatchWait returns
2026-10-06 08:10:44 +13:00
Dean 1c2ccd838c Merge pull request #655 from NumberGuan/codex/fix-rtc-rfc3339-offsets
fix(rtc): reject invalid RFC 3339 formatting offsets
2026-10-06 08:10:00 +13:00
Dean 170ef4a28f Merge pull request #649 from Celegans12/feat/audioout2-3d-latency
feat(audioout): implement sceAudioOut2Set3DLatency and accept sceAudioOut2MasteringInit(0)
2026-10-06 08:09:17 +13:00
Dean d99194f6e9 Merge pull request #645 from Celegans12/feat/voiceqos-exports
feat(voiceqos): declare the missing libSceVoiceQoS exports
2026-10-06 08:08:34 +13:00
Dean fa9b2ed0ba Merge pull request #643 from Celegans12/feat/msgdialog-native-close
feat(msgdialog): implement sceMsgDialogClose in libSceMsgDialog.native
2026-10-06 08:07:51 +13:00