diff --git a/src/instance/launch/mod.rs b/src/instance/launch/mod.rs index 1556c66..ba9086c 100644 --- a/src/instance/launch/mod.rs +++ b/src/instance/launch/mod.rs @@ -456,8 +456,6 @@ pub async fn launch( launcher_name: "rmcl", launcher_version: env!("CARGO_PKG_VERSION"), clientid: "0", - resolution_width: "", - resolution_height: "", }; let (upstream_jvm_args, game_args) = @@ -636,8 +634,6 @@ mod tests { launcher_version: "test", clientid: "0", version_type: "release", - resolution_width: "", - resolution_height: "", }; let features = FeatureSet::default(); let rule_ctx = RuleContext { diff --git a/src/launch_profile/render.rs b/src/launch_profile/render.rs index f156b09..a75e14c 100644 --- a/src/launch_profile/render.rs +++ b/src/launch_profile/render.rs @@ -95,6 +95,7 @@ mod tests { library_directory, classpath_separator: ":", version_name: "1.20.1", + version_type: "release", natives_directory, classpath: "a.jar:b.jar", game_directory, diff --git a/src/launch_profile/rules.rs b/src/launch_profile/rules.rs index cccfe67..2d6d899 100644 --- a/src/launch_profile/rules.rs +++ b/src/launch_profile/rules.rs @@ -27,6 +27,15 @@ pub struct OsCondition { pub struct FeatureSet { pub is_demo_user: Option, pub has_custom_resolution: Option, + // quick-play feature flags (1.20+). rmcl never sets these, so any rule + // gated on them is filtered out by features_match. listing them + // explicitly is what makes that filter work: without the fields, + // serde would silently drop them during deserialization, leaving a + // FeatureSet::default that matches everything. + pub has_quick_plays_support: Option, + pub is_quick_play_singleplayer: Option, + pub is_quick_play_multiplayer: Option, + pub is_quick_play_realms: Option, } #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] @@ -102,17 +111,27 @@ fn os_version_matches(pattern: &str, host_version: &str) -> bool { } fn features_match(required: &FeatureSet, current: &FeatureSet) -> bool { - if let Some(want) = required.is_demo_user - && current.is_demo_user.unwrap_or(false) != want - { - return false; - } - if let Some(want) = required.has_custom_resolution - && current.has_custom_resolution.unwrap_or(false) != want - { - return false; - } - true + let pairs = [ + (required.is_demo_user, current.is_demo_user), + (required.has_custom_resolution, current.has_custom_resolution), + ( + required.has_quick_plays_support, + current.has_quick_plays_support, + ), + ( + required.is_quick_play_singleplayer, + current.is_quick_play_singleplayer, + ), + ( + required.is_quick_play_multiplayer, + current.is_quick_play_multiplayer, + ), + (required.is_quick_play_realms, current.is_quick_play_realms), + ]; + pairs.iter().all(|(req, cur)| match req { + Some(want) => cur.unwrap_or(false) == *want, + None => true, + }) } #[cfg(test)] @@ -263,12 +282,12 @@ mod tests { os: None, features: Some(FeatureSet { is_demo_user: Some(true), - has_custom_resolution: None, + ..Default::default() }), }]; let demo_features = FeatureSet { is_demo_user: Some(true), - has_custom_resolution: None, + ..Default::default() }; let ctx = RuleContext { os_name: "linux", @@ -286,7 +305,7 @@ mod tests { os: None, features: Some(FeatureSet { is_demo_user: Some(true), - has_custom_resolution: None, + ..Default::default() }), }]; let features = FeatureSet::default(); diff --git a/src/launch_profile/templates.rs b/src/launch_profile/templates.rs index cde8dc4..4d53058 100644 --- a/src/launch_profile/templates.rs +++ b/src/launch_profile/templates.rs @@ -14,6 +14,7 @@ pub struct TemplateContext<'a> { pub library_directory: &'a Path, pub classpath_separator: &'a str, pub version_name: &'a str, + pub version_type: &'a str, pub natives_directory: &'a Path, pub classpath: &'a str, pub game_directory: &'a Path, @@ -76,6 +77,7 @@ fn lookup(name: &str, ctx: &TemplateContext) -> Option { "library_directory" => ctx.library_directory.display().to_string(), "classpath_separator" => ctx.classpath_separator.to_string(), "version_name" => ctx.version_name.to_string(), + "version_type" => ctx.version_type.to_string(), "natives_directory" => ctx.natives_directory.display().to_string(), "classpath" => ctx.classpath.to_string(), "game_directory" => ctx.game_directory.display().to_string(), @@ -109,6 +111,7 @@ mod tests { library_directory, classpath_separator: ":", version_name: "1.20.1", + version_type: "release", natives_directory, classpath: "a.jar:b.jar", game_directory, @@ -237,6 +240,7 @@ mod tests { launcher_name: "rmcl", launcher_version: "0.3.0", clientid: "0", + version_type: "release", }; assert_eq!(substitute("${user_properties}", &ctx), "${version_name}"); }