Skip to content

Commit

Permalink
refactor: Get Steam ID from libthermite (#786)
Browse files Browse the repository at this point in the history
Instead of defining our own const, let's just re-use the one recently added to libthermite
  • Loading branch information
GeckoEidechse authored Feb 6, 2024
1 parent c48549a commit a074ecb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src-tauri/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ pub const BLACKLISTED_MODS: [&str; 3] = [
"ebkr-r2modman",
];

/// Titanfall2 Steam App ID
pub const TITANFALL2_STEAM_ID: &str = "1237970";

/// Order in which the sections for release notes should be displayed
pub const SECTION_ORDER: [&str; 11] = [
"feat", "fix", "docs", "style", "refactor", "build", "test", "i18n", "ci", "chore", "other",
Expand Down
5 changes: 2 additions & 3 deletions src-tauri/src/northstar/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;
use std::{cell::RefCell, time::Instant};
use ts_rs::TS;

use crate::constants::{CORE_MODS, NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL, TITANFALL2_STEAM_ID};
use crate::constants::{CORE_MODS, NORTHSTAR_DEFAULT_PROFILE, NORTHSTAR_DLL};
use crate::{
util::{extract, move_dir_all},
GameInstall, InstallType,
Expand Down Expand Up @@ -310,8 +310,7 @@ pub fn find_game_install_location() -> Result<GameInstall, String> {
}
}

let titanfall2_steamid = TITANFALL2_STEAM_ID.parse().unwrap();
match steamdir.app(&titanfall2_steamid) {
match steamdir.app(&thermite::TITANFALL2_STEAM_ID) {
Some(app) => {
// println!("{:#?}", app);
let game_install = GameInstall {
Expand Down
12 changes: 4 additions & 8 deletions src-tauri/src/northstar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ pub mod install;
pub mod profile;

use crate::util::check_ea_app_or_origin_running;
use crate::{
constants::{CORE_MODS, TITANFALL2_STEAM_ID},
platform_specific::get_host_os,
GameInstall, InstallType,
};
use crate::{constants::CORE_MODS, platform_specific::get_host_os, GameInstall, InstallType};
use crate::{NorthstarThunderstoreRelease, NorthstarThunderstoreReleaseWrapper};
use anyhow::anyhow;

Expand Down Expand Up @@ -239,8 +235,7 @@ pub fn launch_northstar_steam(
match steamlocate::SteamDir::locate() {
Some(mut steamdir) => {
if get_host_os() != "windows" {
let titanfall2_steamid: u32 = TITANFALL2_STEAM_ID.parse().unwrap();
match steamdir.compat_tool(&titanfall2_steamid) {
match steamdir.compat_tool(&thermite::TITANFALL2_STEAM_ID) {
Some(_) => {}
None => {
return Err(
Expand All @@ -263,7 +258,8 @@ pub fn launch_northstar_steam(

match open::that(format!(
"steam://run/{}//-profile={} --northstar/",
TITANFALL2_STEAM_ID, game_install.profile
thermite::TITANFALL2_STEAM_ID,
game_install.profile
)) {
Ok(()) => Ok("Started game".to_string()),
Err(_err) => Err("Failed to launch Titanfall 2 via Steam".to_string()),
Expand Down

0 comments on commit a074ecb

Please sign in to comment.