From f8bba45a88eb904f8614390771446af0f82b0c9c Mon Sep 17 00:00:00 2001 From: Mccree Lee Date: Wed, 10 Jul 2024 18:31:16 +0800 Subject: [PATCH] feat: hollow launcher --- Hollow/App.axaml.cs | 10 - Hollow/Program.cs | 22 +- Hollow/Views/MainWindow.axaml.cs | 3 +- build.ps1 | 12 +- hollow-launcher/Cargo.lock | 276 ++++++++++++++++++++++++ hollow-launcher/Cargo.toml | 16 ++ hollow-launcher/assets/small_icon.ico | Bin 0 -> 16958 bytes hollow-launcher/build.rs | 9 + hollow-launcher/src/main.rs | 90 ++++++++ hollow-launcher/target/.rustc_info.json | 1 + hollow-launcher/target/CACHEDIR.TAG | 3 + 11 files changed, 425 insertions(+), 17 deletions(-) create mode 100644 hollow-launcher/Cargo.lock create mode 100644 hollow-launcher/Cargo.toml create mode 100644 hollow-launcher/assets/small_icon.ico create mode 100644 hollow-launcher/build.rs create mode 100644 hollow-launcher/src/main.rs create mode 100644 hollow-launcher/target/.rustc_info.json create mode 100644 hollow-launcher/target/CACHEDIR.TAG diff --git a/Hollow/App.axaml.cs b/Hollow/App.axaml.cs index cf3aa10..0a9068e 100644 --- a/Hollow/App.axaml.cs +++ b/Hollow/App.axaml.cs @@ -26,18 +26,8 @@ public class App : Application private static IServiceProvider? _provider; public override void Initialize() { - Log.Logger = new LoggerConfiguration() - .Enrich.WithProperty("Version", AppInfo.AppVersion) - .MinimumLevel.Debug() - .WriteTo.Console(outputTemplate: "[{Level}] {Timestamp:HH:mm:ss} {Message}{NewLine}{Exception}") - .WriteTo.File(Path.Combine(AppInfo.LogDir, "log_.txt"), outputTemplate: "[{Level}] {Timestamp:HH:mm:ss} {Message}{NewLine}{Exception}", rollingInterval: RollingInterval.Day, retainedFileCountLimit: null) - .CreateLogger(); - AvaloniaXamlLoader.Load(this); _provider = ConfigureServices(); - - //TODO: Platform specific - Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", AppInfo.CachesDir); AvaloniaWebViewBuilder.Initialize(default); } diff --git a/Hollow/Program.cs b/Hollow/Program.cs index 7638c69..77761f2 100644 --- a/Hollow/Program.cs +++ b/Hollow/Program.cs @@ -1,6 +1,10 @@ using Avalonia; using System; +using System.IO; +using Avalonia.Logging; using Avalonia.WebView.Desktop; +using Hollow.Models; +using Serilog; namespace Hollow; @@ -10,14 +14,26 @@ sealed class Program // SynchronizationContext-reliant code before AppMain is called: things aren't initialized // yet and stuff might break. [STAThread] - public static void Main(string[] args) => BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); + public static void Main(string[] args) + { + Log.Logger = new LoggerConfiguration() + .Enrich.WithProperty("Version", AppInfo.AppVersion) + .MinimumLevel.Debug() + .WriteTo.Console(outputTemplate: "[{Level}] {Timestamp:HH:mm:ss} {Message}{NewLine}{Exception}") + .WriteTo.File(Path.Combine(AppInfo.LogDir, "log_.txt"), outputTemplate: "[{Level}] {Timestamp:HH:mm:ss} {Message}{NewLine}{Exception}", rollingInterval: RollingInterval.Day, retainedFileCountLimit: null) + .CreateLogger(); + + //TODO: Platform specific + Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", AppInfo.CachesDir); + + BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); + } // Avalonia configuration, don't remove; also used by visual designer. public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .WithInterFont() .LogToTrace() + .WithInterFont() .UseDesktopWebView(); } \ No newline at end of file diff --git a/Hollow/Views/MainWindow.axaml.cs b/Hollow/Views/MainWindow.axaml.cs index 4fc0324..fb5733c 100644 --- a/Hollow/Views/MainWindow.axaml.cs +++ b/Hollow/Views/MainWindow.axaml.cs @@ -1,3 +1,4 @@ +using System; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Interactivity; @@ -18,7 +19,7 @@ private void MinimizeButton_OnClick(object? _1, RoutedEventArgs _2) private void CloseButton_OnClick(object? _1, RoutedEventArgs _2) { - Close(); + Environment.Exit(0); } protected override void OnPointerPressed(PointerPressedEventArgs e) diff --git a/build.ps1 b/build.ps1 index ef7c79a..94dbdcb 100644 --- a/build.ps1 +++ b/build.ps1 @@ -4,15 +4,21 @@ param( $ErrorActionPreference = "Stop"; +Write-Output "Start building launcher..."; + +cargo build --manifest-path .\hollow-launcher\Cargo.toml -r + Write-Output "Start building withRuntime..."; -dotnet publish Hollow/Hollow.csproj -o "build/$Version/withRuntime" -p:EnableCompressionInSingleFile=true -p:PublishSingleFile=true -p:Platform=win-x64 -p:SelfContained=true -p:AssemblyVersion=$Version -p:Configuration=Release; +dotnet publish Hollow/Hollow.csproj -o "build/$Version/withRuntime/hollow_app" -r win-x64 -p:SelfContained=true -p:AssemblyVersion=$Version -p:Configuration=Release; -Rename-Item -Path "build/$Version/withRuntime/Hollow.exe" -NewName "Hollow_withRuntime.exe" +Copy-Item -Path ".\hollow-launcher\target\release\Hollow.exe" -Destination ".\build\$Version\withRuntime\Hollow.exe" Write-Output "Start building withoutRuntime..."; -dotnet publish Hollow/Hollow.csproj -o "build/$Version/withoutRuntime" -p:Platform=win-x64 -p:PublishReadyToRun=true -p:SelfContained=false -p:AssemblyVersion=$Version -p:Configuration=Release; +dotnet publish Hollow/Hollow.csproj -o "build/$Version/withoutRuntime/hollow_app" -r win-x64 -p:SelfContained=false -p:AssemblyVersion=$Version -p:Configuration=Release; + +Copy-Item -Path ".\hollow-launcher\target\release\Hollow.exe" -Destination ".\build\$Version\withoutRuntime\Hollow.exe" Write-Output "Build Finished"; diff --git a/hollow-launcher/Cargo.lock b/hollow-launcher/Cargo.lock new file mode 100644 index 0000000..328309c --- /dev/null +++ b/hollow-launcher/Cargo.lock @@ -0,0 +1,276 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "anstream" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "clap" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64acc1846d54c1fe936a78dc189c34e28d3f5afc348403f28ecf53660b9b8462" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8393d67ba2e7bfaf28a23458e4e2b543cc73a99595511eb207fdb8aede942" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bac35c6dafb060fd4d275d9a4ffae97917c13a6327903a8be2153cd964f7085" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hollow-launcher" +version = "0.0.1" +dependencies = [ + "clap", + "winres", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "serde" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.204" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml", +] diff --git a/hollow-launcher/Cargo.toml b/hollow-launcher/Cargo.toml new file mode 100644 index 0000000..5edf6c7 --- /dev/null +++ b/hollow-launcher/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "hollow-launcher" +version = "0.0.1" +edition = "2021" +build = "build.rs" + +[[bin]] +name = "Hollow" +path = "src/main.rs" +windows_subsystem = "windows" + +[dependencies] +clap = { version = "4.5.4", features = ["derive"] } + +[build-dependencies] +winres = "0.1.12" \ No newline at end of file diff --git a/hollow-launcher/assets/small_icon.ico b/hollow-launcher/assets/small_icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..55351d8c058e28cb44ee5bf5f086163eb46b1858 GIT binary patch literal 16958 zcmeI2dvF!i9mjt+_mOu? zWvs0_v=(bo5j&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WOzz2rK8T86_2DlH$;h=4 zsqBDIKRIhc?b1gN&p#9DC*2lZLhTl(h5E@U6Y3Z0Cntsa$;ae`P(L{))J~3=P`^;W zP(L|HKBVsb!m;pGOLyyc9dI3R9dI3R9dI3R9dI3R9dI3R9dI3R9dI4^KXw3L_o4nG zN8}pBVmK}iv99A|vQ=(JuXXLkS+hPndaP^p_YH$O=9_n413PZ8u46F_JMJ~h!?5EC R>pDK3vC8de%l^9U{~rK3lc4|r literal 0 HcmV?d00001 diff --git a/hollow-launcher/build.rs b/hollow-launcher/build.rs new file mode 100644 index 0000000..05a63ff --- /dev/null +++ b/hollow-launcher/build.rs @@ -0,0 +1,9 @@ +extern crate winres; + +fn main() { + if cfg!(target_os = "windows") { + let mut res = winres::WindowsResource::new(); + res.set_icon("assets/small_icon.ico"); + res.compile().unwrap(); + } +} \ No newline at end of file diff --git a/hollow-launcher/src/main.rs b/hollow-launcher/src/main.rs new file mode 100644 index 0000000..5d88439 --- /dev/null +++ b/hollow-launcher/src/main.rs @@ -0,0 +1,90 @@ +use std::env; +use std::io::{BufRead, BufReader}; +use std::path::{Path, PathBuf}; +use std::process::{Command, exit, Stdio}; +use clap::Parser; + +#[derive(Parser)] +#[command(long_about = None)] +struct Cli { + #[arg(short, long, value_name = "HOLLOW_ROOT_DIRECTORY")] + root: Option, + + #[arg(long)] + console: bool, +} + +fn panic_then_pause(msg: String) { + Command::new("cmd.exe").arg("/c").arg(format!("echo {} && pause", msg)).status().unwrap(); + exit(1); +} + +fn main() -> Result<(), Box> { + let cli = Cli::parse(); + + + if env::consts::OS != "windows" { + panic!("Support Windows only currently"); + } + + // Get Hollow App Directory + let working_path = env::current_dir()?; + let mut root_directory = working_path; + if let Some(root) = cli.root { + let root = Path::new(&root); + if root.is_relative() { + root_directory = root_directory.join(root); + } else if root.is_absolute() { + root_directory = PathBuf::from(root); + } + } else { + root_directory = root_directory.join("hollow_app"); + } + if !root_directory.exists() { + panic_then_pause(format!("{:?} does not exist", root_directory)); + } else if !root_directory.is_dir() { + panic_then_pause(format!("{:?} is not a directory", root_directory)); + } + + let executable = root_directory.join("Hollow.exe"); + if !executable.exists() { + panic_then_pause(format!("{:?} not found", executable)); + } + + let mut cmd = Command::new(executable); + cmd.current_dir(root_directory); + + let mut child = cmd + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("Failed to start process"); + + if cli.console { + println!("Hollow Launcher"); + + if let Some(stdout) = child.stdout.take() { + let reader = BufReader::new(stdout); + for line in reader.lines() { + match line { + Ok(line) => println!("{}", line), + Err(err) => eprintln!("{}", err), + } + } + } + if let Some(stderr) = child.stderr.take() { + let reader = BufReader::new(stderr); + for line in reader.lines() { + match line { + Ok(line) => println!("{}", line), + Err(err) => eprintln!("{}", err), + } + } + } + let status = child.wait().expect("Failed to wait on Hollow"); + println!("Process exited with: {}", status); + } + Ok(()) +} + + diff --git a/hollow-launcher/target/.rustc_info.json b/hollow-launcher/target/.rustc_info.json new file mode 100644 index 0000000..a8f880b --- /dev/null +++ b/hollow-launcher/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":3803173089458030219,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.81.0-nightly (6868c831a 2024-06-30)\nbinary: rustc\ncommit-hash: 6868c831a1eb45c5150ff623cef5e42a8b8946d0\ncommit-date: 2024-06-30\nhost: x86_64-pc-windows-msvc\nrelease: 1.81.0-nightly\nLLVM version: 18.1.7\n","stderr":""},"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\nC:\\Users\\mccree\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\npacked\n___\ndebug_assertions\noverflow_checks\npanic=\"unwind\"\nproc_macro\nrelocation_model=\"pic\"\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"msvc\"\ntarget_family=\"windows\"\ntarget_feature=\"cmpxchg16b\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"lahfsahf\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_feature=\"sse3\"\ntarget_has_atomic\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_has_atomic_equal_alignment=\"128\"\ntarget_has_atomic_equal_alignment=\"16\"\ntarget_has_atomic_equal_alignment=\"32\"\ntarget_has_atomic_equal_alignment=\"64\"\ntarget_has_atomic_equal_alignment=\"8\"\ntarget_has_atomic_equal_alignment=\"ptr\"\ntarget_has_atomic_load_store\ntarget_has_atomic_load_store=\"128\"\ntarget_has_atomic_load_store=\"16\"\ntarget_has_atomic_load_store=\"32\"\ntarget_has_atomic_load_store=\"64\"\ntarget_has_atomic_load_store=\"8\"\ntarget_has_atomic_load_store=\"ptr\"\ntarget_os=\"windows\"\ntarget_pointer_width=\"64\"\ntarget_thread_local\ntarget_vendor=\"pc\"\nub_checks\nwindows\n","stderr":""},"16495917692426387086":{"success":true,"status":"","code":0,"stdout":"___.exe\nlib___.rlib\n___.dll\n___.dll\n___.lib\n___.dll\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/hollow-launcher/target/CACHEDIR.TAG b/hollow-launcher/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/hollow-launcher/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/