fix(libSceVideoRecordingP): answer parameter checks and calls without a recorder as a PS5 does #11478
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11478"
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-26T16:27:00Z.
What
NHL 26 (PPSA26785) imports
sceVideoRecordingOpen,Close,QueryMemSize,Start,Stop,GetStatus,GetInfoandSetInfo. The first five threw on every call. They now answer as a PS5 does before a recorder exists, which is the only state this library has:sceVideoRecordingStart,StopandClosereturn 0x80A80006 (no recorder open), matchingGetStatus's 0 andGetInfo's 0x80A80006 already onmain.sceVideoRecordingQueryMemSizechecks the parameter block as the console does: 0x80A80003 for a null block, a size field below 16, a duration outside 1 to 3600 seconds, a mode or option above 1, or an unknown format; 0x80A80008 for option 1 without a format; 0x1000 for a block with neither option nor format, including a block whose size field ends before them. A block with a video format (1, 2, 0x10, 0x11, 0x28, 0x40 or 0x41) still throws: its heap size comes from the recorder's MP4 index sizing, which is not implemented.sceVideoRecordingOpenreturns 0x80A80003 for a null path, block or heap and for a negative heap size,QueryMemSize's error for a block it refuses, and 0x80A80003 for a block that needs 0x1000 bytes with a smaller heap. Anything it would accept throws, since there is no recording session.VideoRecordingParamhad the thread priority at 8 and the duration at 12. The console reads the duration at 8, the mode at 12, an affinity mask at 16, the thread priority at 24, two fields at 28 and 32 that must be 0 or 1 (output mode and option, asVideoRecordingParam2names them) and the format at 36. The struct now follows that layout, 64 bytes as NHL 26 fills it.VideoRecordingParam2andOpen2are unchanged (13.40's module does not exportOpen2).Measurement: PS5 on firmware 13.40, inside Gran Turismo 7 (PPSA01317). PS5 titles bind these imports to
libSceVideoRecording.native.sprx. A payload attached to the game with ptrace called that module's exports with every buffer filled with 0xcc. No call created a recorder: everyOpenbelow fails before its session code.Read in the 13.40 module (decrypted from the game's process; not shared) and not measured:
Opencompares the heap size withQueryMemSize's result before it checks the affinity mask, the thread priority (0x100 to 0x2ff) and the field at 28. Those checks are left out, because anything that passes the heap check throws here anyway.How NHL 26 uses it, from its own executable: it fills the 64-byte block above for 1080p (format 1 at 60 fps, 0x11 at 30 fps) or 720p at 30 fps (0x10) with 48 kHz audio. It gives up quietly when
QueryMemSizefails, and whenOpenfails it marks the recorder as used and never retries. Its stop routine then callsGetStatus,StopandCloseand treats a negative result as "nothing to save". With this PR NHL's block still throws inQueryMemSize, and no AnyPS5 run of NHL 26 has reached these calls so far.Tested
Windows 11 (build 26200), MinGW GCC (WinLibs 15.2) Release build with
BUILD_TESTING=ON, each test run three times (ctest --repeat until-fail:3).guest_video_recording_testsnow checks the measured contract: no-recorder answers before and after failed opens; everyQueryMemSizecase above except the accepted formats (formats 3 to 0x44 refused, size fields 0 to 0x24, durations outside 1 to 3600, modes and options above 1, fields the size does not depend on); everyOpenrefusal with the heap left untouched. @oneandonlydean's43debd5f3removed the checks that expected validQueryMemSizeandOpencalls to throw.guest_video_recordingandguest_offline_imports(which also loads libSceVideoRecordingP):a344e526eonmain570089a80): 2/2.main570089a80with this PR's struct, its static asserts and its tests:guest_video_recordingfails (sceVideoRecordingStart not implemented),guest_offline_importspasses.main570089a80: 2/2.a344e526emerged ontomainabed03546on Ubuntu 26.04 with GCC 15.2 (review above):guest_video_recordingpasses 3 of 3, and the same control fails withsceVideoRecordingStart not implemented.tools/check_conventions.py --base origin/mainpasses.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T16:33:42Z.
Review: APPROVED
Reviewed exact head
a344e526ecc71c5a1fbf4bbca3a2416d834bd37aagainst currentmain427dd36164bbc1e7960c85c8e84dca75017c88f8. The four-file diff is focused: the measured 64-byte parameter layout is asserted,CheckParamchecks the required prefix before reading duration/mode and applies the reported size gates, andOpenreturns the measured refusal codes before throwing on paths that would require a recording session. The tests cover the format, duration, mode, option and size matrix, no-recorder calls, and that rejected/open-failing paths leave the heap untouched. The current-main merge preview is clean,git diff --checkpasses, and hosted eligibility, conventions, intake, labels and report checks pass. The product and relinker jobs were skipped by path policy; I did not independently run the Windows suite or reproduce the PS5 measurements, so the reported Windows results and firmware 13.40 measurements are author-provided. I found no actionable blocker. AI-assisted review: yes.Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T02:42:23Z.
Review: COMMENTED
First Linux run, since the description says it was not run on Linux.
Bare-metal Linux x86_64: i7-8700, Ubuntu 26.04, kernel 7.0, glibc 2.43, GCC 15.2, Release,
BUILD_TESTING=ON, full build. Heada344e526emerged--no-commitontomainabed03546(clean).guest_video_recording: passes 3 of 3.guest_video_recordingandguest_offline_imports: 2 of 2.main'sExport.cppwith this PR'sApi.hppstruct, itsVideoRecordingParamsize/offset static asserts and the new tests (full rebuild).guest_video_recordingaborts 3 of 3 withwhat(): sceVideoRecordingStart not implemented. Note that revertingExport.cppalone does not build, becausemain's static asserts reject the new 64-byte struct.This was run on
a344e526e, before the expected-throw checks @oneandonlydean asked to remove. They pass here as well. I have not checked which of the remaining checks is the first to hit the control's throw.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.