* Add initial support for the Nokia N-Gage
* N-Gage: disable clipping for the time being, issue needs to be resolved later
* Move va_copy definition to SDL_internal.h
* Move stdlib.h include to SDL_config_ngage.h, much cleaner this way
* Remove redundant include, add HAVE_STDLIB_H
* Revert "N-Gage: disable clipping for the time being, issue needs to be resolved later"
This reverts commit 4f5f0fc36cc7f34fad05e45671dfa7b8dc32fd51.
* N-Gage: fix clipping issue by providing proper math functions
Enabling GCController.shouldMonitorBackgroundEvents to read background events
for MFi controllers before receiving the first GCControllerDidConnectNotification
is apparently a no-go on macOS (12.3.1 for me), and would crash on attempt.
Apple's documentation is... not great, and doesn't point this out.
This waits for IOS_AddMFIJoystickDevice() to get called down the chain from GCControllerDidConnectNotification, and enables GCController.shouldMonitorBackgroundEvents
if it hadn't been already.
On iOS and tvOS, GCController.shouldMonitorBackgroundEvents is ignored, so
there's no need to check their versions.
Ensure that we're not trying to call SDL_small_alloc()
with a count of zero.
Transforming the code like this fixes a
-Wmaybe-uninitialized warning from GCC 12.0.1
For short messages, use a stack buffer that is
significantly smaller than SDL_MAX_LOG_MESSAGE.
The rationale for this is that we don't want to risk
blowing the stack, while at the same time we would
like to not put pressure on the memory allocator unless
absolutely necessary.
This is the one that splits the "left wing" into two for loops to
bubble out the conditional that decides if it should read from the
left padding or the input buffer.
I still believe the optimization is good, but the basic logic of it
was incorrect, and needs to be reexamined and fixed before going
back into revision control.
We can get _some_ of the info we need out of standard Xlib and report a
single display (which might actually be multiple physical displays mushed
into a single desktop). This is better than nothing, but you should really
just build with XRandR support and get a better X server. :)
- Calculate `j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING` once per loop
iteration since we use it multiple times.
- Do the left-wing loop in two sections: while `srcframe < 0` and then
the remaining calculations when `srcframe >= 0`. This bubbles a conditional
out of every iteration of a tight loop, giving us a boost. We could
_probably_ do this to the right-wing loop too, but it's less straightforward
there.
- The real win: Use floats instead of doubles. This almost doubles the speed
of the entire function on Intel CPUs, and for embedded things without
hardware-level support for doubles, the speedup is enormous. This in
theory might reduce audio quality, though, and I had to put a check in
place to avoid a division-by-zero that we avoided at higher precision, but
this is likely to be worth keeping for at least the Sony PSP and other
smaller platforms, if not everyone.
Instead of waiting until the entire buffer from the SDL callback is ready
to be accepted by PulseAudio, we use pa_stream_set_write_callback and
feed some portion of the buffer as callbacks come in asking for more.
This lets us remove the halving of the buffer size during device open,
and also (hopefully) solves several strange hangs that happen in unusual
circumstances.
Fixes#4387Fixes#2262
* Read IMU scale data from Switch controllers. Up until now, SDL has used hard-coded scaling which isn't correct with some supported controllers.
* Moved declarations to beginning of code blocks to better fit with SDL style requirements