diff --git a/Cargo.toml b/Cargo.toml index 8d283ef..7868197 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] crc32fast = "1.2.0" -esplugin = "4.0.0" +esplugin = "4.1.0" nom = "7.0.0" pelite = "0.10.0" regex = "1.0.5" diff --git a/ffi/src/constants.rs b/ffi/src/constants.rs index 7bbb6a8..8cb80a9 100644 --- a/ffi/src/constants.rs +++ b/ffi/src/constants.rs @@ -72,3 +72,7 @@ pub static LCI_GAME_SKYRIM_VR: c_int = 3; /// Game code for Fallout 4 VR. #[no_mangle] pub static LCI_GAME_FALLOUT_4_VR: c_int = 7; + +/// Game code for Starfield. +#[no_mangle] +pub static LCI_GAME_STARFIELD: c_int = 9; diff --git a/ffi/src/helpers.rs b/ffi/src/helpers.rs index 95b8d60..80988bc 100644 --- a/ffi/src/helpers.rs +++ b/ffi/src/helpers.rs @@ -42,6 +42,7 @@ pub fn map_game_type(game_type: c_int) -> Result { x if x == LCI_GAME_FALLOUT_NV => Ok(GameType::FalloutNV), x if x == LCI_GAME_FALLOUT_4 => Ok(GameType::Fallout4), x if x == LCI_GAME_FALLOUT_4_VR => Ok(GameType::Fallout4VR), + x if x == LCI_GAME_STARFIELD => Ok(GameType::Starfield), _ => Err(LCI_ERROR_INVALID_ARGS), } } diff --git a/ffi/tests/ffi.cpp b/ffi/tests/ffi.cpp index 81024be..fadcaf8 100644 --- a/ffi/tests/ffi.cpp +++ b/ffi/tests/ffi.cpp @@ -21,6 +21,7 @@ void test_game_id_values() { assert(LCI_GAME_FALLOUT_NV == 5); assert(LCI_GAME_FALLOUT_4 == 6); assert(LCI_GAME_FALLOUT_4_VR == 7); + assert(LCI_GAME_STARFIELD == 9); } void test_lci_condition_parse() { diff --git a/src/function/eval.rs b/src/function/eval.rs index 4e2dd9e..516ef9b 100644 --- a/src/function/eval.rs +++ b/src/function/eval.rs @@ -129,6 +129,7 @@ fn evaluate_is_master(state: &State, file_path: &Path) -> Result { GameType::Fallout3 => GameId::Fallout3, GameType::FalloutNV => GameId::FalloutNV, GameType::Fallout4 | GameType::Fallout4VR => GameId::Fallout4, + GameType::Starfield => GameId::Starfield, }; let path = resolve_path(state, file_path); diff --git a/src/lib.rs b/src/lib.rs index d42b7fd..ffa73f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,13 +35,18 @@ pub enum GameType { Fallout4, Fallout4VR, Morrowind, + Starfield, } impl GameType { fn supports_light_plugins(self) -> bool { matches!( self, - GameType::SkyrimSE | GameType::SkyrimVR | GameType::Fallout4 | GameType::Fallout4VR + GameType::SkyrimSE + | GameType::SkyrimVR + | GameType::Fallout4 + | GameType::Fallout4VR + | GameType::Starfield ) } } @@ -301,11 +306,12 @@ mod tests { } #[test] - fn game_type_supports_light_plugins_should_be_true_for_tes5se_tes5vr_fo4_and_fo4vr() { + fn game_type_supports_light_plugins_should_be_true_for_tes5se_tes5vr_fo4_fo4vr_and_starfield() { assert!(GameType::SkyrimSE.supports_light_plugins()); assert!(GameType::SkyrimVR.supports_light_plugins()); assert!(GameType::Fallout4.supports_light_plugins()); assert!(GameType::Fallout4VR.supports_light_plugins()); + assert!(GameType::Starfield.supports_light_plugins()); } #[test]