Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Enable anti cheat runtimes by default #3103

11 changes: 7 additions & 4 deletions src/backend/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
isMac,
isWindows,
getSteamCompatFolder,
configStore
configStore,
isLinux
} from './constants'

import { logError, logInfo, LogPrefix } from './logger/logger'
Expand Down Expand Up @@ -291,7 +292,7 @@ class GlobalConfigV0 extends GlobalConfig {
addDesktopShortcuts: false,
addStartMenuShortcuts: false,
autoInstallDxvk: true,
autoInstallVkd3d: true,
autoInstallVkd3d: isLinux,
autoInstallDxvkNvapi: false,
addSteamShortcuts: false,
preferSystemLibs: false,
Expand All @@ -310,12 +311,14 @@ class GlobalConfigV0 extends GlobalConfig {
enviromentOptions: [],
wrapperOptions: [],
showFps: false,
useGameMode: false,
useGameMode: isFlatpak,
wineCrossoverBottle: 'Heroic',
winePrefix: isWindows ? '' : defaultWinePrefix,
wineVersion: defaultWine,
enableEsync: true,
enableFsync: true,
enableFsync: isLinux,
Copy link
Member Author

@Etaash-mathamsetty Etaash-mathamsetty Oct 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fsync uses a linux specific syscall and can only should be enabled by default on linux

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be nitpicky, but I don't think this should be in this PR

eacRuntime: isLinux,
Etaash-mathamsetty marked this conversation as resolved.
Show resolved Hide resolved
battlEyeRuntime: isLinux,
framelessWindow: false
}
// @ts-expect-error TODO: We need to settle on *one* place to define settings defaults
Expand Down
13 changes: 13 additions & 0 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ import {
createAbortController,
deleteAbortController
} from './utils/aborthandler/aborthandler'
import { download, isInstalled } from './wine/runtimes/runtimes'

async function prepareLaunch(
gameSettings: GameSettings,
Expand Down Expand Up @@ -359,6 +360,18 @@ async function prepareWineLaunch(
}
}

if (gameSettings.eacRuntime && !isInstalled('eac_runtime') && isOnline()) {
await download('eac_runtime')
}

if (
gameSettings.battlEyeRuntime &&
!isInstalled('battleye_runtime') &&
isOnline()
) {
await download('battleye_runtime')
}

const { folder_name: installFolderName, install } =
gameManagerMap[runner].getGameInfo(appName)
const envVars = setupWineEnvVars(
Expand Down
20 changes: 0 additions & 20 deletions src/backend/storeManagers/legendary/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import {
installed,
configStore,
gamesConfigPath,
isLinux,
isFlatpak,
isCLINoGui
} from '../../constants'
import { logError, logInfo, LogPrefix, logsDisabled } from '../../logger/logger'
Expand All @@ -60,7 +58,6 @@ import shlex from 'shlex'
import { t } from 'i18next'
import { isOnline } from '../../online_monitor'
import { showDialogBoxModalAuto } from '../../dialog/dialog'
import { gameAnticheatInfo } from '../../anticheat/utils'
import { Catalog, Product } from 'common/types/epic-graphql'
import { sendFrontendMessage } from '../../main_window'
import { RemoveArgs } from 'common/types/game_manager'
Expand Down Expand Up @@ -623,23 +620,6 @@ export async function install(
}
addShortcuts(appName)

const anticheatInfo = gameAnticheatInfo(getGameInfo(appName).namespace)

if (anticheatInfo && isLinux) {
const gameConfig = GameConfig.get(appName)

if (anticheatInfo.anticheats.includes('Easy Anti-Cheat')) {
gameConfig.setSetting('eacRuntime', true)
if (isFlatpak) {
gameConfig.setSetting('useGameMode', true)
}
}

if (anticheatInfo.anticheats.includes('BattlEye')) {
gameConfig.setSetting('battleyeRuntime', true)
}
}

return { status: 'done' }
}

Expand Down