From d645cbc86054019f6520c203367b0663ff810586 Mon Sep 17 00:00:00 2001 From: Gregory Brzezinski Date: Thu, 3 Nov 2022 23:12:26 +0300 Subject: [PATCH] New steam arguments --- gameUtils/fakeGames.go | 11 ++++++++--- gameUtils/gameTypes.go | 16 +++++++++++----- gameUtils/gameUtils.go | 4 ++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gameUtils/fakeGames.go b/gameUtils/fakeGames.go index df22de9..49df69b 100644 --- a/gameUtils/fakeGames.go +++ b/gameUtils/fakeGames.go @@ -3,7 +3,12 @@ package gameUtils var garrysmodGame = SteamGame{ GameId: "garrysmod", SteamId: "4000", - Args: []string{}, + Args: []Argument{ + Argument{ + Body: "+connect", + Value: "127.0.0.1:27015", + }, + }, Platforms: map[string]bool{ "linux": true, "windows": true, @@ -19,7 +24,7 @@ var openarena = SteamGame{ GameId: "openarena", SteamId: "", //Executable: "/usr/games/openarena", - Args: []string{}, + //Args: []string{}, Assets: GameInterfaceAssets{ Title: "Open Arena", Icon: "icon.png", @@ -30,7 +35,7 @@ var openarena = SteamGame{ var minecraft = SteamGame{ GameId: "minecraft", SteamId: "", - Args: []string{}, + //Args: []string{}, Assets: GameInterfaceAssets{ Title: "Minecraft", Icon: "icon.png", diff --git a/gameUtils/gameTypes.go b/gameUtils/gameTypes.go index 5436b96..1d060eb 100644 --- a/gameUtils/gameTypes.go +++ b/gameUtils/gameTypes.go @@ -1,11 +1,12 @@ package gameUtils type SteamGame struct { - GameId string - SteamId string - Args []string - Assets GameInterfaceAssets - Platforms map[string]bool + GameId string + SteamId string + Args []Argument + OptionalArgs []Argument + Assets GameInterfaceAssets + Platforms map[string]bool } type GameInterfaceAssets struct { @@ -24,3 +25,8 @@ type JSGameInterface struct { Icon string `json:"icon"` Description string `json:"description"` } + +type Argument struct { + Body string `json:"body"` + Value string `json:"value"` +} diff --git a/gameUtils/gameUtils.go b/gameUtils/gameUtils.go index 8258b26..223337f 100644 --- a/gameUtils/gameUtils.go +++ b/gameUtils/gameUtils.go @@ -29,3 +29,7 @@ func GetJSGameInterface(game SteamGame) JSGameInterface { } return newInterface } + +func ArgToStr(a Argument) string { + return a.Body + " " + a.Value +}