Merge branch 'tauri' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher into tauri
This commit is contained in:
commit
f5831b377c
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@ -1081,7 +1081,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ezpplauncher"
|
name = "ezpplauncher"
|
||||||
version = "3.0.0-beta.1"
|
version = "3.0.0-beta.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hardware-id",
|
"hardware-id",
|
||||||
"md5",
|
"md5",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ezpplauncher"
|
name = "ezpplauncher"
|
||||||
version = "3.0.0-beta.1"
|
version = "3.0.0-beta.2"
|
||||||
description = "EZPPLauncher redefined."
|
description = "EZPPLauncher redefined."
|
||||||
authors = ["HorizonCode"]
|
authors = ["HorizonCode"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
@ -677,3 +677,32 @@ pub fn hide_overlay(app: tauri::AppHandle) -> Result<(), String> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn check_for_corruption(folder: String) -> Result<bool, String> {
|
||||||
|
let osu_path = PathBuf::from(folder);
|
||||||
|
let osu_ui = osu_path.join("osu!ui.dll");
|
||||||
|
let osu_gameplay = osu_path.join("osu!gameplay.dll");
|
||||||
|
|
||||||
|
let osu_ui_bak = osu_path.join("osu!ui.dll.bak");
|
||||||
|
let osu_gameplay_bak = osu_path.join("osu!gameplay.dll.bak");
|
||||||
|
|
||||||
|
let required_files = [&osu_ui, &osu_gameplay];
|
||||||
|
|
||||||
|
for file in &required_files {
|
||||||
|
if !file.exists() {
|
||||||
|
return Ok(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let bak_files = [&osu_ui_bak, &osu_gameplay_bak];
|
||||||
|
for bak in &bak_files {
|
||||||
|
if bak.exists() {
|
||||||
|
if let Err(e) = fs::remove_file(bak).await {
|
||||||
|
return Err(format!("Failed to delete {}: {}", bak.display(), e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(false)
|
||||||
|
}
|
||||||
|
@ -8,7 +8,7 @@ use crate::commands::{
|
|||||||
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
|
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
|
||||||
get_osu_skin, get_osu_version, get_skins_count, is_osu_running, open_url_in_browser,
|
get_osu_skin, get_osu_version, get_skins_count, is_osu_running, open_url_in_browser,
|
||||||
replace_ui_files, run_osu, run_osu_updater, set_osu_config_values, set_osu_user_config_values,
|
replace_ui_files, run_osu, run_osu_updater, set_osu_config_values, set_osu_user_config_values,
|
||||||
valid_osu_folder, get_platform, show_overlay, hide_overlay
|
valid_osu_folder, get_platform, check_for_corruption, show_overlay, hide_overlay
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
@ -47,6 +47,7 @@ pub fn run() {
|
|||||||
get_launcher_version,
|
get_launcher_version,
|
||||||
exit,
|
exit,
|
||||||
get_platform,
|
get_platform,
|
||||||
|
check_for_corruption,
|
||||||
show_overlay,
|
show_overlay,
|
||||||
hide_overlay
|
hide_overlay
|
||||||
])
|
])
|
||||||
|
@ -154,4 +154,8 @@
|
|||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
|
button:not([disabled]),
|
||||||
|
[role="button"]:not([disabled]) {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,3 +114,5 @@ export const isOsuRunning = async () => {
|
|||||||
export const getLauncherVersion = async () => await invoke<string>('get_launcher_version');
|
export const getLauncherVersion = async () => await invoke<string>('get_launcher_version');
|
||||||
export const exit = async () => await invoke('exit');
|
export const exit = async () => await invoke('exit');
|
||||||
export const getPlatform = async () => await invoke<string>('get_platform');
|
export const getPlatform = async () => await invoke<string>('get_platform');
|
||||||
|
export const isOsuCorrupted = async (folder: string) =>
|
||||||
|
await invoke<boolean>('check_for_corruption', { folder });
|
||||||
|
@ -84,6 +84,7 @@
|
|||||||
getSkin,
|
getSkin,
|
||||||
getSkinsCount,
|
getSkinsCount,
|
||||||
getVersion,
|
getVersion,
|
||||||
|
isOsuCorrupted,
|
||||||
isOsuRunning,
|
isOsuRunning,
|
||||||
isValidOsuFolder,
|
isValidOsuFolder,
|
||||||
replaceUIFiles,
|
replaceUIFiles,
|
||||||
@ -181,6 +182,7 @@
|
|||||||
try {
|
try {
|
||||||
launchInfo = 'Looking for EZPPLauncher File updates...';
|
launchInfo = 'Looking for EZPPLauncher File updates...';
|
||||||
const updateResult = await getEZPPLauncherUpdateFiles(osuPath);
|
const updateResult = await getEZPPLauncherUpdateFiles(osuPath);
|
||||||
|
|
||||||
if (updateResult) {
|
if (updateResult) {
|
||||||
if (updateResult.filesToDownload.length > 0) {
|
if (updateResult.filesToDownload.length > 0) {
|
||||||
launchInfo = 'Found EZPPLauncher File updates!';
|
launchInfo = 'Found EZPPLauncher File updates!';
|
||||||
@ -220,7 +222,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const releaseStream = await getReleaseStream(osuPath);
|
const releaseStream = await getReleaseStream(osuPath);
|
||||||
let forceUpdate = releaseStream && releaseStream.toLowerCase() !== 'stable40';
|
const osuCorrupted = await isOsuCorrupted(osuPath);
|
||||||
|
let forceUpdate =
|
||||||
|
(releaseStream && releaseStream.toLowerCase() !== 'stable40') || osuCorrupted;
|
||||||
|
|
||||||
const versions = compareBuildNumbers($osuBuild, streamInfo);
|
const versions = compareBuildNumbers($osuBuild, streamInfo);
|
||||||
if (versions > 0 || forceUpdate) {
|
if (versions > 0 || forceUpdate) {
|
||||||
@ -358,10 +362,11 @@
|
|||||||
class="flex flex-col items-center text-sm text-center bg-theme-900 border border-theme-800 rounded-lg mx-3 p-3"
|
class="flex flex-col items-center text-sm text-center bg-theme-900 border border-theme-800 rounded-lg mx-3 p-3"
|
||||||
>
|
>
|
||||||
{#if launchError}
|
{#if launchError}
|
||||||
<span>{launchError.message}</span>
|
<pre class="text-wrap text-start">{JSON.stringify(
|
||||||
{#if launchError.stack}
|
launchError,
|
||||||
<pre>{launchError.stack}</pre>
|
Object.getOwnPropertyNames(launchError),
|
||||||
{/if}
|
2
|
||||||
|
)}</pre>
|
||||||
{:else}
|
{:else}
|
||||||
Unexpected error
|
Unexpected error
|
||||||
{/if}
|
{/if}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user