feat(libSceVideoOut): answer the mode helpers as firmware 13.42 does #14954

Merged
BunnyFl merged 4 commits from upstream-pr/14954 into main 2026-11-06 01:25:12 +00:00
BunnyFl commented 2026-11-02 04:20:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-02T04:20:02Z.


What

Five more libSceVideoOut mode helpers threw. They now read or fill the mode structure as firmware 13.42's libSceVideoOut does. They sit next to sceVideoOutSysModeIsVr from #14941 and read the same dword at offset 0x20, so this builds on that PR:

  • sceVideoOutSysInitMode(void* mode) (9cmjhjqa7Sg) fills bytes 0 to 0x1F with 0xFF, then stores 0x20 in the first dword. It writes nothing past 0x20 bytes and leaves EAX unset, so it is declared void.
  • sceVideoOutSysModeIsSystemDefault(const void* mode) (5Y8uUbGMio0): 1 when bit 0 of the dword at 0x20 is clear.
  • sceVideoOutSysModeIsVrNative(const void* mode) (SgA2MtojPto): 1 when bits 2:1 of that dword are 01.
  • sceVideoOutSysModeIsVrLegacy(const void* mode) (zecl8Gox+P0): 1 when bits 1 and 2 are both set.
  • sceVideoOutSysModeIsHdr(const void* mode) (I7-lGGvFgBM): 1 when byte 6 is from 12 to 17. The module computes (uint8_t)(byte - 12) < 6, and the code does the same in std::uint8_t.

sceVideoOutSysModeIsVr now shares the dword read with these. Its behaviour is unchanged.

None of the five checks its pointer, so a null argument faults on the console as it does here. What the fields mean is unknown, and the new debt entry says so.

Source

Firmware 13.42 libSceVideoOut.sprx, sha256 975b229324655a2d2a945c755fc0339e7feecb62863efc28ad3b2d91a95ad215. Each function was read to its return, from disassembly only, not measured on a console. All five are leaves: no calls, no global data.

0x14450 sceVideoOutSysInitMode (9cmjhjqa7Sg)
  vpcmpeqd ymm0, ymm0, ymm0 ; vmovdqu [rdi], ymm0 ; mov dword [rdi], 0x20 ; ret
0x17240 sceVideoOutSysModeIsSystemDefault (5Y8uUbGMio0)
  mov eax, [rdi+0x20] ; not eax ; and eax, 1 ; ret
0x17260 sceVideoOutSysModeIsVrNative (SgA2MtojPto)
  mov ecx, [rdi+0x20] ; xor eax, eax ; and ecx, 6 ; cmp ecx, 2 ; sete al ; ret
0x17270 sceVideoOutSysModeIsVrLegacy (zecl8Gox+P0)
  mov ecx, [rdi+0x20] ; xor eax, eax ; not ecx ; test cl, 6 ; sete al ; ret
0x17280 sceVideoOutSysModeIsHdr (I7-lGGvFgBM)
  movzx ecx, byte [rdi+6] ; xor eax, eax ; add cl, 0xf4 ; cmp cl, 6 ; setb al ; ret

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release, on #14941's head 072371afe9 (main 93dbd0f82a):

  • guest_video_out_firmware_answers passes. It checks:
    • every value of bits 0 to 2 of the dword at 0x20, with the higher bits clear and set and the rest of the structure 0x00 and 0xFF;
    • all 256 values of byte 6 for IsHdr;
    • that InitMode writes exactly 0x20 bytes over a 0x5A-filled buffer.
  • Mutation checks: each of these makes the test fail with its own message:
    • IsVrLegacy accepting either bit;
    • IsVrNative comparing with 4;
    • IsSystemDefault inverted;
    • IsHdr with <= 6;
    • InitMode filling 0x24 bytes.
  • Negative control: built against #14941's or main's InventoryExports.cpp/.hpp, the test doesn't compile, because these exports still have the placeholder no-argument int signatures there.
  • public_headers (65 tests) passes.
  • VideoOut validation run, same machine, this branch and main 93dbd0f82a:
    • AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer;
    • ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V for video_out_flip_controls, _cpuflip, _eop, _fresh, _deferred, _backtoback and video_out_output_mode_policy;
    • 7/7 pass on both, none skipped. Neither log has the missing-layer message, a VUID- or a SYNC-HAZARD ID.
  • python3 tools/check_conventions.py --base upstream/main: all checks pass.
  • python3 tools/pr_overlap.py --branch feat/videoout-fw1342-sysmode: no confirmed overlap. It could not compare #4040, #5021, #6977, #9432, #9880, #10112, #12863 and #14212, which conflict with main and share CMakeLists.txt or the debt file. None of their changed lines names these five exports or their NIDs.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #14941
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.32015.7029, Windows 11
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5114891017 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14954). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-02T04:20:02Z. --- ### What Five more libSceVideoOut mode helpers threw. They now read or fill the mode structure as firmware 13.42's libSceVideoOut does. They sit next to `sceVideoOutSysModeIsVr` from #14941 and read the same dword at offset 0x20, so this builds on that PR: - `sceVideoOutSysInitMode(void* mode)` (`9cmjhjqa7Sg`) fills bytes 0 to 0x1F with 0xFF, then stores 0x20 in the first dword. It writes nothing past 0x20 bytes and leaves EAX unset, so it is declared `void`. - `sceVideoOutSysModeIsSystemDefault(const void* mode)` (`5Y8uUbGMio0`): 1 when bit 0 of the dword at 0x20 is clear. - `sceVideoOutSysModeIsVrNative(const void* mode)` (`SgA2MtojPto`): 1 when bits 2:1 of that dword are `01`. - `sceVideoOutSysModeIsVrLegacy(const void* mode)` (`zecl8Gox+P0`): 1 when bits 1 and 2 are both set. - `sceVideoOutSysModeIsHdr(const void* mode)` (`I7-lGGvFgBM`): 1 when byte 6 is from 12 to 17. The module computes `(uint8_t)(byte - 12) < 6`, and the code does the same in `std::uint8_t`. `sceVideoOutSysModeIsVr` now shares the dword read with these. Its behaviour is unchanged. None of the five checks its pointer, so a null argument faults on the console as it does here. What the fields mean is unknown, and the new debt entry says so. ### Source Firmware 13.42 `libSceVideoOut.sprx`, sha256 `975b229324655a2d2a945c755fc0339e7feecb62863efc28ad3b2d91a95ad215`. Each function was read to its return, from disassembly only, not measured on a console. All five are leaves: no calls, no global data. ``` 0x14450 sceVideoOutSysInitMode (9cmjhjqa7Sg) vpcmpeqd ymm0, ymm0, ymm0 ; vmovdqu [rdi], ymm0 ; mov dword [rdi], 0x20 ; ret 0x17240 sceVideoOutSysModeIsSystemDefault (5Y8uUbGMio0) mov eax, [rdi+0x20] ; not eax ; and eax, 1 ; ret 0x17260 sceVideoOutSysModeIsVrNative (SgA2MtojPto) mov ecx, [rdi+0x20] ; xor eax, eax ; and ecx, 6 ; cmp ecx, 2 ; sete al ; ret 0x17270 sceVideoOutSysModeIsVrLegacy (zecl8Gox+P0) mov ecx, [rdi+0x20] ; xor eax, eax ; not ecx ; test cl, 6 ; sete al ; ret 0x17280 sceVideoOutSysModeIsHdr (I7-lGGvFgBM) movzx ecx, byte [rdi+6] ; xor eax, eax ; add cl, 0xf4 ; cmp cl, 6 ; setb al ; ret ``` ### Tested Windows 11, WinLibs GCC 15.2.0 r7, Release, on #14941's head 072371afe9 (main 93dbd0f82a): - `guest_video_out_firmware_answers` passes. It checks: - every value of bits 0 to 2 of the dword at 0x20, with the higher bits clear and set and the rest of the structure 0x00 and 0xFF; - all 256 values of byte 6 for `IsHdr`; - that `InitMode` writes exactly 0x20 bytes over a 0x5A-filled buffer. - Mutation checks: each of these makes the test fail with its own message: - `IsVrLegacy` accepting either bit; - `IsVrNative` comparing with 4; - `IsSystemDefault` inverted; - `IsHdr` with `<= 6`; - `InitMode` filling 0x24 bytes. - Negative control: built against #14941's or main's `InventoryExports.cpp`/`.hpp`, the test doesn't compile, because these exports still have the placeholder no-argument `int` signatures there. - `public_headers` (65 tests) passes. - VideoOut validation run, same machine, this branch and main 93dbd0f82a: - AMD Radeon RX 9070 XT (driver 32.0.32015.7029), Vulkan SDK 1.4.363 validation layer; - `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest -V` for `video_out_flip_controls`, `_cpuflip`, `_eop`, `_fresh`, `_deferred`, `_backtoback` and `video_out_output_mode_policy`; - 7/7 pass on both, none skipped. Neither log has the missing-layer message, a `VUID-` or a `SYNC-HAZARD` ID. - `python3 tools/check_conventions.py --base upstream/main`: all checks pass. - `python3 tools/pr_overlap.py --branch feat/videoout-fw1342-sysmode`: no confirmed overlap. It could not compare #4040, #5021, #6977, #9432, #9880, #10112, #12863 and #14212, which conflict with main and share `CMakeLists.txt` or the debt file. None of their changed lines names these five exports or their NIDs. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #14941 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon RX 9070 XT, driver 32.0.32015.7029, Windows 11 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14954
No description provided.