Skip to content

Commit 8e3b8d3

Browse files
committed
add launcher settings
1 parent a29fdab commit 8e3b8d3

File tree

6 files changed

+112
-6
lines changed

6 files changed

+112
-6
lines changed

app.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ type StartMatchOptions struct {
7474
OrangePlayers []PlayerJs `json:"orangePlayers"`
7575
MutatorSettings flat.MutatorSettingsT `json:"mutatorSettings"`
7676
ExtraOptions ExtraOptions `json:"extraOptions"`
77+
Launcher string `json:"launcher"`
78+
GamePath string `json:"gamePath"`
7779
}
7880

7981
func (a *App) StartMatch(options StartMatchOptions) Result {
@@ -105,6 +107,19 @@ func (a *App) StartMatch(options StartMatchOptions) Result {
105107
gameMode = flat.GameModeSoccer
106108
}
107109

110+
var launcher flat.Launcher
111+
switch options.Launcher {
112+
case "steam":
113+
launcher = flat.LauncherSteam
114+
case "epic":
115+
launcher = flat.LauncherEpic
116+
case "custom":
117+
launcher = flat.LauncherCustom
118+
default:
119+
println("No launcher chosen, defaulting to steam")
120+
launcher = flat.LauncherSteam
121+
}
122+
108123
var playerConfigs []*flat.PlayerConfigurationT
109124

110125
for _, playerInfo := range options.BluePlayers {
@@ -128,6 +143,8 @@ func (a *App) StartMatch(options StartMatchOptions) Result {
128143
InstantStart: options.ExtraOptions.InstantStart,
129144
SkipReplays: options.ExtraOptions.SkipReplays,
130145
AutoSaveReplay: options.ExtraOptions.AutoSaveReplay,
146+
Launcher: launcher,
147+
GamePath: options.GamePath,
131148
ExistingMatchBehavior: flat.ExistingMatchBehavior(options.ExtraOptions.ExistingMatchBehavior),
132149
})
133150

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<script lang="ts">
2+
import Modal from "./Modal.svelte"
3+
// todo: remember these! global state etc, save locally through go?
4+
let {launcher = $bindable(), gamePath = $bindable()} = $props();
5+
let visible = $state(false)
6+
7+
function uid(){
8+
return Date.now().toString(36) + Math.random().toString(36).substr(2);
9+
}
10+
let uids = [uid(), uid(), uid()];
11+
</script>
12+
13+
<button onclick={()=>{visible = true}}>Launcher Options</button>
14+
15+
<Modal title="Select a launcher" bind:visible>
16+
<div class="container">
17+
<div class="launcherSelect">
18+
<input name="launcher" type="radio" id={`launcher-steam-${uids[0]}`} bind:group={launcher} value="steam">
19+
<label for={`launcher-steam-${uids[0]}`}>Steam</label><br>
20+
21+
<input name="launcher" type="radio" id={`launcher-epic-${uids[1]}`} bind:group={launcher} value="epic">
22+
<label for={`launcher-epic-${uids[1]}`}>Epic</label><br>
23+
24+
<input name="launcher" type="radio" id={`launcher-custom-${uids[2]}`} bind:group={launcher} value="custom">
25+
<label for={`launcher-custom-${uids[2]}`}>Custom</label>
26+
</div>
27+
<div class="gamePath">
28+
<label for="gamePath">Game path:</label>
29+
<input type="text" id="gamePath" bind:value={gamePath} placeholder="(Leave blank for default)" >
30+
</div>
31+
</div>
32+
</Modal>
33+
34+
<style>
35+
.container {
36+
display: flex;
37+
flex-direction: column;
38+
gap: 1rem;
39+
}
40+
.launcherSelect {
41+
font-size: 1.1rem;
42+
}
43+
input[type='radio'] {
44+
transform: scale(1.1);
45+
}
46+
.gamePath {
47+
display: flex;
48+
flex-direction: column;
49+
}
50+
</style>

frontend/src/components/MatchSettings/Main.svelte

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
import { MAPS_STANDARD } from "../../arena-names.js";
55
import { mutators as mutatorOptions } from "./rlmutators";
66
import type { ExtraOptions } from "../../../bindings/gui";
7+
import LauncherSelector from "../LauncherSelector.svelte";
78
89
let {
910
map = $bindable(),
1011
mode = $bindable(),
1112
extraOptions = $bindable(),
1213
mutators = $bindable(),
14+
launcher = $bindable(),
15+
gamePath = $bindable(),
1316
onStart = () => {},
1417
onStop = () => {},
1518
} = $props();
@@ -53,6 +56,11 @@
5356
bind:value={mode}
5457
placeholder="Select mode"
5558
/>
59+
</div>
60+
<div class="controls">
61+
<button class="start" onclick={()=>{onStart()}}>Start</button>
62+
<button class="stop" onclick={()=>{onStop()}}>Stop</button>
63+
<div></div>
5664
<button
5765
onclick={() => {
5866
showMutators = true;
@@ -63,10 +71,7 @@
6371
showExtraOptions = true;
6472
}}>Extra</button
6573
>
66-
</div>
67-
<div class="controls">
68-
<button class="start" onclick={onStart}>Start</button>
69-
<button class="stop" onclick={onStop}>Stop</button>
74+
<LauncherSelector bind:launcher bind:gamePath />
7075
</div>
7176
</div>
7277
</div>
@@ -147,7 +152,7 @@
147152
<label for="instantStart"> Instant Start </label>
148153
<br />
149154
<select
150-
name="cock"
155+
name="emb"
151156
id="emb"
152157
bind:value={extraOptions.existingMatchBehavior}
153158
>

frontend/src/pages/Home.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
localStorage.setItem("MS_MUTATORS", JSON.stringify(mutatorSettings));
8888
});
8989
90+
let launcher = $state("steam");
91+
let gamePath = $state("");
92+
9093
async function onMatchStart() {
9194
let options: StartMatchOptions = {
9295
map,
@@ -99,6 +102,8 @@
99102
// @ts-ignore
100103
return draggablePlayerToPlayerJs(x);
101104
}),
105+
launcher,
106+
gamePath,
102107
mutatorSettings,
103108
extraOptions,
104109
};
@@ -198,6 +203,8 @@
198203
bind:mode
199204
bind:mutators={mutatorSettings}
200205
bind:extraOptions
206+
bind:launcher
207+
bind:gamePath
201208
/>
202209
</div>
203210
</div>

frontend/src/pages/RocketHost.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { MAPS_STANDARD } from "../arena-names";
55
import closeIcon from "../assets/close.svg"
66
import Plus from "../assets/plus.svg.svelte";
7+
import LauncherSelector from "../components/LauncherSelector.svelte";
78
let { onBack } = $props();
89
910
let waiting = $state(false);
@@ -65,6 +66,9 @@
6566
6667
let blueBots: string[] = $state([]);
6768
let orangeBots: string[] = $state([]);
69+
70+
let launcher = $state("steam");
71+
let gamePath = $state("");
6872
</script>
6973

7074
<div class="page">
@@ -178,6 +182,10 @@
178182
{/each}
179183
</select>
180184
</div>
185+
<div>
186+
<label for="mapselect">Launcher</label>
187+
<LauncherSelector bind:launcher bind:gamePath />
188+
</div>
181189
</div>
182190

183191
<div class="buttons">
@@ -190,7 +198,9 @@
190198
server: serverAddr,
191199
map,
192200
blueBots,
193-
orangeBots
201+
orangeBots,
202+
launcher,
203+
gamePath
194204
}).then((addr)=>{
195205
waiting = false;
196206
toast.success(

rockethost.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ type RHostMatchSettings struct {
112112
Map string `json:"map"`
113113
BlueBots []string `json:"blueBots"`
114114
OrangeBots []string `json:"orangeBots"`
115+
Launcher string `json:"launcher"`
116+
GamePath string `json:"gamePath"`
115117
}
116118

117119
func (a *App) StartRHostMatch(settings RHostMatchSettings) (string, error) {
@@ -145,6 +147,19 @@ func (a *App) StartRHostMatch(settings RHostMatchSettings) (string, error) {
145147
return "", errors.New("Couldn't connect to RLBotServer")
146148
}
147149

150+
var launcher flat.Launcher
151+
switch settings.Launcher {
152+
case "steam":
153+
launcher = flat.LauncherSteam
154+
case "epic":
155+
launcher = flat.LauncherEpic
156+
case "custom":
157+
launcher = flat.LauncherCustom
158+
default:
159+
println("No launcher chosen, defaulting to steam")
160+
launcher = flat.LauncherSteam
161+
}
162+
148163
err = conn.SendPacket(&flat.MatchSettingsT{
149164
PlayerConfigurations: []*flat.PlayerConfigurationT{},
150165
ScriptConfigurations: []*flat.ScriptConfigurationT{
@@ -162,6 +177,8 @@ func (a *App) StartRHostMatch(settings RHostMatchSettings) (string, error) {
162177
GameMapUpk: settings.Map,
163178
EnableStateSetting: true,
164179
EnableRendering: true,
180+
Launcher: launcher,
181+
GamePath: settings.GamePath,
165182
})
166183
if err != nil {
167184
return "", errors.New("Couldn't send matchsettings packet")

0 commit comments

Comments
 (0)