Commit Graph
201 Commits
Author SHA1 Message Date
Adrià 5c356f41c3 Merge pull request #11048 from imellag/feat/libkernel-macos-main-thread
feat(libkernel): start the guest off the main thread on macOS
2026-10-27 08:27:20 +01:00
Dean e55c69f1fd Merge pull request #8927 from ionut27001/fix/videoout-cursor-flip-status
fix(libSceVideoOut): answer the cursor, flip status and pending-flip calls as measured on a PS5
2026-10-27 14:57:01 +13:00
Dean b7cfbf0115 Merge pull request #9346 from Techx3/feat/fullscreen-env
feat(libSceVideoOut): open the display window fullscreen with ANYPS5_FULLSCREEN
2026-10-27 10:29:49 +13:00
Dean Galvin 231bbbce92 Merge branch 'main' into fix/videoout-cursor-flip-status 2026-10-27 04:20:52 +13:00
Emanuele b05ca4e4bf fix(libSceVideoOut): read the window size after a flip on the main thread on macOS 2026-10-26 12:07:59 +01:00
orezraeyandClaude Opus 5.5 f34c280578 Merge main into feat/videoout-composite-overlay
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 03:06:04 -03:00
orezraeyandClaude Opus 5.5 655d0f3f32 Merge main into feat/videoout-composite-overlay
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 21:51:50 -03:00
Dean Galvin 0a52fdf083 Merge branch 'main' into videoout-color-space-wrappers 2026-10-26 10:30:44 +13:00
Emanueleandmugurc 30cc4ea2e6 feat(libkernel): start the guest off the main thread on macOS
AppKit, which SDL uses for windows, Metal surfaces, event pumping and game
controllers, works only on the main thread, and a guest never hands its
thread back. The macOS relinker emits a call to Aps5StartGuest as the
entry of a relinked executable; no library provided it.

- Aps5StartGuest runs the guest entry on a new thread with the stack size
  of the main thread (at least 8 MiB) and serves the main dispatch queue
  from the run loop of the main thread. The guest ends the process with
  exit; a guest entry that returns aborts.
- Aps5RunOnMainThread runs a function on the main thread and waits for it,
  or in place where the main thread is the caller or Aps5StartGuest was
  never called.
- libSceVideoOut sends its SDL calls through OnMainThread, which carries
  the exceptions back to the caller: the initialisation and shutdown of the
  video and game controller subsystems, the window, its Vulkan surface and
  drawable size, the event polling and the pad, mouse and keyboard input,
  which are created and destroyed there. On the other platforms the
  functions run in place.
- The flip test starts its tests through Aps5StartGuest on macOS, as a
  relinked guest does.

Co-authored-by: mugurc <[email protected]>
2026-10-25 16:02:42 +01:00
boykopovar 35cf8d56cd refactor(sdk): add canonical headers for core libraries 2026-10-24 23:17:37 +03:00
SlugZero 58a1bcc5a3 feat(pad): support up to 4 controllers with dynamic user discovery
- Track up to 4 pad slots in libScePad with per-slot inputs, outputs, sensor fusion, and deadbands
- Support dynamic user login/logout events and multi-user registration in libSceUserService
- Map SDL controllers 0-3 to Players 1-4 in libSceVideoOut while preserving Player 1 keyboard and mouse composition
- Add test coverage for multi-controller pads and multi-user services
2026-10-24 19:21:15 +02:00
ionut27001 983a81d91b fix(libSceVideoOut): add APS5_OUTPUT_RESOLUTION to override the reported output resolution 2026-10-24 12:42:14 +02:00
ionut27001 bfeeed4ef4 fix(libSceVideoOut): report the output resolution from the host display as measured on a PS5
sceVideoOutGetOutputStatus derived resolution from the size of the
registered buffers, so a title that reads it right after sceVideoOutOpen
got 1 (1080p) whatever the display. In a payload process on a PS5
(firmware 12.70), with no buffer registered, the field changed with the
console's resolution setting: 2 with it on Automatic on a 4K display, 1
with it set to 1080p. Read it from the display mode SDL reports for the
window's display, next to the refresh rate, and keep it independent of
the registered buffers.
2026-10-24 12:42:08 +02:00
orezraeyandClaude Opus 5.5 ded043d552 feat(videoout): composite the overlay bus over the main output
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-24 02:43:21 -03:00
shanu337 f24320dc1c refactor(libSceVideoOut): consolidate color space wrappers and add Flip tests 2026-10-23 19:00:18 +05:30
SueryandClaude Opus 5.5 7ae3fc8c22 feat(libSceVideoOut): open the display window fullscreen with ANYPS5_FULLSCREEN
A launcher that shows games fullscreen can set ANYPS5_FULLSCREEN instead of
pressing F11 after the window appears. The window opens with
SDL_WINDOW_FULLSCREEN_DESKTOP, the same mode F11 switches to.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017Dqgm9nUKygsXzr6poJsHJ
2026-10-21 14:03:29 -04:00
Adrià ba6abe1fd4 Merge pull request #8418 from hypermoist/feat/videoout-remove-buffer-attribute-option
feat(libSceVideoOut): implement sceVideoOutRemoveBufferAttributeOption
2026-10-21 15:32:40 +02:00
ionut27001 51d561a551 fix(libSceVideoOut): answer the cursor, flip status and pending-flip calls as measured on a PS5 2026-10-21 09:28:51 +03:00
Dean 20de55550f Merge pull request #8095 from Unkown607/fix/videoout-119hz-display-fallback
fix(libSceVideoOut): fall back to 59.94 Hz when display drops below 120 Hz
2026-10-21 14:59:25 +13:00
Dean b7596be595 Merge pull request #6658 from nicolasabosch/perf/gpu-wake-sleeps
perf(libkernel): end short sleeps when the GPU or a flip completes
2026-10-21 07:55:28 +13:00
Nicolas Abosch f857616caa Merge remote-tracking branch 'origin/main' into perf/gpu-wake-sleeps
# Conflicts:
#	core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp
#	core/libs/prx/libSceAgcDriver/Graphics/include/Recorder.hpp
2026-10-20 14:29:10 -03:00
Dean 3e7d1d297c Merge pull request #8138 from bl4nkTHEBUNKER/fix/pad-touchpad-resolution
fix(libScePad): report the DualSense touchpad resolution
2026-10-21 06:25:52 +13:00
hypermistandClaude Opus 5.5 e9bde2a2d4 feat(libSceVideoOut): implement sceVideoOutRemoveBufferAttributeOption
Clear the given bits of the attribute's option field, the inverse of
sceVideoOutAddBufferAttributeOption, as libSceVideoOut does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RbLgECLQ2bpDM7oe2urGZK
2026-10-21 01:28:22 +13:00
Adrià 1d41645527 Merge pull request #7633 from WallisSkill/fix/dualsense-audio-haptics
fix(libSceVideoOut): rumble a DualSense from haptic audio without a sound card
2026-10-20 13:07:58 +02:00
Adrià 36b72ad84a Merge pull request #7632 from WallisSkill/fix/pad-output-coalesce
fix(libSceVideoOut): coalesce controller output updates
2026-10-20 13:00:37 +02:00
dantdmdarealguy e3125e43af feat(agc,videoout): save the displayed frame as a PNG with a screenshot key
F12 (the new Screenshot input action) requests a capture of the next
presented display buffer. The presenter records it with the existing
APS5_DUMP_FRAMES GPU readback at full resolution, and the frame dump
writer thread encodes it with decoder_png into anyps5-screenshots/
beside the executable, or ANYPS5_SCREENSHOTS.
2026-10-20 00:28:39 -05:00
Dean a5ea7c2102 Merge pull request #7955 from alexpournaras/fix/videoout-title-fps-host-clock
fix(libSceVideoOut): count window-title FPS on the host clock
2026-10-20 17:38:05 +13:00
Adrià 049a826e95 Merge pull request #7786 from T3cm0/feat/videoout-hmd2-bus
feat(libSceVideoOut): answer the HMD2 bus open as the console does
2026-10-20 03:25:32 +02:00
bl4nkTHEBUNKER f57b79ef51 fix(libScePad): report the DualSense touchpad resolution
The controller information reported 1920 by 943, the DualShock 4 height with
the DualSense pixel density, while the host controller's fingers were scaled to
1920 by 942 and the keyboard touch contacts sat on the 942 centre line. A title
that maps touch coordinates through the reported resolution lost the lower part
of the touchpad. The width and height now live beside the pad state and all
three places use them.
2026-10-20 01:52:50 +02:00
Dean 0393728fd3 Merge pull request #7005 from TheSovietWaffle/fix/videoout-disable-sdl-wgi
fix(libSceVideoOut): add APS5_NO_WGI to turn off SDL's Windows.Gaming.Input backend
2026-10-20 11:53:01 +13:00
Alexandros Pournaras 0018091176 fix(libSceVideoOut): count window-title FPS on the host clock 2026-10-20 01:23:46 +03:00
wsjardijn dd523997da fix(libSceVideoOut): fall back to 59.94 Hz when display drops below 120 Hz
When a title has configured 119.88 Hz output (mode 15) and the window moves
to a display below 120 Hz, the presenter fell back to std::terminate via a
require() call. Replace the abort with a graceful fallback: reset outputMode
to mode 1 (59.94 Hz), fire the output-mode event so the title is notified,
and continue presenting.

This matches the HDMI output mode renegotiation a real display change
requires: the system falls back to a compatible mode and notifies the
title, rather than terminating the process.

After the fallback:
- sceVideoOutGetOutputStatus reports refreshRate 3 (59.94 Hz)
- sceVideoOutGetResolutionStatus reports refreshRate 3
- vblanks run at 59.94 Hz (every-other-tick skip resumes)
- sceVideoOutIsOutputSupported(mode=15) returns the unsupported error
- sceVideoOutConfigureOutput(mode=15) succeeds again once the window is
  on a 120 Hz display

The console's exact behaviour when a 120 Hz display is lost has not been
measured; this fallback is recorded as unverified in the debt file.

Fixes #7877
2026-10-19 23:21:16 +02:00
battleblob1andClaude Opus 5.5 a55dc4c535 fix(libSceVideoOut): turn SDL's Windows.Gaming.Input backend off only with APS5_NO_WGI
Windows.Gaming.Input stays on by default, so racing wheels, arcade and
flight sticks, HID pads without an HIDAPI driver and Xbox One/Series
trigger rumble keep working. Hosts where it faults at
Windows.Gaming.Input.dll+0x10a84 set APS5_NO_WGI to turn it off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 21:12:22 +03:00
Nicolas Abosch b131d2db5d Merge remote-tracking branch 'origin/main' into perf/gpu-wake-sleeps 2026-10-19 11:58:20 -03:00
Eli Yarson b8607f4ced feat(videoout): write pad and present telemetry to APS5_VIDEOOUT_TELEMETRY_DIR
APS5_VIDEOOUT_TELEMETRY_DIR=<directory> appends one JSON object per line to <directory>/videoout.jsonl: a contract line for the run (commit and pid), a pad line whenever the published pad state changes in its buttons, sticks, L2 or R2, a present line after the first present and every 30 after that with the count and rate the window title shows, and a drops line with the number of lines the writer discarded, reported every ten seconds while it grows and once at a normal exit. A bounded queue of 4096 lines and one writer thread batch the file, so neither the present nor the input path waits for it; a pad change that the full queue refused stays pending for a later publish, and the frame count moves from UpdateTitle's function-static to DisplayWindow so the input path can name the present it belongs to.

Without the variable no file is opened and no thread is started: a present or an input update costs one call that checks a guard variable and returns null.
2026-10-19 15:27:49 +02:00
T3cm0andClaude Fable 5.1 762410ced4 feat(libSceVideoOut): answer the HMD2 bus open as the console does
sceVideoOutOpen with bus type 0x20, the PS VR2 output PPSA05666 opens as
SCE_VIDEO_OUT_BUS_TYPE_HMD2_MAIN after sceHmd2ReprojectionEnableVrMode, threw
VIDEO_OUT_ERROR_INVALID_VALUE and aborted the title. The console returns that
code to a process that is not a game, with the headset connected and worn or
not, for users 255 and 0 and for a null or zeroed open parameter, so the bus
is answered that way before the other argument checks and the title carries
on with the error as its handle, as it does on the console without a headset.

The debt entry records the sequence the title follows on that handle
(RegisterBuffers2 with category 16 and 4000x2040 descriptors that point at
Hmd2 per-eye textures, ConfigureOutput and IsOutputSupported with 0x2000F, a
GPU wait on buffer 0), which a VR backend will have to model, and the test
covers the bus and the HMD output modes 0x20001 and 0x2000C to 0x20010, which
the console and this implementation answer with VIDEO_OUT_ERROR_UNKNOWN_OUTPUT_MODE
on the TV bus.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-19 02:24:36 -05:00
Adrià c8e3fcb703 Merge pull request #6507 from karanvora2599/perf/videoout-unordered-cpu-flips
perf(videoout): don't hold a flip thread's CPU flips behind queued work
2026-10-19 04:49:51 +02:00
EdouardSenceandClaude Opus 5.5 d71853cf25 feat(pad): add a Shake input that swings the reported motion while held
Some titles stop on a prompt to shake the controller, which keyboard players
and controllers without motion sensors cannot answer. While the Shake input is
held (X by default), the composed pad state reports motion with the
acceleration and angular velocity flipping sign every 50 ms; a controller's own
sensor data is used otherwise.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 01:16:53 +02:00
AlxcBTW f0ec9bd2a0 Merge remote-tracking branch 'origin/main' into pr/input-analog-keys 2026-10-18 22:27:23 +02:00
Dean effb7d2d5a Merge pull request #7498 from AlxcBTW/pr/input-slow-mice
fix(libScePad): smooth a slow-reporting mouse over its measured report interval
2026-10-19 09:22:19 +13:00
WallisSkillandClaude Opus 5.5 8540328431 fix(libSceVideoOut): pace only the light bar and resend refused effects
The 30 ms limit gated all controller output, so a rumble pulse shorter
than the interval could be lost and a stop could wait up to 30 ms.
Rumble goes out on every output change again, as on main; SDL already
skips repeated values and merges consecutive rumble reports. Only the
light bar is paced: a changed colour is sent at most every 30 ms, always
the latest one, and a colour SDL refuses is retried after the interval.

The trigger effect is cached only when SDL_GameControllerSendEffect
succeeds, so a refused effect is sent again on the next update as it was
before. LightBarPacer and TriggerEffectCache hold these decisions;
pad_output_pacing covers changes, retries, a new controller and a light
bar animated every frame at 120 Hz.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 02:14:44 +07:00
Nicolas Abosch d22094d066 Merge remote-tracking branch 'origin/main' into perf/gpu-wake-sleeps
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-18 16:04:17 -03:00
WallisSkillandClaude Opus 5.5 ffa63e8fec fix(libSceVideoOut): rumble a DualSense from haptic audio without a sound card
AudioOut2 turns controller haptic PCM into motor rumble only when no
controller sound card plays it, which is the case for a DualSense over
Bluetooth. PadInput then dropped that rumble for every DualSense, so
titles that vibrate through haptic audio never rumbled one over
Bluetooth. A DualSense now takes it like any other controller; with a
sound card no haptic rumble is submitted, so nothing plays twice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 01:09:43 +07:00
WallisSkillandClaude Opus 5.5 be1287b66c fix(libSceVideoOut): coalesce controller output updates
Every change of the pad output state sent a rumble, light bar and trigger
effect update to SDL, and the trigger effect was sent again even when it
had not changed. Titles that animate the light bar or drive rumble from
haptic audio change that state every frame, so at 120 Hz about 110
reports a second were queued while SDL's HIDAPI rumble thread sends at
most one per 10 ms. Different report kinds do not merge in its queue, so
the backlog grew: rumble arrived ever later, and disconnecting the
controller blocked the presenter until the queue drained.

Updates now go out at most every 30 ms with the latest state, and the
trigger effect is sent only when it changes or a controller connects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 01:02:01 +07:00
AlxcBTW 5dbdd6b797 Merge main into pr/input-analog-keys 2026-10-18 18:51:35 +02:00
AlxcBTW 06ca6a066b fix(libScePad): smooth a slow-reporting mouse over its measured report interval 2026-10-18 11:00:03 +02:00
AlxcBTW 438e1baa3e feat(libScePad): ramp keyboard-driven triggers over TriggerRampMs 2026-10-18 11:00:01 +02:00
AlxcBTW 64a9979268 feat(libScePad): ramp keyboard sticks over KeyboardRampMs 2026-10-18 11:00:01 +02:00
AlxcBTW a0f14cdf14 feat(libScePad): tilt keyboard sticks partially while a modifier key is held 2026-10-18 11:00:01 +02:00
Karan Vora db091f5fbb perf(videoout): don't hold a flip thread's CPU flips behind queued work
sceVideoOutSubmitFlip went through queue 0 as a one-packet command
buffer, so every CPU flip waited until the queue worker had translated
all command buffers submitted before it. The PS5 RADV WSI flips from its
own thread once the frame's fence has signaled. vkQuake keeps two frames
in flight, so by then the next frame's command buffer is already queued,
and the flip waited about 10 ms for the worker to translate it. Presents
came in pairs, about 4.7 ms and 29 ms apart. Meanwhile the title waited
in acquire for the flip to be shown, leaving the worker idle for about
7.5 ms per pair.

A CPU flip from a thread that has never submitted queue-0 work now goes
to the presenter at once, unless a command-buffer or EOP flip ahead of it
has not been reached yet. Such a thread can only know that its frame is
done by waiting for it. A flip from a thread that submits its own frames
still waits for the work submitted ahead of it, because a title that
flips without waiting for its frame relies on that order.
APS5_CPU_FLIP_IN_ORDER=1 orders every CPU flip.

vkQuake (PPSA99010) on an RTX 4060: 60 -> 72-74 presents per second,
present-interval standard deviation 12.2 -> 2.1 ms, and intervals over
25 ms 40% -> 1%.
2026-10-17 20:00:58 -04:00