Merge branch 'next' of https://github.com/an-anime-team/an-anime-game-launcher into next
This commit is contained in:
commit
795ef8d62e
15 changed files with 556 additions and 359 deletions
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/the-honkers-railway-launcher.iml" filepath="$PROJECT_DIR$/.idea/the-honkers-railway-launcher.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="EMPTY_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
25
CHANGELOG.md
25
CHANGELOG.md
|
@ -9,6 +9,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- List missing dependencies on non-standard distros during initial setup
|
||||||
|
- Added 4.7.0 voiceovers sizes
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed Italian localization breaking the launcher
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Support new game API
|
||||||
|
- Improved background pictures processing
|
||||||
|
- Updated desktop file entry to include "aagl" keyword
|
||||||
|
- Localized `force-grab-cursor` to Ukrainian
|
||||||
|
|
||||||
|
## [1.5.5] - 08.05.2024
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
- Added Czech
|
- Added Czech
|
||||||
|
|
||||||
## [1.5.4] - 27.03.2024
|
## [1.5.4] - 27.03.2024
|
||||||
|
@ -27,6 +45,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Added Thai
|
- Added Thai
|
||||||
- Added Ukrainian
|
- Added Ukrainian
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed GtkSwitch UI state representation
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Update wish url
|
- Update wish url
|
||||||
|
@ -271,7 +293,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
[unreleased]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.4...next
|
[unreleased]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.5...next
|
||||||
|
[1.5.5]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.4...1.5.5
|
||||||
[1.5.4]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.3...1.5.4
|
[1.5.4]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.3...1.5.4
|
||||||
[1.5.3]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.2...1.5.3
|
[1.5.3]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.2...1.5.3
|
||||||
[1.5.2]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.1...1.5.2
|
[1.5.2]: https://github.com/an-anime-team/the-honkers-railway-launcher/compare/1.5.1...1.5.2
|
||||||
|
|
720
Cargo.lock
generated
720
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -19,7 +19,7 @@ glib-build-tools = "0.19"
|
||||||
|
|
||||||
[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 = "1.12.10"
|
tag = "1.14.0"
|
||||||
features = ["all", "star-rail", "star-rail-patch"]
|
features = ["all", "star-rail", "star-rail-patch"]
|
||||||
|
|
||||||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||||
|
|
|
@ -5,3 +5,4 @@ Exec=AppRun
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Game
|
Categories=Game
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
Keywords=aagl
|
||||||
|
|
|
@ -17,12 +17,12 @@ wish-url = Apri i desideri
|
||||||
about = Informazioni
|
about = Informazioni
|
||||||
|
|
||||||
|
|
||||||
close = { $commandType ->
|
close = { $form ->
|
||||||
[verb] Chiudersi
|
[verb] Chiudersi
|
||||||
*[noun] Chiudi
|
*[noun] Chiudi
|
||||||
}
|
}
|
||||||
|
|
||||||
hide = { $commandType ->
|
hide = { $form ->
|
||||||
[verb] Nascondersi
|
[verb] Nascondersi
|
||||||
*[noun] Nascondi
|
*[noun] Nascondi
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ other-settings = Інші налаштування
|
||||||
framerate-limit = Обмеження кількості кадрів
|
framerate-limit = Обмеження кількості кадрів
|
||||||
unfocused-framerate-limit = Обмеження кількості кадрів поза фокусом
|
unfocused-framerate-limit = Обмеження кількості кадрів поза фокусом
|
||||||
|
|
||||||
force-grab-cursor = Force grab cursor
|
force-grab-cursor = Примусове захоплення курсору
|
||||||
force-grab-cursor-description = Always use relative mouse mode instead of flipping dependent on cursor visibility. The mouse cursor will correctly be centered in the game
|
force-grab-cursor-description = Завжди використовувати відносний режим миші замість гортання залежно від видимості курсору. Курсор миші буде коректно відцентровано у грі
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
let
|
let
|
||||||
nixpkgs = builtins.fetchGit {
|
nixpkgs = builtins.fetchGit {
|
||||||
name = "nixos-23.11";
|
name = "nixos-24.05";
|
||||||
url = "https://github.com/nixos/nixpkgs";
|
url = "https://github.com/nixos/nixpkgs";
|
||||||
ref = "refs/heads/nixos-23.11";
|
ref = "refs/heads/nixos-24.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs-unstable = builtins.fetchGit {
|
nixpkgs-unstable = builtins.fetchGit {
|
||||||
|
@ -23,6 +23,9 @@ in pkgs.mkShell {
|
||||||
gcc
|
gcc
|
||||||
cmake
|
cmake
|
||||||
pkg-config
|
pkg-config
|
||||||
|
|
||||||
|
xdelta
|
||||||
|
libwebp
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
use anime_launcher_sdk::anime_game_core::installer::downloader::Downloader;
|
use anime_launcher_sdk::anime_game_core::installer::downloader::Downloader;
|
||||||
use anime_launcher_sdk::anime_game_core::minreq;
|
use anime_launcher_sdk::anime_game_core::minreq;
|
||||||
|
|
||||||
|
@ -10,30 +12,46 @@ pub struct Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_uri() -> String {
|
pub fn get_uri() -> String {
|
||||||
let uri = concat!("https://hk", "rpg-launcher-static.ho", "yov", "ers", "e.com/hk", "rpg_global/mdk/launcher/api/content?filter_adv=true&key=vplOVX8Vn7cwG8yb&launcher_id=35&language=");
|
let lang = crate::i18n::get_lang();
|
||||||
|
|
||||||
uri.to_owned() + &crate::i18n::format_lang(&crate::i18n::get_lang())
|
if lang.language == unic_langid::langid!("zh-cn").language {
|
||||||
|
concat!("https://hyp-api.", "mi", "ho", "yo", ".com/hyp/hyp-connect/api/getAllGameBasicInfo?launcher_id=jGHBHlcOq1").to_owned()
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
let uri = concat!("https://sg-hyp-api.", "ho", "yo", "verse", ".com/hyp/hyp-connect/api/getAllGameBasicInfo?launcher_id=VYTpXlbWo8&language=");
|
||||||
|
|
||||||
|
uri.to_owned() + &crate::i18n::format_lang(&lang)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cached::proc_macro::cached(result)]
|
#[cached::proc_macro::cached(result)]
|
||||||
pub fn get_background_info() -> anyhow::Result<Background> {
|
pub fn get_background_info() -> anyhow::Result<Background> {
|
||||||
let json = serde_json::from_slice::<serde_json::Value>(minreq::get(get_uri()).send()?.as_bytes())?;
|
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() {
|
let uri = json["data"]["game_info_list"].as_array()
|
||||||
Some(uri) => uri.to_owned(),
|
.ok_or_else(|| anyhow::anyhow!("Failed to list games in the backgrounds API"))?
|
||||||
None => anyhow::bail!("Failed to get background picture uri")
|
.iter()
|
||||||
};
|
.find(|game| {
|
||||||
|
match game["game"]["biz"].as_str() {
|
||||||
|
Some(biz) => biz.starts_with("hk4e_"),
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("Failed to find the game in the backgrounds API"))?["backgrounds"]
|
||||||
|
.as_array()
|
||||||
|
.and_then(|backgrounds| backgrounds.iter().next())
|
||||||
|
.and_then(|background| background["background"]["url"].as_str())
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("Failed to get background picture url"))?
|
||||||
|
.to_string();
|
||||||
|
|
||||||
// This API field contains wrong md5 hash, but file's name
|
let hash = uri.split('/')
|
||||||
// from the uri above actually contains correct one, so
|
.last()
|
||||||
// I parse and use it few lines below
|
.unwrap_or_default()
|
||||||
|
.split('_')
|
||||||
/*let hash = match json["data"]["adv"]["bg_checksum"].as_str() {
|
.next()
|
||||||
Some(uri) => uri.to_owned(),
|
.unwrap_or_default()
|
||||||
None => anyhow::bail!("Failed to get background picture checksum")
|
.to_owned();
|
||||||
};*/
|
|
||||||
|
|
||||||
let hash = uri.split('/').last().unwrap_or_default().split('_').next().unwrap_or_default().to_owned();
|
|
||||||
|
|
||||||
Ok(Background {
|
Ok(Background {
|
||||||
uri,
|
uri,
|
||||||
|
@ -46,23 +64,47 @@ pub fn download_background() -> anyhow::Result<()> {
|
||||||
|
|
||||||
let info = get_background_info()?;
|
let info = get_background_info()?;
|
||||||
|
|
||||||
|
let mut download_image = true;
|
||||||
|
|
||||||
if crate::BACKGROUND_FILE.exists() {
|
if crate::BACKGROUND_FILE.exists() {
|
||||||
let hash = Md5::digest(std::fs::read(crate::BACKGROUND_FILE.as_path())?);
|
let hash = Md5::digest(std::fs::read(crate::BACKGROUND_FILE.as_path())?);
|
||||||
|
|
||||||
if format!("{:x}", hash).to_lowercase() == info.hash {
|
if format!("{:x}", hash).to_lowercase() == info.hash {
|
||||||
tracing::debug!("Background picture is already downloaded. Skipping");
|
tracing::debug!("Background picture is already downloaded. Skipping");
|
||||||
|
|
||||||
|
download_image = false;
|
||||||
|
|
||||||
|
if crate::BACKGROUND_PRIMARY_FILE.exists() {
|
||||||
|
tracing::debug!("Background picture is already patched. Skipping");
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut downloader = Downloader::new(info.uri)?;
|
if download_image {
|
||||||
|
let mut downloader = Downloader::new(&info.uri)?;
|
||||||
|
|
||||||
downloader.continue_downloading = false;
|
downloader.continue_downloading = false;
|
||||||
|
|
||||||
if let Err(err) = downloader.download(crate::BACKGROUND_FILE.as_path(), |_, _| {}) {
|
if let Err(err) = downloader.download(crate::BACKGROUND_FILE.as_path(), |_, _| {}) {
|
||||||
anyhow::bail!(err);
|
anyhow::bail!(err);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Workaround for GTK weakness
|
||||||
|
if info.uri.ends_with(".webp") {
|
||||||
|
Command::new("dwebp")
|
||||||
|
.arg(crate::BACKGROUND_FILE.as_path())
|
||||||
|
.arg("-o")
|
||||||
|
.arg(crate::BACKGROUND_PRIMARY_FILE.as_path())
|
||||||
|
.spawn()?
|
||||||
|
.wait_with_output()?;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
std::fs::copy(crate::BACKGROUND_FILE.as_path(), crate::BACKGROUND_PRIMARY_FILE.as_path())?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,9 @@ lazy_static::lazy_static! {
|
||||||
/// Path to `background` file. Standard is `$HOME/.local/share/honkers-railway-launcher/background`
|
/// Path to `background` file. Standard is `$HOME/.local/share/honkers-railway-launcher/background`
|
||||||
pub static ref BACKGROUND_FILE: PathBuf = LAUNCHER_FOLDER.join("background");
|
pub static ref BACKGROUND_FILE: PathBuf = LAUNCHER_FOLDER.join("background");
|
||||||
|
|
||||||
|
/// Path to `background-primary` file. Standard is `$HOME/.local/share/anime-game-launcher/background-primary`
|
||||||
|
pub static ref BACKGROUND_PRIMARY_FILE: PathBuf = LAUNCHER_FOLDER.join("background-primary");
|
||||||
|
|
||||||
/// Path to `.keep-background` file. Used to mark launcher that it shouldn't update background picture
|
/// Path to `.keep-background` file. Used to mark launcher that it shouldn't update background picture
|
||||||
///
|
///
|
||||||
/// Standard is `$HOME/.local/share/honkers-railway-launcher/.keep-background`
|
/// Standard is `$HOME/.local/share/honkers-railway-launcher/.keep-background`
|
||||||
|
@ -99,7 +102,7 @@ lazy_static::lazy_static! {
|
||||||
.round-bin {{
|
.round-bin {{
|
||||||
border-radius: 24px;
|
border-radius: 24px;
|
||||||
}}
|
}}
|
||||||
", BACKGROUND_FILE.to_string_lossy());
|
", BACKGROUND_PRIMARY_FILE.to_string_lossy());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
|
|
|
@ -103,7 +103,23 @@ impl SimpleComponent for AboutDialog {
|
||||||
"<p>Added</p>",
|
"<p>Added</p>",
|
||||||
|
|
||||||
"<ul>",
|
"<ul>",
|
||||||
"<li>Added Czech</li>",
|
"<li>List missing dependencies on non-standard distros during initial setup</li>",
|
||||||
|
"<li>Added 2.1.0 voiceovers sizes</li>",
|
||||||
|
"</ul>",
|
||||||
|
|
||||||
|
"<p>Fixed</p>",
|
||||||
|
|
||||||
|
"<ul>",
|
||||||
|
"<li>Fixed Italian localization breaking the launcher</li>",
|
||||||
|
"</ul>",
|
||||||
|
|
||||||
|
"<p>Changed</p>",
|
||||||
|
|
||||||
|
"<ul>",
|
||||||
|
"<li>Support new game API</li>",
|
||||||
|
"<li>Improved background pictures processing</li>",
|
||||||
|
"<li>Updated desktop file entry to include aagl keyword</li>",
|
||||||
|
"<li>Localized force-grab-cursor to Ukrainian</li>",
|
||||||
"</ul>"
|
"</ul>"
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl SimpleAsyncComponent for DependenciesApp {
|
||||||
},
|
},
|
||||||
|
|
||||||
gtk::Entry {
|
gtk::Entry {
|
||||||
set_text: "sudo pacman -Syu git xdelta3 p7zip",
|
set_text: "sudo pacman -Syu git xdelta3 p7zip libwebp",
|
||||||
set_editable: false
|
set_editable: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -85,7 +85,7 @@ impl SimpleAsyncComponent for DependenciesApp {
|
||||||
},
|
},
|
||||||
|
|
||||||
gtk::Entry {
|
gtk::Entry {
|
||||||
set_text: "sudo apt install git xdelta3 p7zip-full",
|
set_text: "sudo apt install git xdelta3 p7zip-full webp",
|
||||||
set_editable: false
|
set_editable: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ impl SimpleAsyncComponent for DependenciesApp {
|
||||||
},
|
},
|
||||||
|
|
||||||
gtk::Entry {
|
gtk::Entry {
|
||||||
set_text: "sudo dnf install git xdelta p7zip",
|
set_text: "sudo dnf install git xdelta p7zip libwebp",
|
||||||
set_editable: false
|
set_editable: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -125,6 +125,10 @@ impl SimpleAsyncComponent for DependenciesApp {
|
||||||
|
|
||||||
adw::ActionRow {
|
adw::ActionRow {
|
||||||
set_title: "p7zip"
|
set_title: "p7zip"
|
||||||
|
},
|
||||||
|
|
||||||
|
adw::ActionRow {
|
||||||
|
set_title: "libwebp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,7 +195,7 @@ impl SimpleAsyncComponent for DependenciesApp {
|
||||||
match msg {
|
match msg {
|
||||||
#[allow(unused_must_use)]
|
#[allow(unused_must_use)]
|
||||||
DependenciesAppMsg::Continue => {
|
DependenciesAppMsg::Continue => {
|
||||||
let packages = ["git", "xdelta3"];
|
let packages = ["git", "xdelta3", "dwebp"];
|
||||||
|
|
||||||
for package in packages {
|
for package in packages {
|
||||||
if !is_available(package) {
|
if !is_available(package) {
|
||||||
|
|
Loading…
Reference in a new issue