From d7a46b25da27710f5bd716e34497ff6aaaa21367 Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 6 Apr 2023 22:09:36 +0200 Subject: [PATCH] feat: added environment emulation support This experimental feature generates special configuration file which game interprets as different environments. With this, for example, you can access google payment methods --- Cargo.lock | 8 +++---- Cargo.toml | 2 +- src/ui/preferences/general.rs | 40 ++++++++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7f10f4..9a7519b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,8 +40,8 @@ dependencies = [ [[package]] name = "anime-game-core" -version = "1.5.0" -source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.5.0#3d6f5e48168d7daaa5bf4b6388732564947dbe45" +version = "1.5.1" +source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.5.1#4af7a14fc7e86d40cd97a7beb448a6d593a7d43d" dependencies = [ "anyhow", "bzip2", @@ -86,8 +86,8 @@ dependencies = [ [[package]] name = "anime-launcher-sdk" -version = "0.5.8" -source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.8#7aa54126c8263efc697feafd3c902d783dcf9bb4" +version = "0.5.9" +source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.9#c38fc3206a4ffa2aa1c6517a8570ea0cd92daecb" dependencies = [ "anime-game-core", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index a8abe82..3ef1433 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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.8" +tag = "0.5.9" # path = "../anime-launcher-sdk" # ! for dev purposes only diff --git a/src/ui/preferences/general.rs b/src/ui/preferences/general.rs index a16412c..b22976a 100644 --- a/src/ui/preferences/general.rs +++ b/src/ui/preferences/general.rs @@ -9,12 +9,13 @@ use relm4::factory::{ use gtk::prelude::*; use adw::prelude::*; +use anime_launcher_sdk::anime_game_core::prelude::*; +use anime_launcher_sdk::wincompatlib::prelude::*; 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 anime_launcher_sdk::env_emulation::Environment; use super::main::PreferencesAppMsg; use crate::ui::migrate_installation::MigrateInstallationApp; @@ -302,7 +303,40 @@ impl SimpleAsyncComponent for GeneralApp { #[local_ref] voice_packages -> adw::ExpanderRow { - set_title: &tr("game-voiceovers") + set_title: &tr("game-voiceovers"), + set_subtitle: "List of downloaded game voiceovers. You can select them in the game settings" + }, + + adw::ComboRow { + set_title: "Environment emulation", + set_subtitle: "Experimental feature. Emulate game environment to get specific features like additional payment methods", + + set_model: Some(>k::StringList::new(&[ + "PC", + "Android" + ])), + + set_selected: match CONFIG.launcher.environment { + Environment::PC => 0, + Environment::Android => 1, + + _ => unreachable!() + }, + + connect_selected_notify => |row| { + if is_ready() { + if let Ok(mut config) = config::get() { + config.launcher.environment = match row.selected() { + 0 => Environment::PC, + 1 => Environment::Android, + + _ => unreachable!() + }; + + config::update(config); + } + } + } }, gtk::Box {