3dm support that doesn't actually work I just don't wanna fix it

This commit is contained in:
SpikeHD
2022-07-19 17:40:22 -07:00
parent 18a1b0e94c
commit e270c886db
4 changed files with 44 additions and 4 deletions

View File

@@ -66,6 +66,7 @@
"resources": "These are also required to run a Grasscutter server. This button will be grey if you have an existing resources folder with contents inside"
},
"swag": {
"akebi": "Set Akebi Executable"
"akebi": "Set Akebi Executable",
"migoto": "Set 3dMigoto Executable"
}
}

View File

@@ -54,6 +54,7 @@ export default class ServerLaunchSection extends React.Component<{}, IState> {
this.toggleGrasscutter = this.toggleGrasscutter.bind(this)
this.playGame = this.playGame.bind(this)
this.launchAkebi = this.launchAkebi.bind(this)
this.launch3dm = this.launch3dm.bind(this)
this.setIp = this.setIp.bind(this)
this.setPort = this.setPort.bind(this)
this.toggleHttps = this.toggleHttps.bind(this)
@@ -188,6 +189,18 @@ export default class ServerLaunchSection extends React.Component<{}, IState> {
await this.playGame(config.akebi_path, gameExec)
}
async launch3dm() {
const config = await getConfig()
// First launch 3dm
invoke('run_program', {
path: config.migoto_path
})
// Then play the game as normal
await this.playGame()
}
setIp(text: string) {
this.setState({
ip: text
@@ -240,9 +253,15 @@ export default class ServerLaunchSection extends React.Component<{}, IState> {
<BigButton onClick={this.playGame} id="officialPlay">{this.state.buttonLabel}</BigButton>
{
this.state.swag && (
<BigButton onClick={this.launchAkebi} id="akebiLaunch">
<img className="AkebiIcon" id="akebiIcon" src={Akebi} />
</BigButton>
<>
<BigButton onClick={this.launchAkebi} id="akebiLaunch">
<img className="AkebiIcon" id="akebiIcon" src={Akebi} />
</BigButton>
<BigButton onClick={this.launch3dm} id="serverLaunch">
3DM
</BigButton>
</>
)
}
<BigButton onClick={this.launchServer} id="serverLaunch">

View File

@@ -37,6 +37,7 @@ interface IState {
// Swag stuff
akebi_path: string
migoto_path: string
}
export default class Options extends React.Component<IProps, IState> {
@@ -60,12 +61,14 @@ export default class Options extends React.Component<IProps, IState> {
// Swag stuff
akebi_path: '',
migoto_path: ''
}
this.setGameExecutable = this.setGameExecutable.bind(this)
this.setGrasscutterJar = this.setGrasscutterJar.bind(this)
this.setJavaPath = this.setJavaPath.bind(this)
this.setAkebi = this.setAkebi.bind(this)
this.setMigoto = this.setMigoto.bind(this)
this.toggleGrasscutterWithGame = this.toggleGrasscutterWithGame.bind(this)
this.setCustomBackground = this.setCustomBackground.bind(this)
this.toggleEncryption = this.toggleEncryption.bind(this)
@@ -137,6 +140,14 @@ export default class Options extends React.Component<IProps, IState> {
})
}
setMigoto(value: string) {
setConfigOption('migoto_path', value)
this.setState({
migoto_path: value
})
}
async setLanguage(value: string) {
await setConfigOption('language', value)
window.location.reload()
@@ -321,6 +332,14 @@ export default class Options extends React.Component<IProps, IState> {
<DirInput onChange={this.setAkebi} value={this.state?.akebi_path} extensions={['exe']} />
</div>
</div>
<div className='OptionSection' id="menuOptionsContainerMigoto">
<div className='OptionLabel' id="menuOptionsLabelMigoto">
<Tr text="swag.migoto" />
</div>
<div className='OptionValue' id="menuOptionsDirMigoto">
<DirInput onChange={this.setMigoto} value={this.state?.migoto_path} extensions={['exe']} />
</div>
</div>
</>
)
}

View File

@@ -51,6 +51,7 @@ export interface Configuration {
// Swag stuff
akebi_path?: string
migoto_path?: string
}
export async function setConfigOption<K extends keyof Configuration>(key: K, value: Configuration[K]): Promise<void> {