Skip to content

Commit

Permalink
Merge branch 'main' into feat/delete-old-mode-before-update
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse committed Jul 3, 2023
2 parents ee61999 + f1b789e commit d9d6973
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 293 deletions.
263 changes: 4 additions & 259 deletions src-tauri/Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "1.19.2"
version = "1.20.1"
description = "A Tauri App"
authors = ["you"]
license = ""
Expand Down Expand Up @@ -48,9 +48,6 @@ tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace",
json5 = "0.4.1"
# Async recursion for recursive mod install
async-recursion = "1.0.0"
# Game scanner
# Use specific commit that updates deprecated library
game-scanner = { git = "https://github.com/EqualGames/game-scanner.git", rev = "94dcbd086a5987361a2847988a060da9b5dd3908" }
# For parsing timestamps
chrono = "0.4.23"
# TypeScript bindings
Expand All @@ -64,9 +61,12 @@ log = "0.4.17"
zip-extract = "0.1.2"
# open urls
open = "3.2.0"
semver = "1.0"

[target.'cfg(windows)'.dependencies]
# Windows API stuff
winapi = "0.3.9"
semver = "1.0"
winreg = "0.11.0"

[features]
# by default Tauri runs in production mode
Expand Down
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 game IDs on Origin/EA-App
pub const TITANFALL2_ORIGIN_IDS: [&str; 2] = ["Origin.OFR.50.0001452", "Origin.OFR.50.0001456"];

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

Expand Down
3 changes: 1 addition & 2 deletions src-tauri/src/northstar/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ async fn do_install(
}
}
},
)
.unwrap();
)?;

window
.emit(
Expand Down
38 changes: 19 additions & 19 deletions src-tauri/src/platform_specific/windows.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/// Windows specific code
use anyhow::{anyhow, Result};

use crate::{check_is_valid_game_path, constants::TITANFALL2_ORIGIN_IDS};
#[cfg(target_os = "windows")]
use winreg::{enums::HKEY_LOCAL_MACHINE, RegKey};

use crate::check_is_valid_game_path;

/// Gets Titanfall2 install location on Origin
pub fn origin_install_location_detection() -> Result<String, anyhow::Error> {
// Iterate over known Titanfall2 Origin IDs
for origin_id in TITANFALL2_ORIGIN_IDS {
match game_scanner::origin::find(origin_id) {
// Origin ID found as installed game
Ok(game) => {
if game.path.is_some() {
let game_path = game.path.unwrap();
let game_path_str = game_path.to_str().unwrap();
match check_is_valid_game_path(game_path_str) {
Ok(()) => {
return Ok(game_path_str.to_string());
}
Err(err) => {
log::warn!("{}", err);
continue; // Not a valid game path
}
#[cfg(target_os = "windows")]
{
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
match hklm.open_subkey("SOFTWARE\\Respawn\\Titanfall2") {
Ok(tf) => {
let game_path_str: String = tf.get_value("Install Dir")?;

match check_is_valid_game_path(&game_path_str) {
Ok(()) => {
return Ok(game_path_str.to_string());
}
Err(err) => {
log::warn!("{err}");
}
}
}
Err(err) => {
log::warn!("Couldn't find {origin_id}: {err}")
log::warn!("{err}");
}
}
}

Err(anyhow!("No Origin install path found"))
Err(anyhow!("No Origin / EA App install path found"))
}
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"package": {
"productName": "FlightCore",
"version": "1.19.2"
"version": "1.20.1"
},
"tauri": {
"allowlist": {
Expand Down
2 changes: 2 additions & 0 deletions src-vue/src/i18n/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
"warning": "This window contains various functionality to repair common issues with Northstar and FlightCore.",
"disable_all_but_core": "Disable all but core mods",
"disable_all_but_core_success": "Disabled all mods but core",
"disable_modsettings": "Disable ModSettings mod",
"disable_modsettings_success": "Disabled ModSettings mod",
"force_reinstall_ns": "Force reinstall Northstar",
"force_delete_temp_dl": "Force delete temp download folder",
"delete_persistent_store": "Delete FlightCore persistent store",
Expand Down
1 change: 1 addition & 0 deletions src-vue/src/views/DeveloperView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export default defineComponent({
showNotification("Done", "Fetched tags");
this.first_tag = this.ns_release_tags[1];
this.second_tag = this.ns_release_tags[0];
this.compareTags();
})
.catch((error) => {
showErrorNotification(error);
Expand Down
18 changes: 18 additions & 0 deletions src-vue/src/views/RepairView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
{{ $t('settings.repair.window.force_reinstall_ns') }}
</el-button>

<el-button type="primary" @click="disableModsettingsMod">
{{ $t('settings.repair.window.disable_modsettings') }}
</el-button>

<h2>FlightCore</h2>

<el-button type="primary" @click="cleanUpDownloadFolder">
Expand Down Expand Up @@ -121,6 +125,20 @@ export default defineComponent({
// ...and save
await persistentStore.save();
},
async disableModsettingsMod() {
let game_install = {
game_path: this.$store.state.game_path,
install_type: this.$store.state.install_type
} as GameInstall;
await invoke("set_mod_enabled_status", { gameInstall: game_install, modName: "Mod Settings", isEnabled: false })
.then((message) => {
showNotification(this.$t('generic.success'), this.$t('settings.repair.window.disable_modsettings_success'));
})
.catch((error) => {
showErrorNotification(error);
});
},
},
watch: {
// Lang value is propagated to repair view after it's mounted, so we need to watch
Expand Down
13 changes: 9 additions & 4 deletions src-vue/src/views/mods/ThunderstoreModsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
layout="prev, pager, next"
:page-size="modsPerPage"
:total="modsList.length"
@current-change="(e: number) => currentPageIndex = e - 1"
@update:current-page="onPaginationChange"
/>
</div>

Expand All @@ -36,7 +36,8 @@
layout="prev, pager, next"
:page-size="modsPerPage"
:total="modsList.length"
@current-change="onBottomPaginationChange"
@update:current-page="onPaginationChange"
@current-change="scrollTop"
/>
</div>
</div>
Expand Down Expand Up @@ -183,9 +184,13 @@ export default defineComponent({
/**
* This updates current pagination and scrolls view to the top.
*/
onBottomPaginationChange(index: number) {
onPaginationChange(index: number) {
this.currentPageIndex = index - 1;
(this.$refs.scrollbar as ScrollbarInstance).scrollTo({ top: 0, behavior: 'smooth' });
},
scrollTop(index: number) {
setTimeout(() => {
(this.$refs.scrollbar as ScrollbarInstance).scrollTo({ top: 0, behavior: 'smooth' });
}, 100)
}
},
watch: {
Expand Down

0 comments on commit d9d6973

Please sign in to comment.