diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-14 02:45:12 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-14 02:45:25 -0600 |
| commit | 817e8f5cd26739c69d930d21cd9dc4c0b6e4984e (patch) | |
| tree | 52aed11d6751bb7d20b06acf197d56fac113203d /libs/nak/src/dxvk.rs | |
| parent | 51a9f8f197727f00896e5de44569b098923527dd (diff) | |
Add FUSE external mapping support, BG3/Oblivion Remastered fixes, fomod-plus and NaK integration
FUSE VFS now deploys non-data-dir mod mappings (Paks, OBSE, UE4SS, etc.)
via real symlinks and injects file-level data-dir mappings (plugins.txt,
loadorder.txt) into the VFS tree. Fixes game launches for Oblivion
Remastered (Root Builder path resolution, script extender support) and
BG3 (Wine prefix documents directory, file mapper symlinks on Linux).
Vendors mo2-fomod-plus plugin and NaK crate for FOMOD installer and
game finder/runtime support.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'libs/nak/src/dxvk.rs')
| -rw-r--r-- | libs/nak/src/dxvk.rs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/libs/nak/src/dxvk.rs b/libs/nak/src/dxvk.rs new file mode 100644 index 0000000..97e4222 --- /dev/null +++ b/libs/nak/src/dxvk.rs @@ -0,0 +1,71 @@ +//! DXVK configuration management for Fluorine Manager. +//! +//! Downloads dxvk.conf from upstream, appends Fluorine-specific settings, +//! and stores at `~/.var/app/com.fluorine.manager/config/dxvk.conf`. + +use std::error::Error; +use std::fs; +use std::path::{Path, PathBuf}; + +use crate::logging::{log_info, log_warning}; + +const DXVK_CONF_URL: &str = + "https://raw.githubusercontent.com/doitsujin/dxvk/master/dxvk.conf"; + +const DXVK_CUSTOM_SETTINGS: &str = r#" +# Fluorine Custom Settings +# Disable Graphics Pipeline Library (can cause issues with modded games) +dxvk.enableGraphicsPipelineLibrary = False +"#; + +/// Get the path where the DXVK config will be stored. +pub fn get_dxvk_conf_path() -> PathBuf { + let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string()); + PathBuf::from(home) + .join(".var/app/com.fluorine.manager/config/dxvk.conf") +} + +/// Ensure the dxvk.conf file exists, downloading if necessary. +/// +/// Returns the path to the config file. +pub fn ensure_dxvk_conf() -> Result<PathBuf, Box<dyn Error>> { + let conf_path = get_dxvk_conf_path(); + + // If it already exists, return it + if conf_path.exists() { + return Ok(conf_path); + } + + download_and_create_dxvk_conf(&conf_path) +} + +/// Download the upstream dxvk.conf, append custom settings, and write to `dest`. +pub fn download_and_create_dxvk_conf(dest: &Path) -> Result<PathBuf, Box<dyn Error>> { + // Ensure parent directory exists + if let Some(parent) = dest.parent() { + fs::create_dir_all(parent)?; + } + + log_info("Downloading dxvk.conf from upstream..."); + + let upstream_content = match ureq::get(DXVK_CONF_URL).call() { + Ok(response) => { + let mut body = String::new(); + response.into_reader().read_to_string(&mut body)?; + body + } + Err(e) => { + log_warning(&format!("Failed to download dxvk.conf: {}", e)); + // Create with just custom settings if download fails + String::new() + } + }; + + let full_content = format!("{}\n{}", upstream_content, DXVK_CUSTOM_SETTINGS); + fs::write(dest, &full_content)?; + + log_info(&format!("Created dxvk.conf at {:?}", dest)); + Ok(dest.to_path_buf()) +} + +use std::io::Read as _; |
