Epochify (#1)

Make it work for Epoch!

Reviewed-on: #1
This commit is contained in:
2025-07-22 20:47:04 +00:00
parent 488d10cb8b
commit 0967834f6b
30 changed files with 412 additions and 1446 deletions

View File

@@ -13,10 +13,8 @@ import (
"howett.net/plist"
"turtlesilicon/pkg/debug"
"turtlesilicon/pkg/patching"
"turtlesilicon/pkg/paths"
"turtlesilicon/pkg/utils"
"epochsilicon/pkg/paths"
"epochsilicon/pkg/utils"
)
// showOptionsPopup creates and shows an integrated popup window for options
@@ -25,17 +23,6 @@ func showOptionsPopup() {
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
generalTitle := widget.NewLabel("General Settings")
generalTitle.TextStyle = fyne.TextStyle{Bold: true}
@@ -45,63 +32,11 @@ func showOptionsPopup() {
widget.NewSeparator(),
metalHudCheckbox,
showTerminalCheckbox,
vanillaTweaksCheckbox,
autoDeleteWdbCheckbox,
widget.NewSeparator(),
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
envVarsTitle := widget.NewLabel("Environment Variables")
envVarsTitle.TextStyle = fyne.TextStyle{Bold: true}
@@ -114,7 +49,6 @@ func showOptionsPopup() {
// Create tabs
tabs := container.NewAppTabs(
container.NewTabItem("General", container.NewScroll(generalContainer)),
container.NewTabItem("Graphics", container.NewScroll(graphicsContainer)),
container.NewTabItem("Environment", container.NewScroll(envVarsContainer)),
)
@@ -223,9 +157,9 @@ func showTroubleshootingPopup() {
// --- Delete WDB Directory ---
wdbDeleteButton = widget.NewButton("Delete", func() {
wdbPath := filepath.Join(paths.TurtlewowPath, "WDB")
wdbPath := filepath.Join(paths.EpochPath, "WDB")
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
}
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 +178,7 @@ func showTroubleshootingPopup() {
wineDeleteButton = widget.NewButton("Delete", func() {
homeDir, _ := os.UserHomeDir()
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."
dialog.NewConfirm("Delete Wine Prefixes", msg, func(confirm bool) {
if confirm {
@@ -255,7 +189,7 @@ func showTroubleshootingPopup() {
return
}
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
}
dialog.ShowInformation("Wine Prefixes Deleted", "Wine prefixes deleted successfully.", currentWindow)
@@ -268,8 +202,8 @@ func showTroubleshootingPopup() {
rowCrossover := container.NewBorder(nil, nil, widget.NewLabel("CrossOver version:"), crossoverStatusShort, nil)
rowWDB := container.NewBorder(nil, nil, widget.NewLabel("Delete WDB directory (cache):"), wdbDeleteButton, nil)
rowWine := container.NewBorder(nil, nil, widget.NewLabel("Delete Wine prefixes (~/.wine & TurtleWoW/.wine):"), wineDeleteButton, nil)
appMgmtNote := widget.NewLabel("Please ensure TurtleSilicon is enabled in System Settings > Privacy & Security > App Management.")
rowWine := container.NewBorder(nil, nil, widget.NewLabel("Delete Wine prefixes (~/.wine & Epoch/.wine):"), wineDeleteButton, nil)
appMgmtNote := widget.NewLabel("Please ensure EpochSilicon is enabled in System Settings > Privacy & Security > App Management.")
appMgmtNote.Wrapping = fyne.TextWrapWord
appMgmtNote.TextStyle = fyne.TextStyle{Italic: true}
@@ -288,11 +222,11 @@ func showTroubleshootingPopup() {
troubleshootingCloseButton = widget.NewButton("Close", func() {})
popupContent := container.NewBorder(
nil, // top
nil, // top
container.NewCenter(troubleshootingCloseButton), // bottom
nil, // left
nil, // right
container.NewPadded(scrollContainer), // center
nil, // left
nil, // right
container.NewPadded(scrollContainer), // center
)
windowSize := currentWindow.Content().Size()