diff --git a/bepinex_helpers/src/game.rs b/bepinex_helpers/src/game.rs index d414459..8976cde 100644 --- a/bepinex_helpers/src/game.rs +++ b/bepinex_helpers/src/game.rs @@ -169,6 +169,12 @@ pub fn get_dll_version(path: PathBuf) -> Result> .get("ProductVersion") .ok_or("Failed to get prod. version")?; + // "Converts" 5.*.*.* into 5.*.* becuase BepInEx devs decided to add build num 💀 + if version.starts_with('5') && version.split('.').count() > 3 { + let ver = version.split('.').into_iter().collect::>()[0..3].join("."); + return Ok(Version::parse(&ver).unwrap()); + } + // TODO: Do some proper handling of invalid semver that bix has in older versions 💀 Ok(Version::parse(version).unwrap()) } diff --git a/bepinex_installer/src/installer.rs b/bepinex_installer/src/installer.rs index 9781eef..be862e2 100644 --- a/bepinex_installer/src/installer.rs +++ b/bepinex_installer/src/installer.rs @@ -117,7 +117,7 @@ impl App for Installer { == Some(GameType::UnityIL2CPP) && selected_bix.version >= *MIN_IL2CPP_STABLE_VERSION; - let enabled = supported_ver + let supported = supported_ver || (selected_game.ty != Some(GameType::UnityIL2CPP)); strip.cell(|ui| { @@ -147,7 +147,7 @@ impl App for Installer { strip.cell(|ui| { ui.centered_and_justified(|ui| { let install_btn = Button::new("Install").small(); - if ui.add_enabled(enabled, install_btn).clicked() { + if ui.add(install_btn).clicked() { let options = ToastOptions { show_icon: true, ..ToastOptions::with_duration( @@ -155,6 +155,11 @@ impl App for Installer { ) }; + if !supported { + toasts.error(format!("Minimal BepInEx for this game is {}", *MIN_IL2CPP_STABLE_VERSION), options); + return; + } + let query = selected_game.to_query(&selected_bix.version); let res = selected_bix diff --git a/bepinex_sources/examples/basic.rs b/bepinex_sources/examples/basic.rs index 646d851..293c5dc 100644 --- a/bepinex_sources/examples/basic.rs +++ b/bepinex_sources/examples/basic.rs @@ -2,7 +2,7 @@ use bepinex_sources::{github::GitHubApi, models::bleeding_edge::bepinex::BepInEx use semver::Version; fn main() -> anyhow::Result<()> { - let min_ver = Version::parse("5.4.21").unwrap(); + let min_ver = Version::parse("5.4.11").unwrap(); let mut gh = GitHubApi::new("BepInEx", "BepInEx"); gh.set_pre_releases(true); gh.set_min_tag(Some(min_ver));