11 Commits

11 changed files with 480 additions and 999 deletions

View File

@@ -12,16 +12,13 @@
"@tailwindcss/typography": "0.5.16",
"@tailwindcss/vite": "^4.1.11",
"@tauri-apps/api": "2.6.0",
"@tauri-apps/plugin-dialog": "2.3.0",
"@tauri-apps/plugin-fs": "2.4.0",
"@tauri-apps/plugin-dialog": "2.3.1",
"@tauri-apps/plugin-fs": "2.4.1",
"@tauri-apps/plugin-shell": "2.3.0",
"@tauri-apps/plugin-sql": "2.3.0",
"animejs": "^4.0.2",
"buffer": "^6.0.3",
"crypto-js": "^4.2.0",
"lucide-svelte": "0.525.0",
"osu-classes": "3.1.0",
"osu-parsers": "4.1.7",
"semver": "^7.7.2",
"svelte-confetti": "^2.0.0",
"tw-animate-css": "^1.3.0",
@@ -296,14 +293,12 @@
"@tauri-apps/cli-win32-x64-msvc": ["@tauri-apps/cli-win32-x64-msvc@2.6.1", "", { "os": "win32", "cpu": "x64" }, "sha512-fBsjPqIIHaaQt7tnjIGmPHu5p/BNBVD4JfOhO3QqIVBzAb+W2bDyIQPdoDMI943soLr/+N10xeTiPu+3L74+dQ=="],
"@tauri-apps/plugin-dialog": ["@tauri-apps/plugin-dialog@2.3.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-ylSBvYYShpGlKKh732ZuaHyJ5Ie1JR71QCXewCtsRLqGdc8Is4xWdz6t43rzXyvkItM9syNPMvFVcvjgEy+/GA=="],
"@tauri-apps/plugin-dialog": ["@tauri-apps/plugin-dialog@2.3.1", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-B7jvyhycV8SI/WHzPjciwtYfdFM6/9EXuMjRgYWZwn8GPDmHxpT80aJdb/eDVN+NgoAFDh9bu4QPonYahoYnZQ=="],
"@tauri-apps/plugin-fs": ["@tauri-apps/plugin-fs@2.4.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-Sp8AdDcbyXyk6LD6Pmdx44SH3LPeNAvxR2TFfq/8CwqzfO1yOyV+RzT8fov0NNN7d9nvW7O7MtMAptJ42YXA5g=="],
"@tauri-apps/plugin-fs": ["@tauri-apps/plugin-fs@2.4.1", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-vJlKZVGF3UAFGoIEVT6Oq5L4HGDCD78WmA4uhzitToqYiBKWAvZR61M6zAyQzHqLs0ADemkE4RSy/5sCmZm6ZQ=="],
"@tauri-apps/plugin-shell": ["@tauri-apps/plugin-shell@2.3.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-6GIRxO2z64uxPX4CCTuhQzefvCC0ew7HjdBhMALiGw74vFBDY95VWueAHOHgNOMV4UOUAFupyidN9YulTe5xlA=="],
"@tauri-apps/plugin-sql": ["@tauri-apps/plugin-sql@2.3.0", "", { "dependencies": { "@tauri-apps/api": "^2.6.0" } }, "sha512-JYwIocfsLaDWa41LMiZWuzts7yCJR+EpZPRmgpO7Gd7XiAS9S67dKz306j/k/d9XntB0YopMRBol2OIWMschuA=="],
"@types/bun": ["@types/bun@1.2.18", "", { "dependencies": { "bun-types": "1.2.18" } }, "sha512-Xf6RaWVheyemaThV0kUfaAUvCNokFr+bH8Jxp+tTZfx7dAPA8z9ePnP9S9+Vspzuxxx9JRAXhnyccRj3GyCMdQ=="],
"@types/cookie": ["@types/cookie@0.6.0", "", {}, "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="],
@@ -562,8 +557,6 @@
"lucide-svelte": ["lucide-svelte@0.525.0", "", { "peerDependencies": { "svelte": "^3 || ^4 || ^5.0.0-next.42" } }, "sha512-kfuN6JcCqTfCz2B76aXnyGLAzEBRSYw5GaUspM5RNHQZS5aI5yaKu06fbaofOk8cDvUtY0AUm/zAix7aUX6Q3A=="],
"lzma-js-simple-v2": ["lzma-js-simple-v2@1.2.3", "", { "dependencies": { "@types/node": "^20.12.7" } }, "sha512-6kgy86Q3YLolV6dOwCqdQXg3V07e3XJJ6wqfrN8/s65mvCfqkr+jMJkfiSZNvk+u2ig+G8rLdtaoW/g1oJiwow=="],
"magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="],
"merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],
@@ -598,10 +591,6 @@
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
"osu-classes": ["osu-classes@3.1.0", "", {}, "sha512-kz38FWMGnz5lr6ofovUrNaDAcs1gNpwlDc1qHjW86ILQZXG44w/+NflV7EyFomkI05XCADGfltE4FVoPwrkrmg=="],
"osu-parsers": ["osu-parsers@4.1.7", "", { "dependencies": { "lzma-js-simple-v2": "^1.2.3" }, "peerDependencies": { "osu-classes": "^3.1.0" } }, "sha512-b8aYJy9vK0Yk8zVbxVN+HSChGnXufSxePb3gABG8s5YGCY+31CKJTUHDAVRST0kX4lyeI4Z3iRxsCRftHFHEug=="],
"p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],
"p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],

View File

@@ -21,21 +21,17 @@
"@better-fetch/fetch": "^1.1.18",
"@fontsource/sora": "^5.2.6",
"@fontsource/space-mono": "^5.2.8",
"@iarna/toml": "2.2.5",
"@number-flow/svelte": "^0.3.9",
"@tailwindcss/typography": "0.5.16",
"@tailwindcss/vite": "^4.1.11",
"@tauri-apps/api": "2.6.0",
"@tauri-apps/plugin-dialog": "2.3.0",
"@tauri-apps/plugin-fs": "2.4.0",
"@tauri-apps/plugin-dialog": "2.3.1",
"@tauri-apps/plugin-fs": "2.4.1",
"@tauri-apps/plugin-shell": "2.3.0",
"@tauri-apps/plugin-sql": "2.3.0",
"animejs": "^4.0.2",
"buffer": "^6.0.3",
"crypto-js": "^4.2.0",
"lucide-svelte": "0.525.0",
"osu-classes": "3.1.0",
"osu-parsers": "4.1.7",
"semver": "^7.7.2",
"tw-animate-css": "^1.3.0",
"svelte-confetti": "^2.0.0"
@@ -43,6 +39,7 @@
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@eslint/js": "^9.18.0",
"@iarna/toml": "2.2.5",
"@lucide/svelte": "^0.525.0",
"@sveltejs/adapter-static": "3.0.8",
"@sveltejs/kit": "2.22.2",

1085
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "ezpplauncher"
version = "3.0.2"
version = "3.0.4"
description = "EZPPLauncher redefined."
authors = ["HorizonCode"]
edition = "2024"
@@ -15,20 +15,19 @@ name = "ezpplauncher_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.3.0", features = [] }
tauri-build = { version = "2.3.1", features = [] }
[dependencies]
tauri = { version = "2.6.2", features = [] }
tauri = { version = "2.7.0", features = [] }
tauri-plugin-shell = "2.3.0"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
serde_json = "1.0.141"
serde_repr = "0.1.20"
tauri-plugin-sql = "2.3.0"
tauri-plugin-dialog = "2.3.0"
tauri-plugin-fs = "2.4.0"
tauri-plugin-dialog = "2.3.1"
tauri-plugin-fs = "2.4.1"
hardware-id = "0.3.0"
tauri-plugin-cors-fetch = "4.1.0"
sysinfo = "0.35.2"
sysinfo = "0.36.1"
reqwest = { version = "0.12.22", features = ["json", "stream"] }
md5 = "0.8.0"
tokio = { version = "1.46.1", features = ["full"] }
@@ -40,9 +39,9 @@ once_cell = "1.21.3"
[target.'cfg(windows)'.dependencies]
winreg = "0.55.0"
winapi = { version = "0.3", features = ["winuser", "wincrypt", "memoryapi", "winbase", "dpapi"] }
base64 = "0.21"
base64 = "0.22.1"
widestring = "1.0"
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2.3.0"
tauri-plugin-single-instance = "2.3.2"

6
src-tauri/nsis-hooks.nsh Normal file
View File

@@ -0,0 +1,6 @@
!macro NSIS_HOOK_POSTINSTALL
${If} $PassiveMode = 1
${OrIf} ${Silent}
Exec '"$INSTDIR\${MAINBINARYNAME}.exe"'
${EndIf}
!macroend

View File

@@ -6,6 +6,7 @@ use std::path::PathBuf;
use sysinfo::System;
use tauri::AppHandle;
use tauri::Emitter;
use tauri::Manager;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
@@ -729,3 +730,79 @@ pub fn encrypt_string(string: String, entropy: String) -> String {
Err(_) => string,
}
}
#[tauri::command]
pub async fn download_ezpp_launcher_update(app: AppHandle, url: String) -> Result<(), String> {
let client = Client::new();
let mut response = client.get(&url).send().await.map_err(|e| e.to_string())?;
if !response.status().is_success() {
return Err(format!("Failed to download update: {}", response.status()));
}
let temp_dir = app.path().temp_dir().expect("Failed to get temp directory");
let file_path = temp_dir.join("ezpplauncher_update.exe");
let mut file_out = fs::File::create(&file_path)
.await
.map_err(|e| e.to_string())?;
let mut downloaded = 0u64;
let size = response
.content_length()
.ok_or("Failed to get content length")? as usize;
while let Some(chunk) = response.chunk().await.map_err(|e| e.to_string())? {
downloaded += chunk.len() as u64;
file_out
.write_all(&chunk)
.await
.map_err(|e| e.to_string())?;
app.emit(
"download-progress",
UpdateStatus {
file_name: "Update".to_string(),
downloaded,
size: size,
progress: ((downloaded as f64 / size as f64 * 100.0) * 100.0).trunc() / 100.0,
},
)
.unwrap_or_default();
}
Ok(())
}
#[cfg(windows)]
#[tauri::command]
pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String> {
let temp_dir = app.path().temp_dir().expect("Failed to get temp directory");
let file_path = temp_dir.join("ezpplauncher_update.exe");
if !file_path.exists() {
return Err("Update file does not exist".to_string());
}
// run this app detached and exit
const DETACHED_PROCESS: u32 = 0x00000008;
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
Command::new(&file_path)
.arg("/S")
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to spawn updater: {}", e))?;
sleep(Duration::from_millis(250)).await;
app.exit(0x0100);
Ok(())
}
#[cfg(not(windows))]
#[tauri::command]
pub async fn install_ezpp_launcher_update(_app: AppHandle) -> Result<(), String> {
Ok(())
}

View File

@@ -5,10 +5,11 @@ pub mod commands;
pub mod presence;
pub mod utils;
use crate::commands::{
check_for_corruption, download_ezpp_launcher_update_files, encrypt_string, exit,
find_osu_installation, get_beatmapsets_count, get_ezpp_launcher_update_files, get_hwid,
get_launcher_version, get_osu_release_stream, get_osu_skin, get_osu_version, get_platform,
get_skins_count, has_net8, has_osuwinello, has_wmctrl, is_osu_running, open_url_in_browser,
check_for_corruption, download_ezpp_launcher_update, download_ezpp_launcher_update_files,
encrypt_string, exit, find_osu_installation, get_beatmapsets_count,
get_ezpp_launcher_update_files, get_hwid, get_launcher_version, get_osu_release_stream,
get_osu_skin, get_osu_version, get_platform, get_skins_count, has_net8, has_osuwinello,
has_wmctrl, install_ezpp_launcher_update, is_osu_running, open_url_in_browser,
presence_connect, presence_disconnect, presence_is_connected, presence_update_status,
presence_update_user, replace_ui_files, run_osu, run_osu_updater, set_osu_config_values,
set_osu_user_config_values, valid_osu_folder,
@@ -61,13 +62,14 @@ pub fn run() {
has_osuwinello,
has_wmctrl,
has_net8,
encrypt_string
encrypt_string,
download_ezpp_launcher_update,
install_ezpp_launcher_update
])
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_cors_fetch::init())
.plugin(tauri_plugin_sql::Builder::default().build())
.build(tauri::generate_context!())
.expect("error while building tauri application");

View File

@@ -1,8 +1,9 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "ezpplauncher",
"version": "3.0.2",
"identifier": "farm.ezpp.launcher",
"productName": "EZPPLauncher",
"version": "3.0.4",
"identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher",
"build": {
"beforeDevCommand": "bun run vite:dev",
"devUrl": "http://localhost:1420",
@@ -32,20 +33,26 @@
"license": "GPL-3.0",
"active": true,
"targets": [
"app"
"nsis",
"appimage"
],
"windows": {
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
},
"nsis": {
"installMode": "currentUser",
"compression": "lzma",
"installerHooks": "./nsis-hooks.nsh"
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"windows": {
"webviewInstallMode": {
"silent": true,
"type": "downloadBootstrapper"
}
}
]
}
}

View File

@@ -1,150 +0,0 @@
<script lang="ts">
import ezppLogo from '../../../../assets/logo.png';
import { osudirect } from '@/api/osudirect';
import { gameSounds } from '@/utils';
import { BeatmapDecoder } from 'osu-parsers';
import { onMount } from 'svelte';
type logoProps = {
beatmapId: number;
extended: boolean;
onclick: () => void;
};
let { beatmapId, extended, onclick }: logoProps = $props();
let hovered = $state(false);
let bpm = $state(150); // 1000 * 60 / bpm
let lastTimeout: number | undefined = undefined;
onMount(async () => {
gameSounds.preload();
const beatmapData = await osudirect.osu(beatmapId);
if (beatmapData) {
const decoder = new BeatmapDecoder();
const beatmap = decoder.decodeFromString(beatmapData);
console.log(beatmap);
const audio = new Audio(`https://osu.direct/api/media/audio/${beatmapId}`);
audio.volume = 0.3;
// Function to play the heartbeat sound
const playHeartbeat = () => {
gameSounds.play('menuHeartbeat', {
volume: hovered ? 1 : 0.3,
});
};
// Function to synchronize the heartbeat with the song
const syncHeartbeat = () => {
const currentTime = audio.currentTime * 1000 - 25; // Convert to milliseconds
const timingPoint = beatmap.controlPoints.timingPointAt(currentTime);
const timingPointTime = timingPoint.startTime;
console.log(currentTime, timingPointTime);
if (timingPoint && bpm !== timingPoint.bpm) {
bpm = timingPoint.bpm;
if (lastTimeout) window.clearTimeout(lastTimeout);
const interval = (1000 * 60) / bpm; // Interval in milliseconds
const nextBeat = currentTime % interval; // Invert: time since last beat
// Schedule the next heartbeat at the correct time
lastTimeout = window.setTimeout(() => {
playHeartbeat();
// Clear any previous interval
if (lastTimeout) {
window.clearInterval(lastTimeout);
lastTimeout = undefined;
}
if (!lastTimeout) lastTimeout = window.setInterval(playHeartbeat, interval);
}, nextBeat);
}
// Continue syncing
requestAnimationFrame(syncHeartbeat);
};
// Wait for audio to be ready before starting playback and syncing
audio.addEventListener('canplay', async () => {
audio.addEventListener('play', syncHeartbeat);
audio.addEventListener('ended', async () => await audio.play());
await audio.play();
syncHeartbeat();
});
}
});
</script>
<div
class="w-screen {extended
? hovered
? '-translate-y-1 scale-100'
: '-translate-y-1 scale-90'
: hovered
? 'translate-y-5 scale-150'
: 'translate-y-5 scale-125'} transition-transform select-none"
>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="logo-animation relative w-44 h-44 mx-auto cursor-pointer"
onmouseenter={() => (hovered = true)}
onmouseleave={() => (hovered = false)}
onclick={() => {
if (extended) {
gameSounds.play('menuBack');
} else {
gameSounds.play('menuHit');
}
onclick();
}}
>
<img
class="absolute pulse-logo"
style="animation-duration: {(1000 * 60) / bpm}ms;"
src={ezppLogo}
alt="logo-pulse"
/>
<img
class="absolute main-logo"
style="animation-duration: {(1000 * 60) / bpm}ms;"
src={ezppLogo}
alt="logo"
/>
</div>
</div>
<style lang="scss">
.logo-animation {
.pulse-logo {
animation: 0.5s 0.2s infinite forwards beat-pulse;
}
.main-logo {
animation: 0.5s infinite forwards beat;
}
}
@keyframes beat {
0%,
100% {
scale: 1;
}
90% {
scale: 1.08;
}
}
@keyframes beat-pulse {
0%,
10% {
scale: 0.5;
opacity: 0.5;
filter: blur(0px);
}
100% {
scale: 1.4;
opacity: 0;
filter: blur(2px);
}
}
</style>

View File

@@ -138,3 +138,17 @@ export const hasOsuWinello = async () => await invoke<boolean>('has_osuwinello')
export const hasNet8 = async () => await invoke<boolean>('has_net8');
export const encryptString = async (str: string, entropy: string) =>
await invoke<string>('encrypt_string', { string: str, entropy });
export const downloadUpdate = async (
url: string,
progressCallback: (file: UpdateStatus) => void
) => {
const downloadStatusListen = await listen('download-progress', (event) =>
progressCallback(event.payload as UpdateStatus)
);
try {
await invoke<string>('download_ezpp_launcher_update', { url });
} finally {
downloadStatusListen();
}
};
export const installUpdate = async () => await invoke('install_ezpp_launcher_update');

View File

@@ -83,6 +83,7 @@
import { osuapi } from '@/api/osuapi';
import {
downloadEZPPLauncherUpdateFiles,
downloadUpdate,
encryptString,
exit,
getBeatmapSetsCount,
@@ -94,6 +95,7 @@
hasNet8,
hasOsuWinello,
hasWMCTRL,
installUpdate,
isOsuCorrupted,
isOsuRunning,
isValidOsuFolder,
@@ -114,6 +116,8 @@
let launchInfo = $state('');
let launchError = $state<Error | undefined>(undefined);
let downloadingUpdate = $state(false);
let selectedGamemode = $derived(
getGamemodeInt(modeIntToStr($preferredMode), typeIntToStr($preferredType))
);
@@ -519,7 +523,7 @@
</script>
<AlertDialog.Root open={launchError !== undefined}>
<AlertDialog.Content class="bg-theme-950 border-theme-800 p-0">
<AlertDialog.Content class="bg-theme-950 border-theme-800 p-0 max-w-[90vw]">
<div
class="flex flex-col items-center justify-center border-b border-theme-800 bg-black/40 rounded-t-lg p-3"
>
@@ -527,10 +531,10 @@
<span class="font-semibold text-xl">Error on Launch!</span>
</div>
<div
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 overflow-hidden"
>
{#if launchError}
<pre class="text-wrap text-start">{JSON.stringify(
<pre class="text-wrap text-start overflow-auto w-full">{JSON.stringify(
launchError,
Object.getOwnPropertyNames(launchError),
2
@@ -577,14 +581,45 @@
</div>
</div>
<div class="flex items-center justify-center mb-3">
<Button
onclick={async () => {
if ($newVersion) {
await openURL($newVersion.html_url);
await exit();
}
}}>Update now</Button
>
{#if $platform === 'windows'}
{#if downloadingUpdate}
<div class="flex flex-col items-center justify-center gap-2 p-3 rounded-lg w-full">
<Progress indeterminate={progress === -1} value={progress} />
<span class="text-muted-foreground text-sm mt-4">{launchInfo}</span>
</div>
{:else}
<Button
onclick={async () => {
const updateFile = $newVersion?.assets.find((asset) => asset.name.endsWith('.exe'));
if (!updateFile) {
toast.error('Hmmm...', {
description: 'No update file found.',
});
$newVersion = undefined;
return;
}
downloadingUpdate = true;
launchInfo = 'Downloading Update...';
await downloadUpdate(updateFile.browser_download_url, (file) => {
progress = file.progress;
launchInfo = `Downloading Update (${formatBytes(file.downloaded)}/${formatBytes(file.size)})...`;
});
progress = -1;
launchInfo = 'Update downloaded, installing...';
await installUpdate();
}}>Install Update now</Button
>
{/if}
{:else}
<Button
onclick={async () => {
if ($newVersion) {
await openURL($newVersion.html_url);
await exit();
}
}}>Update now</Button
>
{/if}
</div>
</AlertDialog.Content>
</AlertDialog.Root>