Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heroic update progress bar shows incorrect percentage which doesnt match with legendary's percentage #4190

Open
RoguedBear opened this issue Dec 20, 2024 · 6 comments · May be fixed by #4240
Labels
bug:unconfirmed Someone works on identifying the issue

Comments

@RoguedBear
Copy link

Describe the bug

I was updating fortnite and noticed that the progress bar was stuck at 90% since half hour.

I went ahead and inspected the legendary logs and found the percentage to be vastly different from the one shown in ui. (this is shown in my screenshot down below where i paused the update and screenshotted the last entry which corresponds with what is displayed in the ui)

I tried to look into why this could be when other metrics are exactly the same as displayed in logs but different for percentage and found this snippet in the following file:

// calculate percentage
if (progress.bytes !== '') {
const downloaded = parseFloat(progress.bytes)
const downloadCache = totalDownloadSize - currentDownloadSize[appName]
const totalDownloaded = downloaded + downloadCache
const newPercent =
Math.round((totalDownloaded / totalDownloadSize) * 10000) / 100
progress.percent = newPercent >= 0 ? newPercent : undefined
}

this is in function onInstallOrUpdateOutput, and from what it appears looking through rest of the code, we are parsing all other metrics such as download speed, eta, disk write speed, downloaded bytes, etc, directly from the logs, but for percentage for some reason it is being calculated in the code only.

I am not sure what is wrong with the calculation here, but I do think if we are parsing all other metrics from legendary itself, we should also parse the progress from the log rather than calculating ourselves as the legendary binary would have a better context and calculation for the correct progress, reducing the effort done on heroic side.

Add logs

< logs added as attachment as there are more than 2k lines and 12k lines for heroic & legendary respectively >

Steps to reproduce

  1. put a game on update
  2. the progress starts from ~80% (see logs)
  3. compare with legendary logs
  4. you will see a mismatch between progress reported by heroic & legendary, with legendary one being more correct

Expected behavior

the percentage value should match exactly what is outputted from legendary

Screenshots

image_2024-12-21_02-14-52

Heroic Version

Latest Stable

System Information

System Information:
CPU: 12x 13th Gen Intel(R) Core(TM) i5-13420H
Memory: 16.89 GB (used: 8.61 GB)
GPUs:
  GPU 0:
    Name: Intel Corporation Raptor Lake-P [UHD Graphics]
    IDs: D=a7a8 V=8086 SD=3c90 SV=17aa
    Driver: 31.0.101.4255
OS: Microsoft Windows 11 Home Single Language 10.0.22631 (win32)

The current system is not a Steam Deck
We are not running inside a Flatpak container

Software Versions:
  Heroic: 2.15.2 Emeth
  Legendary: 0.20.34 Direct Intervention
  gogdl: 1.1.2
  comet: comet 0.1.2

  Nile: 1.1.2 Will A. Zeppeli

Additional information

log files which corroborate the same:
2024-12-20T19_41_48-heroic.log

2024-12-20T19_41_48-legendary.log

@RoguedBear RoguedBear added the bug:unconfirmed Someone works on identifying the issue label Dec 20, 2024
@RoguedBear RoguedBear changed the title Legendary update progress bar shows incorrect percentage Heroic update progress bar shows incorrect percentage which doesnt match with legendary's percentage Dec 20, 2024
@RoguedBear
Copy link
Author

If the bug is confirmed and if it is alright, i would be willing to open a PR to fix this

@RoguedBear
Copy link
Author

I was checking this issue again and traced the percentage calculation was added in PR: #1256 specifically in this commit: 223b915 by @arielj

looking at the intent now behind the calculation which is to take in to account already downloaded stuff in case the update is paused/resumed again, I'm confused if this issue would be considered valid.

on one hand, the calculation should take into account only the remaining update download size instead of total game size already downloaded, since the percentage is for the update only

on the other, this feels misleading as i was assuming the update is 90% done, which is not correct as only a few gbs were downloaded of the 15GB update, but in the context of overall progress it makes sense


example of perspective:

I am taking rocket league as an example here which i have not updated since ages, and as per legendary logs the update size is 5.5GB
image

when I press update, legendary's percentage bar is 0% meanwhile heroic shows 81%

image

so it is confusing as seeing 81%, one would think the update is 81% downloaded when that is not the case

basically the difference in perspective of saying if 81% done is:

  • 81% of 5GB update that is is downloaded
  • or 81% of 28GB game that is downloaded

@Etaash-mathamsetty
Copy link
Member

a contribution to fix this would be welcome :)

@RoguedBear
Copy link
Author

a contribution to fix this would be welcome :)

great! i have one question though before I get started:

  • should I only make the change to read legendary's progress bar
  • or apart from above point should I also make it possible to report the remaining download size to the UI?

@Etaash-mathamsetty
Copy link
Member

a contribution to fix this would be welcome :)

great! i have one question though before I get started:

* should I only make the change to read legendary's progress bar

* or apart from above point should I also make it possible to report the remaining download size to the UI?

you probably don't have to change much. I'll just do some quick math here:

current code:
percentage = (downloaded/total) * 100
instead just do:
percentage = (downloaded-initial_downloaded)/(total-inital_downloaded) * 100

@RoguedBear
Copy link
Author

oh damn. this is much cleaner! Thanks for the tip. I'll work on this on the weekends if that's alright.

would it be possible for you to assign this issue to me?

@RoguedBear RoguedBear linked a pull request Jan 4, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:unconfirmed Someone works on identifying the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants