From 2c89a857daeedcb0cab946b14ff50bd0d3ec1f78 Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Sun, 15 May 2022 17:08:09 +0200 Subject: [PATCH] Set origin compat folder --- src/origin/origin_game.rs | 12 ++++++++---- src/origin/origin_platform.rs | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/origin/origin_game.rs b/src/origin/origin_game.rs index d62e3ef..6d761bf 100644 --- a/src/origin/origin_game.rs +++ b/src/origin/origin_game.rs @@ -7,15 +7,19 @@ pub struct OriginGame { pub id: String, pub title: String, pub origin_location: Option, + pub origin_compat_folder: Option, } impl From for ShortcutOwned { fn from(game: OriginGame) -> Self { - let launch = format!( + let launch = match game.origin_compat_folder{ + Some(compat_folder) => + format!("STEAM_COMPAT_DATA_PATH=\"{}\" %command% \"origin2://game/launch?offerIds={}&autoDownload=1&authCode=&cmdParams=\"", compat_folder.to_string_lossy().to_string(), game.id) + , + None => format!( "\"origin2://game/launch?offerIds={}&autoDownload=1&authCode=&cmdParams=\"", - game.id - ); - + game.id) + }; let mut owned_shortcut = if let Some(origin_location) = game.origin_location { let origin_location = format!("\"{}\"", origin_location.to_string_lossy()); Shortcut::new( diff --git a/src/origin/origin_platform.rs b/src/origin/origin_platform.rs index b1c2e1e..fe4b0f6 100644 --- a/src/origin/origin_platform.rs +++ b/src/origin/origin_platform.rs @@ -57,6 +57,7 @@ impl Platform for OriginPlatform { id, title: game_title, origin_location: origin_exe.clone(), + origin_compat_folder: origin_folders.compat_folder.clone(), }) }); Ok(games.collect()) @@ -77,7 +78,6 @@ impl Platform for OriginPlatform { return false; #[cfg(target_family = "unix")] { - //TODO Update this when origin gets support on linux true } } @@ -118,6 +118,8 @@ struct OriginPathData { exe_path: Option, //~/.steam/steam/steamapps/compatdata/X/pfx/drive_c/ProgramData/Origin/LocalContent local_content_path: Option, + //~/.steam/steam/steamapps/compatdata/X + compat_folder: Option, } #[cfg(target_family = "unix")] @@ -150,6 +152,7 @@ fn get_default_locations() -> OriginPathData { if origin_exe_path.exists() && origin_local_content.exists() { res.exe_path = Some(origin_exe_path); res.local_content_path = Some(origin_local_content); + res.compat_folder = Some(dir.path().to_path_buf()); } } }