diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..1dbe4eb --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "link-args=/LIBPATH:.\\mpv-x64"] +[target.aarch64-pc-windows-msvc] +rustflags = ["-C", "link-args=/LIBPATH:.\\mpv-arm64"] \ No newline at end of file diff --git a/build.rs b/build.rs index 6466043..a2fc701 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,5 @@ use chrono::{Datelike, Local}; -use std::{env, io::Cursor, path::PathBuf}; +use std::{env, fs, io::Cursor, path::PathBuf}; extern crate winres; fn main() { @@ -34,9 +34,15 @@ fn main() { res.compile().unwrap(); //extract libmpv-2 - println!("cargo:rerun-if-changed=libmpv-2.zip"); + let target = std::env::var("TARGET").unwrap(); + let archive = match target.as_str() { + "x86_64-pc-windows-msvc" => "libmpv-2_x64.zip", + "aarch64-pc-windows-msvc" => "libmpv-2_arm64.zip", + _ => panic!("Unsupported target {}", target), + }; + println!("cargo:rerun-if-changed={}", archive); { - let archive: Vec = include_bytes!("libmpv-2.zip").to_vec(); + let archive = fs::read(archive).unwrap(); let target_dir = PathBuf::from("."); zip_extract::extract(Cursor::new(archive), &target_dir, true).ok(); } diff --git a/libmpv-2_arm64.zip b/libmpv-2_arm64.zip new file mode 100644 index 0000000..2299532 Binary files /dev/null and b/libmpv-2_arm64.zip differ diff --git a/libmpv-2.zip b/libmpv-2_x64.zip similarity index 100% rename from libmpv-2.zip rename to libmpv-2_x64.zip diff --git a/mpv-arm64/libmpv-2.def b/mpv-arm64/libmpv-2.def new file mode 100644 index 0000000..8610743 Binary files /dev/null and b/mpv-arm64/libmpv-2.def differ diff --git a/mpv-arm64/libmpv-2.dll b/mpv-arm64/libmpv-2.dll new file mode 100644 index 0000000..e414e23 Binary files /dev/null and b/mpv-arm64/libmpv-2.dll differ diff --git a/mpv-arm64/libmpv-2.exp b/mpv-arm64/libmpv-2.exp new file mode 100644 index 0000000..d5ac5cd Binary files /dev/null and b/mpv-arm64/libmpv-2.exp differ diff --git a/mpv-arm64/mpv.lib b/mpv-arm64/mpv.lib new file mode 100644 index 0000000..cf54902 Binary files /dev/null and b/mpv-arm64/mpv.lib differ diff --git a/mpv.def b/mpv-x64/mpv.def similarity index 100% rename from mpv.def rename to mpv-x64/mpv.def diff --git a/mpv.exp b/mpv-x64/mpv.exp similarity index 100% rename from mpv.exp rename to mpv-x64/mpv.exp diff --git a/mpv.lib b/mpv-x64/mpv.lib similarity index 100% rename from mpv.lib rename to mpv-x64/mpv.lib diff --git a/rust-toolchain.toml b/rust-toolchain.toml index a2982ef..3b7031f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] channel = "stable" -targets = ["x86_64-pc-windows-msvc"] +targets = ["aarch64-pc-windows-msvc", "x86_64-pc-windows-msvc"] diff --git a/src/main.rs b/src/main.rs index dba07a7..942ac27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,6 +22,8 @@ struct Opt { help = "Start the app only in system tray and keep the window hidden" )] start_hidden: bool, + #[clap(long, help = "Do not show the splash image")] + no_splash: bool, #[clap(long, help = "Enable dev tools when pressing F12")] dev_tools: bool, #[clap(long, help = "Disable the server and load the WebUI from localhost")] @@ -92,6 +94,7 @@ fn main() { command, commands_path: Some(commands_path), webui_url, + no_splash: opt.no_splash, dev_tools: opt.development || opt.dev_tools, start_hidden: opt.start_hidden, autoupdater_endpoint: opt.autoupdater_endpoint, diff --git a/src/stremio_app/app.rs b/src/stremio_app/app.rs index 4c1adcd..240692a 100644 --- a/src/stremio_app/app.rs +++ b/src/stremio_app/app.rs @@ -34,6 +34,7 @@ pub struct MainWindow { pub command: String, pub commands_path: Option, pub webui_url: String, + pub no_splash: bool, pub dev_tools: bool, pub start_hidden: bool, pub autoupdater_endpoint: Option, @@ -135,6 +136,9 @@ impl MainWindow { self.window.set_visible(!self.start_hidden); self.tray.tray_show_hide.set_checked(!self.start_hidden); + if self.no_splash { + self.splash_screen.hide(); + } let player_channel = self.player.channel.borrow(); let (player_tx, player_rx) = player_channel diff --git a/src/stremio_app/stremio_wevbiew/wevbiew.rs b/src/stremio_app/stremio_wevbiew/wevbiew.rs index 163f161..afbd212 100644 --- a/src/stremio_app/stremio_wevbiew/wevbiew.rs +++ b/src/stremio_app/stremio_wevbiew/wevbiew.rs @@ -168,6 +168,8 @@ impl PartialUi for WebView { window.qt={webChannelTransport:{send:window.chrome.webview.postMessage}}; window.chrome.webview.addEventListener('message',ev=>window.qt.webChannelTransport.onmessage(ev)); }}catch(e){} + window.addEventListener("load", function() {if(initShellComm) try { initShellComm() } catch(e) {}}, false) + "##, |_| Ok(())).expect("Cannot add script to webview"); Ok(()) }).expect("Cannot add content loading");