Commit Graph

15020 Commits

Author SHA1 Message Date
Sam Lantinga da027ec3ee Fixed signed/unsigned comparison warning 2024-03-19 17:00:46 -07:00
Pierre Wendling 390fff4ae0 N3DS: Fix locale name and early return.
- The name for simplified Chinese should be `zh_CN`.
- Ensure `cfguExit` is called even if `CFGU_GetSystemLanguage` failed.
2024-03-19 16:54:07 -07:00
Pierre Wendling 8f529d9d16 N3DS: Implement SDL_GetSystemTimeLocalePreferences
The formats are deduced based on the system's current language and region.
2024-03-19 16:52:56 -07:00
Sam Lantinga ed5d2bdda5 Fixed adding duplicate fsops files to CMakeLists.txt 2024-03-19 16:20:55 -07:00
Sam Lantinga 478b965e6c Fixed warning C4702: unreachable code
Also switched SDL_IOFromFile() to use SDL_InvalidParamError()
2024-03-19 16:02:54 -07:00
Sam Lantinga b1215272ad Fixed warning C4244: '=': conversion from '__int64' to 'int', possible loss of data 2024-03-19 16:02:37 -07:00
Sam Lantinga 2265d22f75 Updated Xcode project for time APIs 2024-03-19 14:53:55 -07:00
Sam Lantinga c582a89f78 Fixed build warning 2024-03-19 14:53:49 -07:00
Susko3 b90fed094f Standardise header includes
Changes "SDL_*.h" and "SDL3/SDL_*.h" to <SDL3/SDL_*.h>
2024-03-19 13:41:53 -07:00
Ivan Epifanov 2e45568338 PSVita: fix SDL_GetSystemTimeLocalePreferences 2024-03-19 12:32:51 -07:00
SDL Wiki Bot ba0417db40 Sync SDL3 wiki -> header 2024-03-19 17:58:24 +00:00
Frank Praznik a6fbf0488c Add time and realtime clock functions
Adds functions to query the system's realtime clock, convert time intervals to/from a calendar date and time in either UTC or the local time, and perform time related calculations.

An SDL_Time type (a time interval represented in nanoseconds), and SDL_DateTime struct (broken down calendar date and time) were added to facilitate this functionality.

Querying the system time results in a value expressed in nanoseconds since the Unix epoch (Jan 1, 1970) in UTC +0000. Conversions to and from the various platform epochs and units are performed when required.

Any direct handling of timezones and DST were intentionally avoided. The offset from UTC is provided when converting from UTC to a local time by calculating the difference between the original UTC and the resulting local time, but no other timezone or DST information is used.

The preferred date formatting and 12/24 hour time for the system locale can be retrieved via global preferences.

Helper functions for obtaining the day of week or day or year for calendar date, and getting the number of days in a month in a given year are provided for convenience. These are simple, but useful for performing various time related calculations.

An automated test for time conversion is included, as is a simple standalone test to display the current system date and time onscreen along with a calendar, the rendering of which demonstrates the use of the utility functions (press up/down to increment or decrement the current month, and keys 1-5 to change the date and time formats).
2024-03-19 10:57:36 -07:00
kanjitalk755 b6c9a72740 Add SDL_storage files to Xcode project 2024-03-18 22:52:58 -07:00
SDL Wiki Bot b2682da035 Sync SDL3 wiki -> header 2024-03-19 04:57:27 +00:00
Sam Lantinga 24ec1c09b9 Renamed SDL_PROP_IOSTREAM_STDIO_HANDLE_POINTER to SDL_PROP_IOSTREAM_STDIO_FILE_POINTER 2024-03-18 21:56:11 -07:00
Cameron Gutman d3a785e521 Improve event processing latency when gamepad/sensor is open
By using the SDL_WaitEventTimeout_Device() path even when polling is required,
we can still achieve sub-millisecond latency for non-gamepad/sensor events when
a gamepad or sensor is in use by the application.
2024-03-18 21:52:42 -07:00
Frank Praznik 1eb7b79986 video: Prepend global video property with "SDL" 2024-03-18 21:52:39 -04:00
Sam Lantinga 784311c20e Fixed duplicate SDL_Version change 2024-03-18 13:59:03 -07:00
Anonymous Maarten 009318c5a9 Fix warnings when building with -DSDL_LIBC=OFF on Linux 2024-03-18 21:29:08 +01:00
Anonymous Maarten f59dbf6a12 cmake: add -Wimplicit-fallthrough warning 2024-03-18 20:34:50 +01:00
Sam Lantinga 086a7a4687 Fixed signed/unsigned comparison warning 2024-03-18 09:48:45 -07:00
Sam Lantinga 491f18eea3 Fixed uninitialized signal_id
Also removed unnecessary SDL_OutOfMemory() calls

Fixes https://github.com/libsdl-org/SDL/issues/9300
2024-03-18 09:12:51 -07:00
Sam Lantinga 90e2551c4f Sort the SDL API symbols
API renames are almost complete, let's prepare for a preview release
2024-03-18 09:03:36 -07:00
SDL Wiki Bot 0d0aaa2d75 Sync SDL3 wiki -> header 2024-03-18 15:57:23 +00:00
Sam Lantinga 92d01ef12a You can pass NULL to SDL_GetPathInfo() and SDL_GetStoragePathInfo() to test for the existence of a file. 2024-03-18 08:56:24 -07:00
Frank Praznik ebb6582534 wayland: Handle the toplevel export property as a string
xdg-toplevel export handles are strings, so treat the property as one. Avoids the need to manually manage the string pointer.
2024-03-18 11:41:02 -04:00
Petar Popovic 9072b994f7 src/filesystem/unix/SDL_sysfilesystem.c add <stdio.h> inclusion
gets rid of some warnings
2024-03-18 15:55:40 +03:00
Mathieu Eyraud 6af979975f Add missing break 2024-03-18 15:55:14 +03:00
SDL Wiki Bot fc26d5d328 Sync SDL3 wiki -> header 2024-03-18 04:28:30 +00:00
Sam Lantinga a1a0156756 Renamed SDL_SizeIO() SDL_GetIOSize() 2024-03-18 00:27:18 -04:00
Sam Lantinga df0f5deddf Added SDL_IOFromDynamicMem() 2024-03-18 00:27:18 -04:00
rofl0r 12245e4c75 PSP/Joystick: fix formatting
(cherry picked from commit c17d2246fb)
2024-03-17 13:23:51 -07:00
rofl0r 7169db1e62 PSP: don't block on joystick event query
using the blocking sceCtrlReadBufferPositive() effectively turns SDL_PollEvent() into WaitForVblank(), because the functions does exactly that if no input is buffered.
due to this, calling SDL_PollEvent() once per frame averaged in 7 ms delay out of the available 16ms budget to get a frame calculated and drawn to achieve 60 fps.

(cherry picked from commit 86f223d664)
2024-03-17 13:23:51 -07:00
Sam Lantinga 747300b356 SDL file times are 64-bit integers representing nanoseconds since the Unix epoch 2024-03-17 13:21:04 -07:00
Sam Lantinga 9153287fa0 Added storage filesystem operations to the exported function list 2024-03-17 13:02:52 -07:00
SDL Wiki Bot e7b9f75e62 Sync SDL3 wiki -> header 2024-03-17 19:29:22 +00:00
Sam Lantinga d65ae710a1 Renamed SDL_LogGetOutputFunction() and SDL_LogSetOutputFunction() to match SDL 3.0 naming convention 2024-03-17 12:28:11 -07:00
Sam Lantinga d8a54cd4f8 Updated "see also" references to be more consistent
Fixes https://github.com/libsdl-org/SDL/issues/9282
2024-03-17 12:28:11 -07:00
Sam Lantinga d972244d3a Added a mapping for the Defender Joystick Cobra R4 (thanks @kotenok2000!) 2024-03-17 12:13:21 -07:00
Sam Lantinga 4697153d1e Use the CRC as part of the unique key for mappings 2024-03-17 12:13:21 -07:00
Ryan C. Gordon 9d83c0a65d filesystem: Rename some internal symbols to remove "FSops" terminology.
This removes the "FSops" naming scheme, which was meant to mirror the
"RWops" naming scheme, which was also recently removed from SDL3.

The build system defines (`SDL_FSOPS_POSIX`, etc) and the source code
filenames retain this, because there's already things using the word
"filesystem" that might overlap (for example, lots of things have a
unique "SDL_sysfilesystem.c", to query base dirs, etc, but almost
everything uses the POSIX "SDL_sysfsops.c" source code.

Fixes #9288.
2024-03-17 14:20:11 -04:00
Petar Popovic 4ecea42fb0 testautomation_math.c: use isinf(V) instead of fpclassify(V) == FP_INFINITE
Using fpclassify can cause a linker error.
Using isinf instead fixes this.
2024-03-17 11:12:09 -07:00
Frank Praznik cb39740cfd wayland: Remove additional instance of setting the viewport source rect 2024-03-17 13:10:48 -04:00
SDL Wiki Bot a206e1e3c0 Sync SDL3 wiki -> header 2024-03-17 15:40:25 +00:00
Sam Lantinga 2f78e5f321 All storage interface functions are optional
If an application is creating custom storage, presumably they'll implement the functions they need.
2024-03-17 08:39:43 -07:00
Sam Lantinga f460f42e70 Added filesystem operations to SDL_Storage 2024-03-17 08:39:43 -07:00
Sam Lantinga 7a088527c1 Removed the reserved parameter from SDL_EnumerateDirectoryCallback
If someone needs to, say, include an SDL_Storage object, they can simply point userdata at a structure that includes the the storage and any other data needed in enumeration.
2024-03-17 08:39:43 -07:00
Sam Lantinga ec3ba387d1 Added SDL_OpenFileStorage() for local file storage 2024-03-17 08:39:43 -07:00
Sam Lantinga ee0a23c7ab The storage ready callback is optional 2024-03-17 08:39:43 -07:00
Sam Lantinga db0c1d7aeb Added portable file and directory operations (thanks @icculus!) 2024-03-17 08:39:43 -07:00