mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2025-02-16 17:59:46 +03:00
Disabled mangohud if gamescope is enabled
This commit is contained in:
parent
d135ef691c
commit
116b31fbdb
2 changed files with 17 additions and 7 deletions
|
@ -2,6 +2,8 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use super::Config;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
pub enum HUD {
|
||||
None,
|
||||
|
@ -40,15 +42,23 @@ impl Into<u32> for HUD {
|
|||
|
||||
impl HUD {
|
||||
/// Get environment variables corresponding to used wine hud
|
||||
pub fn get_env_vars(&self) -> HashMap<&str, &str> {
|
||||
pub fn get_env_vars(&self, config: &Config) -> HashMap<&str, &str> {
|
||||
match self {
|
||||
Self::None => HashMap::new(),
|
||||
Self::DXVK => HashMap::from([
|
||||
("DXVK_HUD", "fps,frametimes,version,gpuload")
|
||||
]),
|
||||
Self::MangoHUD => HashMap::from([
|
||||
("MANGOHUD", "1")
|
||||
])
|
||||
Self::MangoHUD => {
|
||||
// Don't show mangohud if gamescope is enabled
|
||||
// otherwise it'll be doubled
|
||||
if config.game.enhancements.gamescope.enabled {
|
||||
HashMap::new()
|
||||
} else {
|
||||
HashMap::from([
|
||||
("MANGOHUD", "1")
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ pub fn run(debug: bool) -> std::io::Result<()> {
|
|||
bash_chain = format!("{gamescope} -- {bash_chain}");
|
||||
}
|
||||
|
||||
let bash_chain = match config.game.command {
|
||||
let bash_chain = match &config.game.command {
|
||||
Some(command) => command.replace("%command%", &bash_chain),
|
||||
None => bash_chain
|
||||
};
|
||||
|
@ -119,14 +119,14 @@ pub fn run(debug: bool) -> std::io::Result<()> {
|
|||
command.env("WINEPREFIX", &config.game.wine.prefix);
|
||||
|
||||
// Add DXVK_ASYNC=1 for dxvk-async builds automatically
|
||||
if let Some(dxvk) = config.game.dxvk.selected {
|
||||
if let Some(dxvk) = &config.game.dxvk.selected {
|
||||
if dxvk.contains("async") {
|
||||
command.env("DXVK_ASYNC", "1");
|
||||
}
|
||||
}
|
||||
|
||||
command.envs(config.game.wine.sync.get_env_vars());
|
||||
command.envs(config.game.enhancements.hud.get_env_vars());
|
||||
command.envs(config.game.enhancements.hud.get_env_vars(&config));
|
||||
command.envs(config.game.enhancements.fsr.get_env_vars());
|
||||
command.envs(config.game.wine.language.get_env_vars());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue