Skip to content

Add SDL camera handler #16849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Add SDL camera handler #16849

wants to merge 2 commits into from

Conversation

Megamouse
Copy link
Contributor

@Megamouse Megamouse commented Mar 11, 2025

  • Adds SDL camera handler
  • Refactors the bulk of Qt camera handler into a base class shared with SDL camera handler

This can probably be selected to use the PS EYE on windows again. (Didn't test yet).

TODO:

  • Check if PS EYE works
  • Update settings dialogs

@Megamouse Megamouse force-pushed the sdl_camera branch 7 times, most recently from 1d7700b to 4953bff Compare March 12, 2025 19:30
@Megamouse Megamouse force-pushed the sdl_camera branch 5 times, most recently from 7ea5fb0 to 86f50d2 Compare May 12, 2025 20:56
@Megamouse Megamouse force-pushed the sdl_camera branch 8 times, most recently from 58b6e50 to 1a75caf Compare May 13, 2025 06:56
@Megamouse
Copy link
Contributor Author

Megamouse commented May 13, 2025

I fixed at least one crash. But it can now sometimes softlock. Still needs some more work.

@Darkhost1999
Copy link
Contributor

image
RPCS3.log

@Kethen
Copy link
Contributor

Kethen commented May 20, 2025

Thanks for bringing up the concept of main thread of SDL, something I didn't full understand.

Understanding the concept a bit better makes thinking about SDL_PumpEvent() handling a bit weird.

https://github.com/libsdl-org/SDL/blob/2dad6534b841c449100db3a5647fa867ce4db199/include/SDL3/SDL_events.h#L1049-L1071

On one hand, the correct implementation should have both SDL_Init() SDL_PumpEvent() on the same thread, so that it can be a guarantee for some platforms; for instance, window handling on MacOS, and being able to perform callbacks on SDL identified main thread https://github.com/libsdl-org/SDL/blob/2dad6534b841c449100db3a5647fa867ce4db199/src/events/SDL_events.c#L1463

On the other hand, RPCS3 is not currently using SDL window handling and mouse and keyboard input, so just for joystick (maybe even camera) handling, it should be fine as long as SDL_Init() and SDL_PumpEvent() are mutexed; with the current implementation in SDL at least.

I see that the current refactoring ensures that SDL_Init() is done on the qt main thread. Should SDL_PumpEvent() be done on the qt main thread as well for correctness?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants