|
|
|
@@ -1,15 +1,18 @@
|
|
|
|
|
package ui
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"epochsilicon/pkg/log"
|
|
|
|
|
"epochsilicon/pkg/patching"
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"fyne.io/fyne/v2"
|
|
|
|
|
"fyne.io/fyne/v2/container"
|
|
|
|
|
"fyne.io/fyne/v2/dialog"
|
|
|
|
|
"fyne.io/fyne/v2/widget"
|
|
|
|
|
"os"
|
|
|
|
|
"os/exec"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"howett.net/plist"
|
|
|
|
|
|
|
|
|
@@ -198,12 +201,84 @@ func showTroubleshootingPopup() {
|
|
|
|
|
}, currentWindow).Show()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// --- Build Rosettax87 Locally ---
|
|
|
|
|
buildRosettaButton = widget.NewButton("Build", func() {
|
|
|
|
|
msg := "Building rosettax87 on your computer may speed up launch times. This requires xcode-commandline-tools and Cmake to be installed. See the instructions at https://git.burkey.co/eburk/epochsilicon/README.md\n\n"
|
|
|
|
|
msg += "Click YES to start the build process. This could take up to a minute depending on the the speed of your Mac. A popup will let you know when the files have been built and copied to the right place."
|
|
|
|
|
dialog.NewConfirm("Build rosettax87", msg, func(confirm bool) {
|
|
|
|
|
if confirm {
|
|
|
|
|
// Check for dependencies
|
|
|
|
|
if _, err := exec.LookPath("clang"); err != nil {
|
|
|
|
|
m := fmt.Errorf("xcode command line tools are not installed on your computer. Click the Website button in the app and read the instructions on building rosettax87 before trying again")
|
|
|
|
|
log.Error(m.Error())
|
|
|
|
|
dialog.ShowError(m, currentWindow)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if _, err := exec.LookPath("cmake"); err != nil {
|
|
|
|
|
m := fmt.Errorf("Cmake is not installed on your computer. Click the Website button in the app and read the instructions on building rosettax87 before trying again")
|
|
|
|
|
log.Error(m.Error())
|
|
|
|
|
dialog.ShowError(m, currentWindow)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xPath, lPath, err := patching.BuildRosetta()
|
|
|
|
|
if err != nil {
|
|
|
|
|
m := fmt.Errorf("Error building rosettax87: %v\nClick Website for information on getting help", err)
|
|
|
|
|
log.Error(m.Error())
|
|
|
|
|
dialog.ShowError(m, currentWindow)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
d := filepath.Join(paths.EpochPath, "rosettax87")
|
|
|
|
|
if err = os.RemoveAll(d); err != nil {
|
|
|
|
|
m := fmt.Errorf("Error removing existing rosettax87 directory: %v", err)
|
|
|
|
|
log.Error(m.Error())
|
|
|
|
|
dialog.ShowError(m, currentWindow)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = os.MkdirAll(d, 0755); err != nil {
|
|
|
|
|
m := fmt.Errorf("Error creating existing rosettax87 directory: %v", err)
|
|
|
|
|
log.Error(m.Error())
|
|
|
|
|
dialog.ShowError(m, currentWindow)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pathMap := map[string]string{
|
|
|
|
|
xPath: filepath.Join(paths.EpochPath, "rosettax87", "rosettax87"),
|
|
|
|
|
lPath: filepath.Join(paths.EpochPath, "rosettax87", "libRuntimeRosettax87"),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for srcPath, destPath := range pathMap {
|
|
|
|
|
fBytes, err := os.ReadFile(srcPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
errMsg := fmt.Sprintf("failed to read source file %s: %v", srcPath, err)
|
|
|
|
|
dialog.ShowError(errors.New(errMsg), currentWindow)
|
|
|
|
|
log.Debug(errMsg)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = os.WriteFile(destPath, fBytes, 0755)
|
|
|
|
|
if err != nil {
|
|
|
|
|
errMsg := fmt.Sprintf("failed to write file %s: %v", destPath, err)
|
|
|
|
|
dialog.ShowError(errors.New(errMsg), currentWindow)
|
|
|
|
|
log.Debug(errMsg)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
log.Debugf("Successfully copied %s to %s", srcPath, destPath)
|
|
|
|
|
}
|
|
|
|
|
dialog.ShowInformation("Build Successful", "Rosettax87 installed successfully.", currentWindow)
|
|
|
|
|
}
|
|
|
|
|
}, currentWindow).Show()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
troubleshootingTitle := widget.NewLabel("Troubleshooting")
|
|
|
|
|
troubleshootingTitle.TextStyle = fyne.TextStyle{Bold: true}
|
|
|
|
|
|
|
|
|
|
rowCrossover := container.NewBorder(nil, nil, widget.NewLabel("CrossOver version:"), crossoverStatusShort, nil)
|
|
|
|
|
rowWDB := container.NewBorder(nil, nil, widget.NewLabel("Delete WDB directory (cache):"), wdbDeleteButton, nil)
|
|
|
|
|
rowWine := container.NewBorder(nil, nil, widget.NewLabel("Delete Wine prefixes (~/.wine & Epoch/.wine):"), wineDeleteButton, nil)
|
|
|
|
|
rowBuildRosetta := container.NewBorder(nil, nil, widget.NewLabel("Build Rosettax87 locally:"), buildRosettaButton, nil)
|
|
|
|
|
appMgmtNote := widget.NewLabel("Please ensure EpochSilicon is enabled in System Settings > Privacy & Security > App Management.")
|
|
|
|
|
appMgmtNote.Wrapping = fyne.TextWrapWord
|
|
|
|
|
appMgmtNote.TextStyle = fyne.TextStyle{Italic: true}
|
|
|
|
@@ -215,6 +290,7 @@ func showTroubleshootingPopup() {
|
|
|
|
|
crossoverStatusDetail,
|
|
|
|
|
rowWDB,
|
|
|
|
|
rowWine,
|
|
|
|
|
rowBuildRosetta,
|
|
|
|
|
appMgmtNote,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -223,11 +299,11 @@ func showTroubleshootingPopup() {
|
|
|
|
|
troubleshootingCloseButton = widget.NewButton("Close", func() {})
|
|
|
|
|
|
|
|
|
|
popupContent := container.NewBorder(
|
|
|
|
|
nil, // top
|
|
|
|
|
nil, // top
|
|
|
|
|
container.NewCenter(troubleshootingCloseButton), // bottom
|
|
|
|
|
nil, // left
|
|
|
|
|
nil, // right
|
|
|
|
|
container.NewPadded(scrollContainer), // center
|
|
|
|
|
nil, // left
|
|
|
|
|
nil, // right
|
|
|
|
|
container.NewPadded(scrollContainer), // center
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
windowSize := currentWindow.Content().Size()
|
|
|
|
|