Skip to content

Commit ba1ab80

Browse files
authored
Revert "[UI] Remove FSR toggle (#2842)" (#2876)
1 parent 1cec908 commit ba1ab80

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

public/locales/en/translation.json

+3
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@
246246
"store": "Filter Store"
247247
},
248248
"help": {
249+
"amdfsr": "AMD's FSR helps boost framerate by upscaling lower resolutions in Fullscreen Mode. Image quality increases from 5 to 1 at the cost of a slight performance hit. Enabling may improve performance.",
249250
"custom_themes_path": "Do not use CSS files from untrusted sources. When in doubt, ask for a review in our Discord channel.",
250251
"custom_themes_wiki": "Check the Wiki for more details on adding custom themes. Click here.",
251252
"disable_logs": "Toggle this checkbox ON to disable most of the writes to log files (critical information is always logged). Make sure to turn OFF this setting before reporting any issue.",
@@ -494,6 +495,7 @@
494495
"download-no-https": "Download games without HTTPS (useful for CDNs e.g. LanCache)",
495496
"dxvkfpslimit": "Limit FPS (DX9, 10 and 11)",
496497
"egs-sync": "Sync with Installed Epic Games",
498+
"enableFSRHack": "Enable FSR Hack (Wine version needs to support it)",
497499
"eosOverlay": {
498500
"cancelInstall": "Cancel",
499501
"checkForUpdates": "Check for updates",
@@ -516,6 +518,7 @@
516518
},
517519
"esync": "Enable Esync",
518520
"exit-to-tray": "Exit to System Tray",
521+
"FsrSharpnessStrenght": "FSR Sharpness Strength",
519522
"fsync": "Enable Fsync",
520523
"gamemode": "Use GameMode (Feral Game Mode needs to be installed)",
521524
"hideChangelogsOnStartup": "Don't show changelogs on Startup",

src/backend/game_config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class GameConfigV0 extends GameConfig {
211211
preferSystemLibs,
212212
autoSyncSaves,
213213
enableEsync,
214+
enableFSR,
214215
enableFsync,
215216
maxSharpness,
216217
launcherArgs,
@@ -237,6 +238,7 @@ class GameConfigV0 extends GameConfig {
237238
preferSystemLibs,
238239
autoSyncSaves,
239240
enableEsync,
241+
enableFSR,
240242
enableFsync,
241243
maxSharpness,
242244
launcherArgs,

src/backend/launcher.ts

+7
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
339339
)
340340
}
341341
}
342+
if (gameSettings.enableFSR) {
343+
ret.WINE_FULLSCREEN_FSR = '1'
344+
ret.WINE_FULLSCREEN_FSR_STRENGTH =
345+
gameSettings.maxSharpness?.toString() || '2'
346+
} else {
347+
ret.WINE_FULLSCREEN_FSR = '0'
348+
}
342349
if (gameSettings.enableEsync && wineVersion.type !== 'proton') {
343350
ret.WINEESYNC = '1'
344351
}

src/common/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export interface GameSettings {
138138
eacRuntime: boolean
139139
enableDXVKFpsLimit: boolean
140140
enableEsync: boolean
141+
enableFSR: boolean
141142
enableFsync: boolean
142143
enviromentOptions: EnviromentVariable[]
143144
ignoreGameUpdates: boolean
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React, { useContext } from 'react'
2+
import { useTranslation } from 'react-i18next'
3+
import { SelectField, ToggleSwitch } from 'frontend/components/UI'
4+
import useSetting from 'frontend/hooks/useSetting'
5+
import ContextProvider from 'frontend/state/ContextProvider'
6+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
7+
import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'
8+
import SettingsContext from '../SettingsContext'
9+
10+
const EnableFSR = () => {
11+
const { t } = useTranslation()
12+
const { platform } = useContext(ContextProvider)
13+
const { isLinuxNative } = useContext(SettingsContext)
14+
const isLinux = platform === 'linux'
15+
const [enableFSR, setEnableFSR] = useSetting('enableFSR', false)
16+
const [maxSharpness, setFsrSharpness] = useSetting('maxSharpness', 5)
17+
18+
if (!isLinux || isLinuxNative) {
19+
return <></>
20+
}
21+
22+
return (
23+
<>
24+
<div className="toggleRow">
25+
<ToggleSwitch
26+
htmlId="enableFSR"
27+
value={enableFSR || false}
28+
handleChange={() => setEnableFSR(!enableFSR)}
29+
title={t(
30+
'setting.enableFSRHack',
31+
'Enable FSR Hack (Wine version needs to support it)'
32+
)}
33+
/>
34+
35+
<FontAwesomeIcon
36+
className="helpIcon"
37+
icon={faCircleInfo}
38+
title={t(
39+
'help.amdfsr',
40+
"AMD's FSR helps boost framerate by upscaling lower resolutions in Fullscreen Mode. Image quality increases from 5 to 1 at the cost of a slight performance hit. Enabling may improve performance."
41+
)}
42+
/>
43+
</div>
44+
45+
{enableFSR && (
46+
<SelectField
47+
htmlId="setFsrSharpness"
48+
onChange={(event) => setFsrSharpness(Number(event.target.value))}
49+
value={maxSharpness.toString()}
50+
label={t('setting.FsrSharpnessStrenght', 'FSR Sharpness Strength')}
51+
extraClass="smaller"
52+
>
53+
{Array.from(Array(5).keys()).map((n) => (
54+
<option key={n + 1}>{n + 1}</option>
55+
))}
56+
</SelectField>
57+
)}
58+
</>
59+
)
60+
}
61+
62+
export default EnableFSR

src/frontend/screens/Settings/components/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export { default as DownloadNoHTTPS } from './DownloadNoHTTPS'
1818
export { default as EacRuntime } from './EacRuntime'
1919
export { default as EgsSettings } from './EgsSettings'
2020
export { default as EnableEsync } from './EnableEsync'
21+
export { default as EnableFSR } from './EnableFSR'
2122
export { default as EnableFsync } from './EnableFsync'
2223
export { default as EnvVariablesTable } from './EnvVariablesTable'
2324
export { default as GameMode } from './GameMode'

src/frontend/screens/Settings/sections/GamesSettings/index.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
CrossoverBottle,
1212
EacRuntime,
1313
EnableEsync,
14+
EnableFSR,
1415
EnableFsync,
1516
EnvVariablesTable,
1617
GameMode,
@@ -135,6 +136,8 @@ export default function GamesSettings({ useDetails = true }: Props) {
135136

136137
<PreferSystemLibs />
137138

139+
<EnableFSR />
140+
138141
<GameMode />
139142
</>
140143
)}

0 commit comments

Comments
 (0)