Skip to content

Commit

Permalink
[FIX] Enable anti cheat runtimes by default (#3103)
Browse files Browse the repository at this point in the history
* [FIX] Enable anti cheat runtimes by default

* Update config.ts

* download runtimes if enabled

* only enable fsync on linux

* small fixes

* Update config.ts

* only enable vkd3d-proton by default on linux
  • Loading branch information
Etaash-mathamsetty authored Nov 21, 2023
1 parent 32e16d4 commit 6b430d8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
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,
eacRuntime: isLinux,
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

0 comments on commit 6b430d8

Please sign in to comment.