From 336fa53c2e9fa63bcb54e6a1b5190d7e847e596b Mon Sep 17 00:00:00 2001 From: cohaereo Date: Wed, 27 Mar 2024 23:37:00 +0100 Subject: [PATCH] Bump version to 0.4.1 --- CHANGELOG.md | 7 ++++-- Cargo.lock | 9 ++++--- Cargo.toml | 8 +++--- crates/alkahest-data/Cargo.toml | 2 +- crates/alkahest-pm/Cargo.toml | 2 +- src/game_selector.rs | 43 ++++++++++++++++++++++++--------- src/main.rs | 4 ++- src/map.rs | 3 +++ src/overlays/menu.rs | 17 +++++++++++++ 9 files changed, 71 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2fea3e9..7af81625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ You can add additional user facing information if it's a major breaking change. ``` Change types: - - `✨ Major Features` for version-defining changes. + - `✨ Major Changes` for version-defining changes. - `Added` for new features. - `Changed` for changes in existing functionality. - `Deprecated` for soon-to-be removed features. @@ -30,7 +30,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ## Unreleased / Rolling Release -### ✨ Major Features +## 0.4.1 - 2024-03-27 + +### ✨ Major Changes +- ⚠ Alkahest is no longer compatible with Avvy's Alkgui. The features provided by Alkgui are now available in Alkahest itself. - Reworked the map loading mechanism to allow for maps to be loaded individually by @cohaereo - Added a map and activity browser by @cohaereo - Added a game installation detector by @cohaereo diff --git a/Cargo.lock b/Cargo.lock index e4fb6c56..d47a0df4 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -163,6 +163,7 @@ dependencies = [ "tinyvec", "tokio", "tracing", + "tracing-log", "tracing-subscriber", "tracing-tracy", "tracy-client", @@ -986,9 +987,9 @@ dependencies = [ [[package]] name = "destiny-pkg" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325086ced08442c398b1708245cc1e0fc7cde6045b50f988ba982b007ca141fa" +checksum = "50e81d877c30e1b8e853e2bcf2c69d4dbdbd8a18ad8293333066c3e256ba700d" dependencies = [ "aes", "aes-gcm", @@ -1446,9 +1447,9 @@ dependencies = [ [[package]] name = "game-detector" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2534893dec99b0aaa5750e267e1ce422127f278766ab0aa8ad7b9bb6513828" +checksum = "da20c531faaf4aa01cfe14f3afdddcc4fd29076b7e7d8de910b03e924377823b" dependencies = [ "anyhow", "fs-err", diff --git a/Cargo.toml b/Cargo.toml index beeacf0f..4afa9fcf 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ tiger-parse = { version = "0.1.3", git = "https://github.com/v4nguard/tiger-pars ] } destiny-havok = { path = "./crates/destiny-havok" } -destiny-pkg = "0.9.8" +destiny-pkg = "0.9.9" anyhow = { version = "1.0.71" } winit = { version = "0.28" } @@ -89,12 +89,14 @@ build-time = "0.1.3" rustc-hash = "1.1.0" once_cell = "1.19.0" directories = "5.0.1" -game-detector = "0.1.1" +game-detector = "0.1.3" +tracing-log = "0.2.0" [features] default = ["discord_rpc"] tracy = [] -# Ensures all TFX opcodes are interpreted +# Disable sorting the map list +keep_map_order = [] # TODO(cohae): This should be a runtime configuration setting? discord_rpc = ["dep:discord-rpc-client"] diff --git a/crates/alkahest-data/Cargo.toml b/crates/alkahest-data/Cargo.toml index dca3ea01..3e45b409 100644 --- a/crates/alkahest-data/Cargo.toml +++ b/crates/alkahest-data/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] alkahest-pm = { path = "../alkahest-pm" } binrw = "0.13.3" -destiny-pkg = "0.9.8" +destiny-pkg = "0.9.9" glam = { version = "0.25" } tiger-parse = { version = "0.1.3", git = "https://github.com/v4nguard/tiger-parse", features = [ "check_types", diff --git a/crates/alkahest-pm/Cargo.toml b/crates/alkahest-pm/Cargo.toml index 749e03e3..87baa2eb 100644 --- a/crates/alkahest-pm/Cargo.toml +++ b/crates/alkahest-pm/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0.79" -destiny-pkg = "0.9.8" +destiny-pkg = "0.9.9" lazy_static = "1.4.0" parking_lot = "0.12.1" diff --git a/src/game_selector.rs b/src/game_selector.rs index 17def240..7a11b89d 100644 --- a/src/game_selector.rs +++ b/src/game_selector.rs @@ -14,11 +14,11 @@ use winit::{ dpi::PhysicalSize, event::{Event, WindowEvent}, event_loop::{ControlFlow, EventLoop}, - platform::run_return::EventLoopExtRunReturn, + platform::{run_return::EventLoopExtRunReturn, windows::WindowBuilderExtWindows}, }; use crate::{ - icons::{ICON_CONTROLLER, ICON_MICROSOFT, ICON_STEAM}, + icons::{ICON_CONTROLLER, ICON_FOLDER_OPEN, ICON_MICROSOFT, ICON_STEAM}, overlays::{ big_button::BigButton, gui::{GuiManager, PreDrawResult}, @@ -29,11 +29,16 @@ use crate::{ /// Creates a temporary window with egui to select a game installation /// This function should not be called in another render loop, as it will hang until this function completes -pub fn select_game_installation(event_loop: &mut EventLoop<()>) -> anyhow::Result { +pub fn select_game_installation( + event_loop: &mut EventLoop<()>, + icon: &winit::window::Icon, +) -> anyhow::Result { let window = winit::window::WindowBuilder::new() .with_title("Alkahest") .with_inner_size(PhysicalSize::new(320, 320)) .with_min_inner_size(PhysicalSize::new(320, 480)) + .with_window_icon(Some(icon.clone())) + .with_taskbar_icon(Some(icon.clone())) .build(event_loop)?; let window = Arc::new(window); @@ -124,15 +129,29 @@ pub fn select_game_installation(event_loop: &mut EventLoop<()>) -> anyhow::Resul } } - // if BigButton::new(ICON_FOLDER_OPEN, "Browse") - // .full_width() - // .ui(ui) - // .clicked() - // { - // let dialog = native_dialog::FileDialog::new() - // .set_title("Select Destiny 2 packages directory") - // .show_open_single_dir()?; - // } + if BigButton::new(ICON_FOLDER_OPEN, "Browse") + .full_width() + .ui(ui) + .clicked() + { + if let Ok(Some(path)) = native_dialog::FileDialog::new() + .set_title("Select Destiny 2 packages directory") + .show_open_single_dir() { + if path.ends_with("packages") { + selected_path = Ok(path.parent().unwrap().to_string_lossy().to_string()); + *control_flow = ControlFlow::Exit; + } else if path.ends_with("Destiny 2") { + // cohae: Idiot-proofing this a bit + selected_path = Ok(path.to_string_lossy().to_string()); + *control_flow = ControlFlow::Exit; + } else { + native_dialog::MessageDialog::new() + .set_title("Invalid directory") + .set_text("The selected directory is not a packages directory. Please select the packages directory of your game installation.") + .show_alert().ok(); + } + } + } }); PreDrawResult::Continue diff --git a/src/main.rs b/src/main.rs index ee9f8f0f..fd034be9 100755 --- a/src/main.rs +++ b/src/main.rs @@ -43,6 +43,7 @@ use technique::Technique; use text::GlobalStringmap; use tiger_parse::PackageManagerExt; use tracing::level_filters::LevelFilter; +use tracing_log::LogTracer; use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Layer}; use windows::Win32::{ Foundation::DXGI_STATUS_OCCLUDED, @@ -197,6 +198,7 @@ pub async fn main() -> anyhow::Result<()> { None }; + LogTracer::init()?; tracing::subscriber::set_global_default( tracing_subscriber::registry() .with(tracy_layer) @@ -227,7 +229,7 @@ pub async fn main() -> anyhow::Result<()> { PathBuf::from_str(&p).context("Invalid package directory")? } else { let path = PathBuf::from_str( - &game_selector::select_game_installation(&mut event_loop) + &game_selector::select_game_installation(&mut event_loop, &icon) .context("No game installation selected")?, ) .unwrap(); diff --git a/src/map.rs b/src/map.rs index 390e4a4a..15a187fc 100755 --- a/src/map.rs +++ b/src/map.rs @@ -184,6 +184,9 @@ impl MapList { }) .collect(); + #[cfg(not(feature = "keep_map_order"))] + self.maps.sort_by_key(|m| m.name.clone()); + self.updated = true; self.current_map = 0; self.previous_map = 0; diff --git a/src/overlays/menu.rs b/src/overlays/menu.rs index 6d78403f..d0ee1065 100644 --- a/src/overlays/menu.rs +++ b/src/overlays/menu.rs @@ -222,6 +222,23 @@ impl Overlay for MenuBar { ui.separator(); + if ui + .button("Change package directory") + .on_hover_text("Will restart Alkahest") + .clicked() + { + config::with_mut(|c| c.packages_directory = None); + config::persist(); + + // Spawn the new process + std::process::Command::new(std::env::current_exe().unwrap()) + .args(std::env::args().skip(1)) + .spawn() + .expect("Failed to spawn the new alkahest process"); + + std::process::exit(0); + } + if ui.button("Changelog").clicked() { self.changelog_open = true; ui.close_menu();