aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-14 15:59:09 +0800
committerGitHub <noreply@github.com>2026-01-14 15:59:09 +0800
commit9a5e827274979b16f74d513a948b64b4edf15203 (patch)
tree058deda0e86ff12a16d9851fe76bcb38239acf26 /src-tauri
parent505e3485f3dfa31969651f7f281fde33e9843fe8 (diff)
parent2cd4748417b77731096e9acc9b9f78b671a2a3cc (diff)
downloadDropOut-9a5e827274979b16f74d513a948b64b4edf15203.tar.gz
DropOut-9a5e827274979b16f74d513a948b64b4edf15203.zip
Merge pull request #23 from HsiangNianian/hotfix/fix-high-edition-could-not-launch-bug
Diffstat (limited to 'src-tauri')
-rw-r--r--src-tauri/src/core/game_version.rs1
-rw-r--r--src-tauri/src/core/rules.rs7
-rw-r--r--src-tauri/src/main.rs31
3 files changed, 37 insertions, 2 deletions
diff --git a/src-tauri/src/core/game_version.rs b/src-tauri/src/core/game_version.rs
index 572882f..31477a9 100644
--- a/src-tauri/src/core/game_version.rs
+++ b/src-tauri/src/core/game_version.rs
@@ -52,6 +52,7 @@ pub struct Library {
pub struct Rule {
pub action: String, // "allow" or "disallow"
pub os: Option<OsRule>,
+ pub features: Option<serde_json::Value>, // Feature-based rules (e.g., is_demo_user, has_quick_plays_support)
}
#[derive(Debug, Deserialize)]
diff --git a/src-tauri/src/core/rules.rs b/src-tauri/src/core/rules.rs
index 877982a..71abda5 100644
--- a/src-tauri/src/core/rules.rs
+++ b/src-tauri/src/core/rules.rs
@@ -47,6 +47,13 @@ pub fn is_library_allowed(rules: &Option<Vec<Rule>>) -> bool {
}
fn rule_matches(rule: &Rule) -> bool {
+ // Feature-based rules (e.g., is_demo_user, has_quick_plays_support, is_quick_play_singleplayer)
+ // are not implemented in this launcher, so we return false for any rule that has features.
+ // This prevents adding arguments like --demo, --quickPlayPath, --quickPlaySingleplayer, etc.
+ if rule.features.is_some() {
+ return false;
+ }
+
match &rule.os {
None => true, // No OS condition means it applies to all
Some(os_rule) => {
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index ae74a03..a24510e 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -40,6 +40,27 @@ impl MsRefreshTokenState {
}
}
+/// Check if a string contains unresolved placeholders in the form ${...}
+///
+/// After the replacement phase, if a string still contains ${...}, it means
+/// that placeholder variable was not found in the replacements map and is
+/// therefore unresolved. We should skip adding such arguments to avoid
+/// passing malformed arguments to the game launcher.
+fn has_unresolved_placeholder(s: &str) -> bool {
+ // Look for the opening sequence
+ if let Some(start_pos) = s.find("${") {
+ // Check if there's a closing brace after the opening sequence
+ if s[start_pos + 2..].find('}').is_some() {
+ // Found a complete ${...} pattern - this is an unresolved placeholder
+ return true;
+ }
+ // Found ${ but no closing } - also treat as unresolved/malformed
+ return true;
+ }
+ // No ${ found - the string is fully resolved
+ false
+}
+
#[tauri::command]
async fn start_game(
window: Window,
@@ -449,7 +470,10 @@ async fn start_game(
for (key, replacement) in &replacements {
arg = arg.replace(key, replacement);
}
- args.push(arg);
+ // Skip arguments with unresolved placeholders
+ if !has_unresolved_placeholder(&arg) {
+ args.push(arg);
+ }
} else if let Some(arr) = val.as_array() {
for sub in arr {
if let Some(s) = sub.as_str() {
@@ -457,7 +481,10 @@ async fn start_game(
for (key, replacement) in &replacements {
arg = arg.replace(key, replacement);
}
- args.push(arg);
+ // Skip arguments with unresolved placeholders
+ if !has_unresolved_placeholder(&arg) {
+ args.push(arg);
+ }
}
}
}