rip out turtle specific options
Some checks failed
Build Go/Fyne App for macOS ARM64 / build (push) Has been cancelled
Some checks failed
Build Go/Fyne App for macOS ARM64 / build (push) Has been cancelled
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,4 +2,5 @@
|
|||||||
TurtleSilicon.*
|
TurtleSilicon.*
|
||||||
TurtleSilicon.app/Contents/MacOS/turtlesilicon
|
TurtleSilicon.app/Contents/MacOS/turtlesilicon
|
||||||
*.dmg
|
*.dmg
|
||||||
turtlesilicon
|
turtlesilicon
|
||||||
|
.idea
|
34
EpochSilicon.app/Contents/Info.plist
Normal file
34
EpochSilicon.app/Contents/Info.plist
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>EpochSilicon</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>turtlesilicon</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.eburk.epochsilicon</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon.icns</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.2.4</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>78</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<true/>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.11</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
BIN
EpochSilicon.app/Contents/Resources/icon.icns
Normal file
BIN
EpochSilicon.app/Contents/Resources/icon.icns
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
[Details]
|
[Details]
|
||||||
Icon = "Icon.png"
|
Icon = "Icon.png"
|
||||||
Name = "TurtleSilicon"
|
Name = "EpochSilicon"
|
||||||
ID = "com.tairasu.turtlesilicon"
|
ID = "com.eburk.epochsilicon"
|
||||||
Version = "1.2.4"
|
Version = "1.2.4"
|
||||||
Build = 78
|
Build = 79
|
||||||
|
39
main.go
39
main.go
@@ -1,26 +1,23 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/app"
|
||||||
"turtlesilicon/pkg/debug"
|
"turtlesilicon/pkg/debug"
|
||||||
"turtlesilicon/pkg/service"
|
"turtlesilicon/pkg/service"
|
||||||
"turtlesilicon/pkg/ui"
|
"turtlesilicon/pkg/ui"
|
||||||
"turtlesilicon/pkg/utils"
|
|
||||||
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
|
||||||
"fyne.io/fyne/v2/app"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const appVersion = "1.2.4"
|
const appVersion = "0.1.0"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
TSApp := app.NewWithID("com.tairasu.turtlesilicon")
|
PEApp := app.NewWithID("com.eburk.epochsilicon")
|
||||||
TSWindow := TSApp.NewWindow("TurtleSilicon v" + appVersion)
|
PEWindow := PEApp.NewWindow("EpochSilicon v" + appVersion)
|
||||||
TSWindow.Resize(fyne.NewSize(650, 500))
|
PEWindow.Resize(fyne.NewSize(650, 500))
|
||||||
TSWindow.SetFixedSize(true)
|
PEWindow.SetFixedSize(true)
|
||||||
|
|
||||||
// Check for updates
|
/* Check for updates
|
||||||
|
// TODO: Fix updating
|
||||||
go func() {
|
go func() {
|
||||||
prefs, _ := utils.LoadPrefs()
|
prefs, _ := utils.LoadPrefs()
|
||||||
updateInfo, updateAvailable, err := utils.CheckForUpdateWithAssets(appVersion)
|
updateInfo, updateAvailable, err := utils.CheckForUpdateWithAssets(appVersion)
|
||||||
@@ -43,19 +40,21 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show enhanced update dialog
|
|
||||||
ui.ShowUpdateDialog(updateInfo, appVersion, TSWindow)
|
|
||||||
}()
|
|
||||||
|
|
||||||
content := ui.CreateUI(TSWindow)
|
// Show enhanced update dialog
|
||||||
TSWindow.SetContent(content)
|
ui.ShowUpdateDialog(updateInfo, appVersion, PEWindow)
|
||||||
|
}()
|
||||||
|
*/
|
||||||
|
|
||||||
|
content := ui.CreateUI(PEWindow)
|
||||||
|
PEWindow.SetContent(content)
|
||||||
|
|
||||||
// Set up cleanup when window closes
|
// Set up cleanup when window closes
|
||||||
TSWindow.SetCloseIntercept(func() {
|
PEWindow.SetCloseIntercept(func() {
|
||||||
debug.Println("Application closing, cleaning up RosettaX87 service...")
|
debug.Println("Application closing, cleaning up RosettaX87 service...")
|
||||||
service.CleanupService()
|
service.CleanupService()
|
||||||
TSApp.Quit()
|
PEApp.Quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
TSWindow.ShowAndRun()
|
PEWindow.ShowAndRun()
|
||||||
}
|
}
|
||||||
|
@@ -109,11 +109,11 @@ func LaunchGame(myWindow fyne.Window) {
|
|||||||
dialog.ShowError(fmt.Errorf("CrossOver path not set. Please set it in the patcher."), myWindow)
|
dialog.ShowError(fmt.Errorf("CrossOver path not set. Please set it in the patcher."), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it in the patcher."), myWindow)
|
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it in the patcher."), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !paths.PatchesAppliedTurtleWoW || !paths.PatchesAppliedCrossOver {
|
if !paths.PatchesAppliedEpoch || !paths.PatchesAppliedCrossOver {
|
||||||
confirmed := false
|
confirmed := false
|
||||||
dialog.ShowConfirm("Warning", "Not all patches confirmed applied. Continue with launch?", func(c bool) {
|
dialog.ShowConfirm("Warning", "Not all patches confirmed applied. Continue with launch?", func(c bool) {
|
||||||
confirmed = c
|
confirmed = c
|
||||||
@@ -152,7 +152,7 @@ func LaunchGame(myWindow fyne.Window) {
|
|||||||
}
|
}
|
||||||
wowExePath = GetWoWTweakedExecutablePath()
|
wowExePath = GetWoWTweakedExecutablePath()
|
||||||
} else {
|
} else {
|
||||||
wowExePath = filepath.Join(paths.TurtlewowPath, "WoW.exe")
|
wowExePath = filepath.Join(paths.EpochPath, "WoW.exe")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue with normal launch process
|
// Continue with normal launch process
|
||||||
@@ -161,7 +161,7 @@ func LaunchGame(myWindow fyne.Window) {
|
|||||||
|
|
||||||
// continueLaunch continues the game launch process with the specified executable
|
// continueLaunch continues the game launch process with the specified executable
|
||||||
func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
||||||
rosettaInTurtlePath := filepath.Join(paths.TurtlewowPath, "rosettax87")
|
rosettaInTurtlePath := filepath.Join(paths.EpochPath, "rosettax87")
|
||||||
rosettaExecutable := filepath.Join(rosettaInTurtlePath, "rosettax87")
|
rosettaExecutable := filepath.Join(rosettaInTurtlePath, "rosettax87")
|
||||||
wineloader2Path := filepath.Join(paths.CrossoverPath, "Contents", "SharedSupport", "CrossOver", "CrossOver-Hosted Application", "wineloader2")
|
wineloader2Path := filepath.Join(paths.CrossoverPath, "Contents", "SharedSupport", "CrossOver", "CrossOver-Hosted Application", "wineloader2")
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
|||||||
|
|
||||||
// Auto-delete WDB directory if enabled
|
// Auto-delete WDB directory if enabled
|
||||||
if AutoDeleteWdb {
|
if AutoDeleteWdb {
|
||||||
wdbPath := filepath.Join(paths.TurtlewowPath, "WDB")
|
wdbPath := filepath.Join(paths.EpochPath, "WDB")
|
||||||
if utils.DirExists(wdbPath) {
|
if utils.DirExists(wdbPath) {
|
||||||
debug.Printf("Auto-deleting WDB directory: %s", wdbPath)
|
debug.Printf("Auto-deleting WDB directory: %s", wdbPath)
|
||||||
if err := os.RemoveAll(wdbPath); err != nil {
|
if err := os.RemoveAll(wdbPath); err != nil {
|
||||||
@@ -197,7 +197,7 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
|||||||
// Since RosettaX87 service is already running, we can directly launch WoW
|
// Since RosettaX87 service is already running, we can directly launch WoW
|
||||||
debug.Println("RosettaX87 service is running. Proceeding to launch WoW.")
|
debug.Println("RosettaX87 service is running. Proceeding to launch WoW.")
|
||||||
|
|
||||||
if paths.CrossoverPath == "" || paths.TurtlewowPath == "" {
|
if paths.CrossoverPath == "" || paths.EpochPath == "" {
|
||||||
dialog.ShowError(fmt.Errorf("CrossOver path or TurtleWoW path is not set. Cannot launch WoW."), myWindow)
|
dialog.ShowError(fmt.Errorf("CrossOver path or TurtleWoW path is not set. Cannot launch WoW."), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ func continueLaunch(myWindow fyne.Window, wowExePath string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shellCmd := fmt.Sprintf(`cd %s && %s %s %s %s`,
|
shellCmd := fmt.Sprintf(`cd %s && %s %s %s %s`,
|
||||||
utils.QuotePathForShell(paths.TurtlewowPath),
|
utils.QuotePathForShell(paths.EpochPath),
|
||||||
envVars,
|
envVars,
|
||||||
utils.QuotePathForShell(rosettaExecutable),
|
utils.QuotePathForShell(rosettaExecutable),
|
||||||
utils.QuotePathForShell(wineloader2Path),
|
utils.QuotePathForShell(wineloader2Path),
|
||||||
|
@@ -24,12 +24,12 @@ var RecommendedSettings = map[string]string{
|
|||||||
// CheckRecommendedSettings reads the Config.wtf file and checks if all recommended settings are applied
|
// CheckRecommendedSettings reads the Config.wtf file and checks if all recommended settings are applied
|
||||||
// Returns true if all settings are correctly applied, false otherwise
|
// Returns true if all settings are correctly applied, false otherwise
|
||||||
func CheckRecommendedSettings() bool {
|
func CheckRecommendedSettings() bool {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
debug.Printf("TurtleWoW path not set, cannot check Config.wtf")
|
debug.Printf("TurtleWoW path not set, cannot check Config.wtf")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
configPath := filepath.Join(paths.EpochPath, "WTF", "Config.wtf")
|
||||||
|
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||||
debug.Printf("Config.wtf not found at %s", configPath)
|
debug.Printf("Config.wtf not found at %s", configPath)
|
||||||
@@ -73,11 +73,11 @@ func isSettingCorrect(configText, setting, expectedValue string) bool {
|
|||||||
|
|
||||||
// ApplyRecommendedSettings applies all recommended graphics settings to Config.wtf
|
// ApplyRecommendedSettings applies all recommended graphics settings to Config.wtf
|
||||||
func ApplyRecommendedSettings() error {
|
func ApplyRecommendedSettings() error {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
return fmt.Errorf("TurtleWoW path not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
configPath := filepath.Join(paths.EpochPath, "WTF", "Config.wtf")
|
||||||
|
|
||||||
// Create WTF directory if it doesn't exist
|
// Create WTF directory if it doesn't exist
|
||||||
wtfDir := filepath.Dir(configPath)
|
wtfDir := filepath.Dir(configPath)
|
||||||
|
@@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
// ApplyVanillaTweaks applies vanilla-tweaks to WoW.exe to create WoW-tweaked.exe
|
// ApplyVanillaTweaks applies vanilla-tweaks to WoW.exe to create WoW-tweaked.exe
|
||||||
func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
return fmt.Errorf("TurtleWoW path not set")
|
||||||
}
|
}
|
||||||
if paths.CrossoverPath == "" {
|
if paths.CrossoverPath == "" {
|
||||||
@@ -41,7 +41,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wowExePath := filepath.Join(paths.TurtlewowPath, "WoW.exe")
|
wowExePath := filepath.Join(paths.EpochPath, "WoW.exe")
|
||||||
wineloader2Path := filepath.Join(paths.CrossoverPath, "Contents", "SharedSupport", "CrossOver", "CrossOver-Hosted Application", "wineloader2")
|
wineloader2Path := filepath.Join(paths.CrossoverPath, "Contents", "SharedSupport", "CrossOver", "CrossOver-Hosted Application", "wineloader2")
|
||||||
|
|
||||||
if !utils.PathExists(wowExePath) {
|
if !utils.PathExists(wowExePath) {
|
||||||
@@ -52,7 +52,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First, copy vanilla-tweaks.exe to the TurtleWoW directory temporarily
|
// First, copy vanilla-tweaks.exe to the TurtleWoW directory temporarily
|
||||||
tempVanillaTweaksPath := filepath.Join(paths.TurtlewowPath, "vanilla-tweaks.exe")
|
tempVanillaTweaksPath := filepath.Join(paths.EpochPath, "vanilla-tweaks.exe")
|
||||||
|
|
||||||
// Copy vanilla-tweaks.exe to TurtleWoW directory
|
// Copy vanilla-tweaks.exe to TurtleWoW directory
|
||||||
debug.Printf("Copying vanilla-tweaks.exe from %s to %s", vanillaTweaksPath, tempVanillaTweaksPath)
|
debug.Printf("Copying vanilla-tweaks.exe from %s to %s", vanillaTweaksPath, tempVanillaTweaksPath)
|
||||||
@@ -81,7 +81,7 @@ func ApplyVanillaTweaks(myWindow fyne.Window) error {
|
|||||||
// Build the command to apply vanilla-tweaks using the correct format:
|
// Build the command to apply vanilla-tweaks using the correct format:
|
||||||
// cd "path" && "wineloader2" ./vanilla-tweaks.exe --no-frilldistance -no-farclip ./WoW.exe
|
// cd "path" && "wineloader2" ./vanilla-tweaks.exe --no-frilldistance -no-farclip ./WoW.exe
|
||||||
shellCmd := fmt.Sprintf(`cd %s && %s ./vanilla-tweaks.exe --no-frilldistance --no-farclip ./WoW.exe`,
|
shellCmd := fmt.Sprintf(`cd %s && %s ./vanilla-tweaks.exe --no-frilldistance --no-farclip ./WoW.exe`,
|
||||||
utils.QuotePathForShell(paths.TurtlewowPath),
|
utils.QuotePathForShell(paths.EpochPath),
|
||||||
utils.QuotePathForShell(wineloader2Path))
|
utils.QuotePathForShell(wineloader2Path))
|
||||||
|
|
||||||
debug.Printf("Applying vanilla-tweaks with command: %s", shellCmd)
|
debug.Printf("Applying vanilla-tweaks with command: %s", shellCmd)
|
||||||
@@ -167,21 +167,21 @@ func GetVanillaTweaksExecutablePath() (string, error) {
|
|||||||
|
|
||||||
// CheckForWoWTweakedExecutable checks if WoW_tweaked.exe exists in the TurtleWoW directory
|
// CheckForWoWTweakedExecutable checks if WoW_tweaked.exe exists in the TurtleWoW directory
|
||||||
func CheckForWoWTweakedExecutable() bool {
|
func CheckForWoWTweakedExecutable() bool {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
testPath := filepath.Join(paths.TurtlewowPath, "WoW_tweaked.exe")
|
testPath := filepath.Join(paths.EpochPath, "WoW_tweaked.exe")
|
||||||
return utils.PathExists(testPath)
|
return utils.PathExists(testPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetWoWTweakedExecutablePath returns the path to the WoW_tweaked.exe file if it exists
|
// GetWoWTweakedExecutablePath returns the path to the WoW_tweaked.exe file if it exists
|
||||||
func GetWoWTweakedExecutablePath() string {
|
func GetWoWTweakedExecutablePath() string {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
testPath := filepath.Join(paths.TurtlewowPath, "WoW_tweaked.exe")
|
testPath := filepath.Join(paths.EpochPath, "WoW_tweaked.exe")
|
||||||
if utils.PathExists(testPath) {
|
if utils.PathExists(testPath) {
|
||||||
return testPath
|
return testPath
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -19,22 +20,22 @@ import (
|
|||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
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 TurtleWoW clicked")
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
targetWinerosettaDll := filepath.Join(paths.TurtlewowPath, "winerosetta.dll")
|
targetWinerosettaDll := filepath.Join(paths.EpochPath, "winerosetta.dll")
|
||||||
targetD3d9Dll := filepath.Join(paths.TurtlewowPath, "d3d9.dll")
|
targetD3d9Dll := filepath.Join(paths.EpochPath, "d3d9.dll")
|
||||||
targetLibSiliconPatchDll := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
targetRosettaX87Dir := filepath.Join(paths.EpochPath, "rosettax87")
|
||||||
targetRosettaX87Dir := filepath.Join(paths.TurtlewowPath, "rosettax87")
|
dllsTextFile := filepath.Join(paths.EpochPath, "dlls.txt")
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
|
||||||
filesToCopy := map[string]string{
|
filesToCopy := map[string]string{
|
||||||
"winerosetta/winerosetta.dll": targetWinerosettaDll,
|
"winerosetta/winerosetta.dll": targetWinerosettaDll,
|
||||||
"winerosetta/d3d9.dll": targetD3d9Dll,
|
"winerosetta/d3d9.dll": targetD3d9Dll,
|
||||||
"winerosetta/libSiliconPatch.dll": targetLibSiliconPatchDll,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for resourceName, destPath := range filesToCopy {
|
for resourceName, destPath := range filesToCopy {
|
||||||
@@ -57,7 +58,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -67,7 +68,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to create directory %s: %v", targetRosettaX87Dir, err)
|
errMsg := fmt.Sprintf("failed to create directory %s: %v", targetRosettaX87Dir, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -110,7 +111,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
errMsg := fmt.Sprintf("failed to open bundled resource %s: %v", resourceName, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -120,7 +121,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
errMsg := fmt.Sprintf("failed to create destination file %s: %v", destPath, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -131,7 +132,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
errMsg := fmt.Sprintf("failed to copy bundled resource %s to %s: %v", resourceName, destPath, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -143,7 +144,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
errMsg := fmt.Sprintf("failed to set execute permission for %s: %v", destPath, err)
|
errMsg := fmt.Sprintf("failed to set execute permission for %s: %v", destPath, err)
|
||||||
dialog.ShowError(errors.New(errMsg), myWindow)
|
dialog.ShowError(errors.New(errMsg), myWindow)
|
||||||
debug.Println(errMsg)
|
debug.Println(errMsg)
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -153,34 +154,11 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
|
|
||||||
debug.Printf("Checking dlls.txt file at: %s", dllsTextFile)
|
debug.Printf("Checking dlls.txt file at: %s", dllsTextFile)
|
||||||
winerosettaEntry := "winerosetta.dll"
|
winerosettaEntry := "winerosetta.dll"
|
||||||
libSiliconPatchEntry := "libSiliconPatch.dll"
|
|
||||||
needsWinerosettaUpdate := true
|
needsWinerosettaUpdate := true
|
||||||
needsLibSiliconPatchUpdate := true
|
|
||||||
|
|
||||||
// Check user's preference for libSiliconPatch and shadowLOD
|
// Check user's preference for libSiliconPatch and shadowLOD
|
||||||
prefs, _ := utils.LoadPrefs()
|
prefs, _ := utils.LoadPrefs()
|
||||||
|
|
||||||
// Enable by default unless user has explicitly disabled them
|
|
||||||
shouldEnableLibSiliconPatch := true
|
|
||||||
shouldEnableShadowLOD := true
|
|
||||||
|
|
||||||
// If user has manually disabled these settings, respect their choice
|
|
||||||
if prefs.UserDisabledLibSiliconPatch {
|
|
||||||
shouldEnableLibSiliconPatch = false
|
|
||||||
debug.Printf("libSiliconPatch disabled by user choice")
|
|
||||||
} else {
|
|
||||||
// Enable by default and update preferences
|
|
||||||
prefs.EnableLibSiliconPatch = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if prefs.UserDisabledShadowLOD {
|
|
||||||
shouldEnableShadowLOD = false
|
|
||||||
debug.Printf("shadowLOD disabled by user choice")
|
|
||||||
} else {
|
|
||||||
// Enable by default and update preferences
|
|
||||||
prefs.SetShadowLOD0 = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save updated preferences
|
// Save updated preferences
|
||||||
utils.SavePrefs(prefs)
|
utils.SavePrefs(prefs)
|
||||||
|
|
||||||
@@ -190,21 +168,11 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
debug.Printf("dlls.txt already contains %s", winerosettaEntry)
|
debug.Printf("dlls.txt already contains %s", winerosettaEntry)
|
||||||
needsWinerosettaUpdate = false
|
needsWinerosettaUpdate = false
|
||||||
}
|
}
|
||||||
if strings.Contains(fileContent, libSiliconPatchEntry) {
|
|
||||||
debug.Printf("dlls.txt already contains %s", libSiliconPatchEntry)
|
|
||||||
needsLibSiliconPatchUpdate = false
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
debug.Printf("dlls.txt not found, will create a new one")
|
debug.Printf("dlls.txt not found, will create a new one")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only add libSiliconPatch if user wants it enabled
|
if needsWinerosettaUpdate {
|
||||||
if !shouldEnableLibSiliconPatch {
|
|
||||||
needsLibSiliconPatchUpdate = false
|
|
||||||
debug.Printf("libSiliconPatch disabled by user preference, will not add to dlls.txt")
|
|
||||||
}
|
|
||||||
|
|
||||||
if needsWinerosettaUpdate || needsLibSiliconPatchUpdate {
|
|
||||||
var fileContentBytes []byte
|
var fileContentBytes []byte
|
||||||
var err error
|
var err error
|
||||||
if utils.PathExists(dllsTextFile) {
|
if utils.PathExists(dllsTextFile) {
|
||||||
@@ -229,12 +197,6 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
debug.Printf("Adding %s to dlls.txt", winerosettaEntry)
|
debug.Printf("Adding %s to dlls.txt", winerosettaEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if needsLibSiliconPatchUpdate && shouldEnableLibSiliconPatch {
|
|
||||||
if !strings.Contains(updatedContent, libSiliconPatchEntry+"\n") {
|
|
||||||
updatedContent += libSiliconPatchEntry + "\n"
|
|
||||||
debug.Printf("Adding %s to dlls.txt", libSiliconPatchEntry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := os.WriteFile(dllsTextFile, []byte(updatedContent), 0644); err != nil {
|
if err := os.WriteFile(dllsTextFile, []byte(updatedContent), 0644); err != nil {
|
||||||
errMsg := fmt.Sprintf("failed to update dlls.txt: %v", err)
|
errMsg := fmt.Sprintf("failed to update dlls.txt: %v", err)
|
||||||
@@ -245,33 +207,6 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If user has disabled libSiliconPatch, make sure it's removed from dlls.txt
|
|
||||||
if !shouldEnableLibSiliconPatch {
|
|
||||||
if err := disableLibSiliconPatchInDlls(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to remove libSiliconPatch from dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always apply vertex animation shaders setting to Config.wtf
|
|
||||||
if err := applyVertexAnimShadersSetting(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to apply vertex animation shaders setting to Config.wtf: %v", err)
|
|
||||||
// Continue with patching even if Config.wtf update fails
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply shadowLOD setting to Config.wtf for FPS optimization
|
|
||||||
// Use shouldEnableShadowLOD which accounts for first-time patching
|
|
||||||
if shouldEnableShadowLOD {
|
|
||||||
if err := applyShadowLODSetting(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to apply shadowLOD setting to Config.wtf: %v", err)
|
|
||||||
// Continue with patching even if Config.wtf update fails
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If user has disabled shadowLOD, make sure it's removed from Config.wtf
|
|
||||||
if err := removeShadowLODSetting(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to remove shadowLOD setting from Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.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)
|
dialog.ShowInformation("Success", "TurtleWoW patching process completed using bundled resources.", myWindow)
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
@@ -339,19 +274,21 @@ func PatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnpatchTurtleWoW(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 TurtleWoW clicked")
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first."), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Files to remove
|
// Files to remove
|
||||||
winerosettaDllPath := filepath.Join(paths.TurtlewowPath, "winerosetta.dll")
|
winerosettaDllPath := filepath.Join(paths.EpochPath, "winerosetta.dll")
|
||||||
d3d9DllPath := filepath.Join(paths.TurtlewowPath, "d3d9.dll")
|
d3d9DllPath := filepath.Join(paths.EpochPath, "d3d9.dll")
|
||||||
libSiliconPatchDllPath := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
libSiliconPatchDllPath := filepath.Join(paths.EpochPath, "libSiliconPatch.dll")
|
||||||
rosettaX87DirPath := filepath.Join(paths.TurtlewowPath, "rosettax87")
|
rosettaX87DirPath := filepath.Join(paths.EpochPath, "rosettax87")
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
dllsTextFile := filepath.Join(paths.EpochPath, "dlls.txt")
|
||||||
|
|
||||||
// Remove the rosettaX87 directory
|
// Remove the rosettaX87 directory
|
||||||
if utils.DirExists(rosettaX87DirPath) {
|
if utils.DirExists(rosettaX87DirPath) {
|
||||||
@@ -410,17 +347,8 @@ func UnpatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove shadowLOD setting from Config.wtf - only if it was applied via graphics settings
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
if prefs.SetShadowLOD0 {
|
|
||||||
if err := removeShadowLODSetting(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to remove shadowLOD setting from Config.wtf: %v", err)
|
|
||||||
// Continue with unpatching even if Config.wtf update fails
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Println("TurtleWoW unpatching completed successfully.")
|
debug.Println("TurtleWoW unpatching completed successfully.")
|
||||||
paths.PatchesAppliedTurtleWoW = false
|
paths.PatchesAppliedEpoch = false
|
||||||
dialog.ShowInformation("Success", "TurtleWoW unpatching process completed.", myWindow)
|
dialog.ShowInformation("Success", "TurtleWoW unpatching process completed.", myWindow)
|
||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
}
|
}
|
||||||
@@ -455,42 +383,6 @@ func UnpatchCrossOver(myWindow fyne.Window, updateAllStatuses func()) {
|
|||||||
updateAllStatuses()
|
updateAllStatuses()
|
||||||
}
|
}
|
||||||
|
|
||||||
// applyShadowLODSetting applies the shadowLOD setting to Config.wtf for FPS optimization
|
|
||||||
func applyShadowLODSetting() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
// Create WTF directory if it doesn't exist
|
|
||||||
wtfDir := filepath.Dir(configPath)
|
|
||||||
if err := os.MkdirAll(wtfDir, 0755); err != nil {
|
|
||||||
return fmt.Errorf("failed to create WTF directory: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var configText string
|
|
||||||
|
|
||||||
// Read existing config if it exists
|
|
||||||
if content, err := os.ReadFile(configPath); err == nil {
|
|
||||||
configText = string(content)
|
|
||||||
} else {
|
|
||||||
debug.Printf("Config.wtf not found, creating new file")
|
|
||||||
configText = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply shadowLOD setting
|
|
||||||
configText = updateOrAddConfigSetting(configText, "shadowLOD", "0")
|
|
||||||
|
|
||||||
// Write the updated config back to file
|
|
||||||
if err := os.WriteFile(configPath, []byte(configText), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to write Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Successfully applied shadowLOD setting to Config.wtf")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// updateOrAddConfigSetting updates an existing setting or adds a new one if it doesn't exist
|
// updateOrAddConfigSetting updates an existing setting or adds a new one if it doesn't exist
|
||||||
func updateOrAddConfigSetting(configText, setting, value string) string {
|
func updateOrAddConfigSetting(configText, setting, value string) string {
|
||||||
// Create regex pattern to match the setting
|
// Create regex pattern to match the setting
|
||||||
@@ -529,27 +421,6 @@ func removeConfigSetting(configText, setting string) string {
|
|||||||
return configText
|
return configText
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckShadowLODSetting checks if the shadowLOD setting is correctly applied in Config.wtf
|
|
||||||
func CheckShadowLODSetting() bool {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := os.ReadFile(configPath)
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
configText := string(content)
|
|
||||||
return isConfigSettingCorrect(configText, "shadowLOD", "0")
|
|
||||||
}
|
|
||||||
|
|
||||||
// isConfigSettingCorrect checks if a specific setting has the correct value in the config text
|
// isConfigSettingCorrect checks if a specific setting has the correct value in the config text
|
||||||
func isConfigSettingCorrect(configText, setting, expectedValue string) bool {
|
func isConfigSettingCorrect(configText, setting, expectedValue string) bool {
|
||||||
// Create regex pattern to match the setting
|
// Create regex pattern to match the setting
|
||||||
@@ -564,365 +435,3 @@ func isConfigSettingCorrect(configText, setting, expectedValue string) bool {
|
|||||||
currentValue := matches[1]
|
currentValue := matches[1]
|
||||||
return currentValue == expectedValue
|
return currentValue == expectedValue
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeShadowLODSetting removes the shadowLOD setting from Config.wtf
|
|
||||||
func removeShadowLODSetting() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
|
||||||
debug.Printf("Config.wtf not found, nothing to remove")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := os.ReadFile(configPath)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to read Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
configText := string(content)
|
|
||||||
|
|
||||||
// Remove shadowLOD setting if it exists
|
|
||||||
pattern := fmt.Sprintf(`SET\s+%s\s+"[^"]*"[\r\n]*`, regexp.QuoteMeta("shadowLOD"))
|
|
||||||
re := regexp.MustCompile(pattern)
|
|
||||||
|
|
||||||
if re.MatchString(configText) {
|
|
||||||
configText = re.ReplaceAllString(configText, "")
|
|
||||||
debug.Printf("Removed shadowLOD setting from Config.wtf")
|
|
||||||
|
|
||||||
// Write the updated config back to file
|
|
||||||
if err := os.WriteFile(configPath, []byte(configText), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to write Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
debug.Printf("Successfully updated Config.wtf")
|
|
||||||
} else {
|
|
||||||
debug.Printf("shadowLOD setting not found in Config.wtf, nothing to remove")
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// applyVertexAnimShadersSetting applies the vertex animation shaders setting to Config.wtf
|
|
||||||
func applyVertexAnimShadersSetting() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
// Create WTF directory if it doesn't exist
|
|
||||||
wtfDir := filepath.Dir(configPath)
|
|
||||||
if err := os.MkdirAll(wtfDir, 0755); err != nil {
|
|
||||||
return fmt.Errorf("failed to create WTF directory: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var configText string
|
|
||||||
|
|
||||||
// Read existing config if it exists
|
|
||||||
if content, err := os.ReadFile(configPath); err == nil {
|
|
||||||
configText = string(content)
|
|
||||||
} else {
|
|
||||||
debug.Printf("Config.wtf not found, creating new file")
|
|
||||||
configText = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply vertex animation shaders setting
|
|
||||||
configText = updateOrAddConfigSetting(configText, "M2UseShaders", "1")
|
|
||||||
|
|
||||||
// Write the updated config back to file
|
|
||||||
if err := os.WriteFile(configPath, []byte(configText), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to write Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Successfully applied vertex animation shaders setting to Config.wtf")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ApplyGraphicsSettings applies the selected graphics settings to Config.wtf
|
|
||||||
func ApplyGraphicsSettings(myWindow fyne.Window) error {
|
|
||||||
prefs, err := utils.LoadPrefs()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to load preferences: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
// Create WTF directory if it doesn't exist
|
|
||||||
wtfDir := filepath.Dir(configPath)
|
|
||||||
if err := os.MkdirAll(wtfDir, 0755); err != nil {
|
|
||||||
return fmt.Errorf("failed to create WTF directory: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var configText string
|
|
||||||
|
|
||||||
// Read existing config if it exists
|
|
||||||
if content, err := os.ReadFile(configPath); err == nil {
|
|
||||||
configText = string(content)
|
|
||||||
} else {
|
|
||||||
debug.Printf("Config.wtf not found, creating new file")
|
|
||||||
configText = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply or remove graphics settings based on user preferences
|
|
||||||
if prefs.ReduceTerrainDistance {
|
|
||||||
configText = updateOrAddConfigSetting(configText, "farclip", "177")
|
|
||||||
} else {
|
|
||||||
configText = removeConfigSetting(configText, "farclip")
|
|
||||||
}
|
|
||||||
|
|
||||||
if prefs.SetMultisampleTo2x {
|
|
||||||
configText = updateOrAddConfigSetting(configText, "gxMultisample", "2")
|
|
||||||
} else {
|
|
||||||
configText = removeConfigSetting(configText, "gxMultisample")
|
|
||||||
}
|
|
||||||
|
|
||||||
if prefs.SetShadowLOD0 {
|
|
||||||
configText = updateOrAddConfigSetting(configText, "shadowLOD", "0")
|
|
||||||
} else {
|
|
||||||
configText = removeConfigSetting(configText, "shadowLOD")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle libSiliconPatch.dll in dlls.txt (only if DLL exists)
|
|
||||||
libSiliconPatchPath := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
|
||||||
if utils.PathExists(libSiliconPatchPath) {
|
|
||||||
if prefs.EnableLibSiliconPatch {
|
|
||||||
if err := enableLibSiliconPatchInDlls(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to enable libSiliconPatch in dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if err := disableLibSiliconPatchInDlls(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to disable libSiliconPatch in dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write the updated config back to file
|
|
||||||
if err := os.WriteFile(configPath, []byte(configText), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to write Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Successfully applied graphics settings to Config.wtf")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckGraphicsSettings checks if the graphics settings are correctly applied in Config.wtf
|
|
||||||
func CheckGraphicsSettings() (bool, bool, bool) {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return false, false, false
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
|
||||||
return false, false, false
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := os.ReadFile(configPath)
|
|
||||||
if err != nil {
|
|
||||||
return false, false, false
|
|
||||||
}
|
|
||||||
|
|
||||||
configText := string(content)
|
|
||||||
|
|
||||||
terrainCorrect := !prefs.ReduceTerrainDistance || isConfigSettingCorrect(configText, "farclip", "177")
|
|
||||||
multisampleCorrect := !prefs.SetMultisampleTo2x || isConfigSettingCorrect(configText, "gxMultisample", "2")
|
|
||||||
shadowCorrect := !prefs.SetShadowLOD0 || isConfigSettingCorrect(configText, "shadowLOD", "0")
|
|
||||||
|
|
||||||
return terrainCorrect, multisampleCorrect, shadowCorrect
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoadGraphicsSettingsFromConfig reads Config.wtf and updates preferences with current settings
|
|
||||||
func LoadGraphicsSettingsFromConfig() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
configPath := filepath.Join(paths.TurtlewowPath, "WTF", "Config.wtf")
|
|
||||||
|
|
||||||
// If Config.wtf doesn't exist, nothing to load
|
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
|
||||||
debug.Printf("Config.wtf not found, using default graphics settings")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := os.ReadFile(configPath)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to read Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
configText := string(content)
|
|
||||||
|
|
||||||
// Load current preferences
|
|
||||||
prefs, err := utils.LoadPrefs()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to load preferences: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check each graphics setting and update preferences
|
|
||||||
prefs.ReduceTerrainDistance = isConfigSettingCorrect(configText, "farclip", "177")
|
|
||||||
prefs.SetMultisampleTo2x = isConfigSettingCorrect(configText, "gxMultisample", "2")
|
|
||||||
prefs.SetShadowLOD0 = isConfigSettingCorrect(configText, "shadowLOD", "0")
|
|
||||||
|
|
||||||
// Check libSiliconPatch status (DLL exists and enabled in dlls.txt)
|
|
||||||
libSiliconPatchPath := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
|
||||||
libSiliconPatchExists := utils.PathExists(libSiliconPatchPath)
|
|
||||||
libSiliconPatchEnabled := false
|
|
||||||
|
|
||||||
if libSiliconPatchExists && utils.PathExists(dllsTextFile) {
|
|
||||||
if dllsContent, err := os.ReadFile(dllsTextFile); err == nil {
|
|
||||||
libSiliconPatchEnabled = strings.Contains(string(dllsContent), "libSiliconPatch.dll")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prefs.EnableLibSiliconPatch = libSiliconPatchExists && libSiliconPatchEnabled
|
|
||||||
|
|
||||||
// Save updated preferences
|
|
||||||
if err := utils.SavePrefs(prefs); err != nil {
|
|
||||||
return fmt.Errorf("failed to save preferences: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Loaded graphics settings from Config.wtf: terrain=%v, multisample=%v, shadow=%v, libSiliconPatch=%v",
|
|
||||||
prefs.ReduceTerrainDistance, prefs.SetMultisampleTo2x, prefs.SetShadowLOD0, prefs.EnableLibSiliconPatch)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckGraphicsSettingsPresence checks if libSiliconPatch.dll exists and shadowLOD is applied, updates preferences accordingly
|
|
||||||
func CheckGraphicsSettingsPresence() {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
libSiliconPatchPath := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
|
||||||
|
|
||||||
// Check if libSiliconPatch.dll exists
|
|
||||||
libSiliconPatchExists := utils.PathExists(libSiliconPatchPath)
|
|
||||||
|
|
||||||
// Check if it's enabled in dlls.txt
|
|
||||||
libSiliconPatchEnabled := false
|
|
||||||
if utils.PathExists(dllsTextFile) {
|
|
||||||
if fileContentBytes, err := os.ReadFile(dllsTextFile); err == nil {
|
|
||||||
fileContent := string(fileContentBytes)
|
|
||||||
libSiliconPatchEnabled = strings.Contains(fileContent, "libSiliconPatch.dll")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if shadowLOD is currently applied
|
|
||||||
shadowLODApplied := CheckShadowLODSetting()
|
|
||||||
|
|
||||||
// Load current preferences
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
|
|
||||||
// Handle libSiliconPatch preference detection
|
|
||||||
if libSiliconPatchExists {
|
|
||||||
if libSiliconPatchEnabled && !prefs.EnableLibSiliconPatch {
|
|
||||||
// DLL is currently enabled but user preference says disabled - likely first run detection
|
|
||||||
prefs.EnableLibSiliconPatch = true
|
|
||||||
debug.Printf("libSiliconPatch detected as enabled, setting user preference to enabled")
|
|
||||||
} else if !libSiliconPatchEnabled && prefs.EnableLibSiliconPatch {
|
|
||||||
// DLL exists but not enabled, user preference says enabled - respect user choice
|
|
||||||
debug.Printf("libSiliconPatch disabled in dlls.txt but user preference is enabled - keeping user preference")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle shadowLOD preference detection - enable by default if currently applied
|
|
||||||
if shadowLODApplied && !prefs.SetShadowLOD0 {
|
|
||||||
// shadowLOD is currently applied but user preference says disabled - likely first run detection
|
|
||||||
prefs.SetShadowLOD0 = true
|
|
||||||
debug.Printf("shadowLOD detected as applied, setting user preference to enabled")
|
|
||||||
} else if !shadowLODApplied && prefs.SetShadowLOD0 {
|
|
||||||
// shadowLOD not applied but user preference says enabled - respect user choice
|
|
||||||
debug.Printf("shadowLOD not applied but user preference is enabled - keeping user preference")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save any changes
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
|
|
||||||
debug.Printf("Graphics settings detection: libSiliconPatch exists=%v, enabled_in_dlls=%v, user_setting=%v; shadowLOD applied=%v, user_setting=%v",
|
|
||||||
libSiliconPatchExists, libSiliconPatchEnabled, prefs.EnableLibSiliconPatch, shadowLODApplied, prefs.SetShadowLOD0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// enableLibSiliconPatchInDlls adds libSiliconPatch.dll to dlls.txt if not present
|
|
||||||
func enableLibSiliconPatchInDlls() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
|
||||||
libSiliconPatchEntry := "libSiliconPatch.dll"
|
|
||||||
|
|
||||||
var fileContentBytes []byte
|
|
||||||
var err error
|
|
||||||
if utils.PathExists(dllsTextFile) {
|
|
||||||
fileContentBytes, err = os.ReadFile(dllsTextFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to read dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
currentContent := string(fileContentBytes)
|
|
||||||
if strings.Contains(currentContent, libSiliconPatchEntry) {
|
|
||||||
debug.Printf("libSiliconPatch.dll already present in dlls.txt")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add libSiliconPatch.dll to dlls.txt
|
|
||||||
if len(currentContent) > 0 && !strings.HasSuffix(currentContent, "\n") {
|
|
||||||
currentContent += "\n"
|
|
||||||
}
|
|
||||||
currentContent += libSiliconPatchEntry + "\n"
|
|
||||||
|
|
||||||
if err := os.WriteFile(dllsTextFile, []byte(currentContent), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to update dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Added libSiliconPatch.dll to dlls.txt")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// disableLibSiliconPatchInDlls removes libSiliconPatch.dll from dlls.txt
|
|
||||||
func disableLibSiliconPatchInDlls() error {
|
|
||||||
if paths.TurtlewowPath == "" {
|
|
||||||
return fmt.Errorf("TurtleWoW path not set")
|
|
||||||
}
|
|
||||||
|
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
|
||||||
|
|
||||||
if !utils.PathExists(dllsTextFile) {
|
|
||||||
debug.Printf("dlls.txt not found, nothing to remove")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
content, err := os.ReadFile(dllsTextFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("failed to read dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
lines := strings.Split(string(content), "\n")
|
|
||||||
filteredLines := make([]string, 0, len(lines))
|
|
||||||
|
|
||||||
for _, line := range lines {
|
|
||||||
trimmedLine := strings.TrimSpace(line)
|
|
||||||
if trimmedLine != "libSiliconPatch.dll" {
|
|
||||||
filteredLines = append(filteredLines, line)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updatedContent := strings.Join(filteredLines, "\n")
|
|
||||||
if err := os.WriteFile(dllsTextFile, []byte(updatedContent), 0644); err != nil {
|
|
||||||
return fmt.Errorf("failed to update dlls.txt: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.Printf("Removed libSiliconPatch.dll from dlls.txt")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
@@ -18,8 +18,8 @@ const DefaultCrossOverPath = "/Applications/CrossOver.app"
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
CrossoverPath string
|
CrossoverPath string
|
||||||
TurtlewowPath string
|
EpochPath string
|
||||||
PatchesAppliedTurtleWoW = false
|
PatchesAppliedEpoch = false
|
||||||
PatchesAppliedCrossOver = false
|
PatchesAppliedCrossOver = false
|
||||||
RosettaX87ServiceRunning = false
|
RosettaX87ServiceRunning = false
|
||||||
ServiceStarting = false
|
ServiceStarting = false
|
||||||
@@ -66,12 +66,12 @@ func SelectTurtleWoWPath(myWindow fyne.Window, turtlewowPathLabel *widget.RichTe
|
|||||||
}
|
}
|
||||||
selectedPath := uri.Path()
|
selectedPath := uri.Path()
|
||||||
if utils.DirExists(selectedPath) {
|
if utils.DirExists(selectedPath) {
|
||||||
TurtlewowPath = selectedPath
|
EpochPath = selectedPath
|
||||||
PatchesAppliedTurtleWoW = false
|
PatchesAppliedEpoch = false
|
||||||
log.Println("TurtleWoW path set to:", TurtlewowPath)
|
log.Println("TurtleWoW path set to:", EpochPath)
|
||||||
// Save to prefs
|
// Save to prefs
|
||||||
prefs, _ := utils.LoadPrefs()
|
prefs, _ := utils.LoadPrefs()
|
||||||
prefs.TurtleWoWPath = selectedPath
|
prefs.EpochPath = selectedPath
|
||||||
utils.SavePrefs(prefs)
|
utils.SavePrefs(prefs)
|
||||||
} else {
|
} else {
|
||||||
dialog.ShowError(fmt.Errorf("invalid selection: '%s' is not a valid directory", selectedPath), myWindow)
|
dialog.ShowError(fmt.Errorf("invalid selection: '%s' is not a valid directory", selectedPath), myWindow)
|
||||||
@@ -89,10 +89,10 @@ func UpdatePathLabels(crossoverPathLabel, turtlewowPathLabel *widget.RichText) {
|
|||||||
}
|
}
|
||||||
crossoverPathLabel.Refresh()
|
crossoverPathLabel.Refresh()
|
||||||
|
|
||||||
if TurtlewowPath == "" {
|
if EpochPath == "" {
|
||||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||||
} else {
|
} else {
|
||||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: TurtlewowPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: EpochPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
||||||
}
|
}
|
||||||
turtlewowPathLabel.Refresh()
|
turtlewowPathLabel.Refresh()
|
||||||
}
|
}
|
||||||
|
@@ -79,12 +79,12 @@ func isRosettaSocketActive() bool {
|
|||||||
func StartRosettaX87Service(myWindow fyne.Window, updateAllStatuses func()) {
|
func StartRosettaX87Service(myWindow fyne.Window, updateAllStatuses func()) {
|
||||||
log.Println("Starting RosettaX87 service...")
|
log.Println("Starting RosettaX87 service...")
|
||||||
|
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first"), myWindow)
|
dialog.ShowError(fmt.Errorf("TurtleWoW path not set. Please set it first"), myWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rosettaX87Dir := filepath.Join(paths.TurtlewowPath, "rosettax87")
|
rosettaX87Dir := filepath.Join(paths.EpochPath, "rosettax87")
|
||||||
rosettaX87Exe := filepath.Join(rosettaX87Dir, "rosettax87")
|
rosettaX87Exe := filepath.Join(rosettaX87Dir, "rosettax87")
|
||||||
|
|
||||||
if !utils.PathExists(rosettaX87Exe) {
|
if !utils.PathExists(rosettaX87Exe) {
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@@ -14,7 +13,6 @@ import (
|
|||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,17 +41,6 @@ func createOptionsComponents() {
|
|||||||
})
|
})
|
||||||
showTerminalCheckbox.SetChecked(prefs.ShowTerminalNormally)
|
showTerminalCheckbox.SetChecked(prefs.ShowTerminalNormally)
|
||||||
|
|
||||||
vanillaTweaksCheckbox = widget.NewCheck("Enable vanilla-tweaks", func(checked bool) {
|
|
||||||
launcher.EnableVanillaTweaks = checked
|
|
||||||
// Save to preferences
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
prefs.EnableVanillaTweaks = checked
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
debug.Printf("Vanilla-tweaks enabled: %v", launcher.EnableVanillaTweaks)
|
|
||||||
})
|
|
||||||
vanillaTweaksCheckbox.SetChecked(prefs.EnableVanillaTweaks)
|
|
||||||
launcher.EnableVanillaTweaks = prefs.EnableVanillaTweaks
|
|
||||||
|
|
||||||
autoDeleteWdbCheckbox = widget.NewCheck("Auto-delete WDB directory on launch", func(checked bool) {
|
autoDeleteWdbCheckbox = widget.NewCheck("Auto-delete WDB directory on launch", func(checked bool) {
|
||||||
launcher.AutoDeleteWdb = checked
|
launcher.AutoDeleteWdb = checked
|
||||||
// Save to preferences
|
// Save to preferences
|
||||||
@@ -65,41 +52,9 @@ func createOptionsComponents() {
|
|||||||
autoDeleteWdbCheckbox.SetChecked(prefs.AutoDeleteWdb)
|
autoDeleteWdbCheckbox.SetChecked(prefs.AutoDeleteWdb)
|
||||||
launcher.AutoDeleteWdb = prefs.AutoDeleteWdb
|
launcher.AutoDeleteWdb = prefs.AutoDeleteWdb
|
||||||
|
|
||||||
// Create recommended settings button with help icon
|
|
||||||
applyRecommendedSettingsButton = widget.NewButton("Apply recommended settings", func() {
|
|
||||||
err := launcher.ApplyRecommendedSettings()
|
|
||||||
if err != nil {
|
|
||||||
debug.Printf("Failed to apply recommended settings: %v", err)
|
|
||||||
// Show error dialog if we have a window reference
|
|
||||||
if currentWindow != nil {
|
|
||||||
dialog.ShowError(fmt.Errorf("failed to apply recommended settings: %v", err), currentWindow)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug.Printf("Successfully applied recommended settings")
|
|
||||||
// Show success dialog if we have a window reference
|
|
||||||
if currentWindow != nil {
|
|
||||||
dialog.ShowInformation("Success", "Recommended graphics settings have been applied", currentWindow)
|
|
||||||
}
|
|
||||||
// Update button state
|
|
||||||
updateRecommendedSettingsButton()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
applyRecommendedSettingsButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Create help button for recommended settings
|
|
||||||
recommendedSettingsHelpButton = widget.NewButton("?", func() {
|
|
||||||
showRecommendedSettingsHelpPopup()
|
|
||||||
})
|
|
||||||
recommendedSettingsHelpButton.Importance = widget.MediumImportance
|
|
||||||
// Initialize button state
|
|
||||||
updateRecommendedSettingsButton()
|
|
||||||
|
|
||||||
// Create Wine registry Option-as-Alt buttons and status
|
// Create Wine registry Option-as-Alt buttons and status
|
||||||
createWineRegistryComponents()
|
createWineRegistryComponents()
|
||||||
|
|
||||||
// Create graphics settings components
|
|
||||||
createGraphicsSettingsComponents()
|
|
||||||
|
|
||||||
// Load environment variables from preferences
|
// Load environment variables from preferences
|
||||||
if prefs.EnvironmentVariables != "" {
|
if prefs.EnvironmentVariables != "" {
|
||||||
launcher.CustomEnvVars = prefs.EnvironmentVariables
|
launcher.CustomEnvVars = prefs.EnvironmentVariables
|
||||||
@@ -120,11 +75,11 @@ func createOptionsComponents() {
|
|||||||
|
|
||||||
// createPatchingButtons creates all patching-related buttons
|
// createPatchingButtons creates all patching-related buttons
|
||||||
func createPatchingButtons(myWindow fyne.Window) {
|
func createPatchingButtons(myWindow fyne.Window) {
|
||||||
patchTurtleWoWButton = widget.NewButton("Patch TurtleWoW", func() {
|
patchTurtleWoWButton = widget.NewButton("Patch Epoch", func() {
|
||||||
patching.PatchTurtleWoW(myWindow, UpdateAllStatuses)
|
patching.PatchEpoch(myWindow, UpdateAllStatuses)
|
||||||
})
|
})
|
||||||
unpatchTurtleWoWButton = widget.NewButton("Unpatch TurtleWoW", func() {
|
unpatchTurtleWoWButton = widget.NewButton("Unpatch Epoch", func() {
|
||||||
patching.UnpatchTurtleWoW(myWindow, UpdateAllStatuses)
|
patching.UnpatchEpoch(myWindow, UpdateAllStatuses)
|
||||||
})
|
})
|
||||||
patchCrossOverButton = widget.NewButton("Patch CrossOver", func() {
|
patchCrossOverButton = widget.NewButton("Patch CrossOver", func() {
|
||||||
patching.PatchCrossOver(myWindow, UpdateAllStatuses)
|
patching.PatchCrossOver(myWindow, UpdateAllStatuses)
|
||||||
@@ -484,187 +439,3 @@ func showRecommendedSettingsHelpPopup() {
|
|||||||
|
|
||||||
helpPopup.Show()
|
helpPopup.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// createGraphicsSettingsComponents creates all graphics settings checkboxes and buttons
|
|
||||||
func createGraphicsSettingsComponents() {
|
|
||||||
// Load preferences for initial values
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
|
|
||||||
// Create Reduce Terrain Distance setting with help button
|
|
||||||
reduceTerrainDistanceCheckbox = widget.NewCheck("", func(checked bool) {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
prefs.ReduceTerrainDistance = checked
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
debug.Printf("Reduce terrain distance: %v", checked)
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
})
|
|
||||||
reduceTerrainDistanceCheckbox.SetChecked(prefs.ReduceTerrainDistance)
|
|
||||||
|
|
||||||
reduceTerrainDistanceHelpButton = widget.NewButton("?", func() {
|
|
||||||
showGraphicsSettingHelpPopup("Reduce Terrain Distance", "Sets the draw distance to the lowest setting. This will drastically increase your FPS", "High Performance Impact")
|
|
||||||
})
|
|
||||||
reduceTerrainDistanceHelpButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Create Set Multisample to 2x setting with help button
|
|
||||||
setMultisampleTo2xCheckbox = widget.NewCheck("", func(checked bool) {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
prefs.SetMultisampleTo2x = checked
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
debug.Printf("Set multisample to 2x: %v", checked)
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
})
|
|
||||||
setMultisampleTo2xCheckbox.SetChecked(prefs.SetMultisampleTo2x)
|
|
||||||
|
|
||||||
setMultisampleTo2xHelpButton = widget.NewButton("?", func() {
|
|
||||||
showGraphicsSettingHelpPopup("Set Multisample to 2x", "Might reduce your FPS slightly on lower end machines, but makes sure the portraits load properly.", "Medium Performance Impact")
|
|
||||||
})
|
|
||||||
setMultisampleTo2xHelpButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Create Set Shadow LOD to 0 setting with help button
|
|
||||||
setShadowLOD0Checkbox = widget.NewCheck("", func(checked bool) {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
prefs.SetShadowLOD0 = checked
|
|
||||||
|
|
||||||
// Track if user manually disabled this setting
|
|
||||||
if !checked {
|
|
||||||
prefs.UserDisabledShadowLOD = true
|
|
||||||
} else {
|
|
||||||
prefs.UserDisabledShadowLOD = false
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
debug.Printf("Set shadow LOD to 0: %v (user manually changed)", checked)
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
})
|
|
||||||
setShadowLOD0Checkbox.SetChecked(prefs.SetShadowLOD0)
|
|
||||||
|
|
||||||
setShadowLOD0HelpButton = widget.NewButton("?", func() {
|
|
||||||
showGraphicsSettingHelpPopup("Set Shadow LOD to 0", "Turns off all shadows. This will give you ~10% more FPS.", "High Performance Impact")
|
|
||||||
})
|
|
||||||
setShadowLOD0HelpButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Create Enable libSiliconPatch setting with help button
|
|
||||||
libSiliconPatchCheckbox = widget.NewCheck("", func(checked bool) {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
prefs.EnableLibSiliconPatch = checked
|
|
||||||
|
|
||||||
// Track if user manually disabled this setting
|
|
||||||
if !checked {
|
|
||||||
prefs.UserDisabledLibSiliconPatch = true
|
|
||||||
} else {
|
|
||||||
prefs.UserDisabledLibSiliconPatch = false
|
|
||||||
}
|
|
||||||
|
|
||||||
utils.SavePrefs(prefs)
|
|
||||||
debug.Printf("Enable libSiliconPatch: %v (user manually changed)", checked)
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
})
|
|
||||||
libSiliconPatchCheckbox.SetChecked(prefs.EnableLibSiliconPatch)
|
|
||||||
|
|
||||||
libSiliconPatchHelpButton = widget.NewButton("?", func() {
|
|
||||||
showGraphicsSettingHelpPopup("Enable libSiliconPatch", "Hooks into the WoW process and replaces slow X87 instructions with SSE2 instructions that Rosetta can translate much quicker, resulting in an increase in FPS (2x or more). May potentially cause graphical bugs.", "Very High Performance Impact")
|
|
||||||
})
|
|
||||||
libSiliconPatchHelpButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
applyGraphicsSettingsButton = widget.NewButton("Apply Graphics Settings", func() {
|
|
||||||
err := patching.ApplyGraphicsSettings(currentWindow)
|
|
||||||
if err != nil {
|
|
||||||
debug.Printf("Failed to apply graphics settings: %v", err)
|
|
||||||
if currentWindow != nil {
|
|
||||||
dialog.ShowError(fmt.Errorf("failed to apply graphics settings: %v", err), currentWindow)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug.Printf("Successfully applied graphics settings")
|
|
||||||
if currentWindow != nil {
|
|
||||||
dialog.ShowInformation("Success", "Graphics settings have been applied", currentWindow)
|
|
||||||
}
|
|
||||||
// Refresh checkboxes to reflect current state
|
|
||||||
refreshGraphicsSettingsCheckboxes()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
applyGraphicsSettingsButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Initialize button state
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
}
|
|
||||||
|
|
||||||
// updateApplyGraphicsSettingsButton updates the state of the apply graphics settings button
|
|
||||||
func updateApplyGraphicsSettingsButton() {
|
|
||||||
if applyGraphicsSettingsButton == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always enable the button since we need to handle both adding and removing settings
|
|
||||||
applyGraphicsSettingsButton.Enable()
|
|
||||||
applyGraphicsSettingsButton.SetText("Apply Changes")
|
|
||||||
}
|
|
||||||
|
|
||||||
// refreshGraphicsSettingsCheckboxes updates the checkbox states from current preferences
|
|
||||||
func refreshGraphicsSettingsCheckboxes() {
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
|
|
||||||
if reduceTerrainDistanceCheckbox != nil {
|
|
||||||
reduceTerrainDistanceCheckbox.SetChecked(prefs.ReduceTerrainDistance)
|
|
||||||
}
|
|
||||||
if setMultisampleTo2xCheckbox != nil {
|
|
||||||
setMultisampleTo2xCheckbox.SetChecked(prefs.SetMultisampleTo2x)
|
|
||||||
}
|
|
||||||
if setShadowLOD0Checkbox != nil {
|
|
||||||
setShadowLOD0Checkbox.SetChecked(prefs.SetShadowLOD0)
|
|
||||||
}
|
|
||||||
if libSiliconPatchCheckbox != nil {
|
|
||||||
libSiliconPatchCheckbox.SetChecked(prefs.EnableLibSiliconPatch)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the apply button state
|
|
||||||
updateApplyGraphicsSettingsButton()
|
|
||||||
}
|
|
||||||
|
|
||||||
// showGraphicsSettingHelpPopup shows a help popup for a specific graphics setting
|
|
||||||
func showGraphicsSettingHelpPopup(title, description, impact string) {
|
|
||||||
if currentWindow == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create help content
|
|
||||||
helpTitle := widget.NewRichTextFromMarkdown("# " + title)
|
|
||||||
|
|
||||||
descriptionLabel := widget.NewLabel(description)
|
|
||||||
descriptionLabel.Wrapping = fyne.TextWrapWord
|
|
||||||
|
|
||||||
impactLabel := widget.NewLabel(impact)
|
|
||||||
impactLabel.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
// Create OK button
|
|
||||||
okButton := widget.NewButton("OK", func() {
|
|
||||||
// This will be set when the popup is created
|
|
||||||
})
|
|
||||||
okButton.Importance = widget.MediumImportance
|
|
||||||
|
|
||||||
// Create help content container
|
|
||||||
helpContentContainer := container.NewVBox(
|
|
||||||
container.NewCenter(helpTitle),
|
|
||||||
widget.NewSeparator(),
|
|
||||||
descriptionLabel,
|
|
||||||
widget.NewSeparator(),
|
|
||||||
impactLabel,
|
|
||||||
widget.NewSeparator(),
|
|
||||||
container.NewCenter(okButton),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Calculate popup size
|
|
||||||
windowSize := currentWindow.Content().Size()
|
|
||||||
popupWidth := windowSize.Width * 2 / 3
|
|
||||||
popupHeight := windowSize.Height / 2
|
|
||||||
|
|
||||||
// Create the help popup
|
|
||||||
helpPopup := widget.NewModalPopUp(container.NewPadded(helpContentContainer), currentWindow.Canvas())
|
|
||||||
helpPopup.Resize(fyne.NewSize(popupWidth, popupHeight))
|
|
||||||
|
|
||||||
// Set the OK button action to hide the help popup
|
|
||||||
okButton.OnTapped = func() {
|
|
||||||
helpPopup.Hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
helpPopup.Show()
|
|
||||||
}
|
|
||||||
|
@@ -64,8 +64,8 @@ func createPathSelectionForm(myWindow fyne.Window) *widget.Form {
|
|||||||
paths.SelectCrossOverPath(myWindow, crossoverPathLabel, UpdateAllStatuses)
|
paths.SelectCrossOverPath(myWindow, crossoverPathLabel, UpdateAllStatuses)
|
||||||
}), crossoverPathLabel)),
|
}), crossoverPathLabel)),
|
||||||
widget.NewFormItem("TurtleWoW Path:", container.NewBorder(nil, nil, nil, widget.NewButton("Set/Change", func() {
|
widget.NewFormItem("TurtleWoW Path:", container.NewBorder(nil, nil, nil, widget.NewButton("Set/Change", func() {
|
||||||
paths.SelectTurtleWoWPath(myWindow, turtlewowPathLabel, UpdateAllStatuses)
|
paths.SelectTurtleWoWPath(myWindow, epochPathLabel, UpdateAllStatuses)
|
||||||
}), turtlewowPathLabel)),
|
}), epochPathLabel)),
|
||||||
)
|
)
|
||||||
|
|
||||||
return pathSelectionForm
|
return pathSelectionForm
|
||||||
@@ -76,7 +76,7 @@ func createPatchOperationsLayout() fyne.CanvasObject {
|
|||||||
patchOperationsLayout := container.NewVBox(
|
patchOperationsLayout := container.NewVBox(
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
container.NewGridWithColumns(4,
|
container.NewGridWithColumns(4,
|
||||||
widget.NewLabel("TurtleWoW Patch:"), turtlewowStatusLabel, patchTurtleWoWButton, unpatchTurtleWoWButton,
|
widget.NewLabel("TurtleWoW Patch:"), epochStatusLabel, patchTurtleWoWButton, unpatchTurtleWoWButton,
|
||||||
),
|
),
|
||||||
container.NewGridWithColumns(4,
|
container.NewGridWithColumns(4,
|
||||||
widget.NewLabel("CrossOver Patch:"), crossoverStatusLabel, patchCrossOverButton, unpatchCrossOverButton,
|
widget.NewLabel("CrossOver Patch:"), crossoverStatusLabel, patchCrossOverButton, unpatchCrossOverButton,
|
||||||
|
@@ -13,8 +13,6 @@ import (
|
|||||||
|
|
||||||
"howett.net/plist"
|
"howett.net/plist"
|
||||||
|
|
||||||
"turtlesilicon/pkg/debug"
|
|
||||||
"turtlesilicon/pkg/patching"
|
|
||||||
"turtlesilicon/pkg/paths"
|
"turtlesilicon/pkg/paths"
|
||||||
"turtlesilicon/pkg/utils"
|
"turtlesilicon/pkg/utils"
|
||||||
)
|
)
|
||||||
@@ -25,17 +23,6 @@ func showOptionsPopup() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check graphics settings presence and update preferences before showing UI
|
|
||||||
patching.CheckGraphicsSettingsPresence()
|
|
||||||
|
|
||||||
// Load graphics settings from Config.wtf and update preferences
|
|
||||||
if err := patching.LoadGraphicsSettingsFromConfig(); err != nil {
|
|
||||||
debug.Printf("Warning: failed to load graphics settings from Config.wtf: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh checkbox states to reflect current settings
|
|
||||||
refreshGraphicsSettingsCheckboxes()
|
|
||||||
|
|
||||||
// Create General tab content
|
// Create General tab content
|
||||||
generalTitle := widget.NewLabel("General Settings")
|
generalTitle := widget.NewLabel("General Settings")
|
||||||
generalTitle.TextStyle = fyne.TextStyle{Bold: true}
|
generalTitle.TextStyle = fyne.TextStyle{Bold: true}
|
||||||
@@ -51,57 +38,6 @@ func showOptionsPopup() {
|
|||||||
container.NewBorder(nil, nil, nil, container.NewHBox(enableOptionAsAltButton, disableOptionAsAltButton), optionAsAltStatusLabel),
|
container.NewBorder(nil, nil, nil, container.NewHBox(enableOptionAsAltButton, disableOptionAsAltButton), optionAsAltStatusLabel),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create Graphics tab content
|
|
||||||
graphicsTitle := widget.NewLabel("Graphics Settings")
|
|
||||||
graphicsTitle.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
graphicsDescription := widget.NewLabel("Select graphics settings to apply to Config.wtf:")
|
|
||||||
graphicsDescription.TextStyle = fyne.TextStyle{Italic: true}
|
|
||||||
|
|
||||||
// Create bold text labels for each setting
|
|
||||||
terrainLabel := widget.NewLabel("Reduce Terrain Distance")
|
|
||||||
terrainLabel.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
multisampleLabel := widget.NewLabel("Set Multisample to 2x")
|
|
||||||
multisampleLabel.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
shadowLabel := widget.NewLabel("Set Shadow LOD to 0")
|
|
||||||
shadowLabel.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
libSiliconPatchLabel := widget.NewLabel("Enable libSiliconPatch")
|
|
||||||
libSiliconPatchLabel.TextStyle = fyne.TextStyle{Bold: true}
|
|
||||||
|
|
||||||
// Create setting rows with help buttons between checkbox and label
|
|
||||||
terrainRow := container.NewHBox(
|
|
||||||
reduceTerrainDistanceCheckbox,
|
|
||||||
reduceTerrainDistanceHelpButton,
|
|
||||||
terrainLabel)
|
|
||||||
multisampleRow := container.NewHBox(
|
|
||||||
setMultisampleTo2xCheckbox,
|
|
||||||
setMultisampleTo2xHelpButton,
|
|
||||||
multisampleLabel)
|
|
||||||
shadowRow := container.NewHBox(
|
|
||||||
setShadowLOD0Checkbox,
|
|
||||||
setShadowLOD0HelpButton,
|
|
||||||
shadowLabel)
|
|
||||||
libSiliconPatchRow := container.NewHBox(
|
|
||||||
libSiliconPatchCheckbox,
|
|
||||||
libSiliconPatchHelpButton,
|
|
||||||
libSiliconPatchLabel)
|
|
||||||
|
|
||||||
graphicsContainer := container.NewVBox(
|
|
||||||
graphicsTitle,
|
|
||||||
widget.NewSeparator(),
|
|
||||||
graphicsDescription,
|
|
||||||
widget.NewSeparator(),
|
|
||||||
terrainRow,
|
|
||||||
multisampleRow,
|
|
||||||
shadowRow,
|
|
||||||
libSiliconPatchRow,
|
|
||||||
widget.NewSeparator(),
|
|
||||||
container.NewCenter(applyGraphicsSettingsButton),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create Environment Variables tab content
|
// Create Environment Variables tab content
|
||||||
envVarsTitle := widget.NewLabel("Environment Variables")
|
envVarsTitle := widget.NewLabel("Environment Variables")
|
||||||
envVarsTitle.TextStyle = fyne.TextStyle{Bold: true}
|
envVarsTitle.TextStyle = fyne.TextStyle{Bold: true}
|
||||||
@@ -114,7 +50,6 @@ func showOptionsPopup() {
|
|||||||
// Create tabs
|
// Create tabs
|
||||||
tabs := container.NewAppTabs(
|
tabs := container.NewAppTabs(
|
||||||
container.NewTabItem("General", container.NewScroll(generalContainer)),
|
container.NewTabItem("General", container.NewScroll(generalContainer)),
|
||||||
container.NewTabItem("Graphics", container.NewScroll(graphicsContainer)),
|
|
||||||
container.NewTabItem("Environment", container.NewScroll(envVarsContainer)),
|
container.NewTabItem("Environment", container.NewScroll(envVarsContainer)),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -223,9 +158,9 @@ func showTroubleshootingPopup() {
|
|||||||
|
|
||||||
// --- Delete WDB Directory ---
|
// --- Delete WDB Directory ---
|
||||||
wdbDeleteButton = widget.NewButton("Delete", func() {
|
wdbDeleteButton = widget.NewButton("Delete", func() {
|
||||||
wdbPath := filepath.Join(paths.TurtlewowPath, "WDB")
|
wdbPath := filepath.Join(paths.EpochPath, "WDB")
|
||||||
if !utils.DirExists(wdbPath) {
|
if !utils.DirExists(wdbPath) {
|
||||||
dialog.ShowInformation("WDB Not Found", "No WDB directory found in your TurtleWoW folder.", currentWindow)
|
dialog.ShowInformation("WDB Not Found", "No WDB directory found in your Epoch folder.", currentWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dialog.NewConfirm("Delete WDB Directory", "Are you sure you want to delete the WDB directory? This will remove all cached data. No important data will be lost.", func(confirm bool) {
|
dialog.NewConfirm("Delete WDB Directory", "Are you sure you want to delete the WDB directory? This will remove all cached data. No important data will be lost.", func(confirm bool) {
|
||||||
@@ -244,7 +179,7 @@ func showTroubleshootingPopup() {
|
|||||||
wineDeleteButton = widget.NewButton("Delete", func() {
|
wineDeleteButton = widget.NewButton("Delete", func() {
|
||||||
homeDir, _ := os.UserHomeDir()
|
homeDir, _ := os.UserHomeDir()
|
||||||
userWine := filepath.Join(homeDir, ".wine")
|
userWine := filepath.Join(homeDir, ".wine")
|
||||||
turtleWine := filepath.Join(paths.TurtlewowPath, ".wine")
|
turtleWine := filepath.Join(paths.EpochPath, ".wine")
|
||||||
msg := "Are you sure you want to delete the following Wine prefixes?\n\n- " + userWine + "\n- " + turtleWine + "\n\nThis cannot be undone."
|
msg := "Are you sure you want to delete the following Wine prefixes?\n\n- " + userWine + "\n- " + turtleWine + "\n\nThis cannot be undone."
|
||||||
dialog.NewConfirm("Delete Wine Prefixes", msg, func(confirm bool) {
|
dialog.NewConfirm("Delete Wine Prefixes", msg, func(confirm bool) {
|
||||||
if confirm {
|
if confirm {
|
||||||
@@ -255,7 +190,7 @@ func showTroubleshootingPopup() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err2 != nil && !os.IsNotExist(err2) {
|
if err2 != nil && !os.IsNotExist(err2) {
|
||||||
dialog.ShowError(fmt.Errorf("Failed to delete TurtleWoW/.wine: %v", err2), currentWindow)
|
dialog.ShowError(fmt.Errorf("Failed to delete Epoch/.wine: %v", err2), currentWindow)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dialog.ShowInformation("Wine Prefixes Deleted", "Wine prefixes deleted successfully.", currentWindow)
|
dialog.ShowInformation("Wine Prefixes Deleted", "Wine prefixes deleted successfully.", currentWindow)
|
||||||
@@ -288,11 +223,11 @@ func showTroubleshootingPopup() {
|
|||||||
troubleshootingCloseButton = widget.NewButton("Close", func() {})
|
troubleshootingCloseButton = widget.NewButton("Close", func() {})
|
||||||
|
|
||||||
popupContent := container.NewBorder(
|
popupContent := container.NewBorder(
|
||||||
nil, // top
|
nil, // top
|
||||||
container.NewCenter(troubleshootingCloseButton), // bottom
|
container.NewCenter(troubleshootingCloseButton), // bottom
|
||||||
nil, // left
|
nil, // left
|
||||||
nil, // right
|
nil, // right
|
||||||
container.NewPadded(scrollContainer), // center
|
container.NewPadded(scrollContainer), // center
|
||||||
)
|
)
|
||||||
|
|
||||||
windowSize := currentWindow.Content().Size()
|
windowSize := currentWindow.Content().Size()
|
||||||
|
@@ -6,7 +6,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"turtlesilicon/pkg/patching"
|
|
||||||
"turtlesilicon/pkg/paths"
|
"turtlesilicon/pkg/paths"
|
||||||
"turtlesilicon/pkg/service"
|
"turtlesilicon/pkg/service"
|
||||||
"turtlesilicon/pkg/utils"
|
"turtlesilicon/pkg/utils"
|
||||||
@@ -23,7 +22,7 @@ var (
|
|||||||
// UpdateAllStatuses updates all UI components based on current application state
|
// UpdateAllStatuses updates all UI components based on current application state
|
||||||
func UpdateAllStatuses() {
|
func UpdateAllStatuses() {
|
||||||
updateCrossoverStatus()
|
updateCrossoverStatus()
|
||||||
updateTurtleWoWStatus()
|
updateEpochStatus()
|
||||||
updatePlayButtonState()
|
updatePlayButtonState()
|
||||||
updateServiceStatus()
|
updateServiceStatus()
|
||||||
|
|
||||||
@@ -76,20 +75,20 @@ func updateCrossoverStatus() {
|
|||||||
crossoverStatusLabel.Refresh()
|
crossoverStatusLabel.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// updateTurtleWoWStatus updates TurtleWoW path and patch status
|
// updateEpochStatus updates TurtleWoW path and patch status
|
||||||
func updateTurtleWoWStatus() {
|
func updateEpochStatus() {
|
||||||
if paths.TurtlewowPath == "" {
|
if paths.EpochPath == "" {
|
||||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
epochPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not set", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||||
paths.PatchesAppliedTurtleWoW = false // Reset if path is cleared
|
paths.PatchesAppliedEpoch = false // Reset if path is cleared
|
||||||
} else {
|
} else {
|
||||||
turtlewowPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: paths.TurtlewowPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
epochPathLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: paths.EpochPath, Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
||||||
|
|
||||||
// Check if all required files exist
|
// Check if all required files exist
|
||||||
winerosettaDllPath := filepath.Join(paths.TurtlewowPath, "winerosetta.dll")
|
winerosettaDllPath := filepath.Join(paths.EpochPath, "winerosetta.dll")
|
||||||
d3d9DllPath := filepath.Join(paths.TurtlewowPath, "d3d9.dll")
|
d3d9DllPath := filepath.Join(paths.EpochPath, "d3d9.dll")
|
||||||
libSiliconPatchDllPath := filepath.Join(paths.TurtlewowPath, "libSiliconPatch.dll")
|
libSiliconPatchDllPath := filepath.Join(paths.EpochPath, "libSiliconPatch.dll")
|
||||||
rosettaX87DirPath := filepath.Join(paths.TurtlewowPath, "rosettax87")
|
rosettaX87DirPath := filepath.Join(paths.EpochPath, "rosettax87")
|
||||||
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
|
dllsTextFile := filepath.Join(paths.EpochPath, "dlls.txt")
|
||||||
rosettaX87ExePath := filepath.Join(rosettaX87DirPath, "rosettax87")
|
rosettaX87ExePath := filepath.Join(rosettaX87DirPath, "rosettax87")
|
||||||
libRuntimeRosettaX87Path := filepath.Join(rosettaX87DirPath, "libRuntimeRosettax87")
|
libRuntimeRosettaX87Path := filepath.Join(rosettaX87DirPath, "libRuntimeRosettax87")
|
||||||
|
|
||||||
@@ -99,13 +98,8 @@ func updateTurtleWoWStatus() {
|
|||||||
contentStr := string(fileContent)
|
contentStr := string(fileContent)
|
||||||
winerosettaPresent := strings.Contains(contentStr, "winerosetta.dll")
|
winerosettaPresent := strings.Contains(contentStr, "winerosetta.dll")
|
||||||
|
|
||||||
// Check if libSiliconPatch should be present based on user preference
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
libSiliconPatchRequired := prefs.EnableLibSiliconPatch
|
|
||||||
libSiliconPatchPresent := strings.Contains(contentStr, "libSiliconPatch.dll")
|
|
||||||
|
|
||||||
// Validate dlls.txt: winerosetta must be present, libSiliconPatch based on setting
|
// Validate dlls.txt: winerosetta must be present, libSiliconPatch based on setting
|
||||||
if winerosettaPresent && (!libSiliconPatchRequired || libSiliconPatchPresent) {
|
if winerosettaPresent {
|
||||||
dllsFileValid = true
|
dllsFileValid = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,29 +108,21 @@ func updateTurtleWoWStatus() {
|
|||||||
// Check if patched files have the correct size (matches bundled versions)
|
// Check if patched files have the correct size (matches bundled versions)
|
||||||
winerosettaDllCorrectSize := utils.CompareFileWithBundledResource(winerosettaDllPath, "winerosetta/winerosetta.dll")
|
winerosettaDllCorrectSize := utils.CompareFileWithBundledResource(winerosettaDllPath, "winerosetta/winerosetta.dll")
|
||||||
d3d9DllCorrectSize := utils.CompareFileWithBundledResource(d3d9DllPath, "winerosetta/d3d9.dll")
|
d3d9DllCorrectSize := utils.CompareFileWithBundledResource(d3d9DllPath, "winerosetta/d3d9.dll")
|
||||||
libSiliconPatchCorrectSize := utils.CompareFileWithBundledResource(libSiliconPatchDllPath, "winerosetta/libSiliconPatch.dll")
|
|
||||||
rosettaX87CorrectSize := utils.CompareFileWithBundledResource(rosettaX87ExePath, "rosettax87/rosettax87")
|
rosettaX87CorrectSize := utils.CompareFileWithBundledResource(rosettaX87ExePath, "rosettax87/rosettax87")
|
||||||
libRuntimeRosettaX87CorrectSize := utils.CompareFileWithBundledResource(libRuntimeRosettaX87Path, "rosettax87/libRuntimeRosettax87")
|
libRuntimeRosettaX87CorrectSize := utils.CompareFileWithBundledResource(libRuntimeRosettaX87Path, "rosettax87/libRuntimeRosettax87")
|
||||||
|
|
||||||
// Check if shadowLOD setting is applied (only if user has enabled it in graphics settings)
|
|
||||||
prefs, _ := utils.LoadPrefs()
|
|
||||||
shadowLODRequiredAndApplied := true // Default to true if not required
|
|
||||||
if prefs.SetShadowLOD0 {
|
|
||||||
shadowLODRequiredAndApplied = patching.CheckShadowLODSetting()
|
|
||||||
}
|
|
||||||
|
|
||||||
if utils.PathExists(winerosettaDllPath) && utils.PathExists(d3d9DllPath) && utils.PathExists(libSiliconPatchDllPath) &&
|
if utils.PathExists(winerosettaDllPath) && utils.PathExists(d3d9DllPath) && utils.PathExists(libSiliconPatchDllPath) &&
|
||||||
utils.DirExists(rosettaX87DirPath) && utils.PathExists(rosettaX87ExePath) &&
|
utils.DirExists(rosettaX87DirPath) && utils.PathExists(rosettaX87ExePath) &&
|
||||||
utils.PathExists(libRuntimeRosettaX87Path) && dllsFileValid &&
|
utils.PathExists(libRuntimeRosettaX87Path) && dllsFileValid &&
|
||||||
winerosettaDllCorrectSize && d3d9DllCorrectSize && libSiliconPatchCorrectSize &&
|
winerosettaDllCorrectSize && d3d9DllCorrectSize &&
|
||||||
rosettaX87CorrectSize && libRuntimeRosettaX87CorrectSize && shadowLODRequiredAndApplied {
|
rosettaX87CorrectSize && libRuntimeRosettaX87CorrectSize {
|
||||||
paths.PatchesAppliedTurtleWoW = true
|
paths.PatchesAppliedEpoch = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
turtlewowPathLabel.Refresh()
|
epochPathLabel.Refresh()
|
||||||
|
|
||||||
if paths.PatchesAppliedTurtleWoW {
|
if paths.PatchesAppliedEpoch {
|
||||||
turtlewowStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Patched", Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
epochStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Patched", Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}}
|
||||||
if patchTurtleWoWButton != nil {
|
if patchTurtleWoWButton != nil {
|
||||||
patchTurtleWoWButton.Disable()
|
patchTurtleWoWButton.Disable()
|
||||||
}
|
}
|
||||||
@@ -144,9 +130,9 @@ func updateTurtleWoWStatus() {
|
|||||||
unpatchTurtleWoWButton.Enable()
|
unpatchTurtleWoWButton.Enable()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
turtlewowStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not patched", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
epochStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Not patched", Style: widget.RichTextStyle{ColorName: theme.ColorNameError}}}
|
||||||
if patchTurtleWoWButton != nil {
|
if patchTurtleWoWButton != nil {
|
||||||
if paths.TurtlewowPath != "" {
|
if paths.EpochPath != "" {
|
||||||
patchTurtleWoWButton.Enable()
|
patchTurtleWoWButton.Enable()
|
||||||
} else {
|
} else {
|
||||||
patchTurtleWoWButton.Disable()
|
patchTurtleWoWButton.Disable()
|
||||||
@@ -156,13 +142,13 @@ func updateTurtleWoWStatus() {
|
|||||||
unpatchTurtleWoWButton.Disable()
|
unpatchTurtleWoWButton.Disable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
turtlewowStatusLabel.Refresh()
|
epochStatusLabel.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// updatePlayButtonState enables/disables play and launch buttons based on current state
|
// updatePlayButtonState enables/disables play and launch buttons based on current state
|
||||||
func updatePlayButtonState() {
|
func updatePlayButtonState() {
|
||||||
launchEnabled := paths.PatchesAppliedTurtleWoW && paths.PatchesAppliedCrossOver &&
|
launchEnabled := paths.PatchesAppliedEpoch && paths.PatchesAppliedCrossOver &&
|
||||||
paths.TurtlewowPath != "" && paths.CrossoverPath != "" && service.IsServiceRunning()
|
paths.EpochPath != "" && paths.CrossoverPath != "" && service.IsServiceRunning()
|
||||||
|
|
||||||
if launchButton != nil {
|
if launchButton != nil {
|
||||||
if launchEnabled {
|
if launchEnabled {
|
||||||
@@ -239,7 +225,7 @@ func updateServiceStatus() {
|
|||||||
serviceStatusLabel.Refresh()
|
serviceStatusLabel.Refresh()
|
||||||
}
|
}
|
||||||
if startServiceButton != nil {
|
if startServiceButton != nil {
|
||||||
if paths.TurtlewowPath != "" && paths.PatchesAppliedTurtleWoW {
|
if paths.EpochPath != "" && paths.PatchesAppliedEpoch {
|
||||||
startServiceButton.Enable()
|
startServiceButton.Enable()
|
||||||
} else {
|
} else {
|
||||||
startServiceButton.Disable()
|
startServiceButton.Disable()
|
||||||
|
22
pkg/ui/ui.go
22
pkg/ui/ui.go
@@ -1,8 +1,6 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"turtlesilicon/pkg/debug"
|
|
||||||
"turtlesilicon/pkg/patching"
|
|
||||||
"turtlesilicon/pkg/paths"
|
"turtlesilicon/pkg/paths"
|
||||||
"turtlesilicon/pkg/utils"
|
"turtlesilicon/pkg/utils"
|
||||||
|
|
||||||
@@ -14,15 +12,15 @@ import (
|
|||||||
func CreateUI(myWindow fyne.Window) fyne.CanvasObject {
|
func CreateUI(myWindow fyne.Window) fyne.CanvasObject {
|
||||||
// Initialize UI component variables
|
// Initialize UI component variables
|
||||||
crossoverPathLabel = widget.NewRichText()
|
crossoverPathLabel = widget.NewRichText()
|
||||||
turtlewowPathLabel = widget.NewRichText()
|
epochPathLabel = widget.NewRichText()
|
||||||
turtlewowStatusLabel = widget.NewRichText()
|
epochStatusLabel = widget.NewRichText()
|
||||||
crossoverStatusLabel = widget.NewRichText()
|
crossoverStatusLabel = widget.NewRichText()
|
||||||
serviceStatusLabel = widget.NewRichText()
|
serviceStatusLabel = widget.NewRichText()
|
||||||
|
|
||||||
// Load saved paths from prefs
|
// Load saved paths from prefs
|
||||||
prefs, _ := utils.LoadPrefs()
|
prefs, _ := utils.LoadPrefs()
|
||||||
if prefs.TurtleWoWPath != "" {
|
if prefs.EpochPath != "" {
|
||||||
paths.TurtlewowPath = prefs.TurtleWoWPath
|
paths.EpochPath = prefs.EpochPath
|
||||||
}
|
}
|
||||||
if prefs.CrossOverPath != "" {
|
if prefs.CrossOverPath != "" {
|
||||||
paths.CrossoverPath = prefs.CrossOverPath
|
paths.CrossoverPath = prefs.CrossOverPath
|
||||||
@@ -37,18 +35,6 @@ func CreateUI(myWindow fyne.Window) fyne.CanvasObject {
|
|||||||
// Check default CrossOver path
|
// Check default CrossOver path
|
||||||
paths.CheckDefaultCrossOverPath()
|
paths.CheckDefaultCrossOverPath()
|
||||||
|
|
||||||
// Check graphics settings presence and set default state
|
|
||||||
patching.CheckGraphicsSettingsPresence()
|
|
||||||
|
|
||||||
// Load graphics settings from Config.wtf and update UI
|
|
||||||
if err := patching.LoadGraphicsSettingsFromConfig(); err != nil {
|
|
||||||
// Log error but continue - this is not critical for app startup
|
|
||||||
debug.Printf("Warning: failed to load graphics settings from Config.wtf: %v", err)
|
|
||||||
} else {
|
|
||||||
// Refresh checkbox states to reflect loaded settings
|
|
||||||
refreshGraphicsSettingsCheckboxes()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create header, main content and bottom bar
|
// Create header, main content and bottom bar
|
||||||
headerContent := createHeaderContainer()
|
headerContent := createHeaderContainer()
|
||||||
mainContent := createMainContent(myWindow)
|
mainContent := createMainContent(myWindow)
|
||||||
|
@@ -11,8 +11,8 @@ import (
|
|||||||
var (
|
var (
|
||||||
// Status labels
|
// Status labels
|
||||||
crossoverPathLabel *widget.RichText
|
crossoverPathLabel *widget.RichText
|
||||||
turtlewowPathLabel *widget.RichText
|
epochPathLabel *widget.RichText
|
||||||
turtlewowStatusLabel *widget.RichText
|
epochStatusLabel *widget.RichText
|
||||||
crossoverStatusLabel *widget.RichText
|
crossoverStatusLabel *widget.RichText
|
||||||
serviceStatusLabel *widget.RichText
|
serviceStatusLabel *widget.RichText
|
||||||
|
|
||||||
|
@@ -8,25 +8,14 @@ import (
|
|||||||
|
|
||||||
type UserPrefs struct {
|
type UserPrefs struct {
|
||||||
SuppressedUpdateVersion string `json:"suppressed_update_version"`
|
SuppressedUpdateVersion string `json:"suppressed_update_version"`
|
||||||
TurtleWoWPath string `json:"turtlewow_path"`
|
EpochPath string `json:"epoch_path"`
|
||||||
CrossOverPath string `json:"crossover_path"`
|
CrossOverPath string `json:"crossover_path"`
|
||||||
EnvironmentVariables string `json:"environment_variables"`
|
EnvironmentVariables string `json:"environment_variables"`
|
||||||
SaveSudoPassword bool `json:"save_sudo_password"`
|
SaveSudoPassword bool `json:"save_sudo_password"`
|
||||||
ShowTerminalNormally bool `json:"show_terminal_normally"`
|
ShowTerminalNormally bool `json:"show_terminal_normally"`
|
||||||
EnableVanillaTweaks bool `json:"enable_vanilla_tweaks"`
|
|
||||||
RemapOptionAsAlt bool `json:"remap_option_as_alt"`
|
RemapOptionAsAlt bool `json:"remap_option_as_alt"`
|
||||||
AutoDeleteWdb bool `json:"auto_delete_wdb"`
|
AutoDeleteWdb bool `json:"auto_delete_wdb"`
|
||||||
EnableMetalHud bool `json:"enable_metal_hud"`
|
EnableMetalHud bool `json:"enable_metal_hud"`
|
||||||
|
|
||||||
// Graphics settings
|
|
||||||
ReduceTerrainDistance bool `json:"reduce_terrain_distance"`
|
|
||||||
SetMultisampleTo2x bool `json:"set_multisample_to_2x"`
|
|
||||||
SetShadowLOD0 bool `json:"set_shadow_lod_0"`
|
|
||||||
EnableLibSiliconPatch bool `json:"enable_lib_silicon_patch"`
|
|
||||||
|
|
||||||
// Tracking whether user has manually disabled these settings
|
|
||||||
UserDisabledShadowLOD bool `json:"user_disabled_shadow_lod"`
|
|
||||||
UserDisabledLibSiliconPatch bool `json:"user_disabled_lib_silicon_patch"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPrefsPath() (string, error) {
|
func getPrefsPath() (string, error) {
|
||||||
|
Reference in New Issue
Block a user