From 390b5caaaacc7ba504d87331dad116208d90a6e7 Mon Sep 17 00:00:00 2001 From: ROllerozxa Date: Sun, 8 Jan 2023 14:04:17 +0100 Subject: [PATCH] Fix crash on Android with IrrlichtMt9 (#13123) Caused by mouse control --- src/client/clientlauncher.cpp | 7 +++++-- src/client/game.cpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index 94d2a38c9..843c7ad32 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -548,15 +548,18 @@ void ClientLauncher::main_menu(MainMenuData *menudata) } infostream << "Waited for other menus" << std::endl; - // Cursor can be non-visible when coming from the game #ifndef ANDROID + // Cursor can be non-visible when coming from the game m_rendering_engine->get_raw_device()->getCursorControl()->setVisible(true); -#endif + // Set absolute mouse mode #if IRRLICHT_VERSION_MT_REVISION >= 9 m_rendering_engine->get_raw_device()->getCursorControl()->setRelativeMode(false); #endif +#endif + + /* show main menu */ GUIEngine mymenu(&input->joystick, guiroot, m_rendering_engine, &g_menumgr, menudata, *kill); diff --git a/src/client/game.cpp b/src/client/game.cpp index 56d4ae13e..76612879c 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -2535,12 +2535,13 @@ void Game::checkZoomEnabled() void Game::updateCameraDirection(CameraOrientation *cam, float dtime) { -#if IRRLICHT_VERSION_MT_REVISION >= 9 +#if !defined(__ANDROID__) && IRRLICHT_VERSION_MT_REVISION >= 9 if (isMenuActive()) device->getCursorControl()->setRelativeMode(false); else device->getCursorControl()->setRelativeMode(true); #endif + if ((device->isWindowActive() && device->isWindowFocused() && !isMenuActive()) || input->isRandom()) {