Commit Graph

53 Commits

Author SHA1 Message Date
Dean 970316ae04
Merge pull request #4704 from AlxcBTW/feat/input-mouse-look
feat(input): turn mouse speed into a smooth right-stick tilt
2026-10-14 15:55:08 +13:00
Dean 1e277eef6e
Merge pull request #4930 from MarcZX100/fix/videoout-frame-dump-linear
fix(videoout): dump linear display buffers
2026-10-14 15:37:10 +13:00
AlxcBTW 38bc0fd348 feat(input): turn mouse speed into a smooth right-stick tilt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 17:00:20 +02:00
Mouad-Scriptz-0 94087d08b0 feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas
The console's mouse reports relative motion, so the host cursor can never line
up with the cursor a title draws. While a title has a mouse open and the
window is focused the host cursor is hidden and captured, released on focus
loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled
from the presented image's size in window units to the title's display
resolution with sub-pixel carry, so the title's cursor travels as far as the
host pointer would, on scaled desktops and letterboxed windows alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 14:05:52 +00:00
MarcZX100 c1bcd0b697 fix(videoout): dump linear display buffers 2026-10-13 05:05:31 +00:00
Nicolas Falesy 6f284b8298 feat(libSceVideoOut): implement sceVideoOutDeleteVrrActiveStatusEvent
The NID -q-vbO859Tw, declared as sceVideoOutUnknown_q_vbO859Tw for
PPSA02530, hashes to sceVideoOutDeleteVrrActiveStatusEvent. It removes the
handle's VRR status registration from the queue like the other Delete*Event
calls, the counterpart of sceVideoOutAddVrrActiveStatusEvent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017WeVmjnnPPKdxVTpr2Vjtw
2026-10-12 23:04:58 -04:00
PrintOrb 9c007805d6
Merge branch 'main' into fix/videoout-high-frame-rate 2026-10-12 11:15:48 -05:00
Dean 9fca13b538
Merge pull request #4009 from dantdmdarealguy/feat/input-deadzone-sensitivity
feat(input): configure stick deadzones and mouse sensitivity
2026-10-12 23:51:54 +13:00
Dean f55e1117d4
Merge pull request #4058 from ee6aba54/fix/videoout-event-unopened-port
fix(libSceVideoOut): return INVALID_HANDLE for events on ports that are not open
2026-10-12 23:47:16 +13:00
Dean Galvin abc1cfa57d fix(agc-driver): queue frame dumps at the dump scale
A frame presented from guest memory with APS5_DUMP_FRAMES is read back
at the size of the display buffer, and that whole copy went into the
dump writer's queue with the scale beside it (31.6 MiB for a 3840x2160
buffer). The queue holds 64 MiB, so the third frame the writer had not
finished ended the run with "frame dump queue exceeded 64 MiB". A frame
blitted from the resident image is already reduced on the GPU and queued
at the reduced size.

The readback is now reduced by the dump scale when the slot retires and
queued at that size, the same pixels the writer kept before. With
APS5_DUMP_SCALE=1 nothing is reduced and the limit is reached as before.

video_out_frame_dump_queue presents four 3840x2160 frames from guest
memory while the writer is held on the first file and compares every
dump with the decoded display buffer.
2026-10-12 18:54:34 +13:00
Dean 5aa0e15a4f
Merge pull request #3867 from tv7/fix/videoout-attribute-change-pending-flip
fix(videoout): accept a buffer attribute change while a flip is pending
2026-10-12 17:28:15 +13:00
Simon 43573fd48a fix(libSceVideoOut): return INVALID_HANDLE for events on ports that are not open
Registering a flip or vblank event on a handle that sceVideoOutOpen never
created, or that was closed, threw, which ended titles that register
their flip event before they open the port and ignore the result. The
documented error SCE_VIDEO_OUT_ERROR_INVALID_HANDLE is returned instead,
the same check sceVideoOutSetFlipRate and the other output calls use.

The flip test program gains an "unopened" mode.
2026-10-12 00:21:47 +02:00
PrintOrb 665cca43a0
Merge branch 'main' into fix/videoout-high-frame-rate 2026-10-11 17:21:16 -05:00
dantdmdarealguy 3c581619d3 feat(input): configure stick deadzones and mouse sensitivity
anyps5-input.ini accepts LeftStickDeadzone and RightStickDeadzone (whole
percent, 0 to 90), a radial deadzone on the controller sticks whose
remaining travel is rescaled to the full range, and MouseSensitivity
(above 0, at most 10), which replaces the fixed factor of 1 for mouse
look. The defaults keep the current mapping exactly.
2026-10-11 15:57:12 -05:00
PrintOrb cef97424a8 test(videoout): pin high-frame-rate display rejection 2026-10-11 14:46:14 -05:00
PrintOrb 63434686bf fix(videoout): support permitted high-frame-rate output 2026-10-11 13:40:31 -05:00
Lexroid 5cd25dedbd fix(videoout): accept a buffer attribute change while a flip is pending
sceVideoOutSubmitChangeBufferAttribute2 threw when a buffer of the group
had a flip pending, and Marvel's Wolverine makes that call with flips in
the queue. A flip now takes its buffer group when it is reserved, in
submission order, so flips submitted before the change keep the
attributes their buffers were rendered with and later flips use the
new ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 21:06:04 +03:00
omurc4 d40189d707 feat(libSceVideoOut): export sceVideoOutAddBufferAttributeOption
Elden Ring Nightreign (PPSA25380) imports the function, which no library
exported, so the title failed to load. The option is ORed into the buffer
attribute and a null attribute throws. Options other than 0 and 8 still
throw when the buffers are registered.
2026-10-11 13:26:22 -04:00
Alex b6cc4fe7f9 feat(videoout): implement sceVideoOutDeleteOutputModeEvent
Unsubscribe an event queue from the output mode events that
sceVideoOutAddOutputModeEvent registers, the same way the flip and
vblank events are removed. Deleting a registration that does not exist
succeeds, and a null queue or an invalid handle throws.

Co-Authored-By: Gemini 3.8 Flash <noreply@google.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 02:36:47 -04:00
XairRrR da642e807b fix(libSceVideoOut): take 64-bit VRR peg arguments and test peg and unpeg 2026-10-11 01:55:16 +02:00
arcwiser e5a81a3ca9 test(videoout): isolate application fixtures
(cherry picked from commit 7e982a521f2ba5fafabcba45c78cb23918fa9007)
2026-10-10 17:10:51 +00:00
XairRrR c9fe124c10 feat(libs): resolve command-buffer flip buffers when the GPU reaches the flip
A flip packet names a buffer index; the buffer was looked up when the
command buffer was submitted, so a title that registers its buffers
after submitting the first frame failed with "flip buffer is not
registered". The buffer is now resolved when the GPU reaches the flip,
as the hardware does. A flip whose buffer is still unregistered then
presents black and completes (see TechnicalDebt).

Uncharted: Legacy of Thieves Collection (PPSA05684) submits its first flip before registering its buffers and stopped with "flip buffer is not registered".
2026-10-10 09:54:29 +02:00
MathiasDevelopes 85d1eb2e60 fix(libSceVideoOut): overlay-bus flips no longer replace the main output
A title that opens a main and an overlay port flips both, and every flip
was presented as a whole frame, so the window alternated between the two
buses: PPSA01736 shows its intro on the main bus and an empty overlay,
and the intro blinked black on every other frame. Overlay flips now
complete and signal their events without being shown. Compositing the
overlay over the main output is not implemented.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 08:48:03 +02:00
Adrià f3999054bd
Merge pull request #1648 from Pedroj-64/fix/videoout-closed-port-flip-cancel
fix(videoout): cancel flips on a port the title closed instead of failing the driver
2026-10-10 08:03:46 +02:00
Dean b57e66fa60
Merge pull request #2152 from MathiasDevelopes/feat/videoout-pre-vblank-start-events
feat(libSceVideoOut): deliver pre-vblank start events
2026-10-10 17:44:23 +13:00
Adrià 85d4bfcf34
Merge pull request #1496 from hugodearaujo/fix/videoout-output-mode-errors
fix(videoout): answer output mode queries with the console's codes
2026-10-10 03:04:33 +02:00
Adrià Franch df270d59eb fix(ci): skip the VideoOut window tests without a display, as check_skips expects
Main's Linux job fails since #1028 and #1714: guest_video_out_resolution_status aborts when SDL's offscreen
driver has no Vulkan window, and check_skips.py rejects the skips of guest_video_out_wqhd_detection and the
flip tests because "no display" is not among the device limitations it accepts.

The resolution status test now skips with code 77 like its wqhd sibling, the flip tests print the same skip
reason, and check_skips.py accepts "no display" as a device limitation. ANYPS5_REQUIRE_DISPLAY still turns
the skip into a failure.
2026-10-10 02:20:49 +02:00
hugodearaujo cadcbfd3a8 fix(videoout): answer output mode queries with the console's codes
Measured on a PS5 (firmware 13.60) through dlopen of
libSceVideoOut.sprx on a handle the payload opened.
sceVideoOutInitializeOutputOptions writes 0xFF to byte 2 of the 64-byte
options and returns INVALID_ADDRESS for a null pointer.
sceVideoOutIsOutputSupported checks the handle, then the reserved
arguments, then the mode, then the options. It never answers 0: a mode
the display lacks returns UNSUPPORTED_OUTPUT_MODE, and a value that is
not a mode returns 0x8029001E. Options must keep the initialized words,
except word 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 01:42:40 +02:00
Adrià 58706dc2d9
Merge pull request #1225 from Pedroj-64/fix/video-out-present-shutdown-failure
fix(videoout): report GPU driver shutdown failure from the present thread at Shutdown
2026-10-10 01:10:19 +02:00
Gjon Gojcevic 04dec3ddbc feat(libSceVideoOut): register the VRR status event and accept the VRR status call
LibwuIonIBw registers video out event id 16, which the host never triggers because its VRR state does not change; kP2L8t3j-aM returns 0 without effect.
2026-10-09 23:12:08 +02:00
Pedro a1efdab629 fix(videoout): cancel flips on a port the title closed instead of failing the driver
A flip still queued or in presentation when the title closes its port is discarded, as on hardware, rather than stored as a driver failure. A closed port no longer terminates the presentation thread nor surfaces from Shutdown. The lifetime test now expects cancellation and the reopen mode is registered in ctest.
2026-10-09 09:42:53 -05:00
Pedro 2663699dc5 test(videoout): skip flip tests without a Vulkan window and create param.json
The offscreen SDL driver cannot create a Vulkan window on Windows since
the VideoOut window uses SDL_WINDOW_VULKAN, so the tests that open a port
now exit 77 (skipped) like the other display tests, unless
ANYPS5_REQUIRE_DISPLAY is set. The tests also write app0/sce_sys/param.json,
which AppMetadata now requires.
2026-10-09 06:56:43 -05:00
MathiasDevelopes 10f57dea29 feat(libSceVideoOut): deliver pre-vblank start events
sceVideoOutAddPreVblankStartEvent threw "physical pre-vblank timing is
not implemented", so titles that pace on it stopped at startup. It now
registers the event like the vblank event does, and each emulated vblank
tick triggers the pre-vblank start events just before the vblank events,
with the pre-vblank count as data. The console's lead time is unknown.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 12:00:55 +02:00
Dean 3e66276cba
Merge pull request #1367 from Raghav314/fix/videoout-window-at-start
fix(videoout): create the window and the device when VideoOut starts
2026-10-09 21:03:10 +13:00
Celegans12 1816aea91c fix(agc): store and read DCC keys over the console's metadata extent
The console's DCC of a single-level 4-byte SW_64KB_R_X surface is
ceil(W/512) * ceil(H/512) * 4096 bytes, 49152 for 1920x1080, but the
driver stored and read one key per 256 surface bytes (34560).
PPSA26344 retiles its render DCC into the displayable copy it
registers (cs_dcc_retile_32bpp); a retile of the stale tail gives the
mixed keys PPSA12544 stops on.

DccKeyCount gives that extent. Color target and storage image key
stores cover it when the DCC is pipe-aligned (CB_COLOR_ATTRIB3 bit 30,
T# word 6 bit 19), whose CB keys reach its last meta block, and throw
where it is not writable; unaligned DCC keeps one key per 256 bytes,
as do texture and color target key reads. DisplayBufferKeys reads the
display DCC over the extent, presents only when every key agrees,
names the first differing key's pixels and checks a pending image
against those keys.
2026-10-08 15:24:43 +02:00
raghav314 1a2bbc5d3e fix(videoout): create the window and the device when VideoOut starts
The driver created a windowless Vulkan device at the first dispatch and
replaced it with a windowed one at the first flip. The replacement built a
second device and re-imported every host import, and the first flip paid
for it.

VideoOut now creates its window when it starts (the first VideoOut call),
at the default 1920x1080 output, and attaches it to the driver
(AgcDriverAttachWindow) before the call returns. The driver creates its
device with that window, so GPU work and presentation use one device.
Present no longer creates or replaces a device. A device created by GPU
work before VideoOut started is still replaced, now in AttachWindow.

A failure to create the window or the device is thrown from that first
VideoOut call instead of terminating the presentation thread.

Tests:
- video_out_flip_tests onedevice: GPU work, then a flip, leaves one device.
- pacing makes its first presentation span vblanks with GPU work queued
  ahead of the flip; it relied on the device being created at the flip.
- unavailable expects the failure from sceVideoOutOpen.
- guest_video_out_wqhd_detection writes a param.json for the window title
  and is skipped without a display or Vulkan device unless
  ANYPS5_REQUIRE_DISPLAY is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 05:54:05 +05:30
Gjon Gojcevic e6f4d2c178 fix(libSceVideoOut): ignore the reserved buffer pointers
Titles may leave the reserved pointers of a VideoOutBuffers entry uninitialized, so sceVideoOutRegisterBuffers2 no longer rejects them.
2026-10-07 19:50:12 -04:00
Merijn 4d47b3aac5 Merge branch 'main' of https://github.com/boykopovar/AnyPS5 into fix/videoout-unsupported-output-mode
# Conflicts:
#	docs/dev/TechnicalDebt.md
2026-10-06 09:54:03 +02:00
Celegans12 241faf881e feat(agc): present DCC display buffers whose keys are uncompressed or fast-cleared
sceVideoOutRegisterBuffers2 threw "DCC presentation is not implemented"
for category 1 (DCC-compressed) buffers, which PPSA26344 registers. Such
a buffer now needs DCC metadata and the tiled layout, and dcc_control may
only use the CB_DCC_CONTROL block layout bits 0x10026c.

At a flip the keys are read behind their recorded writers, one byte per
256 bytes as in the driver's DCC model. Uncompressed keys present the
stored texels as before; a uniform clear code presents its color with a
GPU clear of the scaler's source image; a pending storage image is used
when it serves the keys. Mixed or unreadable keys, clear codes the
display format has no DCC encoding for, register-clear keys over a
pending image and a clear color wider than 32 bits throw. Buffers
without DCC take the old path.
2026-10-05 23:45:15 +02:00
Merijn d4eed90b54 fix(videoout): report unavailable output modes instead of throwing
sceVideoOutIsOutputSupported threw VIDEO_OUT_ERROR_UNSUPPORTED_OUTPUT_MODE
for every mode other than the default and 119.88 Hz, and
sceVideoOutConfigureOutput threw for an unavailable 119.88 Hz mode. Titles
probe and request modes the display may lack and handle the result:
PPSA12544 asks for 0xd000000a and falls back to 3840 pixels when it is not
supported, and its sceVideoOutConfigureOutput caller switches on the
returned error codes, including VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.
Every mode except the default now reports 0, and configuring one returns
VIDEO_OUT_ERROR_UNAVAILABLE_OUTPUT_MODE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 22:45:12 +02:00
Celegans12 d3e2e53a7c feat(videoout): accept the STRICT_COLORIMETRY buffer option
sceVideoOutRegisterBuffers2 and sceVideoOutSubmitChangeBufferAttribute2
threw for every buffer attribute option other than 0. PPSA26344 builds
its display buffers with option 8 through the libSceAgc helper linked
into it, so its first registration failed.

Option 8, VIDEO_OUT_BUFFER_ATTRIBUTE_OPTION_STRICT_COLORIMETRY (name
and value from KytyPS5), is now accepted and presented as option 0;
every other option still throws. What the console changes for it is
unknown and recorded in TechnicalDebt. The rejection now names the
tiling mode, pitch, aspect ratio and option it was given.

video_out_flip_tests decode checks that option 8 describes the same
buffer as option 0 and that options 1, 32 and 40 are rejected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:53:26 +02:00
Dean 7f5c3ec9b7
Merge pull request #417 from oneandonlydean/fix/agc-flip-after-gpu
fix(agc): complete a flip only once the frame's GPU work has finished
2026-10-04 11:30:22 +13:00
Alexey 29a8d01c83
Merge pull request #297 from oneandonlydean/fix/videoout-open-param-service-thread
fix(videoout): read the open param as the service thread's priority and affinity
2026-10-03 09:46:25 +03:00
Dean Galvin d9632d5523 fix(agc): complete a flip only once the frame's GPU work has finished
With APS5_FLIP_INFLIGHT (default 1) a presentation trailed on the GPU and
the flip completed as soon as its blit was queued behind the frame's
batches. The title reads that completion as "the GPU is done with the
frame" and rewrites the frame's memory, but the recorded GPU work still reads
guest memory in place when it runs. In PPSA21564 the per-draw constant
ring of the next frames landed under vertex programs that had not run
yet: a program read an integer sample count as float 1.0 from another
draw and stepped a loop by its reciprocal, about 1e9 iterations, and
other draws got wrong matrices.

The presenter now queues the present and then waits for the frame's own
fence, outside the GPU mutex, before reporting the flip, so the title
cannot reuse the frame's memory while the GPU still reads it.

Test: video_out_flip_tests aftergpu (needs a GPU and a display) submits a
busy compute dispatch, an end-of-pipe label without an interrupt (which
does not drain the device) and a flip, and checks that the flip
completes no earlier than the label lands.
2026-10-03 19:44:43 +13:00
Dean Galvin 33c89d30dc fix(videoout): pace the next flip from the vblank a flip was released at
processFlip set lastFlipVblank to the vblank count after the host present
returned. When the acquire, the wait for an earlier presentation or the
present itself crossed the next vblank, the next flip's target moved out
by one vblank even when that flip was already queued: a frame ready in
17 ms was shown for 33 ms, and a title that advances its logic by a fixed
step per presented frame ran in slow motion.

A flip takes effect at the vblank it is released at, so that vblank is
now the one the next flip's interval counts from, recorded when the flip
is released. Flip events, flipStatus and flipPendingNum are unchanged.

Test: video_out_flip_tests pacing (needs a GPU and a display) submits
the first flip at flip rate 2, whose presentation opens the device and
spans several vblanks, and checks that lastFlipVblank is 3.
2026-10-03 11:15:47 +13:00
Dean Galvin 151fec7fd6 fix(videoout): read the open param as the service thread's priority and affinity
and throws for any non-zero word after it. Its layout matches shadPS4's
ServiceThreadParams instead: an unknown first word (16), a set-priority flag
and a priority (256..767), a set-affinity flag and a 64-bit CPU mask at
offset 16. PPSA21564 passes 16, 1, 0x100, 1 and 0x1FFF, so it stops at
startup on main.

sceVideoOutOpen now validates each field and reads the mask only when its
flag is set, so a 16-byte param with both flags clear still works. The
priority and affinity are not applied, since the present and vblank threads
are host threads; this and the unknown first word are listed in the
technical debt.
2026-10-02 21:05:25 +13:00
boykopovar d2d221a123
Merge pull request #179 from oneandonlydean/fix/pad-sdl-hidapi
fix(pad): build SDL with HIDAPI so DualSense output reaches the controller
2026-09-30 21:18:57 +03:00
Dean Galvin e2609a87be fix(pad): build SDL with HIDAPI so DualSense output reaches the controller
The bundled SDL was configured with SDL_HIDAPI OFF, so a DualSense went
through the generic joystick driver of the platform: no touchpad, no
light bar and no DualSense effect reports, which left the light bar,
trigger effect and (on Linux) rumble requests that PadInput already
sends through SDL without effect on the controller. With HIDAPI, SDL's
PS5 driver handles the pad: touchpad, light bar, rumble, trigger effects
and the motion sensors.

A USB pad always uses the driver's enhanced reports.
SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE enables them for a Bluetooth pad as
well, which otherwise stays on the simple report without effects.

pad_sdl checks that the bundled SDL is built with the HIDAPI joystick
driver.
2026-10-01 00:35:57 +13:00
Dean Galvin 7447392f87 feat(videoout): accept a zeroed open param
sceVideoOutOpen threw for any non-null param. PS5 titles pass a 16-byte
open param whose first word is its size, so they could not open a port.

A param whose size word is 16 and whose other three words are zero
requests nothing beyond a null param and is accepted. Any other size,
or any non-zero option word, still throws.
2026-09-29 13:25:25 +13:00
devilismyfriend af3c2024ed feat(runtime): timed waits, sync primitive fixes, heap and RTC fixes, unattended-run switches
libkernel: a TimedWait service for condition variables, semaphores, event flags, rwlocks and
equeues with the scheduler tick; mutex/cond/sem corner cases the title hits; job worker
affinity is opt-in (APS5_JOB_AFFINITY). libc: calloc/realloc heap slot swap, a default
terminate handler with a backtrace, CPU topology helper. libSceRtc export fixes with tests.
libSceVideoOut: APS5_NO_PAD_INPUT ignores host input for unattended measurements,
APS5_FLIP_QUEUE_WAIT keeps a stalled process alive for a debugger. ApplicationHeap and
GuestRtc tests wired into the test build.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-26 19:00:39 -07:00