Commit Graph
14017 Commits
Author SHA1 Message Date
boykopovar b99472f7a6 Merge pull request #211 from ljkx/fix/decoder-rex-prefix-order
fix(relinker): ignore a REX prefix that is followed by another prefix
2026-10-01 21:21:44 +03:00
boykopovar de49f81697 Merge pull request #143 from SamG-Coder/codex/shader-geometry-validation
fix(shader): preserve NGG passthrough and wave32 launch inputs
2026-10-01 21:17:52 +03:00
boykopovar cfb1d76e60 Merge pull request #142 from SamG-Coder/codex/shader-interpolation-operands
fix(shader): preserve interpolation instruction operands
2026-10-01 21:17:16 +03:00
boykopovar cbf2bde178 Merge pull request #141 from SamG-Coder/codex/bounded-shader-jump-tables
feat(shader): lower bounded PC-relative jump tables
2026-10-01 21:16:14 +03:00
Adrià FranchandClaude eb85dc7362 fix(nid): share string suffixes when rebuilding .dynstr
The linker stores a dynamic string that is the suffix of another once
(for example "cos" inside "acos"). The patcher wrote every string
separately, so a library whose renamed exports do not shrink the table
enough failed with "rebuilt .dynstr exceeds original section size".
Strings are now sorted by their reversed text and a string that ends
another one points into it.

Co-Authored-By: Claude <[email protected]>
2026-10-01 20:09:41 +02:00
Adrià FranchandClaude 621c8bea23 feat(libScePad): implement scePadGetHandle and the embedded mic vibration option
scePadOpen now records that the pad is open and scePadClose clears it;
scePadGetHandle returns the handle for a port scePadOpen accepts while
the pad is open, and DEVICE_NO_HANDLE otherwise. No embedded microphone
is emulated, so the option that weakens trigger vibration while it is
in use is accepted with no effect.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:57:32 +02:00
Adrià FranchandClaude 76be6796dc fix(libs): correct VideoOut and Pad error codes
Ten libSceVideoOut and two libScePad error constants had values that
belong to other errors of the same library (for example INVALID_HANDLE
was 0x80290003 and RESOURCE_BUSY / SLOT_OCCUPIED were swapped). They now
match KytyPS5, shadPS4 and fpPS4, which agree on all of them.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:53:49 +02:00
Adrià FranchandClaude 2b36dc2408 feat(libScePlayGo): implement the language mask and to-do list
The title is fully installed, so scePlayGoGetLanguageMask reports every
language. scePlayGoSetToDoList validates the handle, entries, chunk IDs
and loci; nothing is pending, so the list is not kept.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:50:33 +02:00
Adrià FranchandClaude 97958bdd07 fix(libScePlayGo): use the library's error codes for bad pointer, handle and size
BAD_POINTER, BAD_HANDLE and BAD_SIZE were 0x80B20004, 0x80B20005 and
0x80B2000D, which are INVALID_ARGUMENT, NOT_INITIALIZED and BAD_SPEED.
They are 0x80B2000A, 0x80B20009 and 0x80B2000B.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:49:12 +02:00
Adrià FranchandClaude 62530c9d5c feat(libSceFiber): implement context size checking and the thread frame pointer
sceFiberStartContextSizeCheck and sceFiberStopContextSizeCheck toggle a
mode in which new fibers get their context filled with a pattern, so
sceFiberGetInfo can report the unused stack margin.
sceFiberGetThreadFramePointerAddress returns the frame pointer of the
thread that called sceFiberRun.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:27:24 +02:00
asimplestray c3a740b3e6 feat(shader): add ray tracing miss fallback mode 2026-10-01 17:24:09 +00:00
Adrià FranchandClaude ff532073f3 fix(tools): count exports that call a local stub wrapper as unimplemented
libSceAjm.native routes 13 exports through a static AjmStub helper that
calls NotImplemented_nid_no_patch, so the progress map counted them as
implemented. Calls to such helpers in the same file now count as stubs.
The compare report also lists functions that went back to stubs in its
header.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:23:55 +02:00
Adrià FranchandClaude 63501b6d73 feat(libSceKeyboard): implement the keyboard library
Keyboard input follows libSceMouse: the video out event loop forwards SDL
key and focus events, whose scancodes are USB HID usages, and the library
keeps the pressed keys, modifiers and lock LEDs in a 16-entry history for
sceKeyboardRead and a snapshot for sceKeyboardReadState.
sceKeyboardGetKey2Char translates the 101-key arrangement; the 106-key
one throws and is listed as technical debt.

KeyboardData holds 16 key codes (96 bytes), not 6.

Co-Authored-By: Claude <[email protected]>
2026-10-01 19:00:23 +02:00
MichonandClaude Opus 5.5 676bbea348 fix(libkernel): read, pread, AIO and APR write into guest memory as host writes
A file read into guest memory is a host write: before the I/O it pins the shared pages it
covers, which reopens any page armed for write tracking and keeps write tracking from arming
it again until the read ends, when the pages count as written. A destination the guest cannot
write fails with EFAULT before any I/O; read and pread throw as for any failed read, AIO
reports SCE_KERNEL_ERROR_EFAULT, and APR throws. APR also throws when a read ends before the
requested size.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 18:56:36 +02:00
MichonandClaude Opus 5.5 17eefbbbd9 fix(libc): reserve the guest arena at its fixed range around what Windows already placed in it
The arena is always [0x200000000, 0x7200000000). Every free, allocation-granularity-aligned
piece of the range is reserved as a placeholder; what lies between the pieces (thread stacks
and other reservations Windows made before libc starts, unaligned slivers) and the
system-reserved range are holes, used ranges a release never frees. A failed query or
reservation of the range throws.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 18:50:15 +02:00
Adrià FranchandClaude fb6580ae36 feat(libSceCesCs): convert single characters between CP1252 and UTF-8
sceCesRefersUcsProfileCp1252 returns the CP1252 profile, and
sceCesSbcToUtf8 / sceCesUtf8ToSbc convert one character in each
direction. The five bytes CP1252 leaves undefined map to the matching
C1 controls, so every byte round-trips. Malformed UTF-8 and code points
outside CP1252 return the library's error codes.

Co-Authored-By: Claude <[email protected]>
2026-10-01 18:41:25 +02:00
Adrià FranchandClaude c548cd25b7 feat(libSceSsl): implement CA certificate queries and sceHttp2AbortRequest
sceSslGetCaCerts reports that no CA certificates are available and
sceSslFreeCaCerts clears the structure, in line with the library's
no-network behaviour. sceHttp2AbortRequest succeeds like
sceHttpAbortRequest. sceSslClose and sceSslGetSerialNumber keep throwing
and are listed as unknown signatures.

Co-Authored-By: Claude <[email protected]>
2026-10-01 18:35:02 +02:00
Adrià FranchandClaude 0a8cc7f543 feat(libSceHttp): implement URI parse, build and escape
sceHttpUriParse, sceHttpUriBuild and sceHttpUriEscape work on strings
only and are implemented. sceHttpCreateRequestWithURL, sceHttpReadData,
sceHttpSetChunkedTransferEnabled and sceHttpCreateEpoll follow the
existing no-network behaviour.

Co-Authored-By: Claude <[email protected]>
2026-10-01 18:15:50 +02:00
asimplestray b15f6800dd feat(shader): implement VOP3 I16/U16 min/max/med3 2026-10-01 16:11:33 +00:00
Yossi Yadgar 53d4ef41d2 feat(relinker): load the fs:[0] thread pointer into any register in Windows guest code 2026-10-01 18:42:14 +03:00
RomainROCH 91dd508c85 fix(libkernel): clear directory metadata on close 2026-10-01 16:48:10 +02:00
RomainROCH d7f89a6654 fix(savedata): preserve existing saves on replace failure 2026-10-01 16:40:38 +02:00
julienlgy 0c4dace39e feat(libSceHmd): add a disconnected-headset HLE stub 2026-10-01 14:18:10 +02:00
Dean Galvin b37365d2dd fix(recompiler): zero the high half of 16-bit SDWA results written as a whole dword
A 16-bit VOP1/VOP2 result in SDWA form with dst_sel:DWORD writes the whole register, so with
dst_unused:UNUSED_PAD the high half is zero. write16Bits treated dst_sel:DWORD as the plain
encoding and kept the old high half, which is right only for the non-SDWA form (GFX10 16-bit
instructions preserve the high bits). The decoder already marks SDWA destinations with
explicitSdwaDst; write16Bits now sends those through writeRawU32 like the other selectors.

GFX10 compilers rely on this to zero-extend f16 results before packing two of them with an
integer add, e.g. v_cvt_f16_f32_sdwa ... dst_sel:DWORD dst_unused:UNUSED_PAD followed by
v_lshl_add_u32 v2, hi, 16, lo. PPSA21564's FidelityFX depth-of-field combine pass packs its
near/far colours into LDS this way 60 times: whatever the low register held before leaked
into the high half, so green (and alpha) of the packed pairs came back huge or infinite while
red and blue stayed right. The bloom then spread the bad green over the intro cinematic.

agc_driver_sdwa_destination_tests runs the padded, preserved and plain encodings and the
packing idiom on the GPU against a model of the guest instructions.
2026-10-02 01:07:59 +13:00
Alberto RuizandClaude Opus 5.5 cc3d2d21ef fix(shader): skip the push constant copy when there is nothing to copy
decodeResult and decodeAllocation called memcpy with the data() of
empty vectors, which may be null. Passing a null pointer to memcpy is
undefined even for a zero size, and UBSan reports it on every entry
without push constants, including the existing shader disk cache test.
The copy now runs only for a non-empty table, as Reader::Values does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R5WJS4ZdQynAJesCZKH5hb
2026-10-01 13:28:36 +02:00
ljkxandClaude Opus 5.5 d54dfb1595 fix(relinker): ignore a REX prefix that is followed by another prefix
In 64-bit mode a REX prefix only takes effect when it immediately
precedes the opcode; a REX followed by a legacy prefix or another REX is
ignored. The instruction decoder, the rewriter's reference classifier,
DecodedInstruction and the SSE4a, SHA-256 and CLZERO operand decoders
read legacy prefixes and then at most one REX. `48 F3 0F 2B 00`
(MOVNTSS) was therefore scanned as `[48 F3][0F 2B 00]` and kept, and
`48 67 0F 01 FC` lost its address-size prefix.

All of them now accept REX bytes among the prefixes and keep only one
that directly precedes the opcode. The converter's guard against
prefix-only fragments is removed, since the decoder no longer produces
them, and the TechnicalDebt entry describing the split is dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 13:09:11 +02:00
boykopovar bc51b337ad Merge pull request #148 from SamG-Coder/codex/shader-corpus-instructions
feat(shader): support 24-bit high products and fix image sample variants
2026-10-01 13:45:19 +03:00
SamG-Coder 5bcb6eae3e fix(shader): version passthrough requests after upstream pixel layout 2026-10-01 20:44:28 +10:00
SamG-Coder d9482ea3ae fix(agc): exclude hidden mesh words from vertex table lookup 2026-10-01 20:44:28 +10:00
SamG-Coder 4cd8e35366 fix(shader): preserve NGG passthrough launch and primitive inputs 2026-10-01 20:43:17 +10:00
boykopovar 131156c5d0 Merge pull request #209 from ljkx/feat/clzero-to-intel
feat(relinker): lower CLZERO for --to-intel
2026-10-01 13:43:09 +03:00
SamG-Coder 785c24e652 fix(shader): derive mesh launch state from guest wave size 2026-10-01 20:42:49 +10:00
SamG-Coder 7fea9dec9b test(agc): build mesh smoke test on Windows 2026-10-01 20:42:49 +10:00
boykopovar c088b87399 Merge pull request #210 from boykopovar/refactor/agc-driver-exec-cpp
Refactor/agc driver exec cpp
The driver for the libSceAgcDriver library written in #5 turned out to be at least four times more performant than the one originally included in the project. However, the Driver.cpp file turned out to be too large; it is now split into multiple files located in subfolders (the include structure is the same). The behavior remained unchanged.
2026-10-01 13:38:50 +03:00
SamG-Coder dfdbeae901 fix(shader): preserve comparison image flags in disk cache 2026-10-01 20:36:28 +10:00
boykopovar 4a82f04113 refactor(agc): organize driver modules into subdirectories 2026-10-01 13:31:24 +03:00
ljkxandClaude Opus 5.5 09cb86b076 feat(relinker): lower CLZERO for --to-intel
Lower CLZERO out of line instead of failing the relink: the 64-byte line
containing rAX (EAX with 67h) is cleared with four MOVNTDQ stores of
zero, the same non-temporal, weakly ordered store. The line address is
masked in xmm0 so RFLAGS stays untouched; xmm0 and rcx are spilled below
the red zone. Short sites share stubs through MatchSequence. CLZERO with
LOCK, an FS/GS override, a 66/F2/F3 prefix or longer than 15 bytes fails
the relink.

The decoder splits a REX followed by another prefix into a separate
instruction, which would hide a prefix that changes what CLZERO or the
next instruction does. The converter now fails the relink when such a
prefix-only fragment directly precedes an AMD-only instruction or would
be moved into a stub as a trailing instruction.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-01 12:30:35 +02:00
boykopovar 98b175f938 refactor(agc): fix deps after splitting 2026-10-01 13:24:48 +03:00
SamG-Coder 7bcde3ba95 fix(tools): count tested shared shader instruction variants 2026-10-01 20:23:58 +10:00
SamG-Coder f5e1fcfad3 fix(agc): bind native depth textures for comparison sampling 2026-10-01 20:23:58 +10:00
SamG-Coder ba22c37d17 fix(shader): preserve constant offsets in image sampling 2026-10-01 20:23:21 +10:00
SamG-Coder 70cb9e2eaf feat(shader): translate signed and unsigned 24-bit high products 2026-10-01 20:23:21 +10:00
SamG-Coder 1571ec6914 feat(shader): lower bounded PC-relative jump tables 2026-10-01 20:19:03 +10:00
boykopovar 719b9328b3 refactor(agc): split driver into logical modules 2026-10-01 13:18:40 +03:00
SamG-Coder c329ad26b7 fix(shader): preserve upstream parameter validation during interpolation 2026-10-01 20:15:52 +10:00
SamG-Coder a8311e9d1a fix(shader): preserve interpolation instruction operands 2026-10-01 20:11:53 +10:00
boykopovar c7fb2575a3 Merge pull request #208 from boykopovar/refactor/split-libs-tests-cmake
Refactor/split libs tests cmake
- Moved test inclusions from `core/libs/CMakeLists.txt` to local library CMakeLists.txt files.
- Created CMakeLists.txt files for `libSceSystemService, libSceContentExport, libSceNet, libSceNetCtl, libSceRandom, libSceRtc, libSceJson2, and libSceFiber`.
- The shared libSceNet/libSceNetCtl test is included in libSceNet.
- Added the shared function add_test_executable for hosting test executables.
- Added add_png_decoder(target runtimeTarget) and add_jpeg_decoder(target runtimeTarget). The runtimeTarget parameter is required; libc is currently passed. A non-existent target causes a CMake error. - The decoder is used by the PRX libraries, meaning exceptions from there should be thrown through our libc.prx.

Changed file locations relative to the build folder (previously they were stored in core/libs):
- tests/ - all test executables
- `core/libs/libs/implib/` - PRX import libraries (*.dll.a)

The number of tests found has not changed (88)
2026-10-01 12:55:05 +03:00
boykopovar f694c1387c Merge pull request #201 from ljkx/feat/monitorx-mwaitx-to-intel
feat(relinker): lower MONITORX and MWAITX for --to-intel
2026-10-01 12:50:04 +03:00
boykopovar bbba29ea61 refactor(cmake): add local library configs and move test definitions 2026-10-01 12:44:01 +03:00
boykopovar a32715f71f refactor(cmake): require explicit runtime target for png and jpeg decoders 2026-10-01 12:38:06 +03:00