From a7a486999d5ec8311b4e9a39aaf8391ad4b75677 Mon Sep 17 00:00:00 2001 From: G2-Games Date: Thu, 14 Nov 2024 02:11:39 -0600 Subject: [PATCH] Upgraded dependencies, reduced binary sizes --- luca_pak/Cargo.toml | 6 +++--- luca_pak/src/header.rs | 2 +- luca_pak/src/lib.rs | 4 +--- pak_explorer/Cargo.toml | 8 ++++---- pak_explorer/src/main.rs | 6 ++---- utils/Cargo.toml | 6 +++--- utils/src/bin/czutil.rs | 10 ++-------- utils/src/bin/pakutil.rs | 11 +++-------- utils/src/lib.rs | 12 ++++++++++++ 9 files changed, 31 insertions(+), 34 deletions(-) create mode 100644 utils/src/lib.rs diff --git a/luca_pak/Cargo.toml b/luca_pak/Cargo.toml index 24cd536..ea5ded4 100644 --- a/luca_pak/Cargo.toml +++ b/luca_pak/Cargo.toml @@ -10,9 +10,9 @@ license = "MIT" authors.workspace = true [dependencies] -byteorder = "1.5.0" -log = "0.4.22" -thiserror = "1.0.61" +byteorder-lite = "0.1" +log = "0.4" +thiserror = "2.0" [lints] workspace = true diff --git a/luca_pak/src/header.rs b/luca_pak/src/header.rs index c7ec83f..9b478d0 100644 --- a/luca_pak/src/header.rs +++ b/luca_pak/src/header.rs @@ -1,4 +1,4 @@ -use byteorder::WriteBytesExt; +use byteorder_lite::WriteBytesExt; use std::io::{self, Write}; use crate::LE; diff --git a/luca_pak/src/lib.rs b/luca_pak/src/lib.rs index 25ab642..4a692ea 100644 --- a/luca_pak/src/lib.rs +++ b/luca_pak/src/lib.rs @@ -1,7 +1,7 @@ pub mod entry; pub mod header; -use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; +use byteorder_lite::{LE, ReadBytesExt, WriteBytesExt}; use header::Header; use log::{debug, info}; use std::{ @@ -12,8 +12,6 @@ use std::{ }; use thiserror::Error; -type LE = LittleEndian; - use crate::{entry::Entry, header::PakFlags}; /// An error associated with a PAK file diff --git a/pak_explorer/Cargo.toml b/pak_explorer/Cargo.toml index 8c4a591..f312381 100644 --- a/pak_explorer/Cargo.toml +++ b/pak_explorer/Cargo.toml @@ -12,12 +12,12 @@ publish = false [dependencies] colog = "1.3.0" cz = { path = "../cz/" } -eframe = { version = "0.28.1", default-features = false, features = ["wayland", "x11", "accesskit", "default_fonts", "wgpu"] } -egui_extras = "0.28.1" -image = { version = "0.25.5", default-features = false, features = ["png"] } +eframe = { version = "0.29", default-features = false, features = ["wayland", "x11", "accesskit", "default_fonts", "wgpu"] } +egui_extras = "0.29" +image = { version = "0.25", default-features = false, features = ["png"] } log = "0.4.22" luca_pak = { path = "../luca_pak/" } -rfd = "0.14.1" +rfd = "0.15" [lints] workspace = true diff --git a/pak_explorer/src/main.rs b/pak_explorer/src/main.rs index 946f690..a00da45 100644 --- a/pak_explorer/src/main.rs +++ b/pak_explorer/src/main.rs @@ -1,7 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release use colog; -use eframe::egui::{self, ColorImage, Image, TextureFilter, TextureHandle, TextureOptions}; +use eframe::egui::{self, ColorImage, Image, TextureFilter, TextureHandle, TextureOptions, ThemePreference}; use log::error; use luca_pak::{entry::EntryType, Pak}; use std::fs; @@ -13,7 +13,6 @@ fn main() -> eframe::Result { let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default().with_inner_size([1024.0, 800.0]), - follow_system_theme: true, ..Default::default() }; @@ -31,7 +30,6 @@ fn main() -> eframe::Result { struct PakExplorer { open_file: Option, selected_entry: Option, - entry_text: String, image_texture: Option, hex_string: Option>, } @@ -43,7 +41,6 @@ impl Default for PakExplorer { selected_entry: None, image_texture: None, hex_string: None, - entry_text: String::new(), } } } @@ -52,6 +49,7 @@ impl eframe::App for PakExplorer { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { egui::CentralPanel::default().show(ctx, |ui| { ui.heading("PAK File Explorer"); + ctx.options_mut(|o| o.theme_preference = ThemePreference::System); ui.horizontal(|ui| { if ui.button("Open file").clicked() { diff --git a/utils/Cargo.toml b/utils/Cargo.toml index 35751e8..8d18096 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "utils" -version = "0.2.0" +name = "lbee-utils" +version = "0.2.1" edition = "2021" license = "GPL-3.0-or-later" authors.workspace = true @@ -15,9 +15,9 @@ name = "pakutil" [dependencies] cz = { path = "../cz/" } luca_pak = { path = "../luca_pak/" } - image = { version = "0.25", default-features = false, features = ["png"] } clap = { version = "4.5", features = ["derive", "error-context"] } +owo-colors = "4.1" [build-dependencies] vergen-gix = { version = "1.0", features = ["build", "cargo", "rustc", "si"] } diff --git a/utils/src/bin/czutil.rs b/utils/src/bin/czutil.rs index 8d85fc7..79e6986 100644 --- a/utils/src/bin/czutil.rs +++ b/utils/src/bin/czutil.rs @@ -1,5 +1,6 @@ use clap::{error::ErrorKind, Error, Parser, Subcommand}; use image::ColorType; +use lbee_utils::version; use std::{ fs, path::{Path, PathBuf}, @@ -71,14 +72,7 @@ fn main() { let cli = Cli::parse(); if cli.version { - println!( - "{}, {} v{}-{} ({})", - env!("CARGO_BIN_NAME"), - env!("CARGO_PKG_NAME"), - env!("CARGO_PKG_VERSION"), - &env!("VERGEN_GIT_SHA")[0..=6], - env!("VERGEN_GIT_COMMIT_DATE"), - ); + println!("{}", version(env!("CARGO_BIN_NAME"))); exit(0); } diff --git a/utils/src/bin/pakutil.rs b/utils/src/bin/pakutil.rs index 1557cb5..bf1f5a2 100644 --- a/utils/src/bin/pakutil.rs +++ b/utils/src/bin/pakutil.rs @@ -3,6 +3,7 @@ use clap::{ Parser, Subcommand, }; use luca_pak::Pak; +use lbee_utils::version; use std::{fs, path::PathBuf, process::exit}; /// Utility to maniuplate PAK archive files from the LUCA System game engine by @@ -10,6 +11,7 @@ use std::{fs, path::PathBuf, process::exit}; #[derive(Parser)] #[command(name = "PAK Utility")] #[command(author, version, about, long_about = None, disable_version_flag = true)] +#[command(arg_required_else_help(true))] struct Cli { /// Show program version information #[arg(short('V'), long)] @@ -64,14 +66,7 @@ fn main() { let cli = Cli::parse(); if cli.version { - println!( - "{}, {} v{}-{} ({})", - env!("CARGO_BIN_NAME"), - env!("CARGO_PKG_NAME"), - env!("CARGO_PKG_VERSION"), - &env!("VERGEN_GIT_SHA")[0..=6], - env!("VERGEN_GIT_COMMIT_DATE"), - ); + println!("{}", version(env!("CARGO_BIN_NAME"))); exit(0); } diff --git a/utils/src/lib.rs b/utils/src/lib.rs new file mode 100644 index 0000000..b6c3a2d --- /dev/null +++ b/utils/src/lib.rs @@ -0,0 +1,12 @@ +use owo_colors::OwoColorize; + +pub fn version(bin_name: &str) -> String { + format!( + "{}, {} v{} ({}, {})", + bin_name, + env!("CARGO_PKG_NAME").cyan(), + env!("CARGO_PKG_VERSION").blue(), + (&env!("VERGEN_GIT_SHA")[0..=6]).green(), + env!("VERGEN_GIT_COMMIT_DATE").green(), + ) +}