mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-08-20 04:27:29 +00:00
feat: more android support
This commit is contained in:
parent
5a20244e30
commit
30c7584650
|
|
@ -4,6 +4,14 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script>
|
||||
if (/Android/i.test(navigator.userAgent)) {
|
||||
document.documentElement.classList.add("is-android");
|
||||
document
|
||||
.querySelector('meta[name="viewport"]')
|
||||
.setAttribute("content", "width=1280");
|
||||
}
|
||||
</script>
|
||||
<link rel="preload" href="/fonts/Mojangles.ttf" as="font" type="font/truetype" crossorigin>
|
||||
<link rel="preload" href="/images/MenuTitle.png" as="image">
|
||||
<title>Emerald Legacy Launcher</title>
|
||||
|
|
|
|||
91
src-tauri/Cargo.lock
generated
91
src-tauri/Cargo.lock
generated
|
|
@ -2949,12 +2949,6 @@ dependencies = [
|
|||
"pathdiff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.2.1"
|
||||
|
|
@ -3727,8 +3721,7 @@ dependencies = [
|
|||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"rustls 0.21.12",
|
||||
"rustls-native-certs 0.6.3",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"rustls-pemfile",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
|
|
@ -3743,6 +3736,7 @@ dependencies = [
|
|||
"wasm-bindgen-futures",
|
||||
"wasm-streams 0.4.2",
|
||||
"web-sys",
|
||||
"webpki-roots 0.25.4",
|
||||
"winreg 0.50.0",
|
||||
]
|
||||
|
||||
|
|
@ -3914,41 +3908,16 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
|
||||
dependencies = [
|
||||
"openssl-probe 0.1.6",
|
||||
"rustls-pemfile 1.0.4",
|
||||
"schannel",
|
||||
"security-framework 2.11.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5"
|
||||
dependencies = [
|
||||
"openssl-probe 0.1.6",
|
||||
"rustls-pemfile 2.2.0",
|
||||
"rustls-pki-types",
|
||||
"schannel",
|
||||
"security-framework 2.11.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-native-certs"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63"
|
||||
dependencies = [
|
||||
"openssl-probe 0.2.1",
|
||||
"openssl-probe",
|
||||
"rustls-pki-types",
|
||||
"schannel",
|
||||
"security-framework 3.7.0",
|
||||
"security-framework",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3960,15 +3929,6 @@ dependencies = [
|
|||
"base64 0.21.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pemfile"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls-pki-types"
|
||||
version = "1.14.1"
|
||||
|
|
@ -3990,10 +3950,10 @@ dependencies = [
|
|||
"log",
|
||||
"once_cell",
|
||||
"rustls 0.23.40",
|
||||
"rustls-native-certs 0.8.3",
|
||||
"rustls-native-certs",
|
||||
"rustls-platform-verifier-android",
|
||||
"rustls-webpki 0.103.13",
|
||||
"security-framework 3.7.0",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
|
|
@ -4140,19 +4100,6 @@ dependencies = [
|
|||
"untrusted",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"core-foundation 0.9.4",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "3.7.0"
|
||||
|
|
@ -5344,11 +5291,11 @@ dependencies = [
|
|||
"futures-util",
|
||||
"log",
|
||||
"rustls 0.22.4",
|
||||
"rustls-native-certs 0.7.3",
|
||||
"rustls-pki-types",
|
||||
"tokio",
|
||||
"tokio-rustls 0.25.0",
|
||||
"tungstenite",
|
||||
"webpki-roots 0.26.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -6084,6 +6031,30 @@ dependencies = [
|
|||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.25.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
|
||||
dependencies = [
|
||||
"webpki-roots 1.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webview2-com"
|
||||
version = "0.38.2"
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ tauri-plugin-opener = "2"
|
|||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tauri-plugin-gamepad = "0.0.5"
|
||||
reqwest = { version = "0.11", default-features = false, features = ["stream", "json", "rustls-tls-native-roots"] }
|
||||
reqwest = { version = "0.11", default-features = false, features = ["stream", "json", "rustls-tls-webpki-roots"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
futures-util = "0.3"
|
||||
tokio-util = { version = "0.7.18", features = ["rt"] }
|
||||
base64 = "0.21"
|
||||
tokio-tungstenite = { version = "0.21", default-features = false, features = ["connect", "rustls-tls-native-roots"] }
|
||||
tokio-tungstenite = { version = "0.21", default-features = false, features = ["connect", "rustls-tls-webpki-roots"] }
|
||||
url = "2"
|
||||
rand = "0.8"
|
||||
http = "1"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:label="@string/main_activity_title"
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.emerald.legacy
|
||||
|
||||
import android.os.Bundle
|
||||
import android.webkit.WebView
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
|
||||
class MainActivity : TauriActivity() {
|
||||
|
|
@ -8,4 +9,10 @@ class MainActivity : TauriActivity() {
|
|||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onWebViewCreate(webView: WebView) {
|
||||
super.onWebViewCreate(webView)
|
||||
webView.settings.useWideViewPort = true
|
||||
webView.settings.loadWithOverviewMode = true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -181,7 +181,18 @@ pub async fn download_and_install(
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
let status = std::process::Command::new("unzip")
|
||||
.args(["-o", zip_path.to_str().unwrap(), "-d", instance_dir.to_str().unwrap()])
|
||||
.status()
|
||||
.map_err(|e| e.to_string())?;
|
||||
if !status.success() {
|
||||
return Err("Extraction failed".into());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(not(target_os = "linux"), not(target_os = "android")))]
|
||||
{
|
||||
let mut cmd = std::process::Command::new("tar");
|
||||
cmd.args(["-xf", zip_path.to_str().unwrap(), "-C", instance_dir.to_str().unwrap()]);
|
||||
|
|
|
|||
|
|
@ -152,6 +152,32 @@ fn extract_archive(zip_tmp: &Path, dest_dir: &Path) -> Result<(Vec<String>, bool
|
|||
extract_ok = st.success();
|
||||
}
|
||||
Ok((files, extract_ok))
|
||||
} else if cfg!(target_os = "android") {
|
||||
let unzip_list = std::process::Command::new("unzip")
|
||||
.args(["-l", zip_str])
|
||||
.output()
|
||||
.map_err(|e| e.to_string())?;
|
||||
if !unzip_list.status.success() {
|
||||
return Err(format!("Failed to list contents of {}", zip_str));
|
||||
}
|
||||
let listing = String::from_utf8_lossy(&unzip_list.stdout);
|
||||
let files: Vec<String> = listing.lines()
|
||||
.filter_map(|l| {
|
||||
let mut parts = l.trim().split_whitespace();
|
||||
let size_str = parts.next()?;
|
||||
size_str.parse::<u64>().ok()?;
|
||||
parts.next()?;
|
||||
parts.next()?;
|
||||
Some(parts.collect::<Vec<&str>>().join(" "))
|
||||
})
|
||||
.filter(|l| !l.ends_with('/') && !l.contains('*'))
|
||||
.map(|l| dest_dir.join(l).to_string_lossy().to_string())
|
||||
.collect();
|
||||
let st = std::process::Command::new("unzip")
|
||||
.args(["-o", zip_str, "-d", dest_dir.to_str().unwrap()])
|
||||
.status()
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok((files, st.success()))
|
||||
} else {
|
||||
let st = std::process::Command::new("tar")
|
||||
.args(["-xf", zip_str, "-C", dest_dir.to_str().unwrap()])
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
import { useMemo } from 'react';
|
||||
export function usePlatform() {
|
||||
const platform = useMemo(() => {
|
||||
if (typeof window === 'undefined') return { isLinux: false, isMac: false, isWindows: false };
|
||||
if (typeof window === 'undefined') return { isLinux: false, isMac: false, isWindows: false, isAndroid: false };
|
||||
const ua = window.navigator.userAgent.toLowerCase();
|
||||
const plat = window.navigator.platform.toLowerCase();
|
||||
const isLinux = plat.includes('linux') || ua.includes('linux');
|
||||
const isMac = plat.includes('mac') || ua.includes('mac');
|
||||
const isWindows = plat.includes('win') || ua.includes('win');
|
||||
return { isLinux, isMac, isWindows };
|
||||
const isAndroid = ua.includes('android');
|
||||
return { isLinux, isMac, isWindows, isAndroid };
|
||||
}, []);
|
||||
|
||||
return platform;
|
||||
|
|
|
|||
|
|
@ -261,19 +261,19 @@ export default function App() {
|
|||
if (unlistenEvent) unlistenEvent();
|
||||
};
|
||||
}, [queueDeepLink]);
|
||||
const { isMac } = usePlatform();
|
||||
const { isMac, isAndroid } = usePlatform();
|
||||
const [isFullscreen, setIsFullscreen] = useState(false);
|
||||
useEffect(() => {
|
||||
const appWindow = getCurrentWindow();
|
||||
if (!isMac) appWindow.setDecorations(false);
|
||||
if (!isMac && !isAndroid) appWindow.setDecorations(false);
|
||||
const checkFs = async () => setIsFullscreen(await appWindow.isFullscreen());
|
||||
checkFs();
|
||||
const unlisten = appWindow.onResized(checkFs);
|
||||
return () => {
|
||||
unlisten.then((fn: () => void) => fn());
|
||||
};
|
||||
}, [isMac]);
|
||||
const showHeader = !isMac || isFullscreen;
|
||||
}, [isMac, isAndroid]);
|
||||
const showHeader = (!isMac || isFullscreen) && !isAndroid;
|
||||
useEffect(() => {
|
||||
if (config.isLoaded) {
|
||||
const setupCompleted =
|
||||
|
|
|
|||
Loading…
Reference in a new issue