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
This commit is contained in:
Observer KRypt0n_ 2023-04-06 22:09:36 +02:00
parent b20df574bf
commit d7a46b25da
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 42 additions and 8 deletions

8
Cargo.lock generated
View file

@ -40,8 +40,8 @@ dependencies = [
[[package]] [[package]]
name = "anime-game-core" name = "anime-game-core"
version = "1.5.0" version = "1.5.1"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.5.0#3d6f5e48168d7daaa5bf4b6388732564947dbe45" source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.5.1#4af7a14fc7e86d40cd97a7beb448a6d593a7d43d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bzip2", "bzip2",
@ -86,8 +86,8 @@ dependencies = [
[[package]] [[package]]
name = "anime-launcher-sdk" name = "anime-launcher-sdk"
version = "0.5.8" version = "0.5.9"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.8#7aa54126c8263efc697feafd3c902d783dcf9bb4" source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=0.5.9#c38fc3206a4ffa2aa1c6517a8570ea0cd92daecb"
dependencies = [ dependencies = [
"anime-game-core", "anime-game-core",
"anyhow", "anyhow",

View file

@ -17,7 +17,7 @@ glib-build-tools = "0.17"
[dependencies.anime-launcher-sdk] [dependencies.anime-launcher-sdk]
git = "https://github.com/an-anime-team/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 # path = "../anime-launcher-sdk" # ! for dev purposes only

View file

@ -9,12 +9,13 @@ use relm4::factory::{
use gtk::prelude::*; use gtk::prelude::*;
use adw::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;
use anime_launcher_sdk::config::launcher::LauncherStyle; 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::*;
use anime_launcher_sdk::components::wine::WincompatlibWine; 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 super::main::PreferencesAppMsg;
use crate::ui::migrate_installation::MigrateInstallationApp; use crate::ui::migrate_installation::MigrateInstallationApp;
@ -302,7 +303,40 @@ impl SimpleAsyncComponent for GeneralApp {
#[local_ref] #[local_ref]
voice_packages -> adw::ExpanderRow { 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(&gtk::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 { gtk::Box {