feat(core): implemented core 0.5.8

This commit is contained in:
Observer KRypt0n_ 2023-03-31 10:21:06 +02:00
parent 7e20abf991
commit 02323bad4f
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
6 changed files with 134 additions and 146 deletions

249
Cargo.lock generated
View file

@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
dependencies = [
"gimli",
]
[[package]]
name = "adler"
version = "1.0.2"
@ -31,18 +40,18 @@ dependencies = [
[[package]]
name = "anime-game-core"
version = "1.4.4"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.7#f84ad39d86fe436678f2ceedf0861609d54bfd6d"
version = "1.5.0"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.5.0#3d6f5e48168d7daaa5bf4b6388732564947dbe45"
dependencies = [
"anyhow",
"bzip2",
"cached",
"curl",
"flate2",
"fs_extra",
"kinda-virtual-fs",
"lazy_static",
"md-5",
"minreq",
"serde",
"serde_json",
"sysinfo",
@ -77,13 +86,12 @@ dependencies = [
[[package]]
name = "anime-launcher-sdk"
version = "0.5.7"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.7#f84ad39d86fe436678f2ceedf0861609d54bfd6d"
version = "0.5.8"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.8#7aa54126c8263efc697feafd3c902d783dcf9bb4"
dependencies = [
"anime-game-core",
"anyhow",
"cached",
"dirs 5.0.0",
"discord-rich-presence",
"enum-ordinalize",
"lazy_static",
@ -99,6 +107,9 @@ name = "anyhow"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
dependencies = [
"backtrace",
]
[[package]]
name = "arc-swap"
@ -226,10 +237,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
version = "0.13.1"
name = "backtrace"
version = "0.3.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
"miniz_oxide",
"object",
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
[[package]]
name = "base64ct"
@ -412,6 +438,16 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "core-foundation"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.3"
@ -489,37 +525,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "curl"
version = "0.4.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "509bd11746c7ac09ebd19f0b17782eae80aadee26237658a6b4808afb5c11a22"
dependencies = [
"curl-sys",
"libc",
"openssl-probe",
"openssl-sys",
"schannel",
"socket2",
"winapi",
]
[[package]]
name = "curl-sys"
version = "0.4.60+curl-7.88.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f"
dependencies = [
"cc",
"libc",
"libz-sys",
"openssl-sys",
"pkg-config",
"rustls-ffi",
"vcpkg",
"winapi",
]
[[package]]
name = "darling"
version = "0.14.4"
@ -583,16 +588,7 @@ version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys 0.3.7",
]
[[package]]
name = "dirs"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd"
dependencies = [
"dirs-sys 0.4.0",
"dirs-sys",
]
[[package]]
@ -606,17 +602,6 @@ dependencies = [
"winapi",
]
[[package]]
name = "dirs-sys"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b"
dependencies = [
"libc",
"redox_users",
"windows-sys 0.45.0",
]
[[package]]
name = "discord-rich-presence"
version = "0.2.3"
@ -1062,6 +1047,12 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "gimli"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4"
[[package]]
name = "gio"
version = "0.17.4"
@ -1481,18 +1472,6 @@ version = "0.2.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
[[package]]
name = "libz-sys"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
@ -1590,6 +1569,22 @@ dependencies = [
"adler",
]
[[package]]
name = "minreq"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41979ac2a5aa373c6e294b4a67fbe5e428e91a4cd0524376681f2bc6d872399b"
dependencies = [
"log",
"once_cell",
"rustls",
"rustls-native-certs",
"serde",
"serde_json",
"webpki",
"webpki-roots",
]
[[package]]
name = "nanorand"
version = "0.7.0"
@ -1671,27 +1666,6 @@ dependencies = [
"libc",
]
[[package]]
name = "num_enum"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "objc"
version = "0.2.7"
@ -1721,6 +1695,15 @@ dependencies = [
"objc",
]
[[package]]
name = "object"
version = "0.30.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439"
dependencies = [
"memchr",
]
[[package]]
name = "once_cell"
version = "1.17.1"
@ -1748,19 +1731,6 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-sys"
version = "0.9.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "176be2629957c157240f68f61f2d0053ad3a4ecfdd9ebf1e6521d18d9635cf67"
dependencies = [
"autocfg",
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "ordered-stream"
version = "0.0.1"
@ -2147,6 +2117,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "rustc-demangle"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b"
[[package]]
name = "rustc-hash"
version = "1.1.0"
@ -2189,25 +2165,22 @@ dependencies = [
]
[[package]]
name = "rustls-ffi"
version = "0.8.2"
name = "rustls-native-certs"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9da52707cca59e6eef8a78f3ad8d04024254a168ed1b41eb4dfa9616eace781a"
checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50"
dependencies = [
"libc",
"log",
"num_enum",
"rustls",
"openssl-probe",
"rustls-pemfile",
"sct",
"webpki",
"schannel",
"security-framework",
]
[[package]]
name = "rustls-pemfile"
version = "0.2.1"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9"
checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b"
dependencies = [
"base64",
]
@ -2252,6 +2225,29 @@ dependencies = [
"untrusted",
]
[[package]]
name = "security-framework"
version = "2.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254"
dependencies = [
"bitflags",
"core-foundation",
"core-foundation-sys",
"libc",
"security-framework-sys",
]
[[package]]
name = "security-framework-sys"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4"
dependencies = [
"core-foundation-sys",
"libc",
]
[[package]]
name = "self_cell"
version = "0.10.2"
@ -2770,12 +2766,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version-compare"
version = "0.1.1"
@ -2896,6 +2886,15 @@ dependencies = [
"untrusted",
]
[[package]]
name = "webpki-roots"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
dependencies = [
"webpki",
]
[[package]]
name = "winapi"
version = "0.3.9"
@ -3075,7 +3074,7 @@ dependencies = [
"async-trait",
"byteorder",
"derivative",
"dirs 4.0.0",
"dirs",
"enumflags2",
"event-listener",
"futures-core",

View file

@ -17,7 +17,7 @@ glib-build-tools = "0.17"
[dependencies.anime-launcher-sdk]
git = "https://github.com/an-anime-team/anime-launcher-sdk"
tag = "0.5.7"
tag = "0.5.8"
# path = "../anime-launcher-sdk" # ! for dev purposes only

View file

@ -1,5 +1,5 @@
use anime_launcher_sdk::anime_game_core::installer::downloader::Downloader;
use anime_launcher_sdk::anime_game_core::curl::fetch;
use anime_launcher_sdk::anime_game_core::minreq;
use md5::{Md5, Digest};
@ -17,7 +17,7 @@ pub fn get_uri() -> String {
#[cached::proc_macro::cached(result)]
pub fn get_background_info() -> anyhow::Result<Background> {
let json = serde_json::from_slice::<serde_json::Value>(&fetch(get_uri(), None)?.get_body()?)?;
let json = serde_json::from_slice::<serde_json::Value>(minreq::get(get_uri()).send()?.as_bytes())?;
let uri = match json["data"]["adv"]["background"].as_str() {
Some(uri) => uri.to_owned(),
@ -60,7 +60,7 @@ pub fn download_background() -> anyhow::Result<()> {
downloader.continue_downloading = false;
if let Err(err) = downloader.download_to(crate::BACKGROUND_FILE.as_path(), |_, _| {}) {
if let Err(err) = downloader.download(crate::BACKGROUND_FILE.as_path(), |_, _| {}) {
anyhow::bail!(err);
}

View file

@ -40,7 +40,7 @@ lazy_static::lazy_static! {
pub static ref GAME: Game = Game::new(&CONFIG.game.path);
/// Path to launcher folder. Standard is `$HOME/.local/share/anime-game-launcher`
pub static ref LAUNCHER_FOLDER: PathBuf = launcher_dir().unwrap_or_default();
pub static ref LAUNCHER_FOLDER: PathBuf = launcher_dir().expect("Failed to get launcher folder");
/// Path to `debug.log` file. Standard is `$HOME/.local/share/anime-game-launcher/debug.log`
pub static ref DEBUG_FILE: PathBuf = LAUNCHER_FOLDER.join("debug.log");
@ -160,7 +160,7 @@ fn main() {
", BACKGROUND_FILE.to_string_lossy()));
// Set game edition
genshin::set_game_edition(CONFIG.launcher.edition.into());
GameEdition::from(CONFIG.launcher.edition).select();
// Set UI language
let lang = CONFIG.launcher.language.parse().expect("Wrong language format used in config");

View file

@ -1,20 +1,11 @@
use relm4::prelude::*;
use gtk::prelude::*;
use anime_launcher_sdk::VERSION as SDK_VERSION;
use anime_launcher_sdk::anime_game_core::{
VERSION as CORE_VERSION,
curl_sys
};
use anime_launcher_sdk::anime_game_core::VERSION as CORE_VERSION;
use crate::*;
lazy_static::lazy_static! {
static ref CURL_INFO: curl_sys::Version = curl_sys::Version::get();
}
#[derive(Debug)]
pub struct AboutDialog {
visible: bool
@ -81,9 +72,6 @@ impl SimpleComponent for AboutDialog {
format!("Anime Launcher SDK: {SDK_VERSION}"),
format!("Anime Game Core: {CORE_VERSION}"),
String::new(),
format!("curl: {}", CURL_INFO.version()),
format!("SSL: {}", CURL_INFO.ssl_version().unwrap_or("?")),
String::new(),
format!("GTK: {}.{}.{}", gtk::major_version(), gtk::minor_version(), gtk::micro_version()),
format!("libadwaita: {}.{}.{}", adw::major_version(), adw::minor_version(), adw::micro_version()),
format!("pango: {}", gtk::pango::version_string()),

View file

@ -20,6 +20,7 @@ mod launch;
use anime_launcher_sdk::config::launcher::LauncherStyle;
use anime_launcher_sdk::states::LauncherState;
use anime_launcher_sdk::components::loader::ComponentsLoader;
use anime_launcher_sdk::anime_game_core::genshin::consts::GameEdition;
use crate::*;
use crate::i18n::*;
@ -564,7 +565,7 @@ impl SimpleComponent for App {
})));
group.add_action::<ConfigFile>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
if let Some(file) = anime_launcher_sdk::consts::config_file() {
if let Ok(file) = anime_launcher_sdk::consts::config_file() {
if let Err(err) = open::that(file) {
sender.input(AppMsg::Toast {
title: tr("config-file-opening-error"),
@ -590,7 +591,7 @@ impl SimpleComponent for App {
group.add_action::<WishUrl>(&RelmAction::new_stateless(clone!(@strong sender => move |_| {
std::thread::spawn(clone!(@strong sender => move || {
let web_cache = CONFIG.game.path
.join(unsafe { anime_launcher_sdk::anime_game_core::genshin::consts::DATA_FOLDER_NAME })
.join(GameEdition::selected().data_folder())
.join("webCaches/Cache/Cache_Data/data_2");
if !web_cache.exists() {