first epoch pass
Some checks failed
Build Go/Fyne App for macOS ARM64 / build (pull_request) Has been cancelled

This commit is contained in:
2025-07-20 21:45:38 -07:00
parent 9b04ad7fd0
commit c735a3f90e
27 changed files with 216 additions and 402 deletions

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"fmt"
"git.burkey.co/eburk/epochcli/pkg/epoch"
"io"
"log"
"os"
@@ -12,20 +13,18 @@ import (
"regexp"
"strings"
"turtlesilicon/pkg/debug"
"turtlesilicon/pkg/paths" // Corrected import path
"turtlesilicon/pkg/utils" // Corrected import path
"epochsilicon/pkg/debug"
"epochsilicon/pkg/paths" // Corrected import path
"epochsilicon/pkg/utils" // Corrected import path
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/dialog"
)
func PatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
// TODO: patch vanilla 3.3.5 to epoch
log.Fatal("FIXME")
debug.Println("Patch TurtleWoW clicked")
debug.Println("Patch Epoch clicked")
if paths.EpochPath == "" {
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
dialog.ShowError(fmt.Errorf("Epoch path not set. Please set it first."), myWindow)
return
}
@@ -156,12 +155,6 @@ func PatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
winerosettaEntry := "winerosetta.dll"
needsWinerosettaUpdate := true
// Check user's preference for libSiliconPatch and shadowLOD
prefs, _ := utils.LoadPrefs()
// Save updated preferences
utils.SavePrefs(prefs)
if fileContentBytes, err := os.ReadFile(dllsTextFile); err == nil {
fileContent := string(fileContentBytes)
if strings.Contains(fileContent, winerosettaEntry) {
@@ -207,8 +200,18 @@ func PatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
}
}
debug.Println("TurtleWoW patching with bundled resources completed successfully.")
dialog.ShowInformation("Success", "TurtleWoW patching process completed using bundled resources.", myWindow)
debug.Println("Downloading updates from Project Epoch servers.")
stats, err := epoch.Update(paths.EpochPath, true, true, false)
if err != nil {
errMsg := fmt.Sprintf("failed to update Epoch files: %v", err)
dialog.ShowError(errors.New(errMsg), myWindow)
log.Println(errMsg)
}
log.Printf("Successfully updated %d Epoch files", stats.Updated)
debug.Println("Epoch patching with bundled resources completed successfully.")
dialog.ShowInformation("Success", "Epoch patching process completed.", myWindow)
updateAllStatuses()
}
@@ -234,7 +237,7 @@ func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
if err := utils.CopyFile(wineloaderOrig, wineloaderCopy); err != nil {
errMsg := fmt.Sprintf("failed to copy wineloader: %v", err)
if strings.Contains(err.Error(), "operation not permitted") {
errMsg += "\n\nSolution: Open System Settings, go to Privacy & Security > App Management, and enable TurtleSilicon."
errMsg += "\n\nSolution: Open System Settings, go to Privacy & Security > App Management, and enable EpochSilicon."
}
dialog.ShowError(fmt.Errorf(errMsg), myWindow)
paths.PatchesAppliedCrossOver = false
@@ -275,18 +278,15 @@ func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
}
func UnpatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
// TODO: unpatch epoch
log.Fatal("fixme")
debug.Println("Unpatch TurtleWoW clicked")
debug.Println("Unpatch Epoch clicked")
if paths.EpochPath == "" {
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
dialog.ShowError(fmt.Errorf("Epoch path not set. Please set it first."), myWindow)
return
}
// Files to remove
winerosettaDllPath := filepath.Join(paths.EpochPath, "winerosetta.dll")
d3d9DllPath := filepath.Join(paths.EpochPath, "d3d9.dll")
libSiliconPatchDllPath := filepath.Join(paths.EpochPath, "libSiliconPatch.dll")
rosettaX87DirPath := filepath.Join(paths.EpochPath, "rosettax87")
dllsTextFile := filepath.Join(paths.EpochPath, "dlls.txt")
@@ -303,7 +303,7 @@ func UnpatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
}
// Remove DLL files
filesToRemove := []string{winerosettaDllPath, d3d9DllPath, libSiliconPatchDllPath}
filesToRemove := []string{winerosettaDllPath, d3d9DllPath}
for _, file := range filesToRemove {
if utils.PathExists(file) {
debug.Printf("Removing file: %s", file)
@@ -317,7 +317,7 @@ func UnpatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
}
}
// Update dlls.txt file - remove winerosetta.dll and libSiliconPatch.dll entries
// Update dlls.txt file - remove winerosetta.dll
if utils.PathExists(dllsTextFile) {
debug.Printf("Updating dlls.txt file: %s", dllsTextFile)
content, err := os.ReadFile(dllsTextFile)
@@ -331,7 +331,7 @@ func UnpatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
for _, line := range lines {
trimmedLine := strings.TrimSpace(line)
if trimmedLine != "winerosetta.dll" && trimmedLine != "libSiliconPatch.dll" {
if trimmedLine != "winerosetta.dll" {
filteredLines = append(filteredLines, line)
}
}
@@ -347,9 +347,9 @@ func UnpatchEpoch(myWindow fyne.Window, updateAllStatuses func()) {
}
}
debug.Println("TurtleWoW unpatching completed successfully.")
debug.Println("Epoch unpatching completed successfully.")
paths.PatchesAppliedEpoch = false
dialog.ShowInformation("Success", "TurtleWoW unpatching process completed.", myWindow)
dialog.ShowInformation("Success", "Epoch unpatching process completed.", myWindow)
updateAllStatuses()
}