diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index 9f2ba3b91..123168eb7 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -1082,12 +1082,7 @@ void FileData::launchGame(Window* window) // 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. - -#if defined(_WIN64) - if (!(Settings::getInstance()->getBool("LaunchWorkaround") || runInBackground)) -#else if (!runInBackground) -#endif Renderer::swapBuffers(); Scripting::fireEvent("game-start", romPath, getSourceFileData()->metadata.get("name"), diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index a8555049b..12794bcc1 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -986,28 +986,6 @@ void GuiMenu::openOtherOptions() } }); -#if defined(_WIN64) - // Workaround for launching games on AMD and Intel graphics drivers. - auto launch_workaround = std::make_shared(mWindow); - launch_workaround->setState(Settings::getInstance()->getBool("LaunchWorkaround")); - s->addWithLabel("AMD AND INTEL GPU GAME LAUNCH WORKAROUND", launch_workaround); - s->addSaveFunc([launch_workaround, s] { - if (launch_workaround->getState() != Settings::getInstance()->getBool("LaunchWorkaround")) { - Settings::getInstance()->setBool("LaunchWorkaround", launch_workaround->getState()); - s->setNeedsSaving(); - } - }); - - // If the RunInBackground setting is enabled, then gray out this option. - if (Settings::getInstance()->getBool("RunInBackground")) { - launch_workaround->setEnabled(false); - launch_workaround->setOpacity(DISABLED_OPACITY); - launch_workaround->getParent() - ->getChild(launch_workaround->getChildIndex() - 1) - ->setOpacity(DISABLED_OPACITY); - } -#endif - #if defined(VIDEO_HW_DECODING) // Whether to enable hardware decoding for the FFmpeg video player. auto video_hardware_decoding = std::make_shared(mWindow); @@ -1173,27 +1151,6 @@ void GuiMenu::openOtherOptions() }); #endif -#if defined(_WIN64) - // Switch callback. - auto launchWorkaroundToggleFunc = [launch_workaround]() { - if (launch_workaround->getEnabled()) { - launch_workaround->setEnabled(false); - launch_workaround->setOpacity(DISABLED_OPACITY); - launch_workaround->getParent() - ->getChild(launch_workaround->getChildIndex() - 1) - ->setOpacity(DISABLED_OPACITY); - } - else { - launch_workaround->setEnabled(true); - launch_workaround->setOpacity(255); - launch_workaround->getParent() - ->getChild(launch_workaround->getChildIndex() - 1) - ->setOpacity(255); - } - }; - run_in_background->setCallback(launchWorkaroundToggleFunc); -#endif - s->setSize(mSize); mWindow->pushGui(s); } diff --git a/es-core/src/Platform.cpp b/es-core/src/Platform.cpp index 66801a442..4a988cb9b 100644 --- a/es-core/src/Platform.cpp +++ b/es-core/src/Platform.cpp @@ -169,27 +169,22 @@ int launchGameWindows(const std::wstring& cmd_utf16, bool runInBackground, bool int width{}; int height{}; - if (Settings::getInstance()->getBool("LaunchWorkaround")) { - // Hack to make the emulator window render correctly with some graphics drivers - // when running at full screen resolution. This is probably only an issue with AMD - // and Intel drivers as Nvidia and software drivers like LLVMpipe work fine without - // this workaround. If not used on affected drivers the emulator window will simply - // be black although the emulator actually works and outputs sounds, accepts input etc. - // There is a white flash the first time an emulator is started during the program - // session and a white single-pixel line will be visible at the bottom of the screen - // when the emulator is loading but it's at least a tolerable workaround. - SDL_GetWindowSize(Renderer::getSDLWindow(), &width, &height); - SDL_SetWindowSize(Renderer::getSDLWindow(), width, height - 1); - SDL_Delay(100); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - Renderer::swapBuffers(); - } + // Hack to make the emulator window render correctly when launching games while running in + // full screen mode. If not done, the emulator window will simply be black although the + // game actually works and outputs sounds, accepts input etc. There is sometimes a white + // flash the first time an emulator is started during the program session and a white + // single-pixel line will be visible at the bottom of the screen while the game is loading. + // But it's at least a tolerable workaround. + SDL_GetWindowSize(Renderer::getSDLWindow(), &width, &height); + SDL_SetWindowSize(Renderer::getSDLWindow(), width, height - 1); + SDL_Delay(100); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + Renderer::swapBuffers(); WaitForSingleObject(pi.hThread, INFINITE); WaitForSingleObject(pi.hProcess, INFINITE); - if (Settings::getInstance()->getBool("LaunchWorkaround")) - SDL_SetWindowSize(Renderer::getSDLWindow(), width, height); + SDL_SetWindowSize(Renderer::getSDLWindow(), width, height); } // If the return value is false, then something failed. diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 8e79d22e1..ddd09b95b 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -233,9 +233,6 @@ void Settings::setDefaults() mBoolMap["VSyncWorkaround"] = {true, true}; #endif mBoolMap["RunInBackground"] = {false, false}; -#if defined(_WIN64) - mBoolMap["LaunchWorkaround"] = {true, true}; -#endif #if defined(VIDEO_HW_DECODING) mBoolMap["VideoHardwareDecoding"] = {false, false}; #endif diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index b572ada96..ab0174f65 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -159,36 +159,37 @@ namespace Renderer SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0"); #endif -#if defined(__APPLE__) || defined(__unix__) bool userResolution = false; // Check if the user has changed the resolution from the command line. if (windowWidth != displayMode.w || windowHeight != displayMode.h) userResolution = true; - // Not sure if this could be a useful setting for some users. - // SDL_SetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, "0"); -#endif unsigned int windowFlags; setupWindow(); #if defined(_WIN64) - // For Windows, always set the mode to windowed as full screen mode seems to behave quite - // erratic. There may be a proper fix for this, but for now windowed mode seems to behave - // well and it's almost completely seamless, especially with a hidden taskbar. - windowFlags = getWindowFlags(); + // For Windows we use SDL_WINDOW_BORDERLESS as "real" full screen doesn't work properly. + // The borderless mode seems to behave well and it's almost completely seamless, especially + // with a hidden taskbar. + if (!userResolution) + windowFlags = SDL_WINDOW_BORDERLESS | getWindowFlags(); + else + // If the resolution has been manually set from the command line, then keep the border. + windowFlags = getWindowFlags(); #elif defined(__APPLE__) + // Not sure if this could be a useful setting. + // SDL_SetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, "0"); + // The SDL_WINDOW_BORDERLESS mode seems to be the only mode that somehow works on macOS // as a real fullscreen mode will do lots of weird stuff like preventing window switching // or refusing to let emulators run at all. SDL_WINDOW_FULLSCREEN_DESKTOP almost works, but // it "shuffles" windows when starting the emulator and won't return properly when the game // has exited. With SDL_WINDOW_BORDERLESS some emulators (like RetroArch) have to be - // configured to run in fullscreen mode or switching to its window will not work when a - // game is launched. So there is room for improvement although it's acceptable for now. + // configured to run in fullscreen mode or switching to its window will not work, but + // apart from that this mode works fine. if (!userResolution) windowFlags = SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI | getWindowFlags(); else - // If the user has changed the resolution from the command line, then add a - // border to the window. windowFlags = SDL_WINDOW_ALLOW_HIGHDPI | getWindowFlags(); #else if (!userResolution)