Commit graph

83 commits

Author SHA1 Message Date
Sam Lantinga fde78d12f2 Updated copyright for 2023 2023-01-09 09:41:41 -08:00
Sam Lantinga 63724c113b Removed the vi format comments from the source
Vim users can use the [editorconfig plugin](https://github.com/editorconfig/editorconfig-vim) to automatically set tab spacing for the SDL coding style.

Fixes https://github.com/libsdl-org/SDL/issues/6903
2022-12-26 11:17:23 -08:00
Ozkan Sezer a3d7dd2464 SDL_sysfilesystem.c (SDL_GetBasePath): fixed the solaris code path.
Reference issue: https://github.com/libsdl-org/SDL/pull/6681
2022-12-02 06:23:30 +03:00
Pierre Wendling 3c501b963d
Clang-Tidy fixes (#6725) 2022-12-01 13:07:03 -08:00
Sam Lantinga 5750bcb174
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.

In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.

The script I ran for the src directory is added as build-scripts/clang-format-src.sh

This fixes:
#6592
#6593
#6594
2022-11-30 12:51:59 -08:00
Sam Lantinga c5790359fd
Added precompiled header support for Visual Studio and Xcode (#6710)
Fixes https://github.com/libsdl-org/SDL/issues/6704
2022-11-29 18:34:15 -08:00
Samuel Venable 4f5e9fd5bd [skip ci] Solaris getexecname() returns argv[0]
`argv[0]`/`getexexname()` are not always absolute paths by default and can be modified to anything the developer wants them to be.

Consider using `readSymLink("/proc/self/path/a.out")` instead and `getexecname()` as the fallback, since the symlink will always be the correct absolute path (unless /proc is ot mounted, but it is by default on Solaris and Illumos platforms).
2022-11-27 21:29:07 -05:00
Sylvain Becker 6a2200823c
Cleanup add brace (#6545)
* Add braces after if conditions

* More add braces after if conditions

* Add braces after while() conditions

* Fix compilation because of macro being modified

* Add braces to for loop

* Add braces after if/goto

* Move comments up

* Remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements

* More remove extra () in the 'return ...;' statements after merge

* Fix inconsistent patterns are xxx == NULL vs !xxx

* More "{}" for "if() break;"  and "if() continue;"

* More "{}" after if() short statement

* More "{}" after "if () return;" statement

* More fix inconsistent patterns are xxx == NULL vs !xxx

* Revert some modificaion on SDL_RLEaccel.c

* SDL_RLEaccel: no short statement

* Cleanup 'if' where the bracket is in a new line

* Cleanup 'while' where the bracket is in a new line

* Cleanup 'for' where the bracket is in a new line

* Cleanup 'else' where the bracket is in a new line
2022-11-27 08:38:43 -08:00
Sam Lantinga 0a48abc860 Switch header convention from #include "SDL.h" to #include <SDL3/SDLh>
I ran this script in the include directory:
```sh
sed -i '' -e 's,#include "\(SDL.*\)",#include <SDL3/\1>,' *.h
```

I ran this script in the src directory:
```sh
for i in ../include/SDL3/SDL*.h
do hdr=$(basename $i)
   if [ x"$(echo $hdr | egrep 'SDL_main|SDL_name|SDL_test|SDL_syswm|SDL_opengl|SDL_egl|SDL_vulkan')" != x ]; then
        find . -type f -exec sed -i '' -e 's,#include "\('$hdr'\)",#include <SDL3/\1>,' {} \;
    else
        find . -type f -exec sed -i '' -e '/#include "'$hdr'"/d' {} \;
    fi
done
```

Fixes https://github.com/libsdl-org/SDL/issues/6575
2022-11-26 22:15:18 -08:00
Sam Lantinga bde808cd87 Fixed some warnings when building on Linux with -DSDL_LIBC=OFF 2022-11-26 05:18:26 -08:00
Sam Lantinga a635a485bc Re-added WinRT support until we're sure that it's no longer being used 2022-11-23 10:41:43 -08:00
Ozkan Sezer dc2a3e06e9 removed WinRT support. 2022-11-22 23:36:24 +03:00
Ozkan Sezer 5cedc2f1ff removed QNX support. 2022-11-22 20:23:40 +03:00
Ozkan Sezer e89a1f9157 removed NaCL support. 2022-11-22 20:10:47 +03:00
Ozkan Sezer 8d6fda4810 removed os2 support & support for building SDL with watcom. 2022-11-22 19:18:47 +03:00
Pierre Wendling de5fa89b50 N3DS: Prepend PrefPath with sdmc:. 2022-11-14 21:24:10 -08:00
Pierre Wendling 2b2693ae90 N3DS: Use asprintf instead of snprintf. 2022-10-10 08:50:59 -07:00
Pierre Wendling 655275378d N3DS port (squashed)
A dedicated renderer using Citro3D would likely allow for better
much better graphical performances.
2022-10-10 08:50:59 -07:00
Sam Lantinga cef1514b01 Fixed some Xcode warnings 2022-07-17 09:07:04 -07:00
Ozkan Sezer 2201d80255 avoid -Werror=declaration-after-statement after last commit. 2022-07-14 02:40:00 +03:00
freebsd 24b3efd08d (OpenBSD) Exe Path: Use PWD instead of CWD and use CWD as fallback 2022-07-13 16:24:20 -07:00
Francisco Javier Trujillo Mata 7d7c5b803c Improving mkdir creating parents folder 2022-07-03 09:23:34 -07:00
chalonverse f317d619cc
Xbox GDKX support (#5869)
* Xbox GDK support (14 squashed commits)

* Added basic keyboard testing

* Update readme

* Code review fixes

* Fixed issue where controller add/removal wasn't working (since the device notification events don't work on Xbox, have to use the joystick thread to poll XInput)
2022-07-01 13:59:14 -07:00
Pierre Wendling 6c536afdb7 Fix C89 declaration for macOS modules.
Since Clang 14, `-Wdeclaration-after-statement` is enforced on every
standard.
2022-06-27 15:19:40 -07:00
Francisco Javier Trujillo Mata 6b03c1adf6 Add filesystem driver 2022-06-15 15:15:26 -07:00
Sam Lantinga aa6ea607d9 Fixed whitespace
Whitespace inconsistencies reported in https://github.com/libsdl-org/SDL/pull/5673
2022-05-18 06:58:14 -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
Ozkan Sezer dfbe1f7248 SDL_GetBasePath() fixes for OS/2 2022-03-17 03:50:02 +03:00
Ozkan Sezer df1474b46e psp/SDL_sysfilesystem.c: fixed a minor compiler warning.
src/filesystem/psp/SDL_sysfilesystem.c: In function 'SDL_GetPrefPath':
src/filesystem/psp/SDL_sysfilesystem.c:71: warning: passing argument 1 of 'free' discards qualifiers from pointer target type
2022-01-08 11:55:10 +03:00
Wouter Wijsman 6d46e30fed Remove extra / in PSP GetPrefPath 2022-01-05 08:29:35 -08:00
Wouter Wijsman 33dccbb381 Make sure GetPrefPath also works without org 2022-01-05 08:29:35 -08:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Francisco Javier Trujillo Mata 13a9cd4797 Adding sysfilesystem driver to PSP 2022-01-02 08:06:04 -08:00
Ozkan Sezer 8d14e6ea44 replaced use of _MAX_PATH with CCHMAXPATH in os/2 code,
it now compiles without HAVE_LIBC
2021-12-08 14:01:02 +03:00
Sylvain aef7105408 Use SDL_free 2021-11-22 08:38:46 -08:00
Sylvain 30338beb61 Minor comment 2021-11-22 08:38:46 -08:00
Sylvain d31251b014 use SDL's functions version inplace of libc version 2021-11-22 08:38:46 -08:00
Cameron Cawley 9ee6942e79 Improve RISC OS implementations of SDL_GetBasePath and SDL_GetPrefPath 2021-10-12 13:07:52 -07:00
Cameron Cawley 3db898c5b6 riscos: Implement SDL_GetPrefPath() 2021-10-12 13:07:52 -07:00
Sam Lantinga 345c161feb Fixed some accidental uses of external C runtime functions 2021-09-22 09:06:45 -07:00
Phillip Trudeau bc7ac134db Windows: Fix SDL_GetBasePath() truncating paths
SDL_GetBasePath grows its path buffer for long paths, but GetModuleFileNameExW always truncates and succeeds,
so `len` was always equal to (buflen - 1) which is 127. This is easily fixed by checking for (buflen - 1) instead of buflen.
For paths longer than MAX_PATH, this problem sometimes got hidden by Windows path shortening ("C:\PROGRA~1\" etc.).

Tested on Windows 10 x64 19041 and 10586.
2021-06-12 23:07:46 -04:00
Ryan C. Gordon 03503423e9
filesystem: Better OpenBSD support for SDL_GetBasePath().
Fixes #3752.
2021-04-19 23:32:45 -04:00
Ivan Epifanov e58a955e68 Deprecate dolcesdk 2021-03-08 09:07:12 -08:00
Ivan Epifanov ca5e5d6154 VITASDK compatibility 2021-03-08 09:07:12 -08:00
Ivan Epifanov 194c813893 Fix filesystem 2021-03-08 09:07:12 -08:00
Ivan Epifanov 41d6c80b07 Filesystem module 2021-03-08 09:07:12 -08:00
Cameron Cawley 391bb80bb9 Replace duplicate functions and lstrlen/lstrcat with SDL string functions 2021-03-05 12:03:58 -08:00
Charlie Birks 1a48ca666f emscripten: Create directory recursively in GetPrefPath 2021-02-13 11:56:01 -05:00
Ozkan Sezer 265a1cc97a use WIN_StringToUTF8W instead of WIN_StringToUTF8 where needed (#2)
cf. bug #5435.
- SDL_wasapi_win32.c (GetWasapiDeviceName): pwszVal is WCHAR*
- windows/SDL_sysfilesystem.c (SDL_GetBasePath, SDL_GetPrefPath)
- windows/SDL_sysurl.c (SDL_SYS_OpenURL): wurl is WCHAR*
- SDL_windowssensor.c (ConnectSensor): bstr_name is WCHAR*
- windows/SDL_systhread.c (SDL_SYS_SetupThread): strw is WCHAR*
2021-01-05 15:50:02 +03:00