mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 15:14:35 +01:00
Launch args from settings
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -41,6 +41,7 @@ interface IState {
|
||||
migotoSet: boolean
|
||||
|
||||
unElevated: boolean
|
||||
launchArgs: string
|
||||
}
|
||||
|
||||
export default class ServerLaunchSection extends React.Component<IProps, IState> {
|
||||
@@ -64,6 +65,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
||||
akebiSet: false,
|
||||
migotoSet: false,
|
||||
unElevated: false,
|
||||
launchArgs: '',
|
||||
}
|
||||
|
||||
this.toggleGrasscutter = this.toggleGrasscutter.bind(this)
|
||||
@@ -95,6 +97,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
||||
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<IProps, IState>
|
||||
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))
|
||||
}
|
||||
|
||||
@@ -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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
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<IProps, IState> {
|
||||
})
|
||||
}
|
||||
|
||||
async setLaunchArgs(value: string) {
|
||||
await setConfigOption('launch_args', value)
|
||||
|
||||
this.setState({
|
||||
launch_args: value,
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Menu closeFn={this.props.closeFn} className="Options" heading="Options">
|
||||
@@ -685,6 +698,16 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
<Tr text="components.delete" />
|
||||
</BigButton>
|
||||
</div>
|
||||
<div className="OptionLabel" id="menuOptionsLaunchArgs">
|
||||
<Tr text="options.launch_args" />
|
||||
</div>
|
||||
<TextInput
|
||||
id="launch_args"
|
||||
key="launch_args"
|
||||
placeholder={'-arg=value'}
|
||||
onChange={this.setLaunchArgs}
|
||||
initalValue={this.state.launch_args}
|
||||
/>
|
||||
</div>
|
||||
</Menu>
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user