fixed gofmt

This commit is contained in:
aomizu
2025-07-10 13:40:23 +09:00
parent 9fd6ca731c
commit 3da12d20d7
5 changed files with 38 additions and 38 deletions

View File

@@ -159,11 +159,11 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
// Check user's preference for libSiliconPatch and shadowLOD
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
@@ -172,7 +172,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
// Enable by default and update preferences
prefs.EnableLibSiliconPatch = true
}
if prefs.UserDisabledShadowLOD {
shouldEnableShadowLOD = false
debug.Printf("shadowLOD disabled by user choice")
@@ -180,7 +180,7 @@ func PatchTurtleWoW(myWindow fyne.Window, updateAllStatuses func()) {
// Enable by default and update preferences
prefs.SetShadowLOD0 = true
}
// Save updated preferences
utils.SavePrefs(prefs)
@@ -676,13 +676,13 @@ func ApplyGraphicsSettings(myWindow fyne.Window) error {
} 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 {
@@ -715,7 +715,7 @@ func ApplyGraphicsSettings(myWindow fyne.Window) error {
// 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
}
@@ -732,7 +732,7 @@ func CheckGraphicsSettings() (bool, bool, bool) {
}
configText := string(content)
terrainCorrect := !prefs.ReduceTerrainDistance || isConfigSettingCorrect(configText, "farclip", "177")
multisampleCorrect := !prefs.SetMultisampleTo2x || isConfigSettingCorrect(configText, "gxMultisample", "2")
shadowCorrect := !prefs.SetShadowLOD0 || isConfigSettingCorrect(configText, "shadowLOD", "0")
@@ -771,13 +771,13 @@ func LoadGraphicsSettingsFromConfig() error {
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")
@@ -790,7 +790,7 @@ func LoadGraphicsSettingsFromConfig() error {
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",
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
@@ -804,10 +804,10 @@ func CheckGraphicsSettingsPresence() {
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) {
@@ -816,13 +816,13 @@ func CheckGraphicsSettingsPresence() {
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 {
@@ -834,7 +834,7 @@ func CheckGraphicsSettingsPresence() {
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
@@ -844,11 +844,11 @@ func CheckGraphicsSettingsPresence() {
// 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",
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)
}
@@ -897,7 +897,7 @@ func disableLibSiliconPatchInDlls() error {
}
dllsTextFile := filepath.Join(paths.TurtlewowPath, "dlls.txt")
if !utils.PathExists(dllsTextFile) {
debug.Printf("dlls.txt not found, nothing to remove")
return nil

View File

@@ -98,12 +98,12 @@ func updateTurtleWoWStatus() {
if fileContent, err := os.ReadFile(dllsTextFile); err == nil {
contentStr := string(fileContent)
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
if winerosettaPresent && (!libSiliconPatchRequired || libSiliconPatchPresent) {
dllsFileValid = true

View File

@@ -2,8 +2,8 @@ package ui
import (
"turtlesilicon/pkg/debug"
"turtlesilicon/pkg/paths"
"turtlesilicon/pkg/patching"
"turtlesilicon/pkg/paths"
"turtlesilicon/pkg/utils"
"fyne.io/fyne/v2"

View File

@@ -46,12 +46,12 @@ var (
envVarsEntry *widget.Entry
// Graphics settings checkboxes
reduceTerrainDistanceCheckbox *widget.Check
setMultisampleTo2xCheckbox *widget.Check
setShadowLOD0Checkbox *widget.Check
libSiliconPatchCheckbox *widget.Check
applyGraphicsSettingsButton *widget.Button
reduceTerrainDistanceCheckbox *widget.Check
setMultisampleTo2xCheckbox *widget.Check
setShadowLOD0Checkbox *widget.Check
libSiliconPatchCheckbox *widget.Check
applyGraphicsSettingsButton *widget.Button
// Graphics settings help buttons
reduceTerrainDistanceHelpButton *widget.Button
setMultisampleTo2xHelpButton *widget.Button

View File

@@ -16,16 +16,16 @@ type UserPrefs struct {
EnableVanillaTweaks bool `json:"enable_vanilla_tweaks"`
RemapOptionAsAlt bool `json:"remap_option_as_alt"`
AutoDeleteWdb bool `json:"auto_delete_wdb"`
// 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"`
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"`
UserDisabledShadowLOD bool `json:"user_disabled_shadow_lod"`
UserDisabledLibSiliconPatch bool `json:"user_disabled_lib_silicon_patch"`
}
func getPrefsPath() (string, error) {