-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathmain.go
More file actions
93 lines (78 loc) · 2.27 KB
/
main.go
File metadata and controls
93 lines (78 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package main
import (
"fmt"
"os"
"github.com/smaTc/RemotePlayDetached/executor"
"github.com/smaTc/RemotePlayDetached/fynegui"
)
// VERSION const
const VERSION = "0.4.4"
// noGui bool
var noGui bool = false
var runDirectly string = ""
var runFromList string = ""
func main() {
checkForArgs()
executor.Init()
if runDirectly != "" && runFromList == "" {
err := executor.RunAppWithArgs("direct", runDirectly)
if err != nil {
fynegui.TextPopup(err.Error(), "Error:")
}
} else if runDirectly == "" && runFromList != "" {
err := executor.RunAppWithArgs("list", runFromList)
if err != nil {
fynegui.TextPopup(err.Error(), "Error:")
}
} else if runDirectly != "" && runFromList != "" {
fmt.Println("you cannot use -r and -g together")
os.Exit(1)
} else if noGui && runDirectly == "" && runFromList == "" {
fmt.Println("Can't run without gui when no game to application to launch is specified")
}
if !noGui {
fynegui.VERSION = VERSION
fynegui.Run()
}
}
func checkForArgs() {
args := os.Args
for index, arg := range args {
if arg == "-s" || arg == "-silent" {
noGui = true
executor.SetExitAfterExec(true)
fynegui.SetExitAfterExec(true)
}
if arg == "-r" || arg == "-run" {
runDirectly = args[index+1]
}
if arg == "-a" || arg == "-app" {
runFromList = args[index+1]
}
if arg == "-rs" || arg == "-runsilent" {
noGui = true
executor.SetExitAfterExec(true)
fynegui.SetExitAfterExec(true)
runDirectly = args[index+1]
}
if arg == "-as" || arg == "-appsilent" {
noGui = true
executor.SetExitAfterExec(true)
fynegui.SetExitAfterExec(true)
runFromList = args[index+1]
}
if arg == "-h" || arg == "-help" {
fmt.Println("===============================================================")
fmt.Println("Possible arguments for Remote Play Detached:")
fmt.Println("")
fmt.Println("-s or -silent to disable the gui")
fmt.Println("-a or -app to run an app from your list by its name")
fmt.Println("-as or -appsilent to run an app from list without gui")
fmt.Println("-r or -run to run an app from a given path")
fmt.Println("-rs or -runsilent to run a game from a given path without gui")
fmt.Println("")
fmt.Println("===============================================================")
os.Exit(0)
}
}
}