fix(libs): values measured on a PS5 (firmware 13.40) from inside retail games #7965
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7965"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-19T16:22:25Z.
What
Values measured on a PS5 on firmware 13.40 on 2026-10-19. Library calls were made inside retail game processes (Gran Turismo 7 PPSA01317, MLB The Show 25 PPSA23479) through ptrace remote calls: a payload attaches to the game, borrows a stopped thread, calls the export the game itself resolved and restores the thread. GPU results come from command buffers built by the probe and submitted with
sceAgcDriverSubmitDcb/sceAgcDriverSubmitAcbfrom inside GT7, including a gfx1013 compute kernel assembled with LLVM 18.sceKernelGetEventErrorwas measured in a plain payload process. Three code changes where the console disagrees with main (the touch pad values are onmainthrough #8138), and debt entries rewritten with the measured values where it agrees or where the code stays as it is.sceKernelGetEventError. It now returns 0 whenfflagsis 0 and0x80020000 | fflagsotherwise, whateverflagsanddatahold, as fpPS4 does. Main returneddatawhenEV_ERRORwas set. Console:{flags 0x4000, fflags 0, data 22}0,{0x4000, 0, -1}0,{0x4000, 0, 0x80020016}0,{0, 0, 0}0,{0x4000, 5, 0}0x80020005,{0x4000, 5, 22}0x80020005,{0, 7, 22}0x80020007,{0x8000, 3, 9}0x80020003.fflagsabove 0xFFFF were not measured, and that is where OR and addition differ, so they throw. The debt entry is rewritten and points out that video-out events, which carry their count infflags, now get 0x80020001 and up.scePadGetControllerInformationandscePadGetExtControllerInformationnow report stick dead zones 13 / 13 (main 2 / 2), which is what GT7's DualSense handle got on the console. Its touch pad answered 1920 x 1080 at 44.86, the values #8138 put onmain, and connection type 0, connected count 1, connected 1 and device class 0 already matched. The libScePad debt entry "Touchpad resolution" said the console's values were not measured; it now gives them.sceSystemServiceParamGetInt. Unknown parameters now return 0x80A10003 without writing, where main wrote 0 and returned 0. Parameters 7 (game parental level) and 1000 (enter button assignment) are no longer answered, because inside GT7 both returned 0x80A10003. Console: 0, 6, 7, 8-20, 401, 999, 1000 and 1001-1008 returned 0x80A10003, and a null value pointer did too, as main already does. 1 to 5 and 400 answered (1, 2, 0, -300, 1, 1 on that console), and 100 answered the value 0, which this PR keeps as an explicit case. A new debt entry records this.sceVideoOutGetResolutionStatus: the 48-byte layout is confirmed (GT7's handle 0x4e100100 on a 4K TV: 3840 x 2160, pane 3840 x 2160, refreshRate 3, screenSizeInInch 60.0f, flags 0). The repo still writes screenSizeInInch 0.sceVideoOutGetOutputStatusWithVrr: bytes 48-53 were the 16-bit values 48, 60, 60 on a TV that takes 120 Hz (the repo writes 0), and the null 0x80290002 and unknown-handle 0x8029000B codes match.sceVideoOutIsOutputSupported: the unsupported mode set matches exactly. Mode 18 answered 0x8029001E on this console, the third console measured, so it stays a throw.sceVideoOutGetVblankStatus: the third u64,reservedhere and written 0, is a running counter on the console. GT7's own call returned 0x1c485ffaadc at a processTime of 941 s, about 970 s at ~2 GHz, which fits a TSC. This is a new entry.WRITE_DATAwith DST_SEL 3 (control 0x00100300, also 0x06100300 with cache policy 3) did not write its label in direct memory, even after aRELEASE_MEMwith GL2 write-back and invalidate (0x00300514). A GDSCOPY_DATAat that address returned 0, while DST_SEL 1, 2 and 5 wrote. The console's ownsceAgcDcbWriteData(dst 6)emits 0x00110300, DST_SEL 3, as the repo's builder does. This PR records the measurement and does not change the code, because Killzone's fence still needs some path to the label that is not established. "COPY_DATA from the GPU clock": SRC_SEL 9 and theRELEASE_MEMDATA_SEL 3 timestamp are the same counter, measured at 98.0 and 99.8 MHz over two 1.1 s CPU intervals, so the repo's 10 ns model holds. New entry forsceAgcDriverSubmitAcb: queues 0x20, 0x30, 0x40, 0x50, 0x57 and 0x58 returned 0 and ran a buffer (the repo throws for 0x58), and queue 0x1F faulted inside the console's driver.src_shared_base/src_shared_limit0x80000000_00000000 / 0x80000000_FFFFFFFF andsrc_private_base/src_private_limit0x70000000_00000000 / 0x70000000_FFFFFFFF, the values the code already uses.s_memtimeadvanced 22.35 times faster thans_memrealtime(44,041,632 against 1,970,792 ticks over the same loop), which puts the core clock at ~2.23 GHz against the 100 MHz reference. The console runs alignment mode DWORD. A rawbuffer_load_dwordwith the V# base 1 byte past a dword, or an aligned base with voffset 1, returned the aligned dword 0x44332211 (not 0x55443322).s_buffer_load_dwordreturned 0x44332211 as the repo does, andbuffer_atomic_addat byte 0x0D updated the dword at 0x0C as the repo does. The raw-access difference is recorded in "V# bases off a DWORD boundary" with aCloses when:. The recompiler is not changed in this PR.Measurement logs and the full tables: the probe and the per-run logs can be attached on request.
Tested
Ubuntu 24.04 x86-64 container (GCC, Ninja, Release,
BUILD_TESTING=ON) under Rosetta on macOS, onmain892a4f132+ these commits:ctest -R "^(guest_pad|guest_equeue_events|guest_system_service_language|pad_input|pad_sdl|pad_input_mapping|pad_keyboard_mouse)$": 100% tests passed, 0 tests failed out of 7.guest_equeue_eventschecks every console case above plusfflags0xFFFF (0x8002FFFF) and a throw for 0x80000001.guest_padchecks the dead zones of both information calls, next to #8138's touch pad checks.guest_system_service_languagechecks that ids 0, 6, 7, 8, 20, 401, 999, 1000, 1001 and 1008 return 0x80A10003 without writing and with a null pointer, and that 100 answers 0. Since83a268a86libkernel refuses a host CPU without AVX2/BMI2, which the Rosetta container is, so theCheckHostCpucall inHostCpu.cppwas bypassed locally for this run only and is not part of the PR.python3 tools/check_conventions.py --base origin/mainreports 0 errors. Its warnings are debt-length on entries that were already over 1000 characters before this PR, plus "V# bases off a DWORD boundary" (1113 characters) ands_memtime(1311). Not tested: Windows and any title.Checklist
main; no other open PR implements the same functions (#7881 moves the pad information code and keeps the old dead zones)NotImplemented_nid_no_patch); silent stubs are listed in the technical debt file.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-19T16:46:46Z.
Review: COMMENTED
I checked the event-error and parameter changes against the recorded measurements.
sceKernelGetEventErrornow follows the measuredfflagscases independent ofEV_ERRORanddata, and it explicitly leaves values above the measured 16-bit range unsupported; the tests cover the 0xFFFF boundary and rejection above it. The system-service tests also check unknown IDs return the measured error without changing the output. The PR notes that Windows and physical touch-pad input were not tested. I did not independently rerun the reported Linux/Rosetta test matrix.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T17:27:09Z.
@frankea thanks for measuring these on a console. #8138 just merged (
3e7d1d297c) with the DualSense touchpad part of this PR: 1920x1080 in both controller-information calls, the x1079 finger scaling and the y 540 contacts, now in shared constants inPadState.hpp. That conflicts with this branch inExport.cpp,PadState.cpp,PadInput.cppandGuestPad.cpp.Could you rebase onto current
main? After that, the pad hunk should come down to the dead-zone change (2 -> 13), plus your measurement as the source for the 1080 value if you'd like to add it next to the constants. The equeue, system service and other measured values stay as they are. Once the head moves we'll re-run CI and the test build on it.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T02:04:49Z.
@oneandonlydean thanks. I merged current
main(892a4f132, with #8138) into the branch rather than rebasing, so no force-push was needed; the head is now78926e215after a second merge ofmain(20de55550). The pad change is down to the dead zones (2 -> 13 in both information calls), with aguest_padcheck next to #8138's touch pad checks.PadState.cpp,PadInput.cppand the touch constants aremain's as they are. Since the code takes no comments, the measurement went into the libScePad "Touchpad resolution" debt entry: it said the console's values were not measured, and it now says a PS5 on 13.40 reported 1920 by 1080 at 44.86 and dead zones of 13 to a retail title. The equeue, system service and debt-only parts are unchanged, and the PR description is updated to match.guest_pad,guest_equeue_events,guest_system_service_language,pad_input,pad_sdl,pad_input_mappingandpad_keyboard_mousepass in the Linux container onmain892a4f132+ this branch.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T02:06:37Z.
@frankea thanks for the console measurements and for trimming the touchpad entry. The values and their source (PS5 firmware 13.40, measured 2026-10-19 from a retail title's own calls) are exactly what these debt lines need.
One change before this can go in: the measurement sentences this PR adds name the title they were taken in, by name and title id, in
docs/dev/debt/libSceAgcDriver.md(3 lines),libSceSystemService.md(2) andlibSceVideoOut.md(4). The docs don't name individual titles, so please drop both the name and the id from those sentences and say something like "measured on a PS5 (firmware 13.40, 2026-10-19) inside a retail title". If the title matters for context, it belongs in the Game bring-up discussion, which the line can link to. Ids that were already in those entries before this PR can stay as they are.Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-21T02:12:17Z.
@oneandonlydean done in
62b29b6e7. The measurement sentences this PR adds no longer name the title or its id: each now says the value was measured on a PS5 (firmware 13.40, 2026-10-19) inside a retail title. That coverslibSceAgcDriver.md,libSceSystemService.mdandlibSceVideoOut.md, plus the same wording inshader.md. Ids that were already in those entries are unchanged.check_conventions.pyreports 0 errors.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xdCloudy on 2026-10-22T01:21:12Z.
@frankea, the overlap bot on my #9086 flags our shared
docs/dev/debt/libSceAgcDriver.mdhunk at main lines 11–12 as a conflict. My PR splitssceAgcDriverGetCoredumpAddressandsceAgcDriverSetTargetRingForDiagout of the unknown-functions entry; yours adds thesceAgcDriverSubmitAcbmeasurement nearby. I found no export or implementation overlap, and a pairwise merge-tree check confirms the debt-file conflict. I propose #7965 lands first, then I will rebase #9086 and reconcile the debt entry. I’ve listed #7965 as a proposed dependency on #9086. Does that order work for you?Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-22T08:56:32Z.
@xdCloudy that order works for me: #7965 first, then #9086 rebases. If #9086 happens to land first, I'll take the rebase on my side; the only overlap is the debt-file hunk you found.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-10-22T12:01:34Z.
Two titles that need the parameter 100 case. Since #9137,
mainthrows on it (sceSystemServiceParamGetInt: registry-backed parameter not implemented):41d551eb60) and #9459 onmaina6dcea9279, it boots to its title screen: "Press ✕ to play" is up by about 9 minutes in a 690 s run, with no stop. Your other changes here don't get in its way up to there, including parameters 7 and 1000 now answering 0x80A10003.maincc0078595dmerged in) with #9424. With #9591's parameter 100 case added, it throws on the same line again; a diagnostic build that prints the registry-backed reads shows parameters 208 and 210 next. Neither this PR nor #9591 covers those.#9591 adds the same parameter 100 case. A local change with only that case gave 007 the same result.
Linux 7.2.11 (Arch), RX 9070 XT, RADV Mesa 26.2.5, Release. One run each.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T12:19:13Z.
@frankea a data point for this PR's
sceSystemServiceParamGetIntvalues: since #9137 the call throws for ids 100-111, 200-213 and 300, and two titles now stop there. Marvel's Spider-Man 2 (PPSA03016) asks for 100, then 208 and 210 (hugodearaujo's run), and 007 First Light (PPSA11386) asks for 100 (#9458). This PR already covers 100. If you can measure 208 and 210 on your PS5 too, and any of 101-111, 200-213 and 300, those values would cover what Spider-Man 2 asks for at that point.