-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SDL3 #621
Support SDL3 #621
Conversation
.. except where SDL_Swap* is actually used (idlib/Lib.cpp). Otherwise #if D3_IS_BIG_ENDIAN suffices, (NOT #ifdef, it's always set, but to either 0 or 1!)
TextInput doesn't work with SDL3 yet, and non-Linux(-y) platforms like macOS or Windows don't support SDL3 yet
a SDL_SyncWindow() was missing, and the return value of SDL_SetWIndowFullscreen() has changed
- use SDL_SetHint() to set the video driver to "dummy" for the dedicated server - adjustments for some more functions that now return bool instead of int. I hope I found all cases of that now, at least in the generic and Linux code, may have to take a closer look at Windows- and Mac- specific code
Refactored the pseudo-custom SDL_main code a bit: SDL_win32_main.c is now only used for SDL1.2, SDL2 and SDL3 have a WinMain() function in win_main.cpp that works pretty much like the SDL2 SDL_main or SDL3 SDL_RunApp() code - except that the argv[] strings passed to the Doom3 main() function (now renamed to SDL_main()) are encoded in ANSI instead of UTF-8, so paths passed as commandline arguments, like dhewm3 +set fs_basepath C:\SüperGämes\Doom3 work with the Win32 ANSI function used by Doom3 to handle paths and files. For this I also moved the stdout/stderr redirection code from SDL_win32_main.c to win_main.cpp and cleaned it up a bit
.. mostly by not making it use SDL_main.h, because it implements its own SDL main functionality anyway. However, I have no way to test this code and as long as SDL3 is not in homebrew testing it in the CI build isn't easy either.
Ok, as far as I can tell this works on Linux and Windows, and at least doesn't break the SDL2 Mac build (I don't have a Mac, so I can't properly test anything, and even testing if it builds with SDL3 by using the Github Testbuilds is currently too much work because homebrew doesn't have SDL3 yet). |
Here's a Windows build for testing current dhewm3 with SDL3: dhewm3-1.5.5pre-win32_SDL3.zip |
r_fillWindowAlphaChan is a hack to work around an older issue with Wayland/Mesa, which has been fixed in Mesa 24.1 (and also seems to work with current NVIDIA drivers). Additionally, in SDL3 the EGL-specific (and thus mostly only affecting Wayland) SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY has been replaced with the generic SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN (that could also affect other platforms), so it's harder to enable this only for Wayland. I think most people using SDL3 will use a recent Mesa/driver versions, so I don't enable it by default for SDL3 (SDL2 behaves like before). However, with `r_fillWindowAlphaChan 1` the hack can be enabled anyway (r_fillWindowAlphaChan defaults to "-1" which means "let dhewm3 decide whether to enable this")
Port dhewm3 to SDL3, while still supporting SDL2 and even SDL1.2.
Seems to work well on Linux (and probably BSD and similar), but other platforms are still TODO.
Will probably only make Windows work and try to make Mac work; no idea if SDL3 (or SDL2, for that matter..) even supports AROS.