From b08462d5559a1d18abd0ba89e1a2353c82cc85c2 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 14 Jan 2024 14:29:13 +0200 Subject: [PATCH] Change default SDL driver name from opengl to empty (autoselection) --- config/schemas/settings.json | 1 + launcher/settingsView/csettingsview_moc.cpp | 2 ++ lib/JsonNode.cpp | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 87f61a70d..be2af9e01 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -199,6 +199,7 @@ }, "driver" : { "type" : "string", + "defaultWindows" : "", "default" : "opengl", "description" : "preferred graphics backend driver name for SDL2" }, diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index edf8d54bd..368ad48f0 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -169,6 +169,8 @@ static QStringList getAvailableRenderingDrivers() SDL_Init(SDL_INIT_VIDEO); QStringList result; + result += QString(); // empty value for autoselection + int driversCount = SDL_GetNumRenderDrivers(); for(int it = 0; it < driversCount; it++) diff --git a/lib/JsonNode.cpp b/lib/JsonNode.cpp index eb3ec93b4..899180dc4 100644 --- a/lib/JsonNode.cpp +++ b/lib/JsonNode.cpp @@ -1289,7 +1289,12 @@ static JsonNode getDefaultValue(const JsonNode & schema, std::string fieldName) #elif defined(VCMI_ANDROID) if (!fieldProps["defaultAndroid"].isNull()) return fieldProps["defaultAndroid"]; -#elif !defined(VCMI_MOBILE) +#elif defined(VCMI_WINDOWS) + if (!fieldProps["defaultWindows"].isNull()) + return fieldProps["defaultWindows"]; +#endif + +#if !defined(VCMI_MOBILE) if (!fieldProps["defaultDesktop"].isNull()) return fieldProps["defaultDesktop"]; #endif