Working structure
This commit is contained in:
Generated
+69
-23
@@ -2172,6 +2172,12 @@ dependencies = [
|
||||
"selectors 0.24.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
@@ -2329,7 +2335,6 @@ dependencies = [
|
||||
"lighty-java",
|
||||
"lighty-launch",
|
||||
"lighty-loaders",
|
||||
"lighty-tauri",
|
||||
"lighty-version",
|
||||
"once_cell",
|
||||
"tokio",
|
||||
@@ -2357,28 +2362,6 @@ dependencies = [
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lighty-tauri"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d3842cdcd5530f59351a3d6f0a9d3d57e76b010d456427e789ad479a7c2272d"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"lighty-auth",
|
||||
"lighty-core",
|
||||
"lighty-java",
|
||||
"lighty-launch",
|
||||
"lighty-loaders",
|
||||
"lighty-version",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"thiserror 2.0.18",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lighty-version"
|
||||
version = "0.8.6"
|
||||
@@ -2616,6 +2599,15 @@ version = "0.1.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-conv"
|
||||
version = "0.2.1"
|
||||
@@ -3860,12 +3852,16 @@ dependencies = [
|
||||
name = "saturn-launcher"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"directories",
|
||||
"lighty-launcher",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-opener",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4173,6 +4169,15 @@ dependencies = [
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
@@ -4792,6 +4797,15 @@ dependencies = [
|
||||
"syn 2.0.117",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.47"
|
||||
@@ -5110,6 +5124,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||
dependencies = [
|
||||
"log",
|
||||
"once_cell",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319"
|
||||
dependencies = [
|
||||
"nu-ansi-term",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5277,6 +5317,12 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.2.1"
|
||||
|
||||
@@ -22,4 +22,8 @@ tauri = { version = "2", features = [] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
lighty-launcher = { version = "0.8.6", features = ["fabric", "tauri-commands"] }
|
||||
lighty-launcher = { version = "0.8.6", features = ["fabric"] }
|
||||
directories = "6.0"
|
||||
once_cell = "1.21"
|
||||
tracing-subscriber = "0.3"
|
||||
anyhow = "1.0"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
use directories::ProjectDirs;
|
||||
use lighty_launcher::{
|
||||
auth::{Authenticator, OfflineAuth},
|
||||
java::JavaDistribution,
|
||||
launch::Launch,
|
||||
loaders::Loader,
|
||||
version::VersionBuilder,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
static LAUNCHER_DIR: Lazy<ProjectDirs> = Lazy::new(|| {
|
||||
ProjectDirs::from("org", "SaturnLauncher", "SaturnLauncher")
|
||||
.expect("Failed to create project directories")
|
||||
});
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn launch() -> Result<(), String> {
|
||||
println!("Launcher directory: {:?}", LAUNCHER_DIR);
|
||||
|
||||
tracing_subscriber::fmt::init();
|
||||
|
||||
// Authenticate
|
||||
let mut auth = OfflineAuth::new("PlayerName");
|
||||
let profile = auth
|
||||
.authenticate()
|
||||
.await
|
||||
.map_err(|e| format!("Authentication failed: {}", e))?;
|
||||
|
||||
// Create version instance
|
||||
let mut version = VersionBuilder::new(
|
||||
"vanilla-1.21.1",
|
||||
Loader::Vanilla,
|
||||
"",
|
||||
"1.21.1",
|
||||
&LAUNCHER_DIR,
|
||||
);
|
||||
|
||||
// Launch the game
|
||||
version
|
||||
.launch(&profile, JavaDistribution::Temurin)
|
||||
.run()
|
||||
.await
|
||||
.map_err(|e| format!("Launch failed: {}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod commands;
|
||||
pub mod launcher;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::Mutex;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use lighty_launcher::tauri::lighty_plugin;
|
||||
use saturn_launcher_lib::{commands::*, AppState};
|
||||
use std::sync::Mutex;
|
||||
|
||||
@@ -9,14 +8,14 @@ use std::sync::Mutex;
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(lighty_plugin())
|
||||
.manage(Mutex::new(AppState::default()))
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
get_installed_mods,
|
||||
toggle_mod,
|
||||
install_mod,
|
||||
get_settings,
|
||||
update_settings
|
||||
update_settings,
|
||||
saturn_launcher_lib::launcher::launch
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user