Add support for Starfield

As far as loot-condition-interpreter is concerned, it's not really any
different from Fallout 4.
This commit is contained in:
Oliver Hamlet
2023-09-05 18:48:44 +01:00
parent 9a29925b21
commit 30c140eb4d
6 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ edition = "2018"
[dependencies] [dependencies]
crc32fast = "1.2.0" crc32fast = "1.2.0"
esplugin = "4.0.0" esplugin = "4.1.0"
nom = "7.0.0" nom = "7.0.0"
pelite = "0.10.0" pelite = "0.10.0"
regex = "1.0.5" regex = "1.0.5"
+4
View File
@@ -72,3 +72,7 @@ pub static LCI_GAME_SKYRIM_VR: c_int = 3;
/// Game code for Fallout 4 VR. /// Game code for Fallout 4 VR.
#[no_mangle] #[no_mangle]
pub static LCI_GAME_FALLOUT_4_VR: c_int = 7; pub static LCI_GAME_FALLOUT_4_VR: c_int = 7;
/// Game code for Starfield.
#[no_mangle]
pub static LCI_GAME_STARFIELD: c_int = 9;
+1
View File
@@ -42,6 +42,7 @@ pub fn map_game_type(game_type: c_int) -> Result<GameType, c_int> {
x if x == LCI_GAME_FALLOUT_NV => Ok(GameType::FalloutNV), 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 => Ok(GameType::Fallout4),
x if x == LCI_GAME_FALLOUT_4_VR => Ok(GameType::Fallout4VR), 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), _ => Err(LCI_ERROR_INVALID_ARGS),
} }
} }
+1
View File
@@ -21,6 +21,7 @@ void test_game_id_values() {
assert(LCI_GAME_FALLOUT_NV == 5); assert(LCI_GAME_FALLOUT_NV == 5);
assert(LCI_GAME_FALLOUT_4 == 6); assert(LCI_GAME_FALLOUT_4 == 6);
assert(LCI_GAME_FALLOUT_4_VR == 7); assert(LCI_GAME_FALLOUT_4_VR == 7);
assert(LCI_GAME_STARFIELD == 9);
} }
void test_lci_condition_parse() { void test_lci_condition_parse() {
+1
View File
@@ -129,6 +129,7 @@ fn evaluate_is_master(state: &State, file_path: &Path) -> Result<bool, Error> {
GameType::Fallout3 => GameId::Fallout3, GameType::Fallout3 => GameId::Fallout3,
GameType::FalloutNV => GameId::FalloutNV, GameType::FalloutNV => GameId::FalloutNV,
GameType::Fallout4 | GameType::Fallout4VR => GameId::Fallout4, GameType::Fallout4 | GameType::Fallout4VR => GameId::Fallout4,
GameType::Starfield => GameId::Starfield,
}; };
let path = resolve_path(state, file_path); let path = resolve_path(state, file_path);
+8 -2
View File
@@ -35,13 +35,18 @@ pub enum GameType {
Fallout4, Fallout4,
Fallout4VR, Fallout4VR,
Morrowind, Morrowind,
Starfield,
} }
impl GameType { impl GameType {
fn supports_light_plugins(self) -> bool { fn supports_light_plugins(self) -> bool {
matches!( matches!(
self, 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] #[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::SkyrimSE.supports_light_plugins());
assert!(GameType::SkyrimVR.supports_light_plugins()); assert!(GameType::SkyrimVR.supports_light_plugins());
assert!(GameType::Fallout4.supports_light_plugins()); assert!(GameType::Fallout4.supports_light_plugins());
assert!(GameType::Fallout4VR.supports_light_plugins()); assert!(GameType::Fallout4VR.supports_light_plugins());
assert!(GameType::Starfield.supports_light_plugins());
} }
#[test] #[test]