mirror of https://github.com/libsdl-org/SDL.git
Compare commits
11 Commits
c05d3f625e
...
6a02aa6297
| Author | SHA1 | Date |
|---|---|---|
|
|
6a02aa6297 | |
|
|
9ed83e71f6 | |
|
|
603118c340 | |
|
|
aa4f916b71 | |
|
|
6cfe211142 | |
|
|
274aa0242e | |
|
|
af8bee2dd1 | |
|
|
bbc674b9e7 | |
|
|
796961acec | |
|
|
3a6f9e01f8 | |
|
|
eb7df4807f |
161
CMakeLists.txt
161
CMakeLists.txt
|
|
@ -7,6 +7,11 @@ endif()
|
|||
# See docs/release_checklist.md
|
||||
project(SDL3 LANGUAGES C VERSION "3.3.0")
|
||||
|
||||
if(GDK_GAMING_XBOX)
|
||||
# FIXME: Setting the standard of individual files doesn't seem to work properly
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDL3_MAINPROJECT ON)
|
||||
else()
|
||||
|
|
@ -331,8 +336,8 @@ dep_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON "SD
|
|||
dep_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON "SDL_AUDIO" OFF)
|
||||
dep_option(SDL_DUMMYVIDEO "Use dummy video driver" ON "SDL_VIDEO" OFF)
|
||||
dep_option(SDL_IBUS "Enable IBus support" ON "${UNIX_SYS}" OFF)
|
||||
dep_option(SDL_OPENGL "Include OpenGL support" ON "SDL_VIDEO;NOT IOS;NOT VISIONOS;NOT TVOS;NOT WATCHOS" OFF)
|
||||
dep_option(SDL_OPENGLES "Include OpenGL ES support" ON "SDL_VIDEO;NOT VISIONOS;NOT TVOS;NOT WATCHOS" OFF)
|
||||
dep_option(SDL_OPENGL "Include OpenGL support" ON "SDL_VIDEO;NOT IOS;NOT VISIONOS;NOT TVOS;NOT WATCHOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_OPENGLES "Include OpenGL ES support" ON "SDL_VIDEO;NOT VISIONOS;NOT TVOS;NOT WATCHOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_DEFAULT})
|
||||
dep_option(SDL_PTHREADS_SEM "Use pthread semaphores" ON "SDL_PTHREADS" OFF)
|
||||
dep_option(SDL_OSS "Support the OSS audio API" ${SDL_OSS_DEFAULT} "UNIX_SYS OR RISCOS;SDL_AUDIO" OFF)
|
||||
|
|
@ -375,8 +380,8 @@ dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SD
|
|||
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
|
||||
dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF)
|
||||
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
|
||||
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
|
||||
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF)
|
||||
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_METAL "Enable Metal support" ON "APPLE" OFF)
|
||||
set_option(SDL_OPENVR "Use OpenVR video driver" OFF)
|
||||
dep_option(SDL_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS} "SDL_VIDEO" OFF)
|
||||
|
|
@ -385,11 +390,11 @@ set_option(SDL_OFFSCREEN "Use offscreen video driver" ON)
|
|||
dep_option(SDL_DUMMYCAMERA "Support the dummy camera driver" ON SDL_CAMERA OFF)
|
||||
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" OFF)
|
||||
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" OFF)
|
||||
dep_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON "NOT VISIONOS" OFF)
|
||||
dep_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON "NOT VISIONOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" ON SDL_HIDAPI_LIBUSB_AVAILABLE OFF)
|
||||
dep_option(SDL_HIDAPI_LIBUSB_SHARED "Dynamically load libusb support" ON "SDL_HIDAPI_LIBUSB;SDL_DEPS_SHARED" OFF)
|
||||
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
|
||||
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
|
||||
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON "SDL_HIDAPI OR GDK_GAMING_XBOX" OFF)
|
||||
set_option(SDL_LIBUDEV "Enable libudev support" ON)
|
||||
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
|
||||
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
|
||||
|
|
@ -441,6 +446,32 @@ if(SDL_PRESEED)
|
|||
SDL_Preseed_CMakeCache()
|
||||
endif()
|
||||
|
||||
if(GDK_GAMING_XBOX)
|
||||
if(GDK_GAMING_XBOX_ONE)
|
||||
message(STATUS "Building shader blobs (Xbox One)")
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/render/direct3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} one"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/gpu/d3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} one"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
elseif(GDK_GAMING_XBOX_SCARLETT)
|
||||
message(STATUS "Building shader blobs (Xbox Series)")
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/render/direct3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/gpu/d3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown Xbox system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_SHARED)
|
||||
add_library(SDL3-shared SHARED)
|
||||
add_library(SDL3::SDL3-shared ALIAS SDL3-shared)
|
||||
|
|
@ -1055,6 +1086,10 @@ if(SDL_LIBC)
|
|||
strcasestr
|
||||
)
|
||||
endif()
|
||||
if(GDK_GAMING_XBOX)
|
||||
list(REMOVE_ITEM symbols_to_check itoa)
|
||||
endif()
|
||||
|
||||
check_library_exists(m pow "" HAVE_LIBM)
|
||||
cmake_push_check_state()
|
||||
if(HAVE_LIBM)
|
||||
|
|
@ -1922,6 +1957,9 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.cpp")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/main/gdk/SDL_sysmain_runapp.cpp")
|
||||
endif()
|
||||
|
||||
if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC)
|
||||
# Prevent codegen that would use the VC runtime libraries.
|
||||
|
|
@ -1955,10 +1993,19 @@ elseif(WINDOWS)
|
|||
check_include_file(ddraw.h HAVE_DDRAW_H)
|
||||
check_include_file(dsound.h HAVE_DSOUND_H)
|
||||
check_include_file(dinput.h HAVE_DINPUT_H)
|
||||
check_include_file(dxgi.h HAVE_DXGI_H)
|
||||
# FIXME: Not sure why, avoiding the above still keeps "HAVE_DDRAW_H" and friends being 1?
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_D3D9_H 0)
|
||||
set(HAVE_D3D11_H 0)
|
||||
set(HAVE_DDRAW_H 0)
|
||||
set(HAVE_DSOUND_H 0)
|
||||
set(HAVE_DINPUT_H 0)
|
||||
set(HAVE_DXGI_H 0)
|
||||
endif()
|
||||
if(SDL_CPU_ARM32) # !!! FIXME: this should probably check if we're !(x86 or x86-64) instead of arm.
|
||||
set(HAVE_DINPUT_H 0)
|
||||
endif()
|
||||
check_include_file(dxgi.h HAVE_DXGI_H)
|
||||
cmake_pop_check_state()
|
||||
if(HAVE_D3D9_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
|
||||
set(HAVE_DIRECTX TRUE)
|
||||
|
|
@ -1989,6 +2036,10 @@ elseif(WINDOWS)
|
|||
static __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2;
|
||||
int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H
|
||||
)
|
||||
# FIXME: Avoiding the check above still marks it as 1
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_WINDOWS_GAMING_INPUT_H 0)
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <stdbool.h>
|
||||
#define COBJMACROS
|
||||
|
|
@ -2003,6 +2054,11 @@ elseif(WINDOWS)
|
|||
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
|
||||
check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H)
|
||||
check_include_file(shobjidl_core.h HAVE_SHOBJIDL_CORE_H)
|
||||
# FIXME: removing the checks didn't work?
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_ROAPI_H 0)
|
||||
set(HAVE_SHELLSCALINGAPI_H 0)
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <windows.h>
|
||||
#include <mfapi.h>
|
||||
|
|
@ -2034,17 +2090,35 @@ elseif(WINDOWS)
|
|||
|
||||
CheckOpenVR()
|
||||
|
||||
if(SDL_RENDER_D3D AND HAVE_D3D9_H)
|
||||
if(SDL_RENDER_D3D AND HAVE_D3D9_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_VIDEO_RENDER_D3D 1)
|
||||
set(HAVE_RENDER_D3D TRUE)
|
||||
endif()
|
||||
if(SDL_RENDER_D3D11 AND HAVE_D3D11_H)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/render/direct3d/SDL_render_d3d.c" PROPERTIES LANGUAGE CXX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/video/gdk/SDL_gdktextinput.cpp")
|
||||
endif()
|
||||
if(SDL_RENDER_D3D11 AND HAVE_D3D11_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_VIDEO_RENDER_D3D11 1)
|
||||
set(HAVE_RENDER_D3D11 TRUE)
|
||||
endif()
|
||||
if(SDL_RENDER_D3D12)
|
||||
set(SDL_VIDEO_RENDER_D3D12 1)
|
||||
set(HAVE_RENDER_D3D12 TRUE)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_render_d3d12.c" PROPERTIES LANGUAGE CXX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_render_d3d12_xbox.cpp")
|
||||
if(GDK_GAMING_XBOX_ONE)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp")
|
||||
# TODO: This should also happen for "SDL_GPU && !(SDL_RENDER)"
|
||||
sdl_link_dependency(d3d12 LIBS d3d12_x.lib)
|
||||
elseif(GDK_GAMING_XBOX_SCARLETT)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp")
|
||||
sdl_link_dependency(d3d12 LIBS d3d12_xs.lib)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown Xbox system")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(HAVE_SDL_VIDEO TRUE)
|
||||
endif()
|
||||
|
|
@ -2065,14 +2139,18 @@ elseif(WINDOWS)
|
|||
|
||||
set(HAVE_SDL_THREADS TRUE)
|
||||
|
||||
if(SDL_SENSOR AND HAVE_SENSORSAPI_H)
|
||||
if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_SENSOR_WINDOWS 1)
|
||||
set(HAVE_SDL_SENSORS TRUE)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/sensor/windows/*.c")
|
||||
endif()
|
||||
|
||||
if(SDL_POWER)
|
||||
set(SDL_POWER_WINDOWS 1)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(SDL_POWER_HARDWIRED 1)
|
||||
else()
|
||||
set(SDL_POWER_WINDOWS 1)
|
||||
endif()
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c")
|
||||
set(HAVE_SDL_POWER TRUE)
|
||||
endif()
|
||||
|
|
@ -2080,8 +2158,15 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/windows/*.c")
|
||||
set(HAVE_SDL_LOCALE TRUE)
|
||||
|
||||
set(SDL_FILESYSTEM_WINDOWS 1)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c")
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
set(SDL_FILESYSTEM_WINDOWS 1)
|
||||
endif()
|
||||
file(GLOB SDL3_WIN_FILESYSTEM_FILES "${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
list(REMOVE_ITEM SDL3_WIN_FILESYSTEM_FILES "${SDL3_SOURCE_DIR}/src/filesystem/windows/SDL_sysfilesystem.c")
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/filesystem/gdk/SDL_sysfilesystem.cpp")
|
||||
endif()
|
||||
sdl_glob_sources("${SDL3_WIN_FILESYSTEM_FILES}")
|
||||
set(HAVE_SDL_FILESYSTEM TRUE)
|
||||
|
||||
set(SDL_FSOPS_WINDOWS 1)
|
||||
|
|
@ -2094,7 +2179,14 @@ elseif(WINDOWS)
|
|||
set(HAVE_SDL_STORAGE 1)
|
||||
|
||||
# Libraries for Win32 native and MinGW
|
||||
sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
||||
if(GDK_GAMING_XBOX)
|
||||
add_link_options("/NODEFAULTLIB")
|
||||
# Needed to inherit base dependencies, specifically to link XblInitialize correctly
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "$(CMAKE_CXX_STANDARD_LIBRARIES) %(AdditionalDependencies) ")
|
||||
sdl_link_dependency(base LIBS xgameplatform xgameruntime xmem pixevt)
|
||||
else()
|
||||
sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
||||
endif()
|
||||
|
||||
set(SDL_TIME_WINDOWS 1)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/time/windows/*.c")
|
||||
|
|
@ -2109,6 +2201,10 @@ elseif(WINDOWS)
|
|||
set(HAVE_SDL_LOADSO TRUE)
|
||||
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/core/gdk/SDL_gdk.cpp")
|
||||
# sdl_sources("${SDL3_SOURCE_DIR}/src/core/windows/pch_cpp.cpp")
|
||||
endif()
|
||||
|
||||
if(SDL_VIDEO)
|
||||
if(SDL_OPENGL)
|
||||
|
|
@ -2134,8 +2230,10 @@ elseif(WINDOWS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/tray/windows/*.c")
|
||||
set(HAVE_SDL_TRAY TRUE)
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/tray/windows/*.c")
|
||||
set(HAVE_SDL_TRAY TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_HIDAPI)
|
||||
|
|
@ -2144,23 +2242,37 @@ elseif(WINDOWS)
|
|||
|
||||
if(SDL_JOYSTICK)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/windows/*.c")
|
||||
if (GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/joystick/windows/SDL_windowsjoystick.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/joystick/windows/SDL_xinputjoystick.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/SDL_gameinputjoystick.c")
|
||||
endif()
|
||||
|
||||
set(SDL_JOYSTICK_RAWINPUT 1)
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_RAWINPUT 1)
|
||||
endif()
|
||||
if(HAVE_DINPUT_H)
|
||||
set(SDL_JOYSTICK_DINPUT 1)
|
||||
sdl_link_dependency(joystick LIBS dinput8)
|
||||
endif()
|
||||
if(HAVE_XINPUT_H)
|
||||
if(HAVE_XINPUT_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_XINPUT 1)
|
||||
set(HAVE_XINPUT TRUE)
|
||||
endif()
|
||||
if(HAVE_WINDOWS_GAMING_INPUT_H)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/core/windows/SDL_xinput.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
if(HAVE_WINDOWS_GAMING_INPUT_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_WGI 1)
|
||||
endif()
|
||||
if(HAVE_GAMEINPUT_H)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/*.cpp")
|
||||
set(SDL_JOYSTICK_GAMEINPUT 1)
|
||||
endif()
|
||||
if(GDK_GAMING_DESKTOP OR GDK_GAMING_XBOX)
|
||||
set(SDL_GDK_TEXTINPUT 1)
|
||||
set(SDL_DISABLE_WINDOWS_IME 1)
|
||||
endif()
|
||||
set(HAVE_SDL_JOYSTICK TRUE)
|
||||
|
||||
if(SDL_HAPTIC)
|
||||
|
|
@ -2168,6 +2280,9 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/haptic/windows/*.c")
|
||||
set(SDL_HAPTIC_DINPUT 1)
|
||||
set(HAVE_SDL_HAPTIC TRUE)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/haptic/windows/SDL_windowshaptic.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -3041,7 +3156,7 @@ if (SDL_DIALOG)
|
|||
elseif(HAIKU)
|
||||
sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/haiku/SDL_haikudialog.cc)
|
||||
set(HAVE_SDL_DIALOG TRUE)
|
||||
elseif(WINDOWS)
|
||||
elseif(WINDOWS AND NOT GDK_GAMING_XBOX)
|
||||
sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/windows/SDL_windowsdialog.c)
|
||||
set(HAVE_SDL_DIALOG TRUE)
|
||||
elseif(MACOS)
|
||||
|
|
@ -3051,7 +3166,7 @@ if (SDL_DIALOG)
|
|||
endif()
|
||||
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/process/SDL_process.c")
|
||||
if(WINDOWS)
|
||||
if(WINDOWS AND NOT GDK_GAMING_XBOX)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/windows/*.c")
|
||||
set(SDL_PROCESS_WINDOWS 1)
|
||||
set(HAVE_SDL_PROCESS TRUE)
|
||||
|
|
@ -3120,6 +3235,10 @@ if(SDL_GPU)
|
|||
endif()
|
||||
if(WINDOWS)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.c")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.cpp")
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/gpu/d3d12/SDL_gpu_d3d12.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
set(SDL_GPU_D3D12 1)
|
||||
set(HAVE_SDL_GPU TRUE)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1064,6 +1064,17 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
|
|||
/**
|
||||
* Get the properties associated with an audio stream.
|
||||
*
|
||||
* The application can hang any data it wants here, but the following
|
||||
* properties are understood by SDL:
|
||||
*
|
||||
* - `SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN`: if true (the default), the
|
||||
* stream be automatically cleaned up when the audio subsystem quits. If set
|
||||
* to false, the streams will persist beyond that. This property is ignored
|
||||
* for streams created through SDL_OpenAudioDeviceStream(), and will always
|
||||
* be cleaned up. Streams that are not cleaned up will still be unbound from
|
||||
* devices when the audio subsystem quits. This property was added in SDL
|
||||
* 3.4.0.
|
||||
*
|
||||
* \param stream the SDL_AudioStream to query.
|
||||
* \returns a valid property ID on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
|
|
@ -1074,6 +1085,9 @@ extern SDL_DECLSPEC SDL_AudioStream * SDLCALL SDL_CreateAudioStream(const SDL_Au
|
|||
*/
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_AudioStream *stream);
|
||||
|
||||
#define SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN "SDL.audiostream.auto_cleanup"
|
||||
|
||||
|
||||
/**
|
||||
* Query the current format of an audio stream.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1073,9 +1073,16 @@ void SDL_QuitAudio(void)
|
|||
|
||||
current_audio.impl.DeinitializeStart();
|
||||
|
||||
// Destroy any audio streams that still exist...
|
||||
while (current_audio.existing_streams) {
|
||||
SDL_DestroyAudioStream(current_audio.existing_streams);
|
||||
// Destroy any audio streams that still exist...unless app asked to keep it.
|
||||
SDL_AudioStream *next = NULL;
|
||||
for (SDL_AudioStream *i = current_audio.existing_streams; i; i = next) {
|
||||
next = i->next;
|
||||
if (i->simplified || SDL_GetBooleanProperty(i->props, SDL_PROP_AUDIOSTREAM_AUTO_CLEANUP_BOOLEAN, true)) {
|
||||
SDL_DestroyAudioStream(i);
|
||||
} else {
|
||||
i->prev = NULL;
|
||||
i->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_LockRWLockForWriting(current_audio.device_hash_lock);
|
||||
|
|
|
|||
|
|
@ -1157,7 +1157,7 @@ static bool ALSA_OpenDevice(SDL_AudioDevice *device)
|
|||
#if SDL_ALSA_DEBUG
|
||||
snd_pcm_uframes_t bufsize;
|
||||
ALSA_snd_pcm_hw_params_get_buffer_size(cfg_ctx.hwparams, &bufsize);
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO,
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO,
|
||||
"ALSA: period size = %ld, periods = %u, buffer size = %lu",
|
||||
cfg_ctx.persize, cfg_ctx.periods, bufsize);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -928,13 +928,14 @@ static bool SetIMUEnabled(SDL_DriverSwitch_Context *ctx, bool enabled)
|
|||
|
||||
static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
||||
{
|
||||
Uint8 *pLeftStickCal;
|
||||
Uint8 *pRightStickCal;
|
||||
Uint8 *pLeftStickCal = NULL;
|
||||
Uint8 *pRightStickCal = NULL;
|
||||
size_t stick, axis;
|
||||
SwitchSubcommandInputPacket_t *user_reply = NULL;
|
||||
SwitchSubcommandInputPacket_t *factory_reply = NULL;
|
||||
SwitchSPIOpData_t readUserParams;
|
||||
SwitchSPIOpData_t readFactoryParams;
|
||||
Uint8 userParamsReadSuccessCount = 0;
|
||||
|
||||
// Read User Calibration Info
|
||||
readUserParams.unAddress = k_unSPIStickUserCalibrationStartOffset;
|
||||
|
|
@ -947,39 +948,52 @@ static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
|
||||
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
|
||||
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0; ; ++attempt) {
|
||||
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (factory_reply->stickFactoryCalibration.opData.unAddress == k_unSPIStickFactoryCalibrationStartOffset) {
|
||||
// We successfully read the calibration data
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempt == MAX_ATTEMPTS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically select the user calibration if magic bytes are set
|
||||
if (user_reply && user_reply->stickUserCalibration.rgucLeftMagic[0] == 0xB2 && user_reply->stickUserCalibration.rgucLeftMagic[1] == 0xA1) {
|
||||
userParamsReadSuccessCount += 1;
|
||||
pLeftStickCal = user_reply->stickUserCalibration.rgucLeftCalibration;
|
||||
} else {
|
||||
pLeftStickCal = factory_reply->stickFactoryCalibration.rgucLeftCalibration;
|
||||
}
|
||||
|
||||
if (user_reply && user_reply->stickUserCalibration.rgucRightMagic[0] == 0xB2 && user_reply->stickUserCalibration.rgucRightMagic[1] == 0xA1) {
|
||||
userParamsReadSuccessCount += 1;
|
||||
pRightStickCal = user_reply->stickUserCalibration.rgucRightCalibration;
|
||||
} else {
|
||||
pRightStickCal = factory_reply->stickFactoryCalibration.rgucRightCalibration;
|
||||
}
|
||||
|
||||
// Only read the factory calibration info if we failed to receive the correct magic bytes
|
||||
if (userParamsReadSuccessCount < 2) {
|
||||
// Read Factory Calibration Info
|
||||
readFactoryParams.unAddress = k_unSPIStickFactoryCalibrationStartOffset;
|
||||
readFactoryParams.ucLength = k_unSPIStickFactoryCalibrationLength;
|
||||
|
||||
const int MAX_ATTEMPTS = 3;
|
||||
for (int attempt = 0;; ++attempt) {
|
||||
if (!WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SPIFlashRead, (uint8_t *)&readFactoryParams, sizeof(readFactoryParams), &factory_reply)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (factory_reply->stickFactoryCalibration.opData.unAddress == k_unSPIStickFactoryCalibrationStartOffset) {
|
||||
// We successfully read the calibration data
|
||||
pLeftStickCal = factory_reply->stickFactoryCalibration.rgucLeftCalibration;
|
||||
pRightStickCal = factory_reply->stickFactoryCalibration.rgucRightCalibration;
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempt == MAX_ATTEMPTS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we still don't have calibration data, return false
|
||||
if (pLeftStickCal == NULL || pRightStickCal == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Stick calibration values are 12-bits each and are packed by bit
|
||||
* For whatever reason the fields are in a different order for each stick
|
||||
* Left: X-Max, Y-Max, X-Center, Y-Center, X-Min, Y-Min
|
||||
* Right: X-Center, Y-Center, X-Max, Y-Max, X-Min, Y-Min
|
||||
* Right: X-Center, Y-Center, X-Min, Y-Min, X-Max, Y-Max
|
||||
*/
|
||||
|
||||
// Left stick
|
||||
|
|
@ -993,10 +1007,10 @@ static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
// Right stick
|
||||
ctx->m_StickCalData[1].axis[0].sCenter = ((pRightStickCal[1] << 8) & 0xF00) | pRightStickCal[0]; // X Axis center
|
||||
ctx->m_StickCalData[1].axis[1].sCenter = (pRightStickCal[2] << 4) | (pRightStickCal[1] >> 4); // Y Axis center
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; // X Axis max above center
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); // Y Axis max above center
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; // X Axis min below center
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); // Y Axis min below center
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; // X Axis min below center
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); // Y Axis min below center
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; // X Axis max above center
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); // Y Axis max above center
|
||||
|
||||
// Filter out any values that were uninitialized (0xFFF) in the SPI read
|
||||
for (stick = 0; stick < 2; ++stick) {
|
||||
|
|
|
|||
|
|
@ -588,88 +588,51 @@ static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
|
|||
}
|
||||
}
|
||||
|
||||
static uint32_t KMSDRM_CrtcGetPropId(uint32_t drm_fd,
|
||||
drmModeObjectPropertiesPtr props,
|
||||
char const *name)
|
||||
static bool KMSDRM_ConnectorCheckVrrCapable(uint32_t drm_fd, uint32_t output_id)
|
||||
{
|
||||
uint32_t i, prop_id = 0;
|
||||
|
||||
for (i = 0; !prop_id && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop =
|
||||
KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SDL_strcmp(drm_prop->name, name) == 0) {
|
||||
prop_id = drm_prop->prop_id;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
}
|
||||
|
||||
return prop_id;
|
||||
}
|
||||
|
||||
static bool KMSDRM_VrrPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *vrr_prop_id)
|
||||
{
|
||||
drmModeObjectPropertiesPtr drm_props;
|
||||
|
||||
drm_props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC);
|
||||
|
||||
if (!drm_props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vrr_prop_id = KMSDRM_CrtcGetPropId(drm_fd,
|
||||
drm_props,
|
||||
"VRR_ENABLED");
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(drm_props);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool KMSDRM_ConnectorCheckVrrCapable(uint32_t drm_fd,
|
||||
uint32_t output_id,
|
||||
char const *name)
|
||||
{
|
||||
uint32_t i;
|
||||
bool found = false;
|
||||
uint64_t prop_value = 0;
|
||||
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
output_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, output_id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcasecmp(prop->name, "VRR_CAPABLE") == 0) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_strcasecmp(drm_prop->name, name) == 0) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
if (found) {
|
||||
return prop_value ? true : false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool KMSDRM_VrrPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *vrr_prop_id)
|
||||
{
|
||||
bool found = false;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcmp(prop->name, "VRR_ENABLED") == 0) {
|
||||
*vrr_prop_id = prop->prop_id;
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
static void KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, bool enabled)
|
||||
{
|
||||
uint32_t vrr_prop_id;
|
||||
|
|
@ -677,119 +640,67 @@ static void KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, bool enabled)
|
|||
return;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeObjectSetProperty(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC,
|
||||
vrr_prop_id,
|
||||
enabled);
|
||||
KMSDRM_drmModeObjectSetProperty(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC, vrr_prop_id, enabled);
|
||||
}
|
||||
|
||||
static bool KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id)
|
||||
{
|
||||
uint32_t object_prop_id, vrr_prop_id;
|
||||
drmModeObjectPropertiesPtr props;
|
||||
bool object_prop_value;
|
||||
int i;
|
||||
uint32_t vrr_prop_id = 0;
|
||||
bool found = false;
|
||||
uint64_t prop_value = 0;
|
||||
|
||||
if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CRTC);
|
||||
|
||||
if (!props) {
|
||||
return false;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (prop->prop_id == vrr_prop_id) {
|
||||
prop_value = props->prop_values[i];
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
}
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
|
||||
for (i = 0; i < props->count_props; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
object_prop_id = drm_prop->prop_id;
|
||||
object_prop_value = props->prop_values[i] ? true : false;
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
|
||||
if (object_prop_id == vrr_prop_id) {
|
||||
return object_prop_value;
|
||||
}
|
||||
if (found) {
|
||||
return prop_value ? true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool KMSDRM_OrientationPropId(uint32_t drm_fd, uint32_t crtc_id, uint32_t *orientation_prop_id)
|
||||
{
|
||||
drmModeObjectPropertiesPtr drm_props;
|
||||
|
||||
drm_props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!drm_props) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*orientation_prop_id = KMSDRM_CrtcGetPropId(drm_fd,
|
||||
drm_props,
|
||||
"panel orientation");
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(drm_props);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int KMSDRM_CrtcGetOrientation(uint32_t drm_fd, uint32_t crtc_id)
|
||||
{
|
||||
uint32_t orientation_prop_id;
|
||||
drmModeObjectPropertiesPtr props;
|
||||
int i;
|
||||
bool done = false;
|
||||
bool found = false;
|
||||
int orientation = 0;
|
||||
|
||||
if (!KMSDRM_OrientationPropId(drm_fd, crtc_id, &orientation_prop_id)) {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
props = KMSDRM_drmModeObjectGetProperties(drm_fd,
|
||||
crtc_id,
|
||||
DRM_MODE_OBJECT_CONNECTOR);
|
||||
|
||||
if (!props) {
|
||||
return orientation;
|
||||
}
|
||||
|
||||
for (i = 0; i < props->count_props && !done; ++i) {
|
||||
drmModePropertyPtr drm_prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
|
||||
if (!drm_prop) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (drm_prop->prop_id == orientation_prop_id && (drm_prop->flags & DRM_MODE_PROP_ENUM)) {
|
||||
if (drm_prop->count_enums) {
|
||||
// "Normal" is the default of no rotation (0 degrees)
|
||||
if (SDL_strcmp(drm_prop->enums[0].name, "Left Side Up") == 0) {
|
||||
orientation = 90;
|
||||
} else if (SDL_strcmp(drm_prop->enums[0].name, "Upside Down") == 0) {
|
||||
orientation = 180;
|
||||
} else if (SDL_strcmp(drm_prop->enums[0].name, "Right Side Up") == 0) {
|
||||
orientation = 270;
|
||||
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(drm_fd, crtc_id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
if (props) {
|
||||
for (uint32_t i = 0; !found && i < props->count_props; ++i) {
|
||||
drmModePropertyPtr prop = KMSDRM_drmModeGetProperty(drm_fd, props->props[i]);
|
||||
if (prop) {
|
||||
if (SDL_strcasecmp(prop->name, "panel orientation") == 0 && (prop->flags & DRM_MODE_PROP_ENUM)) {
|
||||
if (prop->count_enums) {
|
||||
// "Normal" is the default of no rotation (0 degrees)
|
||||
if (SDL_strcmp(prop->enums[0].name, "Left Side Up") == 0) {
|
||||
orientation = 90;
|
||||
} else if (SDL_strcmp(prop->enums[0].name, "Upside Down") == 0) {
|
||||
orientation = 180;
|
||||
} else if (SDL_strcmp(prop->enums[0].name, "Right Side Up") == 0) {
|
||||
orientation = 270;
|
||||
}
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
KMSDRM_drmModeFreeProperty(prop);
|
||||
}
|
||||
|
||||
done = true;
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeProperty(drm_prop);
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
}
|
||||
|
||||
KMSDRM_drmModeFreeObjectProperties(props);
|
||||
|
||||
return orientation;
|
||||
}
|
||||
|
||||
|
|
@ -964,7 +875,7 @@ static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connecto
|
|||
// save previous vrr state
|
||||
dispdata->saved_vrr = KMSDRM_CrtcGetVrr(viddata->drm_fd, crtc->crtc_id);
|
||||
// try to enable vrr
|
||||
if (KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id, "VRR_CAPABLE")) {
|
||||
if (KMSDRM_ConnectorCheckVrrCapable(viddata->drm_fd, connector->connector_id)) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Enabling VRR");
|
||||
KMSDRM_CrtcSetVrr(viddata->drm_fd, crtc->crtc_id, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ add_sdl_test_executable(testdialog SOURCES testdialog.c)
|
|||
add_sdl_test_executable(testtime SOURCES testtime.c)
|
||||
add_sdl_test_executable(testmanymouse SOURCES testmanymouse.c)
|
||||
add_sdl_test_executable(testmodal SOURCES testmodal.c)
|
||||
add_sdl_test_executable(testtray SOURCES testtray.c)
|
||||
add_sdl_test_executable(testtray NEEDS_RESOURCES TESTUTILS SOURCES testtray.c)
|
||||
|
||||
|
||||
add_sdl_test_executable(testprocess
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#include "testutils.h"
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_main.h>
|
||||
#include <SDL3/SDL_test.h>
|
||||
|
|
@ -520,14 +521,17 @@ int main(int argc, char **argv)
|
|||
goto quit;
|
||||
}
|
||||
|
||||
/* TODO: Resource paths? */
|
||||
SDL_Surface *icon = SDL_LoadBMP("../test/sdl-test_round.bmp");
|
||||
char *icon1filename = GetResourceFilename(NULL, "sdl-test_round.bmp");
|
||||
SDL_Surface *icon = SDL_LoadBMP(icon1filename);
|
||||
SDL_free(icon1filename);
|
||||
|
||||
if (!icon) {
|
||||
SDL_Log("Couldn't load icon 1, proceeding without: %s", SDL_GetError());
|
||||
}
|
||||
|
||||
SDL_Surface *icon2 = SDL_LoadBMP("../test/speaker.bmp");
|
||||
char *icon2filename = GetResourceFilename(NULL, "speaker.bmp");
|
||||
SDL_Surface *icon2 = SDL_LoadBMP(icon2filename);
|
||||
SDL_free(icon2filename);
|
||||
|
||||
if (!icon2) {
|
||||
SDL_Log("Couldn't load icon 2, proceeding without: %s", SDL_GetError());
|
||||
|
|
|
|||
Loading…
Reference in New Issue