mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-24 23:25:38 +00:00
(Linux) Added a DEINIT_ON_LAUNCH build flag to support KMS/direct framebuffer access
This commit is contained in:
parent
b9805053a9
commit
e6653bc239
|
@ -44,6 +44,7 @@ option(RPI "Set to ON to enable a Raspberry Pi specific build" OFF)
|
|||
option(BUNDLED_CERTS "Set to ON to use bundled TLS/SSL certificates" OFF)
|
||||
option(CEC "Set to ON to enable CEC" OFF)
|
||||
option(VIDEO_HW_DECODING "Set to ON to enable FFmpeg HW decoding" OFF)
|
||||
option(DEINIT_ON_LAUNCH "Set to ON to deinitialize on game launch" OFF)
|
||||
option(CLANG_TIDY "Set to ON to build using the clang-tidy static analyzer" OFF)
|
||||
option(ASAN "Set to ON to build with AddressSanitizer" OFF)
|
||||
option(TSAN "Set to ON to build with ThreadSanitizer" OFF)
|
||||
|
@ -357,6 +358,15 @@ if(VIDEO_HW_DECODING)
|
|||
message("-- Building with FFmpeg HW decoding")
|
||||
endif()
|
||||
|
||||
if(DEINIT_ON_LAUNCH)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||
add_compile_definitions(DEINIT_ON_LAUNCH)
|
||||
message("-- Building with deinitialization on game launch")
|
||||
else()
|
||||
message(FATAL_ERROR "-- Deinitialization on game launch can only be used on Linux")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(AUR_BUILD OR FLATPAK_BUILD OR RETRODECK OR RPI)
|
||||
set(APPLICATION_UPDATER OFF)
|
||||
endif()
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "FileData.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
#include "CollectionSystemsManager.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "FileSorts.h"
|
||||
|
@ -1895,6 +1896,10 @@ void FileData::launchGame()
|
|||
// Trim any leading and trailing whitespace characters as they could cause launch issues.
|
||||
command = Utils::String::trim(command);
|
||||
|
||||
#if defined(DEINIT_ON_LAUNCH)
|
||||
runInBackground = false;
|
||||
#endif
|
||||
|
||||
// swapBuffers() is called here to turn the screen black to eliminate some potential
|
||||
// flickering and to avoid showing the game launch message briefly when returning
|
||||
// from the game.
|
||||
|
@ -1966,7 +1971,18 @@ void FileData::launchGame()
|
|||
androidData, mEnvData->mStartPath, romRaw, androidExtrasString, androidExtrasStringArray,
|
||||
androidExtrasBool, androidActivityFlags);
|
||||
#else
|
||||
|
||||
#if defined(DEINIT_ON_LAUNCH)
|
||||
// Deinit both the AudioManager and the window which allows emulators to launch in KMS mode.
|
||||
AudioManager::getInstance().deinit();
|
||||
window->deinit();
|
||||
returnValue = Utils::Platform::launchGameUnix(command, startDirectory, false);
|
||||
AudioManager::getInstance().init();
|
||||
window->init();
|
||||
#else
|
||||
returnValue = Utils::Platform::launchGameUnix(command, startDirectory, runInBackground);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// Notify the user in case of a failed game launch using a popup window.
|
||||
if (returnValue != 0) {
|
||||
|
|
|
@ -1653,7 +1653,7 @@ void GuiMenu::openOtherOptions()
|
|||
});
|
||||
#endif
|
||||
|
||||
#if !defined(__ANDROID__)
|
||||
#if !defined(__ANDROID__) && !defined(DEINIT_ON_LAUNCH)
|
||||
// Run ES in the background when a game has been launched.
|
||||
auto runInBackground = std::make_shared<SwitchComponent>();
|
||||
runInBackground->setState(Settings::getInstance()->getBool("RunInBackground"));
|
||||
|
|
Loading…
Reference in a new issue