Index: source/ps/GameSetup/HWDetect.cpp =================================================================== --- source/ps/GameSetup/HWDetect.cpp +++ source/ps/GameSetup/HWDetect.cpp @@ -68,6 +68,7 @@ #endif +static void ReportSDL2(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); + ReportSDL2(scriptInterface, settings); + ReportGLLimits(scriptInterface, settings); scriptInterface.SetProperty(settings, "video_desktop_xres", g_VideoMode.GetDesktopXRes()); @@ -366,6 +369,50 @@ scriptInterface.CallFunctionVoid(global, "RunHardwareDetection", settings); } +static void ReportSDL2(const ScriptInterface& scriptInterface, JS::HandleValue settings) +{ + SDL_SysWMinfo wminfo; + SDL_VERSION(&wminfo.version); + + char version[16]; + sprintf(version, "%d.%d.%d", wminfo.version.major, wminfo.version.minor, wminfo.version.patch); + scriptInterface.SetProperty(settings, "sdl2_version", version); + + int ret = SDL_GetWindowWMInfo(g_VideoMode.GetWindow(), &wminfo); + if (ret) + { + const char* 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_ANDROID: + backend = "Android"; + break; + case SDL_SYSWM_COCOA: + backend = "Cocoa"; + break; + case SDL_SYSWM_UIKIT: + backend = "UIKit"; + break; + case SDL_SYSWM_DIRECTFB: + backend = "DirectFB"; + break; + default: + break; + } + + scriptInterface.SetProperty(settings, "sdl2_video_backend", backend); + } +} + static void ReportGLLimits(const ScriptInterface& scriptInterface, JS::HandleValue settings) { const char* errstr = "(error)";