zeroed-some/wanda / cce3b1d

Browse files

add Display for ProtonCompatibility, improve version preference handling

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
cce3b1d79fbe85ae330b35dbdc48f1595ad7d8f6
Parents
60ee785
Tree
ef2e5f7

1 changed file

StatusFile+-
M crates/wanda-core/src/steam/proton.rs 38 5
crates/wanda-core/src/steam/proton.rsmodified
@@ -4,6 +4,7 @@ use crate::config::WandaConfig;
44
 use crate::error::{Result, WandaError};
55
 use crate::steam::SteamInstallation;
66
 use std::cmp::Ordering;
7
+use std::fmt;
78
 use std::path::{Path, PathBuf};
89
 use tracing::{debug, info, warn};
910
 
@@ -20,6 +21,17 @@ pub enum ProtonCompatibility {
2021
     Unsupported,
2122
 }
2223
 
24
+impl fmt::Display for ProtonCompatibility {
25
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26
+        match self {
27
+            ProtonCompatibility::Recommended => write!(f, "Recommended"),
28
+            ProtonCompatibility::Supported => write!(f, "Supported"),
29
+            ProtonCompatibility::Experimental => write!(f, "Experimental"),
30
+            ProtonCompatibility::Unsupported => write!(f, "Unsupported"),
31
+        }
32
+    }
33
+}
34
+
2335
 /// A detected Proton installation
2436
 #[derive(Debug, Clone)]
2537
 pub struct ProtonVersion {
@@ -286,11 +298,32 @@ impl ProtonManager {
286298
         // Check user preference first
287299
         if let Some(ref preferred) = config.proton.preferred_version {
288300
             if let Some(v) = self.find_by_name(preferred) {
289
-                if v.compatibility == ProtonCompatibility::Unsupported {
290
-                    warn!(
291
-                        "Preferred Proton version {} has known compatibility issues",
292
-                        v.name
293
-                    );
301
+                match v.compatibility {
302
+                    ProtonCompatibility::Unsupported => {
303
+                        warn!(
304
+                            "Preferred Proton version '{}' is {} — it has known compatibility issues with WeMod",
305
+                            v.name, v.compatibility
306
+                        );
307
+                        if let Some(rec) = self.get_recommended() {
308
+                            warn!(
309
+                                "Consider switching to '{}' ({}): wanda init --proton '{}'",
310
+                                rec.name, rec.compatibility, rec.name
311
+                            );
312
+                        }
313
+                    }
314
+                    ProtonCompatibility::Experimental => {
315
+                        warn!(
316
+                            "Preferred Proton version '{}' is {} — GE-Proton 10.x wow64 mode can break WeMod's renderer",
317
+                            v.name, v.compatibility
318
+                        );
319
+                        if let Some(rec) = self.get_recommended() {
320
+                            warn!(
321
+                                "Consider switching to '{}' ({}): wanda init --proton '{}'",
322
+                                rec.name, rec.compatibility, rec.name
323
+                            );
324
+                        }
325
+                    }
326
+                    _ => {}
294327
                 }
295328
                 return Ok(v);
296329
             }