zeroed-some/wanda / 36648f4

Browse files

changes for better compat

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
36648f4dd924809185d593a2c2fcf97d03676717
Parents
7d18366
Tree
fe83ec0

1 changed file

StatusFile+-
M crates/wanda-core/src/wemod/installer.rs 46 30
crates/wanda-core/src/wemod/installer.rsmodified
@@ -6,9 +6,14 @@ use crate::steam::ProtonVersion;
66
 use std::collections::HashMap;
77
 use std::path::Path;
88
 use std::process::Stdio;
9
+use std::time::Duration;
910
 use tokio::process::Command;
11
+use tokio::time::timeout;
1012
 use tracing::{debug, error, info, warn};
1113
 
14
+/// Timeout for WeMod installer (2 minutes should be plenty)
15
+const INSTALLER_TIMEOUT: Duration = Duration::from_secs(120);
16
+
1217
 /// Handles WeMod installation into Wine prefixes
1318
 pub struct WemodInstaller<'a> {
1419
     /// The prefix to install into
@@ -108,43 +113,50 @@ impl<'a> WemodInstaller<'a> {
108113
         info!("Using wine: {}", wine);
109114
         info!("Running: {} {}", wine, installer_path.display());
110115
 
111
-        // WeMod uses Squirrel installer which runs silently by default
112
-        let output = Command::new(&wine)
116
+        // WeMod uses Squirrel installer - run with silent flag to avoid GUI interaction
117
+        // Use inherited stdout/stderr so we can see installer output
118
+        // Add timeout to prevent indefinite hangs
119
+        info!("Running installer (timeout: {:?})...", INSTALLER_TIMEOUT);
120
+
121
+        let install_future = Command::new(&wine)
113122
             .arg(installer_path)
123
+            .arg("--silent")  // Squirrel silent install flag
114124
             .envs(&env)
115
-            .stdout(Stdio::piped())
116
-            .stderr(Stdio::piped())
117
-            .output()
118
-            .await
119
-            .map_err(|e| WandaError::WemodInstallFailed {
120
-                reason: format!("Failed to run installer: {}", e),
121
-            })?;
122
-
123
-        let stdout = String::from_utf8_lossy(&output.stdout);
124
-        let stderr = String::from_utf8_lossy(&output.stderr);
125
-
126
-        if !stdout.is_empty() {
127
-            debug!("Installer stdout: {}", stdout);
128
-        }
129
-
130
-        if !output.status.success() {
131
-            error!("WeMod installer exited with status: {:?}", output.status.code());
132
-            if !stderr.is_empty() {
133
-                error!("Installer stderr: {}", stderr);
125
+            .stdout(Stdio::inherit())
126
+            .stderr(Stdio::inherit())
127
+            .status();
128
+
129
+        match timeout(INSTALLER_TIMEOUT, install_future).await {
130
+            Ok(Ok(status)) => {
131
+                if !status.success() {
132
+                    warn!("WeMod installer exited with status: {:?}", status.code());
133
+                    warn!("Installation may still have succeeded - checking...");
134
+                } else {
135
+                    debug!("Installer completed with success status");
136
+                }
137
+            }
138
+            Ok(Err(e)) => {
139
+                return Err(WandaError::WemodInstallFailed {
140
+                    reason: format!("Failed to run installer: {}", e),
141
+                });
142
+            }
143
+            Err(_) => {
144
+                warn!("Installer timed out after {:?}", INSTALLER_TIMEOUT);
145
+                warn!("Checking if installation succeeded anyway...");
134146
             }
135
-            // Don't fail immediately - installer might still have worked
136
-        } else {
137
-            debug!("Installer completed with success status");
138147
         }
139148
 
140
-        // Wait for wineserver using Proton's wineserver
149
+        // Wait for wineserver using Proton's wineserver (with timeout)
141150
         let wineserver = self.wineserver_exe();
142151
         debug!("Waiting for wineserver: {}", wineserver);
143
-        let _ = Command::new(&wineserver)
152
+        let wineserver_wait = Command::new(&wineserver)
144153
             .arg("-w")
145154
             .envs(&env)
146
-            .status()
147
-            .await;
155
+            .status();
156
+
157
+        if timeout(Duration::from_secs(30), wineserver_wait).await.is_err() {
158
+            warn!("Wineserver wait timed out - continuing anyway");
159
+        }
148160
 
149161
         // Verify installation
150162
         info!("Verifying WeMod installation...");
@@ -309,10 +321,14 @@ impl<'a> WemodInstaller<'a> {
309321
         info!("Using wine: {}", wine);
310322
 
311323
         // Run WeMod with required flags for Wine/Proton compatibility
324
+        // These Electron flags are necessary for proper rendering under Wine
312325
         let child = Command::new(&wine)
313326
             .arg(&wemod_exe)
314
-            .arg("--no-sandbox")      // Required for Wine
315
-            .arg("--disable-gpu")     // Avoid GPU compositor issues
327
+            .arg("--no-sandbox")              // Required for Wine
328
+            .arg("--disable-gpu")             // Disable GPU acceleration
329
+            .arg("--disable-gpu-compositing") // Disable GPU compositing
330
+            .arg("--disable-software-rasterizer") // Force hardware path (paradoxically helps)
331
+            .arg("--in-process-gpu")          // Run GPU in main process
316332
             .envs(&env)
317333
             .stdout(Stdio::inherit())
318334
             .stderr(Stdio::inherit())