summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO22
-rw-r--r--.gitignore1
-rw-r--r--PKGBUILD35
-rw-r--r--discord-no-panic.patch56
-rw-r--r--fix-sandbox.patch69
-rw-r--r--use-cloned-sdk.patch19
6 files changed, 188 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 078b69b907b7..b45227deaed1 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,11 +1,11 @@
-pkgbase = an-anime-game-launcher-git
- pkgdesc = A Launcher for a specific anime game with auto-patching, discord rpc and time tracking
- pkgver = 3.2.1.r7.g711cc82
- pkgrel = 3
+pkgbase = an-anime-game-launcher-patched-git
+ pkgdesc = A Launcher for a specific anime game with auto-patching, discord rpc and time tracking (with a couple of fixes)
+ pkgver = 3.6.0.r2.g1795386
+ pkgrel = 1
url = https://github.com/an-anime-team/an-anime-game-launcher
arch = x86_64
license = GPL3
- makedepends = rust
+ makedepends = cargo
depends = cabextract
depends = curl
depends = git
@@ -19,9 +19,19 @@ pkgbase = an-anime-game-launcher-git
optdepends = mangohud: FPS Hud/GUI
optdepends = gamemode: Game Optimizations
optdepends = gamescope: a tool from Valve that allows for games to run in an isolated Xwayland instance
+ provides = an-anime-game-launcher
+ provides = an-anime-game-launcher-git
source = git+https://github.com/an-anime-team/an-anime-game-launcher
+ source = git+https://github.com/an-anime-team/anime-launcher-sdk
source = an-anime-game-launcher.desktop
+ source = use-cloned-sdk.patch
+ source = fix-sandbox.patch
+ source = discord-no-panic.patch
+ sha256sums = SKIP
sha256sums = SKIP
sha256sums = 3bb15b29fd47e60ead712a67046daf42bd0ba5547d379ead6ea9bba37ea7b137
+ sha256sums = 41bf614e86d2b439dde5dd60ea2e1384f420656d24cc5f075e2b4e9d0fb2b31d
+ sha256sums = 7a60bb9654dd6cf9c5612a9297c540b3334a16ef61048c54132b34dd5202d75b
+ sha256sums = 4ef3c5141e585516fbfa86aa7da1c321fca3ecc342a757c6f82c1dbca5f4e2b8
-pkgname = an-anime-game-launcher-git
+pkgname = an-anime-game-launcher-patched-git
diff --git a/.gitignore b/.gitignore
index 707609fc188c..b8bc3224fb8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
!.SRCINFO
!PKGBUILD
!an-anime-game-launcher.desktop
+!*.patch
diff --git a/PKGBUILD b/PKGBUILD
index 87c466456a85..ab34869fde34 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,9 +1,10 @@
-# Maintainer: DrakeTDL <everyone@disroot.org>
-pkgname="an-anime-game-launcher-git"
-_pkgname="${pkgname%-git}"
-pkgver=3.2.1.r7.g711cc82
-pkgrel=3
-pkgdesc="A Launcher for a specific anime game with auto-patching, discord rpc and time tracking"
+# Maintainer: fnrir <stepien241@gmail.com>
+# Contributer: DrakeTDL <everyone@disroot.org>
+_pkgname="an-anime-game-launcher"
+pkgname="$_pkgname-patched-git"
+pkgver=3.6.0.r2.g1795386
+pkgrel=1
+pkgdesc="A Launcher for a specific anime game with auto-patching, discord rpc and time tracking (with a couple of fixes)"
arch=("x86_64")
url="https://github.com/an-anime-team/an-anime-game-launcher"
license=("GPL3")
@@ -19,20 +20,29 @@ depends=(
unzip
xdelta3
)
-makedepends=(rust)
+makedepends=(cargo)
optdepends=(
"mangohud: FPS Hud/GUI"
"gamemode: Game Optimizations"
"gamescope: a tool from Valve that allows for games to run in an isolated Xwayland instance"
)
+provides=($_pkgname $_pkgname-git)
source=(
"git+https://github.com/an-anime-team/an-anime-game-launcher"
+ "git+https://github.com/an-anime-team/anime-launcher-sdk"
"${_pkgname}.desktop"
+ "use-cloned-sdk.patch"
+ "fix-sandbox.patch"
+ "discord-no-panic.patch"
)
noextract=()
sha256sums=(
SKIP
+ SKIP
"3bb15b29fd47e60ead712a67046daf42bd0ba5547d379ead6ea9bba37ea7b137"
+ "41bf614e86d2b439dde5dd60ea2e1384f420656d24cc5f075e2b4e9d0fb2b31d"
+ "7a60bb9654dd6cf9c5612a9297c540b3334a16ef61048c54132b34dd5202d75b"
+ "4ef3c5141e585516fbfa86aa7da1c321fca3ecc342a757c6f82c1dbca5f4e2b8"
)
pkgver() {
@@ -42,8 +52,17 @@ pkgver() {
prepare() {
cd "${_pkgname}"
- git switch next
git submodule update --init --recursive --single-branch
+
+ sdkver=$(grep -Pazo '(?s)\[dependencies\.anime-launcher-sdk\]\ngit = "\S+"\ntag = "\S+"' Cargo.toml | tail -n 1 | cut -d '"' -f 2)
+ # Use cloned anime-launcher-sdk
+ patch -up1 -i "../use-cloned-sdk.patch"
+ cd "../anime-launcher-sdk"
+ git switch --detach $sdkver
+ # Fix launching game w/ sandboxing and w/o /var/home
+ patch -up1 -i "../fix-sandbox.patch"
+ # Don't panic when not connected to Discord rpc
+ patch -up1 -i "../discord-no-panic.patch"
}
build() {
diff --git a/discord-no-panic.patch b/discord-no-panic.patch
new file mode 100644
index 000000000000..9c8af3b2257b
--- /dev/null
+++ b/discord-no-panic.patch
@@ -0,0 +1,56 @@
+diff --git a/src/discord_rpc.rs b/src/discord_rpc.rs
+index 0d7416c..18413ea 100644
+--- a/src/discord_rpc.rs
++++ b/src/discord_rpc.rs
+@@ -52,6 +52,9 @@ impl DiscordRpc {
+ let mut connected = false;
+
+ while let Ok(update) = receiver.recv() {
++ // NOTE: Panicing closes the channel, which causes issues furether down the line
++ // I replaced them with code from core::result::unwrap_failed
++ // I hope upstream finds a better way to handle these errors.
+ match update {
+ RpcUpdates::Connect => {
+ if !connected {
+@@ -60,7 +63,9 @@ impl DiscordRpc {
+ client.connect().expect("Failed to connect to discord");
+
+ client.set_activity(Self::get_activity(&params))
+- .expect("Failed to update discord rpc activity");
++ .unwrap_or_else(|error| {
++ eprintln!("Failed to update discord rpc activity: {error:?}")
++ });
+ }
+ }
+
+@@ -68,7 +73,9 @@ impl DiscordRpc {
+ if connected {
+ connected = false;
+
+- client.close().expect("Failed to disconnect from discord");
++ client.close().unwrap_or_else(|error| {
++ eprintln!("Failed to disconnect from discord: {error:?}")
++ });
+ }
+ }
+
+@@ -79,13 +86,17 @@ impl DiscordRpc {
+
+ if connected {
+ client.set_activity(Self::get_activity(&params))
+- .expect("Failed to update discord rpc activity");
++ .unwrap_or_else(|error| {
++ eprintln!("Failed to update discord rpc activity: {error:?}")
++ })
+ }
+ }
+
+ RpcUpdates::ClearActivity => {
+ if connected {
+- client.clear_activity().expect("Failed to clear discord rpc activity");
++ client.clear_activity().unwrap_or_else(|error| {
++ eprintln!("Failed to clear discord rpc activity: {error:?}")
++ });
+ }
+ }
+ }
diff --git a/fix-sandbox.patch b/fix-sandbox.patch
new file mode 100644
index 000000000000..6e149dc4cf93
--- /dev/null
+++ b/fix-sandbox.patch
@@ -0,0 +1,69 @@
+diff --git a/src/config/schema_blanks/sandbox/mod.rs b/src/config/schema_blanks/sandbox/mod.rs
+index a6b3590..36305d9 100644
+--- a/src/config/schema_blanks/sandbox/mod.rs
++++ b/src/config/schema_blanks/sandbox/mod.rs
+@@ -1,5 +1,6 @@
+ use serde::{Serialize, Deserialize};
+ use serde_json::Value as JsonValue;
++use std::fs::metadata;
+
+ mod mounts;
+
+@@ -141,15 +142,53 @@ impl Sandbox {
+ }
+
+ if self.isolate_home {
+- command.push_str(" --tmpfs /home");
+- command.push_str(" --tmpfs /var/home");
++ match metadata("/home") {
++ Ok(meta) => {
++ if meta.is_dir() {
++ command.push_str(" --tmpfs /home");
++ } else {
++ tracing::info!("/var/home is not a directory.")
++ }
++ },
++ Err(_) => tracing::info!("/home does not exist.")
++ }
++ match metadata("/var/home") {
++ Ok(meta) => {
++ if meta.is_dir() {
++ command.push_str(" --tmpfs /var/home");
++ } else {
++ tracing::info!("/var/home is not a directory.")
++ }
++ },
++ Err(_) => tracing::info!("/var/home does not exist.")
++ }
+
+ if let Ok(user) = std::env::var("USER") {
+- command += &format!(" --tmpfs '/var/home/{}'", user.trim());
++ let dir = format!("/var/home/{}", user.trim());
++ match metadata(&dir) {
++ Ok(meta) => {
++ if meta.is_dir() {
++ command += &format!(" --tmpfs '{}'", dir);
++ } else {
++ tracing::info!("{} is not a directory.", dir)
++ }
++ },
++ Err(_) => tracing::info!("{} does not exist.", dir)
++ }
+ }
+
+ if let Ok(home) = std::env::var("HOME") {
+- command += &format!(" --tmpfs '{}'", home.trim());
++ let dir = home.trim();
++ match metadata(dir) {
++ Ok(meta) => {
++ if meta.is_dir() {
++ command += &format!(" --tmpfs '{}'", dir);
++ } else {
++ tracing::info!("{} is not a directory.", dir)
++ }
++ },
++ Err(_) => tracing::info!("{} does not exist.", dir)
++ }
+ }
+ }
+
diff --git a/use-cloned-sdk.patch b/use-cloned-sdk.patch
new file mode 100644
index 000000000000..2e148a693977
--- /dev/null
+++ b/use-cloned-sdk.patch
@@ -0,0 +1,19 @@
+diff --git a/Cargo.toml b/Cargo.toml
+index 005f69c..3bf4ae6 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -16,11 +16,11 @@ opt-level = "s"
+ glib-build-tools = "0.17"
+
+ [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.2.1"
++#tag = "1.2.1"
+ features = ["all", "genshin"]
+
+-# path = "../anime-launcher-sdk" # ! for dev purposes only
++path = "../anime-launcher-sdk" # ! for dev purposes only
+
+ [dependencies]
+ relm4 = { version = "0.6.0-beta.1", features = ["macros", "libadwaita"] }