Caps the sample rate at 200kHz so that SDL's mixer will downsample any streams which are higher than that.
My Mega Drive emulator outputs at 223721Hz (the sample rate of the PSG chip), and `SDL_OpenAudioDeviceStream` fails due to DirectSound's `CreateSoundBuffer` returning an 'invalid parameter' error code. Lowering the sample rate makes the error go away.
Reported to me by @B3HKO in this issue:
https://github.com/Clownacy/clownmdemu-frontend/issues/60
The 200kHz limit is documented here:
https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee419022(v=vs.85)
DirectSound's Wikipedia article mentions that problems may occur with sample rates above 192kHz, but no source is provided, so I am unsure whether to take it seriously.
Now apps can have persistent files available during SDL_main()/SDL_AppInit()
and don't have to mess with Emscripten-specific code to prepare the filesystem
for use.
Fixes a crash when calling SDL_RenderGeometryRaw() with both `texture`
and `uv` set to `NULL`, and with geometry that is laid out in a way
that passes the quad checks.
with this, applications can do something like this:
SDL_SetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME, "current song")
and this will be reflected in the Audio Devices Plasmoid, pavucontrol etc
also cleaned up PW_KEY_MEDIA_NAME and PW_KEY_NODE_NAME; setting them to the
same appears string appears to break convention, as it results in redundant
titles in PipeWire application lists.
The thread is still created once and only shut down on WIN_VideoQuit,
but the thread will unregister the devices when they're disabled to avoid
wasting time processing raw input that won't be appreciated by anyone.
This also allows RIDEV_NOLEGACY to be set on the devices, otherwise they
swallow up the WM_MOUSE* events that would be going to the main thread
when relative mode is disabled. That's out of scope for this change, though.
Fix duplicate button/scroll events when GCMouse active
Fix duplicate events and add thread-safe atomic for GCMouse
Fix GCMouse relative mode sync when connected after mode enabled
Respect SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE in GCMouse handler
Fix variable shadowing in GCMouse motion handler
When SIGCHLD is blocked, some executables (for example CMake) do not exit properly when executed using `SDL_CreateProcess` from any SDL thread (not main thread). `SDL_CreateProcessWithProperties` docs say that `SIGCHILD` should not be ignored or handled, therefore blocking it during thread creation is a likely reason for the bug. Should fix#15210.
Signed-off-by: Konstantin Tomashevich <konstantin.tomashevich@gmail.com>
If SDL_HINT_OPENGL_ES_DRIVER is enabled and a GLES context is requested,
don't try to load the WGL/GLX library. Doing so may fail, because
SDL_HINT_OPENGL_LIBRARY may have been set to a custom libGLESv2 (e.g.
ANGLE). This effectively restores the SDL2 behavior.
Other video drivers shouldn't be affected, because they always use EGL
for GLES.
Incidentally, this patch also fixes a missing GL_GetEGLSurface callback
in the X11 fallback path.
The first approach had the drawback that it accumulated handles while raw input was paused, eventually crashing the application.
Now we'll keep reading raw events from the queue, we just won't deliver them to the application.
When emulating display modes or using display scaling, custom cursors need to be scaled, or they can appear too large or small relative to the window size.
Added vids for a variety of xbox 360 devices, mostly for linux use.
Corrected wheel vid and pid being flagged as unknown. Internally, when XUSB is building vid and pids for wireless devices, it assigns 0x02a1 for devices with subtype 1 and 0x02a2 for devices with subtype 2, which are wheels.
Some of these vids and pids do rely on the following patch being merged into the linux kernel, as I have overhauled how VID and PIDs are handled there for wireless devices.
https://patchwork.kernel.org/project/linux-input/patch/20260314075034.1488655-2-sanjay.govind9@gmail.com/
Also added some lists for guitar and drum devices, so we can set controller types correctly for those controllers.
Previously we would spin up and shut down a thread every time we changed raw input mode, which can take several ms. Now we'll just put the raw input thread to sleep when disabling raw input and wake it up when enabling raw input.
The floating state is only set after the first configuration event arrives, so size changes before the window was initially shown could be dropped. Use the flags instead.
When using the display scaling mode, scaled outputs would overlap, as the origins are in scaled points, while the width and height are in pixels. Use a simple algorithm to push the overlapping rectangles apart, so they do not overlap. This may end up leaving gaps in complex layouts (which are already somewhat mangled from mixing coordinate systems), but it works well enough in most cases.