build optimizations and preperation for 1.2.0 release
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
Icon = "Icon.png"
|
||||
Name = "TurtleSilicon"
|
||||
ID = "com.tairasu.turtlesilicon"
|
||||
Version = "1.1.2"
|
||||
Build = 26
|
||||
Version = "1.2.0"
|
||||
Build = 33
|
||||
|
40
Makefile
40
Makefile
@@ -1,10 +1,10 @@
|
||||
.PHONY: build clean
|
||||
.PHONY: build clean build-dev build-release
|
||||
|
||||
# Default target
|
||||
all: build
|
||||
# Default target - optimized release build
|
||||
all: build-release
|
||||
|
||||
# Build the application with custom resource copying
|
||||
build:
|
||||
# Development build (larger, with debug symbols)
|
||||
build-dev:
|
||||
GOOS=darwin GOARCH=arm64 fyne package
|
||||
@echo "Copying additional resources to app bundle..."
|
||||
@mkdir -p TurtleSilicon.app/Contents/Resources/rosettax87
|
||||
@@ -12,15 +12,37 @@ build:
|
||||
@cp -R rosettax87/* TurtleSilicon.app/Contents/Resources/rosettax87/
|
||||
@cp -R winerosetta/* TurtleSilicon.app/Contents/Resources/winerosetta/
|
||||
@cp -R Icon.png TurtleSilicon.app/Contents/Resources/
|
||||
@echo "Build complete!"
|
||||
@echo "Development build complete!"
|
||||
|
||||
build: build-dev
|
||||
|
||||
build-release:
|
||||
@echo "Building optimized release version..."
|
||||
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build \
|
||||
-ldflags="-s -w -X main.appVersion=$$(grep Version FyneApp.toml | cut -d'"' -f2)" \
|
||||
-trimpath \
|
||||
-tags=release \
|
||||
-o turtlesilicon .
|
||||
@echo "Packaging with fyne..."
|
||||
GOOS=darwin GOARCH=arm64 fyne package --release --executable turtlesilicon
|
||||
@echo "Copying additional resources to app bundle..."
|
||||
@mkdir -p TurtleSilicon.app/Contents/Resources/rosettax87
|
||||
@mkdir -p TurtleSilicon.app/Contents/Resources/winerosetta
|
||||
@cp -R rosettax87/* TurtleSilicon.app/Contents/Resources/rosettax87/
|
||||
@cp -R winerosetta/* TurtleSilicon.app/Contents/Resources/winerosetta/
|
||||
@cp -R Icon.png TurtleSilicon.app/Contents/Resources/
|
||||
@echo "Stripping additional symbols..."
|
||||
strip -x TurtleSilicon.app/Contents/MacOS/turtlesilicon
|
||||
@echo "Optimized release build complete!"
|
||||
@echo "Binary size: $$(ls -lah TurtleSilicon.app/Contents/MacOS/turtlesilicon | awk '{print $$5}')"
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -rf TurtleSilicon.app
|
||||
rm -f TurtleSilicon.dmg
|
||||
rm -f turtlesilicon
|
||||
|
||||
# Build DMG without code signing
|
||||
dmg: build
|
||||
dmg: build-release
|
||||
@echo "Creating DMG file..."
|
||||
@hdiutil create -volname TurtleSilicon -srcfolder TurtleSilicon.app -ov -format UDZO TurtleSilicon.dmg
|
||||
@echo "DMG created: TurtleSilicon.dmg"
|
||||
@echo "DMG created: TurtleSilicon.dmg"
|
10
main.go
10
main.go
@@ -1,11 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/service"
|
||||
"turtlesilicon/pkg/ui"
|
||||
"turtlesilicon/pkg/utils"
|
||||
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
const appVersion = "1.1.2"
|
||||
const appVersion = "1.2.0"
|
||||
|
||||
func main() {
|
||||
TSApp := app.NewWithID("com.tairasu.turtlesilicon")
|
||||
@@ -27,9 +27,9 @@ func main() {
|
||||
go func() {
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
latest, notes, update, err := utils.CheckForUpdate(appVersion)
|
||||
log.Printf("DEBUG RAW: latest=%q", latest)
|
||||
debug.Printf("DEBUG RAW: latest=%q", latest)
|
||||
latestVersion := strings.TrimLeft(latest, "v.")
|
||||
log.Printf("DEBUG: appVersion=%q, latest=%q, latestVersion=%q, suppressed=%q, update=%v, err=%v\n",
|
||||
debug.Printf("DEBUG: appVersion=%q, latest=%q, latestVersion=%q, suppressed=%q, update=%v, err=%v\n",
|
||||
appVersion, latest, latestVersion, prefs.SuppressedUpdateVersion, update, err)
|
||||
// Always skip popup if versions match
|
||||
if latestVersion == appVersion {
|
||||
@@ -56,7 +56,7 @@ func main() {
|
||||
|
||||
// Set up cleanup when window closes
|
||||
TSWindow.SetCloseIntercept(func() {
|
||||
log.Println("Application closing, cleaning up RosettaX87 service...")
|
||||
debug.Println("Application closing, cleaning up RosettaX87 service...")
|
||||
service.CleanupService()
|
||||
TSApp.Quit()
|
||||
})
|
||||
|
15
pkg/debug/debug.go
Normal file
15
pkg/debug/debug.go
Normal file
@@ -0,0 +1,15 @@
|
||||
//go:build !release
|
||||
|
||||
package debug
|
||||
|
||||
import "log"
|
||||
|
||||
// Printf logs with fmt.Printf style formatting in debug builds
|
||||
func Printf(format string, v ...interface{}) {
|
||||
log.Printf(format, v...)
|
||||
}
|
||||
|
||||
// Println logs with fmt.Println style in debug builds
|
||||
func Println(v ...interface{}) {
|
||||
log.Println(v...)
|
||||
}
|
13
pkg/debug/debug_release.go
Normal file
13
pkg/debug/debug_release.go
Normal file
@@ -0,0 +1,13 @@
|
||||
//go:build release
|
||||
|
||||
package debug
|
||||
|
||||
// Printf is a no-op in release builds
|
||||
func Printf(format string, v ...interface{}) {
|
||||
// No-op in release builds to reduce binary size
|
||||
}
|
||||
|
||||
// Println is a no-op in release builds
|
||||
func Println(v ...interface{}) {
|
||||
// No-op in release builds to reduce binary size
|
||||
}
|
@@ -3,12 +3,12 @@ package launcher
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/paths" // Corrected import path
|
||||
"turtlesilicon/pkg/utils" // Corrected import path
|
||||
|
||||
@@ -40,7 +40,7 @@ func runGameIntegrated(parentWindow fyne.Window, shellCmd string) error {
|
||||
|
||||
// Parse the shell command to extract components
|
||||
// The shellCmd format is: cd <path> && <envVars> <rosettaExec> <wineloader> <wowExe>
|
||||
log.Printf("Parsing shell command: %s", shellCmd)
|
||||
debug.Printf("Parsing shell command: %s", shellCmd)
|
||||
|
||||
// Create the command without context cancellation
|
||||
cmd := exec.Command("sh", "-c", shellCmd)
|
||||
@@ -70,7 +70,7 @@ func runGameIntegrated(parentWindow fyne.Window, shellCmd string) error {
|
||||
scanner := bufio.NewScanner(stdout)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
log.Printf("GAME STDOUT: %s", line)
|
||||
debug.Printf("GAME STDOUT: %s", line)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -78,7 +78,7 @@ func runGameIntegrated(parentWindow fyne.Window, shellCmd string) error {
|
||||
scanner := bufio.NewScanner(stderr)
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
log.Printf("GAME STDERR: %s", line)
|
||||
debug.Printf("GAME STDERR: %s", line)
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -92,9 +92,9 @@ func runGameIntegrated(parentWindow fyne.Window, shellCmd string) error {
|
||||
}()
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
log.Printf("Game process ended with error: %v", err)
|
||||
debug.Printf("Game process ended with error: %v", err)
|
||||
} else {
|
||||
log.Println("Game process ended successfully")
|
||||
debug.Println("Game process ended successfully")
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -102,7 +102,7 @@ func runGameIntegrated(parentWindow fyne.Window, shellCmd string) error {
|
||||
}
|
||||
|
||||
func LaunchGame(myWindow fyne.Window) {
|
||||
log.Println("Launch Game button clicked")
|
||||
debug.Println("Launch Game button clicked")
|
||||
|
||||
if paths.CrossoverPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("CrossOver path not set. Please set it in the patcher."), myWindow)
|
||||
@@ -131,7 +131,7 @@ func LaunchGame(myWindow fyne.Window) {
|
||||
}
|
||||
gameMutex.Unlock()
|
||||
|
||||
log.Println("Preparing to launch TurtleSilicon...")
|
||||
debug.Println("Preparing to launch TurtleSilicon...")
|
||||
|
||||
// Determine which WoW executable to use based on vanilla-tweaks preference
|
||||
var wowExePath string
|
||||
@@ -178,7 +178,7 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
||||
}
|
||||
|
||||
// Since RosettaX87 service is already running, we can directly launch WoW
|
||||
log.Println("RosettaX87 service is running. Proceeding to launch WoW.")
|
||||
debug.Println("RosettaX87 service is running. Proceeding to launch WoW.")
|
||||
|
||||
if paths.CrossoverPath == "" || paths.TurtlewowPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("CrossOver path or TurtleWoW path is not set. Cannot launch WoW."), myWindow)
|
||||
@@ -211,21 +211,21 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
||||
escapedShellCmd := utils.EscapeStringForAppleScript(shellCmd)
|
||||
cmd2Script := fmt.Sprintf("tell application \"Terminal\" to do script \"%s\"", escapedShellCmd)
|
||||
|
||||
log.Println("Executing WoW launch command via AppleScript...")
|
||||
debug.Println("Executing WoW launch command via AppleScript...")
|
||||
if !utils.RunOsascript(cmd2Script, myWindow) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Launch command executed. Check the new terminal window.")
|
||||
debug.Println("Launch command executed. Check the new terminal window.")
|
||||
} else {
|
||||
// Use integrated terminal
|
||||
log.Printf("Shell command for integrated terminal: %s", shellCmd)
|
||||
log.Println("Executing WoW launch command with integrated terminal...")
|
||||
debug.Printf("Shell command for integrated terminal: %s", shellCmd)
|
||||
debug.Println("Executing WoW launch command with integrated terminal...")
|
||||
if err := runGameIntegrated(myWindow, shellCmd); err != nil {
|
||||
dialog.ShowError(fmt.Errorf("failed to launch game: %v", err), myWindow)
|
||||
return
|
||||
}
|
||||
log.Println("Game launched with integrated terminal. Check the application logs for output.")
|
||||
debug.Println("Game launched with integrated terminal. Check the application logs for output.")
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2,11 +2,11 @@ package launcher
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/paths"
|
||||
"turtlesilicon/pkg/utils"
|
||||
|
||||
@@ -55,7 +55,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||
tempVanillaTweaksPath := filepath.Join(paths.TurtlewowPath, "vanilla-tweaks.exe")
|
||||
|
||||
// Copy vanilla-tweaks.exe to TurtleWoW directory
|
||||
log.Printf("Copying vanilla-tweaks.exe from %s to %s", vanillaTweaksPath, tempVanillaTweaksPath)
|
||||
debug.Printf("Copying vanilla-tweaks.exe from %s to %s", vanillaTweaksPath, tempVanillaTweaksPath)
|
||||
sourceFile, err := os.Open(vanillaTweaksPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open vanilla-tweaks.exe: %v", err)
|
||||
@@ -75,7 +75,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||
|
||||
// Ensure the copied file is executable
|
||||
if err := os.Chmod(tempVanillaTweaksPath, 0755); err != nil {
|
||||
log.Printf("Warning: failed to set executable permission on vanilla-tweaks.exe: %v", err)
|
||||
debug.Printf("Warning: failed to set executable permission on vanilla-tweaks.exe: %v", err)
|
||||
}
|
||||
|
||||
// Build the command to apply vanilla-tweaks using the correct format:
|
||||
@@ -84,17 +84,17 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||
utils.QuotePathForShell(paths.TurtlewowPath),
|
||||
utils.QuotePathForShell(wineloader2Path))
|
||||
|
||||
log.Printf("Applying vanilla-tweaks with command: %s", shellCmd)
|
||||
debug.Printf("Applying vanilla-tweaks with command: %s", shellCmd)
|
||||
|
||||
// Execute the command
|
||||
cmd := exec.Command("sh", "-c", shellCmd)
|
||||
output, err := cmd.CombinedOutput()
|
||||
|
||||
log.Printf("vanilla-tweaks command output: %s", string(output))
|
||||
debug.Printf("vanilla-tweaks command output: %s", string(output))
|
||||
|
||||
// Clean up the temporary vanilla-tweaks.exe file
|
||||
if cleanupErr := os.Remove(tempVanillaTweaksPath); cleanupErr != nil {
|
||||
log.Printf("Warning: failed to clean up temporary vanilla-tweaks.exe: %v", cleanupErr)
|
||||
debug.Printf("Warning: failed to clean up temporary vanilla-tweaks.exe: %v", cleanupErr)
|
||||
}
|
||||
|
||||
// Always check if the output file was created, regardless of exit code
|
||||
@@ -103,7 +103,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||
if foundPath == "" {
|
||||
// Only report error if no output file was created
|
||||
if err != nil {
|
||||
log.Printf("vanilla-tweaks command failed: %v", err)
|
||||
debug.Printf("vanilla-tweaks command failed: %v", err)
|
||||
return fmt.Errorf("failed to apply vanilla-tweaks: %v\nOutput: %s", err, string(output))
|
||||
} else {
|
||||
return fmt.Errorf("vanilla-tweaks completed but WoW-tweaked.exe was not created\nOutput: %s", string(output))
|
||||
@@ -112,10 +112,10 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||
|
||||
// If we found the file but there was an error code, log it as a warning
|
||||
if err != nil {
|
||||
log.Printf("vanilla-tweaks reported error but output file was created: %v", err)
|
||||
debug.Printf("vanilla-tweaks reported error but output file was created: %v", err)
|
||||
}
|
||||
|
||||
log.Println("vanilla-tweaks applied successfully")
|
||||
debug.Println("vanilla-tweaks applied successfully")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -5,12 +5,12 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/paths" // Corrected import path
|
||||
"turtlesilicon/pkg/utils" // Corrected import path
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
log.Println("Patch TurtleWoW clicked")
|
||||
debug.Println("Patch TurtleWoW clicked")
|
||||
if paths.TurtlewowPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
||||
return
|
||||
@@ -37,25 +37,25 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
}
|
||||
|
||||
for resourceName, destPath := range filesToCopy {
|
||||
log.Printf("Processing resource: %s to %s", resourceName, destPath)
|
||||
debug.Printf("Processing resource: %s to %s", resourceName, destPath)
|
||||
|
||||
// Check if file already exists and has correct size
|
||||
if utils.PathExists(destPath) && utils.CompareFileWithBundledResource(destPath, resourceName) {
|
||||
log.Printf("File %s already exists with correct size, skipping copy", destPath)
|
||||
debug.Printf("File %s already exists with correct size, skipping copy", destPath)
|
||||
continue
|
||||
}
|
||||
|
||||
if utils.PathExists(destPath) {
|
||||
log.Printf("File %s exists but has incorrect size, updating...", destPath)
|
||||
debug.Printf("File %s exists but has incorrect size, updating...", destPath)
|
||||
} else {
|
||||
log.Printf("File %s does not exist, creating...", destPath)
|
||||
debug.Printf("File %s does not exist, creating...", destPath)
|
||||
}
|
||||
|
||||
resource, err := fyne.LoadResourceFromPath(resourceName)
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -65,7 +65,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -76,22 +76,22 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
}
|
||||
log.Printf("Successfully copied %s to %s", resourceName, destPath)
|
||||
debug.Printf("Successfully copied %s to %s", resourceName, destPath)
|
||||
}
|
||||
|
||||
log.Printf("Preparing rosettax87 directory at: %s", targetRosettaX87Dir)
|
||||
debug.Printf("Preparing rosettax87 directory at: %s", targetRosettaX87Dir)
|
||||
if err := os.RemoveAll(targetRosettaX87Dir); err != nil {
|
||||
log.Printf("Warning: could not remove existing rosettax87 folder '%s': %v", targetRosettaX87Dir, err)
|
||||
debug.Printf("Warning: could not remove existing rosettax87 folder '%s': %v", targetRosettaX87Dir, err)
|
||||
}
|
||||
if err := os.MkdirAll(targetRosettaX87Dir, 0755); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to create directory %s: %v", targetRosettaX87Dir, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -103,12 +103,12 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
}
|
||||
|
||||
for resourceName, destPath := range rosettaFilesToCopy {
|
||||
log.Printf("Processing rosetta resource: %s to %s", resourceName, destPath)
|
||||
debug.Printf("Processing rosetta resource: %s to %s", resourceName, destPath)
|
||||
resource, err := fyne.LoadResourceFromPath(resourceName)
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -118,7 +118,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -129,7 +129,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
destinationFile.Close()
|
||||
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
@@ -137,20 +137,20 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
destinationFile.Close()
|
||||
|
||||
if filepath.Base(destPath) == "rosettax87" {
|
||||
log.Printf("Setting execute permission for %s", destPath)
|
||||
debug.Printf("Setting execute permission for %s", destPath)
|
||||
if err := os.Chmod(destPath, 0755); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to set execute permission for %s: %v", destPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
}
|
||||
}
|
||||
log.Printf("Successfully copied %s to %s", resourceName, destPath)
|
||||
debug.Printf("Successfully copied %s to %s", resourceName, destPath)
|
||||
}
|
||||
|
||||
log.Printf("Checking dlls.txt file at: %s", dllsTextFile)
|
||||
debug.Printf("Checking dlls.txt file at: %s", dllsTextFile)
|
||||
winerosettaEntry := "winerosetta.dll"
|
||||
libSiliconPatchEntry := "libSiliconPatch.dll"
|
||||
needsWinerosettaUpdate := true
|
||||
@@ -159,15 +159,15 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if fileContentBytes, err := os.ReadFile(dllsTextFile); err == nil {
|
||||
fileContent := string(fileContentBytes)
|
||||
if strings.Contains(fileContent, winerosettaEntry) {
|
||||
log.Printf("dlls.txt already contains %s", winerosettaEntry)
|
||||
debug.Printf("dlls.txt already contains %s", winerosettaEntry)
|
||||
needsWinerosettaUpdate = false
|
||||
}
|
||||
if strings.Contains(fileContent, libSiliconPatchEntry) {
|
||||
log.Printf("dlls.txt already contains %s", libSiliconPatchEntry)
|
||||
debug.Printf("dlls.txt already contains %s", libSiliconPatchEntry)
|
||||
needsLibSiliconPatchUpdate = false
|
||||
}
|
||||
} else {
|
||||
log.Printf("dlls.txt not found, will create a new one with both entries")
|
||||
debug.Printf("dlls.txt not found, will create a new one with both entries")
|
||||
}
|
||||
|
||||
if needsWinerosettaUpdate || needsLibSiliconPatchUpdate {
|
||||
@@ -178,7 +178,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to read dlls.txt for update: %v", err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,32 +192,32 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if needsWinerosettaUpdate {
|
||||
if !strings.Contains(updatedContent, winerosettaEntry+"\n") {
|
||||
updatedContent += winerosettaEntry + "\n"
|
||||
log.Printf("Adding %s to dlls.txt", winerosettaEntry)
|
||||
debug.Printf("Adding %s to dlls.txt", winerosettaEntry)
|
||||
}
|
||||
}
|
||||
if needsLibSiliconPatchUpdate {
|
||||
if !strings.Contains(updatedContent, libSiliconPatchEntry+"\n") {
|
||||
updatedContent += libSiliconPatchEntry + "\n"
|
||||
log.Printf("Adding %s to dlls.txt", libSiliconPatchEntry)
|
||||
debug.Printf("Adding %s to dlls.txt", libSiliconPatchEntry)
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.WriteFile(dllsTextFile, []byte(updatedContent), 0644); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to update dlls.txt: %v", err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
} else {
|
||||
log.Printf("Successfully updated dlls.txt")
|
||||
debug.Printf("Successfully updated dlls.txt")
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("TurtleWoW patching with bundled resources completed successfully.")
|
||||
debug.Println("TurtleWoW patching with bundled resources completed successfully.")
|
||||
dialog.ShowInformation("Success", "TurtleWoW patching process completed using bundled resources.", myWindow)
|
||||
updateAllStatuses()
|
||||
}
|
||||
|
||||
func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
log.Println("Patch CrossOver clicked")
|
||||
debug.Println("Patch CrossOver clicked")
|
||||
if paths.CrossoverPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("CrossOver path not set. Please set it first."), myWindow)
|
||||
return
|
||||
@@ -234,7 +234,7 @@ func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Copying %s to %s", wineloaderOrig, wineloaderCopy)
|
||||
debug.Printf("Copying %s to %s", wineloaderOrig, wineloaderCopy)
|
||||
if err := utils.CopyFile(wineloaderOrig, wineloaderCopy); err != nil {
|
||||
dialog.ShowError(fmt.Errorf("failed to copy wineloader: %w", err), myWindow)
|
||||
paths.PatchesAppliedCrossOver = false
|
||||
@@ -242,40 +242,40 @@ func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Executing: codesign --remove-signature %s", wineloaderCopy)
|
||||
debug.Printf("Executing: codesign --remove-signature %s", wineloaderCopy)
|
||||
cmd := exec.Command("codesign", "--remove-signature", wineloaderCopy)
|
||||
combinedOutput, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
derrMsg := fmt.Sprintf("failed to remove signature from %s: %v\nOutput: %s", wineloaderCopy, err, string(combinedOutput))
|
||||
dialog.ShowError(errors.New(derrMsg), myWindow)
|
||||
log.Println(derrMsg)
|
||||
debug.Println(derrMsg)
|
||||
paths.PatchesAppliedCrossOver = false
|
||||
if err := os.Remove(wineloaderCopy); err != nil {
|
||||
log.Printf("Warning: failed to cleanup wineloader2 after codesign failure: %v", err)
|
||||
debug.Printf("Warning: failed to cleanup wineloader2 after codesign failure: %v", err)
|
||||
}
|
||||
updateAllStatuses()
|
||||
return
|
||||
}
|
||||
log.Printf("codesign output: %s", string(combinedOutput))
|
||||
debug.Printf("codesign output: %s", string(combinedOutput))
|
||||
|
||||
log.Printf("Setting execute permissions for %s", wineloaderCopy)
|
||||
debug.Printf("Setting execute permissions for %s", wineloaderCopy)
|
||||
if err := os.Chmod(wineloaderCopy, 0755); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to set executable permissions for %s: %v", wineloaderCopy, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
paths.PatchesAppliedCrossOver = false
|
||||
updateAllStatuses()
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("CrossOver patching completed successfully.")
|
||||
debug.Println("CrossOver patching completed successfully.")
|
||||
paths.PatchesAppliedCrossOver = true
|
||||
dialog.ShowInformation("Success", "CrossOver patching process completed.", myWindow)
|
||||
updateAllStatuses()
|
||||
}
|
||||
|
||||
func UnpatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
log.Println("Unpatch TurtleWoW clicked")
|
||||
debug.Println("Unpatch TurtleWoW clicked")
|
||||
if paths.TurtlewowPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
||||
return
|
||||
@@ -290,13 +290,13 @@ func UnpatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
|
||||
// Remove the rosettaX87 directory
|
||||
if utils.DirExists(rosettaX87DirPath) {
|
||||
log.Printf("Removing directory: %s", rosettaX87DirPath)
|
||||
debug.Printf("Removing directory: %s", rosettaX87DirPath)
|
||||
if err := os.RemoveAll(rosettaX87DirPath); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to remove directory %s: %v", rosettaX87DirPath, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
} else {
|
||||
log.Printf("Successfully removed directory: %s", rosettaX87DirPath)
|
||||
debug.Printf("Successfully removed directory: %s", rosettaX87DirPath)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,25 +304,25 @@ func UnpatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
filesToRemove := []string{winerosettaDllPath, d3d9DllPath, libSiliconPatchDllPath}
|
||||
for _, file := range filesToRemove {
|
||||
if utils.PathExists(file) {
|
||||
log.Printf("Removing file: %s", file)
|
||||
debug.Printf("Removing file: %s", file)
|
||||
if err := os.Remove(file); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to remove file %s: %v", file, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
} else {
|
||||
log.Printf("Successfully removed file: %s", file)
|
||||
debug.Printf("Successfully removed file: %s", file)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update dlls.txt file - remove winerosetta.dll and libSiliconPatch.dll entries
|
||||
if utils.PathExists(dllsTextFile) {
|
||||
log.Printf("Updating dlls.txt file: %s", dllsTextFile)
|
||||
debug.Printf("Updating dlls.txt file: %s", dllsTextFile)
|
||||
content, err := os.ReadFile(dllsTextFile)
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("failed to read dlls.txt file: %v", err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
} else {
|
||||
lines := strings.Split(string(content), "\n")
|
||||
filteredLines := make([]string, 0, len(lines))
|
||||
@@ -338,21 +338,21 @@ func UnpatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
if err := os.WriteFile(dllsTextFile, []byte(updatedContent), 0644); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to update dlls.txt file: %v", err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
} else {
|
||||
log.Printf("Successfully updated dlls.txt file")
|
||||
debug.Printf("Successfully updated dlls.txt file")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("TurtleWoW unpatching completed successfully.")
|
||||
debug.Println("TurtleWoW unpatching completed successfully.")
|
||||
paths.PatchesAppliedTurtleWoW = false
|
||||
dialog.ShowInformation("Success", "TurtleWoW unpatching process completed.", myWindow)
|
||||
updateAllStatuses()
|
||||
}
|
||||
|
||||
func UnpatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
log.Println("Unpatch CrossOver clicked")
|
||||
debug.Println("Unpatch CrossOver clicked")
|
||||
if paths.CrossoverPath == "" {
|
||||
dialog.ShowError(fmt.Errorf("CrossOver path not set. Please set it first."), myWindow)
|
||||
return
|
||||
@@ -361,21 +361,21 @@ func UnpatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
||||
wineloaderCopy := filepath.Join(paths.CrossoverPath, "Contents", "SharedSupport", "CrossOver", "CrossOver-Hosted Application", "wineloader2")
|
||||
|
||||
if utils.PathExists(wineloaderCopy) {
|
||||
log.Printf("Removing file: %s", wineloaderCopy)
|
||||
debug.Printf("Removing file: %s", wineloaderCopy)
|
||||
if err := os.Remove(wineloaderCopy); err != nil {
|
||||
errMsg := fmt.Sprintf("failed to remove file %s: %v", wineloaderCopy, err)
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
updateAllStatuses()
|
||||
return
|
||||
} else {
|
||||
log.Printf("Successfully removed file: %s", wineloaderCopy)
|
||||
debug.Printf("Successfully removed file: %s", wineloaderCopy)
|
||||
}
|
||||
} else {
|
||||
log.Printf("File not found to remove: %s", wineloaderCopy)
|
||||
debug.Printf("File not found to remove: %s", wineloaderCopy)
|
||||
}
|
||||
|
||||
log.Println("CrossOver unpatching completed successfully.")
|
||||
debug.Println("CrossOver unpatching completed successfully.")
|
||||
paths.PatchesAppliedCrossOver = false
|
||||
dialog.ShowInformation("Success", "CrossOver unpatching process completed.", myWindow)
|
||||
updateAllStatuses()
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/launcher"
|
||||
"turtlesilicon/pkg/patching"
|
||||
"turtlesilicon/pkg/service"
|
||||
@@ -23,7 +23,7 @@ func createOptionsComponents() {
|
||||
|
||||
metalHudCheckbox = widget.NewCheck("Enable Metal Hud (show FPS)", func(checked bool) {
|
||||
launcher.EnableMetalHud = checked
|
||||
log.Printf("Metal HUD enabled: %v", launcher.EnableMetalHud)
|
||||
debug.Printf("Metal HUD enabled: %v", launcher.EnableMetalHud)
|
||||
})
|
||||
metalHudCheckbox.SetChecked(launcher.EnableMetalHud)
|
||||
|
||||
@@ -32,7 +32,7 @@ func createOptionsComponents() {
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.ShowTerminalNormally = checked
|
||||
utils.SavePrefs(prefs)
|
||||
log.Printf("Show terminal normally: %v", checked)
|
||||
debug.Printf("Show terminal normally: %v", checked)
|
||||
})
|
||||
showTerminalCheckbox.SetChecked(prefs.ShowTerminalNormally)
|
||||
|
||||
@@ -42,7 +42,7 @@ func createOptionsComponents() {
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.EnableVanillaTweaks = checked
|
||||
utils.SavePrefs(prefs)
|
||||
log.Printf("Vanilla-tweaks enabled: %v", launcher.EnableVanillaTweaks)
|
||||
debug.Printf("Vanilla-tweaks enabled: %v", launcher.EnableVanillaTweaks)
|
||||
})
|
||||
vanillaTweaksCheckbox.SetChecked(prefs.EnableVanillaTweaks)
|
||||
launcher.EnableVanillaTweaks = prefs.EnableVanillaTweaks
|
||||
@@ -64,7 +64,7 @@ func createOptionsComponents() {
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.EnvironmentVariables = text
|
||||
utils.SavePrefs(prefs)
|
||||
log.Printf("Environment variables updated: %v", launcher.CustomEnvVars)
|
||||
debug.Printf("Environment variables updated: %v", launcher.CustomEnvVars)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ func createBottomBar(myWindow fyne.Window) fyne.CanvasObject {
|
||||
githubURL := "https://github.com/tairasu/TurtleSilicon"
|
||||
parsedURL, err := url.Parse(githubURL)
|
||||
if err != nil {
|
||||
log.Printf("Error parsing GitHub URL: %v", err)
|
||||
debug.Printf("Error parsing GitHub URL: %v", err)
|
||||
return
|
||||
}
|
||||
fyne.CurrentApp().OpenURL(parsedURL)
|
||||
@@ -183,7 +183,7 @@ func createWineRegistryComponents() {
|
||||
// Run in goroutine to avoid blocking UI
|
||||
go func() {
|
||||
if err := utils.SetOptionAsAltEnabled(true); err != nil {
|
||||
log.Printf("Failed to enable Option-as-Alt mapping: %v", err)
|
||||
debug.Printf("Failed to enable Option-as-Alt mapping: %v", err)
|
||||
// Update UI on main thread
|
||||
fyne.Do(func() {
|
||||
stopPulsingEffect()
|
||||
@@ -191,7 +191,7 @@ func createWineRegistryComponents() {
|
||||
})
|
||||
time.Sleep(2 * time.Second) // Show error briefly
|
||||
} else {
|
||||
log.Printf("Successfully enabled Option-as-Alt mapping")
|
||||
debug.Printf("Successfully enabled Option-as-Alt mapping")
|
||||
// Update preferences
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.RemapOptionAsAlt = true
|
||||
@@ -220,7 +220,7 @@ func createWineRegistryComponents() {
|
||||
// Run in goroutine to avoid blocking UI
|
||||
go func() {
|
||||
if err := utils.SetOptionAsAltEnabled(false); err != nil {
|
||||
log.Printf("Failed to disable Option-as-Alt mapping: %v", err)
|
||||
debug.Printf("Failed to disable Option-as-Alt mapping: %v", err)
|
||||
// Update UI on main thread
|
||||
fyne.Do(func() {
|
||||
stopPulsingEffect()
|
||||
@@ -228,7 +228,7 @@ func createWineRegistryComponents() {
|
||||
})
|
||||
time.Sleep(2 * time.Second) // Show error briefly
|
||||
} else {
|
||||
log.Printf("Successfully disabled Option-as-Alt mapping")
|
||||
debug.Printf("Successfully disabled Option-as-Alt mapping")
|
||||
// Update preferences
|
||||
prefs, _ := utils.LoadPrefs()
|
||||
prefs.RemapOptionAsAlt = false
|
||||
|
@@ -1,8 +1,7 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
"turtlesilicon/pkg/paths"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@@ -35,7 +34,7 @@ func createLogoContainer() fyne.CanvasObject {
|
||||
// Load the application logo
|
||||
logoResource, err := fyne.LoadResourceFromPath("Icon.png")
|
||||
if err != nil {
|
||||
log.Printf("Warning: could not load logo: %v", err)
|
||||
debug.Printf("Warning: could not load logo: %v", err)
|
||||
}
|
||||
|
||||
// Create the logo image with a smaller fixed size since we have a header now
|
||||
|
@@ -5,13 +5,14 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"turtlesilicon/pkg/debug"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
)
|
||||
@@ -95,16 +96,16 @@ func CopyDir(src string, dst string) error {
|
||||
|
||||
// RunOsascript runs an AppleScript command using osascript.
|
||||
func RunOsascript(scriptString string, myWindow fyne.Window) bool {
|
||||
log.Printf("Executing AppleScript: %s", scriptString)
|
||||
debug.Printf("Executing AppleScript: %s", scriptString)
|
||||
cmd := exec.Command("osascript", "-e", scriptString)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
errMsg := fmt.Sprintf("AppleScript failed: %v\nOutput: %s", err, string(output))
|
||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||
log.Println(errMsg)
|
||||
debug.Println(errMsg)
|
||||
return false
|
||||
}
|
||||
log.Printf("osascript output: %s", string(output))
|
||||
debug.Printf("osascript output: %s", string(output))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -157,7 +158,7 @@ func CompareFileWithBundledResource(filePath, resourcePath string) bool {
|
||||
// Get file size
|
||||
fileInfo, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
log.Printf("Failed to get file info for %s: %v", filePath, err)
|
||||
debug.Printf("Failed to get file info for %s: %v", filePath, err)
|
||||
return false
|
||||
}
|
||||
fileSize := fileInfo.Size()
|
||||
@@ -165,10 +166,10 @@ func CompareFileWithBundledResource(filePath, resourcePath string) bool {
|
||||
// Get bundled resource size
|
||||
resourceSize, err := GetBundledResourceSize(resourcePath)
|
||||
if err != nil {
|
||||
log.Printf("Failed to get bundled resource size for %s: %v", resourcePath, err)
|
||||
debug.Printf("Failed to get bundled resource size for %s: %v", resourcePath, err)
|
||||
return false
|
||||
}
|
||||
|
||||
log.Printf("Comparing file sizes: %s (%d bytes) vs %s (%d bytes)", filePath, fileSize, resourcePath, resourceSize)
|
||||
debug.Printf("Comparing file sizes: %s (%d bytes) vs %s (%d bytes)", filePath, fileSize, resourcePath, resourceSize)
|
||||
return fileSize == resourceSize
|
||||
}
|
||||
|
Reference in New Issue
Block a user