Skip to content

Commit

Permalink
Add support for OpenMW .omwaddon and .omwgame plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Ortham committed Jan 14, 2025
1 parent 94d663b commit 47ff3b8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ffi/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,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;

/// Game code for OpenMW.
#[no_mangle]
pub static LCI_GAME_OPENMW: c_int = 10;
1 change: 1 addition & 0 deletions ffi/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub fn map_game_type(game_type: c_int) -> Result<GameType, c_int> {
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),
x if x == LCI_GAME_OPENMW => Ok(GameType::OpenMW),
_ => Err(LCI_ERROR_INVALID_ARGS),
}
}
Expand Down
1 change: 1 addition & 0 deletions ffi/tests/ffi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void test_game_id_values() {
assert(LCI_GAME_FALLOUT_4 == 6);
assert(LCI_GAME_FALLOUT_4_VR == 7);
assert(LCI_GAME_STARFIELD == 9);
assert(LCI_GAME_OPENMW == 10);
}

void test_lci_condition_parse() {
Expand Down
2 changes: 1 addition & 1 deletion src/function/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn evaluate_is_master(state: &State, file_path: &Path) -> Result<bool, Error> {
use esplugin::GameId;

let game_id = match state.game_type {
GameType::Morrowind => GameId::Morrowind,
GameType::Morrowind | GameType::OpenMW => GameId::Morrowind,
GameType::Oblivion => GameId::Oblivion,
GameType::Skyrim => GameId::Skyrim,
GameType::SkyrimSE | GameType::SkyrimVR => GameId::SkyrimSE,
Expand Down
3 changes: 3 additions & 0 deletions src/function/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ fn is_unghosted_plugin_file_extension(game_type: GameType, extension: &OsStr) ->
extension.eq_ignore_ascii_case("esp")
|| extension.eq_ignore_ascii_case("esm")
|| (game_type.supports_light_plugins() && extension.eq_ignore_ascii_case("esl"))
|| (game_type == GameType::OpenMW
&& (extension.eq_ignore_ascii_case("omwaddon")
|| extension.eq_ignore_ascii_case("omwgame")))
}

fn has_unghosted_plugin_file_extension(game_type: GameType, path: &Path) -> bool {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum GameType {
Fallout4VR,
Morrowind,
Starfield,
OpenMW,
}

impl GameType {
Expand Down

0 comments on commit 47ff3b8

Please sign in to comment.