functional
Some checks failed
Build Go/Fyne App for macOS ARM64 / build (pull_request) Has been cancelled
Some checks failed
Build Go/Fyne App for macOS ARM64 / build (pull_request) Has been cancelled
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@ var (
|
||||
PatchesAppliedCrossOver = false
|
||||
RosettaX87ServiceRunning = false
|
||||
ServiceStarting = false
|
||||
DownloadingPatches = false
|
||||
)
|
||||
|
||||
func SelectCrossOverPath(myWindow fyne.Window, crossoverPathLabel *widget.RichText, updateAllStatuses func()) {
|
||||
|
@@ -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)),
|
||||
)
|
||||
|
@@ -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()
|
||||
|
Reference in New Issue
Block a user