Skip to content

Revert "[UI] Remove FSR toggle (#2842)" #2876

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

Merged
merged 2 commits into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
"store": "Filter Store"
},
"help": {
"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.",
"custom_themes_path": "Do not use CSS files from untrusted sources. When in doubt, ask for a review in our Discord channel.",
"custom_themes_wiki": "Check the Wiki for more details on adding custom themes. Click here.",
"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.",
Expand Down Expand Up @@ -494,6 +495,7 @@
"download-no-https": "Download games without HTTPS (useful for CDNs e.g. LanCache)",
"dxvkfpslimit": "Limit FPS (DX9, 10 and 11)",
"egs-sync": "Sync with Installed Epic Games",
"enableFSRHack": "Enable FSR Hack (Wine version needs to support it)",
"eosOverlay": {
"cancelInstall": "Cancel",
"checkForUpdates": "Check for updates",
Expand All @@ -516,6 +518,7 @@
},
"esync": "Enable Esync",
"exit-to-tray": "Exit to System Tray",
"FsrSharpnessStrenght": "FSR Sharpness Strength",
"fsync": "Enable Fsync",
"gamemode": "Use GameMode (Feral Game Mode needs to be installed)",
"hideChangelogsOnStartup": "Don't show changelogs on Startup",
Expand Down
2 changes: 2 additions & 0 deletions src/backend/game_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ class GameConfigV0 extends GameConfig {
preferSystemLibs,
autoSyncSaves,
enableEsync,
enableFSR,
enableFsync,
maxSharpness,
launcherArgs,
Expand All @@ -237,6 +238,7 @@ class GameConfigV0 extends GameConfig {
preferSystemLibs,
autoSyncSaves,
enableEsync,
enableFSR,
enableFsync,
maxSharpness,
launcherArgs,
Expand Down
7 changes: 7 additions & 0 deletions src/backend/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,13 @@ function setupWineEnvVars(gameSettings: GameSettings, gameId = '0') {
)
}
}
if (gameSettings.enableFSR) {
ret.WINE_FULLSCREEN_FSR = '1'
ret.WINE_FULLSCREEN_FSR_STRENGTH =
gameSettings.maxSharpness?.toString() || '2'
} else {
ret.WINE_FULLSCREEN_FSR = '0'
}
if (gameSettings.enableEsync && wineVersion.type !== 'proton') {
ret.WINEESYNC = '1'
}
Expand Down
1 change: 1 addition & 0 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface GameSettings {
eacRuntime: boolean
enableDXVKFpsLimit: boolean
enableEsync: boolean
enableFSR: boolean
enableFsync: boolean
enviromentOptions: EnviromentVariable[]
ignoreGameUpdates: boolean
Expand Down
62 changes: 62 additions & 0 deletions src/frontend/screens/Settings/components/EnableFSR.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { SelectField, ToggleSwitch } from 'frontend/components/UI'
import useSetting from 'frontend/hooks/useSetting'
import ContextProvider from 'frontend/state/ContextProvider'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'
import SettingsContext from '../SettingsContext'

const EnableFSR = () => {
const { t } = useTranslation()
const { platform } = useContext(ContextProvider)
const { isLinuxNative } = useContext(SettingsContext)
const isLinux = platform === 'linux'
const [enableFSR, setEnableFSR] = useSetting('enableFSR', false)
const [maxSharpness, setFsrSharpness] = useSetting('maxSharpness', 5)

if (!isLinux || isLinuxNative) {
return <></>
}

return (
<>
<div className="toggleRow">
<ToggleSwitch
htmlId="enableFSR"
value={enableFSR || false}
handleChange={() => setEnableFSR(!enableFSR)}
title={t(
'setting.enableFSRHack',
'Enable FSR Hack (Wine version needs to support it)'
)}
/>

<FontAwesomeIcon
className="helpIcon"
icon={faCircleInfo}
title={t(
'help.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."
)}
/>
</div>

{enableFSR && (
<SelectField
htmlId="setFsrSharpness"
onChange={(event) => setFsrSharpness(Number(event.target.value))}
value={maxSharpness.toString()}
label={t('setting.FsrSharpnessStrenght', 'FSR Sharpness Strength')}
extraClass="smaller"
>
{Array.from(Array(5).keys()).map((n) => (
<option key={n + 1}>{n + 1}</option>
))}
</SelectField>
)}
</>
)
}

export default EnableFSR
1 change: 1 addition & 0 deletions src/frontend/screens/Settings/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export { default as DownloadNoHTTPS } from './DownloadNoHTTPS'
export { default as EacRuntime } from './EacRuntime'
export { default as EgsSettings } from './EgsSettings'
export { default as EnableEsync } from './EnableEsync'
export { default as EnableFSR } from './EnableFSR'
export { default as EnableFsync } from './EnableFsync'
export { default as EnvVariablesTable } from './EnvVariablesTable'
export { default as GameMode } from './GameMode'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
CrossoverBottle,
EacRuntime,
EnableEsync,
EnableFSR,
EnableFsync,
EnvVariablesTable,
GameMode,
Expand Down Expand Up @@ -135,6 +136,8 @@ export default function GamesSettings({ useDetails = true }: Props) {

<PreferSystemLibs />

<EnableFSR />

<GameMode />
</>
)}
Expand Down