Index: source/ps/GameSetup/HWDetect.cpp =================================================================== --- source/ps/GameSetup/HWDetect.cpp +++ source/ps/GameSetup/HWDetect.cpp @@ -43,10 +43,10 @@ #include "ps/scripting/JSInterface_Debug.h" #include "ps/UserReport.h" #include "ps/VideoMode.h" +#include "SDL_syswm.h" #ifdef SDL_VIDEO_DRIVER_X11 #include -#include "SDL_syswm.h" // Define the GLX_MESA_query_renderer macros if built with // an old Mesa (<10.0) that doesn't provide them @@ -68,6 +68,7 @@ #endif +static void ReportSDL(const ScriptInterface& scriptInterface, JS::HandleValue settings); static void ReportGLLimits(const ScriptInterface& scriptInterface, JS::HandleValue settings); #if ARCH_X86_X64 @@ -284,6 +285,8 @@ scriptInterface.SetProperty(settings, "snd_card", snd_card); scriptInterface.SetProperty(settings, "snd_drv_ver", snd_drv_ver); + ReportSDL(scriptInterface, settings); + ReportGLLimits(scriptInterface, settings); scriptInterface.SetProperty(settings, "video_desktop_xres", g_VideoMode.GetDesktopXRes()); @@ -366,6 +369,59 @@ scriptInterface.CallFunctionVoid(global, "RunHardwareDetection", settings); } +static void ReportSDL(const ScriptInterface& scriptInterface, JS::HandleValue settings) +{ + SDL_SysWMinfo wminfo; + SDL_version linked; + SDL_VERSION(&wminfo.version); + + char version[16]; + sprintf_s(version, 16, "%d.%d.%d", wminfo.version.major, wminfo.version.minor, wminfo.version.patch); + scriptInterface.SetProperty(settings, "sdl2_build_version", version); + + SDL_GetVersion(&linked); + sprintf_s(version, 16, "%d.%d.%d", linked.major, linked.minor, linked.patch); + scriptInterface.SetProperty(settings, "sdl2_runtime_version", version); + + if (!SDL_GetWindowWMInfo(g_VideoMode.GetWindow(), &wminfo)) + { + scriptInterface.SetProperty(settings, "sdl2_video_backend", "unknown"); + return; + } + + std::string backend = "unknown"; + switch (wminfo.subsystem) + { + case SDL_SYSWM_WAYLAND: + backend = "Wayland"; + break; + case SDL_SYSWM_X11: + backend = "X11"; + break; + case SDL_SYSWM_WINDOWS: + backend = "Windows"; + break; + case SDL_SYSWM_COCOA: + backend = "Cocoa"; + break; + case SDL_SYSWM_UIKIT: + backend = "UIKit"; + break; + case SDL_SYSWM_DIRECTFB: + backend = "DirectFB"; + break; +#if SDL_VERSION_ATLEAST(2, 0, 4) + case SDL_SYSWM_ANDROID: + backend = "Android"; + break; +#endif + default: + break; + } + + scriptInterface.SetProperty(settings, "sdl2_video_backend", backend.c_str()); +} + static void ReportGLLimits(const ScriptInterface& scriptInterface, JS::HandleValue settings) { const char* errstr = "(error)";