mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-09-24 09:03:44 +00:00
feat: update GE-Proton and add ARM64 Linux support
This commit is contained in:
@@ -7,24 +7,26 @@ pub struct PlatformInfo {
|
||||
pub is_mac: bool,
|
||||
pub is_windows: bool,
|
||||
pub is_android: bool,
|
||||
pub arch: String,
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_platform() -> PlatformInfo {
|
||||
let arch = std::env::consts::ARCH.to_string();
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
PlatformInfo { is_linux: true, is_mac: false, is_windows: false, is_android: false }
|
||||
PlatformInfo { is_linux: true, is_mac: false, is_windows: false, is_android: false, arch }
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
PlatformInfo { is_linux: false, is_mac: true, is_windows: false, is_android: false }
|
||||
PlatformInfo { is_linux: false, is_mac: true, is_windows: false, is_android: false, arch }
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
PlatformInfo { is_linux: false, is_mac: false, is_windows: true, is_android: false }
|
||||
PlatformInfo { is_linux: false, is_mac: false, is_windows: true, is_android: false, arch }
|
||||
}
|
||||
#[cfg(target_os = "android")]
|
||||
{
|
||||
PlatformInfo { is_linux: false, is_mac: false, is_windows: false, is_android: true }
|
||||
PlatformInfo { is_linux: false, is_mac: false, is_windows: false, is_android: true, arch }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ export const DownloadOverlay = memo(function DownloadOverlay({ downloadProgress,
|
||||
{downloadingIds.map((id) => {
|
||||
const pct = downloadProgress[id] ?? 0;
|
||||
const edition = editions.find((e) => e.instanceId === id || e.id === id);
|
||||
const name = edition?.name || t("download.gameFiles");
|
||||
const name =
|
||||
edition?.name ||
|
||||
(id.startsWith("runner_")
|
||||
? id.replace(/^runner_/, "")
|
||||
: t("download.gameFiles"));
|
||||
return (
|
||||
<div key={id} className="flex items-center gap-2.5">
|
||||
{edition?.logo ? (
|
||||
|
||||
@@ -61,7 +61,7 @@ const SettingsView = memo(function SettingsView() {
|
||||
runnerDownloadProgress,
|
||||
downloadRunner,
|
||||
} = useGame();
|
||||
const { isLinux, isMac, isAndroid } = usePlatform();
|
||||
const { isLinux, isMac, isAndroid, arch } = usePlatform();
|
||||
const [focusIndex, setFocusIndex] = useState<number | null>(null);
|
||||
const [currentSubMenu, setCurrentSubMenu] = useState<
|
||||
| "main"
|
||||
@@ -535,15 +535,15 @@ const SettingsView = memo(function SettingsView() {
|
||||
})
|
||||
: t("settings.downloadRunner"),
|
||||
type: "button",
|
||||
textured: true,
|
||||
onClick: () => {
|
||||
if (!isRunnerDownloading) {
|
||||
downloadRunner(
|
||||
"GE-Proton9-25",
|
||||
"https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-25/GE-Proton9-25.tar.gz",
|
||||
`GE-Proton11-6-${arch}`,
|
||||
`https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton11-6/GE-Proton11-6-${arch}.tar.gz`,
|
||||
);
|
||||
}
|
||||
},
|
||||
small: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,10 @@ export function useDiscordRPC({
|
||||
const firstId = downloadingIds[0];
|
||||
const pct = downloadProgress[firstId];
|
||||
const downloadingName =
|
||||
editions.find((e) => e.id === firstId)?.name || "Game Files";
|
||||
editions.find((e) => e.id === firstId)?.name ||
|
||||
(firstId.startsWith("runner_")
|
||||
? firstId.replace(/^runner_/, "")
|
||||
: "Game Files");
|
||||
const extra =
|
||||
downloadingIds.length > 1
|
||||
? ` +${downloadingIds.length - 1} more`
|
||||
|
||||
@@ -464,12 +464,14 @@ export function useGameManager({
|
||||
const downloadRunner = useCallback(
|
||||
async (name: string, url: string) => {
|
||||
if (isRunnerDownloading) return;
|
||||
const runnerKey = `runner_${name}`;
|
||||
setIsRunnerDownloading(true);
|
||||
setRunnerDownloadProgress(0);
|
||||
setDownloadingIds((prev) => [...prev, runnerKey]);
|
||||
setDownloadProgress((prev) => ({ ...prev, [runnerKey]: 0 }));
|
||||
setError(null);
|
||||
try {
|
||||
await TauriService.downloadRunner(name, url);
|
||||
setRunnerDownloadProgress(null);
|
||||
} catch (e: unknown) {
|
||||
console.error(e);
|
||||
setError(
|
||||
@@ -480,12 +482,29 @@ export function useGameManager({
|
||||
: "Failed to download runner",
|
||||
);
|
||||
} finally {
|
||||
setRunnerDownloadProgress(null);
|
||||
setDownloadingIds((prev) => prev.filter((id) => id !== runnerKey));
|
||||
setDownloadProgress((prev) => {
|
||||
const next = { ...prev };
|
||||
delete next[runnerKey];
|
||||
return next;
|
||||
});
|
||||
setIsRunnerDownloading(false);
|
||||
}
|
||||
},
|
||||
[isRunnerDownloading],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isRunnerDownloading) return;
|
||||
const runnerKey = Object.keys(downloadProgress).find((key) =>
|
||||
key.startsWith("runner_"),
|
||||
);
|
||||
if (runnerKey && downloadProgress[runnerKey] !== undefined) {
|
||||
setRunnerDownloadProgress(downloadProgress[runnerKey]);
|
||||
}
|
||||
}, [downloadProgress, isRunnerDownloading]);
|
||||
|
||||
const toggleInstall = useCallback(
|
||||
async (id: string) => {
|
||||
if (downloadingIds.includes(id)) return;
|
||||
|
||||
@@ -6,6 +6,7 @@ const DEFAULT = {
|
||||
isMac: false,
|
||||
isWindows: false,
|
||||
isAndroid: false,
|
||||
arch: "x86_64",
|
||||
};
|
||||
export function usePlatform() {
|
||||
const [platform, setPlatform] = useState(DEFAULT);
|
||||
@@ -15,6 +16,7 @@ export function usePlatform() {
|
||||
isMac: boolean;
|
||||
isWindows: boolean;
|
||||
isAndroid: boolean;
|
||||
arch: string;
|
||||
}>("get_platform")
|
||||
.then(setPlatform)
|
||||
.catch(() => setPlatform(DEFAULT));
|
||||
|
||||
Reference in New Issue
Block a user