mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-21 20:36:01 +03:00
feat(core): implemented new SDK
This commit is contained in:
parent
991b9b337a
commit
4efa6abbb0
6 changed files with 41 additions and 53 deletions
45
Cargo.lock
generated
45
Cargo.lock
generated
|
@ -76,7 +76,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "anime-launcher-sdk"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
dependencies = [
|
||||
"anime-game-core",
|
||||
"anyhow",
|
||||
|
@ -570,37 +570,6 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8"
|
||||
dependencies = [
|
||||
"derive_builder_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder_core"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder_macro"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e"
|
||||
dependencies = [
|
||||
"derive_builder_core",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.6"
|
||||
|
@ -1689,12 +1658,11 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
|||
|
||||
[[package]]
|
||||
name = "open"
|
||||
version = "3.2.0"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8"
|
||||
checksum = "bd61e3bf9d78956c72ee864bba52431f7f43994b21a17e9e72596a81bd61075b"
|
||||
dependencies = [
|
||||
"pathdiff",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2918,12 +2886,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||
|
||||
[[package]]
|
||||
name = "wincompatlib"
|
||||
version = "0.2.2"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d14b77ccb1cd4ef8dd38f70833f922bf192bc6429a4f5f311647d15ba92d11a"
|
||||
dependencies = [
|
||||
"derive_builder",
|
||||
]
|
||||
checksum = "e62198d7aef27647807cde7c4c19ce293b4e331b1332825ce3c841bc0be1bd23"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
|
|
|
@ -20,7 +20,7 @@ relm4 = { version = "0.5", features = ["macros", "libadwaita"] }
|
|||
gtk = { package = "gtk4", version = "0.5", features = ["v4_8"] }
|
||||
adw = { package = "libadwaita", version = "0.2", features = ["v1_2"] }
|
||||
rfd = { version = "0.11", features = ["xdg-portal"], default-features = false }
|
||||
open = "3.2.0"
|
||||
open = "4.0.0"
|
||||
|
||||
anime-launcher-sdk = { path = "anime-launcher-sdk" }
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7286ef8b1771b78292ccf58c39b621c790a2d3cc
|
||||
Subproject commit c5ca8d533c25ecd469caf46e2f8aeeb054a4bb2d
|
|
@ -4,6 +4,7 @@ use relm4::component::*;
|
|||
use adw::prelude::*;
|
||||
|
||||
use anime_launcher_sdk::components::*;
|
||||
use anime_launcher_sdk::components::wine::WincompatlibWine;
|
||||
use anime_launcher_sdk::anime_game_core::installer::prelude::*;
|
||||
use anime_launcher_sdk::config;
|
||||
use anime_launcher_sdk::wincompatlib::prelude::*;
|
||||
|
@ -434,12 +435,13 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
|
|||
let wine = self.selected_wine.as_ref().unwrap();
|
||||
|
||||
let wine = wine
|
||||
.to_wine(Some(config.game.wine.builds.join(&wine.name)))
|
||||
.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name)))
|
||||
.with_prefix(&config.game.wine.prefix)
|
||||
.with_loader(WineLoader::Current)
|
||||
.with_arch(WineArch::Win64);
|
||||
|
||||
std::thread::spawn(move || {
|
||||
match wine.update_prefix(config.game.wine.prefix) {
|
||||
match wine.update_prefix::<&str>(None) {
|
||||
// Download DXVK
|
||||
Ok(_) => sender.input(DownloadComponentsAppMsg::DownloadDXVK),
|
||||
|
||||
|
@ -547,9 +549,9 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
|
|||
let group = wine.find_group(&config.components.path).unwrap().unwrap();
|
||||
|
||||
// Apply DXVK if we need it
|
||||
if wine.features.as_ref().unwrap_or(&group.features).need_dxvk {
|
||||
if wine.features_in(&group).unwrap_or_default().need_dxvk {
|
||||
let wine = wine
|
||||
.to_wine(Some(config.game.wine.builds.join(&wine.name)))
|
||||
.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name)))
|
||||
.with_loader(WineLoader::Current)
|
||||
.with_arch(WineArch::Win64)
|
||||
.with_prefix(config.game.wine.prefix);
|
||||
|
@ -562,6 +564,12 @@ impl SimpleAsyncComponent for DownloadComponentsApp {
|
|||
..InstallParams::default()
|
||||
};
|
||||
|
||||
let WincompatlibWine::Default(wine) = wine else {
|
||||
sender.input(DownloadComponentsAppMsg::Continue);
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
match wine.install_dxvk(config.game.dxvk.builds.join(&dxvk.name), params) {
|
||||
// Go to next page
|
||||
Ok(_) => sender.input(DownloadComponentsAppMsg::Continue),
|
||||
|
|
|
@ -1187,11 +1187,12 @@ impl SimpleComponent for App {
|
|||
|
||||
std::thread::spawn(move || {
|
||||
let wine = wine
|
||||
.to_wine(Some(config.game.wine.builds.join(&wine.name)))
|
||||
.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name)))
|
||||
.with_prefix(&config.game.wine.prefix)
|
||||
.with_loader(WineLoader::Current)
|
||||
.with_arch(WineArch::Win64);
|
||||
|
||||
if let Err(err) = wine.update_prefix(&config.game.wine.prefix) {
|
||||
if let Err(err) = wine.update_prefix::<&str>(None) {
|
||||
tracing::error!("Failed to create wine prefix");
|
||||
|
||||
sender.input(AppMsg::Toast {
|
||||
|
|
|
@ -13,6 +13,7 @@ use anime_launcher_sdk::config;
|
|||
use anime_launcher_sdk::config::launcher::LauncherStyle;
|
||||
use anime_launcher_sdk::anime_game_core::prelude::*;
|
||||
use anime_launcher_sdk::components::*;
|
||||
use anime_launcher_sdk::components::wine::WincompatlibWine;
|
||||
use anime_launcher_sdk::wincompatlib::prelude::*;
|
||||
|
||||
use super::main::PreferencesAppMsg;
|
||||
|
@ -624,7 +625,7 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
|
||||
allow_dxvk_selection: match &CONFIG.game.wine.selected {
|
||||
Some(version) => match wine::Group::find_in(&CONFIG.components.path, version) {
|
||||
Ok(Some(group)) => group.features.need_dxvk,
|
||||
Ok(Some(group)) => group.features.unwrap_or_default().need_dxvk,
|
||||
_ => true
|
||||
}
|
||||
|
||||
|
@ -769,7 +770,9 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
.into_iter()
|
||||
.map(move |version| (
|
||||
version.clone(),
|
||||
version.features.unwrap_or_else(|| group.features.clone()))
|
||||
version.features.unwrap_or_else(
|
||||
|| group.features.to_owned().unwrap_or_default()
|
||||
))
|
||||
)
|
||||
)
|
||||
.collect();
|
||||
|
@ -826,11 +829,16 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
self.selecting_wine_version = true;
|
||||
self.allow_dxvk_selection = features.need_dxvk;
|
||||
|
||||
let wine = version.to_wine(Some(config.game.wine.builds.join(&version.name)));
|
||||
let wine = version
|
||||
.to_wine(&config.components.path, Some(&config.game.wine.builds.join(&version.name)))
|
||||
.with_prefix(&config.game.wine.prefix)
|
||||
.with_loader(WineLoader::Current)
|
||||
.with_arch(WineArch::Win64);
|
||||
|
||||
let wine_name = version.name.to_string();
|
||||
|
||||
std::thread::spawn(move || {
|
||||
match wine.update_prefix(&config.game.wine.prefix) {
|
||||
match wine.update_prefix::<&str>(None) {
|
||||
Ok(_) => {
|
||||
config.game.wine.selected = Some(wine_name);
|
||||
|
||||
|
@ -865,7 +873,13 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
self.selecting_dxvk_version = true;
|
||||
|
||||
let mut wine = match config.get_selected_wine() {
|
||||
Ok(Some(version)) => version.to_wine(Some(config.game.wine.builds.join(&version.name))),
|
||||
Ok(Some(version)) => {
|
||||
match version.to_wine(config.components.path, Some(config.game.wine.builds.join(&version.name))) {
|
||||
WincompatlibWine::Default(wine) => wine,
|
||||
WincompatlibWine::Proton(_) => return
|
||||
}
|
||||
}
|
||||
|
||||
_ => Wine::default()
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue