From d9fad6ab5546b82e3a4d65ad0f2ccd6d0698b698 Mon Sep 17 00:00:00 2001 From: Benau Date: Tue, 8 Nov 2022 09:10:41 +0800 Subject: [PATCH] Don't exit if SDL_GetWindowWMInfo fails --- .../source/Irrlicht/CIrrDeviceSDL.cpp | 20 +++++++++++++++++-- lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp index 1dfef29db..88df161f5 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp @@ -127,9 +127,14 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) { SDL_VERSION(&Info.version); +#if (defined(IOS_STK) || defined(_IRR_COMPILE_WITH_DIRECT3D_9_)) && !defined(__SWITCH__) + // Only iOS or DirectX9 build uses the Info structure // Switch doesn't support GetWindowWMInfo -#ifndef __SWITCH__ +#ifdef IOS_STK if (!SDL_GetWindowWMInfo(Window, &Info)) +#else + if (CreationParams.DriverType == video::EDT_DIRECT3D9 && !SDL_GetWindowWMInfo(Window, &Info)) +#endif return; #endif #ifdef IOS_STK @@ -138,7 +143,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) #ifdef ANDROID Android_initDisplayCutout(&TopPadding, &BottomPadding, &LeftPadding, &RightPadding, &InitialOrientation); #endif - core::stringc sdlversion = "SDL Version "; + core::stringc sdlversion = "Compiled SDL Version "; sdlversion += Info.version.major; sdlversion += "."; sdlversion += Info.version.minor; @@ -147,6 +152,17 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param) Operator = new COSOperator(sdlversion); os::Printer::log(sdlversion.c_str(), ELL_INFORMATION); + + core::stringc cur_sdlversion = "Current SDL Version "; + SDL_version version = {}; + SDL_GetVersion(&version); + cur_sdlversion += version.major; + cur_sdlversion += "."; + cur_sdlversion += version.minor; + cur_sdlversion += "."; + cur_sdlversion += version.patch; + + os::Printer::log(cur_sdlversion.c_str(), ELL_INFORMATION); #if SDL_VERSION_ATLEAST(2, 0, 9) for (int i = 0; i < SDL_NumSensors(); i++) { diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h index af1940961..fd4e8e369 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.h @@ -114,7 +114,9 @@ class MoltenVK; SDL_Window* getWindow() const { return Window; } +#ifdef IOS_STK const SDL_SysWMinfo& getWMInfo() const { return Info; } +#endif virtual s32 getTopPadding();