From e6d88173d6ee01e3a3f2d5b9f059392cc7b78407 Mon Sep 17 00:00:00 2001 From: neoapps-dev Date: Thu, 21 May 2026 14:14:45 +0300 Subject: [PATCH] feat(LCELive): add -ip, -port and -quitondisconnect for neoLegacy --- src-tauri/src/lib.rs | 19 ++++++++++++++----- src/components/modals/ChooseInstanceModal.tsx | 8 +++++--- src/services/TauriService.ts | 3 ++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a548f74..d643dc1 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1342,7 +1342,7 @@ async fn check_game_update(app: AppHandle, instance_id: String, url: String) -> #[tauri::command] #[allow(non_snake_case)] -async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: String, mut servers: Vec) -> Result<(), String> { +async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: String, mut servers: Vec, game_args: Vec) -> Result<(), String> { perform_instance_sync(&app, &instance_id).await?; let working_dir = get_instance_working_dir(&app, &instance_id); let config = load_config(app.clone()); @@ -1422,8 +1422,11 @@ async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: S cmd.env_remove("QT_PLUGIN_PATH"); } - cmd.arg(&game_exe) - .current_dir(&working_dir); + cmd.arg(&game_exe); + for a in &game_args { + cmd.arg(a); + } + cmd.current_dir(&working_dir); let child = cmd.spawn().map_err(|e| e.to_string())?; { @@ -1492,6 +1495,9 @@ async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: S c.arg(&game_exe); c }; + for a in &game_args { + cmd.arg(a); + } #[cfg(unix)] cmd.process_group(0); @@ -1559,6 +1565,9 @@ async fn launch_game(app: AppHandle, state: State<'_, GameState>, instance_id: S #[cfg(all(not(target_os = "macos"), not(target_os = "linux")))] { let mut cmd = tokio::process::Command::new(&game_exe); + for a in &game_args { + cmd.arg(a); + } #[cfg(unix)] cmd.process_group(0); cmd.current_dir(&working_dir); @@ -2462,7 +2471,7 @@ async fn join_game( port: host_port, }; - launch_game(app, game_state, instance_id, vec![server]).await + launch_game(app, game_state, instance_id, vec![server], vec![]).await } #[tauri::command] @@ -2492,7 +2501,7 @@ pub fn run() { let _ = window.hide(); } let state = app_handle.state::(); - match launch_game(app_handle.clone(), state, instance_id, Vec::new()).await { + match launch_game(app_handle.clone(), state, instance_id, Vec::new(), vec![]).await { Ok(_) => { app_handle.exit(0); } Err(e) => { eprintln!("Auto-launch error: {}", e); diff --git a/src/components/modals/ChooseInstanceModal.tsx b/src/components/modals/ChooseInstanceModal.tsx index 5a79201..0510c5b 100644 --- a/src/components/modals/ChooseInstanceModal.tsx +++ b/src/components/modals/ChooseInstanceModal.tsx @@ -64,9 +64,11 @@ export default function ChooseInstanceModal({ const accessToken = lceLiveService.accessToken ?? ""; await TauriService.startRelayProxy(baseUrl, accessToken, sessionId); setStatus("Launching game..."); - await TauriService.launchGame(selectedInstance, [ - { name: invite.hostName || "LCELive Game", ip: "127.0.0.1", port: 61000 } - ]); + await TauriService.launchGame( + selectedInstance, + [{ name: invite.hostName || "LCELive Game", ip: "127.0.0.1", port: 61000 }], + ["-ip", "127.0.0.1", "-port", "61000", "-quitondisconnect"] + ); } else { setStatus("Launching game..."); await TauriService.stopAllProxies(); diff --git a/src/services/TauriService.ts b/src/services/TauriService.ts index ef3539e..d8b58cc 100644 --- a/src/services/TauriService.ts +++ b/src/services/TauriService.ts @@ -123,8 +123,9 @@ export class TauriService { static async launchGame( instanceId: string, servers: McServer[], + extraArgs?: string[], ): Promise { - return invoke("launch_game", { instanceId, servers }); + return invoke("launch_game", { instanceId, servers, extraArgs: extraArgs ?? [] }); } static async stopGame(instanceId: string): Promise {