Compare commits

..

6 Commits

6 changed files with 194 additions and 101 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "3.2.4", "version": "3.2.5",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -79,4 +79,4 @@
"vite": "^8.0.14", "vite": "^8.0.14",
"vite-plugin-devtools-json": "^1.0.0" "vite-plugin-devtools-json": "^1.0.0"
} }
} }
+1 -1
View File
@@ -1239,7 +1239,7 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.4" version = "3.2.5"
dependencies = [ dependencies = [
"aes-gcm", "aes-gcm",
"anyhow", "anyhow",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.4" version = "3.2.5"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "EZPPLauncher", "productName": "EZPPLauncher",
"version": "3.2.4", "version": "3.2.5",
"identifier": "farm.EZPPFarm.Launcher", "identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher", "mainBinaryName": "ezpplauncher",
"build": { "build": {
+51 -6
View File
@@ -9,6 +9,11 @@ export enum Gamemodes {
RELAX_CATCH = 6, RELAX_CATCH = 6,
AUTOPILOT_OSU = 8, AUTOPILOT_OSU = 8,
SCOREV2_OSU = 12,
SCOREV2_TAIKO = 13,
SCOREV2_CATCH = 14,
SCOREV2_MANIA = 15,
} }
export enum Mode { export enum Mode {
@@ -22,12 +27,39 @@ export enum Type {
VANILLA = 0, VANILLA = 0,
RELAX = 4, RELAX = 4,
AUTOPILOT = 8, AUTOPILOT = 8,
SCOREV2 = 12,
} }
export const validModes = [Mode.OSU, Mode.TAIKO, Mode.CATCH, Mode.MANIA]; export const validModes = [Mode.OSU, Mode.TAIKO, Mode.CATCH, Mode.MANIA];
export const validTypes = [Type.VANILLA, Type.RELAX, Type.AUTOPILOT]; export const validTypes = [Type.VANILLA, Type.RELAX, Type.AUTOPILOT, Type.SCOREV2];
export const validModeTypeCombinations = [0, 1, 2, 3, 4, 5, 6, 8]; export const validModeTypeCombinations = [
export const validModeTypeCombinationsSorted = [0, 4, 8, 1, 5, 2, 6, 3]; Gamemodes.VANILLA_OSU,
Gamemodes.VANILLA_TAIKO,
Gamemodes.VANILLA_CATCH,
Gamemodes.VANILLA_MANIA,
Gamemodes.RELAX_OSU,
Gamemodes.RELAX_TAIKO,
Gamemodes.RELAX_CATCH,
Gamemodes.AUTOPILOT_OSU,
Gamemodes.SCOREV2_OSU,
Gamemodes.SCOREV2_TAIKO,
Gamemodes.SCOREV2_CATCH,
Gamemodes.SCOREV2_MANIA,
];
export const validModeTypeCombinationsSorted = [
Gamemodes.VANILLA_OSU,
Gamemodes.RELAX_OSU,
Gamemodes.AUTOPILOT_OSU,
Gamemodes.SCOREV2_OSU,
Gamemodes.VANILLA_TAIKO,
Gamemodes.RELAX_TAIKO,
Gamemodes.SCOREV2_TAIKO,
Gamemodes.VANILLA_CATCH,
Gamemodes.RELAX_CATCH,
Gamemodes.SCOREV2_CATCH,
Gamemodes.VANILLA_MANIA,
Gamemodes.SCOREV2_MANIA,
];
export const validMode = (modeStr: string) => modeStrToInt(modeStr) !== undefined; export const validMode = (modeStr: string) => modeStrToInt(modeStr) !== undefined;
export const validType = (typeStr: string) => typeStrToInt(typeStr) !== undefined; export const validType = (typeStr: string) => typeStrToInt(typeStr) !== undefined;
@@ -60,7 +92,7 @@ export const modeIntToStr = (modeInt: number) => {
return undefined; return undefined;
}; };
export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | string) => { export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | 'v2' | string) => {
switch (typeStr) { switch (typeStr) {
case 'relax': case 'relax':
return Type.RELAX; return Type.RELAX;
@@ -68,6 +100,8 @@ export const typeStrToInt = (typeStr: 'vanilla' | 'relax' | 'autopilot' | string
return Type.AUTOPILOT; return Type.AUTOPILOT;
case 'vanilla': case 'vanilla':
return Type.VANILLA; return Type.VANILLA;
case 'scorev2':
return Type.SCOREV2;
} }
return undefined; return undefined;
}; };
@@ -80,13 +114,15 @@ export const typeIntToStr = (typeInt: number) => {
return 'autopilot'; return 'autopilot';
case Type.VANILLA: case Type.VANILLA:
return 'vanilla'; return 'vanilla';
case Type.SCOREV2:
return 'scorev2';
} }
return undefined; return undefined;
}; };
export const getGamemodeInt = ( export const getGamemodeInt = (
mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined, mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined,
type: 'vanilla' | 'relax' | 'autopilot' | string | undefined type: 'vanilla' | 'relax' | 'autopilot' | 'scorev2' | string | undefined
) => { ) => {
let modee = 0; let modee = 0;
switch (mode) { switch (mode) {
@@ -108,6 +144,9 @@ export const getGamemodeInt = (
case 'autopilot': case 'autopilot':
modee += Type.AUTOPILOT; modee += Type.AUTOPILOT;
break; break;
case 'scorev2':
modee += Type.SCOREV2;
break;
} }
return modee; return modee;
@@ -115,7 +154,7 @@ export const getGamemodeInt = (
export const getGamemodeName = ( export const getGamemodeName = (
mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined, mode: 'osu' | 'taiko' | 'catch' | 'mania' | string | undefined,
type: 'vanilla' | 'relax' | 'autopilot' | string | undefined type: 'vanilla' | 'relax' | 'autopilot' | 'scorev2' | string | undefined
) => { ) => {
let modeStr = ''; let modeStr = '';
switch (mode) { switch (mode) {
@@ -140,6 +179,9 @@ export const getGamemodeName = (
case 'autopilot': case 'autopilot':
modeStr += 'ap'; modeStr += 'ap';
break; break;
case 'scorev2':
modeStr += 'v2';
break;
default: default:
modeStr += 'vn'; modeStr += 'vn';
break; break;
@@ -173,6 +215,9 @@ export const getModeAndTypeFromGamemode = (gamemode: number) => {
case Type.AUTOPILOT: case Type.AUTOPILOT:
type = Type.AUTOPILOT; type = Type.AUTOPILOT;
break; break;
case Type.SCOREV2:
type = Type.SCOREV2;
break;
} }
return { return {
+138 -90
View File
@@ -150,6 +150,8 @@
let downloadingUpdate = $state(false); let downloadingUpdate = $state(false);
let updateCheckFailed = $state(false);
let dragAndDrop = useDropZone({ let dragAndDrop = useDropZone({
onDrop: async (file) => { onDrop: async (file) => {
const firstFile = file[0]; const firstFile = file[0];
@@ -244,7 +246,7 @@
} }
}; };
const launch = async () => { const launch = async (skipUpdateCheck = false) => {
if ($launching) return; if ($launching) return;
launchInfo = 'Checking if osu! is already running...'; launchInfo = 'Checking if osu! is already running...';
launching.set(true); launching.set(true);
@@ -301,107 +303,112 @@
} }
} }
try { if (!skipUpdateCheck) {
launchInfo = 'Looking for file updates...'; try {
let launchStream = $launcherStream; launchInfo = 'Looking for file updates...';
if ($platform !== 'windows') launchStream = 'stable'; //fallback to stable for non windows systems let launchStream = $launcherStream;
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, launchStream); if ($platform !== 'windows') launchStream = 'stable'; //fallback to stable for non windows systems
const updateResult = await getEZPPLauncherUpdateFiles(osuPath, launchStream);
if (updateResult) { if (updateResult) {
if (updateResult.filesToDownload.length > 0) { if (updateResult.filesToDownload.length > 0) {
downloadingEZPPFiles = true; downloadingEZPPFiles = true;
launchInfo = 'Found file updates!'; launchInfo = 'Found file updates!';
await new Promise((res) => setTimeout(res, 1000)); await new Promise((res) => setTimeout(res, 1000));
await downloadEZPPLauncherUpdateFiles( await downloadEZPPLauncherUpdateFiles(
osuPath, osuPath,
updateResult.filesToDownload, updateResult.filesToDownload,
updateResult.updateFiles, updateResult.updateFiles,
(file) => { (file) => {
progress = file.progress; progress = file.progress;
launchInfo = `${file.fileName}(${formatBytes( launchInfo = `${file.fileName}(${formatBytes(
file.downloaded file.downloaded
)}/${formatBytes(file.size)})...`; )}/${formatBytes(file.size)})...`;
} }
); );
progress = -1; progress = -1;
downloadingEZPPFiles = false; downloadingEZPPFiles = false;
} else { } else {
launchInfo = 'EZPPLauncher Files are up to date!'; launchInfo = 'EZPPLauncher Files are up to date!';
await new Promise((res) => setTimeout(res, 1500)); await new Promise((res) => setTimeout(res, 1500));
}
} }
} catch (err) {
launchError = err as Error;
launching.set(false);
return;
} }
} catch (err) {
launchError = err as Error;
launching.set(false);
return;
} }
try { try {
const streamInfo = await ezppfarm.latestBuildVersion('stable40'); if (!skipUpdateCheck) {
if (!streamInfo) { const streamInfo = await ezppfarm.latestBuildVersion('stable40');
sileo.error({ if (!streamInfo) {
title: 'Hmmm...', sileo.error({
description: 'Failed to check for updates, maybe osu! is down?', title: 'Hmmm...',
}); description: 'Failed to check for updates, maybe osu! is down?',
launching.set(false); });
return; launching.set(false);
} updateCheckFailed = true;
return;
}
const releaseStream = await getReleaseStream(osuPath); const releaseStream = await getReleaseStream(osuPath);
if (releaseStream === undefined) { if (releaseStream === undefined) {
sileo.error({ sileo.error({
title: 'Hmmm...', title: 'Hmmm...',
description: 'Failed to get osu! release stream.', description: 'Failed to get osu! release stream.',
}); });
launching.set(false); launching.set(false);
return; return;
} }
// only stable osu! release streams are supported for now // only stable osu! release streams are supported for now
if (!releaseStream.toLowerCase().includes('stable')) { if (!releaseStream.toLowerCase().includes('stable')) {
sileo.error({ sileo.error({
title: 'Hmmm...', title: 'Hmmm...',
description: 'You are not on the stable release stream, please switch to it.', description: 'You are not on the stable release stream, please switch to it.',
}); });
launching.set(false); launching.set(false);
return; return;
} }
const osuCorrupted = await isOsuCorrupted(osuPath); const osuCorrupted = await isOsuCorrupted(osuPath);
let forceUpdate = let forceUpdate =
(releaseStream && releaseStream.toLowerCase() !== 'stable40') || osuCorrupted; (releaseStream && releaseStream.toLowerCase() !== 'stable40') || osuCorrupted;
const versions = compareBuildNumbers($osuBuild, streamInfo); const versions = compareBuildNumbers($osuBuild, streamInfo);
if (versions > 0 || forceUpdate) { if (versions > 0 || forceUpdate) {
launchInfo = 'Update found!'; launchInfo = 'Update found!';
await new Promise((res) => setTimeout(res, 1500)); await new Promise((res) => setTimeout(res, 1500));
launchInfo = 'Running osu! updater...'; launchInfo = 'Running osu! updater...';
await setUserConfigValues(osuPath, [ await setUserConfigValues(osuPath, [
{
key: 'LastVersion',
value: `b${streamInfo}`,
},
]);
await setConfigValues(osuPath, [
{
key: '_ReleaseStream',
value: 'Stable40',
},
]);
osuStream.set('Stable40');
osuBuild.set(`b${streamInfo}`);
await runUpdater(osuPath);
launchInfo = 'osu! is now up to date!';
if (forceUpdate)
await setConfigValues(osuPath, [
{ {
key: '_UpdateFailCount', key: 'LastVersion',
value: '0', value: `b${streamInfo}`,
}, },
]); ]);
} else { await setConfigValues(osuPath, [
launchInfo = 'You are up to date!'; {
key: '_ReleaseStream',
value: 'Stable40',
},
]);
osuStream.set('Stable40');
osuBuild.set(`b${streamInfo}`);
await runUpdater(osuPath);
launchInfo = 'osu! is now up to date!';
if (forceUpdate)
await setConfigValues(osuPath, [
{
key: '_UpdateFailCount',
value: '0',
},
]);
} else {
launchInfo = 'You are up to date!';
}
} }
if ($currentUser) { if ($currentUser) {
const [username, password] = await Promise.all([ const [username, password] = await Promise.all([
@@ -1027,6 +1034,47 @@
</AlertDialog.Content> </AlertDialog.Content>
</AlertDialog.Root> </AlertDialog.Root>
<AlertDialog.Root open={updateCheckFailed}>
<AlertDialog.Content
class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
escapeKeydownBehavior="ignore"
interactOutsideBehavior="ignore"
>
<div
class="flex flex-col items-center justify-center border-b border-theme-800 bg-black/40 rounded-t-lg p-3"
>
<Import size={40} />
<span class="font-semibold text-xl">Update check failed</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"
>
<p class="mb-4">Failed to check for updates.</p>
<p>Do you want to launch anyway?</p>
</div>
<div class="flex items-center justify-center mb-3 gap-4 mt-4">
<Button
class="min-w-28"
onclick={async () => {
await launch(true);
updateCheckFailed = false;
}}
>
Launch anyways
</Button>
<Button
variant="outline"
onclick={async () => {
updateCheckFailed = false;
}}
>
Abort
</Button>
</div>
</AlertDialog.Content>
</AlertDialog.Root>
<AlertDialog.Root open={$newVersion === undefined && !!droppedTheme && !themeInstalling}> <AlertDialog.Root open={$newVersion === undefined && !!droppedTheme && !themeInstalling}>
<AlertDialog.Content <AlertDialog.Content
class="bg-theme-950 border-theme-800 p-0 max-w-2xl" class="bg-theme-950 border-theme-800 p-0 max-w-2xl"
@@ -1353,7 +1401,7 @@
? 'No connection...' ? 'No connection...'
: undefined} : undefined}
disabled={$osuInstallationPath === '' || $serverConnectionFails > 1} disabled={$osuInstallationPath === '' || $serverConnectionFails > 1}
onClick={launch} onClick={async () => await launch()}
/> />
</div> </div>
<div class="relative h-50"> <div class="relative h-50">
@@ -1384,7 +1432,7 @@
{getGamemodeName(modeIntToStr(selectedMode), typeIntToStr(selectedType))} {getGamemodeName(modeIntToStr(selectedMode), typeIntToStr(selectedType))}
</div> </div>
</Select.Trigger> </Select.Trigger>
<Select.Content class="bg-theme-950 border border-theme-900 rounded-lg"> <Select.Content class="bg-theme-950 border border-theme-900 rounded-lg max-h-72">
{#each validModeTypeCombinationsSorted as gamemode (gamemode)} {#each validModeTypeCombinationsSorted as gamemode (gamemode)}
{@const gamemod = getModeAndTypeFromGamemode(gamemode)} {@const gamemod = getModeAndTypeFromGamemode(gamemode)}
<Select.Item value={gamemode.toFixed()}> <Select.Item value={gamemode.toFixed()}>