Compare commits

...

2 Commits

9 changed files with 181 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "ezpplauncher", "name": "ezpplauncher",
"version": "3.2.0", "version": "3.2.1",
"description": "", "description": "",
"type": "module", "type": "module",
"scripts": { "scripts": {
+1 -1
View File
@@ -1074,7 +1074,7 @@ dependencies = [
[[package]] [[package]]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.0" version = "3.2.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.22.1", "base64 0.22.1",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "ezpplauncher" name = "ezpplauncher"
version = "3.2.0" version = "3.2.1"
description = "EZPPLauncher redefined." description = "EZPPLauncher redefined."
authors = ["HorizonCode"] authors = ["HorizonCode"]
edition = "2024" edition = "2024"
+66
View File
@@ -985,3 +985,69 @@ pub async fn install_ezpp_launcher_update(app: AppHandle) -> Result<(), String>
pub async fn install_ezpp_launcher_update(_app: AppHandle) -> Result<(), String> { pub async fn install_ezpp_launcher_update(_app: AppHandle) -> Result<(), String> {
Ok(()) Ok(())
} }
#[tauri::command]
pub async fn run_open_tablet_driver(path: String) -> Result<(), String> {
let otd_path = PathBuf::from(&path);
if !otd_path.exists() {
return Err(format!("OpenTabletDriver not found at: {}", path));
}
#[cfg(windows)]
const DETACHED_PROCESS: u32 = 0x00000008;
#[cfg(windows)]
const CREATE_NEW_PROCESS_GROUP: u32 = 0x00000200;
{
#[cfg(windows)]
Command::new(&otd_path)
.creation_flags(DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP)
.spawn()
.map_err(|e| format!("Failed to start OpenTabletDriver: {}", e))?;
#[cfg(not(windows))]
Command::new(&otd_path)
.spawn()
.map_err(|e| format!("Failed to start OpenTabletDriver: {}", e))?;
}
Ok(())
}
#[tauri::command]
pub async fn stop_open_tablet_driver(path: String) -> Result<(), String> {
let binary_name = PathBuf::from(&path)
.file_name()
.and_then(|n| n.to_str())
.ok_or("Invalid OpenTabletDriver path")?
.to_string();
let mut sys = System::new_all();
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
let process = sys.processes().values().find(|p| {
p.name().eq_ignore_ascii_case(&binary_name)
}).ok_or("OpenTabletDriver is not running")?;
process.kill();
Ok(())
}
#[tauri::command]
pub fn is_open_tablet_driver_running() -> bool {
#[cfg(windows)]
{
let mut sys = System::new_all();
sys.refresh_processes(sysinfo::ProcessesToUpdate::All, true);
sys.processes().values().any(|p| {
p.name().eq_ignore_ascii_case("OpenTabletDriver.Daemon.exe")
})
}
#[cfg(not(windows))]
{
true
}
}
+13 -6
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.0", "version": "3.2.1",
"identifier": "farm.EZPPFarm.Launcher", "identifier": "farm.EZPPFarm.Launcher",
"mainBinaryName": "ezpplauncher", "mainBinaryName": "ezpplauncher",
"build": { "build": {
@@ -16,14 +16,17 @@
"title": "EZPPLauncher", "title": "EZPPLauncher",
"width": 1000, "width": 1000,
"height": 650, "height": 650,
"minWidth": 1000,
"minHeight": 650,
"decorations": false, "decorations": false,
"resizable": false, "resizable": false,
"maximizable": false "maximizable": false,
"shadow": true
} }
], ],
"withGlobalTauri": true, "withGlobalTauri": true,
"security": { "security": {
"csp": null, "csp": "default-src 'self' tauri: asset:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' asset: data: blob: https://assets.ppy.sh https://a.ez-pp.farm https://git.ez-pp.farm https://osu.direct; connect-src 'self' https://ez-pp.farm https://api.ez-pp.farm https://c.ez-pp.farm https://analytics.ez-pp.farm https://git.ez-pp.farm https://osu.direct; media-src 'self' asset: blob:;",
"assetProtocol": { "assetProtocol": {
"enable": true, "enable": true,
"scope": [ "scope": [
@@ -35,6 +38,8 @@
"bundle": { "bundle": {
"publisher": "EZPPFarm", "publisher": "EZPPFarm",
"copyright": "EZPPFarm", "copyright": "EZPPFarm",
"shortDescription": "osu! launcher for EZPPFarm",
"longDescription": "EZPPLauncher is a custom osu! launcher for the EZPPFarm server, featuring automatic updates, ingame login, stat tracking and launcher theming.",
"homepage": "https://ez-pp.farm", "homepage": "https://ez-pp.farm",
"license": "GPL-3.0", "license": "GPL-3.0",
"active": true, "active": true,
@@ -44,9 +49,11 @@
], ],
"fileAssociations": [ "fileAssociations": [
{ {
"ext": ["ezpplauncher-theme"], "ext": [
"name": "ezppLauncher Theme", "ezpplauncher-theme"
"description": "ezppLauncher Theme File", ],
"name": "EZPPLauncher Theme",
"description": "EZPPLauncher Theme File",
"role": "Viewer", "role": "Viewer",
"mimeType": "application/x-ezpplauncher-theme" "mimeType": "application/x-ezpplauncher-theme"
} }
+3
View File
@@ -37,6 +37,9 @@ custom_theme_volume.subscribe((val) => {
} }
}); });
export const openTabletDriverEnabled = writable<boolean>(false);
export const openTabletDriverPath = writable<string>('');
export const serverPing = writable<number | undefined>(undefined); export const serverPing = writable<number | undefined>(undefined);
export const serverConnectionFails = writable(0); export const serverConnectionFails = writable(0);
+3
View File
@@ -146,3 +146,6 @@ export const getSkins = async (folder: string) =>
'get_skins', 'get_skins',
{ folder } { folder }
); );
export const startOpenTabletDriver = async (otdDaemonPath: string) =>
await invoke('run_open_tablet_driver', { path: otdDaemonPath });
export const stopOpenTabletDriver = async (otdDaemonPath: string) => await invoke('stop_open_tablet_driver', { path: otdDaemonPath });
+7
View File
@@ -13,6 +13,8 @@
discordPresence, discordPresence,
firstStartup, firstStartup,
launcherVersion, launcherVersion,
openTabletDriverEnabled,
openTabletDriverPath,
platform, platform,
presenceLoading, presenceLoading,
setupValues, setupValues,
@@ -113,6 +115,8 @@
const config_osu_installation_path = $userSettings.value('osu_installation_path'); const config_osu_installation_path = $userSettings.value('osu_installation_path');
const config_discord_presence = $userSettings.value('discord_presence'); const config_discord_presence = $userSettings.value('discord_presence');
const config_tracking_enabled = $userSettings.value('tracking_consent'); const config_tracking_enabled = $userSettings.value('tracking_consent');
const config_otd_enabled = $userSettings.value('otd_enabled');
const config_otd_path = $userSettings.value('otd_path');
const localThemes = await getThemes(); const localThemes = await getThemes();
const last_theme = localThemes.find((t) => t.name === config_theme.get('Default')); const last_theme = localThemes.find((t) => t.name === config_theme.get('Default'));
@@ -131,6 +135,8 @@
reduceAnimations.set(config_reduce_animations.get(false)); reduceAnimations.set(config_reduce_animations.get(false));
osuInstallationPath.set(config_osu_installation_path.get('')); osuInstallationPath.set(config_osu_installation_path.get(''));
discordPresence.set(config_discord_presence.get(true)); discordPresence.set(config_discord_presence.get(true));
openTabletDriverEnabled.set(config_otd_enabled.get(false));
openTabletDriverPath.set(config_otd_path.get(''));
if (config_tracking_enabled.exists()) { if (config_tracking_enabled.exists()) {
trackingEnabled.set(config_tracking_enabled.get(false)); trackingEnabled.set(config_tracking_enabled.get(false));
} }
@@ -139,6 +145,7 @@
customCursor.subscribe((val) => config_custom_cursor.set(val)); customCursor.subscribe((val) => config_custom_cursor.set(val));
cursorSmoothening.subscribe((val) => config_cursor_smoothening.set(val)); cursorSmoothening.subscribe((val) => config_cursor_smoothening.set(val));
reduceAnimations.subscribe((val) => config_reduce_animations.set(val)); reduceAnimations.subscribe((val) => config_reduce_animations.set(val));
openTabletDriverEnabled.subscribe((val) => config_otd_enabled.set(val));
discordPresence.subscribe(async (val) => { discordPresence.subscribe(async (val) => {
config_discord_presence.set(val); config_discord_presence.set(val);
+86
View File
@@ -18,6 +18,8 @@
launcherVersion, launcherVersion,
launching, launching,
newVersion, newVersion,
openTabletDriverEnabled,
openTabletDriverPath,
osuBuild, osuBuild,
osuStream, osuStream,
platform, platform,
@@ -112,6 +114,8 @@
runUpdater, runUpdater,
setConfigValues, setConfigValues,
setUserConfigValues, setUserConfigValues,
startOpenTabletDriver,
stopOpenTabletDriver,
} from '@/osuUtil'; } from '@/osuUtil';
import { getCurrentWindow } from '@tauri-apps/api/window'; import { getCurrentWindow } from '@tauri-apps/api/window';
import { ezppfarm } from '@/api/ezpp'; import { ezppfarm } from '@/api/ezpp';
@@ -618,11 +622,24 @@
}, 1000 * 2); }, 1000 * 2);
} }
let otd_run = false;
if ($openTabletDriverEnabled && $openTabletDriverPath.length > 0) {
try {
await startOpenTabletDriver($openTabletDriverPath);
otd_run = true;
} catch (err) {
console.log('Failed to start OpenTabletDriver:', err);
}
}
await runOsu(osuPath, true); await runOsu(osuPath, true);
if ($trackingEnabled) umami.track('app_exit_osu'); if ($trackingEnabled) umami.track('app_exit_osu');
cleanup = true; cleanup = true;
launchInfo = 'Cleaning up...'; launchInfo = 'Cleaning up...';
if (otd_run) await stopOpenTabletDriver($openTabletDriverPath);
setCurrentTimeGlobalMedia(0); setCurrentTimeGlobalMedia(0);
resumeGlobalMedia(); resumeGlobalMedia();
fadeGlobalVolume(0, $custom_theme_volume, 2000); fadeGlobalVolume(0, $custom_theme_volume, 2000);
@@ -854,6 +871,48 @@
}); });
}; };
const browse_otd = async () => {
const selectedPath = await open({
directory: false,
multiple: false,
title: 'Select OpenTabletDriver Executable',
filters:
$platform === 'windows'
? [
{
name: 'OpenTabletDriver',
extensions: ['exe'],
},
]
: undefined,
});
if (typeof selectedPath === 'string') {
const fileName = selectedPath.split(/[\\/]/).pop();
if ($platform === 'windows' && fileName?.toLowerCase() !== 'opentabletdriver.daemon.exe') {
sileo.error({
title: 'Wrong executable',
description: 'Please select OpenTabletDriver.Daemon.exe',
fill: '#181825',
styles: { description: 'text-center!' },
});
return;
}
openTabletDriverPath.set(selectedPath);
$userSettings.value('otd_path').set(selectedPath);
await $userSettings.save();
sileo.success({
title: 'Yay!',
description: 'OpenTabletDriver set successfully.',
fill: '#181825',
styles: {
description: 'text-center!',
},
});
}
};
onMount(() => { onMount(() => {
const config = $userSettings; const config = $userSettings;
const trackingConsent = config.value('tracking_consent'); const trackingConsent = config.value('tracking_consent');
@@ -1711,6 +1770,33 @@
> >
</div> </div>
{#if $platform === 'windows'} {#if $platform === 'windows'}
<div class="flex flex-col">
<Label class="text-sm" for="setting-otd-path">OpenTabletDriver path</Label>
<div class="text-muted-foreground text-xs">
Automatically start OpenTabletDriver when launching osu!.
</div>
</div>
<div class="flex flex-row w-full">
<div
class="mt-4 flex items-center bg-theme-950 border border-theme-800 border-r-0 rounded-l-md px-3"
>
<Checkbox id="setting-otd" bind:checked={$openTabletDriverEnabled} />
</div>
<Input
class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-none"
type="text"
value={$openTabletDriverPath}
placeholder="Path to OpenTabletDriver.Daemon.exe"
readonly
disabled={!$openTabletDriverEnabled}
/>
<Button
class="mt-4 bg-theme-950 border-theme-800 rounded-l-none"
variant="outline"
disabled={!$openTabletDriverEnabled}
onclick={browse_otd}>Browse</Button
>
</div>
<div class="flex flex-col"> <div class="flex flex-col">
<Label class="text-sm" for="setting-custom-cursor">patcher release stream</Label> <Label class="text-sm" for="setting-custom-cursor">patcher release stream</Label>
<div class="text-muted-foreground text-xs"> <div class="text-muted-foreground text-xs">