Commit Graph

30 Commits

Author SHA1 Message Date
boykopovar 643c8cfc99
Merge pull request #239 from adriadam10/fix/error-codes
fix(libs): correct VideoOut and Pad error codes
2026-10-01 21:59:04 +03:00
Adrià Franch 76be6796dc fix(libs): correct VideoOut and Pad error codes
Ten libSceVideoOut and two libScePad error constants had values that
belong to other errors of the same library (for example INVALID_HANDLE
was 0x80290003 and RESOURCE_BUSY / SLOT_OCCUPIED were swapped). They now
match KytyPS5, shadPS4 and fpPS4, which agree on all of them.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-01 19:53:49 +02:00
Adrià Franch 63501b6d73 feat(libSceKeyboard): implement the keyboard library
Keyboard input follows libSceMouse: the video out event loop forwards SDL
key and focus events, whose scancodes are USB HID usages, and the library
keeps the pressed keys, modifiers and lock LEDs in a 16-entry history for
sceKeyboardRead and a snapshot for sceKeyboardReadState.
sceKeyboardGetKey2Char translates the 101-key arrangement; the 106-key
one throws and is listed as technical debt.

KeyboardData holds 16 key codes (96 bytes), not 6.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-01 19:00:23 +02:00
boykopovar 7411f17cb7
Merge pull request #128 from oneandonlydean/feat/videoout-open-param
feat(videoout): accept a zeroed open param
2026-09-30 18:54:15 +03:00
boykopovar 4ed3199171
Merge pull request #84 from OverkillLabs/feat/pad-gamepad-haptics
feat(pad): motion sensors, rumble, adaptive triggers and light bar over SDL
2026-09-29 10:47:52 +03:00
OverkillLabs e532b19cee refactor(pad): trim comments and apply naming conventions
Bring the pad-gamepad-haptics diff in line with docs/dev/CONVENTIONS.md:
strip explanatory/rationale comments (struct layouts, algorithm notes,
rewired-NID rationale) down to code only, and rename the anonymous-
namespace helpers in PadState.cpp (Normalize/Fuse/EncodeZones/MaxOf/
ScaleStrength) to camelCase to match upstream's free-function style.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-29 04:24:39 +03: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
boykopovar 39fd90b050 fix(kernel): orderly shutdown when closing the display window 2026-09-28 18:30:34 +03:00
OverkillLabs 1d245cbeb2 videoout: bridge SDL sensor/haptics to pad output alongside existing input-mapping flow
Reconcile our SDL gamepad motion/haptics work with upstream's
configurable keyboard/mouse binding feature (PadInput now built around
Pad::LoadInputMapping() and a std::vector<Pad::InputBinding>). Upstream's
openFirstAvailableController()/openController(deviceIndex) flow and
HandleEvent/Update/publish logic for keyboard, mouse, and wheel
bindings are kept as-is (including APS5_NO_PAD_INPUT handling); the
sensor-enabling and host-haptics steps are grafted on as additional
work done once a controller is open:

- openController(deviceIndex) now also calls enableSensors() and
  marks a re-apply of the current guest output request pending.
- New sampleController()/applyOutput()/enableSensors() bring in real
  gamepad sampling, motion sensor reads, DualSense touchpad finger
  tracking, and pushing rumble/light bar/adaptive trigger state out via
  SDL_GameControllerRumble/SetLED/SendEffect. sampleController()'s
  button list and trigger/stick scaling are an exact copy of the
  button/trigger/stick reading that used to be inlined in publish()
  under the SDL_GameControllerGetAttached check (no deadzone added,
  no extra button remapped) -- only the motion, touchpad, and
  device-kind sampling on top of it are new.
- Update() now also samples the controller and applies pending output
  every tick, in addition to upstream's SDL_GameControllerUpdate() call
  and its keyboard/mouse/wheel timing logic.
- publish() seeds PadInputState from the sampled gamepad state first
  (buttons/sticks/analog triggers/motion/touch/device kind), then
  layers upstream's keyboard/mouse binding loop on top exactly as
  upstream had it, so a bound key still overrides the gamepad the same
  way it did before this merge. Upstream's L2/R2 button-flag derivation
  is preserved, just computed once at the end from whichever value
  (gamepad or a keyboard/mouse override) ends up in analogButtonsL2/R2.
- The background-events SDL hint is now set unconditionally (previously
  only inside the "not yet initialized" branch), since upstream's own
  VideoOutDriver already brings up SDL_INIT_GAMECONTROLLER before
  PadInput is constructed, which meant the hint would never run.

No changes were needed in VideoOutDriver.cpp: PadInput lazily
initializes SDL_INIT_GAMECONTROLLER itself in
openFirstAvailableController() (already a no-op if the subsystem is up),
and the class's public interface (default-constructible, HandleEvent/
Update) is unchanged, so upstream's existing `PadInput padInput;` /
HandleEvent / Update call sites keep working without modification.
VideoOutDriver.cpp's own independent flip-queue/vblank-telemetry rework
was left untouched as out of scope.

Confidence: high for the keyboard/mouse binding path (untouched) and
for the gamepad button/stick/trigger path (byte-for-byte copy of the
pre-existing mapping); the new motion/haptics/touchpad code is novel
and builds/links cleanly but has not been run against real hardware.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-28 13:43:27 +03:00
Julien Legay ddb8add753 feat(libSceVideoOut): route SDL mouse events to libSceMouse
Forward relative motion, supported button transitions, and horizontal and vertical scrolling from the existing SDL event loop. Reset pressed buttons on focus loss without reporting a device disconnect, and track window close and refocus transitions.

Link libSceVideoOut to the mouse library using the existing Pad integration pattern. Add targeted coverage for API errors, event mapping, focus changes, history overflow, and reopening.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-28 11:45:31 +02:00
MartinCajiao 0644a8c38f feat(input): support SDL game controllers 2026-09-27 20:27:22 -05:00
MartinCajiao c13f0eee67 feat(input): allow configurable keyboard and mouse bindings 2026-09-27 19:54:19 -05:00
devilismyfriend a503d0b617 Merge remote-tracking branch 'origin/main' into feat/demons-souls-boot
Brings in main up to 9958d26 (homebrew runtime, POSIX wrappers in
libkernel, sce_module guest modules and --skip-sce-module, the --to-intel
general pipeline, libSceRandom, libSceRtc, libScePosixForWebKit,
libRenoirCore, test wiring).

Resolutions where both sides implemented the same thing:
- libkernel pthread: main's structure (lazy static initialisation,
  destroyed markers, MutexOperations/CondOperations, mutex protocol and
  condattr clock) with this branch's TimedWait deadlines and condition
  (precise timed lock/wait on Windows), wait tracing, the adaptive mutex
  type 4, POSIX default ERRORCHECK mutexes, EDEADLK/EPERM results instead
  of throws, and condition clocks honoured for absolute timeouts.
- libc locale: the guest Dinkumware ABI (_Locimp, facet vtables, short
  ctype/case tables, locale ids, stream storage) is kept because guest code
  inlines those layouts; main's C character functions are kept on top.
- libc stdio/strings/math: main's stream functions (guest FILE status
  sync), strerror/perror, remove, formatting, string and math exports win
  over this branch's duplicates.
- libc paths: main's working directory with this branch's path aliases
  resolved on the normalised guest path.
- libkernel file: this branch's sceKernel* results as SCE errors, main's
  POSIX wrappers and both fstat helpers.
- relinker: this branch's stub lowering keeps its trampolines through the
  main executable path; guest modules refuse lowerings that need stubs.
- AGC driver: main's rendering wait is executed by this branch's workers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-27 10:52:21 -07:00
Pacuka a4273c10dc fix(videoout): drop __stdcall from the window procedure
GCC on Linux rejects the attribute, which breaks the libs build since the
F11 fullscreen change. It has no effect on x86-64 Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 11:15:16 +02:00
boykopovar e4825fbdc2
Merge pull request #3 from SamG-Coder/main
Expand native PS5 homebrew compatibility and regression coverage
2026-09-26 09:54:21 +03:00
devilismyfriend 9c2a75601d feat(libs): agc packet builders, savedata memory, offline service stubs
- libSceAgc: SetIndexCount, SetBaseIndirectArgs, DispatchIndirect, wait
  and write-data patch functions, relaxed checks for what titles send,
  NOP fillers for LOD stats and wait-until-safe, NotImplemented stubs.
- libSceSaveData.native: short mount points, backup events, save-data
  memory slots.
- user/system service, store dialog, video-out flip modes and queue-full
  error, pad read, fibers, offline behaviour for network/NP modules, and
  new export-only modules Ampr, JpegEnc, Json2, MsgDialog.native,
  NpCppWebApi, NpUtility.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0177gthrWEBBfBu5xJDXgBfo
2026-09-25 16:27:49 -07:00
boykopovar 6b8e16b73e feat(video): fullsceen mode by f11 2026-09-25 11:18:58 +03:00
boykopovar 9453f47828 feat(video): open centered window at 60% of display size 2026-09-25 11:13:03 +03:00
boykopovar 11bee5527d fix(video): preserve client aspect ratio when resizing 2026-09-25 11:07:51 +03:00
SamG-Coder cca00c13ab feat(video): track ordered buffer reuse reservations 2026-09-25 07:13:15 +10:00
boykopovar 05c8146744 refactor(pad): libScePad files structure refactor 2026-09-25 00:04:19 +03:00
boykopovar ce287648bf feat(pad): add read input state logic to libScePad 2026-09-24 23:59:12 +03:00
boykopovar e98d2163f4 refactor(log): remove extra logs + refactor timing logging 2026-09-24 20:35:59 +03:00
boykopovar e341cd1b30 feat(window): add fps and frame counter to window title 2026-09-23 15:30:13 +03:00
boykopovar 282257fd98 feat(video): add resizable aspect-ratio-aware window 2026-09-23 14:27:47 +03:00
boykopovar fd5e236aad feat(videoOut): add tiled buffer presentation and flip lifecycle handling 2026-09-14 12:38:16 +03:00
boykopovar d31e35e1ab feat(agc): add flip presentation and suspend synchronization (wip) 2026-09-14 07:39:38 +03:00
boykopovar d225df7449 feat(sceVideoOut): implement sdl2 window and present thread 2026-09-12 17:32:24 +03:00
boykopovar 497821e94f feat(sceVideoOut): video out functions impl (wip) 2026-09-12 11:02:17 +03:00
boykopovar bd16eaaacf refactor(libs): organize libSceVideoOut with cmakelists 2026-09-11 16:41:01 +03:00