Skip to content

Commit

Permalink
Fix UEVR missing from available mods
Browse files Browse the repository at this point in the history
  • Loading branch information
Raicuparta committed Oct 23, 2023
1 parent 1723ea7 commit 1779cf5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
13 changes: 11 additions & 2 deletions backend/src/installed_game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ fn is_mod_installed(game_id: &str, mod_id: &str) -> bool {
false
}

fn equal_or_none<T: PartialEq>(a: Option<T>, b: Option<T>) -> bool {
match (a, b) {
(Some(value_a), Some(value_b)) => value_a == value_b,
_ => true,
}
}

fn get_available_mods(
game_id: &str,
mod_loaders: &mod_loader::DataMap,
Expand All @@ -171,8 +178,10 @@ fn get_available_mods(
.iter()
.flat_map(|(_, mod_loader)| &mod_loader.mods)
.filter_map(|game_mod| {
if game_mod.engine? == executable.engine.as_ref()?.brand
&& game_mod.scripting_backend? == executable.scripting_backend?
if equal_or_none(
game_mod.engine,
executable.engine.as_ref().map(|engine| engine.brand),
) && equal_or_none(game_mod.scripting_backend, executable.scripting_backend)
{
Some((game_mod.id.clone(), is_mod_installed(game_id, &game_mod.id)))
} else {
Expand Down
5 changes: 1 addition & 4 deletions backend/src/steam/owned_games.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ use std::{
fs,
};

use lazy_regex::{
BytesRegex,
Regex,
};
use lazy_regex::BytesRegex;
use steamlocate::SteamDir;

use super::{
Expand Down
2 changes: 1 addition & 1 deletion frontend/api/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ export type GameExecutable = { path: string; engine: GameEngine | null; architec
export type ModKind = "Installable" | "Runnable"
export type AppEvent = "SyncInstalledGames" | "SyncOwnedGames" | "SyncDiscoverGames" | "SyncMods" | "ExecutedSteamCommand"
export type SteamLaunchOption = { launchId: string; appId: number; description: string | null; executable: string | null; arguments: string | null; appType: string | null; osList: string | null; betaKey: string | null; osArch: string | null }
export type OwnedGame = { id: string; name: string; installed: boolean; osList: OperatingSystem[]; engine: GameEngineBrand; releaseDate: number; thumbnailUrl: string }
export type Mod = { id: string; name: string; scriptingBackend: UnityScriptingBackend | null; engine: GameEngineBrand | null; kind: ModKind; path: string }
export type InstalledGame = { id: string; name: string; discriminator: string | null; steamLaunch: SteamLaunchOption | null; executable: GameExecutable; thumbnailUrl: string | null; availableMods: { [key: string]: boolean } }
export type ModLoaderData = { id: string; path: string; mods: Mod[] }
export type UnityScriptingBackend = "Il2Cpp" | "Mono"
export type GameEngine = { brand: GameEngineBrand; version: GameEngineVersion | null }
export type Architecture = "X64" | "X86"
export type OwnedGame = { id: string; name: string; installed: boolean; osList: OperatingSystem[]; engine: GameEngineBrand; releaseDate: number; thumbnailUrl: string }
export type OperatingSystem = "Linux" | "Windows"

0 comments on commit 1779cf5

Please sign in to comment.