This commit is contained in:
Observer KRypt0n_ 2023-04-22 18:58:53 +02:00
commit 341cf04e38
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
10 changed files with 180 additions and 57 deletions

8
Cargo.lock generated
View file

@ -40,8 +40,8 @@ dependencies = [
[[package]]
name = "anime-game-core"
version = "1.7.1"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.7.1#8978728ce5d94aec5c6aecfe470e45fc43d5b522"
version = "1.7.2"
source = "git+https://github.com/an-anime-team/anime-game-core?tag=1.7.2#b367ea1303c9687217024902e37dbb4e24b05f37"
dependencies = [
"anyhow",
"bzip2",
@ -65,8 +65,8 @@ dependencies = [
[[package]]
name = "anime-launcher-sdk"
version = "1.0.6"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.0.6#2a8272c1afdd006925c150ac480a82be645f4b52"
version = "1.0.10"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.0.10#204369158e57056dfc64fbff62fbe6a571034913"
dependencies = [
"anime-game-core",
"anyhow",

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 = "1.0.6"
tag = "1.0.10"
features = ["all", "genshin"]
# path = "../anime-launcher-sdk" # ! for dev purposes only

View file

@ -16,7 +16,7 @@
<br>
# Please don't link to this repository
# ⚠️ Please don't link to this repository
We understand you want to help people run An Anime Game on Linux. The issue is, the more people know
of the tools involved in it, the higher the chances The Anime Game Company will notice them, and then
@ -32,26 +32,38 @@ Or share them and ruin it for the dozens of Linux players. It's up to you.
Do what you must, but we would respectfully request that you try to label the game as "An Anime Game"
instead of the actual name of the game, to avoid search engine parsing.
# Documentation
<br>
Documentation for the launcher can be found in the [repository wiki](https://github.com/an-anime-team/the-honkers-railway-launcher/wiki).
# ♥️ Useful links and thanks
# Download
* Original patch project without which this project wouldn't be possible. Link is omitted for "privacy" purposes
* [macOS launcher](https://github.com/3Shain/yet-another-anime-game-launcher) which contains some additional compatibility components
* [Wiki](https://github.com/an-anime-team/an-anime-game-launcher/wiki) contains some basic FAQ, installation instructions and more
* [Releases page](https://github.com/an-anime-team/an-anime-game-launcher/releases) where you can find latest available version
* [Changelog](CHANGELOG.md) with chronology of the project
Currently there are 5 options available:
1. Flatpak
2. AUR
3. RPM
4. Gentoo/ebuild
5. NixOS
<br>
To see the installation guides, [Please visit the wiki page here](https://github.com/an-anime-team/the-honkers-railway-launcher/wiki/Installation)
# ⬇️ Download
| Distribution | Format | Wiki | Source |
| - | - | - | - |
| Fedora | Flatpak | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-any-distribution-flatpak) | - |
| Arch Linux, Manjaro | AUR | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-arch-linux-aur) | [an-anime-game-launcher-bin](https://aur.archlinux.org/packages/an-anime-game-launcher-bin) |
| Fedora, OpenSUSE | RPM | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-fedora-rpm) | [AAGL](https://build.opensuse.org/repositories/home:Maroxy:AAT-Apps/AAGL) |
| Ubuntu | pacstall | - | [an-anime-game-launcher-bin](https://pacstall.dev/packages/an-anime-game-launcher-bin) |
| Gentoo | ebuild | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-gentoo-linux-ebuild) | [aagl-ebuilds](https://github.com/an-anime-team/aagl-ebuilds) |
| NixOS | nixpkg | [link](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation#-nixos-nixpkg) | [aagl-gtk-on-nix](https://github.com/ezKEa/aagl-gtk-on-nix) |
To see the installation guides, please visit the wiki page [here](https://github.com/an-anime-team/an-anime-game-launcher/wiki/Installation)
## Chinese version support
This should be automatically enabled if you're using zh_cn (Chinese) as your system language. If you're not using it - you'll need to set `China` as your `launcher.edition` in the `config.json` file
This should be automatically enabled if you're using zh_cn (Chinese) as your system language. If you're not using it - you can change the game edition in the launcher settings
# Development
<br>
# 💻 Development
| Folder | Description |
| - | - |

View file

@ -23,6 +23,12 @@ tos-violation-warning-message =
If you understand the risk of trying to play the game in an unofficial capacity, press OK and let's go researching the world of Teyvat!
tos-dialog-title = Are you sure you understand what we want to say?
tos-dialog-message =
1. Don't publish any information about this project
2. Don't abuse it by using some modded clients and so
3. Ask questions exceptionally in our discord or matrix server
dependencies = Dependencies
missing-dependencies-title = You're missing some dependencies!

View file

@ -22,6 +22,7 @@ continue = Continue
exit = Exit
check = Check
restart = Restart
agree = Agree
loading-data = Loading data

View file

@ -8,7 +8,7 @@ hide-home-directory = Esconder el directorio home
hide-home-directory-description = Aisla las carpetas /home, /var/home/$USER, y $HOME del juego
hostname = Nombre del host
additional-arguments = Additional arguments
additional-arguments = Argumentos adicionales
private-directories = Directorios privados
private-directories-description = Estas carpetas serán reemplazadas por un sistema de archivos virtual (tmpfs) vacío, y su contenido real no será accesible al juego aislado
@ -24,5 +24,5 @@ new-path = Nueva ruta
read-only = Sólo lectura
read-only-description = Le prohibe al juego escribir datos en este directorio
symlinks = Symlinks
symlinks-description = Symlink original path to the new one inside of your sandbox
symlinks = Enlaces simbólicos
symlinks-description = Enlaza la ruta original a la nueva dentro de tu entorno aislado

View file

@ -8,7 +8,7 @@ hide-home-directory = 隐藏家目录
hide-home-directory-description = 将 /home、 /var/home/$USER 和 $HOME 目录与游戏隔离
hostname = 主机名
additional-arguments = Additional arguments
additional-arguments = 额外参数
private-directories = 隐私目录
private-directories-description = 这些目录将会被空的虚拟文件系统tmpfs替代其中的原始内容不可被沙盒中的游戏访问
@ -24,5 +24,5 @@ new-path = 新路径
read-only = 只读
read-only-description = 禁止游戏向此目录写入任何数据
symlinks = Symlinks
symlinks-description = Symlink original path to the new one inside of your sandbox
symlinks = 软链接
symlinks-description = 软链接原始路径到沙盒里的新路径

118
fluentscan.py Normal file → Executable file
View file

@ -5,18 +5,51 @@
import os
import sys
import glob
import re
path = "assets/locales/" + sys.argv[1] + "/"
valid_commands = ["diff", "unused", "missing"]
for filename in os.listdir("assets/locales/en"):
with open(os.path.join("assets/locales/en", filename), 'r') as locale_file:
created_locale = open(path + filename)
if len(sys.argv) < 3:
print(f"Command format: ./fluentscan.py [command] [locale]\nAvailable commands: {valid_commands}")
def to_dict(text):
sys.exit()
if sys.argv[1] not in valid_commands:
print(f"Invalid command \"{sys.argv[1]}\". Available commands: {valid_commands}")
sys.exit()
path = "assets/locales/" + sys.argv[2] + "/"
try:
open(path + "/main.ftl", "r").close()
except:
print(f"{path} does not exist")
sys.exit()
all_entries = {}
def dict_compare(d1, d2):
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
shared_keys = d1_keys.intersection(d2_keys)
added = d1_keys - d2_keys
removed = d2_keys - d1_keys
same = set(o for o in shared_keys if d1[o] == d2[o])
return added, removed, same
def to_dict(text):
result={}
for i in text:
if " = " in i:
if " =" in i:
try:
result[i.split()[0]] = ' '.join(i.split()[2:])
@ -28,28 +61,62 @@ for filename in os.listdir("assets/locales/en"):
return result
def dict_compare(d1, d2):
d1_keys = set(d1.keys())
d2_keys = set(d2.keys())
def get_line_num(text,pattern):
line = 1
shared_keys = d1_keys.intersection(d2_keys)
for i in text.split("\n"):
if pattern in i:
return line
added = d1_keys - d2_keys
removed = d2_keys - d1_keys
line += 1
modified = {o : (d1[o], d2[o]) for o in shared_keys if d1[o] != d2[o]}
for filename in os.listdir("assets/locales/en"):
with open(os.path.join("assets/locales/en", filename), 'r') as locale_file:
created_locale = open(path + filename)
same = set(o for o in shared_keys if d1[o] == d2[o])
expected = to_dict(locale_file)
expected2 = to_dict(created_locale)
return added, removed, modified, same
all_entries.update(expected)
expected=to_dict(locale_file)
expected2=to_dict(created_locale)
added, removed, same = dict_compare(expected, expected2)
# TODO: why modified is not used?
added, removed, modified, same = dict_compare(expected, expected2)
if sys.argv[1] == "unused" or sys.argv[1] == "missing":
files = glob.glob("src/**/*.rs", recursive=True)
if added or removed or same:
used = []
vars = {}
for i in files:
with open(i, "r") as script:
text = script.read()
if sys.argv[1] == "unused":
for j in expected:
if f"\"{j}\"" in text:
used.append(j)
elif sys.argv[1] == "missing":
for j in text.split():
# TODO: ignore comments
if 'tr("' in j:
index = j.find('tr("')
var_name = re.sub('[^\\w-]+', '', j[index:].replace('tr("', '').replace("Some", ""))
# TODO: index multiple matches
vars[var_name] = [script.name, get_line_num(text,var_name)]
if sys.argv[1] == "unused":
for i in expected:
if i not in used:
print(f"[{locale_file.name}]\n"
" [Unused]\n"
f" {i}")
continue
if (added or removed or same) and sys.argv[1] == "diff":
print(f"[{created_locale.name[15:]}]")
if added:
@ -72,3 +139,14 @@ for filename in os.listdir("assets/locales/en"):
print(f" {i} = {expected[i]}")
print("")
if sys.argv[1] == "missing":
added, removed, same = dict_compare(vars, all_entries)
if not added:
print("Nothing is missing")
for i in added:
print(f"[{vars[i][0]}, line {vars[i][1]}]\n"
" [Missing]\n"
f" {i}")

View file

@ -8,6 +8,8 @@ use anime_launcher_sdk::is_available;
use crate::i18n::*;
use super::main::FirstRunAppMsg;
use super::main::MAIN_WINDOW;
pub struct TosWarningApp;
#[derive(Debug, Clone)]
@ -86,6 +88,22 @@ impl SimpleAsyncComponent for TosWarningApp {
match msg {
#[allow(unused_must_use)]
TosWarningAppMsg::Continue => {
let dialog = adw::MessageDialog::new(
unsafe { MAIN_WINDOW.as_ref() },
Some(&tr("tos-dialog-title")),
Some(&tr("tos-dialog-message"))
);
dialog.add_responses(&[
("exit", &tr("exit")),
("continue", &tr("agree"))
]);
dialog.connect_response(None, move |_, response| {
match response {
"exit" => relm4::main_application().quit(),
"continue" => {
if is_available("git") && is_available("xdelta3") {
sender.output(Self::Output::ScrollToDefaultPaths);
} else {
@ -93,6 +111,13 @@ impl SimpleAsyncComponent for TosWarningApp {
}
}
_ => unreachable!()
}
});
dialog.show();
}
TosWarningAppMsg::Exit => relm4::main_application().quit()
}
}

View file

@ -1035,7 +1035,8 @@ impl SimpleAsyncComponent for GeneralApp {
let config = Config::get().unwrap_or_else(|_| CONFIG.clone());
if let Ok(Some(wine)) = config.get_selected_wine() {
let result = wine.to_wine(config.components.path, Some(config.game.wine.builds.join(&wine.name)))
let result = wine
.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)