Skip to content

Commit 6fd37e8

Browse files
committed
proton support init
1 parent 17bd098 commit 6fd37e8

7 files changed

Lines changed: 120 additions & 41 deletions

File tree

executor/app.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
package executor
22

3-
//App struct
3+
// App struct
44
type App struct {
5-
Name string
6-
Path string
7-
Args string
5+
Name string
6+
GamePath string
7+
Args string
8+
ProtonPath string
9+
WinePrefixPath string
10+
CompatDataPath string
811
}
912

10-
//Equals func
13+
// Equals func
1114
func (a *App) Equals(otherApp App) bool {
12-
return a.Name == otherApp.Name && a.Path == otherApp.Path && a.Args == otherApp.Args
15+
return a.Name == otherApp.Name &&
16+
a.GamePath == otherApp.GamePath &&
17+
a.Args == otherApp.Args &&
18+
a.ProtonPath == otherApp.ProtonPath &&
19+
a.WinePrefixPath == otherApp.WinePrefixPath &&
20+
a.CompatDataPath == otherApp.CompatDataPath
1321
}

executor/executor.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
var apps = make([]App, 0)
1010
var rpdPath string
1111

12-
//Init func
12+
// Init func
1313
func Init() []App {
1414
wd, err := os.Getwd()
1515
if err != nil {
@@ -24,16 +24,16 @@ func Init() []App {
2424
return nil
2525
}
2626

27-
//RunApp func
27+
// RunApp func
2828
func RunApp(app App) error {
2929
return executeApp(app)
3030
}
3131

32-
//RunAppWithArgs func
32+
// RunAppWithArgs func
3333
func RunAppWithArgs(mode, app string) error {
3434
switch mode {
3535
case "direct":
36-
return executeApp(App{Path: app})
36+
return executeApp(App{GamePath: app})
3737
case "list":
3838
var found bool = false
3939
for _, listApp := range apps {
@@ -50,7 +50,7 @@ func RunAppWithArgs(mode, app string) error {
5050
return nil
5151
}
5252

53-
//RpdPath func
53+
// RpdPath func
5454
func RpdPath() string {
5555
return rpdPath
5656
}

executor/importedApps.go

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import (
1010
"strings"
1111
)
1212

13-
//GetApps func
13+
// GetApps func
1414
func GetApps() *[]App {
1515
fmt.Println("imported Apps:", apps)
1616
return &apps
1717
}
1818

19-
//ImportApp func
19+
// ImportApp func
2020
func ImportApp(app App) {
2121
err := os.Chdir(rpdPath)
2222
if err != nil {
@@ -32,8 +32,23 @@ func ImportApp(app App) {
3232

3333
defer f.Close()
3434

35+
if app.ProtonPath == "" {
36+
app.ProtonPath = "none"
37+
}
38+
39+
if app.WinePrefixPath == "" {
40+
app.WinePrefixPath = "none"
41+
}
42+
43+
if app.CompatDataPath == "" {
44+
app.CompatDataPath = "none"
45+
}
46+
3547
f.WriteString(app.Name + "\n")
36-
f.WriteString(app.Path + "\n")
48+
f.WriteString(app.GamePath + "\n")
49+
f.WriteString(app.ProtonPath + "\n")
50+
f.WriteString(app.WinePrefixPath + "\n")
51+
f.WriteString(app.CompatDataPath + "\n")
3752
if app.Args != "" {
3853
f.WriteString(app.Args)
3954
}
@@ -44,13 +59,13 @@ func ImportApp(app App) {
4459
sortApps()
4560
}
4661

47-
//EditApp func
62+
// EditApp func
4863
func EditApp(oldApp, newApp App) {
4964
DeleteApp(oldApp)
5065
ImportApp(newApp)
5166
}
5267

53-
//DeleteApp func
68+
// DeleteApp func
5469
func DeleteApp(app App) {
5570
err := os.Chdir(rpdPath)
5671
if err != nil {
@@ -93,9 +108,9 @@ func loadImportedApps() []App {
93108
}
94109
cleanStrings(&config)
95110

96-
newApp := App{Name: config[0], Path: config[1]}
97-
if len(config) == 3 {
98-
newApp.Args = config[2]
111+
newApp := App{Name: config[0], GamePath: config[1], ProtonPath: config[2], WinePrefixPath: config[3], CompatDataPath: config[4]}
112+
if len(config) == 6 {
113+
newApp.Args = config[5]
99114
}
100115

101116
loadedApps = append(loadedApps, newApp)
@@ -123,5 +138,6 @@ func checkForDataFolder() bool {
123138
func cleanStrings(str *[]string) {
124139
for i := 0; i < len(*str); i++ {
125140
(*str)[i] = strings.Replace((*str)[i], "\n", "", -1)
141+
(*str)[i] = strings.Replace((*str)[i], "none", "", -1)
126142
}
127143
}

executor/shellCommands.go

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ import (
1111
var threaded bool = false
1212
var exitAfterExec = false
1313

14-
//Threaded func
14+
// Threaded func
1515
func Threaded(b bool) {
1616
threaded = b
1717
}
1818

19-
//SetExitAfterExec func
19+
// SetExitAfterExec func
2020
func SetExitAfterExec(b bool) {
2121
exitAfterExec = b
2222
}
2323

24-
//IsThreaded func
24+
// IsThreaded func
2525
func IsThreaded() bool {
2626
return threaded
2727
}
@@ -35,7 +35,7 @@ func executeApp(app App) error {
3535
argsArray = strings.Split(app.Args, " ")
3636
}
3737

38-
path, executable, seperator := seperatePathFromExecutable(app.Path)
38+
path, executable, seperator := seperatePathFromExecutable(app.GamePath)
3939
os.Chdir(rpdPath)
4040
os.Chdir(path)
4141

@@ -47,16 +47,33 @@ func executeApp(app App) error {
4747
if runtime.GOOS == "windows" {
4848
cmd = exec.Command(executable, argsArray...)
4949
} else {
50-
if path != "" {
51-
cmd = exec.Command("."+seperator+executable, argsArray...)
52-
} else {
53-
cmd = exec.Command(executable, argsArray...)
50+
51+
execLine := ""
52+
53+
if strings.Contains(executable, ".exe") {
54+
compatEnv := "STEAM_COMPAT_DATA_PATH=" + app.CompatDataPath
55+
prefixEnv := "WINEPREFIX=" + app.WinePrefixPath
56+
protonExec := "\"" + app.ProtonPath + "\""
57+
execLine = compatEnv + " " + prefixEnv + " " + protonExec + " run "
5458
}
59+
60+
seperator = seperator
61+
/* if path != "" {
62+
execLine += "." + seperator + executable
63+
} else {
64+
execLine += executable
65+
} */
66+
67+
execLine += app.GamePath
68+
69+
cmd = exec.Command("$PWD")
70+
cmd.Run()
71+
cmd = exec.Command(execLine, argsArray...)
5572
}
5673

5774
var err error
5875

59-
if (exitAfterExec) {
76+
if exitAfterExec {
6077
err = cmd.Run()
6178
} else {
6279
err = cmd.Start()
@@ -93,5 +110,6 @@ func seperatePathFromExecutable(path string) (string, string, string) {
93110
executable = splittedPath[len(splittedPath)-1]
94111
directoryPath = strings.Replace(path, executable, "", -1)
95112
}
113+
96114
return directoryPath, executable, seperator
97115
}

fynegui/appItem.go

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
"github.com/smaTc/RemotePlayDetached/executor"
1010
)
1111

12-
//AppItem struct
12+
// AppItem struct
1313
type AppItem struct {
1414
App executor.App
1515
widget.Box
1616
}
1717

18-
//NewAppItem func
18+
// NewAppItem func
1919
func NewAppItem(app executor.App) fyne.Widget {
2020
item := &AppItem{App: app}
2121
item.ExtendBaseWidget(item)
@@ -65,15 +65,27 @@ func editApp(oldApp executor.App) {
6565
nameEntry.SetText(oldApp.Name)
6666

6767
pathEntry := NewButtonEntry()
68-
pathEntry.SetText(oldApp.Path)
68+
pathEntry.SetText(oldApp.GamePath)
6969

7070
argsEntry := NewButtonEntry()
7171
argsEntry.SetText(oldApp.Args)
7272

73+
protonEntry := NewButtonEntry()
74+
protonEntry.SetText(oldApp.ProtonPath)
75+
76+
prefixEntry := NewButtonEntry()
77+
prefixEntry.SetText(oldApp.WinePrefixPath)
78+
79+
compatEntry := NewButtonEntry()
80+
compatEntry.SetText(oldApp.CompatDataPath)
81+
7382
name := widget.NewFormItem("Name", nameEntry)
74-
path := widget.NewFormItem("Path", pathEntry)
83+
path := widget.NewFormItem("Game Path", pathEntry)
7584
args := widget.NewFormItem("Args", argsEntry)
76-
form := widget.NewForm(name, path, args)
85+
proton := widget.NewFormItem("Proton Path", protonEntry)
86+
prefix := widget.NewFormItem("Prefix Path", prefixEntry)
87+
compat := widget.NewFormItem("Compat Path", compatEntry)
88+
form := widget.NewForm(name, path, args, proton, prefix, compat)
7789

7890
cancelButton := widget.NewButton("Cancel", func() {
7991
editWindow.Close()
@@ -83,12 +95,15 @@ func editApp(oldApp executor.App) {
8395
appName := nameEntry.Text
8496
appPath := pathEntry.Text
8597
argsString := argsEntry.Text
98+
protonPath := protonEntry.Text
99+
prefixPath := prefixEntry.Text
100+
compatPath := compatEntry.Text
86101

87102
if appName == "" || appPath == "" {
88103
return
89104
}
90105

91-
newApp := executor.App{Name: appName, Path: appPath, Args: argsString}
106+
newApp := executor.App{Name: appName, GamePath: appPath, Args: argsString, ProtonPath: protonPath, WinePrefixPath: prefixPath, CompatDataPath: compatPath}
92107
editWindow.Close()
93108
executor.EditApp(oldApp, newApp)
94109
refreshMainWindow()
@@ -101,6 +116,9 @@ func editApp(oldApp executor.App) {
101116
nameEntry.SetConfirmButton(okButton)
102117
pathEntry.SetConfirmButton(okButton)
103118
argsEntry.SetConfirmButton(okButton)
119+
protonEntry.SetConfirmButton(okButton)
120+
prefixEntry.SetConfirmButton(okButton)
121+
compatEntry.SetConfirmButton(okButton)
104122

105123
buttons := fyne.NewContainerWithLayout(layout.NewHBoxLayout(), okButton, layout.NewSpacer(), fileExlporerButton, layout.NewSpacer(), cancelButton)
106124

fynegui/appList.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var apps *[]executor.App
1313

1414
var appList *widget.Form
1515

16-
//var appList widget.NewVBox
16+
// var appList widget.NewVBox
1717
var appListContainer *fyne.Container
1818
var appListGroup *widget.Group
1919

@@ -27,6 +27,12 @@ func importApp() {
2727

2828
argsEntry := NewButtonEntry()
2929

30+
protonPathEntry := NewButtonEntry()
31+
32+
winePrefixEntry := NewButtonEntry()
33+
34+
compatDataPathEntry := NewButtonEntry()
35+
3036
/*
3137
nameEntry := widget.NewEntry()
3238
pathEntry := widget.NewEntry()
@@ -35,10 +41,17 @@ func importApp() {
3541

3642
name := widget.NewFormItem("Name", nameEntry)
3743

38-
path := widget.NewFormItem("Path", pathEntry)
44+
path := widget.NewFormItem("Game Path", pathEntry)
3945

4046
args := widget.NewFormItem("Args", argsEntry)
41-
form := widget.NewForm(name, path, args)
47+
48+
proton := widget.NewFormItem("Proton Path", protonPathEntry)
49+
50+
prefix := widget.NewFormItem("Prefix Path", winePrefixEntry)
51+
52+
compat := widget.NewFormItem("Compat Data Path", compatDataPathEntry)
53+
54+
form := widget.NewForm(name, path, args, proton, prefix, compat)
4255
cancelButton := widget.NewButton("Cancel", func() {
4356
importWindow.Close()
4457
if explorerWindow != nil {
@@ -50,12 +63,15 @@ func importApp() {
5063
appName := nameEntry.Text
5164
appPath := pathEntry.Text
5265
argsString := argsEntry.Text
66+
protonPath := protonPathEntry.Text
67+
prefixPath := winePrefixEntry.Text
68+
compatPath := compatDataPathEntry.Text
5369

5470
if appName == "" || appPath == "" {
5571
return
5672
}
5773

58-
newApp := executor.App{Name: appName, Path: appPath, Args: argsString}
74+
newApp := executor.App{Name: appName, GamePath: appPath, Args: argsString, ProtonPath: protonPath, WinePrefixPath: prefixPath, CompatDataPath: compatPath}
5975
importWindow.Close()
6076
executor.ImportApp(newApp)
6177
refreshMainWindow()
@@ -68,6 +84,9 @@ func importApp() {
6884
nameEntry.SetConfirmButton(okButton)
6985
pathEntry.SetConfirmButton(okButton)
7086
argsEntry.SetConfirmButton(okButton)
87+
protonPathEntry.SetConfirmButton(okButton)
88+
winePrefixEntry.SetConfirmButton(okButton)
89+
compatDataPathEntry.SetConfirmButton(okButton)
7190

7291
buttons := fyne.NewContainerWithLayout(layout.NewHBoxLayout(), okButton, layout.NewSpacer(), fileExlporerButton, layout.NewSpacer(), cancelButton)
7392

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"github.com/smaTc/RemotePlayDetached/fynegui"
99
)
1010

11-
//VERSION const
12-
const VERSION = "0.4.2"
11+
// VERSION const
12+
const VERSION = "0.5.0"
1313

14-
//noGui bool
14+
// noGui bool
1515
var noGui bool = false
1616

1717
var runDirectly string = ""

0 commit comments

Comments
 (0)