diff --git a/EpochSilicon.app/Contents/Info.plist b/EpochSilicon.app/Contents/Info.plist index 838e7a8..85c9743 100644 --- a/EpochSilicon.app/Contents/Info.plist +++ b/EpochSilicon.app/Contents/Info.plist @@ -17,7 +17,7 @@ MacOSX CFBundleVersion - 91 + 99 NSHighResolutionCapable NSSupportsAutomaticGraphicsSwitching diff --git a/FyneApp.toml b/FyneApp.toml index b3079f5..f14931c 100644 --- a/FyneApp.toml +++ b/FyneApp.toml @@ -3,4 +3,4 @@ Name = "EpochSilicon" ID = "com.eburk.epochsilicon" Version = "1.2.4" - Build = 92 + Build = 100 diff --git a/pkg/patching/patching.go b/pkg/patching/patching.go index a3585be..57f76f1 100644 --- a/pkg/patching/patching.go +++ b/pkg/patching/patching.go @@ -201,17 +201,30 @@ func PatchEpoch(myWindow fyne.Window, updateAllStatuses func()) { } debug.Println("Downloading updates from Project Epoch servers.") - stats, err := epoch.Update(paths.EpochPath, true, true, false) - if err != nil { - errMsg := fmt.Sprintf("failed to update Epoch files: %v", err) - dialog.ShowError(errors.New(errMsg), myWindow) - log.Println(errMsg) - } - log.Printf("Successfully updated %d Epoch files", stats.Updated) - debug.Println("Epoch patching with bundled resources completed successfully.") - - dialog.ShowInformation("Success", "Epoch patching process completed.", myWindow) + // TODO: Change from dialog to pulsing animation + dialog.ShowInformation("Downloading patches", "Downloading patches for Project Epoch, this will take some time. Please wait until the status changes to \"Patched\"", myWindow) + paths.DownloadingPatches = true + go func() { + stats, err := epoch.Update(paths.EpochPath, true, true, false) + if err != nil { + errMsg := fmt.Sprintf("failed to update Epoch files: %v", err) + fyne.Do(func() { + dialog.ShowError(errors.New(errMsg), myWindow) + }) + paths.DownloadingPatches = false + log.Println(errMsg) + } + log.Printf("Successfully updated %d Epoch files", stats.Updated) + debug.Println("Epoch patching with bundled resources completed successfully.") + fyne.Do(func() { + dialog.ShowInformation("Success", "Epoch patching process completed.", myWindow) + }) + fyne.DoAndWait(func() { + paths.DownloadingPatches = false + updateAllStatuses() + }) + }() updateAllStatuses() } diff --git a/pkg/paths/paths.go b/pkg/paths/paths.go index 8cdd39c..b3380c9 100644 --- a/pkg/paths/paths.go +++ b/pkg/paths/paths.go @@ -23,6 +23,7 @@ var ( PatchesAppliedCrossOver = false RosettaX87ServiceRunning = false ServiceStarting = false + DownloadingPatches = false ) func SelectCrossOverPath(myWindow fyne.Window, crossoverPathLabel *widget.RichText, updateAllStatuses func()) { diff --git a/pkg/ui/layout.go b/pkg/ui/layout.go index 6fb8f3c..1b753f9 100644 --- a/pkg/ui/layout.go +++ b/pkg/ui/layout.go @@ -63,7 +63,7 @@ func createPathSelectionForm(myWindow fyne.Window) *widget.Form { widget.NewFormItem("CrossOver Path:", container.NewBorder(nil, nil, nil, widget.NewButton("Set/Change", func() { paths.SelectCrossOverPath(myWindow, crossoverPathLabel, UpdateAllStatuses) }), crossoverPathLabel)), - widget.NewFormItem("Epoch Path:", container.NewBorder(nil, nil, nil, widget.NewButton("Set/Change", func() { + widget.NewFormItem("Warcraft Path:", container.NewBorder(nil, nil, nil, widget.NewButton("Set/Change", func() { paths.SelectEpochPath(myWindow, epochPathLabel, UpdateAllStatuses) }), epochPathLabel)), ) diff --git a/pkg/ui/status.go b/pkg/ui/status.go index 642c463..693a525 100644 --- a/pkg/ui/status.go +++ b/pkg/ui/status.go @@ -106,6 +106,17 @@ func updateEpochStatus() { } } + // Check for Epoch-specific files + epochPatchesApplied := false + stats, err := epoch.Update(paths.EpochPath, false, true, true) + if err != nil { + debug.Printf("Failed to get download Epoch patches: %v", err) + } + if stats.Outdated == 0 { + debug.Println("Nothing is outdated") + epochPatchesApplied = true + } + // Check if patched files have the correct size (matches bundled versions) winerosettaDllCorrectSize := utils.CompareFileWithBundledResource(winerosettaDllPath, "winerosetta/winerosetta.dll") d3d9DllCorrectSize := utils.CompareFileWithBundledResource(d3d9DllPath, "winerosetta/d3d9.dll") @@ -116,24 +127,22 @@ func updateEpochStatus() { utils.DirExists(rosettaX87DirPath) && utils.PathExists(rosettaX87ExePath) && utils.PathExists(libRuntimeRosettaX87Path) && dllsFileValid && winerosettaDllCorrectSize && d3d9DllCorrectSize && - rosettaX87CorrectSize && libRuntimeRosettaX87CorrectSize { + rosettaX87CorrectSize && libRuntimeRosettaX87CorrectSize && epochPatchesApplied { paths.PatchesAppliedEpoch = true } - // Check for Epoch-specific files, set PatchesAppliedEpoch to false if not updated - stats, err := epoch.Update(paths.EpochPath, false, true, true) - if err != nil { - paths.PatchesAppliedEpoch = false - debug.Printf("Failed to get download Epoch patches: %v", err) - } - if stats.Outdated > 0 { - paths.PatchesAppliedEpoch = false - } } epochPathLabel.Refresh() - - if paths.PatchesAppliedEpoch { + if paths.DownloadingPatches { + epochStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Downloading...", Style: widget.RichTextStyle{ColorName: theme.ColorNamePrimary}}} + if patchEpochButton != nil { + patchEpochButton.Disable() + } + if unpatchEpochButton != nil { + unpatchEpochButton.Disable() + } + } else if paths.PatchesAppliedEpoch { epochStatusLabel.Segments = []widget.RichTextSegment{&widget.TextSegment{Text: "Patched", Style: widget.RichTextStyle{ColorName: theme.ColorNameSuccess}}} if patchEpochButton != nil { patchEpochButton.Disable()