Repository navigation
Conversation
PS4 programs load system libraries with sceKernelLoadStartModule and their console path. The OpenOrbis piglet sample loads /<sandbox word>/common/lib/libScePigletv2VSH.sprx and libScePrecompiledShaders.sprx, the sandboxed form of /system/common/lib/ that sceKernelGetFsSandboxRandomWord names. The path was opened as a guest file and the load failed with ENOENT. A path in /system/common/lib/ or in the sandboxed /<word>/common/lib/ whose file name ends in .sprx now loads the host libs/<name>.prx, as libSceSysmodule does for module IDs. Names with a directory part are not mapped, so such a path cannot leave libs/.
PS4 titles ship sce_sys/param.sfo instead of param.json. When param.json is absent, the application metadata now reads the title, title ID, download data size and user defined parameters from param.sfo, and /data and /download0 are mounted for it as for param.json. param.json is still preferred when both files exist.
PS4 titles built with Sony's toolchain place a switch statement's jump
table in the code segment, after the last instruction of the function
that indexes it and inside the function's unwind range:
lea rcx, [rip + table]
movsxd rax, dword ptr [rcx + rax*4]
add rax, rcx
jmp rax
Code analysis decodes each function range from start to end, so it read
the table as instructions; the syscall scan and the call-site resolver
sweep the whole segment and lost their instruction boundaries there.
Limbo (CUSA01664) stopped at "Unsupported Windows guest TLS instruction
(bytes: 65 f9)" and Bloodborne (CUSA00900) at "Instruction exceeds 15
bytes".
FindInlineJumpTables decodes a function range, follows the table
address of each RIP-relative lea through 64-bit register moves, and
records the address a movsxd with scale 4 indexes when it lies later
in the same function. When decoding reaches the first such address and
every dword from there to the end of the function is an offset, from
the nearest table before it, to code before the first table, the rest
of the function is taken as tables. Anything else is decoded as before.
Code analysis stops each function there and keeps the control-flow
pass out of the tables; the pipeline fills them with nops in the copies
the syscall scan and the call-site resolver read.
# Conflicts: # core/relinker/relinker/src/guest/GuestImageReader.cpp
# Conflicts: # docs/dev/debt/libkernel.md
# Conflicts: # docs/dev/debt/relinker.md
# Conflicts: # docs/dev/debt/libkernel.md
…ction symbol Limbo's bundled libSceFios2.prx (CUSA01664) has DTPMOD64 relocations against a local section symbol of value 0. As for a TLS relocation without a symbol, the module and offset are the module's own TLS block, so such a relocation is passed on without its symbol; a section symbol with a value, or a module without PT_TLS, still fails.
Each GCN instruction is re-encoded to its RDNA form and decoded by the existing RDNA decoder, so the PS4 path shares the recompiler. Covers the legacy VS stage (program at the VS slot, user SGPRs from s0, vertex and instance index in v0-v3), fetch shaders linked as user-data calls, MIMG (image_sample and friends), PS4 buffer descriptors (GCN DATA_FORMAT / NUM_FORMAT, 44-bit base) and T# image descriptors (GCN tiling in word 7). The GCN switch is keyed into the shader disk cache. PS5 behaviour is unchanged: every PS4-only rule is gated on GcnGuestShaders().
PS4 color and depth targets, buffer and image descriptors and the PS4 tile modes (1D/2D thin and display, depth with tile split, PRT, linear general) on the AGC executor, with a GPU detiler for every mode. Textures sampled over the padded corner of a render target are GPU block copies, and the PS4 SDK pattern-fill compute kernel runs as a GPU fill (render targets and HTILE are cleared without a CPU drain), so Limbo holds 60 fps. Tests cover the tiling equations against addrlib formulas, the GPU detiler for every mode and element size, descriptors and fills.
Real sceGnm shader, state and draw packet writers, submit and submit-and-flip into the AGC executor, PS4 sync packets lowered to their PS5 forms, constant engine buffers merged into the draw buffer and the PS4 graphics EOP event. VideoOut accepts the PS4 10-bit display format.
NpTrophy reads the trophy count and icons from the title's trophy package (names are encrypted and stay not implemented), PS4 v1 save data calls wrap the native v2/v3 ones, NpWebApi library contexts, handles and push event filters work offline (service filters fail without a signed-in user), sceNpSetContentRestriction validates and stores. libSceAjm is built from the libSceAjm.native sources for PS4 titles, and Limbo's remaining imports are exported as not implemented.
Progress report (4777cac → 4562537)📈 System libraries: 43.31% (+0.08%, +28 implemented, +18 declared functions) ✅ 28 implemented
⚪ 10 behaviourally empty (constant return or throw)
🆕 18 declared as stubs
|
|
The current conventions run for head The same run flags the unchecked “One topic per PR” item. This PR currently combines relinker TLS relocation handling, GCN shader support, AGC target/tiling/fill behavior, GNM submission, and several library exports. |
What
Draft integration branch: PS4 titles on the AGC driver, with Limbo (CUSA01664) in game. This branch is
mainwith the pull requests below merged, so they can be tested together. It isn't meant to merge itself: the members merge one by one, each with its own review, and the branch is rebased down as they land. Details, how to run and the bring-up story are in #6978.libSceGnmDriverand VideoOutsceNpSetContentRestriction, which Limbo calls at startWith A, E and #9225 in
main, the branch is nowmain7e2ba73 plus #9430 to #9432, taken in with a merge commit so the pull requests other contributors opened against it (Get-fix#1 to #21) keep their base. Those join the table once each is open upstream with its own review; @ntamas94's #9671 to #9676 already are, on top of #9430 to #9432.Tested
On
main7e2ba73 with #9430 to #9432, Windows 11, WinLibs GCC 15.2, NVIDIA GeForce RTX 5060 Ti (driver 610.88):main. The 3 that fail also fail onmain7e2ba73 on this machine:agc_driver_sample_orderand its--grid-referenceand--recipe-depth-locationscases.mainagainst the branch with the same focused tests: the same 50VUID-errors in the same 8 existing PS5 tests, none added (details in feat(libSceGnmDriver): build PS4 command buffers and submit them #9432).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code