Compare commits

..

483 Commits

Author SHA1 Message Date
Ryan C. Gordon
53dea98309 x11: revert checks for _NET_WM_STATE_FULLSCREEN changes.
This reverts commit 85977354fb.
This reverts commit 0249df9d96.

Fixes #5572.
Reopens #5390.
2022-04-25 14:00:04 -04:00
Sam Lantinga
981e1e3c44 Fixed logical size synchronization issue on macOS
https://discourse.libsdl.org/t/sdl-2-0-22-prerelease/35306/6
2022-04-23 10:35:05 -07:00
Ozkan Sezer
7a5743031d hidapi, libusb: import mainstream commit 536bad201e 2022-04-23 20:01:40 +03:00
Sam Lantinga
fa073ed01a Revert "Fix relative mouse input for Unvanquished (unvanquished.net)"
This reverts commit 3318590796.

Fixes https://github.com/libsdl-org/SDL/issues/5569
2022-04-22 22:31:04 -07:00
Sam Lantinga
8986efd643 Added support for the Backbone One controller on iOS 2022-04-22 14:21:46 -07:00
Sam Lantinga
2ca0837888 SDL: sometimes the PS5 controller doesn't report having to power even when connected over USB. Possibly related to being completely charged? Either way we already know that it's USB or BT so let's use the driver's knowledge instead. 2022-04-22 14:21:41 -07:00
Sam Lantinga
04bf7c9434 Fixed build 2022-04-22 09:36:39 -07:00
Sam Lantinga
d9b5805ba5 Return a correlation error when trigger rumble is attempted without correlation 2022-04-22 09:13:40 -07:00
Eddy Jansson
0288de8529 SDL_Rect: Add \sa documentation block to SDL_FRect 2022-04-22 12:09:13 -04:00
Sam Lantinga
ba62ead5ec Handle potential out of memory condition when working with hints 2022-04-21 08:47:41 -07:00
Cameron Gutman
145824f6ab WGI: Only call RoUninitialize() if RoInitialize() succeeded 2022-04-21 08:47:22 -07:00
Cameron Gutman
00b2e10a7a WGI: Keep a reference to the MTA to avoid crashing on COM teardown
Fixes #5552
Fixes #5270
2022-04-21 08:47:22 -07:00
Cameron Gutman
8982d9f403 windows: Fix RoInitialize() failure after a CoInitializeEx() call using apartment threading
This mirrors the same codepath in WIN_CoInitialize() which handles STA and MTA.
2022-04-21 08:47:22 -07:00
Cameron Gutman
923cb4463e windows: Fix calling convention for RoInitialize/RoUninitialize
Fixes #5563
2022-04-20 21:02:40 -05:00
Ryan C. Gordon
d4a01bfef0 os2: SDL_DestroyMutex should ignore NULL mutexes.
Every other backend does this, so this should match, now.
It's possible this was harmless, but we can avoid the system call
and the (likely?) debug message when it fails, though!
2022-04-20 14:08:09 -04:00
Eddy Jansson
a40405d724 hidapi: Wrap CopyHIDDeviceInfo in define checks.
The purpose of this is to silence a 'defined but not used'
warning.
2022-04-20 09:33:40 -07:00
Eddy Jansson
5bc2933425 test: Basic tests for SDL_FRectEquals
Based on the integer version. These tests mostly check that input
isn't mangled and that invalid input gives the expected negative
result.
2022-04-20 08:38:53 -07:00
Eddy Jansson
fc944859d1 SDL_Rect: Use a default epsilon in SDL_FRectEquals()
Add SDL_FRectEqualsEpsilon() for when more control over
equality test is required.
2022-04-20 08:38:53 -07:00
Eddy Jansson
00feca27b0 Add SDL_FLT_EPSILON. 2022-04-20 08:38:53 -07:00
Eddy Jansson
5d4a1f8356 WhatsNew.txt: Add SDL_FRectEqualsEpsilon() 2022-04-20 08:38:53 -07:00
Frank Praznik
aeadbdd788 Remove an unused function prototype 2022-04-20 09:39:34 -04:00
Frank Praznik
c8c59a2139 Fix a -Wshadow warning 2022-04-20 09:39:34 -04:00
Jaylon Gowie
d9009388c8 SceKernelMemBlockType to unsigned int 2022-04-19 14:17:27 -07:00
Jaylon Gowie
3753a7b1c3 Fix recent changes in VitaSDK 2022-04-19 14:17:27 -07:00
Sam Lantinga
02225aa738 Fixed build 2022-04-18 22:57:03 -07:00
Ryan C. Gordon
49a2e4b0ea x11: Revert "Fix keymap updating for X11 backend"
This reverts commit de6d290266.

This patch had multiple issues, discussed in #5520.
2022-04-19 00:37:39 -04:00
Sam Lantinga
b9fe6ba0e7 Fixed compile warnings 2022-04-18 13:09:08 -07:00
Sam Lantinga
57927a2458 Don't call scandir() inside of scandir()
This works around a crash in address sanitizer
2022-04-18 12:57:28 -07:00
Sylvain
1ede941f5c SDL_render.c: internally change viewport/cliprect type from SDL_FRect to SDL_DRect (double precision). (see bug #5547) 2022-04-18 12:26:32 -07:00
Sam Lantinga
9919d1a7a5 Remove HWND_TOPMOST for fullscreen windows
Fixes https://github.com/libsdl-org/SDL/issues/5509
2022-04-18 11:51:54 -07:00
pionere
009a0ff95f use explicit GetModuleFileNameW 2022-04-18 14:12:22 -04:00
pionere
de711e1685 simplify SDL_GetBasePath on windows
- use GetModuleFileName directly (as recommended)
2022-04-18 14:12:22 -04:00
Jan Beich
7c140429a8 Enable evdev-based gamecontrollerdb on FreeBSD 2022-04-18 09:57:49 -07:00
Sam Lantinga
e7b01ee745 Added controller mapping for the Thrustmaster Dual Analog 3.2 on Linux 2022-04-18 09:55:52 -07:00
Frank Praznik
2b52946143 video: Don't minimize fullscreen windows on focus loss by default when mode switching is disabled
When mode switching is disabled in a video backend, fullscreen windows are basically just fullscreen desktop windows with different internal scaling.  As no mode switching occurs, there's no need to minimize them on focus loss by default.  This can still be overridden by explicitly setting the internal hint for minimizing on focus loss.

This has the side effect of fixing a bug on GNOME, where, when a fullscreen Wayland window has it's focus lost and restored via alt+tab followed by switching back to windowed mode, the top portion of the window won't end up being obstructed by GNOME's top bar.
2022-04-18 09:39:25 -07:00
Ethan Lee
c37090f9a4 wayland: Add support for TOOLTIP/POPUP_MENU 2022-04-18 12:31:02 -04:00
Sam Lantinga
9e264b921b Certain audio drivers, like the RME "Pro" Audio driver, have resampling quality issues when using WASAPI.
We'll use SDL's resampling algorithm so we have consistent quality between platforms and drivers.

Fixes https://github.com/libsdl-org/SDL/issues/5538
2022-04-18 09:20:47 -07:00
Sam Lantinga
254fcc90eb Revert "video: Prefer Wayland over X11"
This reverts commit 8ceba27d62.

SDL Wayland support is stable, but there are a number of issues with third-party software (NVIDIA drivers, libwayland event overflow, libdecor not handling plugin load failures, Steam overlay not working with Wayland, etc.) that make it better to default to X11 at this time.

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

Fixes https://github.com/libsdl-org/SDL/issues/5527
2022-04-18 09:03:14 -07:00
Ryan C. Gordon
c1336b21ed hints: Make SDL_VIDEODRIVER and SDL_AUDIODRIVER formal hints.
They were just environment variables before.

Fixes #5528.
2022-04-17 11:31:55 -07:00
Ryan C. Gordon
634b9edc7f cmake: Fixed indenting and some oldschool endif(TEXT) things. 2022-04-15 20:50:55 -04:00
Semphris
dc5bc5237c Added CMake option to disable the installer 2022-04-15 20:48:40 -04:00
Ryan C. Gordon
67e0f546c5 x11: Update the display when the WM changes a window's fullscreen state.
Fixes #5390.
2022-04-15 18:25:53 -04:00
Frank Praznik
edb473cf46 video: Wayland: Always round scaled pointer coordinates down
Rounding up can cause the pointer coordinates to exceed the window boundaries at the right and bottom edges.
2022-04-15 16:24:20 -04:00
Frank Praznik
13393a1c4b video: Wayland: Clamp fullscreen window dimensions to desktop
A scaled fullscreen window may exceed the bounds of the desktop.  Clamp the window size to the desktop dimensions in fullscreen mode.
2022-04-15 16:24:20 -04:00
pionere
0adb67017b avoid NullPointer in SDL_GetRenderTarget 2022-04-15 15:47:35 -04:00
pionere
01b14e14e6 avoid NullPointer in SDL_GL_MakeCurrent 2022-04-15 08:30:33 -04:00
Ozkan Sezer
55a4e1d336 CI: update os2.yml to use open-watcom/setup-watcom
also remove os2-buildbot.sh -- not needed anymore.
2022-04-14 10:10:02 +03:00
Simon McVittie
c36bd78474 WhatsNew.txt: Document new dependency on libwayland-client 1.18.0
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-13 10:14:29 -04:00
Ethan Lee
46616af722 WhatsNew.txt: Added SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR 2022-04-12 11:53:40 -04:00
David Gow
9c2f46b0d5 Wayland: Add SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR
This hint allows libdecor to be used even when xdg-decoration is
available. It's mostly useful for debugging libdecor, but could in
theory be used by applications which want to (for example) bundle their
own libdecor plugins.
2022-04-12 11:52:41 -04:00
Mathieu Eyraud
99ae6395b1 Initialise scandir argument
'scandir' does not initialise 'entries' on error
2022-04-12 11:14:07 -04:00
Simon McVittie
68b6fff245 test: Copy utf8.txt to build directory
testiconv wants this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 11:01:20 -04:00
Simon McVittie
b4256d03e9 testevdev: Adapt to a broader definition of keyboards
At the time I contributed this unit test, SDL had a relatively narrow
definition of what is a keyboard, approximately matching udev
ID_INPUT_KEYBOARD. Now it uses the equivalent of udev ID_INPUT_KEY,
which matches anything with keyboard keys, and not just reasonably
complete alphanumeric keyboards.

Fixes: 040bd7a9 "Fix udev not detecting ID_INPUT_KEY devices when udev is not running"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
Simon McVittie
c2946902fa testevdev: Recognise touchpads as such
At the time I contributed this unit test, SDL didn't understand Linux
touchpads, but now it does.

Fixes: 373216ae "Added support for touchpads in the Linux evdev code"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-12 10:59:53 -04:00
pionere
f708cebe10 fix os2 timer in fallback mode 2022-04-12 17:01:20 +03:00
Ivan Epifanov
b75996138a Vita: fix VIDEO_VITA_PVR flag 2022-04-11 17:16:22 -04:00
Ethan Lee
b1831715a2 UWP: Require Windows 10 16299 or newer.
This is required to build with WGI support. Thanks for @FrozenChameleon for the fix!

Fixes #5504
2022-04-11 12:09:40 -04:00
Ryan C. Gordon
727eef7064 audio: SDL_ConvertStereoToMono_SSE3 missed an unaligned load. 2022-04-09 10:13:37 -04:00
Sam Lantinga
505d6a4a05 Update version to 2.0.22 for release 2022-04-08 18:18:56 -07:00
Sam Lantinga
a256e6ba7f Updated the patch notes with API changes for 2.0.22 2022-04-08 18:10:56 -07:00
Sam Lantinga
6d7d142b70 Fixed typo 2022-04-08 18:10:38 -07:00
Frank Praznik
c2093fab99 video: wayland: Set the surface damage region when using fullscreen viewports
When using emulated display modes, the output size is often larger than the drawable buffer.  As the surface damage region is automatically calculated from the smaller drawable buffer size, the damage region needs to be manually set to cover the entire viewport region or visual repaint artifacts can result.
2022-04-08 14:11:44 -04:00
Ethan Lee
ba0ba9ef16 direct3d11: Set the swapchain target immediately after creating it.
Fixes #4782
2022-04-07 23:47:20 -07:00
Ethan Lee
cb81630816 render: Update the size/scale/viewport on moves, in addition to resizes.
For OpenGL this means resetting the viewport state shadowing flag too.

Fixes #1504
2022-04-07 23:38:33 -07:00
Sam Lantinga
5613a56032 Make sure the UIKit message box is being handled on the main thread
Potentially fixes https://github.com/libsdl-org/SDL/issues/4865
2022-04-07 11:33:54 -07:00
Ozkan Sezer
2823534fef minor adjustment to os/2 watcom makefile 2022-04-07 20:11:50 +03:00
Sam Lantinga
49b9e3470b Only update modifier state for keys that are pressed in another application
Fixes https://github.com/libsdl-org/SDL/issues/4432
2022-04-07 08:24:03 -07:00
Ryan C. Gordon
85977354fb x11: Treat WM setting the window "fullscreen" like FULLSCREEN_DESKTOP.
Fixes #5390.
2022-04-07 09:15:27 -04:00
Connor Clark
6dbca7c911 Compile with recursive mutexes for emscripten
Emscripten actually does support recursive mutexes, so no need to use SDL's fake recursive code.

Background: #5428, #5479
2022-04-06 18:51:35 -07:00
Ozkan Sezer
64c7896f09 Makefile.in: added missing CXX variable. 2022-04-06 20:56:10 +03:00
Ethan Lee
d1f7f9e35d wayland: Pin the fake window position at (0, 0).
I kind of thought it'd be nice to have it in the center, but this is an issue
for applications that still assume global mouse and window positions are
accessible. For example, this fixes cursor offset issues in UE5.
2022-04-06 11:18:46 -04:00
Ethan Lee
279aeb59be wayland: Add a bug link for the detach FIXME 2022-04-06 01:32:57 -04:00
Ethan Lee
3ada694e62 wayland: Try to detach at the beginning of ShowWindow, just in case.
It's possible that an external component (probably a GL/VK context) committed, so we need to cover our bases and detach in both HideWindow and ShowWindow.

Fixes a crash in UE5 editor's pop-ups.
2022-04-06 01:18:03 -04:00
Ethan Lee
dcfb7fff00 wayland: Evaluate WINDOWPOS_CENTERED_DISPLAY for move events
Partially fixes the mouse cursor in UE5 editor. Imperfect because UE5 uses window position and global mouse state to get position, but of course we don't have global mouse and this is just to get the right display index so this still fails overall. We really need to make global mouse support a feature query...
2022-04-06 00:55:32 -04:00
Sam Lantinga
7ea1b69dd4 Sort controllers by the js* index on Linux
Also fixed the initial scan to directly scan devices instead of using
udev so they can be sorted, as intended.

Fixes https://github.com/libsdl-org/SDL/issues/4688
2022-04-05 21:02:52 -07:00
Ryan C. Gordon
0249df9d96 x11: Try to keep SDL_WINDOW_FULLSCREEN* in sync with window manager.
So if Gnome/KDE/etc have a keyboard shortcut or titlebar decoration to
make any window go fullscreen (with the _NET_WM_FULLSCREEN flag on the
_NET_WM_STATE property), we update the SDL window flag.

Fixes #5390.
2022-04-05 23:18:10 -04:00
Sam Lantinga
eb660e862c Cache the fact that a device didn't look like a joystick
Fixes https://github.com/libsdl-org/SDL/issues/5211
2022-04-05 19:47:42 -07:00
Weng Xuetian
138d96c8a6 Send key release event to input method. (#5281)
Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
2022-04-05 22:30:25 -04:00
Ryan C. Gordon
8bae343f25 x11: when waiting on fullscreen changes, not window position _and_ size.
This makes sure the window doesn't have outdated values if you try to access
them (or call something that does, like SDL_SetWindowMinimumSize).

Fixes #5233.
2022-04-05 22:21:57 -04:00
Sam Lantinga
268c2fa882 Don't resize fullscreen windows when hiding or minimizing them (thanks @madewokherd!)
This has the benefit of window previews (mousing over the icon) having the correct size and contents.

Fixes https://github.com/libsdl-org/SDL/issues/5320
2022-04-05 18:42:17 -07:00
Esme Povirk
def27267b5 Ignore focus change messages that contradict GetForegroundWindow.
On Wine, when a window is programmatically minimized in response
to losing focus, we receive a WM_ACTIVATE for the deactivation,
but GetForegroundWindow still indicates that our window is focused.
This causes an incorrect SDL_WINDOWEVENT_FOCUS_GAINED.

This is probably a Wine bug, but it may take a while to fix and
then for the fix to make its way to users.
2022-04-05 18:00:39 -07:00
Weng Xuetian
ff5b67e5e0 IBus should use ev keycode instead of X keycode
See: 5a455b1ead/client/gtk2/ibusimcontext.c (L468)
2022-04-05 20:04:40 -04:00
Sam Lantinga
27fc582b59 Minor cleanup 2022-04-05 15:11:49 -07:00
Sam Lantinga
86acb1a347 Handle interaction between auto capture and the SDL_CaptureMouse() API
Fixes https://github.com/libsdl-org/SDL/issues/5457
2022-04-05 15:05:07 -07:00
Sam Lantinga
0e198a8799 Added a define VERBOSE_MOTION_EVENTS to show mouse and finger motion events 2022-04-05 15:03:18 -07:00
capehill
006a5a9e03 testgles2: Fix buffer object sizes 2022-04-05 13:05:51 -04:00
Ryan C. Gordon
a5672b858e x11: Wait a bit to see if window pos changes when changing fullscreen.
Helps prevent window from moving to 0,0 when leaving fullscreen.

Fixes #4749.
2022-04-05 11:10:41 -04:00
Cameron Gutman
45372b1c27 x11: Don't unload libGL.so to prevent a crash in XCloseDisplay()
libGL.so may register callbacks that can be invoked upon XCloseDisplay().
If XCloseDisplay() is called after libGL.so is unloaded, the callback pointer
will point at freed memory and invoking it will crash.

The texture framebuffer check optimized out in f37e4a9 was causing libGL.so to
never be unloaded as a side-effect. Skipping it exposed this bug by allowing
libGL.so to actually unload.
2022-04-04 21:39:41 -07:00
Sam Lantinga
7b3449b89f Minor cleanup 2022-04-04 20:46:56 -07:00
Christoph Reichenbach
6cd444f0fa Visualise scroll wheel events in testmouse 2022-04-02 20:50:21 -07:00
Cameron Cawley
57118fb7de render: Fix setting the scale mode for non-native textures 2022-04-02 09:51:28 -07:00
Ozkan Sezer
312c899f4f attempt to fix uwp build 2022-04-02 03:32:10 +03:00
Ozkan Sezer
c0bb39e5e9 check for HAVE_ROAPI_H in cmake and autotools, and
update SDL_config_windows.h and SDL_config_winrt.h
2022-04-02 02:50:02 +03:00
Ozkan Sezer
575dadb11d fix build against older SDKs after commit 8ebef12. 2022-04-02 02:20:02 +03:00
Sam Lantinga
8ebef12d31 Use RoInitialize/RoUninitialize for Windows.Gaming.Input
Thanks @walbourn!

Fixes https://github.com/libsdl-org/SDL/issues/5270
2022-04-01 14:59:45 -07:00
Sylvain Becker
1c9299b00d Add SDL_list to macosx xcode 2022-04-01 08:12:31 +02:00
Sylvain
78834b50d6 Add SDL_list.c/h 2022-04-01 08:01:44 +02:00
Sylvain
ad6bc521bd Move SDL_List functions to SDL_list.c to avoid more merge with eventual PR 2022-04-01 07:59:16 +02:00
Sam Lantinga
0d7edcb703 Fixed loading 32-bit BMP files 2022-03-31 16:15:51 -07:00
Ryan C. Gordon
ea7d5307ac emscripten: Proxy SDL_GetUsableDisplayBounds to the main thread. 2022-03-31 14:12:34 -04:00
Reinhold Gschweicher
fe79eb2fbb emscriptenframebuffer: fix formatting 2022-03-31 14:11:41 -04:00
Reinhold Gschweicher
268cc2a49c emscriptenmouse: remove useless return statement 2022-03-31 14:11:41 -04:00
NeroBurner
3136a53070 fix formatting and cast warnings
Co-authored-by: Charlie Birks <charlie@daftgames.net>
2022-03-31 14:11:41 -04:00
Reinhold Gschweicher
404158595c emscriptenmouse: remove old extra _INT 2022-03-31 14:11:41 -04:00
Reinhold Gschweicher
4dca8f7fb4 SDL2 thread proxying fixes
This PR uses new APIs added in [emscripten-core/emscripten#9336](https://github.com/emscripten-core/emscripten/pull/9336)
to improve compatibility with USE_PTHREADS=1.

Original PR: https://github.com/emscripten-ports/SDL2/pull/127
By: @jakogut
Reviewed by: Daft-Freak
2022-03-31 14:11:41 -04:00
Ryan C. Gordon
1c7bf478ae x11: Ignore BadValue for extremely small XRRSetScreenSize resolutions.
Reference Issue #4840.
2022-03-31 10:09:47 -04:00
Ivan Epifanov
db718998bd Vita: fix readme 2022-03-31 06:02:50 -07:00
Ivan Epifanov
95c0fec518 Vita: PVROGL: fix indentation and ifdef guards 2022-03-31 06:02:50 -07:00
Jaylon Gowie
b5700ab31e Cleanup Spaces 2022-03-31 00:02:56 -04:00
Jaylon Gowie
8e5adc62eb Update README-vita.md 2022-03-31 00:02:56 -04:00
Jaylon Gowie
8c542a3591 Desktop OpenGL 1.X/2.X PSVita Support 2022-03-31 00:02:56 -04:00
Cameron Gutman
2c04df8d65 joystick: Fix rumble issues on PS5 HIDAPI controllers
We were returning the report size from HIDAPI_DriverPS5_RumbleJoystick() rather
than 0 upon success, causing SDL_JoystickRumble() (and callers) to think that
rumbling failed.

This didn't cause major problems until 1868c5b, when it started preventing
rumble state from being persisted in the joystick core, even though it was
successfully sent to the hardware.

This led to all sorts of strangeness, including broken rumble duration and
attempts to stop rumble being discarded.
2022-03-30 18:33:38 -05:00
Ryan C. Gordon
7e15ad2fc4 x11: Catch X11 errors in X11_SetWindowPosition and X11_SetWindowSize.
The functions can go south if other operations are in progress, like
X11_SetWindowBordered, which might be doing something traumatic behind the
scenes of the window manager.

We can't make these tasks totally synchronous, which would fix the problem,
because not only can the window manager block however long it wants, it might
also decide to deny our requests without any notification, so we'd be waiting
forever for a window change that isn't coming.  :(

Fixes #5274.
2022-03-30 14:23:51 -04:00
Ryan C. Gordon
3425e9950e stdinc: SDL_COMPILE_TIME_ASSERT defines shouldn't have a semicolon. 2022-03-30 10:13:47 -04:00
Ivan Epifanov
cbdb67b4f6 Vita: add SDL_GetPreferredLocales support 2022-03-29 15:02:21 -07:00
Ivan Epifanov
178ac19615 Vita: add audio capture support 2022-03-29 14:12:37 -07:00
Frank Praznik
4d1905c9b6 video: wayland: Use viewports for non-fullscreen windows with fractional scaling
Use viewports for non-fullscreen windows when the desktop uses fractional scaling and the window is flagged as DPI-aware to provide a backbuffer mapped as close to 1:1 output as possible.  In the cases of odd window sizes the backbuffer may be a pixel off of scaling perfectly into the window size due to its scaled size being rounded off, but a minute amount of scaling during output is likely preferable to the large amounts of overdraw needed with integer scaled buffers.
2022-03-29 15:00:07 -04:00
Frank Praznik
fa4c51989d video: wayland: Expose more resolutions for mode emulation
Expose as many emulated display modes as possible.  They will currently display stretched to the display's native desktop aspect, but if an application requires a hardcoded resolution, it will work at minimum.

Aside from the change in the emulated display mode list, the Wayland event handling code had to be updated to support separate scaling for the x and y axes, as square pixels are no longer guaranteed.
2022-03-28 22:19:34 -04:00
Ethan Lee
d875416ac4 wayland: Minor fix for old compilers 2022-03-28 15:32:30 -04:00
Frank Praznik
4d76c9cb46 video: wayland: Use wp-viewporter for fullscreen with non-native resolutions
Wayland doesn't support mode switching, however Wayland compositors can support the wp_viewporter protocol, which allows for the mapping of arbitrarily sized buffer regions to output surfaces.  Use this functionality, when available, for fullscreen output when using non-native display modes and/or when dealing with scaled desktops, which can incur significant overdraw without this extension.

This also allows for the exposure of arbitrarily sized, emulated display modes, which can be useful for legacy compatability.
2022-03-28 13:18:26 -04:00
Connor Clark
aec86ba8bb emscriptenaudio: proxy calls to main thread 2022-03-28 12:04:04 -04:00
Ivan Epifanov
96be9cddcc Vita: add hint to select which touchpad generates mouse events 2022-03-28 08:36:32 -07:00
Mathieu Eyraud
1db47d468a Fix potential memory leak in QueueCmdFillRects 2022-03-28 08:34:32 -07:00
Cameron Gutman
a60986caa8 Correct default structure packing on Windows ARM64
See issue #5454 for details
2022-03-27 19:03:54 -05:00
SDL Wiki Bot
6d1c3cd691 Sync wiki -> header 2022-03-27 17:11:05 +00:00
Ivan Epifanov
95ed83137f Vita: Use preallocated memory pool for textures 2022-03-27 10:07:49 -07:00
SDL Wiki Bot
2591f7e39c Sync wiki -> header 2022-03-27 16:52:04 +00:00
SDL Wiki Bot
7ba4d24c25 Sync wiki -> header 2022-03-27 16:49:05 +00:00
capehill
0dcfa92e4c testgles2: Call correct function to get shader info log and add link status checking 2022-03-27 09:44:48 -07:00
Cameron Cawley
6529bf3de7 Clean up formatting in README-directfb.md 2022-03-27 09:12:25 -07:00
Cameron Cawley
0bc9e243b9 Remove URLs from markdown headers in README-visualc.md 2022-03-27 09:12:25 -07:00
Ryan C. Gordon
7bc498d325 direct3d: Implement missing blend operations.
This is only for Direct3D 9; Direct3D 11 already had this implemented.

Fixes #5375.
2022-03-27 09:14:07 -04:00
Ozkan Sezer
a630b02938 configure: improvements to libdecor discovery :
use PKG_CHECK_MODULES, and use DECOR_LIB with find_lib.
Closes: https://github.com/libsdl-org/SDL/pull/5460

Co-authored-by: Trigan2025 <trigan2025@hotmail.fr>
2022-03-27 11:56:40 +03:00
Ethan Lee
713a675401 wayland: Relax the check for mismatching output scales 2022-03-26 22:26:15 -04:00
Ethan Lee
5655be1558 wayland: Avoid overwriting xdg_output position with wl_output position 2022-03-26 19:57:39 -04:00
Ethan Lee
40417b188a wayland: Work around a GNOME xdg_output scaling issue 2022-03-26 19:55:04 -04:00
Ryan C. Gordon
94ed6b0a54 README-windows: Notes on building with Visual Studio/LLVM.
Fixes #5186.
2022-03-26 08:55:26 -04:00
Ryan C. Gordon
5acb4b70ab README-windows: Wordwrap text file.
This makes for easier reading outside of a formal Markdown viewer.
2022-03-26 08:50:25 -04:00
Ryan C. Gordon
26bfee8578 README-windows: Convert to actual Markdown text. 2022-03-26 08:47:46 -04:00
Ryan C. Gordon
beecae31f6 testshader: use SDL_malloc instead of SDL_stack_alloc. 2022-03-26 08:42:09 -04:00
capehill
d6122704e8 Initialize compile status variable and check also program link status 2022-03-26 08:38:42 -04:00
Ethan Lee
7a1c45bd1c wayland: Optimize keyboard_handle_modifiers.
1. Mod index values are (mostly) constant, so can be done with xkb_state_new
2. Mods can change without the group changing, avoid remap events if possible

Lastly, as a bonus, I added braces to the locale check, because I was nearby.
2022-03-25 12:54:05 -04:00
Ivan Epifanov
69d0b6e3c6 Vita: Fix NULL-pointer dereference 2022-03-25 09:29:20 -04:00
Sylvain
bf38fd4679 YUV: fix invalid read on last line when converting from SDL_PIXELFORMAT_YUY2 (see bug #4841) 2022-03-25 11:52:50 +01:00
Ethan Lee
2891f0821b wayland: Use xkb_keymap_mod to set mod state 2022-03-25 02:49:49 -04:00
Ethan Lee
6d9ca92626 wayland: Enforce text capitalization manually, for remapped keymods 2022-03-25 01:36:39 -04:00
Ethan Lee
a75c6150e0 wayland: Add an xkb_keysym_t->SDL_Keycode mapping for backspace 2022-03-25 01:33:40 -04:00
DominusExult
ee96407edf iOS >= 10.0 silence GLes deprecation warnings 2022-03-24 12:37:10 -07:00
Ethan Lee
ab74b6a3c3 wayland: Remove some now-redundant casts 2022-03-24 15:34:29 -04:00
Ethan Lee
ee52ad08cd wayland: Minor fixes for old compilers 2022-03-24 15:32:25 -04:00
Simon McVittie
b4d28085bf wayland: Don't overwrite error message from SDL_EGL_CreateSurface
SDL_EGL_CreateSurface sets a more specific error message, so overwriting
it would lose information.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-24 14:59:25 -04:00
Simon McVittie
d5bbbd3f73 Avoid depending on libwayland 1.20 unnecessarily
When using shared linking (linking in the normal way with
-lwayland-client) rather than loading Wayland libraries dynamically at
runtime, listing symbols that don't exist in the current version results
in a build failure. We don't actually call wl_proxy_marshal_flags() or
wl_proxy_marshal_array_flags() directly; the reason we need them is
that they're called by the code generated by wayland-scanner >= 1.20.

If we're building against an older Wayland library, then we'll have its
corresponding version of wayland-scanner (mismatched versions are not
supported), so we won't need those two symbols, and can avoid generating
a dependency on them.

Conversely, if we're building against a newer Wayland library, the
generated code will call them unconditionally, so we cannot treat them as
optional and gracefully fall back: that would result in a crash. Instead,
treat them as a mandatory part of the Wayland library, so that if they
are not found at runtime, we can fall back to X11 without crashing.

libwayland 1.18 is in several LTS distributions (Ubuntu 20.04,
Debian 11, RHEL 8) so avoiding a hard dependency on 1.20 is quite
useful.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/libsdl-org/SDL/issues/5376
2022-03-24 14:46:48 -04:00
Ryan C. Gordon
d597a9b431 x11: Minor cleanups and corrections in X11_ShowMessageBox.
Reference issue #3254.
2022-03-24 14:25:34 -04:00
Sylvain
6c56193a2a Fixed bug #1650: X11 doesn't set KMOD_NUM and KMOD_CAPS to system state 2022-03-24 18:09:45 +01:00
Kimplul
2398c43be2 add some Thrustmaster wheels 2022-03-24 08:33:37 -07:00
Ryan C. Gordon
4fe7b2cbd1 static analysis: Fixed several complaints from codechecker.
There are still some pending Objective-C specific issues.

Reference issue #4600.
2022-03-24 11:00:43 -04:00
Ivan Epifanov
eadc064e2c Vita: add native YUV textures support.
* Fail if texture init fails.
* Refactor and cleanup.
2022-03-24 07:51:20 -04:00
Ivan Epifanov
0af2db6f29 Vita: support audio format fallback 2022-03-24 07:51:20 -04:00
Frank Praznik
0dae35bf3d video: wayland: Use xdg-output for retrieving the desktop dimensions
Using wl-output to get the desktop display dimensions and dividing by the integer scale factor will not return the correct result when using a desktop with fractional scaling (e.g. a 3840x2160 display at 150% will incorrectly report the scaled desktop area as 1920x1080 instead of 2560x1440).  Use the xdg-output protocol, if available, to retrieve the correct desktop dimensions and offset.

Versions 1 through 3 of the protocol are supported.
2022-03-23 19:43:11 -04:00
Florian "sp1rit"​
9125b244e7 wayland: Basic support for zwp_tablet_*v2 protocol 2022-03-23 13:47:46 -04:00
Ethan Lee
13337e17a5 wayland: The rest of the wayland-client 1.18 requirement... Git, please 2022-03-23 13:27:01 -04:00
Ethan Lee
f3ff0c568e wayland: Bump minimum requirement to wayland-client 1.18 or newer 2022-03-23 13:23:33 -04:00
SDL Wiki Bot
2a4e0f8fd0 Sync wiki -> header 2022-03-23 16:09:05 +00:00
Sylvain Becker
c23a7ad38a Add SDL_RenderGetWindow() API to get the window associated with a renderer (#5440)
Add SDL_RenderGetWindow() API to get the window associated with a renderer
2022-03-23 17:07:56 +01:00
Joao Paulo Magalhaes
57df1dfce6 Video: do not use hardcoded VIVANTE and VDK libraries 2022-03-23 08:49:29 -07:00
Sylvain
f5a980448e Android: add SetWindowResizable() implementation
- which also enable/disable the orientation lock status.

This is only provided when the window is not SDL_WINDOW_FULLSCREEN (see SDL_video.c).
Final orientation also depends on SDL_HINT_ORIENTATIONS.
2022-03-23 10:13:56 +01:00
Sam Lantinga
006aafabcf Fixed freeing a constant string (thanks @gnrlwart) 2022-03-22 20:24:17 -07:00
Ryan C. Gordon
8df045cc7d stdlib: just cast iconv()'s 2nd arg to void *.
This makes the compiler happy (enough) regardless of whether the C runtime
headers think this argument should be const or not.

Fixes #4966.
2022-03-22 16:14:06 -04:00
Charlie Birks
4b8d69a416 Avoid trying to use texture framebuffers on emscripten 2022-03-22 12:18:45 -07:00
pionere
25203222f5 optimize the SDL_str(case)cmp functions 2022-03-22 12:17:50 -07:00
pionere
aec58d8208 make SDL_strcasecmp standard compliant 2022-03-22 12:17:50 -07:00
pionere
b59ca92e82 use != '\0' comparison instead of SDL_strlen in the functions of SDL_getenv 2022-03-22 12:17:50 -07:00
Jonatha Gabriel
b944dc8f2e Also fix Android crash when SDL_HIDAPI_DISABLED set to 1
The Java code needs the native functions to be implemented, even if
they're not surfaced via the C API, therefore, a stub version of
functions were made only to the purpose of "fill the gaps" when
SDL_HIDAPI_DISABLED set to 1.
2022-03-22 12:12:16 -07:00
Egor
2302b2d5e5 Add mapping for Logitech Precision Gamepad 2022-03-22 10:04:03 -07:00
Sylvain
83df4a354e SDL_render.c: remove unsused case, since renderer target has been forced to NULL previously (see bug #4213) 2022-03-22 15:25:01 +01:00
Ryan C. Gordon
f782abe5f0 hints: Added SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE.
Fixes #2349.
2022-03-22 09:54:29 -04:00
Sam Lantinga
34fd83ca06 Don't try to hide foreign windows when destroying the SDL window representation
Fixes https://github.com/libsdl-org/SDL/issues/5432
2022-03-22 06:50:10 -07:00
Ozkan Sezer
74680f5c4c regenerated SDL_blit_auto.c. 2022-03-22 00:56:28 +03:00
pionere
dd6c46cb34 blit-auto optimizations 2022-03-22 00:56:28 +03:00
Sylvain
9dc201d448 Fixed bug #2962 - when SDL_RenderReadPixels format = 0, used format of the target texture
include/SDL_render.h, format:
"0 to use the format of the rendering target "
2022-03-21 10:41:14 +01:00
Sylvain
7f1feee02a Fixed bug #2426 - SDL_RenderReadPixels result is unspecified and fails testautomation
Call SDL_RenderPresent after calling SDL_RenderReadPixels.
From "include/SDL_render.h":
"If you're using this on the main rendering target, it should be called after rendering and before SDL_RenderPresent()."
2022-03-21 10:20:04 +01:00
Ryan C. Gordon
2b3c16eb5b Sync wiki -> headers. 2022-03-20 23:17:14 -04:00
Eddy Jansson
24ffcbd9ad audio: Set error message on dsp init failure.
if SDL_EnumUnixAudioDevices() fails to find any devices,
set an error message on the exit path. Without this,
SDL_Init() could fail without any message available
in SDL_GetError().
2022-03-20 10:31:19 -07:00
Sam Lantinga
8f964576da Fixed parameter operation ordering for ease of reading 2022-03-19 11:01:55 -07:00
Sam Lantinga
0517b61ed6 Relative mouse mode is tied to the window with keyboard focus
This isn't obvious, but makes sense when thinking about how games actually use it. This is also in line with how Windows mouse relative mode is implemented.

Fixes https://github.com/libsdl-org/SDL/issues/5340
2022-03-19 11:00:00 -07:00
Sam Lantinga
b559a4accc Fixed Android crash when SDL_HIDAPI_DISABLED set to 1
The Java code needs the native functions to be implemented, even if they're not surfaced via the C API.

Fixes https://github.com/libsdl-org/SDL/issues/5326
2022-03-19 10:39:22 -07:00
Sam Lantinga
a485ffc3c8 Fix "SDL_FALSE is not defined" runtime error for emscripten. 2022-03-19 09:50:22 -07:00
Ryan C. Gordon
d81fee7623 SDL_Rect: Added floating point versions of all the rectangle APIs.
Fixes #5110.
2022-03-19 10:35:24 -04:00
Ryan C. Gordon
4d9bef604a SDL_Rect: minor code cleanups. 2022-03-19 10:35:23 -04:00
Ryan C. Gordon
c573ebe143 SDL_UnionRect: If both rects are empty, zero out the result struct. 2022-03-19 10:35:23 -04:00
Christian Kündig
fbbd0270eb Fix "SDL_TRUE is not defined" runtime error for emscripten. 2022-03-18 16:42:12 -07:00
SDL Wiki Bot
aef1e56737 Sync wiki -> header 2022-03-18 17:30:05 +00:00
Sam Lantinga
40b7326b38 Added a note that SDL_RenderReadPixels() should be called before SDL_RenderPresent() 2022-03-18 10:28:38 -07:00
Sam Lantinga
6c96217727 Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, controlling whether the mouse should be constrained to the center of the window or the whole window in relative mode.
For further info about the pros and cons, check out the discussion in https://github.com/libsdl-org/SDL/issues/5271
2022-03-18 10:07:59 -07:00
Sam Lantinga
d3cc5764c0 Modern CMake doesn't need "LANGUAGE C" for Objective-C
CMake 3.19 fails to compile Objective-C with that property set

Fixes https://github.com/libsdl-org/SDL/issues/5418
2022-03-18 07:36:16 -07:00
Sam Lantinga
1868c5b521 Start rumbling once a raw input controller has been correlated
Fixes https://github.com/libsdl-org/SDL/issues/5351
2022-03-17 18:25:50 -07:00
Sam Lantinga
3167ba342d Fixed freeing the Windows blank cursor 2022-03-17 17:58:35 -07:00
Sam Lantinga
0387bf821a Fixed memory leak in WIN_CreateBlankCursor() 2022-03-17 17:55:28 -07:00
Sam Lantinga
5ff42438e3 Added a hint to capture the mouse when mouse buttons are pressed, defaulting on
Fixes https://github.com/libsdl-org/SDL/issues/5301
2022-03-17 17:39:46 -07:00
Sam Lantinga
09b8152fae Use SDL_Log instead of printf 2022-03-17 17:19:21 -07:00
Sam Lantinga
b22ce2b5a8 Workaround for bug in Microsoft WGI support
Fixes https://github.com/libsdl-org/SDL/issues/5270
2022-03-17 17:10:40 -07:00
Sam Lantinga
d406278513 Try not forcing activation when grabbing the mouse in fullscreen windows 2022-03-17 17:01:36 -07:00
Sam Lantinga
4e784fce43 When updating grab state, only activate windows that are grabbed, fullscreen, and shown.
Fixes https://github.com/libsdl-org/SDL/issues/5371
2022-03-17 16:57:33 -07:00
Sam Lantinga
e5f45455c9 Added a hint to mark a foreign window as usable with OpenGL
Fixes https://github.com/libsdl-org/SDL/issues/2942
2022-03-17 14:44:34 -07:00
Sam Lantinga
4e49b78a11 Fixed compile warning and comment typo 2022-03-17 14:44:17 -07:00
Ethan Lee
0bf8ccfb60 video: Add a hint to allow Vulkan surfaces on foreign windows 2022-03-17 14:25:55 -07:00
Sam Lantinga
ecaa22cbe6 Don't warn if anyone peeps for events after quitting the event subsystem
Fixes https://github.com/libsdl-org/SDL/issues/5013
2022-03-17 14:22:51 -07:00
Antoine Fontaine
3318590796 Fix relative mouse input for Unvanquished (unvanquished.net)
Here's an IRC dump that hopefully explains the issue this fixes:

> I'm debugging something odd where, for a libre game,
  unvanquished.net (a FPS), relative mouse input in fullscreen is
  buggy
> it's like, working mostly ok, but it has a weird
  performance/cleanup bug
> after some time in relative mouse input mode, some time as low
  as 15s, usually more, the SDL sends A LOT of relative mouse
  input per frame
> almost all of which have xrel==0 && yrel==0
> by A LOT, I mean that after ~1min, it's usually in the
  thousands per frame
> each frame, a while ( SDL_PollEvent( &e)) loop reads the
  inputs, but it seems SDL is not clearing the list.
> one way to clear the list is to open the in-game console or
  menu, which switches the input mode to absolute, then close it
  which gets a working relative input mode (for some time at least)
> I've shown the issue to be present with SDL2.0.20 but not with
  2.0.14 on my system
> some other players on Arch Linux (SDL2.0.20) report a possibly
  related issue, where some keys seem to be pressed at random
> I've did some bisection on SDL master, and I've found that
  there are actually two commits involved, one breaking it
  totally (no input at all), and one fixing it partially (with
  the problem described above)

First related commit that breaks it totally:

	commit 82793ac279
	Author: Sam Lantinga <slouken@libsdl.org>
	Date:   Thu Oct 14 14:26:21 2021 -0700

	    Fixed mouse warping while in relative mode

	    We should get a mouse event with an absolute position and no relative motion and shouldn't change the OS cursor position at all

Second related commit, that halfway fixes it:

	commit 31f8c3ef44
	Author: Sam Lantinga <slouken@libsdl.org>
	Date:   Thu Jan 6 11:27:44 2022 -0800

	    Fixed event pump starvation if the application frequently pushes its own events

Reverting the first commit did fix the issue for me, but would
probably reintroduce the bug it was fixing(?). This patch should
fix it for everyone hopefully.

https://github.com/DaemonEngine/Daemon/issues/600 is the upstream
bug, and contains some early investigation.
2022-03-17 14:00:59 -07:00
Esme Povirk
829e15a490 Ignore unknown WM_SIZE types.
According to MSDN, we can also get SIZE_MAXHIDE and SIZE_MAXSHOW,
based on state changes to other windows. It's not clear under
what circumstances this will happen (I saw some docs indicating
it may require multiple application windows), but it doesn't seem
right to treat them as RESTORED.
2022-03-17 12:51:46 -07:00
uyjulian
a164c9d245 SDL_cocoawindow.m: update fullscreen toggle when SDL_SetWindowResizable called 2022-03-17 12:35:57 -07:00
Sam Lantinga
cc152103ba Fixed warnings when building with cygwin
Fixes https://github.com/libsdl-org/SDL/issues/5025
2022-03-17 11:37:08 -07:00
Sam Lantinga
e8c3ff56e0 Removed problematic call to ISensor_SetEventSink()
Fixes https://github.com/libsdl-org/SDL/issues/5288
2022-03-17 10:01:13 -07:00
Sam Lantinga
bcb0f1de23 Fixed build when events are disabled
Fixes https://github.com/libsdl-org/SDL/issues/5413
2022-03-17 08:52:31 -07:00
pionere
01bfde4520 simplify SetDSerror
- no need to keep the error in a static variable
- always print the error code
- reduce the required stack-size
- reduce the number of snprintf calls (and code size)
2022-03-17 08:44:06 -07:00
Ozkan Sezer
01663238dc testplatform.c: move static asserts out of TestTypes(). 2022-03-17 08:43:27 -07:00
Ozkan Sezer
f0d2747df1 use _Static_assert for SDL_COMPILE_TIME_ASSERT(), when available 2022-03-17 08:43:27 -07:00
Ozkan Sezer
dfbe1f7248 SDL_GetBasePath() fixes for OS/2 2022-03-17 03:50:02 +03:00
Sylvain
b2db570ce9 SDL_triangle_blit_slow: sync code with SDL_blit_slow to handle ARGB2101010 2022-03-16 18:09:40 +01:00
Sylvain
93e7caab9a SDL_blit_slow: remove one nested 'if()' because of ARGB2101010 handling 2022-03-16 18:08:20 +01:00
Sylvain
56568ffb38 Remove 'reserved identifier' warning 2022-03-16 18:04:40 +01:00
Ozkan Sezer
1c1f5c180f imported two libtool mainstream commits 28fbcb6a and b55b1cc8 2022-03-16 17:15:20 +03:00
pionere
2c6a9c5194 minor optimization (SDL_audiocvt.c) 2022-03-16 07:58:28 -04:00
pionere
85dff3e453 emscripten: obey enable-misc/SDL_MISC settings 2022-03-16 14:55:28 +03:00
staphen
123b9aaa41 Adjust gradle dependencies to enable the build to position assets for the APK 2022-03-15 21:57:25 -07:00
Ozkan Sezer
5905696e66 SDL_audiocvt.c: minor cleanup. 2022-03-15 23:10:04 +03:00
Ozkan Sezer
61a93d3c46 minor whitespace cleanup. 2022-03-15 23:10:02 +03:00
Ozkan Sezer
d1e4367f58 SDL_windowskeyboard.c: fix build with SDL_DISABLE_WINDOWS_IME defined.
Fixes https://github.com/libsdl-org/SDL/issues/5408
2022-03-15 21:41:02 +03:00
Ryan C. Gordon
1ee196b483 INSTALL.txt: Say "macOS" instead of "Mac OS X" in modern times.
Reference Issue #5407.
2022-03-15 13:07:55 -04:00
Sylvain
90b13e1488 Merge remote-tracking branch 'refs/remotes/origin/main' 2022-03-15 17:50:57 +01:00
Sylvain
c44966b78b Fixed bug #2691 - re-enable surface_testCompleteSurfaceConversion for ARGB2101010 2022-03-15 17:48:38 +01:00
Sylvain
f3e86b9fd3 Fixed bug #2199: make SDL_blit_slow handles SDL_PIXELFORMAT_ARGB2101010, storing as RGBA 2022-03-15 17:46:12 +01:00
Sam Lantinga
67848b6531 Fix name of macOS platform and link to README file 2022-03-15 09:25:01 -07:00
Sylvain Becker
3bebdaccb7 METAL: clip rect w/h must be <= render pass 2022-03-15 10:37:17 +01:00
Wohlstand
7c421fec16 SDL_audiocvt.c: Don't byteswap 8-bit streams
Otherwise, this results an assert on big endian machines when attenpting to use SDL_LoadWAV_RW function to load 8-bit WAV files.
2022-03-14 08:41:07 -07:00
Zach Reedy
363c36781d Fixed: Incorrect assumption that mouse button is released when window is allocated 2022-03-14 08:38:25 -07:00
Guus Waals
7495b98141 Make SDL_VIDEO_OPENGL_EGL optional on Android 2022-03-14 13:38:12 +01:00
Sylvain
0ad606b48d Android: add comment to set render target to NULL when going to background (bug #4041) 2022-03-14 10:43:18 +01:00
Ozkan Sezer
ecc1c871e6 SDL_endian.h: use endian predefs from newer gcc and clang versions.
Closes: https://github.com/libsdl-org/SDL/pull/5403
2022-03-14 10:10:40 +03:00
Ozkan Sezer
ee6bfcdd66 SDL_blit_N.c: removed duplicated const (fixes bug #5401) 2022-03-13 20:56:42 +03:00
Ryan C. Gordon
3ab739afff cmake: Make test code use proper C main functions.
Fixes #5021.
2022-03-13 12:10:52 -04:00
Ozkan Sezer
072db7b005 SDL_windowskeyboard.c (IME_IsTextInputShown): remove unused local vars. 2022-03-12 01:56:40 +03:00
SDL Wiki Bot
229297d97f Sync wiki -> header 2022-03-11 22:47:04 +00:00
Zach Reedy
d14a126383 IME Composition Truncation + SDL_IsTextInputShown + SDL_ClearComposition (#5398)
* Fixes for IME Composition Truncation + Addition of SDL_ClearComposition, SDL_IsTextInputShown

* Fixed: Documentation and code style issues raised during code review.
2022-03-11 14:45:17 -08:00
Charlie Birks
9de97e19cc emscripten: Don't prevent default on filtered key events 2022-03-11 11:55:41 +00:00
Ozkan Sezer
afb0606f5a minor os/2 clean-ups. 2022-03-10 18:50:10 +03:00
Ozkan Sezer
50575aa184 Makefile.os2: fixed setting OS2DEBUG in CFLAGS. 2022-03-10 18:50:10 +03:00
Cameron Gutman
677dc1015c rawinput: Fix double detection of gamepads on some 3rd party X360 wireless receivers
The name that the Raw Input joystick driver pulls from the HID stack comes
from USB string descriptors contained on the device. For official wireless
receivers, this always contains "Xbox 360 Wireless Receiver for Windows"
which matches the friendly name that WGI provides.

3rd party Xbox 360 wireless receivers may have different strings in their
USB string descriptors (one uses "XBOX 360 For Windows" instead). This
fails to match WGI's name and causes Raw Input and WGI to both report the
same gamepad.

Since wireless Xbox 360 controllers seem to have a consistent VID/PID
regardless of the adapter enumerating them, we can also match on that to
catch these.

The duplicate case reported to me was:
Controller (XBOX 360 For Windows) - 030000005e040000a102000000007200
Xbox 360 Wireless Receiver for Windows - 030000005e0400000000000000007701
2022-03-09 21:19:53 -08:00
Ozkan Sezer
bf69868924 reduced a few ifdefs, fixed an unused warning if built w/o SDL_HAVE_YUV. 2022-03-10 01:55:04 +03:00
Jo Bates
01d38e7ade Make Win32 fullscreen and borderless windows minimizable 2022-03-09 14:08:12 -08:00
Sam Lantinga
09b652b70a Make sure the string properties are actually strings (thanks Nat!) 2022-03-09 13:54:23 -08:00
Sam Lantinga
c6eef542ab Removed dead code 2022-03-09 13:48:31 -08:00
pionere
911ba8d343 hide impossible branch in D3D_UnlockTexture 2022-03-09 20:17:55 +01:00
Sylvain
ea5b482bff Remove unused warning 2022-03-09 15:38:36 +01:00
Sylvain
45833a148d Prevent shadowing static variable '_this' with local paramter '_this' of SDL_CreateWindowTexture 2022-03-09 15:33:45 +01:00
Sylvain
a4a80c8607 Fix variable may be uninitialized when used here [-Wconditional-uninitialized] 2022-03-09 15:21:55 +01:00
Sylvain
04256a5372 Fix compilation (see #5313) 2022-03-09 15:12:25 +01:00
pionere
0983fcee5e fix memory leak in D3D11_CreateRenderer 2022-03-09 15:03:49 +01:00
pionere
3f8b450de2 extend the code hidden by SDL_HAVE_YUV 2022-03-09 15:03:30 +01:00
pionere
ce1883e1e7 fix compile error with disabled SDL_HAVE_YUV (vita)
- UpdateTextureYUV is not defined if SDL_HAVE_YUV is not defined/zero
+ calling SDL_free suffice if the VITA_GXM_RenderData was just allocated
2022-03-09 15:02:44 +01:00
Sam Lantinga
14db417e12 Reenable getting the serial number on macOS
We filter now on game controllers, so we shouldn't hit the crash bug on random devices that this was working around.
2022-03-08 21:32:27 -08:00
Sam Lantinga
c3ca3445bd Prefer HIDAPI on macOS, as that has extended functionality 2022-03-08 18:56:49 -08:00
Sam Lantinga
6a787619e6 Allow reading background events for MFi controllers 2022-03-08 18:42:13 -08:00
Sam Lantinga
b064ad6ac5 Allow GL_ARB_texture_non_power_of_two environment variable to override OpenGL 2.0 check 2022-03-08 18:14:10 -08:00
Sam Lantinga
1b7669374e Fixed the SDL controller type for USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 2022-03-08 09:58:24 -08:00
Mahyar Koshkouei
41e7d1baa6 Add SDL_GetDisplayDPI implementation on Emscripten
Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
2022-03-07 07:18:45 -05:00
Nick Cao
f03215bc70 fix linking with SDL_PULSEAUDIO_SHARED=OFF and SDL_X11_SHARED=OFF 2022-03-07 12:55:50 +03:00
Cameron Gutman
b2463a917c events: Add logging support for several missing event types 2022-03-06 15:02:53 -06:00
Sam Lantinga
bdafe1e049 Fixed whitespace 2022-03-04 11:01:55 -08:00
Sam Lantinga
2e801b1ae7 Split long text input into multiple events if needed (thanks @zreedy!) 2022-03-04 10:50:16 -08:00
SDL Wiki Bot
232c3556ac Sync wiki -> header 2022-03-04 17:30:05 +00:00
Sam Lantinga
ae73ea9c07 Clarified documentation for the trigger rumble API
Fixes https://github.com/libsdl-org/SDL/issues/5372
2022-03-04 09:27:46 -08:00
IOBYTE
13756b5c72 Add X1 and X2 button support to mouse test 2022-03-04 12:09:08 -05:00
Cameron Cawley
2f7b885df9 Fix 'potentially uninitialized local pointer variable' error in UWP builds 2022-02-28 09:04:33 -08:00
Cameron Cawley
b7f8117d40 Build the standalone MSVC projects with GitHub Actions 2022-02-28 09:04:33 -08:00
Cameron Cawley
550b8377bc Combine the MSVC and UWP workflows 2022-02-28 09:04:33 -08:00
Cameron Cawley
98353533e5 riscos: Report keyboard repeat events 2022-02-24 09:11:33 -08:00
Sam Lantinga
af40cb6f00 Added support for the Razer Huntsman Analog keyboard in controller mode 2022-02-23 15:49:10 -08:00
SDL Wiki Bot
669a7f8552 Sync wiki -> header 2022-02-23 16:18:05 +00:00
Ozkan Sezer
4a43321c81 cmake: Fix bug #5361.
src/joystick/*.c wasn't unconditionally added to source list even though
joystick is an SDL subsystem. Also removed the `SDL_JOYSTICK AND NOT APPLE`
condition from src/joystick/dummy/*.c source addition: the OSX unresolved
symbols issue, if it really is there, should be fixed separately.

Fixes https://github.com/libsdl-org/SDL/issues/5361, i.e. build failures
when SDL_JOYSTICK and SDL_HAPTIC are disabled.
2022-02-23 18:10:02 +03:00
Phillip Stephens
94d43186f2 GameCubeAdapter: Add suppport for all rumble modes
This adds support for all 3 of the gamecube controller's rumble modes
Rumble: 1
Stop: 0
StopHard: 2
This is useful for applications that need the full range of support
This also adds a hint to control rumble behavior, defaults 0 to maintain compatibility
2022-02-23 07:03:02 -08:00
Ryan C. Gordon
b946e31ec8 video: Allow unaccelerated SDL_HINT_FRAMEBUFFER_ACCELERATION renderers.
If the app requested a specific renderer, even if it's not the optimal path,
let them have it, because they might want to render with a specific GPU API
on top of the framebuffer pixels.

This fixes DosBox-X crashing on startup, which forces the hint to "opengl".
2022-02-23 09:36:06 -05:00
Ryan C. Gordon
60ddb74cfe video: rework how we prepare a texture framebuffer.
Now we see if we can create an SDL_Renderer, and if that renderer reports
itself as "accelerated," and added some initial heuristics to the OpenGL
renderer to make better decisions about what qualifies as "accelerated."

This adds some FIXMEs that might be merely hypothetical, and removes the
old OpenGL checks from the video subsystem that probably weren't meaningful
in modern times. This will definitely need to improve the existing list
in the GL renderer, to catch things like llvmpipe, etc.

Reference issue #4624.
2022-02-23 09:36:06 -05:00
Wohlstand
08d27dfd7b SDL_openslES.c: Detect float support in runtime and use it
Allow using of the float output type on newer Android devices, but keep PCM16 output on older

Closes #5358
2022-02-22 08:31:14 -08:00
Ryan C. Gordon
293a0aa80e opengl: If GL version >= 2.0, NPOT textures are supported, so favor them.
Fixes #5041.
2022-02-22 10:54:21 -05:00
Sam Lantinga
9299a3e796 Workaround for crash in CoUninitialize() 2022-02-21 16:24:45 -08:00
Sam Lantinga
978fbc3250 Fixed compile warnings 2022-02-21 12:02:44 -08:00
Sam Lantinga
6c531c4334 Correct handling of sentinel events when polling without removing events
Fixes https://github.com/libsdl-org/SDL/issues/5350
2022-02-21 11:35:31 -08:00
Cacodemon345
d90bd261f3 wscons: Make USB keyboard input layout independent 2022-02-18 09:30:04 -08:00
Sylvain
9d86ec8573 Palette format: software Render Jitter in rotation (see #5143)
- same fix applied for rotation with palette surfaces
- allow other 8bits format (eg 332)
2022-02-18 09:57:10 +01:00
Sylvain
ceb09ee740 Fixed #5143 - software Render Jitter in rotation
better precision calculating rotated coordinates and interpolation
2022-02-17 23:11:02 +01:00
Sam Lantinga
18032979d8 Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
2022-02-15 13:07:51 -08:00
Sylvain
75ffa24e3a Software Render Jitter in rotation (bug #5143)
The output surface doesn't necessarily to have even width and height.
2022-02-15 13:35:59 +01:00
Sylvain
61abc4e5b6 PSP: SDL_RenderCopyEx rotation and global scaling around the wrong way (see #bug 3070) 2022-02-15 11:34:50 +01:00
Sylvain
18b76fcc5d Fixed bug #3070 - SDL_RenderCopyEx rotation and global scaling around the wrong way (software renderer) 2022-02-15 11:33:56 +01:00
Sylvain
e366ad1288 Fixed bug #2308: SDL_RenderCopyEx rotation center precision (software renderer) 2022-02-15 10:02:34 +01:00
Wouter Wijsman
66ee79bd68 [PSP] Don't swizzle streaming textures
It was causing issues in the teststreaming demo and unswizzling
later is inefficient and causes issues.
2022-02-14 10:59:25 +01:00
Sam Lantinga
f97a29f6e1 Use the real device VID/PID when seeing the Steam virtual controller 2022-02-11 22:10:33 -08:00
Sylvain
85e6500065 X11 Segmentation fault with multiple windows and renderers (see #5256) 2022-02-11 11:08:08 +01:00
Wouter Wijsman
4cb6181808 Do not build loadso test eboot for PSP 2022-02-10 19:01:15 +01:00
Sylvain
a75041e8dd Fixed bug #2140: basic support to convert 16 colors palette PIXELFORMAT_INDEX4, to allow conversion to SDL_Texture 2022-02-10 13:44:59 +01:00
Wouter Wijsman
abc8198a1f Render all sides when drawing rect on PSP 2022-02-09 09:36:19 -08:00
Sylvain
5b41844c75 Fixed bug #5322 - register virtual input devices as SDL_Touch device, fix compilation 2022-02-09 09:50:41 +01:00
Sylvain
3a9bbf604e Fixed bug #5322 - register virtual input devices as SDL_Touch device because
they can send SOURCE_TOUCHSCREEN events even if getSources() doesn't declare them.
2022-02-09 09:37:36 +01:00
Sylvain
59f1e2875a Android: add debug function to display class/sources 2022-02-08 21:50:19 +01:00
Frank Praznik
228db35287 audio: pipewire: Tidy up formatting 2022-02-08 14:33:34 -05:00
Frank Praznik
9da9e85cba audio: pipewire: Reset all hotplug values and pointers on shutdown
Ensure that all hotplug variables and pointers are reset to NULL or their original value when shutting down.
2022-02-08 14:33:34 -05:00
Frank Praznik
5b36a527ed audio: pipewire: Remove redundant locks
The io_list_check_add() and io_list_remove() functions are only ever called from within the Pipewire thread loop, so the locks are redundant.  io_list_sort() is called from within a lock in the device detection function, so those additional locks are redundant as well.
2022-02-08 14:33:34 -05:00
Frank Praznik
48b4d1c412 audio: pipewire: Convert atomic hotplug conditional variables to SDL_bool
The hotplug loop condition variables are always guarded by the loop mutex while the loop is running, so they don't need to be atomic.
2022-02-08 14:33:34 -05:00
Ozkan Sezer
67f12ede3b move bug #5333 fix to headers 2022-02-08 21:32:50 +03:00
Wouter Wijsman
54304b971d Fix rotation direction and center point on PSP 2022-02-08 09:47:10 -08:00
Wouter Wijsman
2b572dff88 Make RenderCopyEx rotate around center
This still isn't perfect. The rotation is the wrong way around and the
images are upside down.
2022-02-08 09:47:10 -08:00
Sylvain
2df2da11f6 Android: handleMotionEvent() is checking for SOURCE_JOYSTICK. So don't handle DPAD GAMEPAD (see #5322, #2718) 2022-02-08 17:51:40 +01:00
Sylvain
1fc5dba3d5 Android: test for SOURCE_KEYBOARD / SOURCE_MOUSE. Don't compare to 0, since there are several bits (see #5322, #2718) 2022-02-08 17:41:17 +01:00
Ozkan Sezer
7935cfacc5 SDL_mfijoystick.m: use __typeof instead of typeof.
Fixes https://github.com/libsdl-org/SDL/issues/5319
2022-02-08 18:55:10 +03:00
Ozkan Sezer
9b817248c5 SDL_spinlock.c: define HAVE_GCC_ATOMICS for windows/clang builds,
... if not already defined.
Fixes https://github.com/libsdl-org/SDL/issues/5333

diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c
index bdd347e..4f10741 100644
--- a/src/atomic/SDL_spinlock.c
+++ b/src/atomic/SDL_spinlock.c
@@ -28,6 +28,12 @@
 #include "SDL_mutex.h"
 #include "SDL_timer.h"

+#if defined(__WIN32__) && defined(__clang__)
+# ifndef HAVE_GCC_ATOMICS
+# define HAVE_GCC_ATOMICS 1
+# endif
+#endif
+
 #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__)
 #include <atomic.h>
 #endif
2022-02-08 18:50:02 +03:00
Sylvain
f185711203 Fixed bug #5310: Android, Undefined reference to AAssetManager_fromJava 2022-02-08 16:18:01 +01:00
Sylvain
68dd84f1de Android: TouchDevice -1 is reserved for SDL synthetic devce (See #5322) 2022-02-08 11:42:24 +01:00
Sylvain
94e5c3f30e testgesture: display device name with SDL_GetTouchName() 2022-02-08 11:40:39 +01:00
SDL Wiki Bot
580d231822 Sync wiki -> header 2022-02-08 10:37:04 +00:00
Sylvain
e7e44df039 Dynapi: add SDL_GetTouchName() entry 2022-02-08 11:34:41 +01:00
Sylvain
34d4f5b14e Fixed bug #2032: add SDL_GetTouchName to expose the driver name of the device (Thanks @mgerhardy!) 2022-02-08 11:32:20 +01:00
Ivan Epifanov
8ce003a42c Vita: credit cpasjuste 2022-02-07 15:36:42 -08:00
Sylvain
14bc3bf4ec Android: fix typo to register TOUCHSCREEN device (see #5322, #2718) 2022-02-07 22:20:05 +01:00
Frank Praznik
53091e36a3 audio: pipewire: Remove the hard upper bound on rates and buffer sizes
Remove the hard upper limit of 8192 samples and instead use the buffer sizes provided by Pipewire to determine the size of the intermediate input buffer and whether double buffering is required for output streams. This allows for higher latency streams to potentially avoid double-buffering in the output case, and we can guarantee that the intermediate input buffer will always be large enough to handle whatever Pipewire may deliver.

As the buffer size calculations occur in a callback in the Pipewire processing thread itself, the stream readiness check has been modified to wait on two distinct flags set when the buffers have been configured and when the stream is ready and running.
2022-02-07 15:11:31 -05:00
Frank Praznik
66866249a2 audio: pipewire: Condition variable doesn't need to be atomic
The condition variable is guarded by a mutex, so no need for it to be atomic.
2022-02-07 15:11:31 -05:00
Luke Street
0cb39ed468 cmake: Fix SDL_LIBUSB_DYNAMIC soname 2022-02-07 14:22:31 -05:00
Sylvain
b0dd4c7d36 SDL_Render OpenGL: do batching like in the GLES2 backend (with no VBO) 2022-02-07 14:02:20 -05:00
Sylvain
90f0d2ce49 Revert OpenGL point drawing performance, do to proper batching 2022-02-07 14:02:20 -05:00
waddlesplash
423feac69b haiku: Actually remove BDirectWindow and fix OpenGL handling.
This provides the other half of 05c72b113c.
2022-02-06 19:19:21 -05:00
Ozkan Sezer
9403543671 cmake: enable_language(OBJC) only for APPLE 2022-02-05 18:50:00 +03:00
Ozkan Sezer
3c9ac4489e cmake: enable_language(OBJC) to fix check_objc_source_compiles(). 2022-02-05 18:45:50 +03:00
Ozkan Sezer
686a0f3456 cmake: include CheckOBJCSourceCompiles for cmake >= 3.16
c.f. bugs #5011 and #3912
2022-02-05 18:28:24 +03:00
pionere
6d5592a201 minor cleanup of SDL_CreateRenderer 2022-02-05 10:05:25 -05:00
Ozkan Sezer
e8c48981f9 pthread/SDL_systhread.c: always include errno.h
fixes build for several targets after commit 87b02d3 for bug #5283.
2022-02-05 08:56:56 +03:00
Sam Lantinga
5c4fff7f63 Don't fail to get battery status if the upower refresh call fails 2022-02-04 14:02:44 -08:00
Ozkan Sezer
c8cee0b8ca OS2_HasClipboardText: store the boolean result before closing clipboard.
just in case..
2022-02-04 23:28:56 +03:00
Ozkan Sezer
b5614d0c6e cmake: fix UWP joystick.
from: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0005-Fix-uwp-joystick.patch
2022-02-04 20:05:14 +03:00
Ozkan Sezer
c93e552068 minor update to winrt/SDL_sysurl.cpp
from: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0006-Update-SDL_sysurl.cpp.patch
2022-02-04 20:03:50 +03:00
Ozkan Sezer
050a5e1a15 removed unused SDL_config_wiz.h 2022-02-04 20:02:20 +03:00
Ozkan Sezer
c459eceee1 removed unused Makefile.wiz 2022-02-04 19:50:50 +03:00
Ozkan Sezer
3b9e6c1cec SDL_os2video.c: fixed HasClipboardText() semantics.
Empty string in clipboard is expected to give FALSE by SDL_HasClipboardText.
Noticed in a commit by josch1710 in bitwiseworks' os/2 fork.
2022-02-04 19:50:20 +03:00
Joshua Ashton
86b7a0642f Add additional VID/PIDs for Anne Pro II
This thing changes its VID/PID on firmware revisions...
2022-02-04 08:45:19 -08:00
Sam Lantinga
dd69c28d6f Added a mapping for the Xbox Series X controller, firmware version 5.11.3118.0, connected to Linux via Bluetooth 2022-02-03 18:01:34 -08:00
Temdog007
b59e75c259 Handle menu button press from controller 2022-02-02 21:21:44 -08:00
Ravbug
2005dd9595 UWP build (#5299)
* Add UWP-x64 action

* Fix formatting

* Fix missing -
2022-02-02 14:06:52 -08:00
pionere
2cfc83eab7 sync D3D_RenderReadPixels with D3D11_RenderReadPixels
- use the result of SDL_ConvertPixels to propagate error
- get rid of the verbose error message of D3D11_RenderReadPixels in case SDL_ConvertPixels failed
2022-02-02 14:56:38 -05:00
pionere
3bef4a5da6 cleanup error-handling in SDL_egl.c
- always set error message in SDL_EGL_ChooseConfig / SDL_EGL_CreateContext
- assume SDL_EGL_DeleteContext does not alter the error message
- sync generic error message of SDL_EGL_MakeCurrent with SDL_EGL_Get/SetSwapInterval
- do not overwrite error message of SDL_EGL_ChooseConfig in WINRT_CreateWindow
2022-02-02 14:56:21 -05:00
pionere
b5c5052608 cleanup error-handling in SDL_bmp.c
- add missing error-message in SDL_LoadBMP_RW
- check return value of SDL_RWtell in SDL_LoadBMP_RW
- use standard SDL_EFREAD error instead of custom strings
+ adjust return type of readRlePixels
2022-02-02 14:55:36 -05:00
pionere
19df4af2aa simplify SDL_DUMMY/OFFSCREEN_CreateWindowFramebuffer 2022-02-02 14:45:48 -05:00
SonicMastr
ecd922b5cf Fix touch holding detection after #5244 changes 2022-02-02 08:55:26 -08:00
Sylvain
df0d696a62 RISCOS: attempt to fix compilation ERANGE 2022-02-02 15:22:14 +01:00
Sylvain
87b02d3795 Linux thread name limitation: test for ERANGE (see bug #5283) 2022-02-02 15:09:29 +01:00
Francisco Javier Trujillo Mata
daea9fa19e Remove SDL_config_psp and references 2022-02-02 08:36:39 -05:00
Francisco Javier Trujillo Mata
ff5f5d0ef4 Updating Readme-psp info 2022-02-02 08:36:39 -05:00
Francisco Javier Trujillo Mata
ec632aba15 Remove legacy and unused Makefile.psp 2022-02-02 08:36:39 -05:00
Sylvain
220a9596f3 Remove testing instruction (see bug #5283) 2022-02-02 10:01:11 +01:00
Sylvain
9e46a512b1 Fixed bug #5283 - limit thread name to 16 characters when using pthread_setname_np() 2022-02-02 09:58:15 +01:00
Weng Xuetian
b11dfd7611 Only generate key repetition for keys that should repeat on wayland.
This fix repetition on modifier keys, e.g. Control.
2022-02-01 17:56:04 -05:00
Weng Xuetian
a90a2e7582 Fix text_input_v3 preedit string
For every batch of text_input_v3 updates, if there is no preedit in this
batch, preedit should be cleared.
2022-02-01 15:51:26 -05:00
Sam Lantinga
03c4405b3b Fixed D-Bus battery refresh call 2022-02-01 09:33:18 -08:00
SDL Wiki Bot
e1cf8d8748 Sync wiki -> header 2022-02-01 16:58:05 +00:00
SDL Wiki Bot
4fa21dd65b Sync wiki -> header 2022-02-01 10:37:05 +00:00
Sylvain
d46cc18afc Fix function comment 2022-02-01 11:35:26 +01:00
Sylvain
d224a63bda Fix compilation for non Android 2022-02-01 11:34:01 +01:00
SDL Wiki Bot
61b6a2cad4 Sync wiki -> header 2022-02-01 10:33:04 +00:00
Sylvain
fe2ed6cf6f Fixed bug #5221 - Add SDL_AndroidSendMessage() 2022-02-01 11:30:43 +01:00
pionere
97269e143d adjustments to ime_candidates
- allocate ime_candidates on demand
- allow write to the whole allocated memory of ime_candidates
- ensure ime_candcount is set to zero in case the candidates can not be queried for any reason
2022-01-31 22:06:26 -05:00
pionere
6f404d0f04 cleanup IME_GetCandidateList / UILess_GetCandidateList
- move IME_ShowCandidateList, ImmGetContext and ImmReleaseContext to this function
- set ime_candpgsize to MAX_CANDLIST if dwPageSize is zero
- comment out deselection of ime_candsel in case of korean language for the moment (LANG_CHT does not work anyway)
2022-01-31 22:06:26 -05:00
Sam Lantinga
ec8e3104c8 Refresh the battery state before we query it on Linux 2022-01-31 17:01:08 -08:00
Frank Praznik
0b34f18045 audio: pipewire: Don't double free properties on init failure
The context and stream creation functions will destroy the passed properties object on failure, so no need to do it manually.

The pw_properties_free() function pointer is no longer needed, so it can be removed.
2022-01-30 23:23:03 -05:00
Sylvain
f7d3abddba Fixed bug #964 - SDL_RenderCopy stretch loses proportion on viewport.
Handle the case when there is blending
2022-01-29 10:19:08 +01:00
Ozkan Sezer
8b139e26a3 regenerated configure script. 2022-01-29 10:33:50 +03:00
pionere
a5c610b0a3 revert 'Changed to use 0xFE instead of 0xFF for better sound quality.' 2022-01-28 20:40:19 -05:00
Ryan C. Gordon
43f0271b4e Revert "fix compiler warnings in SDL_windows_gaming_input.c"
This reverts commit ca36cdb185.

The older Windows SDK's headers are wrong, and this change would crash if
you hotplug a device.
2022-01-28 20:40:19 -05:00
pionere
a70bb259c7 drop handle parameter of OpenDevice 2022-01-28 20:40:19 -05:00
pionere
47ddb04e17 cleanup/sync the main loop of *_OpenDevice functions to pick audio format II. 2022-01-28 20:40:19 -05:00
pionere
2eafe4340c cleanup/sync the main loop of *_OpenDevice functions to pick audio format 2022-01-28 20:40:19 -05:00
pionere
3939ef72f8 cleanup SDL_GetAudioDeviceSpec
- drop unnecessary hascapture check
- call SDL_InvalidParamError and return -1 in case the index is out of range
- do not zfill SDL_AudioSpec
- adjust documentation to reflect the behavior
2022-01-28 20:40:19 -05:00
pionere
113109f839 cleanup SDL_GetAudioDeviceName
- drop unnecessary hascapture check
- call SDL_InvalidParamError in case the index is out of range
2022-01-28 20:40:19 -05:00
pionere
f91211eb17 cleanup WASAPI_PrepDevice
- reorganize the loop which checks for the right wave-format
- use the return value of UpdateAudioStream
- ensure SetError is called in SDL_NewAudioStream
2022-01-28 20:40:19 -05:00
pionere
c9e8d1573a re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory II. 2022-01-28 20:40:19 -05:00
pionere
1043dd8c0d adjust handling of iscapture
- drop iscapture parameter of OpenDevice
- use SDL_bool for iscapture
2022-01-28 20:40:19 -05:00
pionere
e2f70a2dff cleanup SDL_EventState 2022-01-28 20:40:19 -05:00
pionere
32c7d5d352 cleanup IME_UpdateInputLocale
- do not store the HKL in a static variable
- always set the ime_candvertical value in case the HKL is changed
2022-01-28 20:40:19 -05:00
pionere
25aa7244dc cleanup IME_GetId
- use assert instead of a check (it is a static function with constant parameter)
- assume it is called with 0 first (simplifies the logic)
- reuse dwLang value instead of a new 'call' to LANG()
2022-01-28 20:40:19 -05:00
pionere
60deadba59 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory 2022-01-28 20:40:19 -05:00
pionere
ebdd536676 use SDL_InvalidParamError or SDL_assert instead of custom SDL_SetError 2022-01-28 20:40:19 -05:00
pionere
4a17612bff get rid of BeginLoopIteration 2022-01-28 20:40:19 -05:00
pionere
0770c5829c get rid of PrepareToClose 2022-01-28 20:40:19 -05:00
Ryan C. Gordon
e0236c02ce audio: Removed an unnecessary commented-out line. 2022-01-28 20:40:19 -05:00
pionere
0dda8a7f4c cleanup init functions of audio
- use SDL_bool if possible
- assume NULL/SDL_FALSE filled impl
- skip zfill of current_audio at the beginning of SDL_AudioInit (done before the init() calls)
2022-01-28 20:40:19 -05:00
pionere
6fcfcc3d6f get rid of SkipMixerLock 2022-01-28 20:40:19 -05:00
pionere
3c85cef46c cleanup SDL_RegisterApp
- fix memory leak when RegisterClassEx fails
- set style according to the documentation
- eliminate duplicated SDL_Instance setter
2022-01-28 20:40:19 -05:00
pionere
0af391cbe9 build with Release config on push and pull_request 2022-01-28 20:40:19 -05:00
pionere
ff2d62d89f dlopen is not a subsystem 2022-01-28 20:40:19 -05:00
pionere
a633a3c33e add audio/video dummies if nothing else available II. 2022-01-28 20:40:19 -05:00
pionere
398f9a0e40 fix have_audio/video flags, add uikit to SUMMARY_video in configure 2022-01-28 20:40:19 -05:00
pionere
fa8075c4fc add audio/video dummies if nothing else available 2022-01-28 20:40:19 -05:00
pionere
39c723fc9c fix HAVE_SDL_VIDEO flag of CMakeLists.txt [IOS OR TVOS] 2022-01-28 20:40:19 -05:00
pionere
3dba2a73f1 fix HAVE_SDL_AUDIO flag of CMakeLists.txt II. 2022-01-28 20:40:19 -05:00
pionere
014e2bbdb2 use SDL_COMPILE_TIME_ASSERT instead of SDL_STATIC_ASSERT 2022-01-28 20:40:19 -05:00
pionere
3936af99d8 fix HAVE_SDL_AUDIO flag of CMakeLists.txt 2022-01-28 20:40:19 -05:00
pionere
21510387cf fix CMakeLists.txt vs. configure inconsistencies
- atomic subsystem is disabled by default (changed in configure)
- SDL_WAYLAND_LIBDECOR is disabled by default if SDL_WAYLAND is not set (changed in CMakeLists.txt)
2022-01-28 20:40:19 -05:00
pionere
95f30c7a48 fix compiler warnings in video/uikit 2022-01-28 20:40:19 -05:00
pionere
11cdde01f3 fix MacOS build with disabled SDL_SENSOR
+ get rid of the double-check (SDL_HAPTIC depends on SDL_JOYSTICK)
2022-01-28 20:40:19 -05:00
pionere
176941a4fb allow MacOS build without SDL_FILE 2022-01-28 20:40:19 -05:00
pionere
b1b2ad725c sync handling of subsystems II. (+) 2022-01-28 20:40:19 -05:00
pionere
eb80f2c65a sync handling of subsystems II. 2022-01-28 20:40:19 -05:00
pionere
65e9415b98 sync handling of subsystems
- add DUMMY-define in case the subsystem is enabled but not available (filesystem/misc/locale)
- add missing PSP/VITA-filesystem defines
- sync the order of filesystems in SDL_config.h.cmake/in
- add option to disable locale subsystem in configure
2022-01-28 20:40:19 -05:00
pionere
ea8cf4bd0f add 'Misc' subsystem II. 2022-01-28 20:40:19 -05:00
pionere
118de86202 more conform vulkan/metal configuration 2022-01-28 20:40:19 -05:00
pionere
606d2ea87f bugfix for "add 'Misc' subsystem" 2022-01-28 20:40:19 -05:00
pionere
998117b3ff add 'Misc' subsystem 2022-01-28 20:40:19 -05:00
pionere
942b01a54c do not use RWOps in WIN_SetWindowIcon 2022-01-28 20:40:19 -05:00
pionere
739f350f45 add SDL_LOCALE_DISABLED to SDL_config.h 2022-01-28 20:40:19 -05:00
pionere
bf66720a4d fix mixing of U16 audio 2022-01-28 20:40:19 -05:00
pionere
905e2e22ef cleanup of SDL_MixAudioFormat 2022-01-28 20:40:19 -05:00
pionere
d7110b4490 fix compiler warnings in SDL_windows_gaming_input.c 2022-01-28 20:40:19 -05:00
pionere
e11ba0f5d9 do not load/unload opengl library when SDL_WINDOW_METAL flag is changed 2022-01-28 20:40:19 -05:00
Sylvain
f5911bdc59 GLES2: disable texcoord when not using it (see bug #5235)
similar to opengl backend code:
- glDisableVertexAttribArray doesn't need to depend on 'drawstate.texture' value
- move binding code to SetCopyState()
2022-01-28 19:25:40 +01:00
Sylvain
096fe37bb2 GLES2: revert 7bf8c5a388 2022-01-28 19:25:40 +01:00
Sylvain
a988ce5544 Fixed bug #964 - SDL_RenderCopy stretch loses proportion on viewport boundaries 2022-01-28 17:24:59 +01:00
Sylvain
7bf8c5a388 GLES2: disable texcoord when not using it (see bug #5235) 2022-01-27 21:49:05 -05:00
Vitaliy Zhmurikov
5b74459255 Update SDL_joystick.c
Add Logitech Momo Racing Wheel VID & PID  to SDL_IsJoystickProductWheel function
2022-01-27 12:30:41 -08:00
Ryan C. Gordon
19ae71b2db video: Don't add SDL_WINDOW_(METAL|OPENGL) to new windows if unsupported.
Fixes #4656.

(Better than the previous fix in 3044310518dbb2d4814b32c6521f332b8d69aae5.)
2022-01-27 11:49:15 -05:00
Ivan Epifanov
d7e0c54dde PSVita: send initial SDL_JOYDEVICEADDED events 2022-01-27 08:47:53 -08:00
Cameron Gutman
cc40f732f9 wayland: Round the refresh rate rather than truncating it
A 59999 mHz monitor should be reported as 60 Hz, not 59 Hz.
2022-01-26 21:27:13 -06:00
Ryan C. Gordon
3044310518 video: Don't add SDL_WINDOW_METAL to new windows if not using Cocoa or UIKit.
Fixes #4656.
2022-01-26 21:10:15 -05:00
Cameron Gutman
77a9ca6ba0 wayland: Fix SDL_SetWindowSize() being dropped right after exiting fullscreen
If we get a SDL_SetWindowSize() call right after SDL_SetWindowFullscreen() but
before we've gotten a new configure event from the compositor, the attempt to
set our window size will silently fail (when libdecor is enabled).

Fix this by remembering that we need to commit a new size, so we can do that
in decoration_frame_configure().
2022-01-26 19:48:16 -05:00
Cameron Gutman
c6ec5a07f1 d3d11: Respect SDL_HINT_RENDER_DIRECT3D_THREADSAFE when creating device 2022-01-26 18:44:29 -06:00
Ryan C. Gordon
f37e4a94d3 video: Don't check if we can use a "texture framebuffer" until needed.
This prevents SDL from making an OpenGL context and maybe throwing it away
immediately by default. It will now only do it when trying to request a
window framebuffer directly, or creating an SDL_Renderer with the "software"
backend, which makes that request itself.

The way SDL decides if it should use a "texture framebuffer" needs dramatic
updating, but this solves the immediate problem.

Reference Issue #4624.
2022-01-26 17:06:25 -05:00
Eric Wasylishen
71e06a536a cmake: fix Metal detection
Confirmed to work on:
macOS 10.15.7
XCode Version 12.4 (12D4e)
2022-01-26 12:33:16 -05:00
Ethan Lee
8ceba27d62 video: Prefer Wayland over X11 2022-01-26 12:32:45 -05:00
Ethan Lee
68a71f91c6 wayland: Try to avoid committing before the window is shown 2022-01-25 17:19:19 -05:00
Sam Lantinga
84320266f2 Fixed the queue filling up with sentinel events when the WaitEvent call is passed NULL for the event
The use case is an application that waits for events on the main thread and dispatches them on a separate thread.
2022-01-25 12:37:43 -08:00
Ethan Lee
f0e768da43 wayland: Call SetFullscreen directly in ShowWindow.
This cuts out an extra flush when getting the first configure event.
2022-01-25 13:07:00 -05:00
Sylvain
8c660ccb6f Fixed bug #5256: X11 Segmentation fault with multiple windows and renderers
First window is created and it triggers and 'EnterNotify' event
which calls SDL_SetMouseFocus() and X11_ShowCursor() while the second
windows hasn't finished to be created  (eg window->driverdata isn't set)
Just check for a valid 'driverdata'
2022-01-25 17:18:40 +01:00
Ethan Lee
e2d74bcbe5 wayland: Detach hidden surfaces in HideWindow, not ShowWindow 2022-01-25 11:16:09 -05:00
Ryan C. Gordon
ca22b30e46 testgles2: Use vertex buffer objects instead of client-side arrays.
GLES2 always has them, and they work without hacks on Emscripten, unlike
client-side arrays.

I cleaned it up slightly, but this patch was mostly written by @bing2008.

Fixes #5258.
2022-01-24 22:41:41 -05:00
ulatekh
57bc90403e Add hint to optionally forcibly raise the window under MS Windows. 2022-01-24 11:10:57 -08:00
ulatekh
d7873e656b Disable tablet flicks under MS Windows. 2022-01-22 08:52:46 -08:00
Charlie Birks
15ebad6e7d emscripten: Implement SDL_OpenURL 2022-01-22 13:31:11 +00:00
Charlie Birks
99af3281ee timer: Fix Emscripten declaration-after-statement error 2022-01-22 12:27:54 +00:00
ulatekh
53df0e6619 Fix the erroneous generation of mouse-down events from touch-move events.
The issue is that MS Windows synthesizes a mouse-move event in response
to touch-move events, and those mouse-move events are NOT labeled as
coming from a touch (e.g. GetMouseMessageSource() will not return
SDL_MOUSE_EVENT_SOURCE_TOUCH for those synthesized mouse-move events).

In addition, there seems to be no way to prevent this from happening;
https://gist.github.com/vbfox/1339671 claims to demonstrate a technique
to prevent it, but in my experience, it doesn't work.

Because of this, the "fallthrough" case can't test that the synthesized
mouse-move came from a touch-move, and starts erroneously pressing down
the mouse-button, leading to massive confusion in the client
application.
2022-01-21 17:23:59 -08:00
ulatekh
8f8b14cbb6 Synthesize a missing touch-up event.
If a touch-down event is received for an existing touch-ID, that
probably means the operating system lost it, and that the missing
touch-up should be synthesized, to keep the client state coherent.
2022-01-21 17:23:11 -08:00
Ozkan Sezer
d2456b6e4c os2, geniconv: default functions pointers to Uni*() API,
In case they get accessed before SDL_Init() was called.
2022-01-21 11:50:40 +03:00
Sam Lantinga
67cb548bef Fixed build error with C90 compilers 2022-01-20 19:31:54 -08:00
Carl Glave
a23b3c767f Add support for correlating trigger input 2022-01-20 17:43:35 -08:00
Ethan Lee
e1b4761c62 wayland: Avoid calling SetFullscreen in libdecor ShowWindow.
This caused some weird stuff to happen in the libdecor path, probably because
the window hasn't actually been mapped yet. It ends up calling stuff that
should not yet apply, and so fullscreen in particular would have a really
messed up titlebar.

The good news is, libdecor is good about tracking fullscreen state, so we can
let the callback do this for us. Keep this for xdg_shell because we actually
map the window ourselves, so we know this call is valid for that path.
2022-01-20 14:10:58 -05:00
Ethan Lee
ed3442d7a5 wayland: Fix building with SDL_OPENGL=OFF 2022-01-19 15:47:52 -05:00
Ryan C. Gordon
426c1f4b85 opengles2: fix comment about client-side arrays. 2022-01-19 14:28:30 -05:00
Frank Praznik
b3984df1c6 audio: pipewire: Use client config files instead of module names
Pipewire, as of 0.3.22, uses client config files to load modules instead of explicitly specifying them (PW_KEY_CONTEXT_PROFILE_MODULES is deprecated).  Use the new method to load the realtime module to boost the audio thread priority.
2022-01-19 14:20:19 -05:00
Ozkan Sezer
381520ad92 updates for watcom optimization flags 2022-01-18 14:32:24 +03:00
Sam Lantinga
a0e3c884d4 Updated to version 2.0.21 for development 2022-01-17 15:32:27 -08:00
Ozkan Sezer
1bfefb5b4d regenerated configure script. 2022-01-17 20:56:50 +03:00
Ozkan Sezer
a575e2cf5e Enable alloca on mingw/cygwin builds:
This effectively reverts commit 391d73e37b26614e2e343ca8e9d4334e07380896
Fixes https://github.com/libsdl-org/SDL/issues/5234
2022-01-17 20:56:24 +03:00
Ozkan Sezer
33dadbf137 'dnl' whitespace tidy-up in configure.ac 2022-01-17 20:56:20 +03:00
Cameron Gutman
d3952a8a2c wayland: Avoid spurious resize events 2022-01-17 11:30:03 -06:00
Sam Lantinga
b06866ef97 Entirely remove Xbox axis filtering, we don't want this at all. 2022-01-16 09:44:28 -08:00
Sam Lantinga
09aed1020b Don't send output reports to the Victrix Pro FS v2
It'll hang on reboot if it gets output reports, and it doesn't have functionality that requires them, so skip it.
2022-01-16 09:23:58 -08:00
Sam Lantinga
85961b61a1 Disable Xbox axis deadzone handling by default
Fixes https://github.com/libsdl-org/SDL/issues/5227
2022-01-16 09:01:56 -08:00
Mathieu Eyraud
2a0cde8fd5 Always send SDL_WINDOWEVENT_SIZE_CHANGED when window is resized
SDL_WINDOWEVENT_SIZE_CHANGED is now sent even if the resulting size of the window does not match the requested size.
2022-01-16 08:49:48 -08:00
Sam Lantinga
1a50334c46 Fixed Xbox One trigger axis zero point 2022-01-14 15:04:26 -08:00
Ozkan Sezer
e9511f7136 hidapi, libusb: don't use iconv on OS/2, it lacks wchar_t functionality.
Taken from a patch by Silvan Scherrer at bitwiseworks' OS/2 fork.
2022-01-14 14:39:04 +03:00
Ethan Lee
9a2bbd8acb wayland: Convert URI to local path for DropFile 2022-01-12 13:01:05 -05:00
Ozkan Sezer
0abc0a6f32 SDL_string.c: tidy-up gcc2 va_copy defines after previous haiku commit. 2022-01-12 20:37:32 +03:00
kenmays
d37c9777b9 haiku: updated for Haiku 2022-01-12 09:32:56 -08:00
kenmays
bff867013e haiku: updated for Haiku 2022-01-12 09:32:56 -08:00
kenmays
094e94402d haiku: Remove BDirectWindow, fix OpenGL handling.
From e6cc4e7f4b8189be55dd3b0e13e54e59f73d7672 Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Thu, 30 Jan 2020 04:01:58 +0900
Subject: libsdl2: Remove BDirectWindow, fix OpenGL handling.

* BDirectWindow changed to BWindow.
* Implemented fullscreen.
* Introduced view for non-OpenGL drawing.
* Drawing thread removed, window thread is used instead.
* Use BGLView as OpenGL context. Implement proper context switching and OpenGL
  locking. Only one context per window is supported. BGLView should be not
  deleted when window is closed, it deleted when deleting context.
2022-01-12 09:32:56 -08:00
Ozkan Sezer
407d4e470a cmake: simplify after the previous os/2 commit. 2022-01-12 20:32:00 +03:00
Ozkan Sezer
f199f832e9 cmake: added target_properties for os/2. 2022-01-12 20:22:28 +03:00
Ozkan Sezer
5b6e2d69a5 SDL_os2messagebox.c (_makeDlg): remove unnecessary casts 2022-01-12 11:01:02 +03:00
Ryan C. Gordon
ae9e2149a5 os2-buildbot.sh: Use the 64-bit Watcom binaries.
GitHub Actions is a 64-bit Ubuntu instance. It was only using the 32-bit
binaries because our buildbot put this on the 32-bit Linux host to spread
the CPU load around more evenly.
2022-01-11 21:32:07 -05:00
Ryan C. Gordon
42302d0a59 x11: Let apps specify a custom _NET_WM_WINDOW_TYPE.
Fixes #5185.
2022-01-11 21:17:21 -05:00
Ryan C. Gordon
f9b918ff40 opengles2: Use client-side arrays on everything but Emscripten.
Turns out they're much faster!

Fixes #5206.
2022-01-11 19:41:41 -05:00
ulatekh
bb9ebad74b Optionally disable generation of SDL2main and uninstall projects.
Mostly meant to allow SDL2 to be incorporated as a sub-project of
external CMake projects.
2022-01-11 15:56:37 -08:00
Khem Raj
fcf0e524bb cmake: Remove libunwind-generic as hard dependency
when using alternate unwind implementations like LLVM libunwind
this library is not provided yet the libunwind features are fully
implemented in main libunwind, making this hard dependency assumes
a particular libunwind implementation, this patch makes it optional
which makes the builds to work with llvm libunwind

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-01-11 11:00:20 -08:00
Sam Lantinga
73434a964c Removed debian directory
This isn't used directly by any distribution and isn't helpful at this point.
2022-01-11 10:37:59 -08:00
Max Krummenacher
c3a7cc34fb cmake: sdlchecks.cmake: pass cflags to the appropriate cmake variable
If egl.pc sets at least two macros as the i.MX Vivante driver does, e.g.:
| Cflags: -I${includedir} -DLINUX -DWL_EGL_PLATFORM

then we get the following error during configuration:

| -- Performing Test HAVE_OPENGL_EGL
| CMake Error: Parse error in command line argument: WL_EGL_PLATFORM
|  Should be: VAR:type=value

If one changes to add a value to the macro, e.g.
| Cflags: -I${includedir} -DLINUX=1 -DWL_EGL_PLATFORM=1
then cmake does not error out but the macro is not passed to the
C compiler.

CMAKE_REQUIRED_FLAGS is the wrong variable to pass the CFLAGS in,
CMAKE_REQUIRED_DEFINITIONS should be used.

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
2022-01-11 09:00:37 -08:00
Ozkan Sezer
ea0bca573d SDL_cocoamodes.m: fix build against older SDKs.
Fixes https://github.com/libsdl-org/SDL/issues/5208
2022-01-11 14:56:56 +03:00
Ozkan Sezer
7527c8d3d7 hidapi, libusb: provide a wcsdup implementation if it is not available.
similar to mac and android versions..
2022-01-11 11:33:02 +03:00
Ozkan Sezer
c6c4d4211b pthread: disable SetThreadPriority for OS/2 too 2022-01-11 11:33:02 +03:00
Ozkan Sezer
b265677610 cmake: initial attempt at adding os/2 support. 2022-01-11 11:33:02 +03:00
331 changed files with 11791 additions and 6096 deletions

View File

@@ -15,11 +15,6 @@ jobs:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), os: windows-latest, shell: pwsh, flags: -A x64 }
- { name: Windows (x86), os: windows-latest, shell: pwsh, flags: -A Win32 }
- { name: Windows (clang-cl x64), os: windows-latest, shell: pwsh, flags: -T ClangCL -A x64 }
- { name: Windows (clang-cl x86), os: windows-latest, shell: pwsh, flags: -T ClangCL -A Win32 }
- { name: Windows (ARM64), os: windows-latest, shell: pwsh, flags: -A ARM64 }
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
- { name: Linux, os: ubuntu-20.04, shell: sh, flags: -GNinja }
@@ -84,5 +79,5 @@ jobs:
- name: Configure CMake
run: cmake -B build -DSDL_TEST=ON ${{ matrix.platform.flags }}
- name: Build
run: cmake --build build/
run: cmake --build build/ --config Release

33
.github/workflows/msvc.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Build (MSVC)
on: [push, pull_request]
jobs:
Build:
name: ${{ matrix.platform.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform:
- { name: Windows (x64), flags: -A x64, project: VisualC/SDL.sln, projectflags: '/p:Platform=x64' }
- { name: Windows (x86), flags: -A Win32, project: VisualC/SDL.sln, projectflags: '/p:Platform=Win32' }
- { name: Windows (clang-cl x64), flags: -T ClangCL -A x64 }
- { name: Windows (clang-cl x86), flags: -T ClangCL -A Win32 }
- { name: Windows (ARM64), flags: -A ARM64 }
- { name: UWP (x64), flags: -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0" -DSDL_TEST=OFF, project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' }
steps:
- uses: actions/checkout@v2
- name: Configure CMake
run: cmake -B build -DSDL_TEST=ON ${{ matrix.platform.flags }}
- name: Build CMake
run: cmake --build build/ --config Release --parallel
- name: Add msbuild to PATH
if: ${{ matrix.platform.project != '' }}
uses: microsoft/setup-msbuild@v1.0.2
- name: Build msbuild
if: ${{ matrix.platform.project != '' }}
run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }}

View File

@@ -7,20 +7,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache OpenWatcom
uses: actions/cache@v2
env:
cache-name: cache-openwatcom
with:
path: ~/openwatcom
key: ${{ runner.os }}-build-${{ env.cache-name }}
- name: Download OpenWatcom if not cached
run: if [ ! -d ~/openwatcom/binl64 ]; then wget --no-verbose 'https://github.com/open-watcom/open-watcom-v2/releases/download/Current-build/open-watcom-2_0-c-linux-x64' -O ~/ow.zip && mkdir -p ~/openwatcom && cd ~/openwatcom && unzip ~/ow.zip && chmod -R a+rx ~/openwatcom ; fi
shell: bash
- name: Build
run: WATCOM="$HOME/openwatcom" build-scripts/os2-buildbot.sh
shell: bash
- uses: open-watcom/setup-watcom@v0
- name: Build SDL2
run: |
wmake -f Makefile.os2
- name: Build tests
run: |
cd test && wmake -f Makefile.os2
cd ..
- name: distclean
run: |
wmake -f Makefile.os2 distclean
cd test && wmake -f Makefile.os2 distclean
cd ..

File diff suppressed because it is too large Load Diff

View File

@@ -8,10 +8,10 @@ To compile and install SDL:
* Read the FAQ at https://wiki.libsdl.org/FAQWindows
* Run './configure; make; make install'
Mac OS X with Xcode:
macOS with Xcode:
* Read docs/README-macosx.md
Mac OS X from the command line:
macOS from the command line:
* Run './configure; make; make install'
Linux and other UNIX systems:

View File

@@ -19,6 +19,7 @@ distfile = $(distdir).tar.gz
@SET_MAKE@
SHELL = @SHELL@
CC = @CC@
CXX = @CXX@
INCLUDE = @INCLUDE@
CFLAGS = @BUILD_CFLAGS@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
@@ -49,7 +50,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@
INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac debian docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols
GEN_DIST = SDL2.spec
ifneq ($V,1)

View File

@@ -11,7 +11,7 @@
# wmake -f Makefile.os2 HIDAPI=1
LIBNAME = SDL2
VERSION = 2.0.20
VERSION = 2.0.22
DESCRIPTION = Simple DirectMedia Layer 2
LIBICONV=0
@@ -28,7 +28,13 @@ INCPATH+= -Iinclude
LIBM = SDL2libm.lib
TLIB = SDL2test.lib
LIBS = mmpm2.lib $(LIBM)
CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei
CFLAGS = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxhn -ei
# Debug options:
# - debug messages from OS/2 related code to stdout:
#CFLAGS+= -DOS2DEBUG
# - debug messages from OS/2 code via SDL_LogDebug():
#CFLAGS+= -DOS2DEBUG=2
# max warnings:
CFLAGS+= -wx
# newer OpenWatcom versions enable W303 by default
@@ -54,13 +60,7 @@ CFLAGS_DLL+= -DHAVE_LIBUSB_H=1
# building SDL itself (for DECLSPEC):
CFLAGS_DLL+= -DBUILD_SDL
# Debug options:
# - debug messages from OS/2 related code to stdout:
#CFLAGS+= -DOS2DEBUG
# - debug messages from OS/2 code via SDL_LogDebug():
#CFLAGS+= -DOS2DEBUG=2
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c
SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
SRCS+= SDL_rwops.c SDL_power.c
@@ -140,9 +140,11 @@ SDL_blendpoint.obj: SDL_blendpoint.c
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
SDL_RLEaccel.obj: SDL_RLEaccel.c
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
!ifeq HIDAPI 1
# c99 mode needed because of structs with flexible array members in libusb.h
SDL_hidapi.obj: SDL_hidapi.c
wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $<
!endif
$(LIBICONV_LIB): "src/core/os2/iconv2.lbc"
@echo * Creating: $@

View File

@@ -1,117 +0,0 @@
# The threads code require a rather new PSP SDK with SceLwMutexWorkarea:
# https://github.com/pspdev/pspsdk/commit/276d9e3ca6fb26479ad050c21431b2a40f518365
#
TARGET_LIB = libSDL2.a
EXTRA_TARGETS = libSDL2main.a
OBJS= src/SDL.o \
src/SDL_assert.o \
src/SDL_dataqueue.o \
src/SDL_error.o \
src/SDL_hints.o \
src/SDL_log.o \
src/atomic/SDL_atomic.o \
src/atomic/SDL_spinlock.o \
src/audio/SDL_audio.o \
src/audio/SDL_audiocvt.o \
src/audio/SDL_audiodev.o \
src/audio/SDL_audiotypecvt.o \
src/audio/SDL_mixer.o \
src/audio/SDL_wave.o \
src/audio/psp/SDL_pspaudio.o \
src/cpuinfo/SDL_cpuinfo.o \
src/events/SDL_clipboardevents.o \
src/events/SDL_displayevents.o \
src/events/SDL_dropevents.o \
src/events/SDL_events.o \
src/events/SDL_gesture.o \
src/events/SDL_keyboard.o \
src/events/SDL_mouse.o \
src/events/SDL_quit.o \
src/events/SDL_touch.o \
src/events/SDL_windowevents.o \
src/file/SDL_rwops.o \
src/haptic/SDL_haptic.o \
src/haptic/dummy/SDL_syshaptic.o \
src/hidapi/SDL_hidapi.o \
src/joystick/SDL_joystick.o \
src/joystick/SDL_gamecontroller.o \
src/joystick/psp/SDL_sysjoystick.o \
src/joystick/virtual/SDL_virtualjoystick.o \
src/power/SDL_power.o \
src/power/psp/SDL_syspower.o \
src/filesystem/psp/SDL_sysfilesystem.o \
src/locale/SDL_locale.o \
src/locale/dummy/SDL_syslocale.o \
src/misc/SDL_url.o \
src/misc/dummy/SDL_sysurl.o \
src/render/SDL_render.o \
src/render/SDL_yuv_sw.o \
src/render/psp/SDL_render_psp.o \
src/render/software/SDL_blendfillrect.o \
src/render/software/SDL_blendline.o \
src/render/software/SDL_blendpoint.o \
src/render/software/SDL_drawline.o \
src/render/software/SDL_drawpoint.o \
src/render/software/SDL_render_sw.o \
src/render/software/SDL_rotate.o \
src/render/software/SDL_triangle.o \
src/sensor/SDL_sensor.o \
src/sensor/dummy/SDL_dummysensor.o \
src/stdlib/SDL_getenv.o \
src/stdlib/SDL_iconv.o \
src/stdlib/SDL_malloc.o \
src/stdlib/SDL_qsort.o \
src/stdlib/SDL_stdlib.o \
src/stdlib/SDL_string.o \
src/stdlib/SDL_strtokr.o \
src/thread/SDL_thread.o \
src/thread/generic/SDL_systls.o \
src/thread/psp/SDL_syssem.o \
src/thread/psp/SDL_systhread.o \
src/thread/psp/SDL_sysmutex.o \
src/thread/psp/SDL_syscond.o \
src/timer/SDL_timer.o \
src/timer/psp/SDL_systimer.o \
src/video/SDL_RLEaccel.o \
src/video/SDL_blit.o \
src/video/SDL_blit_0.o \
src/video/SDL_blit_1.o \
src/video/SDL_blit_A.o \
src/video/SDL_blit_N.o \
src/video/SDL_blit_auto.o \
src/video/SDL_blit_copy.o \
src/video/SDL_blit_slow.o \
src/video/SDL_bmp.o \
src/video/SDL_clipboard.o \
src/video/SDL_fillrect.o \
src/video/SDL_pixels.o \
src/video/SDL_rect.o \
src/video/SDL_stretch.o \
src/video/SDL_surface.o \
src/video/SDL_video.o \
src/video/SDL_yuv.o \
src/video/psp/SDL_pspevents.o \
src/video/psp/SDL_pspvideo.o \
src/video/psp/SDL_pspgl.o \
src/video/psp/SDL_pspmouse.o \
src/video/yuv2rgb/yuv_rgb.o
SDLMAIN_OBJ = src/main/psp/SDL_psp_main.o
EXTRA_CLEAN = $(SDLMAIN_OBJ)
INCDIR = ./include
CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lGL -lGLU -lglut -lz \
-lpspvfpu -lpsphprm -lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgum -lpspgu -lpspaudiolib -lpspaudio -lpsphttp -lpspssl -lpspwlan \
-lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -lpspvram
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
libSDL2main.a: $(SDLMAIN_OBJ)
$(AR) cru $@ $^
$(RANLIB) $@

View File

@@ -1,88 +0,0 @@
# Makefile to build the pandora SDL library
WIZSDK = /mythtv/media/devel/toolchains/openwiz/arm-openwiz-linux-gnu
AR = $(WIZSDK)/bin/arm-openwiz-linux-gnu-ar
RANLIB = $(WIZSDK)/bin/arm-openwiz-linux-gnu-ranlib
CC = $(WIZSDK)/bin/arm-openwiz-linux-gnu-gcc
CXX = $(WIZSDK)/bin/arm-openwiz-linux-gnu-g++
STRIP = $(WIZSDK)/bin/arm-openwiz-linux-gnu-strip
CFLAGS = -Wall -fPIC -I./include -I$(WIZSDK)/include -DWIZ_GLES_LITE
TARGET_STATIC = libSDL2.a
TARGET_SHARED = libSDL2.so
SOURCES = \
./src/*.c \
./src/atomic/*.c \
./src/audio/*.c \
./src/audio/disk/*.c \
./src/audio/dsp/*.c \
./src/audio/dummy/*.c \
./src/cpuinfo/*.c \
./src/events/*.c \
./src/file/*.c \
./src/filesystem/unix/*.c \
./src/haptic/*.c \
./src/haptic/linux/*.c \
./src/hidapi/*.c \
./src/joystick/*.c \
./src/joystick/linux/*.c \
./src/loadso/dlopen/*.c \
./src/locale/*.c \
./src/locale/unix/*.c \
./src/misc/*.c \
./src/misc/unix/*.c \
./src/power/*.c \
./src/sensor/*.c \
./src/sensor/dummy/*.c \
./src/stdlib/*.c \
./src/thread/*.c \
./src/thread/pthread/SDL_syscond.c \
./src/thread/pthread/SDL_sysmutex.c \
./src/thread/pthread/SDL_syssem.c \
./src/thread/pthread/SDL_systhread.c \
./src/timer/*.c \
./src/timer/unix/*.c \
./src/video/*.c \
./src/video/yuv2rgb/*.c \
./src/video/dummy/*.c \
./src/video/pandora/*.c
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
all: config_copy $(TARGET_STATIC) $(TARGET_SHARED)
$(TARGET_STATIC): $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@
$(TARGET_SHARED):
$(CC) -shared -Wl,-soname,$(TARGET_SHARED).0 -o $(TARGET_SHARED).0.0.1 $(OBJECTS)
ln -s $(TARGET_SHARED).0.0.1 $(TARGET_SHARED).0
ln -s $(TARGET_SHARED).0 $(TARGET_SHARED)
config_copy:
cp include/SDL_config_wiz.h include/SDL_config.h
clean:
rm -f $(TARGET_STATIC) $(TARGET_SHARED)* $(OBJECTS)
install:
mkdir -p $(WIZSDK)/lib
mkdir -p $(WIZSDK)/include/SDL2
cp -f $(TARGET_STATIC) $(WIZSDK)/lib
cp -f $(TARGET_SHARED).0.0.1 $(WIZSDK)/lib
rm -f $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0.0.1 $(WIZSDK)/lib/$(TARGET_SHARED).0
ln -s $(WIZSDK)/lib/$(TARGET_SHARED).0 $(WIZSDK)/lib/$(TARGET_SHARED)
cp $(TARGET_STATIC) ../../toolchain/libs
cp $(TARGET_SHARED).0.0.1 ../../toolchain/libs
rm -f ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
ln -s ../../toolchain/libs/$(TARGET_SHARED).0.0.1 ../../toolchain/libs/$(TARGET_SHARED).0
ln -s ../../toolchain/libs/$(TARGET_SHARED).0 ../../toolchain/libs/$(TARGET_SHARED)
cp $(TARGET_SHARED).0.0.1 ../nehe_demos/build/$(TARGET_SHARED).0
cp -f include/*.h $(WIZSDK)/include/SDL2/
cp -f include/*.h ../../toolchain/include/SDL2/

View File

@@ -144,6 +144,7 @@
<ClInclude Include="..\src\SDL_fatal.h" />
<ClInclude Include="..\src\SDL_hints_c.h" />
<ClInclude Include="..\src\SDL_internal.h" />
<ClInclude Include="..\src\SDL_list.h" />
<ClInclude Include="..\src\sensor\dummy\SDL_dummysensor.h" />
<ClInclude Include="..\src\sensor\SDL_sensor_c.h" />
<ClInclude Include="..\src\sensor\SDL_syssensor.h" />
@@ -295,6 +296,7 @@
<ClCompile Include="..\src\SDL.c" />
<ClCompile Include="..\src\SDL_assert.c" />
<ClCompile Include="..\src\SDL_dataqueue.c" />
<ClCompile Include="..\src\SDL_list.c" />
<ClCompile Include="..\src\SDL_error.c" />
<ClCompile Include="..\src\SDL_hints.c" />
<ClCompile Include="..\src\SDL_log.c" />
@@ -414,10 +416,10 @@
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
<TargetPlatformVersion>10.0.10069.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10069.0</TargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
<TargetPlatformVersion>10.0.16299.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.16299.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">

View File

@@ -411,6 +411,9 @@
<ClInclude Include="..\src\SDL_dataqueue.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\SDL_list.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="..\src\haptic\windows\SDL_xinputhaptic_c.h">
<Filter>Source Files</Filter>
</ClInclude>
@@ -780,6 +783,9 @@
<ClCompile Include="..\src\SDL_dataqueue.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\SDL_list.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\haptic\windows\SDL_dinputhaptic.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -819,4 +825,4 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
</Project>

View File

@@ -369,6 +369,7 @@
<ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_hints_c.h" />
<ClInclude Include="..\..\src\SDL_internal.h" />
<ClInclude Include="..\..\src\SDL_list.h" />
<ClInclude Include="..\..\src\sensor\dummy\SDL_dummysensor.h" />
<ClInclude Include="..\..\src\sensor\SDL_sensor_c.h" />
<ClInclude Include="..\..\src\sensor\SDL_syssensor.h" />
@@ -543,6 +544,7 @@
<ClCompile Include="..\..\src\SDL.c" />
<ClCompile Include="..\..\src\SDL_assert.c" />
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_list.c" />
<ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_log.c" />

View File

@@ -401,6 +401,7 @@
</ClInclude>
<ClInclude Include="..\..\src\SDL_dataqueue.h" />
<ClInclude Include="..\..\src\SDL_error_c.h" />
<ClInclude Include="..\..\src\SDL_list.h" />
<ClInclude Include="..\..\include\SDL_metal.h">
<Filter>API Headers</Filter>
</ClInclude>
@@ -832,6 +833,7 @@
<ClCompile Include="..\..\src\SDL_dataqueue.c" />
<ClCompile Include="..\..\src\SDL_error.c" />
<ClCompile Include="..\..\src\SDL_hints.c" />
<ClCompile Include="..\..\src\SDL_list.c" />
<ClCompile Include="..\..\src\audio\SDL_audio.c">
<Filter>audio</Filter>
</ClCompile>

View File

@@ -1,6 +1,44 @@
This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.0.22:
---------------------------------------------------------------------------
General:
* Added SDL_RenderGetWindow() to get the window associated with a renderer
* Added floating point rectangle functions:
* SDL_PointInFRect()
* SDL_FRectEmpty()
* SDL_FRectEquals()
* SDL_FRectEqualsEpsilon()
* SDL_HasIntersectionF()
* SDL_IntersectFRect()
* SDL_UnionFRect()
* SDL_EncloseFPoints()
* SDL_IntersectFRectAndLine()
* Added SDL_IsTextInputShown() which returns whether the IME window is currently shown
* Added SDL_ClearComposition() to dismiss the composition window without disabling IME input
* Added SDL_TEXTEDITING_EXT event for handling long composition text, and a hint SDL_HINT_IME_SUPPORT_EXTENDED_TEXT to enable it
* Added the hint SDL_HINT_MOUSE_RELATIVE_MODE_CENTER to control whether the mouse should be constrained to the whole window or the center of the window when relative mode is enabled
* The mouse is now automatically captured when mouse buttons are pressed, and the hint SDL_HINT_MOUSE_AUTO_CAPTURE allows you to control this behavior
* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL to let SDL know that a foreign window will be used with OpenGL
* Added the hint SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN to let SDL know that a foreign window will be used with Vulkan
* Added the hint SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE to specify whether an SDL_QUIT event will be delivered when the last application window is closed
* Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks
Windows:
* Added support for SDL_BLENDOPERATION_MINIMUM and SDL_BLENDOPERATION_MAXIMUM to the D3D9 renderer
Linux:
* Compiling with Wayland support requires libwayland-client version 1.18.0 or later
* Added the hint SDL_HINT_X11_WINDOW_TYPE to specify the _NET_WM_WINDOW_TYPE of SDL windows
* Added the hint SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR to allow using libdecor with compositors that support xdg-decoration
Android:
* Added SDL_AndroidSendMessage() to send a custom command to the SDL java activity
---------------------------------------------------------------------------
2.0.20:
---------------------------------------------------------------------------

View File

@@ -19,10 +19,10 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.20</string>
<string>2.0.22</string>
<key>CFBundleSignature</key>
<string>SDLX</string>
<key>CFBundleVersion</key>
<string>2.0.20</string>
<string>2.0.22</string>
</dict>
</plist>

View File

@@ -111,6 +111,24 @@
A1626A582617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; };
A1626A592617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; };
A1626A5A2617008D003F1973 /* SDL_triangle.h in Headers */ = {isa = PBXBuildFile; fileRef = A1626A512617008C003F1973 /* SDL_triangle.h */; };
A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */ = {isa = PBXBuildFile; fileRef = A1BB8B6127F6CF320057CFA8 /* SDL_list.c */; };
A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */ = {isa = PBXBuildFile; fileRef = A1BB8B6227F6CF330057CFA8 /* SDL_list.h */; };
A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; };
A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; };
A75FCCFD23E25AB700529352 /* SDL_shaders_metal_tvos.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8E323E2514000DCD162 /* SDL_shaders_metal_tvos.h */; };
@@ -3574,6 +3592,8 @@
75E09159241EA924004729E1 /* SDL_virtualjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_virtualjoystick_c.h; sourceTree = "<group>"; };
A1626A3D2617006A003F1973 /* SDL_triangle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_triangle.c; sourceTree = "<group>"; };
A1626A512617008C003F1973 /* SDL_triangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_triangle.h; sourceTree = "<group>"; };
A1BB8B6127F6CF320057CFA8 /* SDL_list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_list.c; sourceTree = "<group>"; };
A1BB8B6227F6CF330057CFA8 /* SDL_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_list.h; sourceTree = "<group>"; };
A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
A75FCEB323E25AB700529352 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -4304,6 +4324,8 @@
A7D8A5AB23E2513D00DCD162 /* SDL_hints.c */,
A7D8A58323E2513D00DCD162 /* SDL_internal.h */,
A7D8A5DD23E2513D00DCD162 /* SDL_log.c */,
A1BB8B6127F6CF320057CFA8 /* SDL_list.c */,
A1BB8B6227F6CF330057CFA8 /* SDL_list.h */,
A7D8A57123E2513D00DCD162 /* SDL.c */,
);
name = "Library Source";
@@ -5284,6 +5306,7 @@
A75FCD4523E25AB700529352 /* SDL_gesture_c.h in Headers */,
A75FCD4623E25AB700529352 /* SDL_shaders_gl.h in Headers */,
A75FCD4723E25AB700529352 /* SDL_systhread_c.h in Headers */,
A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */,
A75FCD4823E25AB700529352 /* SDL_keycode.h in Headers */,
5616CA63252BB35F005D5928 /* SDL_sysurl.h in Headers */,
A75FCD4A23E25AB700529352 /* SDL_cocoakeyboard.h in Headers */,
@@ -5509,6 +5532,7 @@
A75FCEFE23E25AC700529352 /* SDL_gesture_c.h in Headers */,
A75FCEFF23E25AC700529352 /* SDL_shaders_gl.h in Headers */,
A75FCF0023E25AC700529352 /* SDL_systhread_c.h in Headers */,
A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */,
A75FCF0123E25AC700529352 /* SDL_keycode.h in Headers */,
5616CA66252BB361005D5928 /* SDL_sysurl.h in Headers */,
A75FCF0323E25AC700529352 /* SDL_cocoakeyboard.h in Headers */,
@@ -5707,6 +5731,7 @@
A769B0C623E259AE00872273 /* SDL_windowevents_c.h in Headers */,
A769B0C823E259AE00872273 /* SDL_cocoavideo.h in Headers */,
5605721C2473688D00B46B66 /* SDL_syslocale.h in Headers */,
A1BB8B7127F6CF330057CFA8 /* SDL_list.h in Headers */,
A769B0CA23E259AE00872273 /* SDL_uikitevents.h in Headers */,
A769B0CB23E259AE00872273 /* SDL_gesture_c.h in Headers */,
A769B0CC23E259AE00872273 /* SDL_shaders_gl.h in Headers */,
@@ -5955,6 +5980,7 @@
A7D8A98E23E2514000DCD162 /* SDL_sensor_c.h in Headers */,
A7D8BA7423E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
A7D8BA5023E2514400DCD162 /* SDL_shaders_gles2.h in Headers */,
A1BB8B6D27F6CF330057CFA8 /* SDL_list.h in Headers */,
A7D8B98D23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */,
A7D8B99C23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */,
A7D8B9A223E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */,
@@ -6185,6 +6211,7 @@
A7D8A98F23E2514000DCD162 /* SDL_sensor_c.h in Headers */,
A7D8BA7523E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
A7D8BA5123E2514400DCD162 /* SDL_shaders_gles2.h in Headers */,
A1BB8B6E27F6CF330057CFA8 /* SDL_list.h in Headers */,
A7D8B98E23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */,
A7D8B99D23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */,
A7D8B9A323E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */,
@@ -6332,6 +6359,7 @@
A7D8BBAF23E2514500DCD162 /* SDL_windowevents_c.h in Headers */,
A7D8AF0423E2514100DCD162 /* SDL_cocoavideo.h in Headers */,
5605721A2473688C00B46B66 /* SDL_syslocale.h in Headers */,
A1BB8B7027F6CF330057CFA8 /* SDL_list.h in Headers */,
A7D8ACC123E2514100DCD162 /* SDL_uikitevents.h in Headers */,
A7D8BB3D23E2514500DCD162 /* SDL_gesture_c.h in Headers */,
A7D8BA7723E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
@@ -6580,6 +6608,7 @@
A7D8A98D23E2514000DCD162 /* SDL_sensor_c.h in Headers */,
A7D8BA7323E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
A7D8BA4F23E2514400DCD162 /* SDL_shaders_gles2.h in Headers */,
A1BB8B6C27F6CF330057CFA8 /* SDL_list.h in Headers */,
A7D8B98C23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */,
A7D8B99B23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */,
A7D8B9A123E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */,
@@ -6796,6 +6825,7 @@
A7D8B29F23E2514200DCD162 /* vulkan_xlib.h in Headers */,
A7D8B25D23E2514200DCD162 /* vulkan_vi.h in Headers */,
A7D8B29923E2514200DCD162 /* vulkan_mir.h in Headers */,
A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */,
A7D8BB4E23E2514500DCD162 /* default_cursor.h in Headers */,
A7D8B9FE23E2514400DCD162 /* SDL_render_sw_c.h in Headers */,
A7D8BBED23E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */,
@@ -6918,6 +6948,7 @@
A7D8BB3E23E2514500DCD162 /* SDL_gesture_c.h in Headers */,
A7D8BA7823E2514400DCD162 /* SDL_shaders_gl.h in Headers */,
A7D8B42D23E2514300DCD162 /* SDL_systhread_c.h in Headers */,
A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */,
DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */,
A7D8AE9323E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */,
A7D8ACE623E2514100DCD162 /* SDL_uikitvulkan.h in Headers */,
@@ -7554,6 +7585,7 @@
A75FCE8423E25AB700529352 /* e_exp.c in Sources */,
A75FCE8523E25AB700529352 /* SDL_quit.c in Sources */,
A75FCE8623E25AB700529352 /* SDL_cocoawindow.m in Sources */,
A1BB8B6A27F6CF330057CFA8 /* SDL_list.c in Sources */,
A75FCE8723E25AB700529352 /* SDL_sysmutex.c in Sources */,
A75FCE8823E25AB700529352 /* SDL_syshaptic.c in Sources */,
F3F07D61269640160074468B /* SDL_hidapi_luna.c in Sources */,
@@ -7741,6 +7773,7 @@
A75FD03D23E25AC700529352 /* e_exp.c in Sources */,
A75FD03E23E25AC700529352 /* SDL_quit.c in Sources */,
A75FD03F23E25AC700529352 /* SDL_cocoawindow.m in Sources */,
A1BB8B6B27F6CF330057CFA8 /* SDL_list.c in Sources */,
A75FD04023E25AC700529352 /* SDL_sysmutex.c in Sources */,
A75FD04123E25AC700529352 /* SDL_syshaptic.c in Sources */,
F3F07D62269640160074468B /* SDL_hidapi_luna.c in Sources */,
@@ -7927,6 +7960,7 @@
A769B20F23E259AE00872273 /* SDL_syshaptic.c in Sources */,
A769B21023E259AE00872273 /* e_exp.c in Sources */,
F395C1A12569C68F00942BFF /* SDL_iokitjoystick.c in Sources */,
A1BB8B6827F6CF330057CFA8 /* SDL_list.c in Sources */,
A769B21123E259AE00872273 /* SDL_quit.c in Sources */,
A769B21223E259AE00872273 /* SDL_cocoawindow.m in Sources */,
A769B21323E259AE00872273 /* SDL_sysmutex.c in Sources */,
@@ -8116,6 +8150,7 @@
A7D8B43B23E2514300DCD162 /* SDL_sysmutex.c in Sources */,
A7D8AAB123E2514100DCD162 /* SDL_syshaptic.c in Sources */,
A7D8B5CA23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */,
A1BB8B6427F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8AC1023E2514100DCD162 /* SDL_video.c in Sources */,
560572062473687700B46B66 /* SDL_syslocale.m in Sources */,
F3F07D5B269640160074468B /* SDL_hidapi_luna.c in Sources */,
@@ -8303,6 +8338,7 @@
A7D8B43C23E2514300DCD162 /* SDL_sysmutex.c in Sources */,
A7D8AAB223E2514100DCD162 /* SDL_syshaptic.c in Sources */,
A7D8B5CB23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */,
A1BB8B6527F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8AC1123E2514100DCD162 /* SDL_video.c in Sources */,
560572072473687800B46B66 /* SDL_syslocale.m in Sources */,
F3F07D5C269640160074468B /* SDL_hidapi_luna.c in Sources */,
@@ -8489,6 +8525,7 @@
A7D8AADE23E2514100DCD162 /* SDL_syshaptic.c in Sources */,
A7D8BAE923E2514500DCD162 /* e_exp.c in Sources */,
F395C1A02569C68F00942BFF /* SDL_iokitjoystick.c in Sources */,
A1BB8B6727F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8BB8523E2514500DCD162 /* SDL_quit.c in Sources */,
A7D8AEAA23E2514100DCD162 /* SDL_cocoawindow.m in Sources */,
A7D8B43E23E2514300DCD162 /* SDL_sysmutex.c in Sources */,
@@ -8665,6 +8702,7 @@
A7D8B55123E2514300DCD162 /* SDL_hidapi_switch.c in Sources */,
A7D8B96223E2514400DCD162 /* SDL_strtokr.c in Sources */,
A7D8BB7523E2514500DCD162 /* SDL_clipboardevents.c in Sources */,
A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8BAB523E2514400DCD162 /* k_cos.c in Sources */,
A7D8B54523E2514300DCD162 /* SDL_hidapijoystick.c in Sources */,
A7D8B97423E2514400DCD162 /* SDL_malloc.c in Sources */,
@@ -8850,6 +8888,7 @@
A7D8B96523E2514400DCD162 /* SDL_strtokr.c in Sources */,
A7D8BB7823E2514500DCD162 /* SDL_clipboardevents.c in Sources */,
A7D8BAB823E2514400DCD162 /* k_cos.c in Sources */,
A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8B54823E2514300DCD162 /* SDL_hidapijoystick.c in Sources */,
A7D8B97723E2514400DCD162 /* SDL_malloc.c in Sources */,
A7D8BBF023E2574800DCD162 /* SDL_uikitclipboard.m in Sources */,
@@ -9035,6 +9074,7 @@
A7D8B96723E2514400DCD162 /* SDL_strtokr.c in Sources */,
A7D8BB7A23E2514500DCD162 /* SDL_clipboardevents.c in Sources */,
A7D8BABA23E2514400DCD162 /* k_cos.c in Sources */,
A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */,
A7D8B54A23E2514300DCD162 /* SDL_hidapijoystick.c in Sources */,
A7D8B97923E2514400DCD162 /* SDL_malloc.c in Sources */,
A7D8B8CB23E2514400DCD162 /* SDL_audio.c in Sources */,
@@ -9111,7 +9151,7 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEPLOYMENT_POSTPROCESSING = YES;
DYLIB_COMPATIBILITY_VERSION = 1.0.0;
DYLIB_CURRENT_VERSION = 19.2.0;
DYLIB_CURRENT_VERSION = 23.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_ALTIVEC_EXTENSIONS = YES;
@@ -9195,7 +9235,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DYLIB_COMPATIBILITY_VERSION = 1.0.0;
DYLIB_CURRENT_VERSION = 19.2.0;
DYLIB_CURRENT_VERSION = 23.0.0;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -9387,6 +9427,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_LINK_OBJC_RUNTIME = NO;
GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
@@ -9398,6 +9439,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_LINK_OBJC_RUNTIME = NO;
GCC_PREPROCESSOR_DEFINITIONS = GLES_SILENCE_DEPRECATION;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";

View File

@@ -1068,7 +1068,7 @@ _LT_EOF
darwin1.*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
darwin*)
case ${MACOSX_DEPLOYMENT_TARGET},$host in
case $MACOSX_DEPLOYMENT_TARGET,$host in
10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*)

View File

@@ -35,6 +35,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
tasks["merge${variant.name.capitalize()}Assets"]
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
}
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
sourceSets.main {
jniLibs.srcDir 'libs'

View File

@@ -13,6 +13,6 @@ LOCAL_SRC_FILES := YourSourceHere.c
LOCAL_SHARED_LIBRARIES := SDL2
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -llog
LOCAL_LDLIBS := -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
include $(BUILD_SHARED_LIBRARY)

View File

@@ -63,6 +63,106 @@ import java.util.Locale;
*/
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
private static final String TAG = "SDL";
/*
// Display InputType.SOURCE/CLASS of events and devices
//
// SDLActivity.debugSource(device.getSources(), "device[" + device.getName() + "]");
// SDLActivity.debugSource(event.getSource(), "event");
public static void debugSource(int sources, String prefix) {
int s = sources;
int s_copy = sources;
String cls = "";
String src = "";
int tst = 0;
int FLAG_TAINTED = 0x80000000;
if ((s & InputDevice.SOURCE_CLASS_BUTTON) != 0) cls += " BUTTON";
if ((s & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) cls += " JOYSTICK";
if ((s & InputDevice.SOURCE_CLASS_POINTER) != 0) cls += " POINTER";
if ((s & InputDevice.SOURCE_CLASS_POSITION) != 0) cls += " POSITION";
if ((s & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) cls += " TRACKBALL";
int s2 = s_copy & ~InputDevice.SOURCE_ANY; // keep class bits
s2 &= ~( InputDevice.SOURCE_CLASS_BUTTON
| InputDevice.SOURCE_CLASS_JOYSTICK
| InputDevice.SOURCE_CLASS_POINTER
| InputDevice.SOURCE_CLASS_POSITION
| InputDevice.SOURCE_CLASS_TRACKBALL);
if (s2 != 0) cls += "Some_Unkown";
s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class;
tst = InputDevice.SOURCE_BLUETOOTH_STYLUS;
if ((s & tst) == tst) src += " BLUETOOTH_STYLUS";
s2 &= ~tst;
tst = InputDevice.SOURCE_DPAD;
if ((s & tst) == tst) src += " DPAD";
s2 &= ~tst;
tst = InputDevice.SOURCE_GAMEPAD;
if ((s & tst) == tst) src += " GAMEPAD";
s2 &= ~tst;
tst = InputDevice.SOURCE_HDMI;
if ((s & tst) == tst) src += " HDMI";
s2 &= ~tst;
tst = InputDevice.SOURCE_JOYSTICK;
if ((s & tst) == tst) src += " JOYSTICK";
s2 &= ~tst;
tst = InputDevice.SOURCE_KEYBOARD;
if ((s & tst) == tst) src += " KEYBOARD";
s2 &= ~tst;
tst = InputDevice.SOURCE_MOUSE;
if ((s & tst) == tst) src += " MOUSE";
s2 &= ~tst;
if (Build.VERSION.SDK_INT >= 26) {
tst = InputDevice.SOURCE_MOUSE_RELATIVE;
if ((s & tst) == tst) src += " MOUSE_RELATIVE";
s2 &= ~tst;
tst = InputDevice.SOURCE_ROTARY_ENCODER;
if ((s & tst) == tst) src += " ROTARY_ENCODER";
s2 &= ~tst;
}
tst = InputDevice.SOURCE_STYLUS;
if ((s & tst) == tst) src += " STYLUS";
s2 &= ~tst;
tst = InputDevice.SOURCE_TOUCHPAD;
if ((s & tst) == tst) src += " TOUCHPAD";
s2 &= ~tst;
tst = InputDevice.SOURCE_TOUCHSCREEN;
if ((s & tst) == tst) src += " TOUCHSCREEN";
s2 &= ~tst;
tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
s2 &= ~tst;
tst = InputDevice.SOURCE_TRACKBALL;
if ((s & tst) == tst) src += " TRACKBALL";
s2 &= ~tst;
tst = InputDevice.SOURCE_ANY;
if ((s & tst) == tst) src += " ANY";
s2 &= ~tst;
if (s == FLAG_TAINTED) src += " FLAG_TAINTED";
s2 &= ~FLAG_TAINTED;
if (s2 != 0) src += " Some_Unkown";
Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src);
}
*/
public static boolean mIsResumedCalled, mHasFocus;
public static final boolean mHasMultiWindow = (Build.VERSION.SDK_INT >= 24);
@@ -1204,8 +1304,21 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
for (int id : ids) {
InputDevice device = InputDevice.getDevice(id);
if (device != null && (device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) != 0) {
nativeAddTouch(device.getId(), device.getName());
/* Allow SOURCE_TOUCHSCREEN and also Virtual InputDevices because they can send TOUCHSCREEN events */
if (device != null && ((device.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN
|| device.isVirtual())) {
int touchDevId = device.getId();
/*
* Prevent id to be -1, since it's used in SDL internal for synthetic events
* Appears when using Android emulator, eg:
* adb shell input mouse tap 100 100
* adb shell input touchscreen tap 100 100
*/
if (touchDevId < 0) {
touchDevId -= 1;
}
nativeAddTouch(touchDevId, device.getName());
}
}
}
@@ -1895,7 +2008,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
if ((source & InputDevice.SOURCE_KEYBOARD) != 0) {
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (SDLActivity.isTextInputEvent(event)) {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
@@ -1908,7 +2021,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
if ((source & InputDevice.SOURCE_MOUSE) != 0) {
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
// they are ignored here because sending them as mouse input to SDL is messy
if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) {

View File

@@ -255,23 +255,21 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
@Override
public boolean handleMotionEvent(MotionEvent event) {
if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
int actionPointerIndex = event.getActionIndex();
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_MOVE) {
SDLJoystick joystick = getJoystick(event.getDeviceId());
if (joystick != null) {
for (int i = 0; i < joystick.axes.size(); i++) {
InputDevice.MotionRange range = joystick.axes.get(i);
/* Normalize the value to -1...1 */
float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
SDLControllerManager.onNativeJoy(joystick.device_id, i, value);
}
for (int i = 0; i < joystick.hats.size() / 2; i++) {
int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex));
int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex));
SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY);
}
int actionPointerIndex = event.getActionIndex();
int action = event.getActionMasked();
if (action == MotionEvent.ACTION_MOVE) {
SDLJoystick joystick = getJoystick(event.getDeviceId());
if (joystick != null) {
for (int i = 0; i < joystick.axes.size(); i++) {
InputDevice.MotionRange range = joystick.axes.get(i);
/* Normalize the value to -1...1 */
float value = (event.getAxisValue(range.getAxis(), actionPointerIndex) - range.getMin()) / range.getRange() * 2.0f - 1.0f;
SDLControllerManager.onNativeJoy(joystick.device_id, i, value);
}
for (int i = 0; i < joystick.hats.size() / 2; i++) {
int hatX = Math.round(event.getAxisValue(joystick.hats.get(2 * i).getAxis(), actionPointerIndex));
int hatY = Math.round(event.getAxisValue(joystick.hats.get(2 * i + 1).getAxis(), actionPointerIndex));
SDLControllerManager.onNativeHat(joystick.device_id, i, hatX, hatY);
}
}
}
@@ -319,6 +317,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
KeyEvent.KEYCODE_BUTTON_X,
KeyEvent.KEYCODE_BUTTON_Y,
KeyEvent.KEYCODE_BACK,
KeyEvent.KEYCODE_MENU,
KeyEvent.KEYCODE_BUTTON_MODE,
KeyEvent.KEYCODE_BUTTON_START,
KeyEvent.KEYCODE_BUTTON_THUMBL,
@@ -360,6 +359,7 @@ class SDLJoystickHandler_API19 extends SDLJoystickHandler_API16 {
(1 << 2), // X -> X
(1 << 3), // Y -> Y
(1 << 4), // BACK -> BACK
(1 << 6), // MENU -> START
(1 << 5), // MODE -> GUIDE
(1 << 6), // START -> START
(1 << 7), // THUMBL -> LEFTSTICK
@@ -560,8 +560,6 @@ class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
switch ( event.getSource() ) {
case InputDevice.SOURCE_JOYSTICK:
case InputDevice.SOURCE_GAMEPAD:
case InputDevice.SOURCE_DPAD:
return SDLControllerManager.handleJoystickMotionEvent(event);
case InputDevice.SOURCE_MOUSE:
@@ -691,8 +689,6 @@ class SDLGenericMotionListener_API26 extends SDLGenericMotionListener_API24 {
switch ( event.getSource() ) {
case InputDevice.SOURCE_JOYSTICK:
case InputDevice.SOURCE_GAMEPAD:
case InputDevice.SOURCE_DPAD:
return SDLControllerManager.handleJoystickMotionEvent(event);
case InputDevice.SOURCE_MOUSE:

View File

@@ -7081,8 +7081,20 @@ func_mode_link ()
prev=xcompiler
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
# Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199.
-pthread)
case $host in
*solaris2*) ;;
*)
case "$new_inherited_linker_flags " in
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
;;
esac
continue
;;
-mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
func_append compiler_flags " $arg"
func_append compile_command " $arg"

View File

@@ -1,41 +0,0 @@
#!/bin/bash
# This is the script buildbot.libsdl.org uses to cross-compile SDL2 from
# x86 Linux to OS/2, using OpenWatcom.
# The final zipfile can be unpacked on any machine that supports OpenWatcom
# (Windows, Linux, OS/2, etc). Point the compiler at the include directory
# and link against the SDL2.lib file. Ship the SDL2.dll with your app.
if [ -z "$WATCOM" ]; then
echo "This script expects \$WATCOM to be set to the OpenWatcom install dir." 1>&2
echo "This is often something like '/usr/local/share/watcom'" 1>&2
exit 1
fi
export PATH="$WATCOM/binl:$PATH"
ZIPFILE="$1"
if [ -z $1 ]; then
ZIPFILE=sdl-os2.zip
fi
ZIPDIR=buildbot/SDL
set -e
set -x
cd `dirname "$0"`
cd ..
rm -f $ZIPFILE
wmake -f Makefile.os2
rm -rf $ZIPDIR
mkdir -p $ZIPDIR
chmod 644 SDL2.dll SDL2.lib SDL2test.lib
mv SDL2.dll SDL2.lib SDL2test.lib $ZIPDIR/
cp -R include $ZIPDIR/
zip -9r "buildbot/$ZIPFILE" $ZIPDIR
wmake -f Makefile.os2 distclean
set +x
echo "All done. Final installable is in $ZIPFILE ...";

View File

@@ -39,7 +39,7 @@
#
# Base version of SDL, used for packaging purposes
$SDLVersion = "2.0.20"
$SDLVersion = "2.0.22"
# Gets the .bat file that sets up an MSBuild environment, given one of
# Visual Studio's, "PlatformToolset"s.

View File

@@ -92,12 +92,19 @@ macro(LISTTOSTRREV _LIST _OUTPUT)
endforeach()
endmacro()
macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
endmacro()
if(${CMAKE_VERSION} VERSION_LESS "3.16.0")
macro(CHECK_OBJC_SOURCE_COMPILES SOURCE VAR)
set(PREV_REQUIRED_DEFS "${CMAKE_REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_DEFINITIONS "-x objective-c ${PREV_REQUIRED_DEFS}")
CHECK_C_SOURCE_COMPILES(${SOURCE} ${VAR})
set(CMAKE_REQUIRED_DEFINITIONS "${PREV_REQUIRED_DEFS}")
endmacro()
else()
include(CheckOBJCSourceCompiles)
if (APPLE)
enable_language(OBJC)
endif()
endif()
if(CMAKE_VERSION VERSION_LESS 3.13.0)
macro(target_link_directories _TARGET _SCOPE)

View File

@@ -48,6 +48,7 @@ macro(CheckDLOPEN)
int main(int argc, char **argv) {
void *handle = dlopen(\"\", RTLD_NOW);
const char *loaderror = (char *) dlerror();
return 0;
}" HAVE_DLOPEN)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
@@ -57,8 +58,7 @@ macro(CheckO_CLOEXEC)
check_c_source_compiles("
#include <fcntl.h>
int flag = O_CLOEXEC;
int main(void) {
}" HAVE_O_CLOEXEC)
int main(int argc, char **argv) { return 0; }" HAVE_O_CLOEXEC)
endmacro()
# Requires:
@@ -68,12 +68,12 @@ macro(CheckOSS)
set(OSS_HEADER_FILE "sys/soundcard.h")
check_c_source_compiles("
#include <sys/soundcard.h>
int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND)
int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND)
if(NOT OSS_FOUND)
set(OSS_HEADER_FILE "soundcard.h")
check_c_source_compiles("
#include <soundcard.h>
int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND)
int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND)
endif()
if(OSS_FOUND)
@@ -174,7 +174,7 @@ macro(CheckPulseAudio)
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
set(HAVE_PULSEAUDIO_SHARED TRUE)
else()
list(APPEND EXTRA_LDFLAGS ${PKG_sPULSEAUDIO_LDFLAGS})
list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
endif()
set(HAVE_SDL_AUDIO TRUE)
endif()
@@ -467,6 +467,8 @@ macro(CheckX11)
else()
list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
endif()
else()
list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
endif()
set(CMAKE_REQUIRED_LIBRARIES ${X11_LIB} ${X11_LIB})
@@ -479,7 +481,8 @@ macro(CheckX11)
XGenericEventCookie *cookie = &event.xcookie;
XNextEvent(display, &event);
XGetEventData(display, cookie);
XFreeEventData(display, cookie); }" HAVE_XGENERICEVENT)
XFreeEventData(display, cookie);
return 0; }" HAVE_XGENERICEVENT)
if(HAVE_XGENERICEVENT)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
endif()
@@ -527,11 +530,10 @@ macro(CheckX11)
#include <X11/extensions/XInput2.h>
int event_type = XI_TouchBegin;
XITouchClassInfo *t;
Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
{
Status XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f) {
return (Status)0;
}
int main(int argc, char **argv) {}" HAVE_XINPUT2_MULTITOUCH)
int main(int argc, char **argv) { return 0; }" HAVE_XINPUT2_MULTITOUCH)
if(HAVE_XINPUT2_MULTITOUCH)
set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1)
endif()
@@ -545,7 +547,7 @@ macro(CheckX11)
#include <X11/extensions/XInput2.h>
#include <X11/extensions/Xfixes.h>
BarrierEventID b;
int main(void) { }" HAVE_XFIXES_H)
int main(int argc, char **argv) { return 0; }" HAVE_XFIXES_H)
endif()
if(SDL_X11_XFIXES AND HAVE_XFIXES_H AND HAVE_XINPUT2_H)
if(HAVE_X11_SHARED AND XFIXES_LIB)
@@ -630,7 +632,7 @@ endmacro()
# - HAVE_SDL_LOADSO opt
macro(CheckWayland)
if(SDL_WAYLAND)
pkg_check_modules(WAYLAND wayland-client wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
pkg_check_modules(WAYLAND "wayland-client>=1.18" wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
if(WAYLAND_FOUND)
find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)
@@ -775,12 +777,12 @@ macro(CheckVivante)
if(SDL_VIVANTE)
check_c_source_compiles("
#include <gc_vdk.h>
int main(int argc, char** argv) {}" HAVE_VIVANTE_VDK)
int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_VDK)
check_c_source_compiles("
#define LINUX
#define EGL_API_FB
#include <EGL/eglvivante.h>
int main(int argc, char** argv) {}" HAVE_VIVANTE_EGL_FB)
int main(int argc, char** argv) { return 0; }" HAVE_VIVANTE_EGL_FB)
if(HAVE_VIVANTE_VDK OR HAVE_VIVANTE_EGL_FB)
set(HAVE_VIVANTE TRUE)
set(HAVE_SDL_VIDEO TRUE)
@@ -790,7 +792,9 @@ macro(CheckVivante)
set(SDL_VIDEO_DRIVER_VIVANTE 1)
if(HAVE_VIVANTE_VDK)
set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1)
list(APPEND EXTRA_LIBS VDK VIVANTE)
find_library(VIVANTE_LIBRARY REQUIRED NAMES VIVANTE vivante drm_vivante)
find_library(VIVANTE_VDK_LIBRARY VDK REQUIRED)
list(APPEND EXTRA_LIBS ${VIVANTE_LIBRARY} ${VIVANTE_VDK_LIBRARY})
else()
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB")
list(APPEND EXTRA_LIBS EGL)
@@ -805,7 +809,7 @@ macro(CheckGLX)
if(SDL_OPENGL)
check_c_source_compiles("
#include <GL/glx.h>
int main(int argc, char** argv) {}" HAVE_OPENGL_GLX)
int main(int argc, char** argv) { return 0; }" HAVE_OPENGL_GLX)
if(HAVE_OPENGL_GLX)
set(SDL_VIDEO_OPENGL_GLX 1)
endif()
@@ -817,15 +821,14 @@ endmacro()
macro(CheckEGL)
if (SDL_OPENGL OR SDL_OPENGLES)
pkg_check_modules(EGL egl)
string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}")
set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${EGL_CFLAGS}")
check_c_source_compiles("
#define EGL_API_FB
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <EGL/egl.h>
#include <EGL/eglext.h>
int main (int argc, char** argv) {}" HAVE_OPENGL_EGL)
int main (int argc, char** argv) { return 0; }" HAVE_OPENGL_EGL)
if(HAVE_OPENGL_EGL)
set(SDL_VIDEO_OPENGL_EGL 1)
endif()
@@ -839,7 +842,7 @@ macro(CheckOpenGL)
check_c_source_compiles("
#include <GL/gl.h>
#include <GL/glext.h>
int main(int argc, char** argv) {}" HAVE_OPENGL)
int main(int argc, char** argv) { return 0; }" HAVE_OPENGL)
if(HAVE_OPENGL)
set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_RENDER_OGL 1)
@@ -854,7 +857,7 @@ macro(CheckOpenGLES)
check_c_source_compiles("
#include <GLES/gl.h>
#include <GLES/glext.h>
int main (int argc, char** argv) {}" HAVE_OPENGLES_V1)
int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V1)
if(HAVE_OPENGLES_V1)
set(HAVE_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES 1)
@@ -863,7 +866,7 @@ macro(CheckOpenGLES)
check_c_source_compiles("
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
int main (int argc, char** argv) {}" HAVE_OPENGLES_V2)
int main (int argc, char** argv) { return 0; }" HAVE_OPENGLES_V2)
if(HAVE_OPENGLES_V2)
set(HAVE_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES2 1)
@@ -1170,10 +1173,12 @@ macro(CheckHIDAPI)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS}")
if(HIDAPI_ONLY_LIBUSB)
list(APPEND EXTRA_LIBS ${LIBUSB_LIBS})
elseif(OS2)
set(SDL_LIBUSB_DYNAMIC "\"usb100.dll\"")
else()
# libusb is loaded dynamically, so don't add it to EXTRA_LIBS
FindLibraryAndSONAME("usb-1.0")
set(SDL_LIBUSB_DYNAMIC "\"${USB_LIB_SONAME}\"")
set(SDL_LIBUSB_DYNAMIC "\"${USB_1.0_LIB_SONAME}\"")
endif()
endif()
endif()

372
configure vendored
View File

@@ -673,6 +673,8 @@ X_CFLAGS
XMKMF
RPI_LIBS
RPI_CFLAGS
DECOR_LIBS
DECOR_CFLAGS
FUSIONSOUND_LIBS
FUSIONSOUND_CFLAGS
ARTSCONFIG
@@ -822,6 +824,8 @@ enable_filesystem
enable_threads
enable_timers
enable_file
enable_misc
enable_locale
enable_loadso
enable_cpuinfo
enable_assembly
@@ -942,6 +946,8 @@ PULSEAUDIO_CFLAGS
PULSEAUDIO_LIBS
FUSIONSOUND_CFLAGS
FUSIONSOUND_LIBS
DECOR_CFLAGS
DECOR_LIBS
RPI_CFLAGS
RPI_LIBS
XMKMF
@@ -1599,6 +1605,8 @@ Optional Features:
--enable-threads Enable the threading subsystem [default=yes]
--enable-timers Enable the timer subsystem [default=yes]
--enable-file Enable the file subsystem [default=yes]
--enable-misc Enable the misc subsystem [default=yes]
--enable-locale Enable the locale subsystem [default=yes]
--enable-loadso Enable the shared object loading subsystem
[default=yes]
--enable-cpuinfo Enable the cpuinfo subsystem [default=yes]
@@ -1775,6 +1783,9 @@ Some influential environment variables:
C compiler flags for FUSIONSOUND, overriding pkg-config
FUSIONSOUND_LIBS
linker flags for FUSIONSOUND, overriding pkg-config
DECOR_CFLAGS
C compiler flags for DECOR, overriding pkg-config
DECOR_LIBS linker flags for DECOR, overriding pkg-config
RPI_CFLAGS C compiler flags for RPI, overriding pkg-config
RPI_LIBS linker flags for RPI, overriding pkg-config
XMKMF Path to xmkmf, Makefile generator for X Window System
@@ -2855,9 +2866,9 @@ orig_CFLAGS="$CFLAGS"
#
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=0
SDL_MICRO_VERSION=20
SDL_INTERFACE_AGE=2
SDL_BINARY_AGE=20
SDL_MICRO_VERSION=22
SDL_INTERFACE_AGE=0
SDL_BINARY_AGE=22
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
@@ -7120,7 +7131,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
darwin1.*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
darwin*)
case ${MACOSX_DEPLOYMENT_TARGET},$host in
case $MACOSX_DEPLOYMENT_TARGET,$host in
10.[012],*|,*powerpc*-darwin[5-8]*)
_lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
*)
@@ -16999,9 +17010,8 @@ fi
$as_echo_n "checking for linker option --no-undefined... " >&6; }
have_no_undefined=no
case "$host" in
*-*-openbsd*)
*-*-openbsd*)
;;
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--no-undefined"
@@ -17138,7 +17148,7 @@ if test x$enable_libc = xyes; then
$as_echo "#define HAVE_LIBC 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
@@ -17264,7 +17274,7 @@ fi
done
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
if test "x$ac_cv_type_size_t" = xyes; then :
else
@@ -17276,7 +17286,7 @@ _ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for M_PI in math.h" >&5
$as_echo_n "checking for M_PI in math.h... " >&6; }
if ${ac_cv_define_M_PI+:} false; then :
$as_echo_n "(cached) " >&6
@@ -17309,11 +17319,7 @@ $as_echo "#define HAVE_M_PI /**/" >>confdefs.h
fi
case "$host" in
*-*-cygwin* | *-*-mingw*)
;;
*)
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
$as_echo_n "checking for working alloca.h... " >&6; }
@@ -17499,8 +17505,6 @@ _ACEOF
fi
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
$as_echo_n "checking for working memcmp... " >&6; }
@@ -17840,7 +17844,7 @@ $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h
fi
for ac_header in libunwind.h
for ac_header in libunwind.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default"
if test "x$ac_cv_header_libunwind_h" = xyes; then :
@@ -17953,11 +17957,20 @@ SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
SOURCES="$SOURCES $srcdir/src/locale/*.c"
case "$host" in
*-*-emscripten*)
default_atomic=no
;;
*)
default_atomic=yes
;;
esac
# Check whether --enable-atomic was given.
if test "${enable_atomic+set}" = set; then :
enableval=$enable_atomic;
else
enable_atomic=yes
enable_atomic=$default_atomic
fi
if test x$enable_atomic != xyes; then
@@ -18149,6 +18162,34 @@ $as_echo "#define SDL_FILE_DISABLED 1" >>confdefs.h
else
SUMMARY_modules="${SUMMARY_modules} file"
fi
# Check whether --enable-misc was given.
if test "${enable_misc+set}" = set; then :
enableval=$enable_misc;
else
enable_misc=yes
fi
if test x$enable_misc != xyes; then
$as_echo "#define SDL_MISC_DISABLED 1" >>confdefs.h
else
SUMMARY_modules="${SUMMARY_modules} misc"
fi
# Check whether --enable-locale was given.
if test "${enable_locale+set}" = set; then :
enableval=$enable_locale;
else
enable_locale=yes
fi
if test x$enable_locale != xyes; then
$as_echo "#define SDL_LOCALE_DISABLED 1" >>confdefs.h
else
SUMMARY_modules="${SUMMARY_modules} locale"
fi
# Check whether --enable-loadso was given.
if test "${enable_loadso+set}" = set; then :
enableval=$enable_loadso;
@@ -18219,7 +18260,7 @@ fi
fi
fi
# Check whether --enable-mmx was given.
# Check whether --enable-mmx was given.
if test "${enable_mmx+set}" = set; then :
enableval=$enable_mmx;
else
@@ -20150,6 +20191,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_DISK 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
SUMMARY_audio="${SUMMARY_audio} disk"
have_audio=yes
fi
}
@@ -20168,6 +20210,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
SUMMARY_audio="${SUMMARY_audio} dummy"
have_audio=yes
fi
}
@@ -20496,7 +20539,7 @@ $as_echo "$have_gcc_Wall" >&6; }
if test x$have_gcc_Wall = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for necessary GCC -Wno-multichar option" >&5
$as_echo_n "checking for necessary GCC -Wno-multichar option... " >&6; }
need_gcc_Wno_multichar=no
case "$host" in
@@ -20536,7 +20579,7 @@ $as_echo_n "checking for Wayland support... " >&6; }
video_wayland=no
if test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then
if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then
if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
@@ -20577,7 +20620,8 @@ fi
wayland_client_lib=`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
wayland_egl_lib=`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
if test x$wayland_egl_lib = x; then
wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
# This works in Ubuntu 13.10, maybe others
wayland_egl_lib=`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
fi
wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
@@ -20639,17 +20683,79 @@ else
fi
if test x$enable_libdecor = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor support" >&5
$as_echo_n "checking for libdecor support... " >&6; }
if $PKG_CONFIG --exists libdecor-0; then :
video_libdecor=yes
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdecor-0" >&5
$as_echo_n "checking for libdecor-0... " >&6; }
if test -n "$DECOR_CFLAGS"; then
pkg_cv_DECOR_CFLAGS="$DECOR_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5
($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DECOR_CFLAGS=`$PKG_CONFIG --cflags "libdecor-0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
video_libdecor=no
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$DECOR_LIBS"; then
pkg_cv_DECOR_LIBS="$DECOR_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdecor-0\""; } >&5
($PKG_CONFIG --exists --print-errors "libdecor-0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_DECOR_LIBS=`$PKG_CONFIG --libs "libdecor-0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
DECOR_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdecor-0" 2>&1`
else
DECOR_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdecor-0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$DECOR_PKG_ERRORS" >&5
video_libdecor=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
video_libdecor=no
else
DECOR_CFLAGS=$pkg_cv_DECOR_CFLAGS
DECOR_LIBS=$pkg_cv_DECOR_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
video_libdecor=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_libdecor" >&5
$as_echo "$video_libdecor" >&6; }
if test x$video_libdecor = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`"
EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS"
$as_echo "#define HAVE_LIBDECOR_H 1" >>confdefs.h
@@ -20662,18 +20768,16 @@ else
fi
decor_lib=`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
if test x$enable_wayland_shared != xyes; then
enable_libdecor_shared=no
fi
decor_lib=`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`
if test x$have_loadso != xyes && \
test x$enable_libdecor_shared = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&5
$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libdecor loading" >&2;}
fi
if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib"
@@ -20683,7 +20787,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi
fi
fi
@@ -20734,8 +20838,10 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
SUMMARY_audio="${SUMMARY_audio} nacl"
have_audio=yes
SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
SUMMARY_video="${SUMMARY_video} nacl opengles2"
have_video=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -20880,6 +20986,7 @@ $as_echo "$have_video_rpi" >&6; }
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
SUMMARY_video="${SUMMARY_video} rpi"
have_video=yes
fi
fi
}
@@ -21731,7 +21838,7 @@ _ACEOF
fi
have_video=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XGenericEvent" >&5
$as_echo_n "checking for XGenericEvent... " >&6; }
have_XGenericEvent=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -22219,7 +22326,7 @@ else
fi
if test x$enable_video_x11_xrandr = xyes; then
definitely_enable_video_x11_xrandr=no
definitely_enable_video_x11_xrandr=no
have_xrandr_h_hdr=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -22601,7 +22708,7 @@ fi
if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
CFLAGS="$CFLAGS -x objective-c"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cocoa framework" >&5
$as_echo_n "checking for Cocoa framework... " >&6; }
have_cocoa=no
@@ -22654,7 +22761,7 @@ fi
if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
CFLAGS="$CFLAGS -x objective-c"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5
$as_echo_n "checking for Metal framework... " >&6; }
have_metal=no
@@ -23592,7 +23699,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
*-*-darwin*)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
CFLAGS="$CFLAGS -x objective-c"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -23645,7 +23752,7 @@ $as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h
CheckInputEvents()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5
$as_echo_n "checking for Linux 2.4 unified input interface... " >&6; }
use_input_events=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -23681,7 +23788,6 @@ $as_echo "#define SDL_INPUT_LINUXEV 1" >>confdefs.h
CheckInputKD()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux kd.h" >&5
$as_echo_n "checking for Linux kd.h... " >&6; }
use_input_kd=no
@@ -24161,7 +24267,7 @@ fi
if test x$enable_joystick_mfi = xyes; then
save_CFLAGS="$CFLAGS"
save_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5
$as_echo_n "checking for GameController framework... " >&6; }
@@ -24228,7 +24334,7 @@ else
enable_pthreads=maybe
fi
# Check whether --enable-pthread-sem was given.
# Check whether --enable-pthread-sem was given.
if test "${enable_pthread_sem+set}" = set; then :
enableval=$enable_pthread_sem;
else
@@ -24673,6 +24779,30 @@ $as_echo "$have_wince" >&6; }
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
# headers needed elsewhere
ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default"
if test "x$ac_cv_header_tpcshrd_h" = xyes; then :
have_tpcshrd_h=yes
fi
if test x$have_tpcshrd_h = xyes; then
$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h
fi
ac_fn_c_check_header_mongrel "$LINENO" "roapi.h" "ac_cv_header_roapi_h" "$ac_includes_default"
if test "x$ac_cv_header_roapi_h" = xyes; then :
have_roapi_h=yes
fi
if test x$have_roapi_h = xyes; then
$as_echo "#define HAVE_ROAPI_H 1" >>confdefs.h
fi
}
CheckOS2()
@@ -25744,6 +25874,7 @@ case "$host" in
$as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
SUMMARY_video="${SUMMARY_video} android"
have_video=yes
fi
;;
*-*-linux*) ARCH=linux ;;
@@ -25825,12 +25956,16 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
CheckRPATH
CheckVivanteVideo
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes
fi
# Set up files for the locale library
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
@@ -26042,12 +26177,16 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
have_misc=yes
fi
# Use the Windows locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
@@ -26140,17 +26279,6 @@ $as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h
have_haptic=yes
fi
fi
ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default"
if test "x$ac_cv_header_tpcshrd_h" = xyes; then :
have_tpcshrd_h=yes
fi
if test x$have_tpcshrd_h = xyes; then
$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h
fi
# Set up files for the sensor library
ac_fn_c_check_header_mongrel "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default"
if test "x$ac_cv_header_sensorsapi_h" = xyes; then :
@@ -26271,13 +26399,11 @@ fi
SDL_LIBS="-lcygwin $SDL_LIBS"
fi
;;
*-*-beos*)
*-*-beos*)
as_fn_error $? "
*** BeOS support has been removed as of SDL 2.0.2.
" "$LINENO" 5
;;
*-*-haiku*)
ARCH=haiku
ac_default_prefix=/boot/system
@@ -26332,14 +26458,16 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
have_filesystem=yes
fi
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
fi
# The Haiku platform requires special setup.
SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
@@ -26359,13 +26487,16 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h
CheckVulkan
CheckPTHREAD
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
@@ -26448,6 +26579,8 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
SUMMARY_video="${SUMMARY_video} uikit"
have_video=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
@@ -26493,13 +26626,16 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
CheckPTHREAD
CheckHIDAPI
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
@@ -26627,6 +26763,12 @@ $as_echo "#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1" >>confdefs.h
CheckClockGettime
CheckEmscriptenGLES
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c"
have_misc=yes
fi
# Set up files for the power library
if test x$enable_power = xyes; then
@@ -26636,7 +26778,7 @@ $as_echo "#define SDL_POWER_EMSCRIPTEN 1" >>confdefs.h
have_power=yes
fi
# Set up files for the power library
# Set up files for the joystick library
if test x$enable_joystick = xyes; then
$as_echo "#define SDL_JOYSTICK_EMSCRIPTEN 1" >>confdefs.h
@@ -26662,8 +26804,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
have_timers=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
fi
;;
*-*-riscos*)
ARCH=riscos
@@ -26679,9 +26823,11 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
CheckPTHREAD
CheckClockGettime
SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
have_misc=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
@@ -26734,8 +26880,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
fi
# Use the Unix locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
@@ -26832,10 +26980,36 @@ INSTALL_SDL2_CONFIG=$enable_sdl2_config
# Verify that we have all the platform specific files we need
if test x$have_audio != xyes; then
if test x$enable_audio = xyes; then
$as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
fi
if test x$have_video != xyes; then
if test x$enable_video = xyes; then
$as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
fi
if test x$have_misc != xyes; then
if test x$enable_misc = xyes; then
$as_echo "#define SDL_MISC_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
fi
if test x$have_locale != xyes; then
if test x$enable_locale = xyes; then
$as_echo "#define SDL_LOCALE_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
fi
if test x$have_joystick != xyes; then
@@ -26873,7 +27047,7 @@ fi
if test x$have_timers != xyes; then
if test x$enable_timers = xyes; then
$as_echo "#define SDL_TIMERS_DISABLED 1" >>confdefs.h
$as_echo "#define SDL_TIMER_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
@@ -26881,7 +27055,7 @@ fi
if test x$have_filesystem != xyes; then
if test x$enable_filesystem = xyes; then
$as_echo "#define SDL_FILESYSTEM_DISABLED 1" >>confdefs.h
$as_echo "#define SDL_FILESYSTEM_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
@@ -26889,7 +27063,7 @@ fi
if test x$have_loadso != xyes; then
if test x$enable_loadso = xyes; then
$as_echo "#define SDL_LOADSO_DISABLED 1" >>confdefs.h
$as_echo "#define SDL_LOADSO_DUMMY 1" >>confdefs.h
fi
SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"

View File

@@ -22,9 +22,9 @@ dnl Set various version strings - taken gratefully from the GTk sources
#
SDL_MAJOR_VERSION=2
SDL_MINOR_VERSION=0
SDL_MICRO_VERSION=20
SDL_INTERFACE_AGE=2
SDL_BINARY_AGE=20
SDL_MICRO_VERSION=22
SDL_INTERFACE_AGE=0
SDL_BINARY_AGE=22
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
AC_SUBST(SDL_MAJOR_VERSION)
@@ -241,10 +241,9 @@ fi
AC_MSG_CHECKING(for linker option --no-undefined)
have_no_undefined=no
case "$host" in
dnl Skip this on platforms where it is just simply busted.
dnl Skip this on platforms where it is just simply busted.
*-*-openbsd*)
;;
*)
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--no-undefined"
@@ -309,25 +308,19 @@ AC_ARG_ENABLE(libc,
if test x$enable_libc = xyes; then
AC_DEFINE(HAVE_LIBC, 1, [ ])
dnl Check for C library headers
dnl Check for C library headers
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h)
dnl Check for typedefs, structures, etc.
dnl Check for typedefs, structures, etc.
AC_TYPE_SIZE_T
dnl Check for defines
dnl Check for defines
AC_CHECK_DEFINE(M_PI, math.h)
dnl Checks for library functions.
case "$host" in
*-*-cygwin* | *-*-mingw*)
;;
*)
AC_FUNC_ALLOCA
;;
esac
AC_FUNC_ALLOCA
dnl Checks for library functions.
AC_FUNC_MEMCMP
if test x$ac_cv_func_memcmp_working = xyes; then
AC_DEFINE(HAVE_MEMCMP, 1, [ ])
@@ -354,7 +347,7 @@ if test x$enable_libc = xyes; then
AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
dnl Check for additional non-standard headers
dnl Check for additional non-standard headers
AC_CHECK_HEADERS(libunwind.h)
fi
@@ -422,9 +415,18 @@ SOURCES="$SOURCES $srcdir/src/locale/*.c"
dnl Enable/disable various subsystems of the SDL library
case "$host" in
*-*-emscripten*)
default_atomic=no
;;
*)
default_atomic=yes
;;
esac
AC_ARG_ENABLE(atomic,
[AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [default=yes]])],
, enable_atomic=yes)
, enable_atomic=$default_atomic)
if test x$enable_atomic != xyes; then
AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
else
@@ -534,6 +536,22 @@ if test x$enable_file != xyes; then
else
SUMMARY_modules="${SUMMARY_modules} file"
fi
AC_ARG_ENABLE(misc,
[AS_HELP_STRING([--enable-misc], [Enable the misc subsystem [default=yes]])],
, enable_misc=yes)
if test x$enable_misc != xyes; then
AC_DEFINE(SDL_MISC_DISABLED, 1, [ ])
else
SUMMARY_modules="${SUMMARY_modules} misc"
fi
AC_ARG_ENABLE(locale,
[AS_HELP_STRING([--enable-locale], [Enable the locale subsystem [default=yes]])],
, enable_locale=yes)
if test x$enable_locale != xyes; then
AC_DEFINE(SDL_LOCALE_DISABLED, 1, [ ])
else
SUMMARY_modules="${SUMMARY_modules} locale"
fi
AC_ARG_ENABLE(loadso,
[AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])],
, enable_loadso=yes)
@@ -582,7 +600,7 @@ if test x$enable_assembly = xyes; then
fi
fi
dnl Check for various instruction support
dnl Check for various instruction support
AC_ARG_ENABLE(mmx,
[AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [default=yes]])],
, enable_mmx=yes)
@@ -1280,6 +1298,7 @@ CheckDiskAudio()
AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
SUMMARY_audio="${SUMMARY_audio} disk"
have_audio=yes
fi
}
@@ -1293,6 +1312,7 @@ CheckDummyAudio()
AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
SUMMARY_audio="${SUMMARY_audio} dummy"
have_audio=yes
fi
}
@@ -1504,7 +1524,7 @@ CheckWarnAll()
if test x$have_gcc_Wall = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
need_gcc_Wno_multichar=no
case "$host" in
@@ -1535,7 +1555,7 @@ CheckWayland()
video_wayland=no
if test x$video_opengl_egl = xyes && \
test x$video_opengles_v2 = xyes; then
if $PKG_CONFIG --exists wayland-client wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then
if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then
WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
@@ -1566,7 +1586,7 @@ dnl FIXME: Do BSD and OS X need special cases?
wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$wayland_egl_lib = x; then
dnl This works in Ubuntu 13.10, maybe others
# This works in Ubuntu 13.10, maybe others
wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
fi
wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
@@ -1606,39 +1626,31 @@ dnl FIXME: Do BSD and OS X need special cases?
dnl See if libdecor is available
AC_ARG_ENABLE(libdecor,
[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],
, enable_libdecor=yes)
[AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes)
if test x$enable_libdecor = xyes; then
AC_MSG_CHECKING(for libdecor support)
AS_IF([$PKG_CONFIG --exists libdecor-0],
[video_libdecor=yes],
[video_libdecor=no])
AC_MSG_RESULT($video_libdecor)
PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no)
if test x$video_libdecor = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS `$PKG_CONFIG --cflags libdecor-0`"
EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS"
AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ])
AC_ARG_ENABLE(libdecor-shared,
[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],
, enable_libdecor_shared=yes)
[AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],, enable_libdecor_shared=yes)
decor_lib=[`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$enable_wayland_shared != xyes; then
enable_libdecor_shared=no
fi
decor_lib=[`find_lib "libdecor-0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
if test x$have_loadso != xyes && \
test x$enable_libdecor_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
fi
if test x$have_loadso = xyes && \
test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
echo "-- dynamic libdecor -> $decor_lib"
AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$PKG_CONFIG --libs libdecor-0`"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
fi
fi
fi
@@ -1666,8 +1678,10 @@ CheckNativeClient()
SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
SUMMARY_audio="${SUMMARY_audio} nacl"
have_audio=yes
SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
SUMMARY_video="${SUMMARY_video} nacl opengles2"
have_video=yes
],[])
}
@@ -1717,6 +1731,7 @@ CheckRPI()
SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
SUMMARY_video="${SUMMARY_video} rpi"
have_video=yes
fi
fi
}
@@ -1834,7 +1849,6 @@ CheckX11()
fi
have_video=yes
dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
AC_MSG_CHECKING([for XGenericEvent])
have_XGenericEvent=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -2005,7 +2019,7 @@ XITouchClassInfo *t;
[AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [default=yes]])],
, enable_video_x11_xrandr=yes)
if test x$enable_video_x11_xrandr = xyes; then
dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
definitely_enable_video_x11_xrandr=no
have_xrandr_h_hdr=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -2167,7 +2181,7 @@ CheckCOCOA()
, enable_video_cocoa=yes)
if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c"
AC_MSG_CHECKING(for Cocoa framework)
have_cocoa=no
@@ -2195,7 +2209,7 @@ CheckMETAL()
, enable_render_metal=yes)
if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c"
AC_MSG_CHECKING(for Metal framework)
have_metal=no
@@ -2619,7 +2633,7 @@ CheckVulkan()
;;
*-*-darwin*)
save_CFLAGS="$CFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <Cocoa/Cocoa.h>
@@ -2654,7 +2668,7 @@ CheckVulkan()
dnl See if we can use the new unified event interface in Linux 2.4
CheckInputEvents()
{
dnl Check for Linux 2.4 unified input event interface support
dnl Check for Linux 2.4 unified input event interface support
AC_MSG_CHECKING(for Linux 2.4 unified input interface)
use_input_events=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -2674,7 +2688,6 @@ CheckInputEvents()
dnl See if we can use the kernel kd.h header
CheckInputKD()
{
AC_MSG_CHECKING(for Linux kd.h)
use_input_kd=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@@ -2876,7 +2889,7 @@ CheckJoystickMFI()
if test x$enable_joystick_mfi = xyes; then
save_CFLAGS="$CFLAGS"
save_LDFLAGS="$LDFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
AC_MSG_CHECKING(for GameController framework)
@@ -2908,15 +2921,15 @@ CheckJoystickMFI()
dnl See what type of thread model to use on Linux and Solaris
CheckPTHREAD()
{
dnl Check for pthread support
dnl Check for pthread support
dnl Emscripten pthreads work, but you need to have a non-pthread fallback build
dnl for systems without support. It's not currently enough to not use
dnl pthread functions in a pthread-build; it won't start up on unsupported
dnl browsers. As such, you have to explicitly enable it on Emscripten builds
dnl for the time being. This default with change to ON once this becomes
dnl commonly supported in browsers or the Emscripten teams makes a single
dnl binary work everywhere.
dnl Emscripten pthreads work, but you need to have a non-pthread fallback build
dnl for systems without support. It's not currently enough to not use
dnl pthread functions in a pthread-build; it won't start up on unsupported
dnl browsers. As such, you have to explicitly enable it on Emscripten builds
dnl for the time being. This default with change to ON once this becomes
dnl commonly supported in browsers or the Emscripten teams makes a single
dnl binary work everywhere.
case "$host" in
*-*-emscripten*)
@@ -2930,7 +2943,7 @@ CheckPTHREAD()
AC_ARG_ENABLE(pthreads,
[AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=maybe]])],
, enable_pthreads=maybe)
dnl This is used on Linux for glibc binary compatibility (Doh!)
dnl This is used on Linux for glibc binary compatibility (Doh!)
AC_ARG_ENABLE(pthread-sem,
[AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=maybe]])],
, enable_pthread_sem=maybe)
@@ -3185,6 +3198,16 @@ CheckWINDOWS()
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
# headers needed elsewhere
AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
if test x$have_tpcshrd_h = xyes; then
AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ])
fi
AC_CHECK_HEADER(roapi.h,have_roapi_h=yes)
if test x$have_roapi_h = xyes; then
AC_DEFINE(HAVE_ROAPI_H, 1, [ ])
fi
}
dnl Determine whether the compiler can produce OS/2 executables
@@ -3643,6 +3666,7 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
AC_DEFINE(SDL_VIDEO_DRIVER_ANDROID, 1, [ ])
SUMMARY_video="${SUMMARY_video} android"
have_video=yes
fi
;;
*-*-linux*) ARCH=linux ;;
@@ -3724,12 +3748,16 @@ case "$host" in
CheckRPATH
CheckVivanteVideo
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
have_misc=yes
fi
# Set up files for the locale library
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
case $ARCH in
@@ -3907,12 +3935,16 @@ case "$host" in
# Set up the core platform files
SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
have_misc=yes
fi
# Use the Windows locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
have_locale=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
@@ -3977,10 +4009,6 @@ case "$host" in
have_haptic=yes
fi
fi
AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
if test x$have_tpcshrd_h = xyes; then
AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ])
fi
# Set up files for the sensor library
AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no)
if test x$have_winsensors = xyes; then
@@ -4045,14 +4073,12 @@ case "$host" in
SDL_LIBS="-lcygwin $SDL_LIBS"
fi
;;
dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
*-*-beos*)
AC_MSG_ERROR([
*** BeOS support has been removed as of SDL 2.0.2.
])
;;
*-*-haiku*)
ARCH=haiku
ac_default_prefix=/boot/system
@@ -4097,14 +4123,16 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
have_filesystem=yes
fi
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
have_locale=yes
fi
# The Haiku platform requires special setup.
SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
@@ -4124,13 +4152,16 @@ case "$host" in
CheckVulkan
CheckPTHREAD
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
@@ -4191,6 +4222,8 @@ case "$host" in
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
SUMMARY_video="${SUMMARY_video} uikit"
have_video=yes
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
@@ -4236,13 +4269,16 @@ case "$host" in
CheckPTHREAD
CheckHIDAPI
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
have_misc=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
have_locale=yes
fi
# Set up files for the audio library
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
@@ -4350,6 +4386,12 @@ case "$host" in
CheckClockGettime
CheckEmscriptenGLES
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c"
have_misc=yes
fi
# Set up files for the power library
if test x$enable_power = xyes; then
AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
@@ -4357,7 +4399,7 @@ case "$host" in
have_power=yes
fi
# Set up files for the power library
# Set up files for the joystick library
if test x$enable_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
@@ -4377,8 +4419,10 @@ case "$host" in
have_timers=yes
fi
# Set up files for the locale library
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
have_locale=yes
fi
;;
*-*-riscos*)
ARCH=riscos
@@ -4394,9 +4438,11 @@ case "$host" in
CheckPTHREAD
CheckClockGettime
SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
have_misc=yes
# Set up files for the misc library
if test x$enable_misc = xyes; then
SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
have_misc=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS, 1, [ ])
@@ -4443,8 +4489,10 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
fi
# Use the Unix locale APIs.
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
if test x$enable_locale = xyes; then
SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
have_locale=yes
fi
# Set up files for the video library
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ])
@@ -4520,10 +4568,28 @@ AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
# Verify that we have all the platform specific files we need
if test x$have_audio != xyes; then
if test x$enable_audio = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
fi
if test x$have_video != xyes; then
if test x$enable_video = xyes; then
AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
fi
if test x$have_misc != xyes; then
if test x$enable_misc = xyes; then
AC_DEFINE(SDL_MISC_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
fi
if test x$have_locale != xyes; then
if test x$enable_locale = xyes; then
AC_DEFINE(SDL_LOCALE_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
fi
if test x$have_joystick != xyes; then
@@ -4552,19 +4618,19 @@ if test x$have_threads != xyes; then
fi
if test x$have_timers != xyes; then
if test x$enable_timers = xyes; then
AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
AC_DEFINE(SDL_TIMER_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
fi
if test x$have_filesystem != xyes; then
if test x$enable_filesystem = xyes; then
AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
AC_DEFINE(SDL_FILESYSTEM_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
fi
if test x$have_loadso != xyes; then
if test x$enable_loadso = xyes; then
AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
AC_DEFINE(SDL_LOADSO_DUMMY, 1, [ ])
fi
SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
fi

186
debian/changelog vendored
View File

@@ -1,186 +0,0 @@
libsdl2 (2.0.20) UNRELEASED; urgency=low
* Updated SDL to version 2.0.20
-- Sam Lantinga <slouken@libsdl.org> Fri, 7 Jan 2022 18:24:41 -0800
libsdl2 (2.0.19) UNRELEASED; urgency=low
* Updated SDL to version 2.0.19
-- Sam Lantinga <slouken@libsdl.org> Tue, 30 Nov 2021 09:57:40 -0800
libsdl2 (2.0.18) UNRELEASED; urgency=low
* Updated SDL to version 2.0.18
-- Sam Lantinga <slouken@libsdl.org> Fri, 26 Nov 2021 08:07:21 -0800
libsdl2 (2.0.17) UNRELEASED; urgency=low
* Updated SDL to version 2.0.17
-- Sam Lantinga <slouken@libsdl.org> Tue, 10 Aug 2021 15:00:14 -0800
libsdl2 (2.0.16) UNRELEASED; urgency=low
* Updated SDL to version 2.0.16
-- Sam Lantinga <slouken@libsdl.org> Sat, 31 Jul 2021 13:27:38 -0800
libsdl2 (2.0.15) UNRELEASED; urgency=low
* Updated SDL to version 2.0.15 for development builds
-- Sam Lantinga <slouken@libsdl.org> Tue, 22 Dec 2020 10:29:01 -0800
libsdl2 (2.0.14) UNRELEASED; urgency=low
* Updated SDL to version 2.0.14
-- Sam Lantinga <slouken@libsdl.org> Tue, 8 Dec 2020 17:54:33 -0800
libsdl2 (2.0.13) UNRELEASED; urgency=low
* Updated SDL to version 2.0.13 for development builds
-- Sam Lantinga <slouken@libsdl.org> Tue, 10 Mar 2020 18:24:22 -0800
libsdl2 (2.0.12) UNRELEASED; urgency=low
* Updated SDL to version 2.0.12
-- Sam Lantinga <slouken@libsdl.org> Sun, 1 Mar 2020 14:57:07 -0800
libsdl2 (2.0.11) UNRELEASED; urgency=low
* Updated SDL to version 2.0.11 for development builds
-- Sam Lantinga <slouken@libsdl.org> Sun, 22 Sep 2019 10:33:03 -0800
libsdl2 (2.0.10) UNRELEASED; urgency=low
* Updated SDL to version 2.0.10
-- Sam Lantinga <slouken@libsdl.org> Mon, 17 Jun 2019 08:48:47 -0800
libsdl2 (2.0.9) UNRELEASED; urgency=low
* Updated SDL to version 2.0.9
-- Sam Lantinga <slouken@libsdl.org> Wed, 26 Sep 2018 10:02:21 -0800
libsdl2 (2.0.8) UNRELEASED; urgency=low
* Updated SDL to version 2.0.8
-- Sam Lantinga <slouken@libsdl.org> Sat, 4 Nov 2017 21:21:53 -0800
libsdl2 (2.0.7) UNRELEASED; urgency=low
* Updated SDL to version 2.0.7
-- Sam Lantinga <slouken@libsdl.org> Thu, 12 Oct 2017 08:01:16 -0800
libsdl2 (2.0.6) UNRELEASED; urgency=low
* Updated SDL to version 2.0.6
-- Sam Lantinga <slouken@libsdl.org> Sat, 9 Sep 2017 07:29:36 -0800
libsdl2 (2.0.5) UNRELEASED; urgency=low
* Updated SDL to version 2.0.5
-- Sam Lantinga <slouken@libsdl.org> Mon, 28 Nov 2016 07:32:52 -0800
libsdl2 (2.0.4) UNRELEASED; urgency=low
* Updated SDL to version 2.0.4
-- Sam Lantinga <slouken@libsdl.org> Thu, 07 Jan 2016 11:02:39 -0800
libsdl2 (2.0.3) UNRELEASED; urgency=low
* Updated SDL to version 2.0.3
-- Sam Lantinga <slouken@libsdl.org> Sun, 9 Mar 2014 10:35:54 -0800
libsdl2 (2.0.2) UNRELEASED; urgency=low
* Updated SDL to version 2.0.2
-- Sam Lantinga <slouken@libsdl.org> Sun, 9 Feb 2014 2:55:59 -0800
libsdl2 (2.0.1) UNRELEASED; urgency=low
* Updated SDL to version 2.0.1
-- Sam Lantinga <slouken@libsdl.org> Wed, 23 Oct 2013 16:31:38 -0800
libsdl2 (2.0.0) UNRELEASED; urgency=low
* SDL is now a native debian package.
* Removed udeb package
* Disabled DirectFB support by default, to avoid runtime dependencies
-- Sam Lantinga <slouken@libsdl.org> Fri, 15 Feb 2013 08:55:04 -0800
libsdl2 (2.0.0~20130127-1) UNRELEASED; urgency=low
* New upstream snapshot.
-- Sam Hocevar <sho@debian.org> Wed, 30 Jan 2013 23:01:12 +0100
libsdl2 (2.0.0~20130103-1) unstable; urgency=low
[ Manuel A. Fernandez Montecelo ]
* debian/control:
- Updating maintainers/permissions:
- Add myself and Felix Geyer
- Update Build-Depends:
- Remove a few obsolete items
- Add items added lately to libsdl1.2, such as libts (touch screen)
support
- Add "libsdl2-dbg", analog to libsdl1.2-dbg
- Change "XC-Package-Type: udeb" to "Package-Type"
* debian/compat: set level 9
* debian/source/format: Set to "3.0 (quilt)"
- Remove README.source, not needed with new format
* debian/sdl2-config.1: Fix typo, "progams"->"programs"
* debian/libsdl2-dev.install:
- Remove "usr/lib/*/*.la", discouraged
- Add man pages: "usr/share/man/man3/*"
* debian/libsdl2-dev.manpages: add file to install local "sdl2-config.1"
* debian/sources: Removed, possible obsolete file from long ago?
* debian/copyright:
- Upstream updated to zlib/libpng
- Copyright-file format conversion to 1.0
- Complete revamp and detailed research about copyright and licenses used,
it's very messy but hopefully complete
[ Felix Geyer ]
* Simplify debian/rules by using dh(1).
-- Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com> Sun, 27 Jan 2013 16:40:49 +0100
libsdl2 (2.0~20120220c-1) experimental; urgency=low
* Upstream version was renamed to 2.0 (Closes: #669367).
* New upstream snapshot (Closes: #671506).
* This package no longer conflicts with libsdl-1.2.
* debian/rules: add multiarch support (Closes: #669364).
* debian/patches/fix_joystick_misc_axes.diff: fix a joystick remapping
bug causing some axes to malfunction.
* debian/patches/external_header_paths.diff: provide additional CFLAGS
so that headers such as SDL_syswm.h can be included (Closes: #669363).
-- Sam Hocevar <sho@debian.org> Thu, 17 May 2012 19:03:59 +0200
libsdl-1.3 (1.3.0~20111204-1) experimental; urgency=low
* Initial upload from upstream snapshot.
-- Sam Hocevar <sho@debian.org> Sun, 04 Dec 2011 14:35:05 +0100

1
debian/compat vendored
View File

@@ -1 +0,0 @@
9

91
debian/control vendored
View File

@@ -1,91 +0,0 @@
Source: libsdl2
Priority: optional
Section: libs
Maintainer: Debian SDL packages maintainers <pkg-sdl-maintainers@lists.alioth.debian.org>
Uploaders: Barry deFreese <bdefreese@debian.org>,
Sam Hocevar <sho@debian.org>,
Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>,
Felix Geyer <fgeyer@debian.org>,
Sam Lantinga <slouken@libsdl.org>
Standards-Version: 3.9.3
Build-Depends: debhelper (>= 9),
dh-autoreconf,
dpkg-dev (>= 1.16.1~),
fcitx-libs-dev [linux-any],
libasound2-dev [linux-any],
libdbus-1-dev,
libegl1-mesa-dev [!hurd-any],
libdrm-dev [linux-any],
libgl1-mesa-dev,
libgles-dev [!hurd-any],
libpulse-dev,
libudev-dev [linux-any],
libdbus-1-dev [linux-any],
libibus-1.0-dev[linux-any],
libpulse-dev,
libsndio-dev,
libudev-dev [linux-any],
libusb2-dev [kfreebsd-any],
libusbhid-dev [kfreebsd-any],
libwayland-dev [linux-any],
libx11-dev,
libxcursor-dev,
libxext-dev,
libxfixes-dev,
libxi-dev,
libxinerama-dev,
libxkbcommon-dev,
libxrandr-dev,
libxss-dev,
libxxf86vm-dev,
libxt-dev,
libxv-dev,
pkg-config,
libsamplerate0-dev,
wayland-protocols
Homepage: http://www.libsdl.org/
Package: libsdl2-2.0-0
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends},
${shlibs:Depends},
libudev1 [linux-any],
libdbus-1-3 [linux-any]
Conflicts: libsdl-1.3-0
Replaces: libsdl-1.3-0
Description: Simple DirectMedia Layer
SDL is a library that allows programs portable low level access to
a video framebuffer, audio output, mouse, and keyboard.
.
This package contains the shared library, compiled with X11 graphics drivers and OSS, ALSA and PulseAudio sound drivers.
Package: libsdl2-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2-2.0-0 (= ${binary:Version}),
libc6-dev,
libgl1-mesa-dev
Conflicts: libsdl-1.3-dev
Replaces: libsdl-1.3-dev
Description: Simple DirectMedia Layer development files
SDL is a library that allows programs portable low level access to a video
framebuffer, audio output, mouse, and keyboard.
.
This package contains files needed if you wish to use the SDL library in your own programs.
Package: libsdl2-dbg
Priority: extra
Section: debug
Architecture: any
Multi-Arch: same
Depends: ${misc:Depends},
libsdl2-2.0-0 (= ${binary:Version}),
Description: Simple DirectMedia Layer debug files
SDL is a library that allows programs portable low level access to a video
framebuffer, audio output, mouse, and keyboard.
.
This package contains the debug symbols for the SDL library.

351
debian/copyright vendored
View File

@@ -1,351 +0,0 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SDL
Upstream-Contact: Sam Lantinga <slouken@libsdl.org>
Source: http://www.libsdl.org/
Files: *
Copyright: 1997-2022 Sam Lantinga <slouken@libsdl.org>
License: zlib/libpng
Files: src/libm/*
Copyright: 1993 by Sun Microsystems, Inc. All rights reserved.
License: SunPro
Files: src/main/windows/SDL_windows_main.c
Copyright: 2022 Sam Lantinga
License: PublicDomain_Sam_Lantinga
Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98
Files: src/render/mmx.h
Copyright: 1997-99 by H. Dietz and R. Fisher
License: zlib/libpng
Comment:
Copyright but no mention to license.
.
Included since long ago with SDL (and its Debian package) under directory
src/video/mmx.h
Files: src/render/SDL_yuv_sw.c
Copyright: 1995 Erik Corry
1995 The Regents of the University of California
1995 Brown University
License: BrownUn_UnCalifornia_ErikCorry
Files: src/test/SDL_test_md5.c
Copyright: 1997-2022 Sam Lantinga <slouken@libsdl.org>
1990 RSA Data Security, Inc.
License: zlib/libpng and RSA_Data_Security
Files: src/thread/windows/win_ce_semaphore.c
Copyright: 1998, Johnson M. Hart (with corrections 2001 by Rainer Loritz)
License: Johnson_M._Hart
Files: src/video/x11/imKStoUCS.c
src/video/x11/imKStoUCS.h
Copyright: 1994-2003 The XFree86 Project, Inc.
License: MIT/X11
Files: test/testhaptic.c
Copyright: 1997-2022 Sam Lantinga <slouken@libsdl.org>
2008 Edgar Simo Serra
License: BSD_3_clause
Files: test/testrumble.c
Copyright: 1997-2022 Sam Lantinga <slouken@libsdl.org>
2011 Edgar Simo Serra
License: BSD_3_clause
Files: test/shapes/*
Copyright: none
License: zlib/libpng
Comment: No specific information about the images
Files: Xcode/TemplatesForXcode*/*/main.c
Copyright: none
License: zlib/libpng
Comment: SDL files, no copyright or license notice
Files: Xcode/TemplatesForXcode*/*/atlantis/*
Copyright: 1993, 1994, Silicon Graphics, Inc.
License: SGI_atlantis
Files: Xcode/TemplatesForXcode*/*/atlantis/atlantis.c
Copyright: 1994 Mark J. Kilgard
1993, 1994, Silicon Graphics, Inc.
License: SGI_atlantis
Comment: See license for full copyright notice, this one is the same except for
the additional copyright holder
Files: Xcode/SDLTest/sdlcommon_prefix.h
Copyright: 2003 Darrell Walisser
License: zlib/libpng
Comment:
Created by Darrell Walisser on Wed Aug 06 2003.
Copyright (c) 2003 __MyCompanyName__. All rights reserved.
Files: debian/*
Copyright: 2011-2012, Manuel A. Fernandez Montecelo <manuel.montezelo@gmail.com>
2011-2012, Felix Geyer <debfx-pkg@fobos.de>
2011, Roman Vasiyarov <rvasiyarov@gmail.com>
2010, Jon Dowland <jmtd@debian.org>
2009, Barry deFreese <bdefreese@debian.org>
2007-2008, Aurelien Jarno <aurel32@debian.org>
2007-2008, Sam Hocevar (Debian packages) <sam+deb@zoy.org>
2002-2007, Josselin Mouette <joss@debian.org>
2001, Christian T. Steigies <cts@debian.org>
2001, Branden Robinson <branden@debian.org>
License: LGPL-2.1+
License: zlib/libpng
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
.
On Debian systems, the complete text of version 2.1 of the GNU Lesser
Public License can be found in '/usr/share/common-licenses/LGPL-2.1'.
License: MIT/X11
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is fur-
nished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
.
Except as contained in this notice, the name of the XFree86 Project shall not
be used in advertising or otherwise to promote the sale, use or other deal-
ings in this Software without prior written authorization from the XFree86
Project.
License: BSD_3_clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the LibQxt project nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Comment:
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
.
.
Copyright (c) 2011, Edgar Simo Serra
All rights reserved.
.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Simple Directmedia Layer (SDL) nor the names of
its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License: BrownUn_UnCalifornia_ErikCorry
/* This code was derived from code carrying the following copyright notices:
* Copyright (c) 1995 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Copyright (c) 1995 Erik Corry
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
* BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Portions of this software Copyright (c) 1995 Brown University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement
* is hereby granted, provided that the above copyright notice and the
* following two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
* UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
* BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
License: Johnson_M._Hart
Permission is granted for any and all use providing that this
copyright is properly acknowledged.
There are no assurances of suitability for any use whatsoever.
License: SunPro
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
License: PublicDomain_Sam_Lantinga
Placed in the public domain by Sam Lantinga 4/13/98
License: PublicDomain_Edgar_Simo
Written by Edgar Simo "bobbens"
.
Released under Public Domain.
License: RSA_Data_Security
***********************************************************************
** utl_md5.c -- the source code for MD5 routines **
** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
** Created: 2/17/90 RLR **
** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
***********************************************************************
***********************************************************************
** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
** **
** License to copy and use this software is granted provided that **
** it is identified as the "RSA Data Security, Inc. MD5 Message- **
** Digest Algorithm" in all material mentioning or referencing this **
** software or this function. **
** **
** License is also granted to make and use derivative works **
** provided that such works are identified as "derived from the RSA **
** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
** material mentioning or referencing the derived work. **
** **
** RSA Data Security, Inc. makes no representations concerning **
** either the merchantability of this software or the suitability **
** of this software for any particular purpose. It is provided "as **
** is" without express or implied warranty of any kind. **
** **
** These notices must be retained in any copies of any part of this **
** documentation and/or software. **
***********************************************************************
License: SGI_atlantis
(c) Copyright 1993, 1994, Silicon Graphics, Inc.
ALL RIGHTS RESERVED
Permission to use, copy, modify, and distribute this software for
any purpose and without fee is hereby granted, provided that the above
copyright notice appear in all copies and that both the copyright notice
and this permission notice appear in supporting documentation, and that
the name of Silicon Graphics, Inc. not be used in advertising
or publicity pertaining to distribution of the software without specific,
written prior permission.
.
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
.
US Government Users Restricted Rights
Use, duplication, or disclosure by the Government is subject to
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
(c)(1)(ii) of the Rights in Technical Data and Computer Software
clause at DFARS 252.227-7013 and/or in similar or successor
clauses in the FAR or the DOD or NASA FAR Supplement.
Unpublished-- rights reserved under the copyright laws of the
United States. Contractor/manufacturer is Silicon Graphics,
Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
.
OpenGL(TM) is a trademark of Silicon Graphics, Inc.

4
debian/docs vendored
View File

@@ -1,4 +0,0 @@
BUGS.txt
CREDITS.txt
README.md
README-SDL.txt

View File

@@ -1 +0,0 @@
usr/lib/*/libSDL2-2.0.so.0*

View File

@@ -1 +0,0 @@
usr/lib/*/libSDL2-2.0.so.0*

View File

@@ -1,9 +0,0 @@
usr/bin/sdl2-config
usr/include/SDL2
usr/lib/*/*.a
usr/lib/*/*.la
usr/lib/*/*.so
usr/lib/*/pkgconfig/sdl2.pc
usr/lib/*/cmake/SDL2/sdl2-config.cmake
usr/lib/*/cmake/SDL2/sdl2-config-version.cmake
usr/share/aclocal/sdl2.m4

View File

@@ -1 +0,0 @@
debian/sdl2-config.1

54
debian/rules vendored
View File

@@ -1,54 +0,0 @@
#!/usr/bin/make -f
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
confflags = --disable-rpath --disable-video-directfb \
--disable-nas --disable-esd --disable-arts
# These flags can be used to create a package directly linking with external libraries and having the appropriate package dependencies
#confflags += --disable-alsa-shared
#confflags += --disable-arts-shared
#confflags += --disable-directfb-shared
#confflags += --disable-esd-shared
#confflags += --disable-fusionsound-shared
#confflags += --disable-jack-shared
#confflags += --disable-kmsdrm-shared
#confflags += --disable-libsamplerate-shared
#confflags += --disable-nas-shared
#confflags += --disable-pulseaudio-shared
#confflags += --disable-sndio-shared
#confflags += --disable-wayland-shared
#confflags += --disable-x11-shared
%:
dh $@ --parallel
override_dh_auto_configure:
dh_auto_configure -Bbuilddir/all -- $(confflags)
override_dh_auto_build:
dh_auto_build -Bbuilddir/all
tar czf debian/examples.tar.gz test
override_dh_auto_install:
dh_auto_install -Bbuilddir/all
override_dh_auto_clean:
dh_auto_clean -Bbuilddir/all
rm -f debian/examples.tar.gz
override_dh_install:
dh_install --remaining-packages --fail-missing -XlibSDL2.la
override_dh_installexamples:
dh_installexamples -plibsdl2-dev debian/examples.tar.gz
dh_installexamples --remaining-packages
override_dh_link:
# to address lintian warning
# W: libsdl2-2.0-0: dev-pkg-without-shlib-symlink usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0.0.0 usr/lib/x86_64-linux-gnu/libSDL2-2.0.so
dh_link -plibsdl2-dev usr/lib/$(DEB_HOST_MULTIARCH)/libSDL2-2.0.so.0.0.0 usr/lib/$(DEB_HOST_MULTIARCH)/libSDL2-2.0.so
override_dh_strip:
dh_strip --dbg-package=libsdl2-dbg

86
debian/sdl2-config.1 vendored
View File

@@ -1,86 +0,0 @@
.TH sdl2-config 1 "2012-02-20" "SDL 2.0"
.SH NAME
sdl2-config \- script to get information about the installed version of SDL
.SH SYNOPSIS
.B sdl2-config
[ --prefix=
.IR DIR ]
[ --exec-prefix=
.IR DIR ]
[ --version ] [ --libs | --library-libs | --plugin-libs ] [ --cflags ]
.SH DESCRIPTION
.B sdl2-config
is a tool that is used to configure and determine the compiler and linker
flags that should be used to compile and link programs, libraries, and
plugins that use SDL. It is also used internally by the m4 macros that are
included with SDL.
.SH OPTIONS
.TP
.B --cflags
Print the compiler flags that are necessary to compile a program or library
that uses SDL.
.TP
.BI --exec-prefix= DIR
If specified, use
.I DIR
instead of the installation exec prefix that SDL was build with when
computing the output for the --cflags, --libs, --library-libs, and
--plugin-libs options. This option must be specified before any of the
--cflags, --libs, --library-libs, and --plugin-libs options.
.TP
.B --libs
Print the linker flags that are necessary to link a program that uses SDL.
.TP
.B --static-libs
Print the linker flags that are necessary to statically link a program that uses SDL.
.TP
.B --library-libs
Print the linker flags that are necessary to link a library that uses SDL.
(This excludes any static objects required for linking, since these must be
linked only by executable programs.)
.TP
.B --plugin-libs
Print the linker flags that are necessary to link an SDL-using object that
is to be accessed via
.IR dlopen (3).
This may include static objects with PIC symbol information. This option
should
.B not
be used for ordinary shared libraries or standalone applications.
.TP
.BI --prefix= DIR
If specified, use PREFIX instead of the installation prefix that SDL was
built with when computing the output for the --cflags, --libs,
--library-libs, and --plugin-libs options. This option is also used for
the exec prefix if --exec-prefix was not specified. This option must be
specified before any of the --cflags, --libs, --library-libs, and
--plugin-libs options.
.TP
.B --version
Prints the currently installed version of SDL on standard output.
.SH EXAMPLES
.TP
gcc -o main.o $(sdl2-config --cflags) main.c
is how you might use
.B sdl2-config
to compile a C source file for an executable program.
.TP
gcc -o my_app $(sdl2-config --libs) main.o util.o
is how you might use
.B sdl2-config
to link compiled objects into an executable program.
.TP
gcc -o libSDL_nifty-2.0.so.0.0.1 $(sdl --library-libs) read.o write.o munge.o
is how you might use
.B sdl2-config
to link compiled objects into a shared library.
.TP
gcc -o libnifty_xmms.so $(sdl --plugin-libs) stream.o blit.o deinterlace.o
is how you might use
.B sdl2-config
to link compiled objects into a plugin for use by another program.
.SH AUTHOR
The Simple DirectMedia Layer (SDL) library was written by Sam Lantinga.
.PP
This manual page was written by Branden Robinson, originally for Progeny
Linux Systems, Inc., and the Debian Project.

View File

@@ -1 +0,0 @@
3.0 (native)

2
debian/watch vendored
View File

@@ -1,2 +0,0 @@
version=3
http://www.libsdl.org/release/SDL-([\d.]+)\.tar\.gz

View File

@@ -206,6 +206,9 @@ You should not use the SDL renderer API while the app going in background:
after you read this message, GL context gets backed-up and you should not
use the SDL renderer API.
When this event is received, you have to set the render target to NULL, if you're using it.
(eg call SDL_SetRenderTarget(renderer, NULL))
- SDL_APP_DIDENTERFOREGROUND:
GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET).

View File

@@ -15,29 +15,34 @@ What you need:
* Kernel-Framebuffer support: required: vesafb, radeonfb ....
* Mesa 7.0.x - optional for OpenGL
/etc/directfbrc
This file should contain the following lines to make
The `/etc/directfbrc` file should contain the following lines to make
your joystick work and avoid crashes:
------------------------
```
disable-module=joystick
disable-module=cle266
disable-module=cyber5k
no-linux-input-grab
------------------------
```
To disable to use x11 backend when DISPLAY variable is found use
```
export SDL_DIRECTFB_X11_CHECK=0
```
To disable the use of linux input devices, i.e. multimice/multikeyboard support,
use
```
export SDL_DIRECTFB_LINUX_INPUT=0
```
To use hardware accelerated YUV-overlays for YUV-textures, use:
```
export SDL_DIRECTFB_YUV_DIRECT=1
```
This is disabled by default. It will only support one
YUV texture, namely the first. Every other YUV texture will be
@@ -45,7 +50,9 @@ rendered in software.
In addition, you may use (directfb-1.2.x)
```
export SDL_DIRECTFB_YUV_UNDERLAY=1
```
to make the YUV texture an underlay. This will make the cursor to
be shown.
@@ -54,14 +61,18 @@ Simple Window Manager
=====================
The driver has support for a very, very basic window manager you may
want to use when running with "wm=default". Use
want to use when running with `wm=default`. Use
```
export SDL_DIRECTFB_WM=1
```
to enable basic window borders. In order to have the window title rendered,
you need to have the following font installed:
```
/usr/share/fonts/truetype/freefont/FreeSans.ttf
```
OpenGL Support
==============
@@ -71,21 +82,25 @@ works at least on all directfb supported platforms.
As of this writing 20100802 you need to pull Mesa from git and do the following:
------------------------
```
git clone git://anongit.freedesktop.org/git/mesa/mesa
cd mesa
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
------------------------
```
Edit configs/linux-directfb so that the Directories-section looks like
------------------------
Edit `configs/linux-directfb` so that the Directories-section looks like this:
```
# Directories
SRC_DIRS = mesa glu
GLU_DIRS = sgi
DRIVER_DIRS = directfb
PROGRAM_DIRS =
------------------------
```
Then do the following:
```
make linux-directfb
make
@@ -95,13 +110,14 @@ sudo make install INSTALL_DIR=/usr/local/dfb_GL
cd src/mesa/drivers/directfb
make
sudo make install INSTALL_DIR=/usr/local/dfb_GL
------------------------
```
To run the SDL - testprograms:
```
export SDL_VIDEODRIVER=directfb
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
./testgl
```

View File

@@ -1,31 +1,36 @@
PSP
======
SDL port for the Sony PSP contributed by
Captian Lex
SDL2 port for the Sony PSP contributed by:
- Captian Lex
- Francisco Javier Trujillo Mata
- Wouter Wijsman
Credit to
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
Geecko for his PSP GU lib "Glib2d"
Building
--------
To build SDL2 library for the PSP, make sure psp-config is in the path and run:
make -f Makefile.psp
## Building
To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
```bash
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
cmake --build build
cmake --install build
```
Getting PSP toolchain
---------------------
https://github.com/pspdev/psptoolchain
## Getting PSP Dev
[Installing PSP Dev](https://github.com/pspdev/pspdev)
Running on PPSSPP Emulator
--------------------------
https://github.com/hrydgard/ppsspp
( https://github.com/hrydgard/ppsspp/wiki/Build-instructions )
## Running on PPSSPP Emulator
[PPSSPP](https://github.com/hrydgard/ppsspp)
Compiling an HelloWorld
-----------------------
https://psp-dev.org/doku.php?id=tutorial:hello_world
[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
To Do
------
PSP Screen Keyboard
## Compiling a HelloWorld
[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
## To Do
- PSP Screen Keyboard
- Dialogs

View File

@@ -1,7 +1,7 @@
Using SDL with Microsoft Visual C++
===================================
### by [Lion Kimbro](mailto:snowlion@sprynet.com) with additions by [James Turk](mailto:james@conceptofzero.net)
### by Lion Kimbro with additions by James Turk
You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
yourself.

View File

@@ -3,7 +3,7 @@ PS Vita
SDL port for the Sony Playstation Vita and Sony Playstation TV
Credit to
* xerpi and rsn8887 for initial (vita2d) port
* xerpi, cpasjuste and rsn8887 for initial (vita2d) port
* vitasdk/dolcesdk devs
* CBPS discord (Namely Graphene and SonicMastr)
@@ -22,6 +22,9 @@ Notes
* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
These renderers support 720p and 1080i resolutions. These can be specified with:
`SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
anytime before video subsystem initialization.
* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
* By default SDL emits mouse events for touch events on every touchscreen.
Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.

View File

@@ -1,45 +1,58 @@
Windows
================================================================================
# Windows
================================================================================
OpenGL ES 2.x support
================================================================================
## LLVM and Intel C++ compiler support
SDL has support for OpenGL ES 2.x under Windows via two alternative
implementations.
The most straightforward method consists in running your app in a system with
a graphic card paired with a relatively recent (as of November of 2013) driver
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
compiler, but you'll have to manually add the "-msse3" command line option
to at least the SDL_audiocvt.c source file, and possibly others. This may
not be necessary if you build SDL with CMake instead of the included Visual
Studio solution.
Details are here: https://github.com/libsdl-org/SDL/issues/5186
## OpenGL ES 2.x support
SDL has support for OpenGL ES 2.x under Windows via two alternative
implementations.
The most straightforward method consists in running your app in a system with
a graphic card paired with a relatively recent (as of November of 2013) driver
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
to ship said extension on Windows currently include nVidia and Intel.
The other method involves using the ANGLE library (https://code.google.com/p/angleproject/)
If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile
extension is found, SDL will try to load the libEGL.dll library provided by
ANGLE.
The other method involves using the
[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
context is requested and no WGL_EXT_create_context_es2_profile extension is
found, SDL will try to load the libEGL.dll library provided by ANGLE.
To obtain the ANGLE binaries, you can either compile from source from
https://chromium.googlesource.com/angle/angle or copy the relevant binaries from
a recent Chrome/Chromium install for Windows. The files you need are:
* libEGL.dll
* libGLESv2.dll
* d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler)
or...
* d3dcompiler_43.dll (supports Windows XP or later)
https://chromium.googlesource.com/angle/angle or copy the relevant binaries
from a recent Chrome/Chromium install for Windows. The files you need are:
- libEGL.dll
- libGLESv2.dll
- d3dcompiler_46.dll (supports Windows Vista or later, better shader
compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
If you compile ANGLE from source, you can configure it so it does not need the
d3dcompiler_* DLL at all (for details on this, see their documentation).
d3dcompiler_* DLL at all (for details on this, see their documentation).
However, by default SDL will try to preload the d3dcompiler_46.dll to
comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to
support Windows XP) or to skip this step at all, you can use the
SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details).
comply with ANGLE's requirements. If you wish SDL to preload
d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
details).
Known Bugs:
* SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
that there's a bug in the library which prevents the window contents from
refreshing if this is set to anything other than the default value.
Vulkan Surface Support
==============
Support for creating Vulkan surfaces is configured on by default. To disable it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to use Vulkan graphics in your application.
- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
that there's a bug in the library which prevents the window contents from
refreshing if this is set to anything other than the default value.
## Vulkan Surface Support
Support for creating Vulkan surfaces is configured on by default. To disable
it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
use Vulkan graphics in your application.

View File

@@ -14,7 +14,7 @@ hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.
SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
SDL officially supports Windows, macOS, Linux, iOS, and Android.
Support for other platforms may be found in the source code.
SDL is written in C, works natively with C++, and there are bindings
@@ -38,7 +38,7 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd
- [Git](README-git.md)
- [iOS](README-ios.md)
- [Linux](README-linux.md)
- [OS X](README-macosx.md)
- [macOS](README-macos.md)
- [OS/2](README-os2.md)
- [Native Client](README-nacl.md)
- [Pandora](README-pandora.md)

View File

@@ -500,9 +500,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
* hardware.
*
* `spec` will be filled with the sample rate, sample format, and channel
* count. All other values in the structure are filled with 0. When the
* supported struct members are 0, SDL was unable to get the property from the
* backend.
* count.
*
* \param index the index of the audio device; valid values range from 0 to
* SDL_GetNumAudioDevices() - 1

View File

@@ -67,9 +67,8 @@ typedef enum
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
} SDL_BlendOperation;
/**
@@ -87,7 +86,6 @@ typedef enum
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
} SDL_BlendFactor;
/**
@@ -135,10 +133,10 @@ typedef enum
* SDL 2.0.6. All renderers support the four blend modes listed in the
* SDL_BlendMode enumeration.
*
* - **direct3d**: Supports `SDL_BLENDOPERATION_ADD` with all factors.
* - **direct3d11**: Supports all operations with all factors. However, some
* - **direct3d**: Supports all operations with all factors. However, some
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
* `SDL_BLENDOPERATION_MAXIMUM`.
* - **direct3d11**: Same as Direct3D 9.
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL
* 2.0.6.

View File

@@ -39,8 +39,6 @@
#include "SDL_config_iphoneos.h"
#elif defined(__ANDROID__)
#include "SDL_config_android.h"
#elif defined(__PSP__)
#include "SDL_config_psp.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#elif defined(__EMSCRIPTEN__)

View File

@@ -253,6 +253,7 @@
#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
#cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@
#cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@
#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@
#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
@@ -277,6 +278,8 @@
#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@
#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@
#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@
#cmakedefine SDL_LOCALE_DISABLED @SDL_LOCALE_DISABLED@
#cmakedefine SDL_MISC_DISABLED @SDL_MISC_DISABLED@
/* Enable various audio drivers */
#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@
@@ -491,6 +494,12 @@
#cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@
#cmakedefine SDL_FILESYSTEM_PSP @SDL_FILESYSTEM_PSP@
/* Enable misc subsystem */
#cmakedefine SDL_MISC_DUMMY @SDL_MISC_DUMMY@
/* Enable locale subsystem */
#cmakedefine SDL_LOCALE_DUMMY @SDL_LOCALE_DUMMY@
/* Enable assembly routines */
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@
#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@
@@ -512,6 +521,7 @@
#cmakedefine SDL_VIDEO_VITA_PIB @SDL_VIDEO_VITA_PIB@
#cmakedefine SDL_VIDEO_VITA_PVR @SDL_VIDEO_VITA_PVR@
#cmakedefine SDL_VIDEO_VITA_PVR_OGL @SDL_VIDEO_VITA_PVR_OGL@
#if !defined(__WIN32__) && !defined(__WINRT__)
# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H)

View File

@@ -242,6 +242,7 @@
#undef HAVE_AUDIOCLIENT_H
#undef HAVE_TPCSHRD_H
#undef HAVE_SENSORSAPI_H
#undef HAVE_ROAPI_H
/* SDL internal assertion support */
#undef SDL_DEFAULT_ASSERT_LEVEL
@@ -263,6 +264,8 @@
#undef SDL_VIDEO_DISABLED
#undef SDL_POWER_DISABLED
#undef SDL_FILESYSTEM_DISABLED
#undef SDL_LOCALE_DISABLED
#undef SDL_MISC_DISABLED
/* Enable various audio drivers */
#undef SDL_AUDIO_DRIVER_AAUDIO
@@ -445,16 +448,24 @@
#undef SDL_POWER_HARDWIRED
/* Enable system filesystem support */
#undef SDL_FILESYSTEM_ANDROID
#undef SDL_FILESYSTEM_HAIKU
#undef SDL_FILESYSTEM_COCOA
#undef SDL_FILESYSTEM_DUMMY
#undef SDL_FILESYSTEM_RISCOS
#undef SDL_FILESYSTEM_UNIX
#undef SDL_FILESYSTEM_WINDOWS
#undef SDL_FILESYSTEM_NACL
#undef SDL_FILESYSTEM_ANDROID
#undef SDL_FILESYSTEM_EMSCRIPTEN
#undef SDL_FILESYSTEM_OS2
#undef SDL_FILESYSTEM_RISCOS
#undef SDL_FILESYSTEM_VITA
#undef SDL_FILESYSTEM_PSP
/* Enable misc subsystem */
#undef SDL_MISC_DUMMY
/* Enable locale subsystem */
#undef SDL_LOCALE_DUMMY
/* Enable assembly routines */
#undef SDL_ASSEMBLY_ROUTINES

View File

@@ -185,6 +185,7 @@
/* Enable various threading systems */
#ifdef __EMSCRIPTEN_PTHREADS__
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
#endif
/* Enable various timer systems */

View File

@@ -1,165 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_psp_h_
#define SDL_config_psp_h_
#define SDL_config_h_
#include "SDL_platform.h"
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif
#define HAVE_GCC_ATOMICS 1
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
/* #define HAVE_SYSCONF 1 */
/* #define HAVE_SIGACTION 1 */
/* PSP isn't that sophisticated */
#define LACKS_SYS_MMAN_H 1
/* Enable the PSP thread support (src/thread/psp/\*.c) */
#define SDL_THREAD_PSP 1
/* Enable the PSP timer support (src/timer/psp/\*.c) */
#define SDL_TIMER_PSP 1
/* Enable the PSP joystick driver (src/joystick/psp/\*.c) */
#define SDL_JOYSTICK_PSP 1
#define SDL_JOYSTICK_VIRTUAL 1
/* Enable the dummy sensor driver */
#define SDL_SENSOR_DUMMY 1
/* Enable the PSP audio driver (src/audio/psp/\*.c) */
#define SDL_AUDIO_DRIVER_PSP 1
/* PSP video driver */
#define SDL_VIDEO_DRIVER_PSP 1
/* PSP render driver */
#define SDL_VIDEO_RENDER_PSP 1
#define SDL_POWER_PSP 1
/* Enable the PSP filesystem support (src/filesystem/psp/\*.c) */
#define SDL_FILESYSTEM_PSP 1
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
/* PSP doesn't have HIDAPI available */
#define SDL_HIDAPI_DISABLED 1
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
#endif /* SDL_config_psp_h_ */

View File

@@ -90,6 +90,10 @@ typedef unsigned int uintptr_t;
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
@@ -100,6 +104,7 @@ typedef unsigned int uintptr_t;
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1

View File

@@ -92,6 +92,10 @@ typedef unsigned int uintptr_t;
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
/* Useful headers */
#define HAVE_DXGI_H 1
#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
@@ -191,6 +195,8 @@ typedef unsigned int uintptr_t;
#define HAVE_TRUNCF 1
#define HAVE__FSEEKI64 1
#define HAVE_ROAPI_H 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DISK 1

View File

@@ -1,154 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_wiz_h_
#define SDL_config_wiz_h_
#define SDL_config_h_
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
#define SDL_BYTEORDER 1234
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_ICONV_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MATH_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRLEN 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_POW 1
#define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_OSS 1
#define SDL_INPUT_LINUXEV 1
#define SDL_JOYSTICK_LINUX 1
#define SDL_JOYSTICK_VIRTUAL 1
#define SDL_HAPTIC_LINUX 1
#define SDL_SENSOR_DUMMY 1
#define SDL_LOADSO_DLOPEN 1
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
#define SDL_TIMER_UNIX 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_PANDORA 1
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_OPENGL_ES 1
#endif /* SDL_config_wiz_h_ */

View File

@@ -65,6 +65,15 @@ _m_prefetch(void *__P)
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#else
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \

View File

@@ -102,6 +102,7 @@ typedef enum
SDL_KEYMAPCHANGED, /**< Keymap changed due to a system event such as an
input language or keyboard layout change.
*/
SDL_TEXTEDITING_EXT, /**< Extended keyboard text editing (composition) */
/* Mouse events */
SDL_MOUSEMOTION = 0x400, /**< Mouse moved */
@@ -243,6 +244,19 @@ typedef struct SDL_TextEditingEvent
Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingEvent;
/**
* \brief Extended keyboard text editing event structure (event.editExt.*) when text would be
* truncated if stored in the text buffer SDL_TextEditingEvent
*/
typedef struct SDL_TextEditingExtEvent
{
Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */
char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
Sint32 start; /**< The start cursor of selected editing text */
Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingExtEvent;
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
/**
@@ -601,6 +615,7 @@ typedef union SDL_Event
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_TextEditingExtEvent editExt; /**< Extended text editing event data */
SDL_TextInputEvent text; /**< Text input event data */
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
SDL_MouseButtonEvent button; /**< Mouse button event data */

View File

@@ -869,8 +869,9 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
* calling it with 0 intensity stops any rumbling.
*
* Note that this is rumbling of the _triggers_ and not the game controller as
* a whole. The first controller to offer this feature was the PlayStation 5's
* DualShock 5.
* a whole. This is currently only supported on Xbox One controllers. If you
* want the (more common) whole-controller rumble, use
* SDL_GameControllerRumble() instead.
*
* \param gamecontroller The controller to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0

View File

@@ -412,6 +412,19 @@ extern "C" {
*/
#define SDL_HINT_EVENT_LOGGING "SDL_EVENT_LOGGING"
/**
* \brief A variable controlling whether raising the window should be done more forcefully
*
* This variable can be set to the following values:
* "0" - No forcing (the default)
* "1" - Extra level of forcing
*
* At present, this is only an issue under MS Windows, which makes it nearly impossible to
* programmatically move a window to the foreground, for "security" reasons. See
* http://stackoverflow.com/a/34414846 for a discussion.
*/
#define SDL_HINT_FORCE_RAISEWINDOW "SDL_HINT_FORCE_RAISEWINDOW"
/**
* \brief A variable controlling how 3D acceleration is used to accelerate the SDL screen surface.
*
@@ -566,6 +579,17 @@ extern "C" {
*/
#define SDL_HINT_IME_SHOW_UI "SDL_IME_SHOW_UI"
/**
* \brief A variable to control if extended IME text support is enabled.
* If enabled then SDL_TextEditingExtEvent will be issued if the text would be truncated otherwise.
* Additionally SDL_TextInputEvent will be dispatched multiple times so that it is not truncated.
*
* The variable can be set to the following values:
* "0" - Legacy behavior. Text can be truncated, no heap allocations. (default)
* "1" - Modern behavior.
*/
#define SDL_HINT_IME_SUPPORT_EXTENDED_TEXT "SDL_IME_SUPPORT_EXTENDED_TEXT"
/**
* \brief A variable controlling whether the home indicator bar on iPhone X
* should be hidden.
@@ -612,6 +636,21 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
/**
* \brief A variable controlling whether "low_frequency_rumble" and "high_frequency_rumble" is used to implement
* the GameCube controller's 3 rumble modes, Stop(0), Rumble(1), and StopHard(2)
* this is useful for applications that need full compatibility for things like ADSR envelopes.
* Stop is implemented by setting "low_frequency_rumble" to "0" and "high_frequency_rumble" ">0"
* Rumble is both at any arbitrary value,
* StopHard is implemented by setting both "low_frequency_rumble" and "high_frequency_rumble" to "0"
*
* This variable can be set to the following values:
* "0" - Normal rumble behavior is behavior is used (default)
* "1" - Proper GameCube controller rumble behavior is used
*
*/
#define SDL_HINT_JOYSTICK_GAMECUBE_RUMBLE_BRAKE "SDL_JOYSTICK_GAMECUBE_RUMBLE_BRAKE"
/**
* \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver.
*
@@ -766,7 +805,6 @@ extern "C" {
* This variable can be set to the following values:
* "0" - RAWINPUT drivers are not used
* "1" - RAWINPUT drivers are used (the default)
*
*/
#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
@@ -783,6 +821,15 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT "SDL_JOYSTICK_RAWINPUT_CORRELATE_XINPUT"
/**
* \brief A variable controlling whether the ROG Chakram mice should show up as joysticks
*
* This variable can be set to the following values:
* "0" - ROG Chakram mice do not show up as joysticks (the default)
* "1" - ROG Chakram mice show up as joysticks
*/
#define SDL_HINT_JOYSTICK_ROG_CHAKRAM "SDL_JOYSTICK_ROG_CHAKRAM"
/**
* \brief A variable controlling whether a separate thread should be used
* for handling joystick detection and raw input messages on Windows
@@ -886,6 +933,22 @@ extern "C" {
*/
#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE"
/**
* \brief A variable controlling whether relative mouse mode constrains the mouse to the center of the window
*
* This variable can be set to the following values:
* "0" - Relative mouse mode constrains the mouse to the window
* "1" - Relative mouse mode constrains the mouse to the center of the window
*
* Constraining to the center of the window works better for FPS games and when the
* application is running over RDP. Constraining to the whole window works better
* for 2D games and increases the chance that the mouse will be in the correct
* position when using high DPI mice.
*
* By default SDL will constrain the mouse to the center of the window
*/
#define SDL_HINT_MOUSE_RELATIVE_MODE_CENTER "SDL_MOUSE_RELATIVE_MODE_CENTER"
/**
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
*
@@ -922,6 +985,19 @@ extern "C" {
*/
#define SDL_HINT_MOUSE_TOUCH_EVENTS "SDL_MOUSE_TOUCH_EVENTS"
/**
* \brief A variable controlling whether the mouse is captured while mouse buttons are pressed
*
* This variable can be set to the following values:
* "0" - The mouse is not captured while mouse buttons are pressed
* "1" - The mouse is captured while mouse buttons are pressed
*
* By default the mouse is captured while mouse buttons are pressed so if the mouse is dragged
* outside the window, the application continues to receive mouse events until the button is
* released.
*/
#define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE"
/**
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
*
@@ -1278,6 +1354,18 @@ extern "C" {
*/
#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS"
/**
* \brief A variable controlling which touchpad should generate synthetic mouse events
*
* This variable can be set to the following values:
* "0" - Only front touchpad should generate mouse events. Default
* "1" - Only back touchpad should generate mouse events.
* "2" - Both touchpads should generate mouse events.
*
* By default SDL will generate mouse events for all touch devices
*/
#define SDL_HINT_VITA_TOUCH_MOUSE_DEVICE "SDL_HINT_VITA_TOUCH_MOUSE_DEVICE"
/**
* \brief A variable controlling whether the Android / tvOS remotes
* should be listed as joystick devices, instead of sending keyboard events.
@@ -1387,6 +1475,20 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR "SDL_VIDEO_WAYLAND_ALLOW_LIBDECOR"
/**
* \brief A variable controlling whether the libdecor Wayland backend is preferred over native decrations.
*
* When this hint is set, libdecor will be used to provide window decorations, even if xdg-decoration is
* available. (Note that, by default, libdecor will use xdg-decoration itself if available).
*
* This variable can be set to the following values:
* "0" - libdecor is enabled only if server-side decorations are unavailable.
* "1" - libdecor is always enabled if available.
*
* libdecor is used over xdg-shell when xdg-decoration protocol is unavailable.
*/
#define SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR "SDL_VIDEO_WAYLAND_PREFER_LIBDECOR"
/**
* \brief A variable that is the address of another SDL_Window* (as a hex string formatted with "%p").
*
@@ -1406,6 +1508,28 @@ extern "C" {
*/
#define SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT "SDL_VIDEO_WINDOW_SHARE_PIXEL_FORMAT"
/**
* \brief When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL.
*
* This variable can be set to the following values:
* "0" - Don't add any graphics flags to the SDL_WindowFlags
* "1" - Add SDL_WINDOW_OPENGL to the SDL_WindowFlags
*
* By default SDL will not make the foreign window compatible with OpenGL.
*/
#define SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL "SDL_VIDEO_FOREIGN_WINDOW_OPENGL"
/**
* \brief When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan.
*
* This variable can be set to the following values:
* "0" - Don't add any graphics flags to the SDL_WindowFlags
* "1" - Add SDL_WINDOW_VULKAN to the SDL_WindowFlags
*
* By default SDL will not make the foreign window compatible with Vulkan.
*/
#define SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN "SDL_VIDEO_FOREIGN_WINDOW_VULKAN"
/**
* \brief A variable specifying which shader compiler to preload when using the Chrome ANGLE binaries
*
@@ -1824,6 +1948,97 @@ extern "C" {
*/
#define SDL_HINT_AUDIO_INCLUDE_MONITORS "SDL_AUDIO_INCLUDE_MONITORS"
/**
* \brief A variable that forces X11 windows to create as a custom type.
*
* This is currently only used for X11 and ignored elsewhere.
*
* During SDL_CreateWindow, SDL uses the _NET_WM_WINDOW_TYPE X11 property
* to report to the window manager the type of window it wants to create.
* This might be set to various things if SDL_WINDOW_TOOLTIP or
* SDL_WINDOW_POPUP_MENU, etc, were specified. For "normal" windows that
* haven't set a specific type, this hint can be used to specify a custom
* type. For example, a dock window might set this to
* "_NET_WM_WINDOW_TYPE_DOCK".
*
* If not set or set to "", this hint is ignored. This hint must be set
* before the SDL_CreateWindow() call that it is intended to affect.
*
* This hint is available since SDL 2.0.22.
*/
#define SDL_HINT_X11_WINDOW_TYPE "SDL_X11_WINDOW_TYPE"
/**
* \brief A variable that decides whether to send SDL_QUIT when closing the final window.
*
* By default, SDL sends an SDL_QUIT event when there is only one window
* and it receives an SDL_WINDOWEVENT_CLOSE event, under the assumption most
* apps would also take the loss of this window as a signal to terminate the
* program.
*
* However, it's not unreasonable in some cases to have the program continue
* to live on, perhaps to create new windows later.
*
* Changing this hint to "0" will cause SDL to not send an SDL_QUIT event
* when the final window is requesting to close. Note that in this case,
* there are still other legitimate reasons one might get an SDL_QUIT
* event: choosing "Quit" from the macOS menu bar, sending a SIGINT (ctrl-c)
* on Unix, etc.
*
* The default value is "1". This hint can be changed at any time.
*
* This hint is available since SDL 2.0.22. Before then, you always get
* an SDL_QUIT event when closing the final window.
*/
#define SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE "SDL_QUIT_ON_LAST_WINDOW_CLOSE"
/**
* \brief A variable that decides what video backend to use.
*
* By default, SDL will try all available video backends in a reasonable
* order until it finds one that can work, but this hint allows the app
* or user to force a specific target, such as "x11" if, say, you are
* on Wayland but want to try talking to the X server instead.
*
* This functionality has existed since SDL 2.0.0 (indeed, before that)
* but before 2.0.22 this was an environment variable only. In 2.0.22,
* it was upgraded to a full SDL hint, so you can set the environment
* variable as usual or programatically set the hint with SDL_SetHint,
* which won't propagate to child processes.
*
* The default value is unset, in which case SDL will try to figure out
* the best video backend on your behalf. This hint needs to be set
* before SDL_Init() is called to be useful.
*
* This hint is available since SDL 2.0.22. Before then, you could set
* the environment variable to get the same effect.
*/
#define SDL_HINT_VIDEODRIVER "SDL_VIDEODRIVER"
/**
* \brief A variable that decides what audio backend to use.
*
* By default, SDL will try all available audio backends in a reasonable
* order until it finds one that can work, but this hint allows the app
* or user to force a specific target, such as "alsa" if, say, you are
* on PulseAudio but want to try talking to the lower level instead.
*
* This functionality has existed since SDL 2.0.0 (indeed, before that)
* but before 2.0.22 this was an environment variable only. In 2.0.22,
* it was upgraded to a full SDL hint, so you can set the environment
* variable as usual or programatically set the hint with SDL_SetHint,
* which won't propagate to child processes.
*
* The default value is unset, in which case SDL will try to figure out
* the best audio backend on your behalf. This hint needs to be set
* before SDL_Init() is called to be useful.
*
* This hint is available since SDL 2.0.22. Before then, you could set
* the environment variable to get the same effect.
*/
#define SDL_HINT_AUDIODRIVER "SDL_AUDIODRIVER"
/**
* \brief An enumeration of hint priorities

View File

@@ -829,9 +829,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
* Each call to this function cancels any previous trigger rumble effect, and
* calling it with 0 intensity stops any rumbling.
*
* Note that this function is for _trigger_ rumble; the first joystick to
* support this was the PlayStation 5's DualShock 5 controller. If you want
* the (more common) whole-controller rumble, use SDL_JoystickRumble()
* Note that this is rumbling of the _triggers_ and not the game controller as
* a whole. This is currently only supported on Xbox One controllers. If you
* want the (more common) whole-controller rumble, use SDL_JoystickRumble()
* instead.
*
* \param joystick The joystick to vibrate

View File

@@ -268,9 +268,30 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputActive(void);
*/
extern DECLSPEC void SDLCALL SDL_StopTextInput(void);
/**
* Dismiss the composition window/IME without disabling the subsystem.
*
* \since This function is available since SDL 2.0.22.
*
* \sa SDL_StartTextInput
* \sa SDL_StopTextInput
*/
extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
/**
* Returns if an IME Composite or Candidate window is currently shown.
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
/**
* Set the rectangle used to type Unicode text inputs.
*
* Note: If you want use system native IME window, try to set hint
* **SDL_HINT_IME_SHOW_UI** to **1**, otherwise this function won't give you
* any feedback.
*
* \param rect the SDL_Rect structure representing the rectangle to receive
* text (ignored if NULL)
*

View File

@@ -92,6 +92,7 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
*
* \param window SDL_Window from which the drawable size should be queried
* \param w Pointer to variable for storing the width in pixels, may be NULL
* \param h Pointer to variable for storing the height in pixels, may be NULL
*
* \since This function is available since SDL 2.0.14.
*

View File

@@ -54,8 +54,8 @@ typedef struct SDL_Point
/**
* The structure that defines a point (floating point)
*
* \sa SDL_EnclosePoints
* \sa SDL_PointInRect
* \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect
*/
typedef struct SDL_FPoint
{
@@ -71,6 +71,7 @@ typedef struct SDL_FPoint
* \sa SDL_RectEquals
* \sa SDL_HasIntersection
* \sa SDL_IntersectRect
* \sa SDL_IntersectRectAndLine
* \sa SDL_UnionRect
* \sa SDL_EnclosePoints
*/
@@ -83,6 +84,16 @@ typedef struct SDL_Rect
/**
* A rectangle, with the origin at the upper left (floating point).
*
* \sa SDL_FRectEmpty
* \sa SDL_FRectEquals
* \sa SDL_FRectEqualsEpsilon
* \sa SDL_HasIntersectionF
* \sa SDL_IntersectFRect
* \sa SDL_IntersectFRectAndLine
* \sa SDL_UnionFRect
* \sa SDL_EncloseFPoints
* \sa SDL_PointInFRect
*/
typedef struct SDL_FRect
{
@@ -213,6 +224,147 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect *
int *Y1, int *X2,
int *Y2);
/* SDL_FRect versions... */
/**
* Returns true if point resides inside a rectangle.
*/
SDL_FORCE_INLINE SDL_bool SDL_PointInFRect(const SDL_FPoint *p, const SDL_FRect *r)
{
return ( (p->x >= r->x) && (p->x < (r->x + r->w)) &&
(p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE;
}
/**
* Returns true if the rectangle has no area.
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
{
return ((!r) || (r->w <= 0.0f) || (r->h <= 0.0f)) ? SDL_TRUE : SDL_FALSE;
}
/**
* Returns true if the two rectangles are equal, within some given epsilon.
*
* \since This function is available since SDL 2.0.22.
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{
return (a && b && ((a == b) ||
((SDL_fabs(a->x - b->x) <= epsilon) &&
(SDL_fabs(a->y - b->y) <= epsilon) &&
(SDL_fabs(a->w - b->w) <= epsilon) &&
(SDL_fabs(a->h - b->h) <= epsilon))))
? SDL_TRUE : SDL_FALSE;
}
/**
* Returns true if the two rectangles are equal, using a default epsilon.
*
* \since This function is available since SDL 2.0.22.
*/
SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b)
{
return SDL_FRectEqualsEpsilon(a, b, SDL_FLT_EPSILON);
}
/**
* Determine whether two rectangles intersect with float precision.
*
* If either pointer is NULL the function will return SDL_FALSE.
*
* \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.22.
*
* \sa SDL_IntersectRect
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A,
const SDL_FRect * B);
/**
* Calculate the intersection of two rectangles with float precision.
*
* If `result` is NULL then this function will return SDL_FALSE.
*
* \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle
* \param result an SDL_FRect structure filled in with the intersection of
* rectangles `A` and `B`
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.22.
*
* \sa SDL_HasIntersectionF
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
/**
* Calculate the union of two rectangles with float precision.
*
* \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle
* \param result an SDL_FRect structure filled in with the union of rectangles
* `A` and `B`
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A,
const SDL_FRect * B,
SDL_FRect * result);
/**
* Calculate a minimal rectangle enclosing a set of points with float
* precision.
*
* If `clip` is not NULL then only points inside of the clipping rectangle are
* considered.
*
* \param points an array of SDL_FPoint structures representing points to be
* enclosed
* \param count the number of structures in the `points` array
* \param clip an SDL_FRect used for clipping or NULL to enclose all points
* \param result an SDL_FRect structure filled in with the minimal enclosing
* rectangle
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
* points were outside of the clipping rectangle.
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points,
int count,
const SDL_FRect * clip,
SDL_FRect * result);
/**
* Calculate the intersection of a rectangle and line segment with float
* precision.
*
* This function is used to clip a line segment to a rectangle. A line segment
* contained entirely within the rectangle or that does not intersect will
* remain unchanged. A line segment that crosses the rectangle at either or
* both ends will be clipped to the boundary of the rectangle and the new
* coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
*
* \param rect an SDL_FRect structure representing the rectangle to intersect
* \param X1 a pointer to the starting X-coordinate of the line
* \param Y1 a pointer to the starting Y-coordinate of the line
* \param X2 a pointer to the ending X-coordinate of the line
* \param Y2 a pointer to the ending Y-coordinate of the line
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRectAndLine(const SDL_FRect *
rect, float *X1,
float *Y1, float *X2,
float *Y2);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@@ -261,6 +261,17 @@ extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *
*/
extern DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window * window);
/**
* Get the window associated with a renderer.
*
* \param renderer the renderer to query
* \returns the window on success or NULL on failure; call SDL_GetError() for
* more information.
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC SDL_Window * SDLCALL SDL_RenderGetWindow(SDL_Renderer *renderer);
/**
* Get information about a rendering context.
*
@@ -356,11 +367,15 @@ extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer
* \param texture the texture to query
* \param format a pointer filled in with the raw format of the texture; the
* actual format may differ, but pixel transfers will use this
* format (one of the SDL_PixelFormatEnum values)
* format (one of the SDL_PixelFormatEnum values). This argument
* can be NULL if you don't need this information.
* \param access a pointer filled in with the actual access to the texture
* (one of the SDL_TextureAccess values)
* \param w a pointer filled in with the width of the texture in pixels
* \param h a pointer filled in with the height of the texture in pixels
* (one of the SDL_TextureAccess values). This argument can be
* NULL if you don't need this information.
* \param w a pointer filled in with the width of the texture in pixels. This
* argument can be NULL if you don't need this information.
* \param h a pointer filled in with the height of the texture in pixels. This
* argument can be NULL if you don't need this information.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
@@ -1603,6 +1618,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopyExF(SDL_Renderer * renderer,
* vertex array Color and alpha modulation is done per vertex
* (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
*
* \param renderer The rendering context.
* \param texture (optional) The SDL texture to use.
* \param vertices Vertices.
* \param num_vertices Number of vertices.
@@ -1627,6 +1643,7 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
* vertex arrays Color and alpha modulation is done per vertex
* (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
*
* \param renderer The rendering context.
* \param texture (optional) The SDL texture to use.
* \param xy Vertex positions
* \param xy_stride Byte size to move from one element to the next element
@@ -1658,7 +1675,8 @@ extern DECLSPEC int SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
* Read pixels from the current rendering target to an array of pixels.
*
* **WARNING**: This is a very slow operation, and should not be used
* frequently.
* frequently. If you're using this on the main rendering target, it should be
* called after rendering and before SDL_RenderPresent().
*
* `pitch` specifies the number of bytes between rows in the destination
* `pixels` data. This allows you to write to a subrectangle or have padded

View File

@@ -234,6 +234,19 @@ typedef uint64_t Uint64;
/* @} *//* Basic data types */
/**
* \name Floating-point constants
*/
/* @{ */
#ifdef FLT_EPSILON
#define SDL_FLT_EPSILON FLT_EPSILON
#else
#define SDL_FLT_EPSILON 1.1920928955078125e-07F /* 0x0.000002p0 */
#endif
/* @} *//* Floating-point constants */
/* Make sure we have macros for printing width-based integers.
* <stdint.h> should define these but this is not true all platforms.
* (for example win32) */
@@ -354,8 +367,14 @@ typedef uint64_t Uint64;
#endif
#endif /* SDL_DISABLE_ANALYZE_MACROS */
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#else /* universal, but may trigger -Wunused-local-typedefs */
#define SDL_COMPILE_TIME_ASSERT(name, x) \
typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1]
#endif
/** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);

View File

@@ -425,6 +425,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
*/
extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
/**
* Send a user command to SDLActivity.
*
* Override "boolean onUnhandledMessage(Message msg)" to handle the message.
*
* \param command user command that must be greater or equal to 0x8000
* \param param user parameter
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
#endif /* __ANDROID__ */
/* Platform specific functions for WinRT */

View File

@@ -298,6 +298,8 @@ struct SDL_SysWMinfo
struct wl_egl_window *egl_window; /**< Wayland EGL window (native window) */
struct xdg_surface *xdg_surface; /**< Wayland xdg surface (window manager handle) */
struct xdg_toplevel *xdg_toplevel; /**< Wayland xdg toplevel role */
struct xdg_popup *xdg_popup; /**< Wayland xdg popup role */
struct xdg_positioner *xdg_positioner; /**< Wayland xdg positioner, for popup */
} wl;
#endif
#if defined(SDL_VIDEO_DRIVER_MIR) /* no longer available, left for API/ABI compatibility. Remove in 2.1! */

View File

@@ -95,6 +95,14 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
*/
extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
/**
* Get the touch device name as reported from the driver or NULL if the index
* is invalid.
*
* \since This function is available since SDL 2.0.22.
*/
extern DECLSPEC const char* SDLCALL SDL_GetTouchName(int index);
/**
* Get the type of the given touch device.
*

View File

@@ -59,7 +59,7 @@ typedef struct SDL_version
*/
#define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 0
#define SDL_PATCHLEVEL 20
#define SDL_PATCHLEVEL 22
/**
* Macro to determine SDL version program was compiled against.

View File

@@ -1337,6 +1337,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window * window,
* Mouse grab confines the mouse cursor to the window.
*
* \param window The window for which the mouse grab mode should be set.
* \param grabbed This is SDL_TRUE to grab mouse, and SDL_FALSE to release.
*
* \since This function is available since SDL 2.0.16.
*

View File

@@ -107,7 +107,7 @@
#ifdef __BORLANDC__
#pragma nopackwarning
#endif
#ifdef _M_X64
#ifdef _WIN64
/* Use 8-byte alignment on 64-bit architectures, so pointers are aligned */
#pragma pack(push,8)
#else

View File

@@ -153,8 +153,7 @@ SDL_InitSubSystem(Uint32 flags)
Uint32 flags_initialized = 0;
if (!SDL_MainIsReady) {
SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
return -1;
return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?");
}
/* Clear the error message */
@@ -208,7 +207,7 @@ SDL_InitSubSystem(Uint32 flags)
/* Initialize the timer subsystem */
if ((flags & SDL_INIT_TIMER)){
#if !SDL_TIMERS_DISABLED
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) {
if (SDL_TimerInit() < 0) {
goto quit_and_error;
@@ -317,6 +316,8 @@ SDL_InitSubSystem(Uint32 flags)
#endif
}
(void) flags_initialized; /* make static analysis happy, since this only gets used in error cases. */
return (0);
quit_and_error:
@@ -402,7 +403,7 @@ SDL_QuitSubSystem(Uint32 flags)
}
#endif
#if !SDL_TIMERS_DISABLED
#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY
if ((flags & SDL_INIT_TIMER)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) {
SDL_TimerQuit();

View File

@@ -178,6 +178,11 @@ SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
return;
}
hint->name = SDL_strdup(name);
if (!hint->name) {
SDL_free(hint);
SDL_OutOfMemory();
return;
}
hint->value = NULL;
hint->priority = SDL_HINT_DEFAULT;
hint->callbacks = NULL;

93
src/SDL_list.c Normal file
View File

@@ -0,0 +1,93 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "./SDL_internal.h"
#include "SDL.h"
#include "./SDL_list.h"
/* Push */
int
SDL_ListAdd(SDL_ListNode **head, void *ent)
{
SDL_ListNode *node = SDL_malloc(sizeof (*node));
if (node == NULL) {
return SDL_OutOfMemory();
}
node->entry = ent;
node->next = *head;
*head = node;
return 0;
}
/* Pop from end as a FIFO (if add with SDL_ListAdd) */
void
SDL_ListPop(SDL_ListNode **head, void **ent)
{
SDL_ListNode **ptr = head;
/* Invalid or empty */
if (head == NULL || *head == NULL) {
return;
}
while ((*ptr)->next) {
ptr = &(*ptr)->next;
}
if (ent) {
*ent = (*ptr)->entry;
}
SDL_free(*ptr);
*ptr = NULL;
}
void
SDL_ListRemove(SDL_ListNode **head, void *ent)
{
SDL_ListNode **ptr = head;
while (*ptr) {
if ((*ptr)->entry == ent) {
SDL_ListNode *tmp = *ptr;
*ptr = (*ptr)->next;
SDL_free(tmp);
return;
}
ptr = &(*ptr)->next;
}
}
void
SDL_ListClear(SDL_ListNode **head)
{
SDL_ListNode *l = *head;
*head = NULL;
while (l) {
SDL_ListNode *tmp = l;
l = l->next;
SDL_free(tmp);
}
}
/* vi: set ts=4 sw=4 expandtab: */

39
src/SDL_list.h Normal file
View File

@@ -0,0 +1,39 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_list_h_
#define SDL_list_h_
typedef struct SDL_ListNode
{
void *entry;
struct SDL_ListNode *next;
} SDL_ListNode;
int SDL_ListAdd(SDL_ListNode **head, void *ent);
void SDL_ListPop(SDL_ListNode **head, void **ent);
void SDL_ListRemove(SDL_ListNode **head, void *ent);
void SDL_ListClear(SDL_ListNode **head);
#endif /* SDL_list_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -245,11 +245,6 @@ SDL_AudioThreadDeinit_Default(_THIS)
{ /* no-op. */
}
static void
SDL_AudioBeginLoopIteration_Default(_THIS)
{ /* no-op. */
}
static void
SDL_AudioWaitDevice_Default(_THIS)
{ /* no-op. */
@@ -277,11 +272,6 @@ SDL_AudioFlushCapture_Default(_THIS)
{ /* no-op. */
}
static void
SDL_AudioPrepareToClose_Default(_THIS)
{ /* no-op. */
}
static void
SDL_AudioCloseDevice_Default(_THIS)
{ /* no-op. */
@@ -299,7 +289,7 @@ SDL_AudioFreeDeviceHandle_Default(void *handle)
static int
SDL_AudioOpenDevice_Default(_THIS, void *handle, const char *devname, int iscapture)
SDL_AudioOpenDevice_Default(_THIS, const char *devname)
{
return SDL_Unsupported();
}
@@ -334,11 +324,6 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
}
}
static void
SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
{
}
static void
finish_audio_entry_points_init(void)
{
@@ -347,14 +332,6 @@ finish_audio_entry_points_init(void)
* blindly call them without having to check for validity first.
*/
if (current_audio.impl.SkipMixerLock) {
if (current_audio.impl.LockDevice == NULL) {
current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
}
if (current_audio.impl.UnlockDevice == NULL) {
current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
}
}
#define FILL_STUB(x) \
if (current_audio.impl.x == NULL) { \
@@ -364,13 +341,11 @@ finish_audio_entry_points_init(void)
FILL_STUB(OpenDevice);
FILL_STUB(ThreadInit);
FILL_STUB(ThreadDeinit);
FILL_STUB(BeginLoopIteration);
FILL_STUB(WaitDevice);
FILL_STUB(PlayDevice);
FILL_STUB(GetDeviceBuf);
FILL_STUB(CaptureFromDevice);
FILL_STUB(FlushCapture);
FILL_STUB(PrepareToClose);
FILL_STUB(CloseDevice);
FILL_STUB(LockDevice);
FILL_STUB(UnlockDevice);
@@ -429,8 +404,7 @@ add_audio_device(const char *name, SDL_AudioSpec *spec, void *handle, SDL_AudioD
SDL_UnlockMutex(current_audio.detectionLock);
SDL_free(item->original_name);
SDL_free(item);
SDL_OutOfMemory();
return -1;
return SDL_OutOfMemory();
}
SDL_snprintf(replacement, len, "%s (%d)", name, dupenum + 1);
@@ -483,7 +457,7 @@ free_device_list(SDL_AudioDeviceItem **devices, int *devCount)
/* The audio backends call this when a new device is plugged in. */
void
SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle)
SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle)
{
const int device_index = iscapture ? add_capture_device(name, spec, handle) : add_output_device(name, spec, handle);
if (device_index != -1) {
@@ -545,7 +519,7 @@ mark_device_removed(void *handle, SDL_AudioDeviceItem *devices, SDL_bool *remove
/* The audio backends call this when a device is removed from the system. */
void
SDL_RemoveAudioDevice(const int iscapture, void *handle)
SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle)
{
int device_index;
SDL_AudioDevice *device = NULL;
@@ -723,7 +697,6 @@ SDL_RunAudio(void *devicep)
/* Loop, filling the audio buffers */
while (!SDL_AtomicGet(&device->shutdown)) {
current_audio.impl.BeginLoopIteration(device);
data_len = device->callbackspec.size;
/* Fill the current buffer with sound */
@@ -786,8 +759,6 @@ SDL_RunAudio(void *devicep)
}
}
current_audio.impl.PrepareToClose(device);
/* Wait for the audio to drain. */
SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2);
@@ -831,8 +802,6 @@ SDL_CaptureAudio(void *devicep)
int still_need;
Uint8 *ptr;
current_audio.impl.BeginLoopIteration(device);
if (SDL_AtomicGet(&device->paused)) {
SDL_Delay(delay); /* just so we don't cook the CPU. */
if (device->stream) {
@@ -956,20 +925,18 @@ SDL_GetAudioDriver(int index)
int
SDL_AudioInit(const char *driver_name)
{
int i = 0;
int initialized = 0;
int tried_to_init = 0;
int i;
SDL_bool initialized = SDL_FALSE, tried_to_init = SDL_FALSE;
if (SDL_GetCurrentAudioDriver()) {
SDL_AudioQuit(); /* shutdown driver if already running. */
}
SDL_zero(current_audio);
SDL_zeroa(open_devices);
/* Select the proper audio driver */
if (driver_name == NULL) {
driver_name = SDL_getenv("SDL_AUDIODRIVER");
driver_name = SDL_GetHint(SDL_HINT_AUDIODRIVER);
}
if (driver_name != NULL && *driver_name != 0) {
@@ -990,7 +957,7 @@ SDL_AudioInit(const char *driver_name)
for (i = 0; bootstrap[i]; ++i) {
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
tried_to_init = 1;
tried_to_init = SDL_TRUE;
SDL_zero(current_audio);
current_audio.name = bootstrap[i]->name;
current_audio.desc = bootstrap[i]->desc;
@@ -1007,7 +974,7 @@ SDL_AudioInit(const char *driver_name)
continue;
}
tried_to_init = 1;
tried_to_init = SDL_TRUE;
SDL_zero(current_audio);
current_audio.name = bootstrap[i]->name;
current_audio.desc = bootstrap[i]->desc;
@@ -1114,38 +1081,29 @@ SDL_GetNumAudioDevices(int iscapture)
const char *
SDL_GetAudioDeviceName(int index, int iscapture)
{
const char *retval = NULL;
SDL_AudioDeviceItem *item;
int i;
const char *retval;
if (!SDL_GetCurrentAudioDriver()) {
SDL_SetError("Audio subsystem is not initialized");
return NULL;
}
if (iscapture && !current_audio.impl.HasCaptureSupport) {
SDL_SetError("No capture support");
return NULL;
}
if (index >= 0) {
SDL_AudioDeviceItem *item;
int i;
SDL_LockMutex(current_audio.detectionLock);
item = iscapture ? current_audio.inputDevices : current_audio.outputDevices;
i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
if (index < i) {
for (i--; i > index; i--, item = item->next) {
SDL_assert(item != NULL);
}
SDL_LockMutex(current_audio.detectionLock);
item = iscapture ? current_audio.inputDevices : current_audio.outputDevices;
i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
if (index >= 0 && index < i) {
for (i--; i > index; i--, item = item->next) {
SDL_assert(item != NULL);
retval = item->name;
}
SDL_UnlockMutex(current_audio.detectionLock);
}
if (retval == NULL) {
SDL_SetError("No such device");
SDL_assert(item != NULL);
retval = item->name;
} else {
SDL_InvalidParamError("index");
retval = NULL;
}
SDL_UnlockMutex(current_audio.detectionLock);
return retval;
}
@@ -1154,38 +1112,33 @@ SDL_GetAudioDeviceName(int index, int iscapture)
int
SDL_GetAudioDeviceSpec(int index, int iscapture, SDL_AudioSpec *spec)
{
SDL_AudioDeviceItem *item;
int i, retval;
if (spec == NULL) {
return SDL_InvalidParamError("spec");
}
SDL_zerop(spec);
if (!SDL_GetCurrentAudioDriver()) {
return SDL_SetError("Audio subsystem is not initialized");
}
if (iscapture && !current_audio.impl.HasCaptureSupport) {
return SDL_SetError("No capture support");
}
if (index >= 0) {
SDL_AudioDeviceItem *item;
int i;
SDL_LockMutex(current_audio.detectionLock);
item = iscapture ? current_audio.inputDevices : current_audio.outputDevices;
i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
if (index < i) {
for (i--; i > index; i--, item = item->next) {
SDL_assert(item != NULL);
}
SDL_LockMutex(current_audio.detectionLock);
item = iscapture ? current_audio.inputDevices : current_audio.outputDevices;
i = iscapture ? current_audio.inputDeviceCount : current_audio.outputDeviceCount;
if (index >= 0 && index < i) {
for (i--; i > index; i--, item = item->next) {
SDL_assert(item != NULL);
SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec));
}
SDL_UnlockMutex(current_audio.detectionLock);
SDL_assert(item != NULL);
SDL_memcpy(spec, &item->spec, sizeof(SDL_AudioSpec));
retval = 0;
} else {
retval = SDL_InvalidParamError("index");
}
SDL_UnlockMutex(current_audio.detectionLock);
return 0;
return retval;
}
@@ -1421,7 +1374,7 @@ open_audio_device(const char *devname, int iscapture,
SDL_AtomicSet(&device->enabled, 1);
/* Create a mutex for locking the sound buffers */
if (!current_audio.impl.SkipMixerLock) {
if (current_audio.impl.LockDevice == SDL_AudioLockDevice_Default) {
device->mixer_lock = SDL_CreateMutex();
if (device->mixer_lock == NULL) {
close_audio_device(device);
@@ -1430,7 +1383,7 @@ open_audio_device(const char *devname, int iscapture,
}
}
if (current_audio.impl.OpenDevice(device, handle, devname, iscapture) < 0) {
if (current_audio.impl.OpenDevice(device, devname) < 0) {
close_audio_device(device);
return 0;
}
@@ -1555,8 +1508,7 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained)
/* SDL_OpenAudio() is legacy and can only act on Device ID #1. */
if (open_devices[0] != NULL) {
SDL_SetError("Audio device is already opened");
return -1;
return SDL_SetError("Audio device is already opened");
}
if (obtained) {

View File

@@ -80,7 +80,7 @@ SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format)
Just use unaligned load/stores, if the memory at runtime is
aligned it'll be just as fast on modern processors */
while (i >= 4) { /* 4 * float32 */
_mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_loadu_ps(src+4)), divby2));
_mm_storeu_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_loadu_ps(src), _mm_loadu_ps(src+4)), divby2));
i -= 4; src += 8; dst += 4;
}
@@ -369,11 +369,11 @@ SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
const float surround_left_distributed = src[6] * 0.5f;
const float surround_right_distributed = src[7] * 0.5f;
dst[0] = (src[0] + surround_left_distributed) * two_thirds; /* FL */
dst[1] = (src[1] + surround_right_distributed) * two_thirds; /* FR */
dst[1] = (src[1] + surround_right_distributed) * two_thirds; /* FR */
dst[2] = src[2] * two_thirds; /* CC */
dst[3] = src[3] * two_thirds; /* LFE */
dst[4] = (src[4] + surround_left_distributed) * two_thirds; /* BL */
dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */
dst[5] = (src[5] + surround_right_distributed) * two_thirds; /* BR */
}
cvt->len_cvt /= 8;
@@ -398,12 +398,12 @@ SDL_Convert71To61(SDL_AudioCVT * cvt, SDL_AudioFormat format)
for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 7) {
dst[0] = src[3]; /* LFE */
dst[1] = src[2]; /* FC */
dst[1] = src[2]; /* FC */
dst[2] = src[1]; /* FR */
dst[3] = src[7]; /* SR */
dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */
dst[5] = src[6]; /* SL */
dst[6] = src[0]; /* FL */
dst[6] = src[0]; /* FL */
}
cvt->len_cvt /= 8;
@@ -428,13 +428,13 @@ SDL_Convert61To71(SDL_AudioCVT * cvt, SDL_AudioFormat format)
for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 8) {
dst[0] = src[6]; /* FL */
dst[1] = src[2]; /* FR */
dst[1] = src[2]; /* FR */
dst[2] = src[1]; /* FC */
dst[3] = src[0]; /* LFE */
dst[4] = src[4]; /* BL */
dst[5] = src[4]; /* BR */
dst[6] = src[5]; /* SL */
dst[7] = src[3]; /* SR */
dst[6] = src[5]; /* SL */
dst[7] = src[3]; /* SR */
}
cvt->len_cvt /= 7;
@@ -459,12 +459,12 @@ SDL_Convert51To61(SDL_AudioCVT * cvt, SDL_AudioFormat format)
for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 7) {
dst[0] = src[3]; /* LFE */
dst[1] = src[2]; /* FC */
dst[1] = src[2]; /* FC */
dst[2] = src[1]; /* FR */
dst[3] = src[5]; /* SR */
dst[4] = (src[4] + src[5]) / 0.2f; /* BackSurround */
dst[5] = src[4]; /* SL */
dst[6] = src[0]; /* FL */
dst[6] = src[0]; /* FL */
}
cvt->len_cvt /= 6;
@@ -489,7 +489,7 @@ SDL_Convert61To51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
for (i = cvt->len_cvt / (sizeof (float) * 7); i; --i, src += 7, dst += 6) {
dst[0] = src[6]; /* FL */
dst[1] = src[2]; /* FR */
dst[1] = src[2]; /* FR */
dst[2] = src[1]; /* FC */
dst[3] = src[0]; /* LFE */
dst[4] = src[5]; /* BL */
@@ -614,7 +614,7 @@ SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format)
ce = (lf + rf) * 0.5f;
/* Constant 0.571f is approx 4/7 not to saturate */
dst[0] = 0.571f * (lf + (lf - 0.5f * ce)); /* FL */
dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */
dst[1] = 0.571f * (rf + (rf - 0.5f * ce)); /* FR */
dst[2] = ce; /* FC */
dst[3] = 0; /* LFE (only meant for special LFE effects) */
dst[4] = lb; /* BL */
@@ -801,7 +801,8 @@ ResamplerPadding(const int inrate, const int outrate)
{
if (inrate == outrate) {
return 0;
} else if (inrate > outrate) {
}
if (inrate > outrate) {
return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate)));
}
return RESAMPLER_SAMPLES_PER_ZERO_CROSSING;
@@ -930,9 +931,7 @@ SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter)
if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) {
return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS);
}
if (filter == NULL) {
return SDL_SetError("Audio filter pointer is NULL");
}
SDL_assert(filter != NULL);
cvt->filters[cvt->filter_index++] = filter;
cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */
return 0;
@@ -943,7 +942,7 @@ SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt)
{
int retval = 0; /* 0 == no conversion necessary. */
if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(src_fmt) > 8) {
if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
return -1;
}
@@ -1020,7 +1019,7 @@ SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt)
retval = 1; /* added a converter. */
}
if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) {
if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN) && SDL_AUDIO_BITSIZE(dst_fmt) > 8) {
if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
return -1;
}
@@ -1217,19 +1216,26 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
if (!SDL_SupportedAudioFormat(src_fmt)) {
return SDL_SetError("Invalid source format");
} else if (!SDL_SupportedAudioFormat(dst_fmt)) {
}
if (!SDL_SupportedAudioFormat(dst_fmt)) {
return SDL_SetError("Invalid destination format");
} else if (!SDL_SupportedChannelCount(src_channels)) {
}
if (!SDL_SupportedChannelCount(src_channels)) {
return SDL_SetError("Invalid source channels");
} else if (!SDL_SupportedChannelCount(dst_channels)) {
}
if (!SDL_SupportedChannelCount(dst_channels)) {
return SDL_SetError("Invalid destination channels");
} else if (src_rate <= 0) {
}
if (src_rate <= 0) {
return SDL_SetError("Source rate is equal to or less than zero");
} else if (dst_rate <= 0) {
}
if (dst_rate <= 0) {
return SDL_SetError("Destination rate is equal to or less than zero");
} else if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) {
}
if (src_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) {
return SDL_SetError("Source rate is too high");
} else if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) {
}
if (dst_rate >= SDL_MAX_SINT32 / RESAMPLER_SAMPLES_PER_ZERO_CROSSING) {
return SDL_SetError("Destination rate is too high");
}
@@ -1273,6 +1279,9 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt,
/* just a byteswap needed? */
if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) {
if (SDL_AUDIO_BITSIZE(dst_fmt) == 8) {
return 0;
}
if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) {
return -1;
}
@@ -1666,6 +1675,7 @@ SDL_NewAudioStream(const SDL_AudioFormat src_format,
retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream));
if (!retval) {
SDL_OutOfMemory();
return NULL;
}
@@ -1907,11 +1917,14 @@ SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len)
if (!stream) {
return SDL_InvalidParamError("stream");
} else if (!buf) {
}
if (!buf) {
return SDL_InvalidParamError("buf");
} else if (len == 0) {
}
if (len == 0) {
return 0; /* nothing to do. */
} else if ((len % stream->src_sample_frame_size) != 0) {
}
if ((len % stream->src_sample_frame_size) != 0) {
return SDL_SetError("Can't add partial sample frames");
}
@@ -2017,11 +2030,14 @@ SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len)
if (!stream) {
return SDL_InvalidParamError("stream");
} else if (!buf) {
}
if (!buf) {
return SDL_InvalidParamError("buf");
} else if (len <= 0) {
}
if (len <= 0) {
return 0; /* nothing to do. */
} else if ((len % stream->dst_sample_frame_size) != 0) {
}
if ((len % stream->dst_sample_frame_size) != 0) {
return SDL_SetError("Can't request partial sample frames");
}
@@ -2067,4 +2083,3 @@ SDL_FreeAudioStream(SDL_AudioStream *stream)
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -29,7 +29,6 @@
/* This table is used to add two sound values together and pin
* the value to avoid overflow. (used with permission from ARDI)
* Changed to use 0xFE instead of 0xFF for better sound quality.
*/
static const Uint8 mix8[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -66,24 +65,25 @@ static const Uint8 mix8[] = {
0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5,
0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE,
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE
0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
/* The volume ranges from 0 - 128 */
#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME)
#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128)
#define ADJUST_VOLUME_U16(s, v) (s = (((s-32768)*v)/SDL_MIX_MAXVOLUME)+32768)
void
@@ -115,8 +115,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
Sint8 *dst8, *src8;
Sint8 src_sample;
int dst_sample;
const int max_audioval = ((1 << (8 - 1)) - 1);
const int min_audioval = -(1 << (8 - 1));
const int max_audioval = SDL_MAX_SINT8;
const int min_audioval = SDL_MIN_SINT8;
src8 = (Sint8 *) src;
dst8 = (Sint8 *) dst;
@@ -125,12 +125,11 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
ADJUST_VOLUME(src_sample, volume);
dst_sample = *dst8 + src_sample;
if (dst_sample > max_audioval) {
*dst8 = max_audioval;
dst_sample = max_audioval;
} else if (dst_sample < min_audioval) {
*dst8 = min_audioval;
} else {
*dst8 = dst_sample;
dst_sample = min_audioval;
}
*dst8 = dst_sample;
++dst8;
++src8;
}
@@ -141,14 +140,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
{
Sint16 src1, src2;
int dst_sample;
const int max_audioval = ((1 << (16 - 1)) - 1);
const int min_audioval = -(1 << (16 - 1));
const int max_audioval = SDL_MAX_SINT16;
const int min_audioval = SDL_MIN_SINT16;
len /= 2;
while (len--) {
src1 = ((src[1]) << 8 | src[0]);
src1 = SDL_SwapLE16(*(Sint16 *)src);
ADJUST_VOLUME(src1, volume);
src2 = ((dst[1]) << 8 | dst[0]);
src2 = SDL_SwapLE16(*(Sint16 *)dst);
src += 2;
dst_sample = src1 + src2;
if (dst_sample > max_audioval) {
@@ -156,9 +155,7 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
dst[0] = dst_sample & 0xFF;
dst_sample >>= 8;
dst[1] = dst_sample & 0xFF;
*(Sint16 *)dst = SDL_SwapLE16(dst_sample);
dst += 2;
}
}
@@ -168,14 +165,14 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
{
Sint16 src1, src2;
int dst_sample;
const int max_audioval = ((1 << (16 - 1)) - 1);
const int min_audioval = -(1 << (16 - 1));
const int max_audioval = SDL_MAX_SINT16;
const int min_audioval = SDL_MIN_SINT16;
len /= 2;
while (len--) {
src1 = ((src[0]) << 8 | src[1]);
src1 = SDL_SwapBE16(*(Sint16 *)src);
ADJUST_VOLUME(src1, volume);
src2 = ((dst[0]) << 8 | dst[1]);
src2 = SDL_SwapBE16(*(Sint16 *)dst);
src += 2;
dst_sample = src1 + src2;
if (dst_sample > max_audioval) {
@@ -183,9 +180,7 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
dst[1] = dst_sample & 0xFF;
dst_sample >>= 8;
dst[0] = dst_sample & 0xFF;
*(Sint16 *)dst = SDL_SwapBE16(dst_sample);
dst += 2;
}
}
@@ -195,21 +190,23 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
{
Uint16 src1, src2;
int dst_sample;
const int max_audioval = 0xFFFF;
const int max_audioval = SDL_MAX_SINT16;
const int min_audioval = SDL_MIN_SINT16;
len /= 2;
while (len--) {
src1 = ((src[1]) << 8 | src[0]);
ADJUST_VOLUME(src1, volume);
src2 = ((dst[1]) << 8 | dst[0]);
src1 = SDL_SwapLE16(*(Uint16 *)src);
ADJUST_VOLUME_U16(src1, volume);
src2 = SDL_SwapLE16(*(Uint16 *)dst);
src += 2;
dst_sample = src1 + src2;
dst_sample = src1 + src2 - 32768 * 2;
if (dst_sample > max_audioval) {
dst_sample = max_audioval;
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
dst[0] = dst_sample & 0xFF;
dst_sample >>= 8;
dst[1] = dst_sample & 0xFF;
dst_sample += 32768;
*(Uint16 *)dst = SDL_SwapLE16(dst_sample);
dst += 2;
}
}
@@ -219,21 +216,23 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
{
Uint16 src1, src2;
int dst_sample;
const int max_audioval = 0xFFFF;
const int max_audioval = SDL_MAX_SINT16;
const int min_audioval = SDL_MIN_SINT16;
len /= 2;
while (len--) {
src1 = ((src[0]) << 8 | src[1]);
ADJUST_VOLUME(src1, volume);
src2 = ((dst[0]) << 8 | dst[1]);
src1 = SDL_SwapBE16(*(Uint16 *)src);
ADJUST_VOLUME_U16(src1, volume);
src2 = SDL_SwapBE16(*(Uint16 *)dst);
src += 2;
dst_sample = src1 + src2;
dst_sample = src1 + src2 - 32768 * 2;
if (dst_sample > max_audioval) {
dst_sample = max_audioval;
} else if (dst_sample < min_audioval) {
dst_sample = min_audioval;
}
dst[1] = dst_sample & 0xFF;
dst_sample >>= 8;
dst[0] = dst_sample & 0xFF;
dst_sample += 32768;
*(Uint16 *)dst = SDL_SwapBE16(dst_sample);
dst += 2;
}
}
@@ -245,8 +244,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
Uint32 *dst32 = (Uint32 *) dst;
Sint64 src1, src2;
Sint64 dst_sample;
const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
const Sint64 max_audioval = SDL_MAX_SINT32;
const Sint64 min_audioval = SDL_MIN_SINT32;
len /= 4;
while (len--) {
@@ -271,8 +270,8 @@ SDL_MixAudioFormat(Uint8 * dst, const Uint8 * src, SDL_AudioFormat format,
Uint32 *dst32 = (Uint32 *) dst;
Sint64 src1, src2;
Sint64 dst_sample;
const Sint64 max_audioval = ((((Sint64) 1) << (32 - 1)) - 1);
const Sint64 min_audioval = -(((Sint64) 1) << (32 - 1));
const Sint64 max_audioval = SDL_MAX_SINT32;
const Sint64 min_audioval = SDL_MIN_SINT32;
len /= 4;
while (len--) {

View File

@@ -39,11 +39,11 @@ typedef struct SDL_AudioDevice SDL_AudioDevice;
/* Audio targets should call this as devices are added to the system (such as
a USB headset being plugged in), and should also be called for
for every device found during DetectDevices(). */
extern void SDL_AddAudioDevice(const int iscapture, const char *name, SDL_AudioSpec *spec, void *handle);
extern void SDL_AddAudioDevice(const SDL_bool iscapture, const char *name, SDL_AudioSpec *spec, void *handle);
/* Audio targets should call this as devices are removed, so SDL can update
its list of available devices. */
extern void SDL_RemoveAudioDevice(const int iscapture, void *handle);
extern void SDL_RemoveAudioDevice(const SDL_bool iscapture, void *handle);
/* Audio targets should call this if an opened audio device is lost while
being used. This can happen due to i/o errors, or a device being unplugged,
@@ -65,16 +65,14 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device);
typedef struct SDL_AudioDriverImpl
{
void (*DetectDevices) (void);
int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture);
int (*OpenDevice) (_THIS, const char *devname);
void (*ThreadInit) (_THIS); /* Called by audio thread at start */
void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */
void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */
void (*WaitDevice) (_THIS);
void (*PlayDevice) (_THIS);
Uint8 *(*GetDeviceBuf) (_THIS);
int (*CaptureFromDevice) (_THIS, void *buffer, int buflen);
void (*FlushCapture) (_THIS);
void (*PrepareToClose) (_THIS); /**< Called between run and draining wait for playback devices */
void (*CloseDevice) (_THIS);
void (*LockDevice) (_THIS);
void (*UnlockDevice) (_THIS);
@@ -84,13 +82,11 @@ typedef struct SDL_AudioDriverImpl
/* !!! FIXME: add pause(), so we can optimize instead of mixing silence. */
/* Some flags to push duplicate code into the core and reduce #ifdefs. */
/* !!! FIXME: these should be SDL_bool */
int ProvidesOwnCallbackThread;
int SkipMixerLock;
int HasCaptureSupport;
int OnlyHasDefaultOutputDevice;
int OnlyHasDefaultCaptureDevice;
int AllowsArbitraryDeviceNames;
SDL_bool ProvidesOwnCallbackThread;
SDL_bool HasCaptureSupport;
SDL_bool OnlyHasDefaultOutputDevice;
SDL_bool OnlyHasDefaultCaptureDevice;
SDL_bool AllowsArbitraryDeviceNames;
} SDL_AudioDriverImpl;
@@ -178,8 +174,8 @@ typedef struct AudioBootStrap
{
const char *name;
const char *desc;
int (*init) (SDL_AudioDriverImpl * impl);
int demand_only; /* 1==request explicitly, or it won't be available. */
SDL_bool (*init) (SDL_AudioDriverImpl * impl);
SDL_bool demand_only; /* 1==request explicitly, or it won't be available. */
} AudioBootStrap;
/* Not all of these are available in a given build. Use #ifdefs, etc. */

View File

@@ -685,7 +685,7 @@ MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len)
state.output.pos = 0;
state.output.size = outputsize / sizeof(Sint16);
state.output.data = (Sint16 *)SDL_malloc(outputsize);
state.output.data = (Sint16 *)SDL_calloc(1, outputsize);
if (state.output.data == NULL) {
return SDL_OutOfMemory();
}

View File

@@ -71,9 +71,10 @@ void aaudio_errorCallback( AAudioStream *stream, void *userData, aaudio_result_t
#define LIB_AAUDIO_SO "libaaudio.so"
static int
aaudio_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
aaudio_OpenDevice(_THIS, const char *devname)
{
struct SDL_PrivateAudioData *private;
SDL_bool iscapture = this->iscapture;
aaudio_result_t res;
LOGI(__func__);
@@ -268,7 +269,7 @@ aaudio_Deinitialize(void)
LOGI("End AAUDIO %s", SDL_GetError());
}
static int
static SDL_bool
aaudio_Init(SDL_AudioDriverImpl *impl)
{
aaudio_result_t res;
@@ -280,7 +281,7 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
* See https://github.com/google/oboe/issues/40 for more information.
*/
if (SDL_GetAndroidSDKVersion() < 27) {
return 0;
return SDL_FALSE;
}
SDL_zero(ctx);
@@ -315,12 +316,12 @@ aaudio_Init(SDL_AudioDriverImpl *impl)
/* and the capabilities */
impl->HasCaptureSupport = SDL_TRUE;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultCaptureDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
/* this audio target is available. */
LOGI("SDL aaudio_Init OK");
return 1;
return SDL_TRUE;
failure:
if (ctx.handle) {
@@ -331,11 +332,11 @@ failure:
}
ctx.handle = NULL;
ctx.builder = NULL;
return 0;
return SDL_FALSE;
}
AudioBootStrap aaudio_bootstrap = {
"AAudio", "AAudio audio driver", aaudio_Init, 0
"AAudio", "AAudio audio driver", aaudio_Init, SDL_FALSE
};
/* Pause (block) all non already paused audio devices by taking their mixer lock */

View File

@@ -543,9 +543,10 @@ ALSA_set_buffer_size(_THIS, snd_pcm_hw_params_t *params)
}
static int
ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
ALSA_OpenDevice(_THIS, const char *devname)
{
int status = 0;
SDL_bool iscapture = this->iscapture;
snd_pcm_t *pcm_handle = NULL;
snd_pcm_hw_params_t *hwparams = NULL;
snd_pcm_sw_params_t *swparams = NULL;
@@ -569,7 +570,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
/* Open the audio device */
/* Name of device should depend on # channels in spec */
status = ALSA_snd_pcm_open(&pcm_handle,
get_audio_device(handle, this->spec.channels),
get_audio_device(this->handle, this->spec.channels),
iscapture ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK);
@@ -597,10 +598,7 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
}
/* Try for a closest match on audio format */
status = -1;
for (test_format = SDL_FirstAudioFormat(this->spec.format);
test_format && (status < 0);) {
status = 0; /* if we can't support a format, it'll become -1. */
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_U8:
format = SND_PCM_FORMAT_U8;
@@ -633,19 +631,14 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
format = SND_PCM_FORMAT_FLOAT_BE;
break;
default:
status = -1;
continue;
}
if (ALSA_snd_pcm_hw_params_set_format(pcm_handle, hwparams, format) >= 0) {
break;
}
if (status >= 0) {
status = ALSA_snd_pcm_hw_params_set_format(pcm_handle,
hwparams, format);
}
if (status < 0) {
test_format = SDL_NextAudioFormat();
}
}
if (status < 0) {
return SDL_SetError("ALSA: Couldn't find any hardware audio formats");
if (!test_format) {
return SDL_SetError("%s: Unsupported audio format", "alsa");
}
this->spec.format = test_format;
@@ -997,11 +990,11 @@ ALSA_Deinitialize(void)
UnloadALSALibrary();
}
static int
static SDL_bool
ALSA_Init(SDL_AudioDriverImpl * impl)
{
if (LoadALSALibrary() < 0) {
return 0;
return SDL_FALSE;
}
/* Set the function pointers */
@@ -1017,12 +1010,12 @@ ALSA_Init(SDL_AudioDriverImpl * impl)
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap ALSA_bootstrap = {
"alsa", "ALSA PCM audio", ALSA_Init, 0
"alsa", "ALSA PCM audio", ALSA_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ALSA */

View File

@@ -36,9 +36,10 @@ static SDL_AudioDevice* audioDevice = NULL;
static SDL_AudioDevice* captureDevice = NULL;
static int
ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
ANDROIDAUDIO_OpenDevice(_THIS, const char *devname)
{
SDL_AudioFormat test_format;
SDL_bool iscapture = this->iscapture;
SDL_assert((captureDevice == NULL) || !iscapture);
SDL_assert((audioDevice == NULL) || iscapture);
@@ -54,20 +55,18 @@ ANDROIDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return SDL_OutOfMemory();
}
test_format = SDL_FirstAudioFormat(this->spec.format);
while (test_format != 0) { /* no "UNKNOWN" constant */
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
if ((test_format == AUDIO_U8) ||
(test_format == AUDIO_S16) ||
(test_format == AUDIO_F32)) {
this->spec.format = test_format;
break;
}
test_format = SDL_NextAudioFormat();
}
if (test_format == 0) {
if (!test_format) {
/* Didn't find a compatible format :( */
return SDL_SetError("No compatible audio format!");
return SDL_SetError("%s: Unsupported audio format", "android");
}
if (Android_JNI_OpenAudioDevice(iscapture, &this->spec) < 0) {
@@ -120,7 +119,7 @@ ANDROIDAUDIO_CloseDevice(_THIS)
SDL_free(this->hidden);
}
static int
static SDL_bool
ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -133,14 +132,14 @@ ANDROIDAUDIO_Init(SDL_AudioDriverImpl * impl)
/* and the capabilities */
impl->HasCaptureSupport = SDL_TRUE;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultCaptureDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap ANDROIDAUDIO_bootstrap = {
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, 0
"android", "SDL Android audio driver", ANDROIDAUDIO_Init, SDL_FALSE
};
/* Pause (block) all non already paused audio devices by taking their mixer lock */

View File

@@ -216,11 +216,11 @@ ARTS_Suspend(void)
}
static int
ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
ARTS_OpenDevice(_THIS, const char *devname)
{
int rc = 0;
int bits = 0, frag_spec = 0;
SDL_AudioFormat test_format = 0, format = 0;
int bits, frag_spec = 0;
SDL_AudioFormat test_format = 0;
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
@@ -231,32 +231,24 @@ ARTS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_zerop(this->hidden);
/* Try for a closest match on audio format */
for (test_format = SDL_FirstAudioFormat(this->spec.format);
!format && test_format;) {
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
#ifdef DEBUG_AUDIO
fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
#endif
switch (test_format) {
case AUDIO_U8:
bits = 8;
format = 1;
break;
case AUDIO_S16LSB:
bits = 16;
format = 1;
break;
default:
format = 0;
break;
}
if (!format) {
test_format = SDL_NextAudioFormat();
continue;
}
break;
}
if (format == 0) {
return SDL_SetError("Couldn't find any hardware audio formats");
if (!test_format) {
return SDL_SetError("%s: Unsupported audio format", "arts");
}
this->spec.format = test_format;
bits = SDL_AUDIO_BITSIZE(test_format);
if ((rc = SDL_NAME(arts_init) ()) != 0) {
return SDL_SetError("Unable to initialize ARTS: %s",
@@ -320,16 +312,16 @@ ARTS_Deinitialize(void)
}
static int
static SDL_bool
ARTS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadARTSLibrary() < 0) {
return 0;
return SDL_FALSE;
} else {
if (SDL_NAME(arts_init) () != 0) {
UnloadARTSLibrary();
SDL_SetError("ARTS: arts_init failed (no audio server?)");
return 0;
return SDL_FALSE;
}
/* Play a stream so aRts doesn't crash */
@@ -350,14 +342,14 @@ ARTS_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = ARTS_GetDeviceBuf;
impl->CloseDevice = ARTS_CloseDevice;
impl->Deinitialize = ARTS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap ARTS_bootstrap = {
"arts", "Analog RealTime Synthesizer", ARTS_Init, 0
"arts", "Analog RealTime Synthesizer", ARTS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ARTS */

View File

@@ -741,8 +741,10 @@ COREAUDIO_CloseDevice(_THIS)
#if MACOSX_COREAUDIO
static int
prepare_device(_THIS, void *handle, int iscapture)
prepare_device(_THIS)
{
void *handle = this->handle;
SDL_bool iscapture = this->iscapture;
AudioDeviceID devid = (AudioDeviceID) ((size_t) handle);
OSStatus result = noErr;
UInt32 size = 0;
@@ -983,7 +985,7 @@ audioqueue_thread(void *arg)
and quits (flagging the audioqueue for shutdown), or toggles to some other system
output device (in which case we'll try again). */
const AudioDeviceID prev_devid = this->hidden->deviceID;
if (prepare_device(this, this->handle, this->iscapture) && (prev_devid != this->hidden->deviceID)) {
if (prepare_device(this) && (prev_devid != this->hidden->deviceID)) {
AudioQueueStop(this->hidden->audioQueue, 1);
if (assign_device_to_audioqueue(this)) {
int i;
@@ -1015,11 +1017,11 @@ audioqueue_thread(void *arg)
}
static int
COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
COREAUDIO_OpenDevice(_THIS, const char *devname)
{
AudioStreamBasicDescription *strdesc;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
int valid_datatype = 0;
SDL_AudioFormat test_format;
SDL_bool iscapture = this->iscapture;
SDL_AudioDevice **new_open_devices;
/* Initialize all variables that we clean on shutdown */
@@ -1076,8 +1078,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
strdesc->mSampleRate = this->spec.freq;
strdesc->mFramesPerPacket = 1;
while ((!valid_datatype) && (test_format)) {
this->spec.format = test_format;
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
/* CoreAudio handles most of SDL's formats natively, but not U16, apparently. */
switch (test_format) {
case AUDIO_U8:
@@ -1088,32 +1089,32 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
case AUDIO_S32MSB:
case AUDIO_F32LSB:
case AUDIO_F32MSB:
valid_datatype = 1;
strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(this->spec.format);
if (SDL_AUDIO_ISBIGENDIAN(this->spec.format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
if (SDL_AUDIO_ISFLOAT(this->spec.format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat;
else if (SDL_AUDIO_ISSIGNED(this->spec.format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
break;
default:
test_format = SDL_NextAudioFormat();
break;
continue;
}
break;
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
return SDL_SetError("Unsupported audio format");
if (!test_format) { /* shouldn't happen, but just in case... */
return SDL_SetError("%s: Unsupported audio format", "coreaudio");
}
this->spec.format = test_format;
strdesc->mBitsPerChannel = SDL_AUDIO_BITSIZE(test_format);
if (SDL_AUDIO_ISBIGENDIAN(test_format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
if (SDL_AUDIO_ISFLOAT(test_format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsFloat;
else if (SDL_AUDIO_ISSIGNED(test_format))
strdesc->mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8;
strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket;
#if MACOSX_COREAUDIO
if (!prepare_device(this, handle, iscapture)) {
if (!prepare_device(this)) {
return -1;
}
#endif
@@ -1135,8 +1136,7 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
this->hidden->ready_semaphore = NULL;
if ((this->hidden->thread != NULL) && (this->hidden->thread_error != NULL)) {
SDL_SetError("%s", this->hidden->thread_error);
return -1;
return SDL_SetError("%s", this->hidden->thread_error);
}
return (this->hidden->thread != NULL) ? 0 : -1;
@@ -1152,7 +1152,7 @@ COREAUDIO_Deinitialize(void)
#endif
}
static int
static SDL_bool
COREAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -1164,18 +1164,18 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->DetectDevices = COREAUDIO_DetectDevices;
AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL);
#else
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultCaptureDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
#endif
impl->ProvidesOwnCallbackThread = 1;
impl->HasCaptureSupport = 1;
impl->ProvidesOwnCallbackThread = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap COREAUDIO_bootstrap = {
"coreaudio", "CoreAudio", COREAUDIO_Init, 0
"coreaudio", "CoreAudio", COREAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_COREAUDIO */

View File

@@ -98,10 +98,8 @@ DSOUND_Load(void)
static int
SetDSerror(const char *function, int code)
{
static const char *error;
static char errbuf[1024];
const char *error;
errbuf[0] = 0;
switch (code) {
case E_NOINTERFACE:
error = "Unsupported interface -- Is DirectX 8.0 or later installed?";
@@ -137,15 +135,11 @@ SetDSerror(const char *function, int code)
error = "Function not supported";
break;
default:
SDL_snprintf(errbuf, SDL_arraysize(errbuf),
"%s: Unknown DirectSound error: 0x%x", function, code);
error = "Unknown DirectSound error";
break;
}
if (!errbuf[0]) {
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function,
error);
}
return SDL_SetError("%s", errbuf);
return SDL_SetError("%s: %s (0x%x)", function, error, code);
}
static void
@@ -473,14 +467,14 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt)
}
static int
DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
DSOUND_OpenDevice(_THIS, const char *devname)
{
const DWORD numchunks = 8;
HRESULT result;
SDL_bool valid_format = SDL_FALSE;
SDL_bool tried_format = SDL_FALSE;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
LPGUID guid = (LPGUID) handle;
SDL_bool iscapture = this->iscapture;
SDL_AudioFormat test_format;
LPGUID guid = (LPGUID) this->handle;
DWORD bufsize;
/* Initialize all variables that we clean on shutdown */
@@ -510,7 +504,7 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
}
}
while ((!valid_format) && (test_format)) {
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_U8:
case AUDIO_S16:
@@ -547,19 +541,21 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
rc = iscapture ? CreateCaptureBuffer(this, bufsize, &wfmt) : CreateSecondary(this, bufsize, &wfmt);
if (rc == 0) {
this->hidden->num_buffers = numchunks;
valid_format = SDL_TRUE;
break;
}
}
break;
continue;
default:
continue;
}
test_format = SDL_NextAudioFormat();
break;
}
if (!valid_format) {
if (!test_format) {
if (tried_format) {
return -1; /* CreateSecondary() should have called SDL_SetError(). */
}
return SDL_SetError("DirectSound: Unsupported audio format");
return SDL_SetError("%s: Unsupported audio format", "directsound");
}
/* Playback buffers will auto-start playing in DSOUND_WaitDevice() */
@@ -575,11 +571,11 @@ DSOUND_Deinitialize(void)
}
static int
static SDL_bool
DSOUND_Init(SDL_AudioDriverImpl * impl)
{
if (!DSOUND_Load()) {
return 0;
return SDL_FALSE;
}
/* Set the function pointers */
@@ -596,11 +592,11 @@ DSOUND_Init(SDL_AudioDriverImpl * impl)
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap DSOUND_bootstrap = {
"directsound", "DirectSound", DSOUND_Init, 0
"directsound", "DirectSound", DSOUND_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_DSOUND */

View File

@@ -114,7 +114,7 @@ DISKAUDIO_CloseDevice(_THIS)
static const char *
get_filename(const int iscapture, const char *devname)
get_filename(const SDL_bool iscapture, const char *devname)
{
if (devname == NULL) {
devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE);
@@ -126,9 +126,11 @@ get_filename(const int iscapture, const char *devname)
}
static int
DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
DISKAUDIO_OpenDevice(_THIS, const char *devname)
{
void *handle = _this->handle;
/* handle != NULL means "user specified the placeholder name on the fake detected device list" */
SDL_bool iscapture = _this->iscapture;
const char *fname = get_filename(iscapture, handle ? NULL : devname);
const char *envr = SDL_getenv(DISKENVR_IODELAY);
@@ -177,7 +179,7 @@ DISKAUDIO_DetectDevices(void)
SDL_AddAudioDevice(SDL_TRUE, DEFAULT_INPUT_DEVNAME, NULL, (void *) 0x2);
}
static int
static SDL_bool
DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -191,14 +193,14 @@ DISKAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = DISKAUDIO_CloseDevice;
impl->DetectDevices = DISKAUDIO_DetectDevices;
impl->AllowsArbitraryDeviceNames = 1;
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap DISKAUDIO_bootstrap = {
"disk", "direct-to-disk audio", DISKAUDIO_Init, 1
"disk", "direct-to-disk audio", DISKAUDIO_Init, SDL_TRUE
};
#endif /* SDL_AUDIO_DRIVER_DISK */

View File

@@ -68,8 +68,9 @@ DSP_CloseDevice(_THIS)
static int
DSP_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
DSP_OpenDevice(_THIS, const char *devname)
{
SDL_bool iscapture = this->iscapture;
const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT);
int format;
int value;
@@ -301,13 +302,14 @@ look_for_devices_test(int fd)
return 0;
}
static int
static SDL_bool
DSP_Init(SDL_AudioDriverImpl * impl)
{
InitTimeDevicesExist = SDL_FALSE;
SDL_EnumUnixAudioDevices(0, look_for_devices_test);
if (!InitTimeDevicesExist) {
return 0; /* maybe try a different backend. */
SDL_SetError("dsp: No such audio device");
return SDL_FALSE; /* maybe try a different backend. */
}
/* Set the function pointers */
@@ -319,15 +321,15 @@ DSP_Init(SDL_AudioDriverImpl * impl)
impl->CaptureFromDevice = DSP_CaptureFromDevice;
impl->FlushCapture = DSP_FlushCapture;
impl->AllowsArbitraryDeviceNames = 1;
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap DSP_bootstrap = {
"dsp", "OSS /dev/dsp standard audio", DSP_Init, 0
"dsp", "OSS /dev/dsp standard audio", DSP_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_OSS */

View File

@@ -28,7 +28,7 @@
#include "SDL_dummyaudio.h"
static int
DUMMYAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
DUMMYAUDIO_OpenDevice(_THIS, const char *devname)
{
_this->hidden = (void *) 0x1; /* just something non-NULL */
return 0; /* always succeeds. */
@@ -45,22 +45,22 @@ DUMMYAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen)
return buflen;
}
static int
static SDL_bool
DUMMYAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
impl->OpenDevice = DUMMYAUDIO_OpenDevice;
impl->CaptureFromDevice = DUMMYAUDIO_CaptureFromDevice;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultCaptureDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap DUMMYAUDIO_bootstrap = {
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, 1
"dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE
};
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -32,7 +32,7 @@ static void
FeedAudioDevice(_THIS, const void *buf, const int buflen)
{
const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels;
EM_ASM_ARGS({
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels'];
for (var c = 0; c < numChannels; ++c) {
@@ -101,7 +101,7 @@ HandleCaptureProcess(_THIS)
return;
}
EM_ASM_ARGS({
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels;
for (var c = 0; c < numChannels; ++c) {
@@ -147,7 +147,7 @@ HandleCaptureProcess(_THIS)
static void
EMSCRIPTENAUDIO_CloseDevice(_THIS)
{
EM_ASM_({
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
if ($0) {
if (SDL2.capture.silenceTimer !== undefined) {
@@ -192,16 +192,16 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS)
}
static int
EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname)
{
SDL_bool valid_format = SDL_FALSE;
SDL_AudioFormat test_format;
SDL_bool iscapture = this->iscapture;
int result;
/* based on parts of library_sdl.js */
/* create context */
result = EM_ASM_INT({
result = MAIN_THREAD_EM_ASM_INT({
if(typeof(Module['SDL2']) === 'undefined') {
Module['SDL2'] = {};
}
@@ -228,22 +228,21 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu
return SDL_SetError("Web Audio API is not available!");
}
test_format = SDL_FirstAudioFormat(this->spec.format);
while ((!valid_format) && (test_format)) {
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_F32: /* web audio only supports floats */
this->spec.format = test_format;
valid_format = SDL_TRUE;
break;
default:
continue;
}
test_format = SDL_NextAudioFormat();
break;
}
if (!valid_format) {
if (!test_format) {
/* Didn't find a compatible format :( */
return SDL_SetError("No compatible audio format!");
return SDL_SetError("%s: Unsupported audio format", "emscripten");
}
this->spec.format = test_format;
/* Initialize all variables that we clean on shutdown */
#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */
@@ -281,7 +280,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu
feels like it's a pretty inefficient tapdance in similar ways,
to be honest. */
EM_ASM_({
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
var have_microphone = function(stream) {
//console.log('SDL audio capture: we have a microphone! Replacing silence callback.');
@@ -324,7 +323,7 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu
}, this->spec.channels, this->spec.samples, HandleCaptureProcess, this);
} else {
/* setup a ScriptProcessorNode */
EM_ASM_ARGS({
MAIN_THREAD_EM_ASM({
var SDL2 = Module['SDL2'];
SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0);
SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) {
@@ -339,43 +338,47 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu
return 0;
}
static int
static void
EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
{
}
static SDL_bool
EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
{
int available;
int capture_available;
SDL_bool available, capture_available;
/* Set the function pointers */
impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice;
impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
/* no threads here */
impl->SkipMixerLock = 1;
impl->ProvidesOwnCallbackThread = 1;
impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock;
impl->ProvidesOwnCallbackThread = SDL_TRUE;
/* check availability */
available = EM_ASM_INT_V({
available = MAIN_THREAD_EM_ASM_INT({
if (typeof(AudioContext) !== 'undefined') {
return 1;
return true;
} else if (typeof(webkitAudioContext) !== 'undefined') {
return 1;
return true;
}
return 0;
return false;
});
if (!available) {
SDL_SetError("No audio context available");
}
capture_available = available && EM_ASM_INT_V({
capture_available = available && MAIN_THREAD_EM_ASM_INT({
if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) {
return 1;
return true;
} else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') {
return 1;
return true;
}
return 0;
return false;
});
impl->HasCaptureSupport = capture_available ? SDL_TRUE : SDL_FALSE;
@@ -385,7 +388,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
}
AudioBootStrap EMSCRIPTENAUDIO_bootstrap = {
"emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, 0
"emscripten", "SDL emscripten audio driver", EMSCRIPTENAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_EMSCRIPTEN */

View File

@@ -208,7 +208,7 @@ get_progname(void)
static int
ESD_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
ESD_OpenDevice(_THIS, const char *devname)
{
esd_format_t format = (ESD_STREAM | ESD_PLAY);
SDL_AudioFormat test_format = 0;
@@ -293,11 +293,11 @@ ESD_Deinitialize(void)
UnloadESDLibrary();
}
static int
static SDL_bool
ESD_Init(SDL_AudioDriverImpl * impl)
{
if (LoadESDLibrary() < 0) {
return 0;
return SDL_FALSE;
} else {
int connection = 0;
@@ -308,7 +308,7 @@ ESD_Init(SDL_AudioDriverImpl * impl)
if (connection < 0) {
UnloadESDLibrary();
SDL_SetError("ESD: esd_open_sound failed (no audio server?)");
return 0;
return SDL_FALSE;
}
SDL_NAME(esd_close) (connection);
}
@@ -320,14 +320,14 @@ ESD_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = ESD_GetDeviceBuf;
impl->CloseDevice = ESD_CloseDevice;
impl->Deinitialize = ESD_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap ESD_bootstrap = {
"esd", "Enlightened Sound Daemon", ESD_Init, 0
"esd", "Enlightened Sound Daemon", ESD_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_ESD */

View File

@@ -174,10 +174,10 @@ SDL_FS_CloseDevice(_THIS)
static int
SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_FS_OpenDevice(_THIS, const char *devname)
{
int bytes;
SDL_AudioFormat test_format = 0, format = 0;
SDL_AudioFormat test_format;
FSSampleFormat fs_format;
FSStreamDescription desc;
DirectResult ret;
@@ -191,45 +191,34 @@ SDL_FS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_zerop(this->hidden);
/* Try for a closest match on audio format */
for (test_format = SDL_FirstAudioFormat(this->spec.format);
!format && test_format;) {
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
#ifdef DEBUG_AUDIO
fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
#endif
switch (test_format) {
case AUDIO_U8:
fs_format = FSSF_U8;
bytes = 1;
format = 1;
break;
case AUDIO_S16SYS:
fs_format = FSSF_S16;
bytes = 2;
format = 1;
break;
case AUDIO_S32SYS:
fs_format = FSSF_S32;
bytes = 4;
format = 1;
break;
case AUDIO_F32SYS:
fs_format = FSSF_FLOAT;
bytes = 4;
format = 1;
break;
default:
format = 0;
break;
}
if (!format) {
test_format = SDL_NextAudioFormat();
continue;
}
break;
}
if (format == 0) {
return SDL_SetError("Couldn't find any hardware audio formats");
if (!test_format) {
return SDL_SetError("%s: Unsupported audio format", "fusionsound");
}
this->spec.format = test_format;
bytes = SDL_AUDIO_BITSIZE(test_format) / 8;
/* Retrieve the main sound interface. */
ret = SDL_NAME(FusionSoundCreate) (&this->hidden->fs);
@@ -288,11 +277,11 @@ SDL_FS_Deinitialize(void)
}
static int
static SDL_bool
SDL_FS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadFusionSoundLibrary() < 0) {
return 0;
return SDL_FALSE;
} else {
DirectResult ret;
@@ -302,7 +291,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
SDL_SetError
("FusionSound: SDL_FS_init failed (FusionSoundInit: %d)",
ret);
return 0;
return SDL_FALSE;
}
}
@@ -313,14 +302,14 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = SDL_FS_GetDeviceBuf;
impl->CloseDevice = SDL_FS_CloseDevice;
impl->Deinitialize = SDL_FS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap FUSIONSOUND_bootstrap = {
"fusionsound", "FusionSound", SDL_FS_Init, 0
"fusionsound", "FusionSound", SDL_FS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_FUSIONSOUND */

View File

@@ -120,11 +120,10 @@ UnmaskSignals(sigset_t * omask)
static int
HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
HAIKUAUDIO_OpenDevice(_THIS, const char *devname)
{
int valid_datatype = 0;
media_raw_audio_format format;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(_this->spec.format);
SDL_AudioFormat test_format;
/* Initialize all variables that we clean on shutdown */
_this->hidden = new SDL_PrivateAudioData;
@@ -138,9 +137,7 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
format.frame_rate = (float) _this->spec.freq;
format.channel_count = _this->spec.channels; /* !!! FIXME: support > 2? */
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
_this->spec.format = test_format;
for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
@@ -178,15 +175,15 @@ HAIKUAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
continue;
}
break;
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
return SDL_SetError("Unsupported audio format");
if (!test_format) { /* shouldn't happen, but just in case... */
return SDL_SetError("%s: Unsupported audio format", "haiku");
}
_this->spec.format = test_format;
/* Calculate the final parameters for this audio specification */
SDL_CalculateAudioSpec(&_this->spec);
@@ -216,22 +213,22 @@ HAIKUAUDIO_Deinitialize(void)
SDL_QuitBeApp();
}
static int
static SDL_bool
HAIKUAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) {
return 0;
return SDL_FALSE;
}
/* Set the function pointers */
impl->OpenDevice = HAIKUAUDIO_OpenDevice;
impl->CloseDevice = HAIKUAUDIO_CloseDevice;
impl->Deinitialize = HAIKUAUDIO_Deinitialize;
impl->ProvidesOwnCallbackThread = 1;
impl->OnlyHasDefaultOutputDevice = 1;
impl->ProvidesOwnCallbackThread = SDL_TRUE;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
extern "C"
@@ -239,7 +236,7 @@ extern "C"
extern AudioBootStrap HAIKUAUDIO_bootstrap;
}
AudioBootStrap HAIKUAUDIO_bootstrap = {
"haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, 0
"haiku", "Haiku BSoundPlayer", HAIKUAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_HAIKU */

View File

@@ -280,12 +280,13 @@ JACK_CloseDevice(_THIS)
}
static int
JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
JACK_OpenDevice(_THIS, const char *devname)
{
/* Note that JACK uses "output" for capture devices (they output audio
data to us) and "input" for playback (we input audio data to them).
Likewise, SDL's playback port will be "output" (we write data out)
and capture will be "input" (we read data in). */
SDL_bool iscapture = this->iscapture;
const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput;
const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput;
const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback;
@@ -405,18 +406,18 @@ JACK_Deinitialize(void)
UnloadJackLibrary();
}
static int
static SDL_bool
JACK_Init(SDL_AudioDriverImpl * impl)
{
if (LoadJackLibrary() < 0) {
return 0;
return SDL_FALSE;
} else {
/* Make sure a JACK server is running and available. */
jack_status_t status;
jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL);
if (client == NULL) {
UnloadJackLibrary();
return 0;
return SDL_FALSE;
}
JACK_jack_client_close(client);
}
@@ -433,11 +434,11 @@ JACK_Init(SDL_AudioDriverImpl * impl)
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap JACK_bootstrap = {
"jack", "JACK Audio Connection Kit", JACK_Init, 0
"jack", "JACK Audio Connection Kit", JACK_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_JACK */

View File

@@ -99,7 +99,7 @@ static void NACLAUDIO_CloseDevice(SDL_AudioDevice *device) {
}
static int
NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
NACLAUDIO_OpenDevice(_THIS, const char *devname) {
PP_Instance instance = PSGetInstanceId();
const PPB_Audio *ppb_audio = PSInterfaceAudio();
const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig();
@@ -133,18 +133,18 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) {
return 0;
}
static int
static SDL_bool
NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
{
if (PSGetInstanceId() == 0) {
return 0;
return SDL_FALSE;
}
/* Set the function pointers */
impl->OpenDevice = NACLAUDIO_OpenDevice;
impl->CloseDevice = NACLAUDIO_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1;
impl->ProvidesOwnCallbackThread = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->ProvidesOwnCallbackThread = SDL_TRUE;
/*
* impl->WaitDevice = NACLAUDIO_WaitDevice;
* impl->GetDeviceBuf = NACLAUDIO_GetDeviceBuf;
@@ -152,12 +152,12 @@ NACLAUDIO_Init(SDL_AudioDriverImpl * impl)
* impl->Deinitialize = NACLAUDIO_Deinitialize;
*/
return 1;
return SDL_TRUE;
}
AudioBootStrap NACLAUDIO_bootstrap = {
NACLAUDIO_DRIVER_NAME, "SDL NaCl Audio Driver",
NACLAUDIO_Init, 0
NACLAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NACL */

View File

@@ -237,26 +237,6 @@ NAS_CloseDevice(_THIS)
SDL_free(this->hidden);
}
static unsigned char
sdlformat_to_auformat(unsigned int fmt)
{
switch (fmt) {
case AUDIO_U8:
return AuFormatLinearUnsigned8;
case AUDIO_S8:
return AuFormatLinearSigned8;
case AUDIO_U16LSB:
return AuFormatLinearUnsigned16LSB;
case AUDIO_U16MSB:
return AuFormatLinearUnsigned16MSB;
case AUDIO_S16LSB:
return AuFormatLinearSigned16LSB;
case AUDIO_S16MSB:
return AuFormatLinearSigned16MSB;
}
return AuNone;
}
static AuBool
event_handler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * hnd)
{
@@ -331,11 +311,12 @@ find_device(_THIS)
}
static int
NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
NAS_OpenDevice(_THIS, const char *devname)
{
AuElement elms[3];
int buffer_size;
SDL_AudioFormat test_format, format;
SDL_bool iscapture = this->iscapture;
SDL_AudioFormat test_format, format = 0;
/* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *)
@@ -346,16 +327,33 @@ NAS_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_zerop(this->hidden);
/* Try for a closest match on audio format */
format = 0;
for (test_format = SDL_FirstAudioFormat(this->spec.format);
!format && test_format;) {
format = sdlformat_to_auformat(test_format);
if (format == AuNone) {
test_format = SDL_NextAudioFormat();
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_U8:
format = AuFormatLinearUnsigned8;
break;
case AUDIO_S8:
format = AuFormatLinearSigned8;
break;
case AUDIO_U16LSB:
format = AuFormatLinearUnsigned16LSB;
break;
case AUDIO_U16MSB:
format = AuFormatLinearUnsigned16MSB;
break;
case AUDIO_S16LSB:
format = AuFormatLinearSigned16LSB;
break;
case AUDIO_S16MSB:
format = AuFormatLinearSigned16MSB;
break;
default:
continue;
}
break;
}
if (format == 0) {
return SDL_SetError("NAS: Couldn't find any hardware audio formats");
if (!test_format) {
return SDL_SetError("%s: Unsupported audio format", "nas");
}
this->spec.format = test_format;
@@ -423,16 +421,16 @@ NAS_Deinitialize(void)
UnloadNASLibrary();
}
static int
static SDL_bool
NAS_Init(SDL_AudioDriverImpl * impl)
{
if (LoadNASLibrary() < 0) {
return 0;
return SDL_FALSE;
} else {
AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL);
if (aud == NULL) {
SDL_SetError("NAS: AuOpenServer() failed (no audio server?)");
return 0;
return SDL_FALSE;
}
NAS_AuCloseServer(aud);
}
@@ -447,15 +445,15 @@ NAS_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = NAS_CloseDevice;
impl->Deinitialize = NAS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultCaptureDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
impl->OnlyHasDefaultCaptureDevice = SDL_TRUE;
impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap NAS_bootstrap = {
"nas", "Network Audio System", NAS_Init, 0
"nas", "Network Audio System", NAS_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NAS */

View File

@@ -202,9 +202,11 @@ NETBSDAUDIO_CloseDevice(_THIS)
}
static int
NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
NETBSDAUDIO_OpenDevice(_THIS, const char *devname)
{
SDL_AudioFormat format = 0;
SDL_bool iscapture = this->iscapture;
SDL_AudioFormat test_format;
int encoding = AUDIO_ENCODING_NONE;
audio_info_t info, hwinfo;
struct audio_prinfo *prinfo = iscapture ? &info.record : &info.play;
@@ -244,54 +246,46 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
}
#endif
prinfo->encoding = AUDIO_ENCODING_NONE;
prinfo->sample_rate = this->spec.freq;
prinfo->channels = this->spec.channels;
for (format = SDL_FirstAudioFormat(this->spec.format); format;) {
switch (format) {
for (test_format = SDL_FirstAudioFormat(this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
switch (test_format) {
case AUDIO_U8:
prinfo->encoding = AUDIO_ENCODING_ULINEAR;
prinfo->precision = 8;
encoding = AUDIO_ENCODING_ULINEAR;
break;
case AUDIO_S8:
prinfo->encoding = AUDIO_ENCODING_SLINEAR;
prinfo->precision = 8;
encoding = AUDIO_ENCODING_SLINEAR;
break;
case AUDIO_S16LSB:
prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE;
prinfo->precision = 16;
encoding = AUDIO_ENCODING_SLINEAR_LE;
break;
case AUDIO_S16MSB:
prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE;
prinfo->precision = 16;
encoding = AUDIO_ENCODING_SLINEAR_BE;
break;
case AUDIO_U16LSB:
prinfo->encoding = AUDIO_ENCODING_ULINEAR_LE;
prinfo->precision = 16;
encoding = AUDIO_ENCODING_ULINEAR_LE;
break;
case AUDIO_U16MSB:
prinfo->encoding = AUDIO_ENCODING_ULINEAR_BE;
prinfo->precision = 16;
encoding = AUDIO_ENCODING_ULINEAR_BE;
break;
case AUDIO_S32LSB:
prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE;
prinfo->precision = 32;
encoding = AUDIO_ENCODING_SLINEAR_LE;
break;
case AUDIO_S32MSB:
prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE;
prinfo->precision = 32;
encoding = AUDIO_ENCODING_SLINEAR_BE;
break;
default:
continue;
}
if (prinfo->encoding != AUDIO_ENCODING_NONE) {
break;
}
format = SDL_NextAudioFormat();
break;
}
if (prinfo->encoding == AUDIO_ENCODING_NONE) {
return SDL_SetError("No supported encoding for 0x%x", this->spec.format);
if (!test_format) {
return SDL_SetError("%s: Unsupported audio format", "netbsd");
}
prinfo->encoding = encoding;
prinfo->precision = SDL_AUDIO_BITSIZE(test_format);
info.hiwat = 5;
info.lowat = 3;
@@ -304,7 +298,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
}
/* Final spec used for the device. */
this->spec.format = format;
this->spec.format = test_format;
this->spec.freq = prinfo->sample_rate;
this->spec.channels = prinfo->channels;
@@ -326,7 +320,7 @@ NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
return 0;
}
static int
static SDL_bool
NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
@@ -339,14 +333,14 @@ NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->FlushCapture = NETBSDAUDIO_FlushCapture;
impl->HasCaptureSupport = SDL_TRUE;
impl->AllowsArbitraryDeviceNames = 1;
impl->AllowsArbitraryDeviceNames = SDL_TRUE;
return 1; /* this audio target is available. */
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap NETBSDAUDIO_bootstrap = {
"netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0
"netbsd", "NetBSD audio", NETBSDAUDIO_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_NETBSD */

Some files were not shown because too many files have changed in this diff Show More