From 527c308e28f4a0d2be6641afdf13e2e1ed298846 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 31 Dec 2025 16:48:40 +0100 Subject: [PATCH] Add isle:Active in Background config option (#756) This keeps isle running in the background, useful for multitaskers. --- ISLE/isleapp.cpp | 11 ++++++++--- ISLE/isleapp.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 0f9c7f4d..3ce21e91 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -205,6 +205,7 @@ IsleApp::IsleApp() m_exclusiveFullScreen = FALSE; m_msaaSamples = 0; m_anisotropic = 16.0f; + m_activeInBackground = FALSE; } // FUNCTION: ISLE 0x4011a0 @@ -504,11 +505,13 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event) switch (event->type) { case SDL_EVENT_WINDOW_FOCUS_GAINED: - g_isle->SetWindowActive(TRUE); - Lego()->Resume(); + if (!g_isle->GetActiveInBackground()) { + g_isle->SetWindowActive(TRUE); + Lego()->Resume(); + } break; case SDL_EVENT_WINDOW_FOCUS_LOST: - if (g_isle->GetGameStarted()) { + if (!g_isle->GetActiveInBackground() && g_isle->GetGameStarted()) { g_isle->SetWindowActive(FALSE); Lego()->Pause(); #ifdef __EMSCRIPTEN__ @@ -1143,6 +1146,7 @@ bool IsleApp::LoadConfig() iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10)); iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10)); iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10)); + iniparser_set(dict, "isle:Active in background", m_activeInBackground ? "true" : "false"); #ifdef EXTENSIONS iniparser_set(dict, "extensions", NULL); @@ -1227,6 +1231,7 @@ bool IsleApp::LoadConfig() m_frameDelta = static_cast(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta))); m_videoParam.SetMSAASamples((m_msaaSamples = iniparser_getint(dict, "isle:MSAA", m_msaaSamples))); m_videoParam.SetAnisotropic((m_anisotropic = iniparser_getdouble(dict, "isle:Anisotropic", m_anisotropic))); + m_activeInBackground = iniparser_getboolean(dict, "isle:Active in Background", m_activeInBackground); const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL); if (deviceId != NULL) { diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 38c0aecc..75c332aa 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -56,6 +56,7 @@ class IsleApp { MxFloat GetCursorSensitivity() { return m_cursorSensitivity; } LegoInputManager::TouchScheme GetTouchScheme() { return m_touchScheme; } MxBool GetHaptic() { return m_haptic; } + MxBool GetActiveInBackground() { return m_activeInBackground; } void SetWindowActive(MxS32 p_windowActive) { m_windowActive = p_windowActive; } void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; } @@ -117,6 +118,7 @@ class IsleApp { MxBool m_exclusiveFullScreen; MxU32 m_msaaSamples; MxFloat m_anisotropic; + MxBool m_activeInBackground; }; extern IsleApp* g_isle;