diff --git a/src-tauri/lang/en.json b/src-tauri/lang/en.json index 5c8c87c..34a26f2 100644 --- a/src-tauri/lang/en.json +++ b/src-tauri/lang/en.json @@ -36,7 +36,8 @@ "redirect_more": "Also redirect other MHY games", "check_aagl": "For more options, check the other launcher", "grasscutter_elevation": "Method of running GC on restricted ports", - "web_cache": "Delete webCaches folder" + "web_cache": "Delete webCaches folder", + "launch_args": "Launch Args" }, "downloads": { "grasscutter_fullbuild": "Download Grasscutter All-in-One", diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index adf3fc7..dfa8988 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -41,6 +41,7 @@ interface IState { migotoSet: boolean unElevated: boolean + launchArgs: string } export default class ServerLaunchSection extends React.Component { @@ -64,6 +65,7 @@ export default class ServerLaunchSection extends React.Component akebiSet: false, migotoSet: false, unElevated: false, + launchArgs: '', } this.toggleGrasscutter = this.toggleGrasscutter.bind(this) @@ -95,6 +97,7 @@ export default class ServerLaunchSection extends React.Component akebiSet: config.akebi_path !== '', migotoSet: config.migoto_path !== '', unElevated: config.un_elevated || false, + launchArgs: config.launch_args || '', }) } @@ -214,9 +217,13 @@ export default class ServerLaunchSection extends React.Component if (config.un_elevated) { await invoke('run_un_elevated', { path: config.game_install_path, + args: config.launch_args, }) } else { - await invoke('run_program_relative', { path: exe || config.game_install_path }) + await invoke('run_program_relative', { + path: exe || config.game_install_path, + args: config.launch_args, + }) } else alert('Game not found! At: ' + (exe || config.game_install_path)) } diff --git a/src/ui/components/menu/Options.tsx b/src/ui/components/menu/Options.tsx index 1263b7d..3393a85 100644 --- a/src/ui/components/menu/Options.tsx +++ b/src/ui/components/menu/Options.tsx @@ -17,6 +17,7 @@ import * as meta from '../../../utils/rsa' import HelpButton from '../common/HelpButton' import SmallButton from '../common/SmallButton' import { confirm } from '@tauri-apps/api/dialog' +import TextInput from '../common/TextInput' export enum GrasscutterElevation { None = 'None', @@ -50,6 +51,7 @@ interface IState { platform: string un_elevated: boolean redirect_more: boolean + launch_args: string // Linux stuff grasscutter_elevation: string @@ -85,6 +87,7 @@ export default class Options extends React.Component { platform: '', un_elevated: false, redirect_more: false, + launch_args: '', // Linux stuff grasscutter_elevation: GrasscutterElevation.None, @@ -107,6 +110,7 @@ export default class Options extends React.Component { this.deleteWebCache = this.deleteWebCache.bind(this) this.addMigotoDelay = this.addMigotoDelay.bind(this) this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this) + this.setLaunchArgs = this.setLaunchArgs.bind(this) } async componentDidMount() { @@ -145,6 +149,7 @@ export default class Options extends React.Component { platform, un_elevated: config.un_elevated || false, redirect_more: config.redirect_more || false, + launch_args: config.launch_args || '', // Linux stuff grasscutter_elevation: config.grasscutter_elevation || GrasscutterElevation.None, @@ -374,6 +379,14 @@ export default class Options extends React.Component { }) } + async setLaunchArgs(value: string) { + await setConfigOption('launch_args', value) + + this.setState({ + launch_args: value, + }) + } + render() { return ( @@ -685,6 +698,16 @@ export default class Options extends React.Component { + + ) diff --git a/src/utils/configuration.ts b/src/utils/configuration.ts index 0882daa..9d7e777 100644 --- a/src/utils/configuration.ts +++ b/src/utils/configuration.ts @@ -28,6 +28,7 @@ let defaultConfig: Configuration auto_mongodb: false, un_elevated: false, redirect_more: false, + launch_args: '', // Linux stuff grasscutter_elevation: 'None', @@ -62,6 +63,7 @@ export interface Configuration { auto_mongodb: boolean un_elevated: boolean redirect_more: boolean + launch_args: string // Linux stuff grasscutter_elevation: string