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